Mercurial > hg > index.cgi
annotate extra/gcc6809lw-4.6.4-3.patch @ 409:c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
An updated version of the gcc6809 patch is provided. This update removes
some incompatible syntax left over from the original gcc6809 patch that used
as6809. It was doing something that doesn't work with lwtools anyway.
Namely, trying to use the assembler to set the layout used by the linker.
Now thats all back to front when you think about it.
With this update, it is now possible to use the "as" wrapper with
--pragma=newsource enabled and be able to pass assembly code through the C
preprocessor without worrying about extraneous spaces causing problems.
author | William Astle <lost@l-w.ca> |
---|---|
date | Thu, 03 Mar 2016 22:33:40 -0700 |
parents | |
children |
rev | line source |
---|---|
409
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1 diff -urN gcc-4.6.4-clean/config.sub gcc-4.6.4/config.sub |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2 --- gcc-4.6.4-clean/config.sub 2010-05-25 07:22:07.000000000 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3 +++ gcc-4.6.4/config.sub 2015-07-20 19:44:52.766843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4 @@ -313,7 +313,7 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5 c6x) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6 basic_machine=tic6x-unknown |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7 ;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8 - m6811 | m68hc11 | m6812 | m68hc12 | picochip) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
9 + m6809 | m6811 | m68hc11 | m6812 | m68hc12 | picochip) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
10 # Motorola 68HC11/12. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
11 basic_machine=$basic_machine-unknown |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
12 os=-none |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
13 @@ -354,7 +354,7 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
14 | i*86-* | i860-* | i960-* | ia64-* \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
15 | ip2k-* | iq2000-* \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
16 | lm32-* \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
17 - | m32c-* | m32r-* | m32rle-* \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
18 + | m32c-* | m32r-* | m32rle-* | m6809-* \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
19 | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
20 | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
21 | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
22 @@ -509,6 +509,10 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
23 basic_machine=arm-unknown |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
24 os=-cegcc |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
25 ;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
26 + coco) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
27 + basic_machine=coco |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
28 + os=-none |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
29 + ;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
30 convex-c1) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
31 basic_machine=c1-convex |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
32 os=-bsd |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
33 diff -urN gcc-4.6.4-clean/configure gcc-4.6.4/configure |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
34 --- gcc-4.6.4-clean/configure 2011-12-18 03:03:44.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
35 +++ gcc-4.6.4/configure 2015-07-20 19:44:52.766843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
36 @@ -3439,6 +3439,9 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
37 m32r-*-*) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
38 noconfigdirs="$noconfigdirs ${libgcj}" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
39 ;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
40 + m6809*) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
41 + noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 target-libgloss ${libgcj}" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
42 + ;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
43 m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
44 noconfigdirs="$noconfigdirs target-libstdc++-v3 ${libgcj}" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
45 libgloss_dir=m68hc11 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
46 diff -urN gcc-4.6.4-clean/configure.ac gcc-4.6.4/configure.ac |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
47 --- gcc-4.6.4-clean/configure.ac 2011-11-18 04:45:44.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
48 +++ gcc-4.6.4/configure.ac 2015-07-20 19:44:52.766843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
49 @@ -885,6 +885,9 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
50 m32r-*-*) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
51 noconfigdirs="$noconfigdirs ${libgcj}" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
52 ;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
53 + m6809*) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
54 + noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 target-libgloss ${libgcj}" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
55 + ;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
56 m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
57 noconfigdirs="$noconfigdirs target-libstdc++-v3 ${libgcj}" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
58 libgloss_dir=m68hc11 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
59 diff -urN gcc-4.6.4-clean/gcc/calls.c gcc-4.6.4/gcc/calls.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
60 --- gcc-4.6.4-clean/gcc/calls.c 2012-02-09 10:27:25.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
61 +++ gcc-4.6.4/gcc/calls.c 2015-07-20 19:44:52.766843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
62 @@ -2561,7 +2561,7 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
63 call sequence. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
64 Also do the adjustments before a throwing call, otherwise |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
65 exception handling can fail; PR 19225. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
66 - if (pending_stack_adjust >= 32 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
67 + if (pending_stack_adjust >= 8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
68 || (pending_stack_adjust > 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
69 && (flags & ECF_MAY_BE_ALLOCA)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
70 || (pending_stack_adjust > 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
71 diff -urN gcc-4.6.4-clean/gcc/config/m6809/crt0.S gcc-4.6.4/gcc/config/m6809/crt0.S |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
72 --- gcc-4.6.4-clean/gcc/config/m6809/crt0.S 1969-12-31 17:00:00.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
73 +++ gcc-4.6.4/gcc/config/m6809/crt0.S 2015-07-20 19:44:52.766843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
74 @@ -0,0 +1,173 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
75 +;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
76 +;;; Copyright 2006, 2007, 2008, 2009 by Brian Dominy <brian@oddchange.com> |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
77 +;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
78 +;;; This file is part of GCC. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
79 +;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
80 +;;; GCC is free software; you can redistribute it and/or modify |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
81 +;;; it under the terms of the GNU General Public License as published by |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
82 +;;; the Free Software Foundation; either version 3, or (at your option) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
83 +;;; any later version. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
84 +;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
85 +;;; GCC is distributed in the hope that it will be useful, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
86 +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
87 +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
88 +;;; GNU General Public License for more details. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
89 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
90 +;;; You should have received a copy of the GNU General Public License |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
91 +;;; along with GCC; see the file COPYING3. If not see |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
92 +;;; <http://www.gnu.org/licenses/>. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
93 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
94 + /* Declare external for main() */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
95 + .globl _main |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
96 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
97 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
98 +/* The startup is heavily dependent on the type of machine and |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
99 +OS environment that is available at the start point. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
100 +For the most part, the general idea is the same across machines, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
101 +but the implementation is vastly different. This is managed via |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
102 +conditional compiles throughout the startup code for each of the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
103 +supported machines. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
104 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
105 +#ifdef TARGET_COCO /* CoCo memory map */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
106 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
107 +#define COCO_RAMROM_MODE 0xFFDE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
108 +#define COCO_ALLRAM_MODE 0xFFDF |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
109 +#define COCO_PAGE1 0xFFD5 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
110 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
111 +/* SAM M1 and M0 adjusts the memory size */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
112 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
113 +#define BASIC_WARMSTART_FLAG 0x0071 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
114 +#define BASIC_START 0xA027 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
115 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
116 +#define __STACK_TOP 0x6800 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
117 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
118 +#else /* Simulator (default) memory map */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
119 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
120 +#define SIM_EXIT_REG 0xFF01 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
121 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
122 +#define __STACK_TOP 0xFE00 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
123 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
124 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
125 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
126 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
127 + .area .data |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
128 + .area .ctors |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
129 + .area .dtors |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
130 + .area .bss |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
131 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
132 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
133 + ;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
134 + ;;; __exit : Exit point from the program |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
135 + ;;; For simulation, this writes to a special I/O register that |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
136 + ;;; the simulator interprets as end-of-program. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
137 + ;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
138 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
139 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
140 + .globl __exit |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
141 +__exit: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
142 +#ifdef TARGET_COCO |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
143 + ;; Go back to ROM/RAM mode |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
144 + sta COCO_RAMROM_MODE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
145 + clr BASIC_WARMSTART_FLAG |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
146 + jmp BASIC_START |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
147 +#else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
148 + tfr x,d |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
149 + stb SIM_EXIT_REG |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
150 + bra __exit |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
151 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
152 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
153 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
154 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
155 + ;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
156 + ;;; __start : Entry point to the program |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
157 + ;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
158 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
159 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
160 + .globl __start |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
161 +__start: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
162 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
163 +#ifdef HAVE_DIRECT |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
164 + ;; Initialize the direct page pointer |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
165 + lda #<s_.direct |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
166 + tfr a,dp |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
167 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
168 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
169 +#ifdef TARGET_COCO |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
170 + ;; Turn off interrupts |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
171 + orcc #(0x10|0x40) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
172 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
173 + ;; Setup All RAM Mode |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
174 + sta COCO_ALLRAM_MODE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
175 +#endif /* TARGET_COCO */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
176 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
177 + ;; Initialize the stack |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
178 + lds #__STACK_TOP - 2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
179 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
180 + ;; Call any "initializer" functions |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
181 + ldu #s_.ctors |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
182 +__ctors_loop: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
183 + ldy ,u++ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
184 + cmpy #0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
185 + beq __ctors_done |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
186 + jsr ,y |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
187 + bra __ctors_loop |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
188 +__ctors_done: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
189 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
190 + ;; Enable interrupts on the simulator |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
191 +#ifndef TARGET_COCO |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
192 + andcc #~(0x10|0x40) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
193 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
194 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
195 + ;; Set up the environment |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
196 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
197 + ;; Set up argc/argv arrays |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
198 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
199 + ;; Call the main function. The exit code will |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
200 + ;; be returned in the X register, unless compiled |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
201 + ;; with -mdret, in which case it comes back in D. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
202 + jsr _main |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
203 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
204 + ;; Call any finalizer functions |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
205 + ldu #s_.dtors |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
206 +__dtors_loop: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
207 + ldy ,u++ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
208 + cmpy #0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
209 + beq __dtors_done |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
210 + jsr ,y |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
211 + bra __dtors_loop |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
212 +__dtors_done: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
213 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
214 + ;; If main returns, then invoke _exit() to stop the program |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
215 + ;; The C library doesn't support -mdret yet, so move the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
216 + ;; argument first. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
217 +#ifdef __DRET__ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
218 + tfr d,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
219 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
220 + jmp _exit |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
221 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
222 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
223 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
224 + ;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
225 + ;;; __crt0_vector : Default handler for interrupts |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
226 + ;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
227 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
228 +___crt0_vector: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
229 + ;; The default behavior is to simply ignore all |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
230 + ;; non-reset interrupts. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
231 + rti |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
232 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
233 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
234 + ;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
235 + ;;; vector : The interrupt vector table |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
236 + ;;; The linker will ensure that this gets loaded at address 0xFFF0. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
237 + ;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
238 + .area vector |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
239 +vectors: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
240 + .word ___crt0_vector |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
241 + .word ___crt0_vector |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
242 + .word ___crt0_vector |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
243 + .word ___crt0_vector |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
244 + .word ___crt0_vector |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
245 + .word ___crt0_vector |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
246 + .word ___crt0_vector |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
247 + .word __start |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
248 diff -urN gcc-4.6.4-clean/gcc/config/m6809/libgcc1.s gcc-4.6.4/gcc/config/m6809/libgcc1.s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
249 --- gcc-4.6.4-clean/gcc/config/m6809/libgcc1.s 1969-12-31 17:00:00.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
250 +++ gcc-4.6.4/gcc/config/m6809/libgcc1.s 2015-07-20 19:44:52.766843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
251 @@ -0,0 +1,511 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
252 +/* libgcc routines for m6809 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
253 + Copyright (C) 2006 Free Software Foundation, Inc. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
254 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
255 +This file is part of GCC. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
256 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
257 +GCC is free software; you can redistribute it and/or modify |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
258 +it under the terms of the GNU General Public License as published by |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
259 +the Free Software Foundation; either version 3, or (at your option) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
260 +any later version. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
261 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
262 +GCC is distributed in the hope that it will be useful, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
263 +but WITHOUT ANY WARRANTY; without even the implied warranty of |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
264 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
265 +GNU General Public License for more details. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
266 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
267 +You should have received a copy of the GNU General Public License |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
268 +along with GCC; see the file COPYING3. If not see |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
269 +<http://www.gnu.org/licenses/>. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
270 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
271 +/* As a special exception, if you link this library with other files, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
272 + some of which are compiled with GCC, to produce an executable, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
273 + this library does not by itself cause the resulting executable |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
274 + to be covered by the GNU General Public License. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
275 + This exception does not however invalidate any other reasons why |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
276 + the executable file might be covered by the GNU General Public License. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
277 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
278 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
279 +#define SIGFPE jmp _abort |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
280 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
281 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
282 + ; Shift functions |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
283 + ; On input, D is value to be shifted, and X has shift count. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
284 + ; Result is also in D. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
285 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
286 +#ifdef L_ashlhi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
287 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
288 + .globl _ashlhi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
289 +_ashlhi3: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
290 + pshs x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
291 +1$: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
292 + leax -1,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
293 + cmpx #-1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
294 + beq 2$ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
295 + aslb |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
296 + rola |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
297 + bra 1$ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
298 +2$: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
299 + puls x,pc |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
300 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
301 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
302 +#ifdef L_ashrhi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
303 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
304 + .globl _ashrhi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
305 +_ashrhi3: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
306 + pshs x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
307 +1$: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
308 + leax -1,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
309 + cmpx #-1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
310 + beq 2$ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
311 + asra |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
312 + rorb |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
313 + bra 1$ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
314 +2$: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
315 + puls x,pc |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
316 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
317 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
318 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
319 +#ifdef L_lshrhi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
320 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
321 + .globl _lshrhi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
322 +_lshrhi3: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
323 + pshs x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
324 +1$: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
325 + leax -1,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
326 + cmpx #-1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
327 + beq 2$ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
328 + lsra |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
329 + rorb |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
330 + bra 1$ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
331 +2$: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
332 + puls x,pc |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
333 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
334 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
335 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
336 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
337 +#ifdef L_softregs |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
338 + .area direct |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
339 + .globl m0, m1, m2, m3, m4, m5, m6, m7 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
340 + .globl m8, m9, m10, m11, m12, m13, m14, m15 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
341 +m0: .blkb 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
342 +m1: .blkb 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
343 +m2: .blkb 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
344 +m3: .blkb 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
345 +m4: .blkb 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
346 +m5: .blkb 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
347 +m6: .blkb 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
348 +m7: .blkb 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
349 +m8: .blkb 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
350 +m9: .blkb 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
351 +m10: .blkb 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
352 +m11: .blkb 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
353 +m12: .blkb 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
354 +m13: .blkb 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
355 +m14: .blkb 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
356 +m15: .blkb 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
357 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
358 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
359 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
360 +#ifdef L_ashlsi3_one |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
361 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
362 + .globl _ashlsi3_one |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
363 +_ashlsi3_one: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
364 + asl 3,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
365 + rol 2,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
366 + rol 1,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
367 + rol ,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
368 + rts |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
369 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
370 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
371 +#ifdef L_ashlsi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
372 + /* X points to the SImode (source/dest) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
373 + B is the count */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
374 +_ashlsi3: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
375 + pshs u |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
376 + cmpb #16 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
377 + blt try8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
378 + subb #16 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
379 + ; Shift by 16 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
380 + ldu 2,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
381 + stu ,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
382 +try8: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
383 + cmpb #8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
384 + blt try_rest |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
385 + subb #8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
386 + ; Shift by 8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
387 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
388 +try_rest: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
389 + tstb |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
390 + beq done |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
391 +do_rest: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
392 + ; Shift by 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
393 + asl 3,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
394 + rol 2,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
395 + rol 1,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
396 + rol ,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
397 + decb |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
398 + bne do_rest |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
399 +done: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
400 + puls u,pc |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
401 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
402 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
403 +#ifdef L_ashrsi3_one |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
404 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
405 + .globl _ashlsi3_one |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
406 +_ashrsi3_one: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
407 + asr ,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
408 + ror 1,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
409 + ror 2,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
410 + ror 3,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
411 + rts |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
412 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
413 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
414 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
415 +#ifdef L_lshrsi3_one |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
416 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
417 + .globl _lshrsi3_one |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
418 +_lshrsi3_one: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
419 + lsr ,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
420 + ror 1,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
421 + ror 2,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
422 + ror 3,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
423 + rts |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
424 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
425 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
426 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
427 +#ifdef L_clzsi2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
428 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
429 + .globl ___clzhi2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
430 + ; Input: X = 16-bit unsigned integer |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
431 + ; Output: X = number of leading zeros |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
432 + ; This function destroys the value in D. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
433 +___clzhi2: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
434 + pshs x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
435 + ; Find the offset of the leftmost '1' bit in |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
436 + ; the left half of the word. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
437 + ; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
438 + ; Bits are numbered in the table with 1 meaning the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
439 + ; LSB and 8 meaning the MSB. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
440 + ; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
441 + ; If nonzero, then clz is 8-a. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
442 + tfr x,d |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
443 + ldx #___clz_tab |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
444 + tfr a,b |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
445 + clra |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
446 + ldb d,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
447 + bne upper_bit_set |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
448 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
449 +lower_bit_set: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
450 + ; If the upper byte is zero, then check the lower |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
451 + ; half of the word. Return 16-a. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
452 + puls d |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
453 + clra |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
454 + ldb d,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
455 + negb |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
456 + addb #16 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
457 + bra done |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
458 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
459 +upper_bit_set: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
460 + negb |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
461 + addb #8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
462 + puls x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
463 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
464 +done: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
465 + tfr d,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
466 + puls pc |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
467 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
468 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
469 +#ifdef L_clzdi2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
470 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
471 + .globl ___clzsi2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
472 + ; Input: 32-bit unsigned integer is on the stack, just |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
473 + ; above the return address |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
474 + ; Output: X = number of leading zeros |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
475 +___clzsi2: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
476 + ; Check the upper 16-bit word |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
477 + ; If it is not zero, then return clzhi2(X). |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
478 + ; A branch can be used instead of a call since no |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
479 + ; postprocessing is needed. Use long branch form |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
480 + ; though since functions may not be near each other. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
481 + ldx 2,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
482 + lbne ___clzhi2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
483 + ldx 4,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
484 + jsr ___clzhi2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
485 + leax 16,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
486 + rts |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
487 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
488 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
489 +#ifdef L_ctzsi2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
490 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
491 + .globl ___ctzhi2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
492 + ; Input: X = 16-bit unsigned integer |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
493 + ; Output: X = number of trailing zeros |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
494 + ; F(x) = 15 - clzhi2(X & -x) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
495 + ; This function destroys the value in D. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
496 +___ctzhi2: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
497 + tfr x,d |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
498 + coma |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
499 + comb |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
500 + addd #1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
501 + pshs a |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
502 + pshs b |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
503 + tfr x,d |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
504 + andb ,s+ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
505 + anda ,s+ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
506 + tfr d,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
507 + jsr ___clzhi2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
508 + tfr x,d |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
509 + subd #16 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
510 + coma |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
511 + comb |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
512 + tfr d,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
513 + rts |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
514 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
515 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
516 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
517 +#ifdef L_ctzdi2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
518 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
519 + .globl ___ctzsi2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
520 + ; Input: 32-bit unsigned integer is on the stack, just |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
521 + ; above the return address |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
522 + ; Output: X = number of leading zeros |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
523 +___ctzsi2: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
524 + ; Check the lower 16-bit word |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
525 + ; If it is not zero, then return ctzhi2(X). |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
526 + ; A branch can be used instead of a call since no |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
527 + ; postprocessing is needed. Use long branch form |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
528 + ; though since functions may not be near each other. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
529 + ldx 4,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
530 + lbne ___ctzhi2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
531 + ldx 2,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
532 + jsr ___ctzhi2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
533 + leax 16,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
534 + rts |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
535 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
536 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
537 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
538 +#ifdef L_mulhi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
539 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
540 +;;; ___mulhi3 - signed/unsigned multiply |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
541 +;;; Called by GCC to implement 16x16 multiplication |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
542 +;;; Arguments: Two 16-bit values, one in stack, one in X. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
543 +;;; Result: 16-bit result in X |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
544 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
545 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
546 + .globl _mulhi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
547 +_mulhi3: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
548 + pshs x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
549 + lda 5,s ; left msb * right lsb * 256 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
550 + ldb ,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
551 + mul |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
552 + tfr b,a |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
553 + clrb |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
554 + tfr d,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
555 + ldb 1,s ; left lsb * right msb * 256 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
556 + lda 4,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
557 + mul |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
558 + tfr b,a |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
559 + clrb |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
560 + leax d,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
561 + ldb 1,s ; left lsb * right lsb |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
562 + lda 5,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
563 + mul |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
564 + leax d,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
565 + puls d,pc ; kill D to remove initial push |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
566 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
567 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
568 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
569 +#ifdef L_divhi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
570 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
571 +;;; ___divhi3 - signed division |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
572 +;;; Arguments: Dividend in X, divisor on the stack |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
573 +;;; Returns result in X. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
574 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
575 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
576 + .globl _divhi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
577 +_divhi3: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
578 + ldd 2,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
579 + bne do_div ; check dividend |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
580 + SIGFPE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
581 +do_div: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
582 + pshs x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
583 + jsr _seuclid |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
584 + puls x,pc |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
585 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
586 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
587 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
588 +#ifdef L_modhi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
589 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
590 +;;; ___modhi3 - signed modulo |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
591 +;;; Arguments: Dividend in X, divisor on the stack |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
592 +;;; Returns result in X. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
593 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
594 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
595 + .globl _modhi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
596 +_modhi3: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
597 + ldd 2,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
598 + bne do_mod ; check dividend |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
599 + SIGFPE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
600 +do_mod: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
601 + pshs x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
602 + jsr _seuclid |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
603 + leas 2,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
604 + tfr d,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
605 + rts |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
606 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
607 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
608 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
609 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
610 +#ifdef L_udivhi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
611 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
612 +;;; ___udivhi3 - unsigned division |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
613 +;;; Arguments: Dividend in X, divisor on the stack |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
614 +;;; Returns result in X. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
615 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
616 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
617 + .globl _udivhi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
618 +_udivhi3: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
619 + ldd 2,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
620 + bne do_udiv ; check dividend |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
621 + SIGFPE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
622 +do_udiv: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
623 + pshs x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
624 + jsr _euclid |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
625 + puls x,pc |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
626 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
627 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
628 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
629 +#ifdef L_umodhi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
630 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
631 +;;; ___umodhi3 - unsigned modulo |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
632 +;;; Arguments: Dividend in X, divisor on the stack |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
633 +;;; Returns result in X. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
634 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
635 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
636 + .globl _umodhi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
637 +_umodhi3: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
638 + ldd 2,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
639 + bne do_umod ; check dividend |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
640 + SIGFPE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
641 +do_umod: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
642 + pshs x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
643 + jsr _euclid |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
644 + leas 2,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
645 + tfr d,x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
646 + rts |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
647 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
648 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
649 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
650 +#ifdef L_euclid |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
651 +; unsigned euclidean division |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
652 +; calling: (left / right) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
653 +; push left |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
654 +; ldd right |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
655 +; jsr _euclid |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
656 +; quotient on the stack (left) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
657 +; modulus in d |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
658 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
659 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
660 + .globl _euclid |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
661 + left=5 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
662 + right=1 ; word |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
663 + count=0 ; byte |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
664 + CARRY=1 ; alias |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
665 +_euclid: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
666 + leas -3,s ; 2 local variables |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
667 + clr count,s ; prescale divisor |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
668 + inc count,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
669 + tsta |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
670 +presc: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
671 + bmi presc_done |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
672 + inc count,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
673 + aslb |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
674 + rola |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
675 + bra presc |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
676 +presc_done: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
677 + std right,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
678 + ldd left,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
679 + clr left,s ; quotient = 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
680 + clr left+1,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
681 +mod1: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
682 + subd right,s ; check subtract |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
683 + bcc mod2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
684 + addd right,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
685 + andcc #~CARRY |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
686 + bra mod3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
687 +mod2: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
688 + orcc #CARRY |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
689 +mod3: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
690 + rol left+1,s ; roll in carry |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
691 + rol left,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
692 + lsr right,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
693 + ror right+1,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
694 + dec count,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
695 + bne mod1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
696 + leas 3,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
697 + rts |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
698 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
699 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
700 +#ifdef L_seuclid |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
701 +; signed euclidean division |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
702 +; calling: (left / right) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
703 +; push left |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
704 +; ldd right |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
705 +; jsr _seuclid |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
706 +; quotient on the stack (left) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
707 +; modulus in d |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
708 + .area .text |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
709 + .globl _seuclid |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
710 + left=6 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
711 + right=2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
712 + quot_sign=1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
713 + mod_sign=0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
714 +_seuclid: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
715 + leas -4,s ; 3 local variables |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
716 + std right,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
717 + clr mod_sign,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
718 + clr quot_sign,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
719 + ldd left,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
720 + bge mod_abs |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
721 + inc mod_sign,s ; sign(mod) = sign(left) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
722 + inc quot_sign,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
723 + bsr negd ; abs(left) -> D |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
724 +mod_abs: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
725 + pshs b,a ; push abs(left) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
726 + ldd right+2,s ; all references shifted by 2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
727 + bge quot_abs |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
728 + dec quot_sign+2,s ; sign(quot) = sign(left) XOR sign(right) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
729 + bsr negd ; abs(right) -> D |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
730 +quot_abs: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
731 + jsr _euclid ; call (unsigned) euclidean division |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
732 + std right+2,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
733 + puls a,b ; quot -> D |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
734 + tst quot_sign,s ; all references no longer shifted |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
735 + beq quot_done |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
736 + bsr negd |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
737 +quot_done: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
738 + std left,s ; quot -> left |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
739 + ldd right,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
740 + tst mod_sign,s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
741 + beq mod_done |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
742 + bsr negd |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
743 +mod_done: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
744 + leas 4,s ; destroy stack frame |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
745 + rts |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
746 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
747 +negd: ; self-explanatory ! |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
748 + nega |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
749 + negb |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
750 + sbca #0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
751 + rts |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
752 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
753 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
754 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
755 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
756 +#ifdef L_pending_addsi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
757 +_addsi3: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
758 + rts |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
759 +#endif /* L_pending_addsi3 */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
760 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
761 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
762 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
763 diff -urN gcc-4.6.4-clean/gcc/config/m6809/m6809.c gcc-4.6.4/gcc/config/m6809/m6809.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
764 --- gcc-4.6.4-clean/gcc/config/m6809/m6809.c 1969-12-31 17:00:00.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
765 +++ gcc-4.6.4/gcc/config/m6809/m6809.c 2015-07-20 22:11:37.726714746 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
766 @@ -0,0 +1,3023 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
767 +/*------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
768 + FILE: m6809.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
769 +-------------------------------------------------------------------*/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
770 +/* Subroutines for insn-output.c for MC6809. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
771 + Copyright (C) 1989-2007 Free Software Foundation, Inc. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
772 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
773 + MC6809 Version by Tom Jones (jones@sal.wisc.edu) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
774 + Space Astronomy Laboratory |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
775 + University of Wisconsin at Madison |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
776 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
777 + minor changes to adapt it to gcc-2.5.8 by Matthias Doerfel |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
778 + ( msdoerfe@informatik.uni-erlangen.de ) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
779 + also added #pragma interrupt (inspired by gcc-6811) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
780 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
781 + minor changes to adapt it to gcc-2.8.0 by Eric Botcazou |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
782 + (ebotcazou@multimania.com) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
783 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
784 + minor changes to adapt it to gcc-2.95.3 by Eric Botcazou |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
785 + (ebotcazou@multimania.com) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
786 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
787 + major cleanup, improvements, and upgrade to gcc 3.4 by Brian Dominy |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
788 + (brian@oddchange.com) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
789 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
790 + additional adjustments, etc., for gcc 4.6.1 by William Astle (lost@l-w.ca) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
791 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
792 +This file is part of GCC. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
793 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
794 +GCC is free software; you can redistribute it and/or modify |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
795 +it under the terms of the GNU General Public License as published by |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
796 +the Free Software Foundation; either version 3, or (at your option) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
797 +any later version. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
798 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
799 +GCC is distributed in the hope that it will be useful, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
800 +but WITHOUT ANY WARRANTY; without even the implied warranty of |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
801 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
802 +GNU General Public License for more details. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
803 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
804 +You should have received a copy of the GNU General Public License |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
805 +along with GCC; see the file COPYING3. If not see |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
806 +<http://www.gnu.org/licenses/>. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
807 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
808 +#include <string.h> |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
809 +#include <time.h> |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
810 +#include <sys/types.h> |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
811 +#include <sys/timeb.h> |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
812 +#include <stdio.h> |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
813 +#include "config.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
814 +#include "system.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
815 +#include "coretypes.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
816 +#include "tm.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
817 +#include "tree.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
818 +#include "rtl.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
819 +#include "tm_p.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
820 +#include "regs.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
821 +#include "flags.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
822 +#include "hard-reg-set.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
823 +#include "real.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
824 +#include "tree.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
825 +#include "insn-config.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
826 +#include "conditions.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
827 +#include "insn-flags.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
828 +#include "output.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
829 +#include "insn-attr.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
830 +#include "function.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
831 +#include "target.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
832 +#include "target-def.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
833 +#include "expr.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
834 +#include "recog.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
835 +#include "cpplib.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
836 +#include "c-family/c-pragma.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
837 +#include "c-family/c-common.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
838 +#include "toplev.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
839 +#include "optabs.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
840 +#include "version.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
841 +#include "df.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
842 +#include "rtlhooks-def.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
843 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
844 +/* macro to return TRUE if length of operand mode is one byte */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
845 +#define BYTE_MODE(X) ((GET_MODE_SIZE (GET_MODE (X))) == 1) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
846 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
847 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
848 +/* REAL_REG_P(x) is a true if the rtx 'x' represents a real CPU |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
849 +register and not a fake one that is emulated in software. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
850 +#define REAL_REG_P(x) (REG_P(x) && !M_REG_P(x)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
851 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
852 +/*------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
853 + Target hooks, moved from target.h |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
854 +-------------------------------------------------------------------*/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
855 +static void m6809_encode_section_info (tree decl, rtx rtl, int new_decl_p ATTRIBUTE_UNUSED); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
856 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
857 +#undef TARGET_ENCODE_SECTION_INFO |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
858 +#define TARGET_ENCODE_SECTION_INFO m6809_encode_section_info |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
859 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
860 +#undef TARGET_ASM_FILE_START |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
861 +#define TARGET_ASM_FILE_START m6809_asm_file_start |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
862 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
863 +#undef TARGET_ASM_ALIGNED_HI_OP |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
864 +#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
865 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
866 +#undef TARGET_ASM_ALIGNED_SI_OP |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
867 +#define TARGET_ASM_ALIGNED_SI_OP NULL |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
868 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
869 +#undef TARGET_ASM_UNALIGNED_HI_OP |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
870 +#define TARGET_ASM_UNALIGNED_HI_OP "\t.word\t" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
871 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
872 +#undef TARGET_ASM_UNALIGNED_SI_OP |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
873 +#define TARGET_ASM_UNALIGNED_SI_OP NULL |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
874 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
875 +#undef TARGET_RTX_COSTS |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
876 +#define TARGET_RTX_COSTS m6809_rtx_costs |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
877 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
878 +#undef TARGET_ATTRIBUTE_TABLE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
879 +#define TARGET_ATTRIBUTE_TABLE m6809_attribute_table |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
880 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
881 +#undef TARGET_INIT_BUILTINS |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
882 +#define TARGET_INIT_BUILTINS m6809_init_builtins |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
883 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
884 +#undef TARGET_EXPAND_BUILTIN |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
885 +#define TARGET_EXPAND_BUILTIN m6809_expand_builtin |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
886 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
887 +#undef TARGET_DEFAULT_TARGET_FLAGS |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
888 +#define TARGET_DEFAULT_TARGET_FLAGS (MASK_REG_ARGS | MASK_DIRECT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
889 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
890 +#undef TARGET_FUNCTION_OK_FOR_SIBCALL |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
891 +#define TARGET_FUNCTION_OK_FOR_SIBCALL m6809_function_ok_for_sibcall |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
892 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
893 +#undef TARGET_ASM_TRAMPOLINE_TEMPLATE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
894 +#define TARGET_ASM_TRAMPOLINE_TEMPLATE m6809_asm_trampoline_template |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
895 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
896 +#undef TARGET_TRAMPOLINE_INIT |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
897 +#define TARGET_TRAMPOLINE_INIT m6809_initialize_trampoline |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
898 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
899 +#undef TARGET_FRAME_POINTER_REQUIRED |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
900 +#define TARGET_FRAME_POINTER_REQUIRED m6809_frame_pointer_required |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
901 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
902 +#undef TARGET_OPTION_OVERRIDE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
903 +#define TARGET_OPTION_OVERRIDE m6809_override_options |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
904 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
905 +/* External variables used */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
906 +extern int reload_completed; /* set in toplev.c */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
907 +extern FILE *asm_out_file; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
908 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
909 +static int last_mem_size; /* operand size (bytes) */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
910 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
911 +/* True if the section was recently changed and another .area |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
912 + * directive needs to be output before emitting the next label. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
913 +int section_changed = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
914 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
915 +/* Section names. The defaults here are used until an |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
916 + * __attribute__((section)) is seen that changes it. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
917 +char code_section_op[128] = "\t.area .text"; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
918 +char data_section_op[128] = "\t.area .data"; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
919 +char bss_section_op[128] = "\t.area .bss"; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
920 +const char *code_bank_option = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
921 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
922 +/* TRUE if the direct mode prefix might be valid in this context. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
923 + * This is set by 'print_address' prior to calling output_addr_const, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
924 + * which performs into 'print_direct_prefix' to do the final checks. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
925 +static int check_direct_prefix_flag; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
926 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
927 +/* Nonzero if an address is being printed in a context which does not |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
928 + * permit any PIC modifications to the address */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
929 +static int pic_ok_for_addr_p = 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
930 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
931 +/* Current code page. This supports machines which can do bank |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
932 + * switching to allow for more than 64KB of code/data. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
933 +char far_code_page[64]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
934 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
935 +/* Current bank name */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
936 +static char current_bank_name[8] = "-1"; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
937 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
938 +/* Default bank name */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
939 +static char default_code_bank_name[8] = "-1"; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
940 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
941 +/* Direct memory reserved as soft registers */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
942 +unsigned int m6809_soft_regs = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
943 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
944 +/* ABI version */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
945 +unsigned int m6809_abi_version = M6809_ABI_VERSION_REGS; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
946 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
947 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
948 +/** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
949 + * Called after options have been parsed. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
950 + * If overrides have been specified on the command-line, then |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
951 + * these values are copied into the main storage variables. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
952 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
953 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
954 +m6809_override_options (void) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
955 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
956 + /* Handle -mfar-code-page */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
957 + if (far_code_page_option == 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
958 + far_code_page_option = "__default_code_page"; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
959 + strcpy (far_code_page, far_code_page_option); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
960 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
961 + /* Handle -mcode-section, -mdata-section, and -mbss-section */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
962 + if (code_section_ptr != 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
963 + sprintf (code_section_op, "\t.area %s", code_section_ptr); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
964 + if (data_section_ptr != 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
965 + sprintf (data_section_op, "\t.area %s", data_section_ptr); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
966 + if (bss_section_ptr != 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
967 + sprintf (bss_section_op, "\t.area %s", bss_section_ptr); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
968 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
969 + /* Handle -mcode-bank */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
970 + if (code_bank_option != 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
971 + sprintf (default_code_bank_name, "%s", code_bank_option); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
972 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
973 + /* Handle -mabi-version or -mno-reg-args */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
974 + if (m6809_abi_version_ptr != 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
975 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
976 + if (!strcmp (m6809_abi_version_ptr, "stack")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
977 + m6809_abi_version = M6809_ABI_VERSION_STACK; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
978 + else if (!strcmp (m6809_abi_version_ptr, "regs")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
979 + m6809_abi_version = M6809_ABI_VERSION_REGS; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
980 + else if (!strcmp (m6809_abi_version_ptr, "bx")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
981 + m6809_abi_version = M6809_ABI_VERSION_BX; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
982 + else if (!strcmp (m6809_abi_version_ptr, "latest")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
983 + m6809_abi_version = M6809_ABI_VERSION_LATEST; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
984 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
985 + m6809_abi_version = atoi (m6809_abi_version_ptr); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
986 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
987 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
988 + /* The older -mno-reg-args option is deprecated, and treated |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
989 + as -mabi=stack. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
990 + if (!TARGET_REG_ARGS) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
991 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
992 + warning (WARNING_OPT "-mno-reg-args deprecated; use -mabi=stack instead."); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
993 + m6809_abi_version = M6809_ABI_VERSION_STACK; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
994 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
995 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
996 + /* -fexceptions is unsupported */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
997 + flag_exceptions = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
998 + flag_non_call_exceptions = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
999 + flag_unwind_tables = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1000 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1001 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1002 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1003 +/** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1004 + * Output prefix that directs the assembler to use a direct-mode |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1005 + * instruction if globally enabled, address is a symbol, and symbol |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1006 + * has been marked as in direct page. Also, never do this if |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1007 + * using the indirect mode. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1008 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1009 +print_direct_prefix (FILE * file, rtx addr) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1010 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1011 + if (TARGET_DIRECT && |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1012 + (GET_CODE (addr) == SYMBOL_REF) && |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1013 + SYMBOL_REF_FLAG (addr) && |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1014 + check_direct_prefix_flag) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1015 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1016 + putc ('*', file); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1017 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1018 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1019 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1020 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1021 +/** Prints an operand (that is not an address) in assembly from RTL. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1022 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1023 +print_operand (FILE * file, rtx x, int code) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1024 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1025 + if (REG_P (x)) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1026 + /* gcc currently allocates the entire 16-bit 'd' register |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1027 + * even when it only needs an 8-bit value. So here it |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1028 + * is tricked into printing only the lower 8-bit 'b' |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1029 + * register into the assembly output. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1030 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1031 + * Eventually gcc should be modified to allocate a/b |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1032 + * independently and this hack can be removed. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1033 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1034 + * Occasionally, we may want to do an operation using |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1035 + * the 'a' register instead of 'b'; use the 'A' code |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1036 + * to specify that. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1037 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1038 + if (code == 'A') |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1039 + fputs ("a", file); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1040 + else if ((BYTE_MODE (x)) && (REGNO (x) == HARD_D_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1041 + fputs ("b", file); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1042 + else if (M_REG_P (x) && code == 'L') |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1043 + /* Soft registers can be treated like memory and accessed |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1044 + * at a particular offset. TODO : handle 'W' */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1045 + fputs (reg_names[REGNO (x)+1], file); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1046 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1047 + fputs (reg_names[REGNO (x)], file); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1048 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1049 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1050 + else if (MEM_P (x)) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1051 + last_mem_size = GET_MODE_SIZE (GET_MODE (x)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1052 + if (code == 'L') { /* LSH of word address */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1053 + if (GET_CODE (XEXP (x, 0)) == MEM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1054 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1055 + /* Offseting an indirect addressing mode is not supported */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1056 + error ("expression too complex for 6809 (offset indirect mode)"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1057 + debug_rtx (x); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1058 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1059 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1060 + x = adjust_address (x, QImode, 1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1061 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1062 + else if (code == 'M') { /* MSH of word address */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1063 + if (GET_CODE (XEXP (x, 0)) == MEM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1064 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1065 + /* Offseting an indirect addressing mode is not supported */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1066 + error ("expression too complex for 6809 (offset indirect mode)"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1067 + debug_rtx (x); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1068 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1069 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1070 + x = adjust_address (x, QImode, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1071 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1072 + else if (code == 'W') { /* least significant half of 32-bit */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1073 + x = adjust_address (x, HImode, 2); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1074 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1075 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1076 + pic_ok_for_addr_p = (code != 'C'); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1077 + output_address (XEXP (x, 0)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1078 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1079 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1080 + else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) != DImode) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1081 + union { double d; int i[2]; } u; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1082 + u.i[0] = CONST_DOUBLE_LOW (x); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1083 + u.i[1] = CONST_DOUBLE_HIGH (x); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1084 + fprintf (file, "#%#9.9g", u.d); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1085 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1086 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1087 + else if (code == 'R') { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1088 + fprintf (file, "%s", |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1089 + m6809_get_regs_printable (INTVAL (x))); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1090 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1091 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1092 + else { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1093 + if (code == 'L') { /* LSH of word address */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1094 + x = gen_rtx_CONST_INT (VOIDmode, (INTVAL(x) & 0xff)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1095 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1096 + else if (code == 'M') { /* MSH of word address */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1097 + x = gen_rtx_CONST_INT (VOIDmode, ((INTVAL(x) >> 8) & 0xff)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1098 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1099 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1100 + putc ('#', file); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1101 + output_addr_const (file, x); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1102 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1103 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1104 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1105 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1106 +/** Prints an address operand to assembler from its RTL representation. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1107 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1108 +print_operand_address (FILE *file, rtx addr) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1109 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1110 + register rtx base = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1111 + register rtx offset = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1112 + int regno; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1113 + int indirect_flag = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1114 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1115 + check_direct_prefix_flag = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1116 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1117 + /*** check for indirect addressing ***/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1118 + if (MEM_P (addr)) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1119 + last_mem_size = GET_MODE_SIZE (GET_MODE (addr)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1120 + addr = XEXP (addr, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1121 + if (pic_ok_for_addr_p) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1122 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1123 + indirect_flag = 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1124 + fprintf (file, "["); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1125 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1126 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1127 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1128 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1129 + switch (GET_CODE (addr)) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1130 + case REG: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1131 + regno = REGNO (addr); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1132 + fprintf (file, ",%s", reg_names[regno]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1133 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1134 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1135 + case PRE_DEC: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1136 + regno = REGNO (XEXP (addr, 0)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1137 + fputs (((last_mem_size == 1) ? ",-" : ",--"), file); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1138 + fprintf (file, "%s", reg_names[regno]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1139 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1140 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1141 + case POST_INC: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1142 + regno = REGNO (XEXP (addr, 0)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1143 + fprintf (file, ",%s", reg_names[regno]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1144 + fputs (((last_mem_size == 1) ? "+" : "++"), file); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1145 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1146 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1147 + case PLUS: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1148 + base = XEXP (addr, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1149 + if (MEM_P (base)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1150 + base = XEXP (base, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1151 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1152 + offset = XEXP (addr, 1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1153 + if (MEM_P (offset)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1154 + offset = XEXP (offset, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1155 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1156 + if ((CONSTANT_ADDRESS_P (base)) && (CONSTANT_ADDRESS_P (offset))) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1157 + if (!indirect_flag) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1158 + check_direct_prefix_flag = 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1159 + output_addr_const (file, base); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1160 + check_direct_prefix_flag = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1161 + fputs ("+", file); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1162 + output_addr_const (file, offset); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1163 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1164 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1165 + else if ((CONSTANT_ADDRESS_P (base)) && (A_REG_P (offset))) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1166 + output_addr_const (file, base); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1167 + fprintf (file, ",%s", reg_names[REGNO (offset)]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1168 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1169 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1170 + else if ((CONSTANT_ADDRESS_P (offset)) && (A_REG_P (base))) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1171 + output_addr_const (file, offset); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1172 + fprintf (file, ",%s", reg_names[REGNO (base)]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1173 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1174 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1175 + /*** accumulator offset ***/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1176 + else if (((D_REG_P (offset)) || (Q_REG_P (offset))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1177 + && (A_REG_P (base))) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1178 + fprintf (file, "%s,%s", |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1179 + reg_names[REGNO (offset)], reg_names[REGNO (base)]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1180 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1181 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1182 + else if (((D_REG_P (base)) || (Q_REG_P (base))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1183 + && (A_REG_P (offset))) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1184 + fprintf (file, "%s,%s", |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1185 + reg_names[REGNO (base)], reg_names[REGNO (offset)]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1186 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1187 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1188 + else if (GET_CODE (base) == PRE_DEC) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1189 + regno = REGNO (XEXP (base, 0)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1190 + fputs (((last_mem_size == 1) ? ",-" : ",--"), file); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1191 + fprintf (file, "%s", reg_names[regno]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1192 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1193 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1194 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1195 + abort (); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1196 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1197 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1198 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1199 + default: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1200 + /* Set this global before calling output_addr_const() */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1201 + if (!indirect_flag) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1202 + check_direct_prefix_flag = 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1203 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1204 + /* When printing a SYMBOL_REF in PIC mode, do not print the leading |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1205 + * '#' and follow it by ',pcr' to enable relative addressing. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1206 + if (flag_pic && pic_ok_for_addr_p && GET_CODE (addr) == SYMBOL_REF) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1207 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1208 + ASM_OUTPUT_SYMBOL_REF (file, addr); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1209 + fputs (",pcr", file); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1210 + pic_ok_for_addr_p = 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1211 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1212 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1213 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1214 + output_addr_const (file, addr); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1215 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1216 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1217 + check_direct_prefix_flag = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1218 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1219 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1220 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1221 + if (indirect_flag) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1222 + fprintf (file, "]"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1223 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1224 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1225 +/*------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1226 + Update the CC Status |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1227 +--------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1228 + Set the cc_status for the results of an insn whose pattern is EXP. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1229 + We assume that jumps don't affect the condition codes. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1230 + All else, clobbers the condition codes, by assumption. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1231 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1232 + We assume that ALL add, minus, etc. instructions effect the condition |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1233 + codes. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1234 +-------------------------------------------------------------------*/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1235 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1236 +notice_update_cc (rtx exp, rtx insn ATTRIBUTE_UNUSED) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1237 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1238 + int src_code; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1239 + int dst_code; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1240 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1241 + /*** recognize SET insn's ***/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1242 + if (GET_CODE (exp) == SET) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1243 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1244 + src_code = GET_CODE (SET_SRC (exp)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1245 + dst_code = GET_CODE (SET_DEST (exp)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1246 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1247 + /* Jumps do not alter the cc's. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1248 + if (SET_DEST (exp) == pc_rtx) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1249 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1250 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1251 + /* Moving one register into another register (tfr): |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1252 + Doesn't alter the cc's. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1253 + if (REG_P (SET_DEST (exp)) && (REG_P (SET_SRC (exp)))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1254 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1255 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1256 + /* Moving memory into a register (load): Sets cc's. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1257 + if (REG_P (SET_DEST (exp)) && src_code == MEM) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1258 + cc_status.value1 = SET_SRC (exp); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1259 + cc_status.value2 = SET_DEST (exp); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1260 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1261 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1262 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1263 + /* Moving register into memory (store): Sets cc's. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1264 + if (dst_code == MEM && REG_P (SET_SRC (exp))) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1265 + cc_status.value1 = SET_SRC (exp); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1266 + cc_status.value2 = SET_DEST (exp); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1267 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1268 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1269 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1270 + /* Function calls clobber the cc's. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1271 + else if (GET_CODE (SET_SRC (exp)) == CALL) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1272 + CC_STATUS_INIT; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1273 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1274 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1275 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1276 + /* Tests and compares set the cc's in predictable ways. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1277 + else if (SET_DEST (exp) == cc0_rtx) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1278 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1279 + cc_status.flags = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1280 + cc_status.value1 = SET_SRC (exp); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1281 + cc_status.value2 = SET_DEST (exp); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1282 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1283 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1284 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1285 + else if (A_REG_P (SET_DEST (exp))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1286 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1287 + CC_STATUS_INIT; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1288 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1289 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1290 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1291 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1292 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1293 + /* Certain instructions affect the condition codes. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1294 + switch (src_code) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1295 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1296 + case PLUS: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1297 + case MINUS: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1298 + case NEG: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1299 + case ASHIFT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1300 + /* These instructions set the condition codes, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1301 + * and may modify the V bit. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1302 + cc_status.flags |= CC_NO_OVERFLOW; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1303 + /* FALLTHRU */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1304 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1305 + case AND: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1306 + case IOR: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1307 + case XOR: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1308 + case ASHIFTRT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1309 + case LSHIFTRT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1310 + /* These instructions set the condition codes, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1311 + * but cannot overflow (V=0). */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1312 + cc_status.value1 = SET_SRC (exp); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1313 + cc_status.value2 = SET_DEST (exp); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1314 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1315 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1316 + default: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1317 + /* Everything else is clobbered */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1318 + CC_STATUS_INIT; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1319 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1320 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1321 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1322 + } /* SET */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1323 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1324 + else if (GET_CODE (exp) == PARALLEL |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1325 + && GET_CODE (XVECEXP (exp, 0, 0)) == SET) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1326 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1327 + if (SET_DEST (XVECEXP (exp, 0, 0)) == pc_rtx) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1328 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1329 + if (SET_DEST (XVECEXP (exp, 0, 0)) == cc0_rtx) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1330 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1331 + CC_STATUS_INIT; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1332 + cc_status.value1 = SET_SRC (XVECEXP (exp, 0, 0)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1333 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1334 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1335 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1336 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1337 + /*** default action if we haven't recognized something |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1338 + and returned earlier ***/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1339 + CC_STATUS_INIT; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1340 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1341 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1342 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1343 +/** Returns nonzero if the expression EXP can be implemented using one |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1344 + * of the 6809's single operand instructions. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1345 +int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1346 +m6809_single_operand_operator (rtx exp) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1347 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1348 + rtx op1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1349 + HOST_WIDE_INT val; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1350 + enum rtx_code code; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1351 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1352 + debug_rtx(exp); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1353 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1354 + code = GET_CODE (exp); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1355 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1356 + /* Unary operators always qualify */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1357 + switch (code) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1358 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1359 + case NEG: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1360 + case NOT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1361 + return 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1362 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1363 + default: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1364 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1365 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1366 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1367 + /* Binary operators can only qualify if the second |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1368 + * argument is a CONST_INT of certain value. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1369 + op1 = XEXP (exp, 1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1370 + if (GET_CODE (op1) != CONST_INT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1371 + return 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1372 + val = INTVAL (op1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1373 + switch (code) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1374 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1375 + case PLUS: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1376 + case MINUS: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1377 + if (val == -1 || val == 1) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1378 + return 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1379 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1380 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1381 + case ASHIFT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1382 + case ASHIFTRT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1383 + case LSHIFTRT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1384 + case ROTATE: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1385 + case ROTATERT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1386 + if (val == 1) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1387 + return 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1388 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1389 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1390 + default: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1391 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1392 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1393 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1394 + return 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1395 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1396 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1397 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1398 +/** Return a bitarray of the hard registers which are used by a function. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1399 +unsigned int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1400 +m6809_get_live_regs (void) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1401 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1402 + unsigned int regs = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1403 + int regno; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1404 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1405 + if (frame_pointer_needed) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1406 + regs |= (1 << HARD_FRAME_POINTER_REGNUM); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1407 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1408 + for (regno = HARD_X_REGNUM; regno <= HARD_U_REGNUM; regno++) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1409 + if (df_regs_ever_live_p (regno) && ! call_used_regs[regno]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1410 + regs |= (1 << regno); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1411 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1412 + return regs; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1413 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1414 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1415 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1416 +/** Return a printable version of a list of hard registers, suitable |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1417 + * for use in a PSHx or PULx insn. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1418 +const char * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1419 +m6809_get_regs_printable (unsigned int regs) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1420 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1421 + static char list[64]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1422 + char *listp = list; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1423 + unsigned int regno; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1424 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1425 + for (regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1426 + if ((regs & (1 << regno)) && !S_REGNO_P (regno)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1427 + listp += sprintf (listp, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1428 + (listp == list) ? "%s" : ",%s", reg_names[regno]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1429 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1430 + return list; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1431 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1432 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1433 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1434 +/** Return the total number of bytes covered by a set of hard registers. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1435 +unsigned int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1436 +m6809_get_regs_size (unsigned int regs) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1437 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1438 + unsigned int regno; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1439 + unsigned int size = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1440 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1441 + for (regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1442 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1443 + /* Only count register in the given register set */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1444 + if (REGSET_CONTAINS_P (regno, regs)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1445 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1446 + /* Add 1 or 2 byte, depending on the size of the register. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1447 + * Since 'D' may be in both sets, check for WORD_REGSET first. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1448 + if (REGSET_CONTAINS_P(regno, WORD_REGSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1449 + size += 2; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1450 + else if (REGSET_CONTAINS_P(regno, BYTE_REGSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1451 + size++; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1452 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1453 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1454 + return size; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1455 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1456 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1457 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1458 +/* Given the target of call instruction in X, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1459 + * return the tree node that contains the function declaration for |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1460 + * that target. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1461 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1462 + * If the rtx or the tree do not appear valid for any reason, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1463 + * then return NULL_TREE. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1464 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1465 +static tree call_target_decl (rtx x) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1466 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1467 + tree decl; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1468 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1469 + /* Make sure the target is really a MEM. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1470 + if (!x || !MEM_P (x)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1471 + return NULL_TREE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1472 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1473 + /* Make sure the address is a SYMBOL_REF. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1474 + x = XEXP (x, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1475 + if (!x || (GET_CODE (x) != SYMBOL_REF)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1476 + return NULL_TREE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1477 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1478 + /* Get the declaration of this symbol */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1479 + decl = SYMBOL_REF_DECL (x); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1480 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1481 + /* Make sure the declaration is really a function. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1482 + if (!decl || (TREE_CODE(decl) != FUNCTION_DECL)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1483 + return NULL_TREE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1484 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1485 + return decl; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1486 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1487 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1488 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1489 +/** Returns nonzero if a function, whose declaration is in DECL, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1490 + * was declared to have the attribute given by ATTR_NAME. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1491 +int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1492 +m6809_function_has_type_attr_p (tree decl, const char *attr_name) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1493 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1494 + tree type; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1495 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1496 + type = TREE_TYPE (decl); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1497 + return lookup_attribute (attr_name, TYPE_ATTRIBUTES (type)) != NULL; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1498 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1499 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1500 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1501 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1502 +/** Returns nonzero if the current function was declared to have the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1503 + * attribute given by ATTR_NAME. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1504 +int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1505 +m6809_current_function_has_type_attr_p (const char *attr_name) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1506 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1507 + return m6809_function_has_type_attr_p (current_function_decl, attr_name); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1508 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1509 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1510 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1511 +/** Return nonzero if the current function has no return value. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1512 +int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1513 +m6809_current_function_is_void (void) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1514 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1515 + return (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl)))); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1516 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1517 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1518 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1519 +/** Get the value of a declaration's 'bank', as set by the 'bank' |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1520 + * attribute. If no bank was declared, it returns NULL by default. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1521 +const char * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1522 +m6809_get_decl_bank (tree decl) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1523 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1524 + tree attr; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1525 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1526 + /* Lookup the 'bank' attribute. If it does not exist, then |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1527 + * return NULL */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1528 + attr = lookup_attribute ("bank", DECL_ATTRIBUTES (decl)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1529 + if (attr == NULL_TREE) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1530 + return NULL; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1531 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1532 + /* Make sure it has a value assigned to it */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1533 + attr = TREE_VALUE (attr); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1534 + if (attr == NULL_TREE) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1535 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1536 + warning (WARNING_OPT "banked function did not declare a bank number"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1537 + return NULL; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1538 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1539 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1540 + /* Return the bank name */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1541 + attr = TREE_VALUE (attr); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1542 + return TREE_STRING_POINTER (attr); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1543 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1544 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1545 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1546 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1547 +m6809_declare_function_name (FILE *asm_out_file, const char *name, tree decl) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1548 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1549 + /* Check the function declaration for special properties. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1550 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1551 + * If the function was declare with __attribute__((bank)), output |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1552 + * assembler definitions to force the function to go into the named |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1553 + * bank. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1554 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1555 + const char *bank_name = m6809_get_decl_bank (decl); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1556 + if (bank_name != NULL) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1557 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1558 + /* Declare __self_bank as a local assembler value that denotes |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1559 + * which bank the current function is in. This is required only |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1560 + * when the bank actually changes. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1561 + if (strcmp (bank_name, current_bank_name)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1562 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1563 + fprintf (asm_out_file, "__self_bank\t.equ %s\n", bank_name); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1564 + strcpy (current_bank_name, bank_name); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1565 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1566 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1567 + /* Declare a global assembler value that denotes which bank the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1568 + * named function is in. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1569 + fprintf (asm_out_file, "__%s_bank\t.gblequ %s\n", name, bank_name); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1570 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1571 + /* Force the current function into a new area */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1572 + fprintf (asm_out_file, "\t.bank bank_%s (FSFX=_%s)\n", |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1573 + bank_name, bank_name); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1574 + fprintf (asm_out_file, "\t.area bank_%s (BANK=bank_%s)\n", |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1575 + bank_name, bank_name); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1576 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1577 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1578 + /* Emit the label for the function's name */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1579 + ASM_OUTPUT_LABEL (asm_out_file, name); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1580 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1581 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1582 +#if 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1583 +/** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1584 + * Handle pragmas. Note that only the last branch pragma seen in the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1585 + * source has any affect on code generation. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1586 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1587 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1588 +#define BAD_PRAGMA(msgid, arg) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1589 + do { warning (WARNING_OPT msgid, arg); return -1; } while (0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1590 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1591 +static int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1592 +pragma_parse (const char *name, tree *sect) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1593 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1594 + tree s, x; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1595 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1596 + if (pragma_lex (&x) != CPP_OPEN_PAREN) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1597 + BAD_PRAGMA ("missing '(' after '#pragma %s' - ignored", name); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1598 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1599 + if (pragma_lex (&s) != CPP_STRING) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1600 + BAD_PRAGMA ("missing section name in '#pragma %s' - ignored", name); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1601 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1602 + if (pragma_lex (&x) != CPP_CLOSE_PAREN) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1603 + BAD_PRAGMA ("missing ')' for '#pragma %s' - ignored", name); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1604 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1605 + if (pragma_lex (&x) != CPP_EOF) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1606 + warning (WARNING_OPT "junk at end of '#pragma %s'", name); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1607 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1608 + *sect = s; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1609 + return 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1610 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1611 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1612 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1613 +/* |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1614 + * Handle #pragma section. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1615 + * This is deprecated; code should use __attribute__(section("name")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1616 + * instead. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1617 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1618 +void pragma_section (cpp_reader *pfile ATTRIBUTE_UNUSED) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1619 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1620 + tree sect; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1621 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1622 + if (pragma_parse ("section", §)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1623 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1624 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1625 + snprintf (code_section_op, 6+TREE_STRING_LENGTH (sect), |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1626 + ".area\t%s", TREE_STRING_POINTER (sect)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1627 + snprintf (data_section_op, 6+TREE_STRING_LENGTH (sect), |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1628 + ".area\t%s", TREE_STRING_POINTER (sect)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1629 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1630 + /* Mark a flag that sections have changed. Upon emitting another |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1631 + * declaration, the new .area directive will be written. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1632 + section_changed++; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1633 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1634 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1635 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1636 +/** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1637 + * Check a `double' value for validity for a particular machine mode. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1638 + * Called by the CHECK_FLOAT_VALUE() machine-dependent macro. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1639 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1640 +int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1641 +check_float_value (enum machine_mode mode, double *d, int overflow) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1642 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1643 + if (mode == SFmode) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1644 + if (*d > 1.7014117331926443e+38) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1645 + error("magnitude of constant too large for `float'"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1646 + *d = 1.7014117331926443e+38; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1647 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1648 + else if (*d < -1.7014117331926443e+38) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1649 + error("magnitude of constant too large for `float'"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1650 + *d = -1.7014117331926443e+38; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1651 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1652 + else if ((*d > 0) && (*d < 2.9387358770557188e-39)) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1653 + warning(WARNING_OPT "`float' constant truncated to zero"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1654 + *d = 0.0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1655 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1656 + else if ((*d < 0) && (*d > -2.9387358770557188e-39)) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1657 + warning(WARNING_OPT "`float' constant truncated to zero"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1658 + *d = 0.0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1659 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1660 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1661 + return overflow; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1662 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1663 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1664 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1665 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1666 +/** Declare that the target supports named output sections. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1667 +bool m6809_have_named_section = (bool)1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1668 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1669 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1670 +/** Write to the assembler file a directive to place |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1671 + * subsequent objects to a different section in the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1672 + * object file. ASxxxx uses the "area" directive for |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1673 + * this purpose. It does not however support generalized |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1674 + * alignment, and can only place items on an odd/even |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1675 + * boundary. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1676 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1677 +m6809_asm_named_section ( |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1678 + const char *name, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1679 + unsigned int flags ATTRIBUTE_UNUSED, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1680 + tree decl) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1681 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1682 + fprintf (asm_out_file, "\t.area\t%s\n", name); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1683 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1684 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1685 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1686 +enum reg_class |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1687 +m6809_preferred_reload_class (rtx x, enum reg_class regclass) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1688 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1689 + /* Check cases based on type code of rtx */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1690 + switch (GET_CODE(x)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1691 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1692 + /* |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1693 + * Observation, 2015-07-19, William Astle |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1694 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1695 + * The original comparison for range for 16 bits was wrong, adding 0x80 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1696 + * instead of 0x8000. Replaced both 8 bit and 16 bit comparisions with |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1697 + * a more straight forward range comparison - excessive cleverness isn't |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1698 + * really required here. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1699 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1700 + case CONST_INT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1701 + /* Constants that can fit into 1 byte should be |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1702 + * loaded into a Q_REGS reg */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1703 + if ((INTVAL(x) >= -128 && INTVAL(x) <= 127) && |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1704 +// if (((unsigned) (INTVAL(x) + 0x80) < 0x100) && |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1705 + (regclass > A_REGS)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1706 + return Q_REGS; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1707 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1708 + /* 16-bit constants should be loaded into A_REGS |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1709 + * when possible. gcc may already require A_REGS |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1710 + * or D_REGS for certain types of instructions. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1711 + * This case applies mostly to simple copy operations |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1712 + * to/from memory when any register will do, but |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1713 + * it's best to avoid using D register since it is |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1714 + * needed for other things. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1715 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1716 + else if ((INTVAL(x) >= -32768 && INTVAL(x) <= 32767) && |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1717 +// else if (((unsigned) (INTVAL(x) + 0x80) < 0x10000) && |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1718 + (regclass > A_REGS)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1719 + return A_REGS; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1720 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1721 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1722 + case SYMBOL_REF: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1723 + case LABEL_REF: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1724 + /* Addresses should always be loaded into A_REGS */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1725 + if (regclass >= A_REGS) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1726 + return (A_REGS); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1727 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1728 + default: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1729 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1730 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1731 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1732 + /* Check cases based on mode of rtx */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1733 + if ((GET_MODE(x) == QImode) && (regclass != A_REGS)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1734 + return Q_REGS; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1735 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1736 + /* Default: return whatever class reload suggested */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1737 + return regclass; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1738 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1739 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1740 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1741 +/** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1742 + * Check a new declaration for the "section" attribute. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1743 + * If it exists, and the target section is "direct", then mark |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1744 + * the declaration (in RTL) to indicate special treatment. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1745 + * When the variable is referenced later, we test for this flag |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1746 + * and can emit special asm text to force the assembler to use |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1747 + * short instructions. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1748 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1749 +static void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1750 +m6809_encode_section_info (tree decl, rtx rtl, int new_decl_p ATTRIBUTE_UNUSED) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1751 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1752 + tree attr, id; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1753 + const char *name; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1754 + const char *decl_name; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1755 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1756 + /* We only care about variable declarations, not functions */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1757 + if (TREE_CODE (decl) != VAR_DECL) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1758 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1759 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1760 + /* For debugging purposes only; grab the decl's name */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1761 + decl_name = IDENTIFIER_POINTER (DECL_NAME (decl)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1762 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1763 + /* Give up if the decl doesn't have any RTL */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1764 + if (!DECL_RTL (decl)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1765 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1766 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1767 + /* See if it has a section attribute */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1768 + attr = lookup_attribute ("section", DECL_ATTRIBUTES (decl)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1769 + if (!attr) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1770 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1771 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1772 + /* See if the section attribute has a value */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1773 + id = TREE_VALUE (TREE_VALUE (attr)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1774 + if (!id) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1775 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1776 + name = TREE_STRING_POINTER (id); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1777 + if (!name) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1778 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1779 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1780 + /* See if the value is 'direct'. If so, mark it. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1781 + if (!strcmp (name, "direct")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1782 + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1783 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1784 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1785 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1786 +/** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1787 + * Output code to perform a complex shift, for which there is no |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1788 + * direct support in the instruction set. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1789 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1790 + * shift1 is an instruction pattern for performing a 1-bit modification. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1791 + * This code wraps that pattern in a loop to perform the shift N times, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1792 + * where N is given by the address register in operands[2]. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1793 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1794 + * To support 16-bit shifts, shift2 can also be provided: it is |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1795 + * a second instruction to be included in the loop. 8-bit shift |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1796 + * insns will pass NULL here. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1797 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1798 + * The insn length of shift1/shift2 is assumed to be 1 byte, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1799 + * which works in all of the cases it is needed so far. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1800 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1801 +static void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1802 +m6809_gen_register_shift ( |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1803 + rtx *operands, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1804 + const char *shift1, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1805 + const char *shift2 ) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1806 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1807 + char beq_pattern[32]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1808 + char bra_pattern[32]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1809 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1810 + int shiftlen = (shift1 && shift2) ? 2 : 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1811 + int cmplen = (REGNO (operands[2]) == HARD_X_REGNUM) ? 3 : 4; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1812 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1813 + int beq_offset = 2 + shiftlen + 2; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1814 + int bra_offset = shiftlen + 2 + cmplen + 2; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1815 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1816 + sprintf (beq_pattern, "beq\t.+%d", beq_offset); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1817 + sprintf (bra_pattern, "bra\t.-%d", bra_offset); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1818 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1819 + output_asm_insn ("pshs\t%2", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1820 + output_asm_insn ("lea%2\t-1,%2", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1821 + output_asm_insn ("cmp%2\t#-1", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1822 + output_asm_insn (beq_pattern, operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1823 + if (shift1) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1824 + output_asm_insn (shift1, operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1825 + if (shift2) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1826 + output_asm_insn (shift2, operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1827 + output_asm_insn (bra_pattern, operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1828 + output_asm_insn ("puls\t%2", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1829 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1830 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1831 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1832 +/** Generate RTL for the upper 8-bits of a 16-bit constant. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1833 +rtx |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1834 +gen_rtx_const_high (rtx r) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1835 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1836 + unsigned char v = (INTVAL (r) >> 8) & 0xFF; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1837 + signed char s = (signed char)v; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1838 + return gen_int_mode (s, QImode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1839 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1840 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1841 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1842 +/** Generate RTL for the lower 8-bits of a 16-bit constant. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1843 +rtx |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1844 +gen_rtx_const_low (rtx r) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1845 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1846 + unsigned char v = INTVAL (r) & 0xFF; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1847 + signed char s = (signed char)v; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1848 + return gen_int_mode (s, QImode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1849 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1850 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1851 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1852 +/** Generate RTL to allocate/free bytes on the stack. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1853 + * CODE is given as MINUS when allocating and PLUS when freeing, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1854 + * to match the semantics of a downward-growing stack. SIZE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1855 + * is always given as a positive integer. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1856 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1857 +static rtx |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1858 +gen_rtx_stack_adjust (enum rtx_code code, int size) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1859 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1860 + if (size <= 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1861 + return NULL_RTX; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1862 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1863 + if (code == MINUS) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1864 + size = -size; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1865 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1866 + return gen_rtx_SET (Pmode, stack_pointer_rtx, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1867 + gen_rtx_PLUS (Pmode, stack_pointer_rtx, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1868 + gen_int_mode (size, HImode))); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1869 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1870 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1871 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1872 +/** Generate RTL to push/pop a set of registers. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1873 +rtx |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1874 +gen_rtx_register_pushpop (int op, int regs) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1875 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1876 + rtx nregs = gen_int_mode (regs, QImode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1877 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1878 + if (op == UNSPEC_PUSH_RS) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1879 + return gen_register_push (nregs); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1880 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1881 + return gen_register_pop (nregs); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1882 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1883 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1884 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1885 +/* Given a register set REGS, where the bit positions correspond to |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1886 + * hard register numbers, return another bitmask that represents the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1887 + * order in which those registers would be pushed/popped. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1888 + * Registers that are pushed first have higher bit positions. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1889 + * The pop order is just the reverse bitmask. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1890 + * These values are the same as the bitmasks actually used in the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1891 + * machine instructions. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1892 +static unsigned int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1893 +register_push_order (int regs) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1894 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1895 + unsigned int order = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1896 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1897 + if (REGSET_CONTAINS_P (HARD_PC_REGNUM, regs)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1898 + order |= 0x80; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1899 + if (REGSET_CONTAINS_P (HARD_U_REGNUM, regs)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1900 + order |= 0x40; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1901 + if (REGSET_CONTAINS_P (HARD_Y_REGNUM, regs)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1902 + order |= 0x20; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1903 + if (REGSET_CONTAINS_P (HARD_X_REGNUM, regs)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1904 + order |= 0x10; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1905 + if (REGSET_CONTAINS_P (HARD_DP_REGNUM, regs)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1906 + order |= 0x8; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1907 + if (REGSET_CONTAINS_P (HARD_B_REGNUM, regs)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1908 + order |= 0x4; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1909 + if (REGSET_CONTAINS_P (HARD_A_REGNUM, regs)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1910 + order |= 0x2; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1911 + if (REGSET_CONTAINS_P (HARD_CC_REGNUM, regs)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1912 + order |= 0x1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1913 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1914 + if (REGSET_CONTAINS_P (HARD_D_REGNUM, regs)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1915 + order |= (0x4 | 0x2); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1916 + return order; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1917 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1918 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1919 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1920 +/* Returns nonzero if two consecutive push or pop instructions, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1921 + * as determined by the OP, can be merged into a single instruction. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1922 + * The first instruction in the sequence pushes/pops REGS1; the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1923 + * second applies to REGS2. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1924 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1925 + * If true, the resulting instruction can use (regs1 | regs2) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1926 + * safely. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1927 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1928 +int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1929 +m6809_can_merge_pushpop_p (int op, int regs1, int regs2) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1930 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1931 + /* Register sets must not overlap */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1932 + if (regs1 & regs2) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1933 + return 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1934 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1935 + if (op == UNSPEC_PUSH_RS) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1936 + return (register_push_order (regs1) > register_push_order (regs2)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1937 + else if (op == UNSPEC_POP_RS) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1938 + return (register_push_order (regs1) < register_push_order (regs2)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1939 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1940 + return 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1941 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1942 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1943 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1944 +/** Emit instructions for making a library call. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1945 + * MODE is the mode of the operation. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1946 + * NAME is the library function name. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1947 + * OPERANDS is the rtx array provided by the recognizer. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1948 + * COUNT is the number of input operands to the call, and |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1949 + * should be 1 for a unary op or 2 for a binary op. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1950 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1951 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1952 +emit_libcall_insns (enum machine_mode mode, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1953 + const char *name, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1954 + rtx *operands, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1955 + int count) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1956 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1957 + /* Generate an rtx for the call target. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1958 + rtx symbol = gen_rtx_SYMBOL_REF (Pmode, name); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1959 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1960 + /* Emit the library call. Slightly different based |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1961 + on the number of operands */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1962 + if (count == 2) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1963 + emit_library_call (symbol, LCT_NORMAL, mode, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1964 + 2, operands[1], mode, operands[2], mode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1965 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1966 + emit_library_call (symbol, LCT_NORMAL, mode, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1967 + 1, operands[1], mode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1968 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1969 + /* The library call is expected to put its result |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1970 + in LIBCALL_VALUE, so need to copy it into the destination. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1971 + emit_move_insn (operands[0], LIBCALL_VALUE(mode)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1972 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1973 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1974 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1975 +/** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1976 + * A small helper function that writes out a single branch instruction. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1977 + * OPCODE is the short name, e.g. "ble". |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1978 + * OPERANDS has the rtx for the target label. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1979 + * LONG_P is nonzero if we are emitting a long branch, and need to |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1980 + * prepend an 'l' to the opcode name. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1981 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1982 +void output_branch_insn1 (const char *opcode, rtx *operands, int long_p) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1983 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1984 + char pattern[64]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1985 + sprintf (pattern, "%s%s\t%%l0", long_p ? "l" : "", opcode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1986 + output_asm_insn (pattern, operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1987 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1988 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1989 +/** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1990 + * Output a branch/conditional branch insn of the proper |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1991 + * length. code identifies the particular branch insn. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1992 + * operands holds the branch target in operands[0]. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1993 + * length says what the size of this insn should be. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1994 + * Based on the length, we know whether it should be a |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1995 + * short (8-bit) or long (16-bit) branch. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1996 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1997 +const char * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1998 +output_branch_insn (enum rtx_code code, rtx *operands, int length) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1999 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2000 + int shortform; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2001 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2002 + /* Decide whether or not to use the long or short form. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2003 + * Calculate automatically based on insn lengths. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2004 + shortform = ((length > 2) ? 0 : 1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2005 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2006 + /* Determine the proper opcode. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2007 + * Use the short (2-byte) opcode if the target is within |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2008 + * reach. Otherwise, use jmp (3-byte opcode), unless |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2009 + * compiling with -fpic, in which case we'll need to use |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2010 + * lbra (4-byte opcode). |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2011 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2012 + switch (code) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2013 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2014 + case LABEL_REF: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2015 + if (shortform) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2016 + output_branch_insn1 ("bra", operands, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2017 + else if (flag_pic) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2018 + output_branch_insn1 ("bra", operands, 1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2019 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2020 + output_branch_insn1 ("jmp", operands, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2021 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2022 + case EQ: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2023 + output_branch_insn1 ("beq", operands, !shortform); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2024 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2025 + case NE: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2026 + output_branch_insn1 ("bne", operands, !shortform); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2027 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2028 + case GT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2029 + output_branch_insn1 ("bgt", operands, !shortform); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2030 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2031 + case GTU: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2032 + output_branch_insn1 ("bhi", operands, !shortform); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2033 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2034 + case LT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2035 + if (cc_prev_status.flags & CC_NO_OVERFLOW) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2036 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2037 + output_branch_insn1 ("bmi", operands, !shortform); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2038 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2039 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2040 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2041 + output_branch_insn1 ("blt", operands, !shortform); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2042 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2043 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2044 + case LTU: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2045 + output_branch_insn1 ("blo", operands, !shortform); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2046 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2047 + case GE: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2048 + if (cc_prev_status.flags & CC_NO_OVERFLOW) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2049 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2050 + output_branch_insn1 ("bpl", operands, !shortform); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2051 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2052 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2053 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2054 + output_branch_insn1 ("bge", operands, !shortform); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2055 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2056 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2057 + case GEU: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2058 + output_branch_insn1 ("bhs", operands, !shortform); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2059 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2060 + case LE: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2061 + if (cc_prev_status.flags & CC_NO_OVERFLOW) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2062 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2063 + output_branch_insn1 ("bmi", operands, !shortform); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2064 + output_branch_insn1 ("beq", operands, !shortform); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2065 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2066 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2067 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2068 + output_branch_insn1 ("ble", operands, !shortform); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2069 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2070 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2071 + case LEU: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2072 + output_branch_insn1 ("bls", operands, !shortform); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2073 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2074 + default: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2075 + abort(); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2076 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2077 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2078 + return ""; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2079 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2080 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2081 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2082 +/** Returns the "cost" of an RTL expression. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2083 + * In general, the expression "COSTS_N_INSNS(1)" is used to represent |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2084 + * the cost of a fast 8-bit arithmetic instruction that operates on |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2085 + * a reg/mem or a reg/immed. Other costs are relative to this. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2086 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2087 + * Notes: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2088 + * - The cost of a REG is always zero; this cannot be changed. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2089 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2090 + * - On the 6809, instructions on two registers will nearly always take |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2091 + * longer than those that operate on a register and a constant/memory, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2092 + * because of the way the instruction set is structured. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2093 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2094 + * TODO: multiply HImode by 2 should be done via shifts, instead of add. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2095 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2096 +static bool |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2097 +m6809_rtx_costs (rtx X, int code, int outer_code ATTRIBUTE_UNUSED, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2098 + int *total, bool speed) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2099 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2100 + int has_const_arg = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2101 + HOST_WIDE_INT const_arg; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2102 + enum machine_mode mode; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2103 + int nargs = 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2104 + rtx op0, op1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2105 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2106 + /* Data RTXs return a value between 0-3, depending on complexity. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2107 + All of these are less than COSTS_N_INSNS(1). */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2108 + switch (code) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2109 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2110 + case CC0: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2111 + case PC: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2112 + *total = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2113 + return true; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2114 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2115 + case CONST_INT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2116 + if (X == const0_rtx) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2117 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2118 + *total = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2119 + return true; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2120 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2121 + else if ((unsigned) INTVAL (X) < 077) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2122 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2123 + *total = 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2124 + return true; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2125 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2126 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2127 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2128 + *total = 2; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2129 + return true; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2130 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2131 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2132 + case LABEL_REF: case CONST: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2133 + *total = 2; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2134 + return true; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2135 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2136 + case SYMBOL_REF: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2137 + /* References to memory are made cheaper if they have |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2138 + * the 'direct' mode attribute set */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2139 + *total = (SYMBOL_REF_FLAG (X)) ? 1 : 2; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2140 + return true; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2141 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2142 + case MEM: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2143 + /* See what form of address was given */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2144 + X = XEXP (X, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2145 + switch (GET_CODE (X)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2146 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2147 + case SYMBOL_REF: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2148 + *total = (SYMBOL_REF_FLAG (X)) ? 1 : 2; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2149 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2150 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2151 + case CONST_INT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2152 + *total = 2; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2153 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2154 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2155 + case MEM: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2156 + *total = COSTS_N_INSNS (1) + 2; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2157 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2158 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2159 + default: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2160 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2161 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2162 + return true; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2163 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2164 + case CONST_DOUBLE: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2165 + /* TODO : not sure about this value. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2166 + *total = 3; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2167 + return true; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2168 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2169 + default: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2170 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2171 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2172 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2173 + /* Decode the rtx */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2174 + mode = GET_MODE (X); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2175 + op0 = XEXP (X, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2176 + op1 = XEXP (X, 1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2177 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2178 + /* We don't implement anything in SImode or greater. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2179 + if (GET_MODE_SIZE (mode) >= GET_MODE_SIZE (SImode)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2180 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2181 + *total = COSTS_N_INSNS (100); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2182 + return true; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2183 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2184 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2185 + /* Figure out if there is a constant argument, and its value. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2186 + if (GET_RTX_CLASS (code) == RTX_BIN_ARITH |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2187 + || GET_RTX_CLASS (code) == RTX_COMM_ARITH) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2188 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2189 + nargs = 2; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2190 + if (GET_CODE (op1) == CONST_INT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2191 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2192 + has_const_arg = 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2193 + const_arg = INTVAL (op1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2194 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2195 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2196 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2197 + /* Penalize a reg/reg operation by adding MEMORY_MOVE_COST, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2198 + * Ignore soft registers, since these are really in memory. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2199 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2200 + * TODO: penalize HImode reg/reg for most operations, except maybe |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2201 + * additions since index registers allow for that. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2202 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2203 + * TODO: shifts by constant N do not always require N instructions; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2204 + * some of this can be done cheaper. The number of actual insns can be |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2205 + * predicted well. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2206 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2207 + if (nargs == 2 && REAL_REG_P (op0) && REAL_REG_P (op1)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2208 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2209 + *total = MEMORY_MOVE_COST (mode, Q_REGS, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2210 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2211 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2212 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2213 + *total = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2214 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2215 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2216 + /* Operator RTXs are counted as COSTS_N_INSNS(N), where N is |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2217 + the estimated number of actual machine instructions needed to |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2218 + perform the computation. Some small adjustments are made since |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2219 + some "instructions" are more complex than others. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2220 + switch (code) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2221 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2222 + case PLUS: case MINUS: case COMPARE: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2223 + /* 6809 handles these natively in QImode, and in HImode as long |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2224 + * as operand 1 is constant. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2225 + if (mode == QImode || (mode == HImode && has_const_arg)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2226 + *total += COSTS_N_INSNS (1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2227 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2228 + *total += COSTS_N_INSNS (GET_MODE_SIZE (mode)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2229 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2230 + /* -1, 0, and 1 can be done using inherent instructions |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2231 + * for PLUS and MINUS in QImode, so don't add extra cost. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2232 + if (has_const_arg |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2233 + && (mode == QImode || mode == HImode) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2234 + && (const_arg == -1 || const_arg == 0 || const_arg == 1) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2235 + && (code == PLUS || code == MINUS)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2236 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2237 + return true; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2238 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2239 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2240 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2241 + case AND: case IOR: case XOR: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2242 + case NEG: case NOT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2243 + /* 6809 handles these natively in QImode, but requires |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2244 + * splitting in HImode. Treat these as 2 insns. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2245 + *total += COSTS_N_INSNS (1) * GET_MODE_SIZE (mode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2246 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2247 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2248 + case ASHIFT: case ASHIFTRT: case LSHIFTRT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2249 + case ROTATE: case ROTATERT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2250 + /* 6809 can do shift/rotates of a QImode by a constant in |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2251 + * 1 insn times the shift count, or in HImode by a constant |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2252 + * by splitting to 2 insns. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2253 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2254 + * Shift by a nonconstant will take significantly longer |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2255 + * than any of these. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2256 + if (has_const_arg) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2257 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2258 + const_arg %= (GET_MODE_SIZE (mode) * 8); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2259 + if (const_arg == 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2260 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2261 + *total += COSTS_N_INSNS(1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2262 + return true; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2263 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2264 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2265 + /* HImode shifts greater than 8 get optimized due |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2266 + * to register transfer from b to a; this cuts down the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2267 + * cost. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2268 + if (const_arg >= 8) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2269 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2270 + *total += COSTS_N_INSNS (1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2271 + const_arg -= 8; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2272 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2273 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2274 + /* The computed cost is 'const_arg' 1-bit shifts, doubled |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2275 + if in HImode, minus the cost of the constant itself which |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2276 + will be added in later but really shouldn't be. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2277 + *total += COSTS_N_INSNS (const_arg) * GET_MODE_SIZE (mode) - 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2278 + return true; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2279 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2280 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2281 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2282 + /* It may take up to 7 iterations of about 6-7 real |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2283 + * instructions, so make this expensive. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2284 + *total += COSTS_N_INSNS (50); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2285 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2286 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2287 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2288 + case MULT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2289 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2290 + /* Multiply is cheap when both arguments are 8-bits. They |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2291 + could be QImode, or QImode widened to HImode, or a constant |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2292 + that fits into 8-bits. As long as both operands qualify, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2293 + we can use a single mul instruction. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2294 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2295 + Assume that fast multiply can be used, and change this if we find |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2296 + differently... */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2297 + int ok_for_qihi3 = 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2298 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2299 + /* Check the first operand */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2300 + switch (GET_MODE (op0)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2301 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2302 + case QImode: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2303 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2304 + case HImode: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2305 + if (GET_CODE (op0) != SIGN_EXTEND && GET_CODE (op0) != ZERO_EXTEND) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2306 + ok_for_qihi3 = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2307 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2308 + default: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2309 + ok_for_qihi3 = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2310 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2311 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2312 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2313 + /* Likewise, check the second operand. This is where constants may appear. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2314 + switch (GET_MODE (op1)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2315 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2316 + case QImode: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2317 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2318 + case HImode: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2319 + if (GET_CODE (op1) != SIGN_EXTEND && GET_CODE (op1) != ZERO_EXTEND) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2320 + ok_for_qihi3 = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2321 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2322 + case VOIDmode: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2323 + if (!CONST_OK_FOR_LETTER_P (const_arg, 'K')) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2324 + ok_for_qihi3 = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2325 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2326 + default: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2327 + ok_for_qihi3 = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2328 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2329 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2330 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2331 + /* Fast multiply takes about 4 times as many cycles as a normal |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2332 + arithmetic operation. Otherwise, it will take an expensive libcall. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2333 + if (ok_for_qihi3) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2334 + *total += COSTS_N_INSNS (4); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2335 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2336 + *total = COSTS_N_INSNS (50); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2337 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2338 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2339 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2340 + case DIV: case UDIV: case MOD: case UMOD: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2341 + /* These all require more expensive libcalls. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2342 + *total += COSTS_N_INSNS (100); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2343 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2344 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2345 + /* TODO : TRUNCATE, SIGN_EXTEND, and ZERO_EXTEND */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2346 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2347 + /* These can normally be done with autoincrement, etc., so |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2348 + * don't charge for them. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2349 + case PRE_DEC: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2350 + case PRE_INC: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2351 + case POST_DEC: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2352 + case POST_INC: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2353 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2354 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2355 + default: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2356 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2357 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2358 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2359 + /* Always return false, and let the caller gather the costs |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2360 + * of the operands */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2361 + return false; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2362 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2363 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2364 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2365 +static tree |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2366 +m6809_handle_fntype_attribute (tree *node, tree name, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2367 + tree args ATTRIBUTE_UNUSED, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2368 + int flags ATTRIBUTE_UNUSED, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2369 + bool *no_add_attrs) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2370 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2371 + if (TREE_CODE (*node) != FUNCTION_TYPE) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2372 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2373 + warning (WARNING_OPT "'%s' only valid for functions", |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2374 + IDENTIFIER_POINTER (name)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2375 + *no_add_attrs = TRUE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2376 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2377 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2378 + return NULL_TREE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2379 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2380 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2381 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2382 +static tree |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2383 +m6809_handle_data_type_attribute (tree *node ATTRIBUTE_UNUSED, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2384 + tree name ATTRIBUTE_UNUSED, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2385 + tree args ATTRIBUTE_UNUSED, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2386 + int flags ATTRIBUTE_UNUSED, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2387 + bool *no_add_attrs ATTRIBUTE_UNUSED) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2388 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2389 + return NULL_TREE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2390 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2391 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2392 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2393 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2394 +static tree |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2395 +m6809_handle_default_attribute (tree *node ATTRIBUTE_UNUSED, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2396 + tree name ATTRIBUTE_UNUSED, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2397 + tree args ATTRIBUTE_UNUSED, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2398 + int flags ATTRIBUTE_UNUSED, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2399 + bool *no_add_attrs ATTRIBUTE_UNUSED ) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2400 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2401 + return NULL_TREE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2402 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2403 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2404 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2405 +/* Table of valid machine attributes */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2406 +const struct attribute_spec m6809_attribute_table[] = { /* |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2407 +{ name, min, max, decl, type, fntype, handler } */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2408 +{ "interrupt", 0, 0, false, true, true, m6809_handle_fntype_attribute }, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2409 +{ "naked", 0, 0, false, true, true, m6809_handle_fntype_attribute }, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2410 +{ "far", 0, 1, false, true, true, m6809_handle_fntype_attribute }, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2411 +{ "bank", 0, 1, true, false, false, m6809_handle_default_attribute }, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2412 +{ "boolean", 0, 0, false, true, false, m6809_handle_data_type_attribute }, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2413 +{ NULL, 0, 0, false, true, false, NULL }, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2414 +}; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2415 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2416 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2417 +/** Initialize builtin routines for the 6809. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2418 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2419 +m6809_init_builtins (void) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2420 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2421 + /* Create type trees for each function signature required. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2422 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2423 + * void_ftype_void = void f(void) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2424 + * void_ftype_uchar = void f(unsigned char) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2425 + * uchar_ftype_uchar2 = unsigned char f (unsigned char, unsigned char) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2426 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2427 + tree void_ftype_void = |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2428 + build_function_type (void_type_node, void_list_node); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2429 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2430 + tree void_ftype_uchar = |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2431 + build_function_type (void_type_node, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2432 + tree_cons (NULL_TREE, unsigned_char_type_node, void_list_node)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2433 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2434 + tree uchar_ftype_uchar2 = |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2435 + build_function_type (unsigned_char_type_node, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2436 + tree_cons (NULL_TREE, unsigned_char_type_node, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2437 + tree_cons (NULL_TREE, unsigned_char_type_node, void_list_node))); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2438 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2439 + /* Register each builtin function. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2440 + add_builtin_function ("__builtin_swi", void_ftype_void, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2441 + M6809_SWI, BUILT_IN_MD, NULL, NULL_TREE); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2442 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2443 + add_builtin_function ("__builtin_swi2", void_ftype_void, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2444 + M6809_SWI2, BUILT_IN_MD, NULL, NULL_TREE); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2445 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2446 + add_builtin_function ("__builtin_swi3", void_ftype_void, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2447 + M6809_SWI3, BUILT_IN_MD, NULL, NULL_TREE); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2448 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2449 + add_builtin_function ("__builtin_cwai", void_ftype_uchar, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2450 + M6809_CWAI, BUILT_IN_MD, NULL, NULL_TREE); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2451 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2452 + add_builtin_function ("__builtin_sync", void_ftype_void, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2453 + M6809_SYNC, BUILT_IN_MD, NULL, NULL_TREE); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2454 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2455 + add_builtin_function ("__builtin_nop", void_ftype_void, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2456 + M6809_NOP, BUILT_IN_MD, NULL, NULL_TREE); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2457 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2458 + add_builtin_function ("__builtin_blockage", void_ftype_void, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2459 + M6809_BLOCKAGE, BUILT_IN_MD, NULL, NULL_TREE); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2460 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2461 + add_builtin_function ("__builtin_add_decimal", uchar_ftype_uchar2, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2462 + M6809_ADD_DECIMAL, BUILT_IN_MD, NULL, NULL_TREE); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2463 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2464 + add_builtin_function ("__builtin_add_carry", uchar_ftype_uchar2, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2465 + M6809_ADD_CARRY, BUILT_IN_MD, NULL, NULL_TREE); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2466 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2467 + add_builtin_function ("__builtin_sub_carry", uchar_ftype_uchar2, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2468 + M6809_SUB_CARRY, BUILT_IN_MD, NULL, NULL_TREE); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2469 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2470 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2471 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2472 +/** Used by m6809_expand_builtin, given a tree ARGLIST which |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2473 + * refers to the operands of a builtin call, return an rtx |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2474 + * that represents the nth operand, as denoted by OPNUM, which |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2475 + * is a zero-based integer. MODE gives the expected mode |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2476 + * of the operand. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2477 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2478 + * This rtx is suitable for use in the emitted RTL for the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2479 + * builtin instruction. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2480 +rtx |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2481 +m6809_builtin_operand (tree arglist, enum machine_mode mode, int opnum) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2482 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2483 + tree arg; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2484 + rtx r; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2485 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2486 + arg = CALL_EXPR_ARG (arglist, opnum); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2487 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2488 + /* Convert the tree to RTL */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2489 + r = expand_expr (arg, NULL_RTX, mode, EXPAND_NORMAL); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2490 + if (r == NULL_RTX) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2491 + return NULL_RTX; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2492 + return r; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2493 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2494 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2495 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2496 +/** Expand a builtin that was registered in init_builtins into |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2497 + * RTL. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2498 +rtx |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2499 +m6809_expand_builtin (tree exp, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2500 + rtx target, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2501 + rtx subtarget ATTRIBUTE_UNUSED, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2502 + enum machine_mode mode ATTRIBUTE_UNUSED, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2503 + int ignore ATTRIBUTE_UNUSED ) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2504 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2505 + tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2506 + tree arglist = exp; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2507 + unsigned int fcode = DECL_FUNCTION_CODE (fndecl); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2508 + rtx r0, r1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2509 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2510 + switch (fcode) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2511 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2512 + case M6809_SWI: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2513 + r0 = gen_rtx_CONST_INT (VOIDmode, 1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2514 + emit_insn (target = gen_m6809_swi (r0)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2515 + return target; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2516 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2517 + case M6809_SWI2: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2518 + r0 = gen_rtx_CONST_INT (VOIDmode, 2); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2519 + emit_insn (target = gen_m6809_swi (r0)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2520 + return target; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2521 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2522 + case M6809_SWI3: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2523 + r0 = gen_rtx_CONST_INT (VOIDmode, 3); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2524 + emit_insn (target = gen_m6809_swi (r0)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2525 + return target; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2526 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2527 + case M6809_CWAI: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2528 + r0 = m6809_builtin_operand (arglist, QImode, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2529 + emit_insn (target = gen_m6809_cwai (r0)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2530 + return target; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2531 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2532 + case M6809_SYNC: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2533 + emit_insn (target = gen_m6809_sync ()); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2534 + return target; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2535 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2536 + case M6809_ADD_CARRY: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2537 + r0 = m6809_builtin_operand (arglist, QImode, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2538 + r1 = m6809_builtin_operand (arglist, QImode, 1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2539 + if (!target) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2540 + target = gen_reg_rtx (QImode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2541 + emit_insn (gen_addqi3_carry (target, r0, r1)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2542 + return target; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2543 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2544 + case M6809_SUB_CARRY: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2545 + r0 = m6809_builtin_operand (arglist, QImode, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2546 + r1 = m6809_builtin_operand (arglist, QImode, 1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2547 + if (!target) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2548 + target = gen_reg_rtx (QImode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2549 + emit_insn (gen_subqi3_carry (target, r0, r1)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2550 + return target; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2551 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2552 + case M6809_NOP: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2553 + emit_insn (target = gen_nop ()); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2554 + return target; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2555 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2556 + case M6809_BLOCKAGE: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2557 + emit_insn (target = gen_blockage ()); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2558 + return target; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2559 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2560 + case M6809_ADD_DECIMAL: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2561 + r0 = m6809_builtin_operand (arglist, QImode, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2562 + r1 = m6809_builtin_operand (arglist, QImode, 1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2563 + if (!target) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2564 + target = gen_reg_rtx (QImode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2565 + emit_insn (gen_addqi3_decimal (target, r0, r1)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2566 + return target; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2567 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2568 + default: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2569 + warning (WARNING_OPT "unknown builtin expansion ignored"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2570 + return NULL_RTX; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2571 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2572 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2573 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2574 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2575 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2576 +/* Returns nonzero if 'x' represents a function that was declared |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2577 + * as __noreturn__. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2578 +int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2579 +noreturn_functionp (rtx x) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2580 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2581 + tree decl = call_target_decl (x); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2582 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2583 + if (decl == NULL_TREE) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2584 + return 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2585 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2586 + return TREE_THIS_VOLATILE (decl); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2587 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2588 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2589 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2590 +const char * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2591 +far_function_type_p (tree type) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2592 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2593 + tree attr; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2594 + const char *page; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2595 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2596 + /* Return whether or not this decl has the far attribute */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2597 + attr = lookup_attribute ("far", TYPE_ATTRIBUTES (type)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2598 + if (attr == NULL_TREE) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2599 + return NULL; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2600 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2601 + /* If it is far, check for a value */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2602 + attr = TREE_VALUE (attr); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2603 + if (attr == NULL_TREE) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2604 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2605 + warning (WARNING_OPT "far code page not specified, using local value"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2606 + return far_code_page; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2607 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2608 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2609 + /* We have a TREE_LIST of attribute values, get the first one. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2610 + * It should be an INTEGER_CST. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2611 + attr = TREE_VALUE (attr); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2612 + page = TREE_STRING_POINTER (attr); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2613 + return page; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2614 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2615 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2616 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2617 +/* For a far function, returns the identifier that states which page |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2618 + * it resides in. Otherwise, returns NULL for ordinary functions. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2619 +const char * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2620 +far_functionp (rtx x) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2621 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2622 + tree decl, decl_type; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2623 + const char *page; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2624 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2625 + /* Find the FUNCTION_DECL corresponding to the rtx being called. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2626 + decl = call_target_decl (x); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2627 + if (decl == NULL_TREE) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2628 + return NULL; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2629 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2630 + /* See if the function has the new 'banked' attribute. These |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2631 + * are numeric instead of text */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2632 + page = m6809_get_decl_bank (decl); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2633 + if (page) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2634 + return page; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2635 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2636 + /* No, lookup the type of the function and see if the type |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2637 + * specifies far or not. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2638 + decl_type = TREE_TYPE (decl); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2639 + if (decl_type == NULL_TREE) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2640 + return NULL; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2641 + return far_function_type_p (decl_type); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2642 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2643 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2644 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2645 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2646 +/** Outputs the assembly language for a far call. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2647 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2648 +output_far_call_insn (rtx *operands, int has_return) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2649 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2650 + static char page_data[64]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2651 + const char *called_page; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2652 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2653 + /* The logic is the same for functions whether or not there |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2654 + * is a return value. Skip over the return value in this |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2655 + * case, so that the call location is always operands[0]. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2656 + if (has_return) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2657 + operands++; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2658 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2659 + /* Get the name of the page being called */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2660 + called_page = far_functionp (operands[0]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2661 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2662 +#if 0 /* TODO : broken logic */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2663 + /* See if the called page name is a 'bank' */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2664 + if (isdigit (*called_page)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2665 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2666 + /* New style banking */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2667 + if (!strcmp (called_page, current_bank_name)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2668 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2669 + /* Same page */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2670 + output_asm_insn ("jsr\t%0", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2671 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2672 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2673 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2674 + /* Different page */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2675 + output_asm_insn ("jsr\t__far_call_handler\t;new style", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2676 + output_asm_insn ("\t.dw\t%0", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2677 + sprintf (page_data, "\t.db\t%s", called_page); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2678 + output_asm_insn (page_data, operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2679 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2680 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2681 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2682 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2683 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2684 + /* Are we calling a different page than we are running in? */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2685 + if (!strcmp (called_page, far_code_page)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2686 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2687 + /* Same page : no need to execute a far call */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2688 + if (flag_pic) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2689 + output_asm_insn ("lbsr\t%C0", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2690 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2691 + output_asm_insn ("jsr\t%0", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2692 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2693 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2694 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2695 + /* Different page : need to emit far call thunk */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2696 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2697 + /* First output a call to the thunk for making far calls. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2698 + if (flag_pic) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2699 + output_asm_insn ("lbsr\t__far_call_handler", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2700 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2701 + output_asm_insn ("jsr\t__far_call_handler\t;old style", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2702 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2703 + /* Now output the name of the call site */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2704 + output_asm_insn ("\t.dw\t%C0", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2705 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2706 + /* Finally output the page number */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2707 + sprintf (page_data, "\t.db\t%s", far_functionp (operands[0])); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2708 + output_asm_insn (page_data, operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2709 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2710 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2711 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2712 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2713 +int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2714 +m6809_init_cumulative_args (CUMULATIVE_ARGS cum ATTRIBUTE_UNUSED, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2715 + tree fntype, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2716 + rtx libname ATTRIBUTE_UNUSED) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2717 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2718 + cum = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2719 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2720 + /* For far functions, the current implementation does not allow for |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2721 + * stack parameters. So note whenever the called function is far |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2722 + * and in a different page than the current one; such a function |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2723 + * should give an error if a stack parameter is generated. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2724 + if (fntype) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2725 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2726 + const char *called_page = far_function_type_p (fntype); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2727 + if (called_page && strcmp (called_page, far_code_page) && !TARGET_FAR_STACK_PARAM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2728 + cum |= CUM_STACK_INVALID; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2729 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2730 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2731 + if (fntype && TYPE_ARG_TYPES (fntype) != 0 && |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2732 + (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) != void_type_node)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2733 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2734 + /* has variable arguments, cannot use registers */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2735 + cum |= (CUM_X_MASK | CUM_B_MASK | CUM_STACK_ONLY); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2736 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2737 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2738 + if (m6809_abi_version == M6809_ABI_VERSION_STACK) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2739 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2740 + /* cannot use registers ; only use the stack */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2741 + cum |= (CUM_STACK_ONLY | CUM_X_MASK | CUM_B_MASK); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2742 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2743 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2744 + return cum; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2745 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2746 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2747 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2748 +rtx |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2749 +m6809_function_arg_on_stack (CUMULATIVE_ARGS *cump) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2750 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2751 + if (*cump & CUM_STACK_INVALID) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2752 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2753 + *cump &= ~CUM_STACK_INVALID; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2754 + error ("far function needs stack, will not work"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2755 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2756 + return NULL_RTX; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2757 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2758 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2759 +void m6809_asm_trampoline_template(FILE *f) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2760 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2761 + fprintf(f, "ldy #0000\n"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2762 + fprintf(f, "jmp 0x0000\n"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2763 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2764 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2765 +/* |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2766 + * Trampoline output: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2767 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2768 + * ldu #&cxt 4 bytes --LDY- ?? ?? |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2769 + * jmp fnaddr 3 bytes JMP ?? ?? |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2770 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2771 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2772 +m6809_initialize_trampoline (rtx tramp, tree fndecl, rtx cxt) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2773 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2774 + rtx fnaddr = XEXP (DECL_RTL (fndecl), 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2775 + /* TODO - optimize by generating the entire trampoline code here, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2776 + * and removing the template altogether, since there are only two |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2777 + * bytes there that matter. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2778 + emit_move_insn (gen_rtx_MEM (HImode, plus_constant (tramp, 2)), cxt); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2779 + emit_move_insn (gen_rtx_MEM (HImode, plus_constant (tramp, 5)), fnaddr); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2780 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2781 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2782 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2783 +/** Echo the version of the compiler and the name of the source file |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2784 + * at the beginning of each assembler output file. asm_out_file |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2785 + * is a global FILE * pointing to the output stream. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2786 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2787 +m6809_asm_file_start (void) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2788 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2789 + const char *module_name; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2790 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2791 + fprintf (asm_out_file, "\n;;; gcc for m6809 : %s %s\n", |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2792 + __DATE__, __TIME__); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2793 + fprintf (asm_out_file, ";;; %s\n", version_string); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2794 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2795 + fprintf (asm_out_file, ";;; ABI version %d\n", m6809_abi_version); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2796 + fprintf (asm_out_file, ";;; %s\n", |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2797 + (TARGET_BYTE_INT ? "-mint8" : "-mint16")); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2798 + if (TARGET_EXPERIMENT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2799 + fprintf (asm_out_file, ";;; -mexperiment\n"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2800 + if (TARGET_WPC) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2801 + fprintf (asm_out_file, ";;; -mwpc\n"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2802 + if (TARGET_6309) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2803 + fprintf (asm_out_file, ";;; -m6309\n"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2804 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2805 + /* Print the name of the module, which is taken as the base name |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2806 + * of the input file. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2807 + * See the 'User-Defined Symbols' section of the assembler |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2808 + * documentation for the rules on valid symbols. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2809 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2810 + module_name = lbasename (main_input_filename); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2811 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2812 + fprintf (asm_out_file, "\t.module\t"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2813 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2814 + if (*module_name >= '0' && *module_name <= '9') |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2815 + fprintf (asm_out_file, "_"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2816 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2817 + while (*module_name) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2818 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2819 + if ((*module_name >= '0' && *module_name <= '9') |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2820 + || (*module_name >= 'A' && *module_name <= 'Z') |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2821 + || (*module_name >= 'a' && *module_name <= 'z') |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2822 + || *module_name == '$' |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2823 + || *module_name == '.' |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2824 + || *module_name == '_') |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2825 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2826 + fprintf (asm_out_file, "%c", *module_name); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2827 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2828 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2829 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2830 + fprintf (asm_out_file, "_"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2831 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2832 + module_name++; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2833 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2834 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2835 + fprintf (asm_out_file, "\n"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2836 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2837 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2838 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2839 +/** Returns true if prologue/epilogue code is required for the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2840 + * current function being compiled. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2841 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2842 + * This is just the inverse of whether the function is declared as |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2843 + * 'naked'. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2844 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2845 +int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2846 +prologue_epilogue_required (void) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2847 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2848 + return !m6809_current_function_has_type_attr_p ("naked") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2849 + && !m6809_current_function_has_type_attr_p ("noreturn"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2850 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2851 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2852 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2853 +/** Expand RTL for function entry */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2854 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2855 +emit_prologue_insns (void) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2856 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2857 + rtx insn; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2858 + unsigned int live_regs = m6809_get_live_regs (); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2859 + unsigned int frame_size = get_frame_size (); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2860 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2861 + /* Save all registers used, including the frame pointer */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2862 + if (live_regs && !m6809_current_function_has_type_attr_p ("interrupt")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2863 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2864 + insn = emit_insn ( |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2865 + gen_rtx_register_pushpop (UNSPEC_PUSH_RS, live_regs)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2866 + RTX_FRAME_RELATED_P (insn) = 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2867 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2868 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2869 + /* Allocate space for local variables */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2870 + if (frame_size != 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2871 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2872 + insn = emit_insn (gen_rtx_stack_adjust (MINUS, frame_size)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2873 + RTX_FRAME_RELATED_P (insn) = 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2874 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2875 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2876 + /* Set the frame pointer if it is needed */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2877 + if (frame_pointer_needed) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2878 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2879 + insn = emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2880 + RTX_FRAME_RELATED_P (insn) = 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2881 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2882 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2883 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2884 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2885 +/** Expand RTL for function exit */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2886 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2887 +emit_epilogue_insns (bool sibcall_p) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2888 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2889 + unsigned int live_regs = m6809_get_live_regs (); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2890 + unsigned int frame_size = get_frame_size (); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2891 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2892 + if (frame_size != 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2893 + emit_insn (gen_rtx_stack_adjust (PLUS, frame_size)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2894 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2895 + if (sibcall_p) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2896 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2897 + if (live_regs) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2898 + emit_insn (gen_rtx_register_pushpop (UNSPEC_POP_RS, live_regs)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2899 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2900 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2901 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2902 + if (live_regs && !m6809_current_function_has_type_attr_p ("interrupt")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2903 + emit_insn ( |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2904 + gen_rtx_register_pushpop (UNSPEC_POP_RS, PC_REGBIT | live_regs)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2905 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2906 + if (m6809_current_function_has_type_attr_p ("interrupt")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2907 + emit_jump_insn (gen_return_rti ()); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2908 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2909 + emit_jump_insn (gen_return_rts ()); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2910 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2911 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2912 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2913 +#if 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2914 +/** Predefine some preprocessor names according to the currently |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2915 + * selected compiler options */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2916 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2917 +m6809_cpu_cpp_builtins (void) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2918 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2919 + if (TARGET_6309) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2920 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2921 + builtin_define_std ("__M6309__"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2922 + builtin_define_std ("__m6309__"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2923 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2924 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2925 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2926 + builtin_define_std ("__M6809__"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2927 + builtin_define_std ("__m6809__"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2928 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2929 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2930 + if (TARGET_BYTE_INT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2931 + builtin_define_std ("__int8__"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2932 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2933 + builtin_define_std ("__int16__"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2934 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2935 + switch (m6809_abi_version) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2936 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2937 + case M6809_ABI_VERSION_STACK: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2938 + builtin_define_std ("__regargs__"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2939 + builtin_define_std ("__ABI_STACK__"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2940 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2941 + case M6809_ABI_VERSION_REGS: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2942 + builtin_define_std ("__ABI_REGS__"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2943 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2944 + case M6809_ABI_VERSION_BX: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2945 + builtin_define_std ("__ABI_BX__"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2946 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2947 + default: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2948 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2949 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2950 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2951 + if (TARGET_WPC) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2952 + builtin_define_std ("__WPC__"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2953 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2954 + if (TARGET_DRET) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2955 + builtin_define_std ("__DRET__"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2956 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2957 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2958 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2959 +#define MAX_ASM_ASCII_STRING 48 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2960 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2961 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2962 +m6809_output_ascii (FILE *fp, const char *str, unsigned long size) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2963 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2964 + unsigned long i; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2965 + bool use_ascii = true; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2966 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2967 + /* If the size is too large, then break this up into multiple |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2968 + outputs. The assembler can only output roughly 48 bytes at a |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2969 + time. Note that if there are lots of escape sequences in |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2970 + the string, this may fail. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2971 + if (size > MAX_ASM_ASCII_STRING) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2972 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2973 + m6809_output_ascii (fp, str, MAX_ASM_ASCII_STRING); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2974 + m6809_output_ascii (fp, str + MAX_ASM_ASCII_STRING, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2975 + size - MAX_ASM_ASCII_STRING); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2976 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2977 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2978 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2979 + /* Check for 8-bit codes, which cannot be embedded in an .ascii */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2980 + for (i = 0; i < size; i++) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2981 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2982 + int c = str[i] & 0377; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2983 + if (c >= 0x80) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2984 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2985 + use_ascii = false; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2986 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2987 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2988 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2989 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2990 + if (use_ascii) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2991 + fprintf (fp, "\t.ascii \""); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2992 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2993 + for (i = 0; i < size; i++) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2994 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2995 + int c = str[i] & 0377; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2996 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2997 + if (use_ascii) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2998 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2999 + /* Just output the plain character if it is printable, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3000 + otherwise output the escape code for the character. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3001 + The assembler recognizes the same C-style octal escape sequences, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3002 + except that it only supports 7-bit codes. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3003 + if (c >= ' ' && c < 0177 && c != '\\' && c != '"') |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3004 + putc (c, fp); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3005 + else switch (c) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3006 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3007 + case '\n': |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3008 +#ifndef TARGET_COCO |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3009 + fputs ("\\n", fp); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3010 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3011 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3012 + /* On the CoCo, we fallthrough and treat '\n' like '\r'. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3013 + case '\r': |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3014 + fputs ("\\r", fp); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3015 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3016 + case '\t': |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3017 + fputs ("\\t", fp); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3018 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3019 + case '\f': |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3020 + fputs ("\\f", fp); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3021 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3022 + case 0: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3023 + fputs ("\\0", fp); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3024 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3025 + default: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3026 + fprintf (fp, "\\%03o", c); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3027 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3028 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3029 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3030 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3031 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3032 + fprintf (fp, "\t.byte\t0x%02X\n", c); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3033 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3034 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3035 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3036 + if (use_ascii) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3037 + fprintf (fp, "\"\n"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3038 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3039 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3040 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3041 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3042 +m6809_output_quoted_string (FILE *asm_file, const char *string) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3043 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3044 + char c; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3045 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3046 + if (strlen (string) > MAX_ASM_ASCII_STRING) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3047 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3048 + /* The string length is too large. We'll have to truncate it. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3049 + This is only called from debugging functions, so it's usually |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3050 + not critical. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3051 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3052 + char truncated_string[MAX_ASM_ASCII_STRING+1]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3053 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3054 + /* Copy as many characters as we can. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3055 + strncpy (truncated_string, string, MAX_ASM_ASCII_STRING); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3056 + truncated_string[MAX_ASM_ASCII_STRING] = '\0'; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3057 + string = truncated_string; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3058 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3059 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3060 + /* Copied from toplev.c */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3061 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3062 + putc ('\"', asm_file); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3063 + while ((c = *string++) != 0) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3064 + if (ISPRINT (c)) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3065 + if (c == '\"' || c == '\\') |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3066 + putc ('\\', asm_file); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3067 + putc (c, asm_file); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3068 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3069 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3070 + fprintf (asm_file, "\\%03o", (unsigned char) c); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3071 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3072 + putc ('\"', asm_file); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3073 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3074 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3075 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3076 +/** Output the assembly code for a shift instruction where the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3077 + * shift count is not constant. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3078 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3079 +m6809_output_shift_insn (int rtx_code, rtx *operands) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3080 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3081 + struct shift_opcode *op; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3082 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3083 + if (GET_CODE (operands[2]) == CONST_INT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3084 + abort (); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3085 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3086 + if (optimize_size && GET_MODE (operands[0]) == HImode) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3087 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3088 + switch (rtx_code) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3089 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3090 + case ASHIFT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3091 + output_asm_insn ("jsr\t_ashlhi3", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3092 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3093 + case ASHIFTRT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3094 + output_asm_insn ("jsr\t_ashrhi3", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3095 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3096 + case LSHIFTRT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3097 + output_asm_insn ("jsr\t_lshrhi3", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3098 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3099 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3100 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3101 + else if (GET_MODE (operands[0]) == HImode) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3102 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3103 + switch (rtx_code) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3104 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3105 + case ASHIFT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3106 + m6809_gen_register_shift (operands, "aslb", "rola"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3107 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3108 + case ASHIFTRT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3109 + m6809_gen_register_shift (operands, "asra", "rorb"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3110 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3111 + case LSHIFTRT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3112 + m6809_gen_register_shift (operands, "lsra", "rorb"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3113 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3114 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3115 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3116 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3117 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3118 + switch (rtx_code) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3119 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3120 + case ASHIFT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3121 + m6809_gen_register_shift (operands, "aslb", NULL); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3122 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3123 + case ASHIFTRT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3124 + m6809_gen_register_shift (operands, "asrb", NULL); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3125 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3126 + case LSHIFTRT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3127 + m6809_gen_register_shift (operands, "lsrb", NULL); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3128 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3129 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3130 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3131 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3132 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3133 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3134 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3135 +m6809_emit_move_insn (rtx dst, rtx src) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3136 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3137 + emit_insn (gen_rtx_SET (VOIDmode, dst, src)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3138 + if (ACC_A_REG_P (dst)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3139 + emit_insn (gen_rtx_USE (VOIDmode, dst)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3140 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3141 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3142 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3143 +/** Split a complex shift instruction into multiple CPU |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3144 + * shift instructions. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3145 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3146 +m6809_split_shift (enum rtx_code code, rtx *operands) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3147 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3148 + enum machine_mode mode; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3149 + int count; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3150 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3151 + mode = GET_MODE (operands[0]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3152 + count = INTVAL (operands[2]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3153 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3154 + /* Handle a shift count outside the range of 0 .. N-1, where |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3155 + * N is the mode size in bits. We normalize the count, and |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3156 + * for negative counts we also invert the direction of the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3157 + * shift. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3158 + if ((count < 0) || (count >= 8 * GET_MODE_SIZE (mode))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3159 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3160 + if (count < 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3161 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3162 + count = -count; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3163 + code = (code == ASHIFT) ? ASHIFTRT : ASHIFT; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3164 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3165 + count %= (8 * GET_MODE_SIZE (mode)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3166 + m6809_emit_move_insn (operands[0], |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3167 + gen_rtx_fmt_ee (code, mode, operands[1], |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3168 + gen_rtx_CONST_INT (VOIDmode, count))); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3169 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3170 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3171 + /* Handle shift by zero explicitly as a no-op. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3172 + if (count == 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3173 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3174 + emit_insn (gen_nop ()); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3175 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3176 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3177 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3178 + /* Decompose the shift by a constant N > 8 into two |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3179 + * shifts, first by 8 and then by N-8. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3180 + * This "speeds up" the process for large shifts that would be |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3181 + * handled below, but allows for some optimization. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3182 + * In some cases shift by 8 can be implemented fast. If an |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3183 + * instruction to shift by 8 is defined, it will be used here; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3184 + * otherwise it will be further decomposed as below. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3185 + if (mode == HImode && count > 8) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3186 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3187 + rtx output = operands[0]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3188 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3189 + m6809_emit_move_insn (operands[0], |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3190 + gen_rtx_fmt_ee (code, mode, operands[1], |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3191 + gen_rtx_CONST_INT (VOIDmode, 8))); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3192 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3193 + /* Unsigned shifts always produce a zero in either the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3194 + * upper or lower half of the output; then, that part |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3195 + * does not need to be shifted anymore. We modify the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3196 + * output and the subsequent instructions to operate in |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3197 + * QImode only on the relevant part. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3198 + if (REG_P (output)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3199 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3200 + if (code == ASHIFT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3201 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3202 + output = gen_rtx_REG (QImode, HARD_A_REGNUM); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3203 + mode = QImode; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3204 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3205 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3206 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3207 + output = gen_rtx_REG (QImode, HARD_D_REGNUM); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3208 + mode = QImode; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3209 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3210 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3211 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3212 + m6809_emit_move_insn (output, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3213 + gen_rtx_fmt_ee (code, mode, copy_rtx (output), |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3214 + gen_rtx_CONST_INT (VOIDmode, count-8))); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3215 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3216 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3217 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3218 + /* Rewrite the unsigned shift of an 8-bit register by a large constant N |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3219 + * (near to the maximum of 8) as a rotate and mask. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3220 + if (mode == QImode && REG_P (operands[0]) && count >= ((code == ASHIFTRT) ? 7 : 6)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3221 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3222 + unsigned int mask; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3223 + unsigned int was_signed = (code == ASHIFTRT); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3224 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3225 + code = (code == ASHIFT) ? ROTATERT : ROTATE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3226 + if (code == ROTATE) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3227 + mask = (count == 6) ? 0x03 : 0x01; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3228 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3229 + mask = (count == 6) ? 0xC0 - 0x100 : 0x80 - 0x100; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3230 + count = 9 - count; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3231 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3232 + do { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3233 + m6809_emit_move_insn (operands[0], |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3234 + gen_rtx_fmt_ee (code, QImode, operands[1], const1_rtx)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3235 + } while (--count != 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3236 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3237 + m6809_emit_move_insn (operands[0], |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3238 + gen_rtx_fmt_ee (AND, QImode, operands[1], |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3239 + gen_rtx_CONST_INT (VOIDmode, mask))); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3240 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3241 + if (was_signed) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3242 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3243 + emit_insn (gen_negqi2 (operands[0], copy_rtx (operands[0]))); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3244 + if (ACC_A_REG_P (operands[0])) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3245 + emit_insn (gen_rtx_USE (VOIDmode, operands[0])); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3246 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3247 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3248 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3249 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3250 + /* Decompose the shift by any constant N > 1 into a sequence |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3251 + * of N shifts. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3252 + * This is done recursively, by creating a shift by 1 and a |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3253 + * shift by N-1, as long as N>1. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3254 + if (count > 1) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3255 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3256 + m6809_emit_move_insn (operands[0], |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3257 + gen_rtx_fmt_ee (code, mode, operands[1], const1_rtx)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3258 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3259 + m6809_emit_move_insn (operands[0], |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3260 + gen_rtx_fmt_ee (code, mode, operands[1], |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3261 + gen_rtx_CONST_INT (VOIDmode, count-1))); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3262 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3263 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3264 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3265 + /* Decompose the single shift of a 16-bit quantity into two |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3266 + * CPU instructions, one for each 8-bit half. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3267 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3268 + if (mode == HImode && count == 1) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3269 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3270 + rtx first, second; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3271 + enum rtx_code rotate_code; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3272 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3273 + rotate_code = (code == ASHIFT) ? ROTATE : ROTATERT; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3274 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3275 + /* Split the operand into two 8-bit entities. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3276 + * FIRST is the one that will get shifted via a regular CPU |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3277 + * instruction. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3278 + * SECOND is the one that will have the result of the first shift |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3279 + * rotated in. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3280 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3281 + * We initialize first and second as if we are doing a left shift, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3282 + * then swap the operands if it's a right shift. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3283 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3284 + if (REG_P (operands[0])) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3285 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3286 + first = gen_rtx_REG (QImode, HARD_D_REGNUM); /* HARD_B_REGNUM? */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3287 + second = gen_rtx_REG (QImode, HARD_A_REGNUM); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3288 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3289 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3290 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3291 + first = adjust_address (operands[0], QImode, 1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3292 + second = adjust_address (operands[0], QImode, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3293 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3294 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3295 + if (rotate_code == ROTATERT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3296 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3297 + rtx tmp; tmp = first; first = second; second = tmp; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3298 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3299 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3300 + /* Decompose into a shift and a rotate instruction. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3301 + m6809_emit_move_insn (first, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3302 + gen_rtx_fmt_ee (code, QImode, copy_rtx (first), const1_rtx)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3303 + m6809_emit_move_insn (second, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3304 + gen_rtx_fmt_ee (rotate_code, QImode, copy_rtx (second), const1_rtx)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3305 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3306 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3307 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3308 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3309 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3310 +/** Adjust register usage based on compile-time flags. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3311 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3312 +m6809_conditional_register_usage (void) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3313 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3314 + unsigned int soft_regno; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3315 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3316 +#ifdef CONFIG_SOFT_REGS_ALWAYS |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3317 + m6809_soft_regs = CONFIG_SOFT_REGS_ALWAYS; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3318 +#else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3319 + if (!m6809_soft_reg_count) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3320 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3321 + m6809_soft_regs = atoi (m6809_soft_reg_count); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3322 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3323 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3324 + if (m6809_soft_regs == 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3325 + return; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3326 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3327 + if (m6809_soft_regs > NUM_M_REGS) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3328 + m6809_soft_regs = NUM_M_REGS; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3329 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3330 + /* Registers are marked FIXED by default. Free up if |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3331 + the user wishes. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3332 + for (soft_regno = 1; soft_regno < m6809_soft_regs; soft_regno++) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3333 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3334 + fixed_regs[SOFT_M0_REGNUM + soft_regno] = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3335 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3336 + /* Mark the softregs as call-clobbered, so that they need |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3337 + * not be saved/restored on function entry/exit. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3338 + call_used_regs[SOFT_M0_REGNUM + soft_regno] = 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3339 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3340 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3341 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3342 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3343 +/** Return a RTX representing how to return a value from a function. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3344 + VALTYPE gives the type of the value, FUNC identifies the function |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3345 + itself. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3346 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3347 + In general, we only care about the width of the result. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3348 +rtx |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3349 +m6809_function_value (const tree valtype, const tree func ATTRIBUTE_UNUSED) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3350 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3351 + unsigned int regno; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3352 + enum machine_mode mode; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3353 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3354 + /* Get the mode (i.e. width) of the result. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3355 + mode = TYPE_MODE (valtype); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3356 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3357 + if (lookup_attribute ("boolean", TYPE_ATTRIBUTES (valtype))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3358 + regno = HARD_Z_REGNUM; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3359 + else if (mode == QImode || (TARGET_DRET && mode == HImode)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3360 + regno = HARD_D_REGNUM; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3361 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3362 + regno = HARD_X_REGNUM; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3363 + return gen_rtx_REG (mode, regno); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3364 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3365 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3366 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3367 +/** Return 1 if REGNO is possibly needed to return the result |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3368 +of a function, 0 otherwise. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3369 +int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3370 +m6809_function_value_regno_p (unsigned int regno) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3371 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3372 + if (regno == HARD_Z_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3373 + return 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3374 + else if ((TARGET_BYTE_INT || TARGET_DRET) && regno == HARD_D_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3375 + return 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3376 + else if (!TARGET_DRET && regno == HARD_X_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3377 + return 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3378 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3379 + return 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3380 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3381 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3382 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3383 +#ifdef TRACE_PEEPHOLE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3384 +int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3385 +m6809_match_peephole2 (unsigned int peephole_id, unsigned int stage) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3386 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3387 + if (stage == PEEP_END) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3388 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3389 + printf ("%s: peephole %d pattern and predicate matched\n", |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3390 + main_input_filename, peephole_id); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3391 + fflush (stdout); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3392 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3393 + else if (stage == PEEP_COND) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3394 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3395 + printf ("%s: peephole %d? at least pattern matched\n", |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3396 + main_input_filename, peephole_id); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3397 + fflush (stdout); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3398 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3399 + return 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3400 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3401 +#else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3402 +int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3403 +m6809_match_peephole2 (unsigned int peephole_id ATTRIBUTE_UNUSED, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3404 + unsigned int stage ATTRIBUTE_UNUSED) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3405 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3406 + return 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3407 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3408 +#endif /* TRACE_PEEPHOLE */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3409 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3410 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3411 +/** Return 1 if it is OK to store a value of MODE in REGNO. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3412 +int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3413 +m6809_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3414 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3415 + /* Soft registers, as they are just memory, can really hold |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3416 + values of any type. However we restrict them to values of |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3417 + size HImode or QImode to prevent exhausting them for larger |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3418 + values. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3419 + Word values cannot be placed into the first soft register, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3420 + as it is the low byte that is being placed there, which |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3421 + corrupts the (non-soft) register before it. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3422 + if (M_REGNO_P (regno)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3423 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3424 + switch (GET_MODE_SIZE (mode)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3425 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3426 + case 1: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3427 + return 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3428 + case 2: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3429 + return regno != SOFT_M0_REGNUM; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3430 + default: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3431 + return 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3432 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3433 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3434 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3435 + /* VOIDmode can be stored anywhere */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3436 + else if (mode == VOIDmode) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3437 + return 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3438 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3439 + /* Zero is a reserved register, but problems occur if we don't |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3440 + say yes here??? */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3441 + else if (regno == 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3442 + return 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3443 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3444 + /* For other registers, return true only if the requested size |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3445 + exactly matches the hardware size. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3446 + else if ((G_REGNO_P (regno)) && (GET_MODE_SIZE (mode) == 2)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3447 + return 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3448 + else if ((BYTE_REGNO_P (regno)) && (GET_MODE_SIZE (mode) == 1)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3449 + return 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3450 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3451 + return 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3452 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3453 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3454 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3455 +/* exp is the call expression. DECL is the called function, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3456 + * or NULL for an indirect call */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3457 +bool |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3458 +m6809_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3459 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3460 + tree type, arg; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3461 + const char *name; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3462 + bool result = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3463 + int argcount = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3464 + int step = 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3465 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3466 + /* If there is no DECL, it is an indirect call. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3467 + * Never optimize this??? */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3468 + if (decl == NULL) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3469 + goto done; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3470 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3471 + /* Never allow an interrupt handler to be optimized this way. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3472 + if (m6809_function_has_type_attr_p (decl, "interrupt")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3473 + goto done; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3474 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3475 + /* Skip sibcall if the type can't be found for |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3476 + * some reason */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3477 + step++; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3478 + name = IDENTIFIER_POINTER (DECL_NAME (decl)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3479 + type = TREE_TYPE (decl); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3480 + if (type == NULL) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3481 + goto done; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3482 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3483 + /* Skip sibcall if the target is a far function */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3484 + step++; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3485 + if (far_function_type_p (type) != NULL) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3486 + goto done; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3487 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3488 + /* Skip sibcall if the called function's arguments are |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3489 + * variable */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3490 + step++; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3491 + if (TYPE_ARG_TYPES (type) == NULL) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3492 + goto done; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3493 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3494 + /* Allow sibcalls in other cases. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3495 + result = 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3496 +done: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3497 + /* printf ("%s ok for sibcall? %s, step %d, args %d\n", name, result ? "yes" : "no", step, argcount); */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3498 + return result; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3499 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3500 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3501 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3502 +/** Emit code for the 'casesi' pattern. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3503 + * This pattern is only used in 8-bit mode, and can be disabled |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3504 + * with -mold-case there as well. The rationale for this is to |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3505 + * do a better job than the simpler but well-tested 'tablejump' |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3506 + * method. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3507 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3508 + * For small jumptables, where the switch expression is an |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3509 + * 8-bit value, the lookup can be done more efficiently |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3510 + * using the "B,X" style index mode. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3511 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3512 +m6809_do_casesi (rtx index, rtx lower_bound, rtx range, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3513 + rtx table_label, rtx default_label) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3514 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3515 + enum machine_mode mode; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3516 + rtx scaled; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3517 + rtx table_in_reg; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3518 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3519 + /* expr.c has to be patched so that it does not promote |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3520 + * the expression to SImode, but rather to HImode. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3521 + * Fail now if that isn't the case. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3522 + if (GET_MODE_SIZE (GET_MODE (index)) > GET_MODE_SIZE (HImode)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3523 + error ("try_casesi promotion bug"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3524 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3525 + /* Determine whether or not we are going to work primarily in |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3526 + * QImode or HImode. This depends on the size of the index |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3527 + * into the lookup table. QImode can only be used when the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3528 + * index is less than 0x40, since it will be doubled but |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3529 + * must remain unsigned. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3530 + if ((GET_CODE (range) == CONST_INT) && (INTVAL (range) < 0x40)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3531 + mode = QImode; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3532 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3533 + mode = HImode; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3534 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3535 + /* Convert to QImode if necessary */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3536 + if (mode == QImode) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3537 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3538 + index = gen_lowpart_general (mode, index); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3539 + lower_bound = gen_lowpart_general (mode, lower_bound); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3540 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3541 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3542 + /* Translate from case value to table index by subtraction */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3543 + if (lower_bound != const0_rtx) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3544 + index = expand_binop (mode, sub_optab, index, lower_bound, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3545 + NULL_RTX, 0, OPTAB_LIB_WIDEN); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3546 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3547 + /* Emit compare-and-jump to test for index out-of-range */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3548 + emit_cmp_and_jump_insns (index, range, GTU, NULL_RTX, mode, 1, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3549 + default_label); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3550 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3551 + /* Put the table address is in a register */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3552 + table_in_reg = gen_reg_rtx (Pmode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3553 + emit_move_insn (table_in_reg, gen_rtx_LABEL_REF (Pmode, table_label)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3554 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3555 + /* Emit table lookup and jump */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3556 + if (mode == QImode) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3557 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3558 + /* Scale the index */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3559 + scaled = gen_reg_rtx (QImode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3560 + emit_insn (gen_ashlqi3 (scaled, index, const1_rtx)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3561 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3562 + /* Emit the jump */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3563 + emit_jump_insn (gen_tablejump_short_offset (scaled, table_in_reg)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3564 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3565 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3566 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3567 + /* Scale the index */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3568 + emit_insn (gen_ashlhi3 (index, index, const1_rtx)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3569 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3570 + /* Emit the jump */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3571 + emit_jump_insn (gen_tablejump_long_offset (index, table_in_reg)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3572 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3573 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3574 + /* Copied from expr.c */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3575 + if (!CASE_VECTOR_PC_RELATIVE && !flag_pic) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3576 + emit_barrier (); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3577 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3578 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3579 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3580 +/** Output the assembly code for a 32-bit add/subtract. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3581 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3582 +m6809_output_addsi3 (int rtx_code, rtx *operands) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3583 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3584 + rtx xoperands[8]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3585 + rtx dst = operands[0]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3586 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3587 + /* Prepare the operands by splitting each SImode into two HImodes |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3588 + that can be operated independently. The high word of operand 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3589 + is further divided into two QImode components for use with 'adc' |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3590 + style instructions. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3591 + xoperands[7] = operands[3]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3592 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3593 + xoperands[0] = adjust_address (dst, HImode, 2); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3594 + xoperands[3] = adjust_address (dst, HImode, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3595 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3596 +#if 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3597 + xoperands[2] = adjust_address (operands[1], HImode, 2); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3598 + xoperands[6] = adjust_address (operands[1], HImode, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3599 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3600 + /* Operand 2 may be a MEM or a CONST_INT */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3601 + if (GET_CODE (operands[2]) == CONST_INT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3602 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3603 + xoperands[1] = gen_int_mode (INTVAL (operands[2]) & 0xFFFF, HImode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3604 + xoperands[4] = gen_int_mode ((INTVAL (operands[2]) >> 24) & 0xFF, QImode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3605 + xoperands[5] = gen_int_mode ((INTVAL (operands[2]) >> 16) & 0xFF, QImode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3606 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3607 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3608 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3609 + xoperands[1] = adjust_address (operands[2], HImode, 2); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3610 + xoperands[4] = adjust_address (operands[2], QImode, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3611 + xoperands[5] = adjust_address (operands[2], QImode, 1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3612 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3613 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3614 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3615 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3616 +#if 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3617 + xoperands[1] = adjust_address (operands[1], HImode, 2); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3618 + xoperands[4] = adjust_address (operands[1], QImode, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3619 + xoperands[5] = adjust_address (operands[1], QImode, 1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3620 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3621 + /* Operand 2 may be a MEM or a CONST_INT */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3622 + if (GET_CODE (operands[2]) == CONST_INT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3623 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3624 + xoperands[2] = gen_int_mode ((INTVAL (operands[2])) & 0xFFFF, HImode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3625 + xoperands[6] = gen_int_mode ((INTVAL (operands[2]) >> 16) & 0xFFFF, HImode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3626 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3627 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3628 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3629 + xoperands[2] = adjust_address (operands[2], HImode, 2); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3630 + xoperands[6] = adjust_address (operands[2], HImode, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3631 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3632 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3633 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3634 + /* Output the assembly code. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3635 + if (rtx_code == PLUS) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3636 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3637 + output_asm_insn ("ld%7\t%2", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3638 + output_asm_insn ("add%7\t%1", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3639 + output_asm_insn ("st%7\t%0", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3640 + output_asm_insn ("ld%7\t%6", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3641 + output_asm_insn ("adcb\t%5", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3642 + output_asm_insn ("adca\t%4", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3643 + output_asm_insn ("st%7\t%3", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3644 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3645 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3646 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3647 + output_asm_insn ("ld%7\t%2", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3648 + output_asm_insn ("sub%7\t%1", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3649 + output_asm_insn ("st%7\t%0", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3650 + output_asm_insn ("ld%7\t%6", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3651 + output_asm_insn ("sbcb\t%5", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3652 + output_asm_insn ("sbca\t%4", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3653 + output_asm_insn ("st%7\t%3", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3654 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3655 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3656 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3657 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3658 +#if 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3659 +/** Output the assembly code for a 32-bit shift. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3660 +Operands 0 and 1 must be the same rtx, forced by a matching |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3661 +constraint. Operand 2 must be a CONST_INT. Operand 3 is |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3662 +"d" in case a temporary reg is needed. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3663 +void |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3664 +m6809_output_shiftsi3 (int rtx_code, rtx *operands) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3665 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3666 + unsigned int count = INTVAL (operands[2]) % 32; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3667 + unsigned int size = 4; /* sizeof (SImode) */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3668 + int s; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3669 + rtx xoperands[4]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3670 + int op; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3671 + int start, end, step; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3672 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3673 + /* Initialize */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3674 + if (rtx_code == ASHIFT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3675 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3676 + start = size-1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3677 + end = -1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3678 + step = -1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3679 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3680 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3681 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3682 + start = 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3683 + end = size; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3684 + step = 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3685 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3686 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3687 + xoperands[2] = operands[2]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3688 + xoperands[3] = operands[3]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3689 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3690 + if (count <= 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3691 + abort (); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3692 + if (rtx_code == ROTATE || rtx_code == ROTATERT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3693 + abort (); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3694 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3695 + /* Extract bit shifts over 16 bits by HImode moves. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3696 + if (count >= 16) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3697 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3698 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3699 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3700 + /* Extract bit shifts over 8 bits by QImode moves. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3701 + if (count >= 8) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3702 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3703 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3704 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3705 + /* Iterate over the number of bits to be shifted. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3706 + while (count > 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3707 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3708 + /* Each bit to be shifted requires 1 proper bit shift |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3709 + and 3 rotates. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3710 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3711 + /* First, do the arithmetic/logical shift. Left shifts |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3712 + start from the LSB; right shifts start from the MSB. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3713 + xoperands[0] = adjust_address (operands[0], QImode, start); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3714 + switch (rtx_code) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3715 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3716 + case ASHIFT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3717 + output_asm_insn ("asl\t%0", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3718 + start--; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3719 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3720 + case ASHIFTRT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3721 + output_asm_insn ("asr\t%0", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3722 + start++; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3723 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3724 + case LSHIFTRT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3725 + output_asm_insn ("lsr\t%0", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3726 + start++; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3727 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3728 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3729 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3730 + /* Next, rotate the other bytes */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3731 + for (s = start; s != end; s += step) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3732 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3733 + xoperands[0] = adjust_address (operands[0], QImode, s); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3734 + switch (rtx_code) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3735 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3736 + case ASHIFT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3737 + output_asm_insn ("rol\t%0", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3738 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3739 + case ASHIFTRT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3740 + case LSHIFTRT: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3741 + output_asm_insn ("ror\t%0", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3742 + break; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3743 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3744 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3745 + count--; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3746 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3747 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3748 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3749 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3750 +int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3751 +power_of_two_p (unsigned int n) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3752 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3753 + return (n & (n-1)) == 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3754 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3755 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3756 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3757 +int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3758 +m6809_can_eliminate (int from, int to) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3759 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3760 + if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3761 + return !frame_pointer_needed; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3762 + return 1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3763 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3764 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3765 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3766 +int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3767 +m6809_initial_elimination_offset (int from, int to) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3768 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3769 + switch (from) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3770 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3771 + case ARG_POINTER_REGNUM: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3772 + return get_frame_size () + m6809_get_regs_size (m6809_get_live_regs ()); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3773 + case FRAME_POINTER_REGNUM: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3774 + return get_frame_size (); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3775 + default: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3776 + gcc_unreachable (); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3777 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3778 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3779 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3780 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3781 +bool |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3782 +m6809_frame_pointer_required (void) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3783 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3784 + return false; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3785 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3786 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3787 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3788 +/* Defines the target-specific hooks structure. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3789 +struct gcc_target targetm = TARGET_INITIALIZER; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3790 diff -urN gcc-4.6.4-clean/gcc/config/m6809/m6809.h gcc-4.6.4/gcc/config/m6809/m6809.h |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3791 --- gcc-4.6.4-clean/gcc/config/m6809/m6809.h 1969-12-31 17:00:00.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3792 +++ gcc-4.6.4/gcc/config/m6809/m6809.h 2015-07-20 21:56:53.518727644 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3793 @@ -0,0 +1,1352 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3794 +/* Definitions of target machine for GNU compiler. MC6809 version. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3795 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3796 + MC6809 Version by Tom Jones (jones@sal.wisc.edu) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3797 + Space Astronomy Laboratory |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3798 + University of Wisconsin at Madison |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3799 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3800 + minor changes to adapt it to gcc-2.5.8 by Matthias Doerfel |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3801 + ( msdoerfe@informatik.uni-erlangen.de ) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3802 + also added #pragma interrupt (inspired by gcc-6811) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3803 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3804 + minor changes to adapt it to gcc-2.8.0 by Eric Botcazou |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3805 + (ebotcazou@multimania.com) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3806 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3807 + minor changes to adapt it to egcs-1.1.2 by Eric Botcazou |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3808 + (ebotcazou@multimania.com) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3809 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3810 + minor changes to adapt it to gcc-2.95.3 by Eric Botcazou |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3811 + (ebotcazou@multimania.com) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3812 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3813 + changes for gcc-3.1.1 by ??? |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3814 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3815 + further changes for gcc-3.1.1 and beyond by Brian Dominy |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3816 + (brian@oddchange.com) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3817 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3818 + even more changes for gcc-4.6.1 by William Astle (lost@l-w.ca) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3819 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3820 +This file is part of GCC. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3821 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3822 +GCC is free software; you can redistribute it and/or modify |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3823 +it under the terms of the GNU General Public License as published by |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3824 +the Free Software Foundation; either version 3, or (at your option) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3825 +any later version. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3826 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3827 +GCC is distributed in the hope that it will be useful, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3828 +but WITHOUT ANY WARRANTY; without even the implied warranty of |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3829 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3830 +GNU General Public License for more details. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3831 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3832 +You should have received a copy of the GNU General Public License |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3833 +along with GCC; see the file COPYING3. If not see |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3834 +<http://www.gnu.org/licenses/>. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3835 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3836 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3837 +/* Helper macros for creating strings with macros */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3838 +#define C_STRING(x) C_STR(x) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3839 +#define C_STR(x) #x |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3840 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3841 +/* Certain parts of GCC include host-side includes, which is bad. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3842 + * Some things that get pulled in need to be undone. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3843 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3844 +#undef HAVE_GAS_HIDDEN |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3845 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3846 +/* Names to predefine in the preprocessor for this target machine. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3847 +/*#define TARGET_CPU_CPP_BUILTINS() m6809_cpu_cpp_builtins () */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3848 +#define TARGET_CPU_CPP_BUILTINS() do \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3849 + { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3850 + if (TARGET_6309) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3851 + { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3852 + builtin_define_std ("__M6309__"); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3853 + builtin_define_std ("__m6309__"); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3854 + } \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3855 + else \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3856 + { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3857 + builtin_define_std ("__M6809__"); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3858 + builtin_define_std ("__m6809__"); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3859 + } \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3860 + \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3861 + if (TARGET_BYTE_INT) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3862 + builtin_define_std ("__int8__"); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3863 + else \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3864 + builtin_define_std ("__int16__"); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3865 + \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3866 + switch (m6809_abi_version) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3867 + { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3868 + case M6809_ABI_VERSION_STACK: \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3869 + builtin_define_std ("__regargs__"); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3870 + builtin_define_std ("__ABI_STACK__"); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3871 + break; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3872 + case M6809_ABI_VERSION_REGS: \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3873 + builtin_define_std ("__ABI_REGS__"); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3874 + break; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3875 + case M6809_ABI_VERSION_BX: \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3876 + builtin_define_std ("__ABI_BX__"); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3877 + break; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3878 + default: \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3879 + break; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3880 + } \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3881 + \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3882 + if (TARGET_WPC) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3883 + builtin_define_std ("__WPC__"); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3884 + \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3885 + if (TARGET_DRET) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3886 + builtin_define_std ("__DRET__"); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3887 + } while (0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3888 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3889 +/* As an embedded target, we have no libc. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3890 +#ifndef inhibit_libc |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3891 +#define inhibit_libc |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3892 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3893 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3894 +/* Print subsidiary information on the compiler version in use. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3895 +#define TARGET_VERSION fprintf (stderr, " (MC6809)"); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3896 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3897 +/* Run-time compilation parameters selecting different hardware subsets. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3898 +/*extern int target_flags; */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3899 +extern short *reg_renumber; /* def in local_alloc.c */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3900 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3901 +/* Runtime current values of section names */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3902 +extern int section_changed; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3903 +extern char code_section_op[], data_section_op[], bss_section_op[]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3904 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3905 +#define WARNING_OPT 0, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3906 +/*extern const char *m6809_abi_version_ptr; */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3907 +extern unsigned int m6809_soft_regs; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3908 +extern unsigned int m6809_abi_version; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3909 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3910 +/* ABI versions */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3911 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3912 +#define M6809_ABI_VERSION_STACK 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3913 +#define M6809_ABI_VERSION_REGS 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3914 +#define M6809_ABI_VERSION_BX 2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3915 +#define M6809_ABI_VERSION_LATEST (M6809_ABI_VERSION_BX) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3916 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3917 +/* Allow $ in identifiers */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3918 +#define DOLLARS_IN_IDENTIFIERS 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3919 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3920 +/*-------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3921 + Target machine storage layout |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3922 +--------------------------------------------------------------*/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3923 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3924 +/* Define this if most significant bit is lowest numbered |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3925 + in instructions that operate on numbered bit-fields. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3926 +#define BITS_BIG_ENDIAN 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3927 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3928 +/* Define to 1 if most significant byte of a word is the lowest numbered. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3929 +#define BYTES_BIG_ENDIAN 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3930 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3931 +/* Define to 1 if most significant word of a multiword value is the lowest numbered. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3932 +#define WORDS_BIG_ENDIAN 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3933 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3934 +/* Number of bits in an addressible storage unit */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3935 +#define BITS_PER_UNIT 8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3936 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3937 +/* Width in bits of a "word", or the contents of a machine register. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3938 + * Although the 6809 has a few byte registers, define this to 16-bits |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3939 + * since this is the natural size of most registers. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3940 +#define BITS_PER_WORD 16 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3941 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3942 +/* Width of a word, in units (bytes). */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3943 +#define UNITS_PER_WORD (BITS_PER_WORD/8) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3944 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3945 +/* Width in bits of a pointer. See also the macro `Pmode' defined below. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3946 +#define POINTER_SIZE 16 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3947 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3948 +/* Allocation boundary (bits) for storing pointers in memory. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3949 +#define POINTER_BOUNDARY 8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3950 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3951 +/* Allocation boundary (bits) for storing arguments in argument list. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3952 +/* PARM_BOUNDARY is divided by BITS_PER_WORD in expr.c -- tej */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3953 +#define PARM_BOUNDARY 8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3954 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3955 +/* Boundary (bits) on which stack pointer should be aligned. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3956 +#define STACK_BOUNDARY 8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3957 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3958 +/* Allocation boundary (bits) for the code of a function. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3959 +#define FUNCTION_BOUNDARY 8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3960 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3961 +/* Alignment of field after `int : 0' in a structure. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3962 +#define EMPTY_FIELD_BOUNDARY 8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3963 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3964 +/* Every structure's size must be a multiple of this. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3965 +#define STRUCTURE_SIZE_BOUNDARY 8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3966 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3967 +/* Largest mode size to use when putting an object, including |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3968 + * a structure, into a register. By limiting this to 16, no |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3969 + * 32-bit objects will ever be allocated to a pair of hard |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3970 + * registers. This is a good thing, since there aren't that |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3971 + * many of them. 32-bit objects are only needed for floats |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3972 + * and "long long"s. Larger values have been tried and did not |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3973 + * work. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3974 +#define MAX_FIXED_MODE_SIZE 16 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3975 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3976 +/* No data type wants to be aligned rounder than this. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3977 +#define BIGGEST_ALIGNMENT 8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3978 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3979 +/* Define this if move instructions will actually fail to work |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3980 + when given unaligned data. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3981 +#define STRICT_ALIGNMENT 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3982 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3983 +/*-------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3984 + Standard register usage. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3985 +--------------------------------------------------------------*/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3986 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3987 +/* Register values as bitmasks. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3988 + * TODO : merge D_REGBIT and B_REGBIT, and treat this as the same |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3989 + * register. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3990 +#define RSVD1_REGBIT (1 << HARD_RSVD1_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3991 +#define D_REGBIT (1 << HARD_D_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3992 +#define X_REGBIT (1 << HARD_X_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3993 +#define Y_REGBIT (1 << HARD_Y_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3994 +#define U_REGBIT (1 << HARD_U_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3995 +#define S_REGBIT (1 << HARD_S_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3996 +#define PC_REGBIT (1 << HARD_PC_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3997 +#define Z_REGBIT (1 << HARD_Z_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3998 +#define A_REGBIT (1 << HARD_A_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3999 +#define B_REGBIT (1 << HARD_B_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4000 +#define CC_REGBIT (1 << HARD_CC_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4001 +#define DP_REGBIT (1 << HARD_DP_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4002 +#define SOFT_FP_REGBIT (1 << SOFT_FP_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4003 +#define SOFT_AP_REGBIT (1 << SOFT_AP_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4004 +#define M_REGBIT(n) (1 << (SOFT_M0_REGNUM + n)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4005 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4006 +/* Macros for dealing with set of registers. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4007 + * A register set is just a bitwise-OR of all the register |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4008 + * bitmask values. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4009 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4010 +/* Which registers can hold 8-bits */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4011 +#define BYTE_REGSET \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4012 + (Z_REGBIT | A_REGBIT | D_REGBIT | CC_REGBIT | DP_REGBIT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4013 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4014 +/* Which registers can hold 16-bits. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4015 + * Note: D_REGBIT is defined as both an 8-bit and 16-bit register */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4016 +#define WORD_REGSET \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4017 + (D_REGBIT | X_REGBIT | Y_REGBIT | U_REGBIT | S_REGBIT | PC_REGBIT | SOFT_FP_REGBIT | SOFT_AP_REGBIT | RSVD1_REGBIT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4018 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4019 +/* Returns nonzero if a given REGNO is in the REGSET. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4020 +#define REGSET_CONTAINS_P(regno, regset) (((1 << (regno)) & (regset)) != 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4021 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4022 +/* Defines related to the number of soft registers supported. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4023 + * The actual number used may be less depending on -msoft-reg-count. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4024 + * If you change one of these, you should change them all. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4025 +#define NUM_M_REGS 8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4026 +#define M_REGS_FIXED 1, 1, 1, 1, 1, 1, 1, 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4027 +#define M_REGS_CALL_USED 1, 1, 1, 1, 1, 1, 1, 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4028 +#define HARD_M_REGNUMS \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4029 + SOFT_M0_REGNUM+0, SOFT_M0_REGNUM+1, SOFT_M0_REGNUM+2, SOFT_M0_REGNUM+3, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4030 + SOFT_M0_REGNUM+4, SOFT_M0_REGNUM+5, SOFT_M0_REGNUM+6, SOFT_M0_REGNUM+7 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4031 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4032 +#define SOFT_M_REGBITS (((1UL << NUM_M_REGS) - 1) << (SOFT_M0_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4033 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4034 +/* Number of actual hardware registers. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4035 + The hardware registers are assigned numbers for the compiler |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4036 + from 0 to just below FIRST_PSEUDO_REGISTER. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4037 + All registers that the compiler knows about must be given numbers, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4038 + even those that are not normally considered general registers. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4039 + Make sure the constant below matches the value of SOFT_M0_REGNUM; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4040 + for some reason, GCC won't compile if that name is used here directly. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4041 +#ifdef SOFT_M0_REGNUM |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4042 +#if (SOFT_M0_REGNUM != 14) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4043 +#error "bad register numbering" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4044 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4045 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4046 +#define FIRST_PSEUDO_REGISTER (14 + NUM_M_REGS) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4047 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4048 +/* 1 for registers that have pervasive standard uses |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4049 + and are not available for the register allocator. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4050 + The psuedoregisters (M_REGS) are declared fixed here, but |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4051 + will be unfixed if -msoft-reg-count is seen later. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4052 +#define FIXED_REGISTERS \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4053 + {1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, M_REGS_FIXED, } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4054 + /* -, X, Y, U, S, PC,D, Z, A, B, C, DP,FP,AP,M... */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4055 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4056 +/* 1 for registers not available across function calls. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4057 + These must include the FIXED_REGISTERS and also any |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4058 + registers that can be used without being saved. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4059 + The latter must include the registers where values are returned |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4060 + and the register where structure-value addresses are passed. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4061 + Aside from that, you can include as many other registers as you like. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4062 +#define CALL_USED_REGISTERS \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4063 + {1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, M_REGS_CALL_USED, } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4064 + /* -, X, Y, U, S, PC,D, Z, A, B, C, DP,FP,AP,M... */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4065 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4066 +/* Return number of consecutive hard regs needed starting at reg REGNO |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4067 + to hold something of mode MODE. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4068 + For the 6809, we distinguish between word-length and byte-length |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4069 + registers. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4070 +#define HARD_REGNO_NREGS(REGNO, MODE) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4071 + (REGSET_CONTAINS_P (REGNO, WORD_REGSET) ? \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4072 + ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4073 + (GET_MODE_SIZE (MODE))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4074 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4075 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4076 +/* Value is 1 if hard register REGNO can hold a value |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4077 +of machine-mode MODE. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4078 +#define HARD_REGNO_MODE_OK(REGNO, MODE) m6809_hard_regno_mode_ok (REGNO, MODE) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4079 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4080 +/* Value is 1 if it is a good idea to tie two pseudo registers |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4081 + when one has mode MODE1 and one has mode MODE2. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4082 + If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4083 + for any hard reg, then this must be 0 for correct output. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4084 +#define MODES_TIEABLE_P(MODE1, MODE2) 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4085 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4086 +/* Specify the registers used for certain standard purposes. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4087 + The values of these macros are register numbers. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4088 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4089 +/* program counter if referenced as a register */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4090 +#define PC_REGNUM HARD_PC_REGNUM |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4091 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4092 +/* Register to use for pushing function arguments. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4093 +#define STACK_POINTER_REGNUM HARD_S_REGNUM |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4094 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4095 +/* Base register for access to local variables of the function. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4096 + * Before reload, FRAME_POINTER_REGNUM will be used. Later, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4097 + * the elimination pass will convert these to STACK_POINTER_REGNUM |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4098 + * if possible, or else HARD_FRAME_POINTER_REGNUM. The idea is to |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4099 + * avoid tying up a hard register (U) for the frame pointer if |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4100 + * it can be eliminated entirely, making it available for use as |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4101 + * a general register. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4102 +#define FRAME_POINTER_REGNUM SOFT_FP_REGNUM |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4103 +#define HARD_FRAME_POINTER_REGNUM HARD_U_REGNUM |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4104 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4105 +/* Define a table of possible eliminations. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4106 + * The idea is to try to avoid using hard registers for the argument |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4107 + * and frame pointers if they can be derived from the stack pointer |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4108 + * instead, which already has a hard register reserved for it. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4109 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4110 + * The order of entries in this table will try to convert |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4111 + * ARG_POINTER_REGNUM and FRAME_POINTER_REGNUM into stack pointer |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4112 + * references first, but if that fails, they will be converted to use |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4113 + * HARD_FRAME_POINTER_REGNUM. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4114 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4115 +#define ELIMINABLE_REGS \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4116 +{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4117 + { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4118 + { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4119 + { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4120 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4121 +/* #define CAN_ELIMINATE(FROM, TO) m6809_can_eliminate (FROM, TO) */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4122 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4123 +/* Define how to offset the frame or argument pointer to turn it |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4124 + * into a stack pointer reference. This is based on the way that |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4125 + * the frame is constructed in the function prologue. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4126 +#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4127 + (OFFSET) = m6809_initial_elimination_offset (FROM, TO) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4128 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4129 +/* Base register for access to arguments of the function. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4130 + * This is only used prior to reload; no instructions will ever |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4131 + * be output referring to this register. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4132 +#define ARG_POINTER_REGNUM SOFT_AP_REGNUM |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4133 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4134 +/* Register in which static-chain is passed to a function. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4135 +#define STATIC_CHAIN_REGNUM HARD_Y_REGNUM |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4136 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4137 +/* #define CONDITIONAL_REGISTER_USAGE (m6809_conditional_register_usage ()) */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4138 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4139 +/* Order in which hard registers are allocated to pseudos. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4140 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4141 + * Since the D register is the only valid reg for 8-bit values |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4142 + * now, avoid using it for 16-bit values by putting it after all |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4143 + * other 16-bits. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4144 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4145 + * Prefer X first since the first 16-bit function argument goes |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4146 + * there. We may be able to pass in to a subroutine without |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4147 + * a copy. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4148 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4149 + * Prefer U over Y since instructions using Y take one extra |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4150 + * byte, and thus one extra cycle to execute. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4151 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4152 +#define REG_ALLOC_ORDER \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4153 + { HARD_X_REGNUM, HARD_U_REGNUM, HARD_Y_REGNUM, HARD_D_REGNUM, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4154 + HARD_M_REGNUMS, HARD_S_REGNUM, HARD_PC_REGNUM, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4155 + HARD_B_REGNUM, HARD_A_REGNUM, HARD_CC_REGNUM, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4156 + HARD_DP_REGNUM, SOFT_FP_REGNUM, SOFT_AP_REGNUM, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4157 + 6, HARD_Z_REGNUM } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4158 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4159 +/*-------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4160 + classes of registers |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4161 +--------------------------------------------------------------*/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4162 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4163 +/* Define the classes of registers for register constraints in the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4164 + machine description. Also define ranges of constants. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4165 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4166 + One of the classes must always be named ALL_REGS and include all hard regs. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4167 + If there is more than one class, another class must be named NO_REGS |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4168 + and contain no registers. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4169 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4170 + The name GENERAL_REGS must be the name of a class (or an alias for |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4171 + another name such as ALL_REGS). This is the class of registers |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4172 + that is allowed by "g" or "r" in a register constraint. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4173 + Also, registers outside this class are allocated only when |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4174 + instructions express preferences for them. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4175 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4176 + The classes must be numbered in nondecreasing order; that is, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4177 + a larger-numbered class must never be contained completely |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4178 + in a smaller-numbered class. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4179 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4180 + For any two classes, it is very desirable that there be another |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4181 + class that represents their union. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4182 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4183 +enum reg_class { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4184 + NO_REGS, /* The trivial class with no registers in it */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4185 + D_REGS, /* 16-bit (word (HI)) data (D) */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4186 + ACC_A_REGS, /* The A register */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4187 + ACC_B_REGS, /* The B register */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4188 + X_REGS, /* The X register */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4189 + Z_REGS, /* The Z (zero-bit) register */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4190 + Q_REGS, /* 8-bit (byte (QI)) data (A,B) */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4191 + M_REGS, /* 8-bit (byte (QI)) soft registers */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4192 + CC_REGS, /* 8-bit condition code register */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4193 + I_REGS, /* An index register (A,B,D) */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4194 + T_REGS, /* 16-bit addresses, not including stack or PC (X,Y,U) */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4195 + A_REGS, /* 16-bit addresses (X,Y,U,S,PC) */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4196 + S_REGS, /* 16-bit soft registers (FP, AP) */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4197 + P_REGS, /* 16-bit pushable registers (D,X,Y,U); omit PC and S */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4198 + G_REGS, /* 16-bit data and address (D,X,Y,U,S,PC) */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4199 + ALL_REGS, /* All registers */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4200 + LIM_REG_CLASSES |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4201 +}; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4202 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4203 +#define N_REG_CLASSES (int) LIM_REG_CLASSES |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4204 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4205 +/* Since GENERAL_REGS is a smaller class than ALL_REGS, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4206 + it is not an alias to ALL_REGS, but to G_REGS. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4207 +#define GENERAL_REGS G_REGS |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4208 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4209 +/* Give names of register classes as strings for dump file. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4210 +#define REG_CLASS_NAMES \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4211 + { "NO_REGS", "D_REGS", "ACC_A_REGS", "ACC_B_REGS", "X_REGS", "Z_REGS", "Q_REGS", "M_REGS", \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4212 + "CC_REGS", "I_REGS", "T_REGS", "A_REGS", "S_REGS", "P_REGS", "G_REGS", \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4213 + "ALL_REGS" } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4214 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4215 +/* Define which registers fit in which classes. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4216 + This is an initializer for a vector of HARD_REG_SET |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4217 + of length N_REG_CLASSES. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4218 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4219 +#define D_REGSET (D_REGBIT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4220 +#define ACC_A_REGSET (A_REGBIT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4221 +#define ACC_B_REGSET (D_REGBIT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4222 +#define X_REGSET (X_REGBIT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4223 +#define Z_REGSET (Z_REGBIT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4224 +#define Q_REGSET (D_REGBIT | A_REGBIT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4225 +#define M_REGSET (SOFT_M_REGBITS) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4226 +#define CC_REGSET (CC_REGBIT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4227 +#define I_REGSET (A_REGBIT | B_REGBIT | D_REGBIT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4228 +#define T_REGSET (X_REGBIT | Y_REGBIT | U_REGBIT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4229 +#define A_REGSET (X_REGBIT | Y_REGBIT | U_REGBIT | S_REGBIT | PC_REGBIT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4230 +#define S_REGSET (SOFT_FP_REGBIT | SOFT_AP_REGBIT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4231 +#define P_REGSET (D_REGBIT | X_REGBIT | Y_REGBIT | U_REGBIT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4232 +#define G_REGSET \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4233 + (D_REGSET | Q_REGSET | I_REGSET | A_REGSET | M_REGSET | S_REGSET) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4234 +#define ALL_REGSET (G_REGSET) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4235 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4236 +#define REG_CLASS_CONTENTS { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4237 + {0}, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4238 + {D_REGSET}, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4239 + {ACC_A_REGSET}, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4240 + {ACC_B_REGSET}, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4241 + {X_REGSET}, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4242 + {Z_REGSET}, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4243 + {Q_REGSET}, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4244 + {M_REGSET}, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4245 + {CC_REGSET}, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4246 + {I_REGSET}, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4247 + {T_REGSET}, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4248 + {A_REGSET}, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4249 + {S_REGSET}, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4250 + {P_REGSET}, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4251 + {G_REGSET}, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4252 + {ALL_REGSET}, \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4253 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4254 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4255 +/* The same information, inverted. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4256 + * This is defined to use the REG_CLASS_CONTENTS defines above, so that |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4257 + * these two sets of definitions are always consistent. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4258 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4259 +#define REGNO_REG_CLASS(REGNO) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4260 + (D_REGNO_P (REGNO) ? D_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4261 + (Z_REGNO_P (REGNO) ? Z_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4262 + (ACC_A_REGNO_P (REGNO) ? ACC_A_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4263 + (ACC_B_REGNO_P (REGNO) ? ACC_B_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4264 + (X_REGNO_P (REGNO) ? X_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4265 + (Q_REGNO_P (REGNO) ? Q_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4266 + (M_REGNO_P (REGNO) ? M_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4267 + (CC_REGNO_P (REGNO) ? CC_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4268 + (I_REGNO_P (REGNO) ? I_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4269 + (T_REGNO_P (REGNO) ? T_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4270 + (A_REGNO_P (REGNO) ? A_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4271 + (S_REGNO_P (REGNO) ? S_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4272 + (P_REGNO_P (REGNO) ? P_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4273 + (G_REGNO_P (REGNO) ? G_REGS : ALL_REGS)))))))))))))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4274 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4275 +#define D_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, D_REGSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4276 +#define ACC_A_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, ACC_A_REGSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4277 +#define ACC_B_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, ACC_B_REGSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4278 +#define X_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, X_REGSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4279 +#define Z_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, Z_REGSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4280 +#define Q_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, Q_REGSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4281 +#define M_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, M_REGSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4282 +#define CC_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, CC_REGSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4283 +#define I_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, I_REGSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4284 +#define T_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, T_REGSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4285 +#define A_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, A_REGSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4286 +#define S_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, S_REGSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4287 +#define P_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, P_REGSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4288 +#define G_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, G_REGSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4289 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4290 +/* Macros that test an rtx 'X' to see if it's in a particular |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4291 + * register class. 'X' need not be a REG necessarily. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4292 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4293 +#define D_REG_P(X) (REG_P (X) && D_REGNO_P (REGNO (X))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4294 +#define ACC_A_REG_P(X) (REG_P (X) && ACC_A_REGNO_P (REGNO (X))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4295 +#define ACC_B_REG_P(X) (REG_P (X) && ACC_B_REGNO_P (REGNO (X))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4296 +#define X_REG_P(X) (REG_P (X) && X_REGNO_P (REGNO (X))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4297 +#define Z_REG_P(X) (REG_P (X) && Z_REGNO_P (REGNO (X))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4298 +#define I_REG_P(X) (REG_P (X) && I_REGNO_P (REGNO (X))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4299 +#define T_REG_P(X) (REG_P (X) && T_REGNO_P (REGNO (X))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4300 +#define A_REG_P(X) (REG_P (X) && A_REGNO_P (REGNO (X))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4301 +#define S_REG_P(X) (REG_P (X) && S_REGNO_P (REGNO (X))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4302 +#define P_REG_P(X) (REG_P (X) && P_REGNO_P (REGNO (X))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4303 +#define Q_REG_P(X) (REG_P (X) && Q_REGNO_P (REGNO (X))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4304 +#define M_REG_P(X) (REG_P (X) && M_REGNO_P (REGNO (X))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4305 +#define CC_REG_P(X) (REG_P (X) && CC_REGNO_P (REGNO (X))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4306 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4307 +/* Redefine this in terms of BYTE_REGSET */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4308 +#define BYTE_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, BYTE_REGSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4309 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4310 +/* The class value for index registers, and the one for base regs. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4311 +#define INDEX_REG_CLASS I_REGS |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4312 +#define BASE_REG_CLASS A_REGS |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4313 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4314 +/* Get reg_class from a letter in the machine description. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4315 +#define REG_CLASS_FROM_LETTER(C) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4316 + (((C) == 'a' ? A_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4317 + ((C) == 'd' ? D_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4318 + ((C) == 'x' ? I_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4319 + ((C) == 't' ? M_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4320 + ((C) == 'c' ? CC_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4321 + ((C) == 'A' ? ACC_A_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4322 + ((C) == 'B' ? ACC_B_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4323 + ((C) == 'v' ? X_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4324 + ((C) == 'u' ? S_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4325 + ((C) == 'U' ? P_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4326 + ((C) == 'T' ? T_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4327 + ((C) == 'z' ? Z_REGS : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4328 + ((C) == 'q' ? Q_REGS : NO_REGS)))))))))))))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4329 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4330 +/*-------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4331 + The letters I through O in a register constraint string |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4332 + can be used to stand for particular ranges of immediate operands. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4333 + This macro defines what the ranges are. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4334 + C is the letter, and VALUE is a constant value. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4335 + Return 1 if VALUE is in the range specified by C. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4336 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4337 + For the 6809, J, K, L are used for indexed addressing. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4338 + `I' is used for the constant 1. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4339 + `J' is used for the 5-bit offsets. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4340 + `K' is used for the 8-bit offsets. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4341 + `L' is used for the range of signed numbers that fit in 16 bits. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4342 + `M' is used for the exact value '8'. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4343 + `N' is used for the constant -1. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4344 + `O' is used for the constant 0. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4345 +--------------------------------------------------------------*/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4346 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4347 +#define CONST_OK_FOR_LETTER_P(VALUE, C) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4348 + ((C) == 'I' ? ((VALUE) == 1) : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4349 + (C) == 'J' ? ((VALUE) >= -16 && (VALUE) <= 15) : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4350 + (C) == 'K' ? ((VALUE) >= -128 && (VALUE) <= 127) : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4351 + (C) == 'L' ? ((VALUE) >= -32768 && (VALUE) <= 32767) : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4352 + (C) == 'M' ? ((VALUE) == 8) : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4353 + (C) == 'N' ? ((VALUE) == -1) : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4354 + (C) == 'O' ? ((VALUE) == 0) : 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4355 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4356 +/* Similar, but for floating constants, and defining letters G and H. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4357 + No floating-point constants are valid on MC6809. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4358 +#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4359 + ((C) == 'G' ? (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4360 + && VALUE == CONST0_RTX (GET_MODE (VALUE))) : 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4361 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4362 +/* Given an rtx X being reloaded into a reg required to be |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4363 + in class CLASS, return the class of reg to actually use. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4364 + In general this is just CLASS; but on some machines |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4365 + in some cases it is preferable to use a more restrictive class. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4366 +#define PREFERRED_RELOAD_CLASS(X,CLASS) m6809_preferred_reload_class(X,CLASS) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4367 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4368 +#define SMALL_REGISTER_CLASSES 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4369 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4370 +/* Return the maximum number of consecutive registers |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4371 + needed to represent mode MODE in a register of class CLASS. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4372 +#define CLASS_MAX_NREGS(CLASS, MODE) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4373 + ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4374 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4375 +/*-------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4376 + Stack layout; function entry, exit and calling. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4377 +--------------------------------------------------------------*/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4378 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4379 +/* Define this if pushing a word on the stack |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4380 + makes the stack pointer a smaller address. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4381 +#define STACK_GROWS_DOWNWARD |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4382 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4383 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4384 +/* Define this if the nominal address of the stack frame |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4385 + is at the high-address end of the local variables; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4386 + that is, each additional local variable allocated |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4387 + goes at a more negative offset in the frame. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4388 +#define FRAME_GROWS_DOWNWARD 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4389 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4390 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4391 +/* Offset within stack frame to start allocating local variables at. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4392 + If FRAME_GROWS_DOWNWARD, this is the offset to the END of the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4393 + first local allocated. Otherwise, it is the offset to the BEGINNING |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4394 + of the first local allocated. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4395 +#define STARTING_FRAME_OFFSET 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4396 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4397 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4398 +/* Always push stack arguments for now. Accumulation is not yet working. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4399 +#define PUSH_ROUNDING(BYTES) (BYTES) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4400 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4401 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4402 +/* Offset of first parameter from the argument pointer register value. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4403 + * ARG_POINTER_REGNUM is defined to point to the return address pushed |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4404 + * onto the stack, so we must offset by 2 bytes to get to the arguments. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4405 +#define FIRST_PARM_OFFSET(FNDECL) 2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4406 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4407 +/* Value is 1 if returning from a function call automatically |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4408 + pops the arguments described by the number-of-args field in the call. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4409 + FUNTYPE is the data type of the function (as a tree), |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4410 + or for a library call it is an identifier node for the subroutine name. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4411 +/* #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0 */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4412 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4413 +/* Define how to find the value returned by a function. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4414 + VALTYPE is the data type of the value (as a tree). |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4415 + If the precise function being called is known, FUNC is its FUNCTION_DECL; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4416 + otherwise, FUNC is 0. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4417 +#define FUNCTION_VALUE(VALTYPE, FUNC) m6809_function_value (VALTYPE, FUNC) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4418 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4419 +/* Define how to find the value returned by a library function |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4420 + assuming the value has mode MODE. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4421 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4422 +/* All return values are in the X-register. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4423 +#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, HARD_X_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4424 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4425 +/* Define this if using the nonreentrant convention for returning |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4426 + structure and union values. No; it is inefficient and buggy. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4427 +#undef PCC_STATIC_STRUCT_RETURN |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4428 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4429 +/* 1 if N is a possible register number for a function value. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4430 +#define FUNCTION_VALUE_REGNO_P(N) m6809_function_value_regno_p (N) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4431 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4432 +/* Define this to be true when FUNCTION_VALUE_REGNO_P is true for |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4433 + more than one register. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4434 +#define NEEDS_UNTYPED_CALL 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4435 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4436 +/* 1 if N is a possible register number for function argument passing. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4437 +#define FUNCTION_ARG_REGNO_P(N) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4438 + ((m6809_abi_version != M6809_ABI_VERSION_STACK) ? \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4439 + (((N) == HARD_D_REGNUM) || ((N) == HARD_X_REGNUM)) : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4440 + 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4441 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4442 +/*-------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4443 + Argument Lists |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4444 +--------------------------------------------------------------*/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4445 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4446 +/* Cumulative arguments are tracked in a single integer, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4447 + * which is the number of bytes of arguments scanned so far, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4448 + * plus which registers have already been used. The register |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4449 + * info is kept in some of the upper bits */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4450 +#define CUMULATIVE_ARGS unsigned int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4451 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4452 +#define CUM_STACK_ONLY 0x80000000 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4453 +#define CUM_X_MASK 0x40000000 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4454 +#define CUM_B_MASK 0x20000000 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4455 +#define CUM_STACK_INVALID 0x10000000 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4456 +#define CUM_STACK_MASK 0xFFFFFFF |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4457 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4458 +#define CUM_ADVANCE_8BIT(cum) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4459 + (((cum) & CUM_B_MASK) ? (cum)++ : ((cum) |= CUM_B_MASK)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4460 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4461 +#define CUM_ADVANCE_16BIT(cum) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4462 + (((cum) & CUM_X_MASK) ? (cum) += 2 : ((cum) |= CUM_X_MASK)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4463 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4464 +/* Initialize a variable CUM of type CUMULATIVE_ARGS |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4465 + for a call to a function whose data type is FNTYPE. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4466 + For a library call, FNTYPE is 0. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4467 + N_NAMED was added in gcc 3.4 and is not used currently. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4468 +#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT,N_NAMED) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4469 + ((CUM) = m6809_init_cumulative_args (CUM, FNTYPE, LIBNAME)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4470 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4471 +#define FUNCTION_ARG_SIZE(MODE, TYPE) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4472 + ((MODE) != BLKmode ? GET_MODE_SIZE (MODE) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4473 + : (unsigned) int_size_in_bytes (TYPE)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4474 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4475 +/* Update the data in CUM to advance over an argument |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4476 + of mode MODE and data type TYPE. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4477 + (TYPE is null for libcalls where that information may not be available.) */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4478 +#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4479 + (((MODE == QImode) && !((CUM) & CUM_STACK_ONLY)) ? \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4480 + CUM_ADVANCE_8BIT (CUM) : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4481 + ((MODE == HImode) && !((CUM) & CUM_STACK_ONLY)) ? \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4482 + CUM_ADVANCE_16BIT (CUM) : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4483 + ((CUM) = ((CUM) + (TYPE ? int_size_in_bytes (TYPE) : 2)))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4484 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4485 +/* Define where to put the arguments to a function. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4486 + Value is zero to push the argument on the stack, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4487 + or a hard register rtx in which to store the argument. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4488 + This macro is used _before_ FUNCTION_ARG_ADVANCE. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4489 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4490 + For the 6809, the first 8-bit function argument can be placed into B, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4491 + and the first 16-bit arg can go into X. All other arguments |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4492 + will be pushed onto the stack. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4493 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4494 + Command-line options can adjust this behavior somewhat. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4495 + */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4496 +#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4497 + ((MODE == VOIDmode) ? NULL_RTX : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4498 + ((MODE == BLKmode) || (GET_MODE_SIZE (MODE) > 2)) ? NULL_RTX : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4499 + ((MODE == QImode) && !((CUM) & (CUM_STACK_ONLY | CUM_B_MASK))) ? \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4500 + gen_rtx_REG (QImode, HARD_D_REGNUM) : \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4501 + ((MODE == HImode) && !((CUM) & (CUM_STACK_ONLY | CUM_X_MASK))) ? \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4502 + gen_rtx_REG (HImode, HARD_X_REGNUM) : m6809_function_arg_on_stack (&CUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4503 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4504 +/* Output assembler code to FILE to increment profiler label # LABELNO |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4505 + for profiling a function entry. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4506 +#define FUNCTION_PROFILER(FILE, LABELNO) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4507 + fprintf (FILE, "\tldd\t#LP%u\n\tjsr\tmcount\n", (LABELNO)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4508 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4509 +/* Stack pointer must be correct on function exit */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4510 +#define EXIT_IGNORE_STACK 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4511 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4512 +/***************************************************************************** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4513 +** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4514 +** Trampolines for Nested Functions |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4515 +** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4516 +*****************************************************************************/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4517 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4518 +/* Length in units of the trampoline for entering a nested function. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4519 +#define TRAMPOLINE_SIZE 7 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4520 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4521 +/*-------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4522 + Addressing modes, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4523 + and classification of registers for them. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4524 +--------------------------------------------------------------*/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4525 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4526 +/* 6809 has postincrement and predecrement addressing modes */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4527 +#define HAVE_POST_INCREMENT 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4528 +#define HAVE_PRE_DECREMENT 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4529 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4530 +/* Whether or not to use index registers is configurable. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4531 + * Experiments show that things work better when this is off, so |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4532 + * that's the way it is for now. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4533 +#undef USE_INDEX_REGISTERS |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4534 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4535 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4536 +/* Macros to check register numbers against specific register classes. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4537 +#define REG_VALID_FOR_BASE_P(REGNO) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4538 + (((REGNO) < FIRST_PSEUDO_REGISTER) && A_REGNO_P (REGNO)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4539 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4540 +/* MC6809 index registers do not allow scaling, */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4541 +/* but there is "accumulator-offset" mode. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4542 +#ifdef USE_INDEX_REGISTERS |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4543 +#define REG_VALID_FOR_INDEX_P(REGNO) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4544 + (((REGNO) < FIRST_PSEUDO_REGISTER) && I_REGNO_P (REGNO)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4545 +#else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4546 +#define REG_VALID_FOR_INDEX_P(REGNO) 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4547 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4548 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4549 +/* Internal macro, the nonstrict definition for REGNO_OK_FOR_BASE_P */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4550 +#define REGNO_OK_FOR_BASE_NONSTRICT_P(REGNO) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4551 + ((REGNO) >= FIRST_PSEUDO_REGISTER \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4552 + || REG_VALID_FOR_BASE_P (REGNO) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4553 + || (REGNO) == FRAME_POINTER_REGNUM \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4554 + || (REGNO) == HARD_FRAME_POINTER_REGNUM \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4555 + || (REGNO) == ARG_POINTER_REGNUM \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4556 + || (reg_renumber && REG_VALID_FOR_BASE_P (reg_renumber[REGNO]))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4557 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4558 +/* Internal macro, the nonstrict definition for REGNO_OK_FOR_INDEX_P */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4559 +#define REGNO_OK_FOR_INDEX_NONSTRICT_P(REGNO) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4560 + ((REGNO) >= FIRST_PSEUDO_REGISTER \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4561 + || REG_VALID_FOR_INDEX_P (REGNO) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4562 + || (reg_renumber && REG_VALID_FOR_INDEX_P (reg_renumber[REGNO]))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4563 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4564 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4565 +/* Internal macro, the strict definition for REGNO_OK_FOR_BASE_P */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4566 +#define REGNO_OK_FOR_BASE_STRICT_P(REGNO) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4567 + ((REGNO) < FIRST_PSEUDO_REGISTER ? REG_VALID_FOR_BASE_P (REGNO) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4568 + : (reg_renumber && REG_VALID_FOR_BASE_P (reg_renumber[REGNO]))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4569 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4570 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4571 +/* Internal macro, the strict definition for REGNO_OK_FOR_INDEX_P */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4572 +#define REGNO_OK_FOR_INDEX_STRICT_P(REGNO) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4573 + ((REGNO) < FIRST_PSEUDO_REGISTER ? REG_VALID_FOR_INDEX_P (REGNO) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4574 + : (reg_renumber && REG_VALID_FOR_INDEX_P (reg_renumber[REGNO]))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4575 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4576 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4577 +#define REGNO_OK_FOR_BASE_P(REGNO) REGNO_OK_FOR_BASE_STRICT_P (REGNO) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4578 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4579 +#define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_INDEX_STRICT_P (REGNO) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4580 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4581 +#define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_STRICT_P (REGNO (X)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4582 +#define REG_OK_FOR_BASE_NONSTRICT_P(X) REGNO_OK_FOR_BASE_NONSTRICT_P (REGNO (X)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4583 +#define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_STRICT_P (REGNO (X)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4584 +#define REG_OK_FOR_INDEX_NONSTRICT_P(X) REGNO_OK_FOR_INDEX_NONSTRICT_P (REGNO (X)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4585 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4586 +#ifndef REG_OK_STRICT |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4587 +#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NONSTRICT_P(X) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4588 +#ifdef USE_INDEX_REGISTERS |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4589 +#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_NONSTRICT_P(X) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4590 +#else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4591 +#define REG_OK_FOR_INDEX_P(X) 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4592 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4593 +#else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4594 +#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P (X) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4595 +#ifdef USE_INDEX_REGISTERS |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4596 +#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_STRICT_P (X) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4597 +#else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4598 +#define REG_OK_FOR_INDEX_P(X) 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4599 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4600 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4601 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4602 +/* Maximum number of registers that can appear in a valid memory address */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4603 +#ifdef USE_INDEX_REGISTERS |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4604 +#define MAX_REGS_PER_ADDRESS 2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4605 +#else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4606 +#define MAX_REGS_PER_ADDRESS 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4607 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4608 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4609 +/* 1 if X is an rtx for a constant that is a valid address. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4610 + * We allow any constant, plus the sum of any two constants (this allows |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4611 + * offsetting a symbol ref) */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4612 +#define CONSTANT_ADDRESS_P(X) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4613 + ((CONSTANT_P (X)) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4614 + || ((GET_CODE (X) == PLUS) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4615 + && (CONSTANT_P (XEXP (X, 0))) && (CONSTANT_P (XEXP (X, 1))))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4616 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4617 +/* Nonzero if the constant value X is a legitimate general operand. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4618 + It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4619 +/* Any single-word constant is ok; the only contexts |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4620 + allowing general_operand of mode DI or DF are movdi and movdf. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4621 +#define LEGITIMATE_CONSTANT_P(X) (GET_CODE (X) != CONST_DOUBLE) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4622 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4623 +/* Nonzero if the X is a legitimate immediate operand in PIC mode. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4624 +#define LEGITIMATE_PIC_OPERAND_P(X) !symbolic_operand (X, VOIDmode) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4625 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4626 +/*-------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4627 + Test for valid memory addresses |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4628 +--------------------------------------------------------------*/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4629 +/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4630 + that is a valid memory address for an instruction. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4631 + The MODE argument is the machine mode for the MEM expression |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4632 + that wants to use this address. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4633 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4634 +/*-------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4635 + Valid addresses are either direct or indirect (MEM) versions |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4636 + of the following forms. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4637 + constant N |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4638 + register ,X |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4639 + constant indexed N,X |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4640 + accumulator indexed D,X |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4641 + auto_increment ,X++ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4642 + auto_decrement ,--X |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4643 +--------------------------------------------------------------*/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4644 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4645 +#define REGISTER_ADDRESS_P(X) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4646 + (REG_P (X) && REG_OK_FOR_BASE_P (X)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4647 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4648 +#define EXTENDED_ADDRESS_P(X) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4649 + CONSTANT_ADDRESS_P (X) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4650 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4651 +#define LEGITIMATE_BASE_P(X) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4652 + ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4653 + || (GET_CODE (X) == SIGN_EXTEND \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4654 + && GET_CODE (XEXP (X, 0)) == REG \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4655 + && GET_MODE (XEXP (X, 0)) == HImode \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4656 + && REG_OK_FOR_BASE_P (XEXP (X, 0)))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4657 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4658 +#define LEGITIMATE_OFFSET_P(X) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4659 + (CONSTANT_ADDRESS_P (X) || (REG_P (X) && REG_OK_FOR_INDEX_P (X))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4660 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4661 +/* 1 if X is the sum of a base register and an offset. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4662 +#define INDEXED_ADDRESS(X) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4663 + ((GET_CODE (X) == PLUS \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4664 + && LEGITIMATE_BASE_P (XEXP (X, 0)) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4665 + && LEGITIMATE_OFFSET_P (XEXP (X, 1))) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4666 + || (GET_CODE (X) == PLUS \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4667 + && LEGITIMATE_BASE_P (XEXP (X, 1)) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4668 + && LEGITIMATE_OFFSET_P (XEXP (X, 0)))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4669 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4670 +#define STACK_REG_P(X) (REG_P(X) && REGNO(X) == HARD_S_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4671 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4672 +#define STACK_PUSH_P(X) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4673 + (MEM_P (X) && GET_CODE (XEXP (X, 0)) == PRE_DEC && STACK_REG_P (XEXP (XEXP (X, 0), 0))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4674 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4675 +#define STACK_POP_P(X) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4676 + (MEM_P (X) && GET_CODE (XEXP (X, 0)) == POST_INC && STACK_REG_P (XEXP (XEXP (X, 0), 0))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4677 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4678 +#define PUSH_POP_ADDRESS_P(X) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4679 + (((GET_CODE (X) == PRE_DEC) || (GET_CODE (X) == POST_INC)) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4680 + && (LEGITIMATE_BASE_P (XEXP (X, 0)))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4681 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4682 +/* Go to ADDR if X is a valid address. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4683 +#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4684 +{ \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4685 + if (REGISTER_ADDRESS_P(X)) goto ADDR; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4686 + if (PUSH_POP_ADDRESS_P (X)) goto ADDR; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4687 + if (EXTENDED_ADDRESS_P (X)) goto ADDR; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4688 + if (INDEXED_ADDRESS (X)) goto ADDR; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4689 + if (MEM_P (X) && REGISTER_ADDRESS_P(XEXP (X, 0))) goto ADDR; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4690 + if (MEM_P (X) && PUSH_POP_ADDRESS_P (XEXP (X, 0))) goto ADDR; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4691 + if (MEM_P (X) && EXTENDED_ADDRESS_P (XEXP (X, 0))) goto ADDR; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4692 + if (MEM_P (X) && INDEXED_ADDRESS (XEXP (X, 0))) goto ADDR; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4693 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4694 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4695 +/*-------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4696 + Address Fix-up |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4697 +--------------------------------------------------------------*/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4698 +/* Go to LABEL if ADDR (a legitimate address expression) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4699 + has an effect that depends on the machine mode it is used for. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4700 + In the latest GCC, this case is already handled by the core code |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4701 + so no action is required here. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4702 +#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4703 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4704 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4705 +/*-------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4706 + Miscellaneous Parameters |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4707 +--------------------------------------------------------------*/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4708 +/* Specify the machine mode that this machine uses |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4709 + for the index in the tablejump instruction. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4710 +#define CASE_VECTOR_MODE Pmode |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4711 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4712 +/* Define this as 1 if `char' should by default be signed; else as 0. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4713 +#define DEFAULT_SIGNED_CHAR 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4714 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4715 +/* This flag, if defined, says the same insns that convert to a signed fixnum |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4716 + also convert validly to an unsigned one. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4717 +#define FIXUNS_TRUNC_LIKE_FIX_TRUNC |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4718 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4719 +/* Max number of bytes we can move from memory to memory/register |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4720 + in one reasonably fast instruction. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4721 +#define MOVE_MAX 2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4722 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4723 +/* Int can be 8 or 16 bits (default is 16) */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4724 +#define INT_TYPE_SIZE (TARGET_BYTE_INT ? 8 : 16) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4725 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4726 +/* Short is always 16 bits */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4727 +#define SHORT_TYPE_SIZE (TARGET_BYTE_INT ? 8 : 16) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4728 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4729 +/* Size (bits) of the type "long" on target machine */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4730 +#define LONG_TYPE_SIZE (TARGET_BYTE_INT ? 16 : 32) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4731 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4732 +/* Size (bits) of the type "long long" on target machine */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4733 +#define LONG_LONG_TYPE_SIZE 32 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4734 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4735 +/* Size (bits) of the type "char" on target machine */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4736 +#define CHAR_TYPE_SIZE 8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4737 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4738 +/* Size (bits) of the type "float" on target machine */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4739 +#define FLOAT_TYPE_SIZE 32 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4740 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4741 +/* Size (bits) of the type "double" on target machine. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4742 + * Note that the C standard does not require that doubles |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4743 + * hold any more bits than float. Since the 6809 has so few |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4744 + * registers, we cannot really support more than 32-bits. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4745 +#define DOUBLE_TYPE_SIZE 32 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4746 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4747 +/* Size (bits) of the type "long double" on target machine */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4748 +#define LONG_DOUBLE_TYPE_SIZE 32 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4749 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4750 +/* Define the type used for "size_t". With a 64KB address space, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4751 + * only a 16-bit value here makes sense. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4752 +#define SIZE_TYPE (TARGET_BYTE_INT ? "long unsigned int" : "unsigned int") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4753 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4754 +/* Likewise, the difference between two pointers is also a 16-bit |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4755 + * signed value. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4756 +#define PTRDIFF_TYPE (TARGET_BYTE_INT ? "long int" : "int") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4757 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4758 +/* Nonzero if access to memory by bytes is slow and undesirable. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4759 +#define SLOW_BYTE_ACCESS 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4760 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4761 +/* Define if shifts truncate the shift count |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4762 + which implies one can omit a sign-extension or zero-extension |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4763 + of a shift count. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4764 +#define SHIFT_COUNT_TRUNCATED 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4765 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4766 +/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4767 + is done just by pretending it is already truncated. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4768 +#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4769 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4770 +/* It is as good to call a constant function address as to |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4771 + call an address kept in a register. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4772 +#define NO_FUNCTION_CSE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4773 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4774 +/* Specify the machine mode that pointers have. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4775 + After generation of rtl, the compiler makes no further distinction |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4776 + between pointers and any other objects of this machine mode. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4777 +#define Pmode HImode |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4778 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4779 +/* A function address in a call instruction |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4780 + is a byte address (for indexing purposes) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4781 + so give the MEM rtx a byte's mode. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4782 +#define FUNCTION_MODE HImode |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4783 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4784 +/* Define the cost of moving a value from a register in CLASS1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4785 + * to CLASS2, of a given MODE. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4786 + * |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4787 + * On the 6809, hard register transfers are all basically equivalent. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4788 + * But soft register moves are treated more like memory moves. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4789 +#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4790 + (((CLASS1 == M_REGS) || (CLASS2 == M_REGS)) ? 4 : 7) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4791 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4792 +/* Define the cost of moving a value between a register and memory. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4793 +#define MEMORY_MOVE_COST(MODE, CLASS, IN) 5 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4794 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4795 +/* Check a `double' value for validity for a particular machine mode. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4796 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4797 +#define CHECK_FLOAT_VALUE(MODE, D, OVERFLOW) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4798 + ((OVERFLOW) = check_float_value (MODE, &D, OVERFLOW)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4799 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4800 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4801 +/*-------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4802 + machine-dependent |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4803 +--------------------------------------------------------------*/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4804 +/* Tell final.c how to eliminate redundant test instructions. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4805 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4806 +/* Here we define machine-dependent flags and fields in cc_status |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4807 + (see `conditions.h'). */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4808 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4809 +/* Store in cc_status the expressions |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4810 + that the condition codes will describe |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4811 + after execution of an instruction whose pattern is EXP. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4812 + Do not alter them if the instruction would not alter the cc's. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4813 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4814 +/* On the 6809, most of the insns to store in an address register |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4815 + fail to set the cc's. However, in some cases these instructions |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4816 + can make it possibly invalid to use the saved cc's. In those |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4817 + cases we clear out some or all of the saved cc's so they won't be used. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4818 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4819 +#define NOTICE_UPDATE_CC(EXP, INSN) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4820 + notice_update_cc((EXP), (INSN)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4821 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4822 +/***************************************************************************** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4823 +** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4824 +** pragma support |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4825 +** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4826 +*****************************************************************************/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4827 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4828 +#if 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4829 +#define REGISTER_TARGET_PRAGMAS() \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4830 +do { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4831 + extern void pragma_section PARAMS ((cpp_reader *)); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4832 + c_register_pragma (0, "section", pragma_section); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4833 +} while (0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4834 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4835 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4836 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4837 +/*-------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4838 + ASSEMBLER FORMAT |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4839 +--------------------------------------------------------------*/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4840 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4841 +#define FMT_HOST_WIDE_INT "%ld" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4842 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4843 +/* Output to assembler file text saying following lines |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4844 + may contain character constants, extra white space, comments, etc. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4845 +#define ASM_APP_ON ";----- asm -----\n" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4846 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4847 +/* Output to assembler file text saying following lines |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4848 + no longer contain unusual constructs. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4849 +#define ASM_APP_OFF ";--- end asm ---\n" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4850 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4851 +/* Use a semicolon to begin a comment. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4852 +#define ASM_COMMENT_START "; " |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4853 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4854 +/* Output assembly directives to switch to section 'name' */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4855 +#undef TARGET_ASM_NAMED_SECTION |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4856 +#define TARGET_ASM_NAMED_SECTION m6809_asm_named_section |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4857 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4858 +#undef TARGET_HAVE_NAMED_SECTION |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4859 +#define TARGET_HAVE_NAMED_SECTION m6809_have_named_section |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4860 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4861 +/* Output before read-only data. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4862 +#define TEXT_SECTION_ASM_OP (code_section_op) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4863 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4864 +/* Output before writable data. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4865 +#define DATA_SECTION_ASM_OP (data_section_op) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4866 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4867 +/* Output before uninitialized data. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4868 +#define BSS_SECTION_ASM_OP (bss_section_op) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4869 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4870 +/* Support the ctors and dtors sections for g++. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4871 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4872 +#undef CTORS_SECTION_ASM_OP |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4873 +#define CTORS_SECTION_ASM_OP "\t.area .ctors" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4874 +#undef DTORS_SECTION_ASM_OP |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4875 +#define DTORS_SECTION_ASM_OP "\t.area .dtors" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4876 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4877 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4878 +#undef DO_GLOBAL_CTORS_BODY |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4879 +#undef DO_GLOBAL_DTORS_BODY |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4880 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4881 +#define HAS_INIT_SECTION |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4882 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4883 +/* This is how to output an assembler line |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4884 + that says to advance the location counter |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4885 + to a multiple of 2**LOG bytes. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4886 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4887 +#define ASM_OUTPUT_ALIGN(FILE,LOG) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4888 + if ((LOG) > 1) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4889 + fprintf (FILE, "\t.bndry %u\n", 1 << (LOG)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4890 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4891 +/* The .set foo,bar construct doesn't work by default */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4892 +#undef SET_ASM_OP |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4893 +#define ASM_OUTPUT_DEF(FILE, LABEL1, LABEL2) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4894 + do \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4895 + { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4896 + fputc ('\t', FILE); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4897 + assemble_name (FILE, LABEL1); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4898 + fputs (" = ", FILE); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4899 + assemble_name (FILE, LABEL2); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4900 + fputc ('\n', FILE); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4901 + } \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4902 + while (0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4903 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4904 +/* How to refer to registers in assembler output. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4905 + This sequence is indexed by compiler's hard-register-number (see above). */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4906 +#define MNAME(x) [SOFT_M0_REGNUM+(x)] = "*m" C_STRING(x) , |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4907 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4908 +#define REGISTER_NAMES { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4909 + [HARD_D_REGNUM]= "d", \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4910 + [HARD_X_REGNUM]= "x", \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4911 + [HARD_Y_REGNUM]= "y", \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4912 + [HARD_U_REGNUM]= "u", \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4913 + [HARD_S_REGNUM]= "s", \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4914 + [HARD_PC_REGNUM]= "pc", \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4915 + [HARD_A_REGNUM]= "a", \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4916 + [HARD_B_REGNUM]= "b", \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4917 + [HARD_CC_REGNUM]= "cc",\ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4918 + [HARD_DP_REGNUM]= "dp", \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4919 + [SOFT_FP_REGNUM]= "soft_fp", \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4920 + [SOFT_AP_REGNUM]= "soft_ap", \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4921 + MNAME(0) MNAME(1) MNAME(2) MNAME(3) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4922 + MNAME(4) MNAME(5) MNAME(6) MNAME(7) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4923 + [HARD_RSVD1_REGNUM] = "-", \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4924 + [HARD_Z_REGNUM] = "z" /* bit 2 of CC */ } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4925 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4926 +/***************************************************************************** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4927 +** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4928 +** Debug Support |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4929 +** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4930 +*****************************************************************************/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4931 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4932 +/* Default to DBX-style debugging */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4933 +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4934 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4935 +#define DBX_DEBUGGING_INFO |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4936 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4937 +#define DEFAULT_GDB_EXTENSIONS 0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4938 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4939 +#define ASM_STABS_OP ";\t.stabs\t" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4940 +#define ASM_STABD_OP ";\t.stabd\t" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4941 +#define ASM_STABN_OP ";\t.stabn\t" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4942 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4943 +#define DBX_CONTIN_LENGTH 54 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4944 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4945 +#define DBX_OUTPUT_MAIN_SOURCE_FILENAME(ASMFILE, FILENAME) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4946 +do { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4947 + const char *p = FILENAME; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4948 + while ((p = strchr (p, '/')) != NULL) { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4949 + p = FILENAME = p+1; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4950 + } \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4951 + fprintf (ASMFILE, "%s", ASM_STABS_OP); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4952 + output_quoted_string (ASMFILE, FILENAME); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4953 + fprintf (ASMFILE, ",%d,0,0,", N_SO); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4954 + assemble_name (ASMFILE, ltext_label_name); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4955 + fputc ('\n', ASMFILE); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4956 + switch_to_section (text_section); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4957 + (*targetm.asm_out.internal_label) (ASMFILE, "Ltext", 0); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4958 +} while (0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4959 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4960 +/* With -g, GCC sometimes outputs string literals that are longer than |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4961 + * the assembler can handle. Without actual debug support, these are |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4962 + * not really required. Redefine the function to output strings to |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4963 + * output as much as possible. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4964 +#define OUTPUT_QUOTED_STRING(FILE, STR) m6809_output_quoted_string (FILE, STR) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4965 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4966 +/***************************************************************************** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4967 +** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4968 +** Output and Generation of Labels |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4969 +** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4970 +*****************************************************************************/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4971 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4972 +/* Prefixes for various assembly-time objects */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4973 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4974 +#define REGISTER_PREFIX "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4975 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4976 +#define LOCAL_LABEL_PREFIX "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4977 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4978 +#define USER_LABEL_PREFIX "_" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4979 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4980 +#define IMMEDIATE_PREFIX "#" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4981 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4982 +/* This is how to output the definition of a user-level label named NAME, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4983 + such as the label on a static function or variable NAME. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4984 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4985 +#define ASM_OUTPUT_LABEL(FILE,NAME) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4986 +do { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4987 + if (section_changed) { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4988 + fprintf (FILE, "\n%s\n\n", code_section_op); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4989 + section_changed = 0; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4990 + } \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4991 + assemble_name (FILE, NAME); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4992 + fputs (":\n", FILE); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4993 +} while (0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4994 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4995 +/* This is how to output the label for a function definition. It |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4996 + invokes ASM_OUTPUT_LABEL, but may examine the DECL tree node for |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4997 + other properties. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4998 +#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4999 + m6809_declare_function_name (FILE,NAME,DECL) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5000 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5001 +/* This is how to output a command to make the user-level label |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5002 + named NAME defined for reference from other files. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5003 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5004 +#define GLOBAL_ASM_OP "\t.globl " |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5005 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5006 +/* This is how to output a reference to a user label named NAME. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5007 +#define ASM_OUTPUT_LABELREF(FILE,NAME) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5008 + fprintf (FILE, "_%s", NAME) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5009 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5010 +/* This is how to output a reference to a symbol ref |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5011 + * Check to see if the symbol is in the direct page */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5012 +#define ASM_OUTPUT_SYMBOL_REF(FILE,sym) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5013 +{ \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5014 + print_direct_prefix (FILE, sym); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5015 + assemble_name (FILE, XSTR (sym, 0)); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5016 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5017 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5018 +/* External references aren't necessary, so don't emit anything */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5019 +#define ASM_OUTPUT_EXTERNAL(FILE,DECL,NAME) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5020 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5021 +/* This is how to store into the string LABEL |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5022 + the symbol_ref name of an internal numbered label where |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5023 + PREFIX is the class of label and NUM is the number within the class. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5024 + This is suitable for output with `assemble_name'. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5025 +#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5026 + sprintf (LABEL, "*%s%lu", PREFIX, (unsigned long int)NUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5027 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5028 +/* This is how to output an assembler line defining an `int' constant. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5029 +#define ASM_OUTPUT_INT(FILE,VALUE) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5030 +( fprintf (FILE, "\t.word "), \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5031 + output_addr_const (FILE, (VALUE)), \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5032 + fprintf (FILE, "\n")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5033 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5034 +/* Likewise for `char' and `short' constants. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5035 +#define ASM_OUTPUT_SHORT(FILE,VALUE) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5036 +( fprintf (FILE, "\t.word "), \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5037 + output_addr_const (FILE, (VALUE)), \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5038 + fprintf (FILE, "\n")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5039 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5040 +/* This is how to output a string. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5041 +#define ASM_OUTPUT_ASCII(FILE,STR,SIZE) m6809_output_ascii (FILE, STR, SIZE) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5042 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5043 +/* This is how to output an insn to push a register on the stack. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5044 + It need not be very fast code. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5045 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5046 +#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5047 + fprintf (FILE, "\tpshs\t%s\n", reg_names[REGNO]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5048 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5049 +/* This is how to output an insn to pop a register from the stack. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5050 + It need not be very fast code. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5051 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5052 +#define ASM_OUTPUT_REG_POP(FILE,REGNO) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5053 + fprintf (FILE, "\tpuls\t%s\n", reg_names[REGNO]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5054 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5055 +/* This is how to output an element of a case-vector that is absolute. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5056 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5057 +#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5058 + fprintf (FILE, "\t.word L%u\n", VALUE) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5059 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5060 +/* This is how to output an element of a case-vector that is relative. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5061 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5062 +#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5063 + fprintf (FILE, "\t.word L%u-L%u\n", VALUE, REL) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5064 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5065 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5066 +/***************************************************************************** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5067 +** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5068 +** Assembler Commands for Alignment |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5069 +** |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5070 +*****************************************************************************/ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5071 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5072 +/* ASM_OUTPUT_SKIP is supposed to zero initialize the data. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5073 + * So use the .byte and .word directives instead of .blkb */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5074 +#define ASM_OUTPUT_SKIP(FILE,SIZE) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5075 + do { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5076 + int __size = SIZE; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5077 + while (__size > 0) { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5078 + if (__size >= 2) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5079 + { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5080 + fprintf (FILE, "\t.word\t0\t;skip space %d\n", __size); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5081 + __size -= 2; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5082 + } \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5083 + else \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5084 + { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5085 + fprintf (FILE, "\t.byte\t0\t;skip space\n"); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5086 + __size--; \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5087 + } \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5088 + } \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5089 + } while (0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5090 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5091 +/* This says how to output an assembler line |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5092 + to define a global common symbol. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5093 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5094 +#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5095 + do { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5096 + switch_to_section (bss_section); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5097 + fputs ("\t.globl\t", FILE); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5098 + assemble_name ((FILE), (NAME)); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5099 + fputs ("\n", FILE); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5100 + assemble_name ((FILE), (NAME)); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5101 + fprintf ((FILE), ":\t.blkb\t" FMT_HOST_WIDE_INT "\n", (ROUNDED));} while(0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5102 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5103 +/* This says how to output an assembler line |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5104 + to define a local common symbol. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5105 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5106 +#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5107 +do { \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5108 + switch_to_section (bss_section); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5109 + assemble_name ((FILE), (NAME)); \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5110 + fprintf ((FILE), ":\t.blkb\t" FMT_HOST_WIDE_INT "\n", (ROUNDED));} while(0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5111 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5112 +/* Store in OUTPUT a string (made with alloca) containing |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5113 + an assembler-name for a local static variable named NAME. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5114 + LABELNO is an integer which is different for each call. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5115 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5116 +#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5117 +( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5118 + sprintf ((OUTPUT), "%s.%lu", (NAME), (unsigned long int)(LABELNO))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5119 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5120 +/* Print an instruction operand X on file FILE. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5121 + CODE is the code from the %-spec for printing this operand. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5122 + If `%z3' was used to print operand 3, then CODE is 'z'. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5123 +#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5124 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5125 +/* Print a memory operand whose address is X, on file FILE. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5126 +#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5127 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5128 +/* Don't let stack pushes build up too much. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5129 +#define MAX_PENDING_STACK 8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5130 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5131 +/* Define values for builtin operations */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5132 +enum m6809_builtins |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5133 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5134 + M6809_SWI, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5135 + M6809_SWI2, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5136 + M6809_SWI3, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5137 + M6809_CWAI, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5138 + M6809_SYNC, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5139 + M6809_ADD_CARRY, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5140 + M6809_SUB_CARRY, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5141 + M6809_ADD_DECIMAL, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5142 + M6809_NOP, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5143 + M6809_BLOCKAGE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5144 +}; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5145 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5146 diff -urN gcc-4.6.4-clean/gcc/config/m6809/m6809.md gcc-4.6.4/gcc/config/m6809/m6809.md |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5147 --- gcc-4.6.4-clean/gcc/config/m6809/m6809.md 1969-12-31 17:00:00.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5148 +++ gcc-4.6.4/gcc/config/m6809/m6809.md 2015-07-20 22:05:21.702720231 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5149 @@ -0,0 +1,2359 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5150 +;; GCC machine description for Motorola 6809 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5151 +;; Copyright (C) 1989, 2005, 2006, 2007, 2008, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5152 +;; 2009 Free Software Foundation, Inc. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5153 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5154 +;; Mostly by Brian Dominy (brian@oddchange.com) with substantial renovations |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5155 +;; by William Astle (lost@l-w.ca). |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5156 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5157 +;; Based on earlier work by Tom Jones (jones@sal.wisc.edu) and |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5158 +;; Matthias Doerfel (msdoerfe@informatik.uni-erlangen.de) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5159 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5160 +;; This file is part of GCC. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5161 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5162 +;; GCC is free software; you can redistribute it and/or modify |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5163 +;; it under the terms of the GNU General Public License as published by |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5164 +;; the Free Software Foundation; either version 3, or (at your option) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5165 +;; any later version. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5166 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5167 +;; GCC is distributed in the hope that it will be useful, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5168 +;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5169 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5170 +;; GNU General Public License for more details. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5171 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5172 +;; You should have received a copy of the GNU General Public License |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5173 +;; along with GCC; see the file COPYING3. If not see |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5174 +;; <http://www.gnu.org/licenses/>. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5175 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5176 +;; General information: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5177 +;; -------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5178 +;; * This backend is mostly a rewrite from earlier (3.1.1 and before) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5179 +;; versions. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5180 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5181 +;; * The 'A' and 'B' registers are treated as a single register by the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5182 +;; register allocator; hence, the instruction templates assume that |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5183 +;; both can be modified if either one is available for use. No |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5184 +;; attempt is made to split instructions to refer to a particular half |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5185 +;; of the register. It is always referred to as the 'D' register, even |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5186 +;; in QImode (when it will be displayed as 'B'). |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5187 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5188 +;; * There is full support for proper branch instruction generation, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5189 +;; based on instruction lengths. However, many instruction patterns |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5190 +;; are still overloaded to emit lots of real instructions, which can |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5191 +;; make the length calculation difficult; in those cases, I've tried |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5192 +;; to be pessimistic and assume the worst-case. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5193 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5194 +;; * The instruction type attributes are only defined for branch |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5195 +;; vs. non branch instructions for now, since there is seemingly no |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5196 +;; reason to define these for other types anyway. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5197 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5198 +;; * The limited number of total registers presents the greatest |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5199 +;; challenge. There are 'soft registers' -- memory locations |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5200 +;; used to simulate real regs -- which can be helpful. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5201 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5202 +;; * Position-independent code (PIC) is supported and has been tested |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5203 +;; but not to the extent of absolute code generation. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5204 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5205 +;; * All of the 6809 special opcodes, e.g. SWI and SYNC, are defined |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5206 +;; as UNSPEC instructions, and can be accessed from C code using |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5207 +;; __builtin_xxxx() style functions. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5208 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5209 +;; What still needs to be done: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5210 +;; ---------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5211 +;; * Replace remaining instances of (define_peephole) with |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5212 +;; (define_peephole2), or remove them completely if they are not |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5213 +;; matching anyway. Add more peepholes for things actually encountered. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5214 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5215 +;; * Indexing addressing can lead to crashes in complex functions when |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5216 +;; register pressure is high. Only the 'D' register can actually be |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5217 +;; used as an index register, and its demand by other instructions |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5218 +;; can sometimes mean that it is impossible to satisfy constraints. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5219 +;; Currently, indexing is completely disabled to avoid these types |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5220 +;; of problems, although code is slightly more inefficient in some |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5221 +;; working cases. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5222 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5223 +;; * 32-bit math is terribly inefficient. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5224 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5225 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5226 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5227 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5228 +;;- Constants |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5229 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5230 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5231 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5232 +; Define constants for hard register numbers. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5233 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5234 +(define_constants [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5235 + (HARD_RSVD1_REGNUM 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5236 + (HARD_X_REGNUM 1) (HARD_Y_REGNUM 2) (HARD_U_REGNUM 3) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5237 + (HARD_S_REGNUM 4) (HARD_PC_REGNUM 5) (HARD_D_REGNUM 6) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5238 + (HARD_Z_REGNUM 7) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5239 + (HARD_A_REGNUM 8) (HARD_B_REGNUM 9) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5240 + (HARD_CC_REGNUM 10) (HARD_DP_REGNUM 11) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5241 + (SOFT_FP_REGNUM 12) (SOFT_AP_REGNUM 13) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5242 + (SOFT_M0_REGNUM 14) (SOFT_M1_REGNUM 15) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5243 + (SOFT_M2_REGNUM 16) (SOFT_M3_REGNUM 17) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5244 +]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5245 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5246 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5247 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5248 +; The range in which a short branch insn can be used. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5249 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5250 +(define_constants [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5251 + (MIN_SHORT_BRANCH_OFFSET -127) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5252 + (MAX_SHORT_BRANCH_OFFSET 128) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5253 +]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5254 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5255 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5256 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5257 +; The lengths of various types of real 6809 instructions. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5258 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5259 +; By default, ordinary insns are 4 bytes long. This is often not |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5260 +; right, and the insn patterns below will redefine this to the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5261 +; correct value. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5262 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5263 +; Branch instruction lengths (conditional and unconditionals) are |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5264 +; well known and declared here. The short insns are used when the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5265 +; offset is within the range declared above (between MIN_SHORT |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5266 +; and MAX_SHORT) ; otherwise the long form is used. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5267 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5268 +(define_constants [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5269 + (DEFAULT_INSN_LENGTH 4) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5270 + (SHORT_CBRANCH_LENGTH 2) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5271 + (LONG_CBRANCH_LENGTH 4) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5272 + (SHORT_BRANCH_LENGTH 2) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5273 + (LONG_BRANCH_LENGTH 3) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5274 +]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5275 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5276 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5277 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5278 +; Constants for insn cycle counts. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5279 +; Note that these counts all assume 1-byte opcodes. 2-byte |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5280 +; opcodes require 1 extra cycles for fetching the extra byte. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5281 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5282 +(define_constants [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5283 + ;; The default insn length, when it cannot be calculated. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5284 + ;; Take a conservative approach and estimate high. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5285 + (DEFAULT_INSN_CYCLES 10) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5286 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5287 + ;; Cycle counts for ALU and load operations. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5288 + (ALU_INHERENT_CYCLES 2) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5289 + (ALU_IMMED_CYCLES 2) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5290 + (ALU_DIRECT_CYCLES 4) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5291 + (ALU_INDEXED_BASE_CYCLES 4) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5292 + (ALU_EXTENDED_CYCLES 5) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5293 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5294 + ;; If an ALU operation is on a 16-bit register (D), then |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5295 + ;; add this number of cycles to the total count. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5296 + (ALU_16BIT_CYCLES 2) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5297 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5298 + ;; A load of a 16-bit register incurs this extra amount. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5299 + (LOAD_16BIT_CYCLES 1) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5300 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5301 + ;; Cycle counts for memory-only operations (bit shifts, clear, test) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5302 + (MEM_DIRECT_CYCLES 6) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5303 + (MEM_INDEXED_BASE_CYCLES 6) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5304 + (MEM_EXTENDED_CYCLES 7) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5305 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5306 + ;; Cycle count for any reg-reg transfer (regardless of size) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5307 + (EXG_CYCLES 8) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5308 + (TFR_CYCLES 6) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5309 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5310 + ;; Cycle count for a condition code update (andcc/orcc) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5311 + (CC_CYCLES 3) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5312 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5313 + (JMP_DIRECT_CYCLES 3) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5314 + (JMP_INDEXED_BASE_CYCLES 3) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5315 + (JMP_EXTENDED_CYCLES 4) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5316 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5317 + (JSR_DIRECT_CYCLES 7) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5318 + (JSR_INDEXED_BASE_CYCLES 7) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5319 + (JSR_EXTENDED_CYCLES 8) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5320 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5321 + (LEA_BASE_CYCLES 4) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5322 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5323 + ;; Cycle count for a psh/pul operations. Add to this the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5324 + ;; total number of bytes moved for the correct count. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5325 + (PSH_PUL_CYCLES 5) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5326 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5327 + ;; Miscellaneous cycle counts |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5328 + (CWAI_CYCLES 20) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5329 + (MUL_CYCLES 11) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5330 + (NOP_CYCLES 2) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5331 + (RTI_CYCLES 15) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5332 + (RTS_CYCLES 5) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5333 + (SWI_CYCLES 20) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5334 + (SYNC_CYCLES 4) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5335 +]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5336 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5337 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5338 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5339 +; An enumeration of values for each "unspec"; i.e. unspecified |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5340 +; instruction. These represent insns that are meaningful on the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5341 +; 6809 but which have no intrinsic meaning to GCC itself. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5342 +; These insns can be generated explicitly using the __builtin_xxx |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5343 +; syntax; they are also implicitly generated by the backend |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5344 +; as needed to implement other insns. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5345 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5346 +(define_constants [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5347 + (UNSPEC_BLOCKAGE 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5348 + (UNSPEC_PUSH_RS 1) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5349 + (UNSPEC_POP_RS 2) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5350 + (UNSPEC_SWI 3) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5351 + (UNSPEC_CWAI 4) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5352 + (UNSPEC_ADD_CARRY 5) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5353 + (UNSPEC_SUB_CARRY 6) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5354 + (UNSPEC_SYNC 7) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5355 + (UNSPEC_ADD_DECIMAL 8) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5356 +]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5357 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5358 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5359 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5360 +;;- Predicates |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5361 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5362 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5363 +(include "predicates.md") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5364 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5365 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5366 +;;- Attributes |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5367 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5368 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5369 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5370 +;; The type attribute is used to distinguish between different |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5371 +;; types of branch instructions, so that their lengths can be |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5372 +;; calculated correctly. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5373 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5374 +(define_attr "type" "branch,cbranch,unknown" (const_string "unknown")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5375 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5376 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5377 +;; The length of a branch instruction is calculated based on how |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5378 +;; far away the branch target is. Lengths of other insns default |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5379 +;; to 4. set_attr is used in instruction templates to specify |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5380 +;; the length when it is known exactly. When not sure, err on |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5381 +;; the high side to avoid compile errors. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5382 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5383 +(define_attr "length" "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5384 + (cond [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5385 + (eq_attr "type" "branch") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5386 + (if_then_else (lt (minus (match_dup 0) (pc)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5387 + (const_int MIN_SHORT_BRANCH_OFFSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5388 + (const_int LONG_BRANCH_LENGTH) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5389 + (if_then_else (gt (minus (match_dup 0) (pc)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5390 + (const_int MAX_SHORT_BRANCH_OFFSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5391 + (const_int LONG_BRANCH_LENGTH) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5392 + (const_int SHORT_BRANCH_LENGTH))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5393 + (eq_attr "type" "cbranch") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5394 + (if_then_else (lt (minus (match_dup 0) (pc)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5395 + (const_int MIN_SHORT_BRANCH_OFFSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5396 + (const_int LONG_CBRANCH_LENGTH) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5397 + (if_then_else (gt (minus (match_dup 0) (pc)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5398 + (const_int MAX_SHORT_BRANCH_OFFSET)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5399 + (const_int LONG_CBRANCH_LENGTH) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5400 + (const_int SHORT_CBRANCH_LENGTH))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5401 + ] (const_int DEFAULT_INSN_LENGTH))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5402 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5403 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5404 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5405 +;; The default attributes for 'asm' statements. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5406 +;; The default length is the longest possible single 6809 instruction, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5407 +;; which is 5 bytes. GCC will automatically multiply this by the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5408 +;; number of real insns contained in an asm statement. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5409 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5410 +(define_asm_attributes |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5411 + [(set_attr "length" "5") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5412 + (set_attr "type" "unknown")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5413 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5414 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5415 +;; An attribute for the number of cycles that it takes an instruction |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5416 +;; to execute. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5417 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5418 +(define_attr "cycles" "" (const_int DEFAULT_INSN_CYCLES)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5419 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5420 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5421 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5422 +;;- Instruction patterns. When multiple patterns apply, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5423 +;;- the first one in the file is chosen. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5424 +;;- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5425 +;;- See file "rtl.def" for documentation on define_insn, match_*, et. al. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5426 +;;- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5427 +;;- Note: NOTICE_UPDATE_CC in m6809.h handles condition code updates |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5428 +;;- for most instructions. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5429 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5430 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5431 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5432 +;;- Test |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5433 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5434 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5435 +;; cmpx is 3 bytes, not 4 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5436 +(define_insn "*tsthi_x" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5437 + [(set (cc0) (match_operand:HI 0 "register_operand_x" "v"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5438 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5439 + "cmpx\t#0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5440 + [(set_attr "length" "3")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5441 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5442 +;; subd #0 is 3 bytes, better than cmpd #0 which is 4 bytes |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5443 +(define_insn "*tsthi_d" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5444 + [(set (cc0) (match_operand:HI 0 "register_operand_d" "d"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5445 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5446 + "subd\t#0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5447 + [(set_attr "length" "3")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5448 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5449 +(define_insn "*tsthi" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5450 + [(set (cc0) (match_operand:HI 0 "register_operand" "a"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5451 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5452 + "cmp%0\t#0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5453 + [(set_attr "length" "4")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5454 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5455 +(define_insn "*bitqi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5456 + [(set (cc0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5457 + (and:QI (match_operand:QI 0 "register_operand" "%q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5458 + (match_operand:QI 1 "general_operand" "mi")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5459 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5460 + "bit%0\t%1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5461 + [(set_attr "length" "3")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5462 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5463 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5464 +(define_insn "tstqi" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5465 + [(set (cc0) (match_operand:QI 0 "nonimmediate_operand" "q,mt"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5466 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5467 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5468 + tst%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5469 + tst\t%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5470 + [(set_attr "length" "1,3")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5471 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5472 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5473 +;;- Compare instructions |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5474 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5475 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5476 +;; - cmphi for register to memory or register compares |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5477 +(define_insn "cmphi" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5478 + [(set (cc0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5479 + (compare |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5480 + (match_operand:HI 0 "general_operand" "da, mi, ??Ud") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5481 + (match_operand:HI 1 "general_operand" "mi, da, dU")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5482 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5483 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5484 + if ((REG_P (operands[0])) && (REG_P (operands[1]))) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5485 + output_asm_insn ("pshs\t%1\t;cmphi: R:%1 with R:%0", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5486 + return "cmp%0\t,s++\t;cmphi:"; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5487 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5488 + if (GET_CODE (operands[0]) == REG) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5489 + return "cmp%0\t%1\t;cmphi:"; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5490 + else { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5491 + cc_status.flags |= CC_REVERSED; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5492 + return "cmp%1\t%0\t;cmphi:(R)"; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5493 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5494 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5495 + [(set_attr "length" "5,5,7")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5496 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5497 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5498 +(define_insn "cmpqi" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5499 + [(set (cc0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5500 + (compare (match_operand:QI 0 "whole_general_operand" "q,q, q,O,mt,K") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5501 + (match_operand:QI 1 "whole_general_operand" "O,mt,K,q,q, q")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5502 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5503 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5504 + if (REG_P (operands[0]) && !M_REG_P (operands[0])) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5505 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5506 + if (operands[1] == const0_rtx) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5507 + return "tst%0\t;cmpqi:(ZERO)"; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5508 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5509 + return "cmp%0\t%1\t;cmpqi:"; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5510 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5511 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5512 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5513 + cc_status.flags |= CC_REVERSED; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5514 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5515 + if (operands[0] == const0_rtx) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5516 + return "tst%1\t;cmpqi:(RZERO)"; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5517 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5518 + return "cmp%1\t%0\t;cmpqi:(R)"; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5519 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5520 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5521 + [(set_attr "length" "1,3,2,1,3,2")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5522 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5523 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5524 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5525 +;;- Compare/branch pattern |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5526 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5527 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5528 +(define_expand "cbranchhi4" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5529 + [(set (cc0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5530 + (compare |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5531 + (match_operand:HI 1 "general_operand" "da, mi, ??Ud") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5532 + (match_operand:HI 2 "general_operand" "mi, da, dU"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5533 + (set (pc) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5534 + (if_then_else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5535 + (match_operator 0 "ordered_comparison_operator" [(cc0) (const_int 0)]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5536 + (label_ref (match_operand 3 "" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5537 + (pc)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5538 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5539 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5540 +) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5541 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5542 +(define_expand "cbranchqi4" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5543 + [(set (cc0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5544 + (compare |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5545 + (match_operand:QI 1 "whole_general_operand" "q,q, q,O,mt,K") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5546 + (match_operand:QI 2 "whole_general_operand" "O,mt,K,q,q, q"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5547 + (set (pc) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5548 + (if_then_else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5549 + (match_operator 0 "ordered_comparison_operator" [(cc0) (const_int 0)]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5550 + (label_ref (match_operand 3 "" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5551 + (pc)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5552 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5553 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5554 +) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5555 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5556 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5557 +;;- Move |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5558 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5559 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5560 +; this looks good (obviously not finished) but I still see 'movsi' |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5561 +; places in udivsi3 where it's broken |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5562 +; (define_insn "pushsi1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5563 +; [(set (mem:SI (pre_dec (reg:HI HARD_S_REGNUM))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5564 +; (match_operand:SI 0 "general_operand" "o")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5565 +; (set (reg:HI HARD_S_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5566 +; (plus:HI (reg:HI HARD_S_REGNUM) (const_int -4))) ] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5567 +; "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5568 +; "; pushsi %0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5569 +; [(set_attr "length" "12")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5570 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5571 +; (define_insn "popsi1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5572 +; [(set (match_operand:SI 0 "general_operand" "=o") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5573 +; (mem:SI (post_inc (reg:HI HARD_S_REGNUM)))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5574 +; (set (reg:HI HARD_S_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5575 +; (plus:HI (reg:HI HARD_S_REGNUM) (const_int 4))) ] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5576 +; "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5577 +; "; popsi %0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5578 +; [(set_attr "length" "12")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5579 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5580 +; (define_insn "movsi" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5581 +; [(set (match_operand:SI 0 "nonimmediate_operand" "=o") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5582 +; (match_operand:SI 1 "general_operand" " oi"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5583 +; "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5584 +; "; movsi %0 <- %1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5585 +; [(set_attr "length" "1")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5586 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5587 +; this doesn't work |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5588 +; (define_expand "movsi" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5589 +; [(parallel [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5590 +; (set (match_operand:SI 0 "nonimmediate_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5591 +; (match_operand:SI 1 "general_operand" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5592 +; (clobber (match_scratch:HI 2 ""))])] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5593 +; "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5594 +; { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5595 +; rtx insn; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5596 +; if (STACK_PUSH_P (operands[0]) || STACK_POP_P (operands[1])) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5597 +; { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5598 +; REG_NOTES (insn) = alloc_EXPR_LIST (REG_INC, stack_pointer_rtx, REG_NOTES (insn)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5599 +; } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5600 +; insn = emit_move_multi_word (SImode, operands[0], operands[1]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5601 +; DONE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5602 +; }) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5603 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5604 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5605 +(define_expand "movhi" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5606 + [(set (match_operand:HI 0 "nonimmediate_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5607 + (match_operand:HI 1 "general_operand" ""))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5608 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5609 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5610 + /* One of the ops has to be in a register prior to reload */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5611 + if (!register_operand (operand0, HImode) && |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5612 + !register_operand (operand1, HImode)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5613 + operands[1] = copy_to_mode_reg (HImode, operand1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5614 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5615 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5616 +;;; Try a splitter to handle failure cases where we try to move |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5617 +;;; an immediate constant (zero usually) directly to memory. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5618 +;;; This absolutely requires an intermediate register. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5619 +(define_split |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5620 + [(set (match_operand:HI 0 "memory_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5621 + (match_operand:HI 1 "immediate_operand" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5622 + (clobber (match_operand:HI 2 "register_operand" ""))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5623 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5624 + [(set (match_dup 2) (match_dup 1)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5625 + (set (match_dup 0) (match_dup 2))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5626 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5627 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5628 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5629 +;;; This would be a nice method for loading from a word array, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5630 +;;; but it is never generated because the combiner cannot merge |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5631 +;;; more than 3 instructions (there are four here). This is |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5632 +;;; perhaps better done via a peephole. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5633 +(define_insn "*movhi_array_load" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5634 + [(set (match_operand:HI 0 "nonimmediate_operand" "=da") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5635 + (mem:HI (plus:HI (ashift:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "%B")) (const_int 1)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5636 + (match_operand:HI 2 "immediate_operand" "i")))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5637 + (clobber (match_scratch:HI 3 "=X"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5638 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5639 + "ldx\t%2\;abx\;abx\;ld%0\t,x" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5640 + [(set_attr "length" "7")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5641 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5642 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5643 +;;; Optimize the move of a byte to the stack using the pshs instruction |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5644 +;;; instead of a store with pre-increment. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5645 +(define_insn "movhi_push" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5646 + [(set (match_operand:HI 0 "push_operand" "=m") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5647 + (match_operand:HI 1 "register_operand" "U"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5648 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5649 + "pshs\t%1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5650 + [(set_attr "length" "2")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5651 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5652 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5653 +(define_insn "*movhi_pic_symbolref" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5654 + [(set (match_operand:HI 0 "register_operand" "=a") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5655 + (match_operand:HI 1 "symbolic_operand" ""))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5656 + "flag_pic" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5657 + "lea%0\t%c1,pcr" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5658 + [(set_attr "length" "4")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5659 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5660 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5661 +(define_insn "*movhi_1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5662 + [(set (match_operand:HI 0 "nonimmediate_operand" "=a,d,a,ad,mu") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5663 + (match_operand:HI 1 "general_operand" " a,a,d,miu,ad"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5664 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5665 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5666 + lea%0\t,%1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5667 + tfr\t%1,%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5668 + tfr\t%1,%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5669 + ld%0\t%1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5670 + st%1\t%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5671 + [(set_attr "length" "2,2,2,*,*")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5672 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5673 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5674 +;;; Generated by the combiner to merge an address calculation with |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5675 +;;; a byte load. We can use the 'abx' instruction here. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5676 +(define_insn "*movqi_array_load" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5677 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5678 + (mem:QI (plus:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "%B")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5679 + (match_operand:HI 2 "immediate_operand" "i")))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5680 + (clobber (match_scratch:HI 3 "=X"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5681 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5682 + "ldx\t%2\;abx\;ld%0\t,x" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5683 + [(set_attr "length" "6")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5684 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5685 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5686 +;;; Optimize the move of a byte to the stack using the pshs instruction |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5687 +;;; instead of a store with pre-increment. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5688 +(define_insn "movqi_push" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5689 + [(set (match_operand:QI 0 "push_operand" "=m") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5690 + (match_operand:QI 1 "register_operand" " q"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5691 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5692 + "pshs\t%1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5693 + [(set_attr "length" "2")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5694 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5695 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5696 +;;; Optimize the move of a byte from the stack using the puls instruction |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5697 +;;; instead of a store with post-decrement. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5698 +(define_insn "movqi_pop" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5699 + [(set (match_operand:QI 0 "register_operand" "=q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5700 + (match_operand:QI 1 "pop_operand" "m"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5701 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5702 + "puls\t%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5703 + [(set_attr "length" "2")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5704 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5705 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5706 +;;- load low byte of 16-bit data into 8-bit register/memory |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5707 +(define_insn "*mov_lsb" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5708 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q,q,m,!q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5709 + (subreg:QI (match_operand:HI 1 "general_operand" "d,m,a,d, U") 1))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5710 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5711 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5712 + \t;movlsbqihi: D->B |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5713 + ld%0\t%L1\t;movlsbqihi: msb:%1 -> R:%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5714 + tfr\t%1,d\t;movlsbqihi: R:%1 -> R:%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5715 + stb\t%0\t;movlsbqihi: R:%1 -> %0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5716 + pshs\t%1\t;movlsbqihi: R:%1 -> R:%0\;leas\t1,s\;puls\t%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5717 + [(set_attr "length" "0,*,2,*,6")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5718 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5719 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5720 +;;- load high byte of 16-bit data into 8-bit register/memory |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5721 +(define_insn "*mov_msb" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5722 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q,q,q,m,!q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5723 + (subreg:QI (match_operand:HI 1 "general_operand" "d,O,a,m,d, U") 0))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5724 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5725 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5726 + tfr\ta,b\t;movmsbqihi: D->B |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5727 + clr%0\t\t;movmsbqihi: ZERO -> R:%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5728 + tfr\t%1,d\t;movmsbqihi: R:%1 -> R:%0\;tfr\ta,b |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5729 + ld%0\t%L1\t;movmsbqihi: lsb:%1 -> R:%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5730 + sta\t%0\t;movmsbqihi: R:%1 -> %0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5731 + pshs\t%1\t;movmsbqihi: R:%1 -> R:%0\;puls\t%0\;leas\t1,s" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5732 + [(set_attr "length" "2,1,4,*,*,6")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5733 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5734 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5735 +(define_insn "*movqi_boolean" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5736 + [(set (reg:QI HARD_Z_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5737 + (match_operand:QI 0 "general_operand" "q,O,i,m"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5738 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5739 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5740 + tst%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5741 + andcc\t#~4 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5742 + orcc\t#4 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5743 + tst\t%0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5744 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5745 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5746 +(define_insn "movqi" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5747 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q,m,q,m,q,z") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5748 + (match_operand:QI 1 "general_operand" " q,O,O,mi,q,z,q"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5749 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5750 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5751 + tfr\t%1,%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5752 + clr%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5753 + clr\t%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5754 + ld%0\t%1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5755 + st%1\t%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5756 + tfr\tcc,%0\;and%0\t#4 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5757 + tst%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5758 + [(set_attr "length" "2,1,3,*,*,4,1")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5759 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5760 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5761 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5762 +;;- Swap registers |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5763 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5764 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5765 +; Note: 8-bit swap is never needed so it is not defined. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5766 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5767 +(define_insn "swaphi" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5768 + [(set (match_operand:HI 0 "register_operand" "+r") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5769 + (match_operand:HI 1 "register_operand" "+r")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5770 + (set (match_dup 1) (match_dup 0))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5771 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5772 + "exg\t%1,%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5773 + [(set_attr "length" "2") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5774 + (set (attr "cycles") (const_int EXG_CYCLES))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5775 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5776 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5777 +(define_insn "bswaphi2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5778 + [(set (match_operand:HI 0 "register_operand" "=d") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5779 + (bswap:HI (match_operand:HI 1 "register_operand" "0")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5780 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5781 + "exg\ta,b" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5782 + [(set_attr "length" "2")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5783 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5784 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5785 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5786 +;;- Extension and truncation insns. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5787 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5788 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5789 +(define_insn "extendqihi2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5790 + [(set (match_operand:HI 0 "register_operand" "=d") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5791 + (sign_extend:HI (match_operand:QI 1 "general_operand" "B")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5792 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5793 + "sex\t\t;extendqihi2: R:%1 -> R:%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5794 + [(set_attr "length" "1")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5795 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5796 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5797 +(define_insn "zero_extendqihi2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5798 + [(set (match_operand:HI 0 "register_operand" "=d") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5799 + (zero_extend:HI (match_operand:QI 1 "general_operand" "B")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5800 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5801 + "clra\t\t;zero_extendqihi: R:%1 -> R:%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5802 + [(set_attr "length" "1")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5803 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5804 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5805 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5806 +;;- All kinds of add instructions. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5807 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5808 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5809 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5810 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5811 +;; gcc's automatic version of addsi3 doesn't know about adcb,adca |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5812 +;; so it is MUCH less efficient. Define this one ourselves. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5813 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5814 +;; TODO - can't always get 'd' for the clobber... allow other registers |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5815 +;; as well and use exg d,R ... exg R,d around the code sequence to |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5816 +;; use others, at a price. Also consider libcall for this when |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5817 +;; optimizing for size. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5818 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5819 +(define_insn "addsi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5820 + [(set (match_operand:SI 0 "nonimmediate_operand" "=o") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5821 + (plus:SI (match_operand:SI 1 "general_operand" "%o") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5822 + (match_operand:SI 2 "general_operand" " oi"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5823 + (clobber (match_scratch:HI 3 "=d"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5824 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5825 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5826 + m6809_output_addsi3 (PLUS, operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5827 + return ""; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5828 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5829 + [(set_attr "length" "21")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5830 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5831 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5832 +; Increment of a 16-bit MEM by 1 can be done without a register. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5833 +(define_insn "*addhi_mem_1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5834 + [(set (match_operand:HI 0 "memory_operand" "=m") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5835 + (plus:HI (match_operand:HI 1 "memory_operand" "0") (const_int 1)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5836 + "GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5837 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5838 + rtx xoperands[2]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5839 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5840 + xoperands[0] = operands[0]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5841 + xoperands[1] = adjust_address (operands[0], QImode, 1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5842 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5843 + output_asm_insn ("inc\t%1", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5844 + output_asm_insn ("bne\t__IL%=", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5845 + output_asm_insn ("inc\t%0\;__IL%=:", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5846 + return ""; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5847 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5848 + [(set_attr "length" "7")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5849 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5850 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5851 +; Decrement of a 16-bit MEM by 1 can be done without a register. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5852 +(define_insn "*addhi_mem_minus1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5853 + [(set (match_operand:HI 0 "memory_operand" "=m") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5854 + (plus:HI (match_operand:HI 1 "memory_operand" "0") (const_int -1)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5855 + "GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5856 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5857 + rtx xoperands[2]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5858 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5859 + xoperands[0] = operands[0]; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5860 + xoperands[1] = adjust_address (operands[0], QImode, 1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5861 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5862 + output_asm_insn ("tst\t%1", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5863 + output_asm_insn ("bne\t__IL%=", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5864 + output_asm_insn ("dec\t%0", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5865 + output_asm_insn ("__IL%=:", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5866 + output_asm_insn ("dec\t%1", xoperands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5867 + return ""; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5868 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5869 + [(set_attr "length" "7")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5870 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5871 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5872 +; Allow the addition of an 8-bit quantity to a 16-bit quantity |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5873 +; using the LEAX B,Y addressing mode, where X and Y are both |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5874 +; index registers. This will only get generated via the peephole |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5875 +; which removes a sign extension. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5876 +(define_insn "*addhi_b" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5877 + [(set (match_operand:HI 0 "index_register_operand" "=a") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5878 + (plus:HI(match_operand:HI 1 "index_register_operand" "%a") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5879 + (match_operand:QI 2 "register_operand" "q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5880 + ))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5881 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5882 + "lea%0\t%2,%1\t;addhi_b: R:%0 = R:%2 + R:%1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5883 + [(set_attr "length" "*")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5884 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5885 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5886 +; Splitter for addhi pattern #5 below |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5887 +(define_split |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5888 + [(set (match_operand:HI 0 "index_register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5889 + (plus:HI (match_dup 0) (match_operand:HI 1 "memory_operand" "")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5890 + "reload_completed" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5891 + [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5892 + (parallel [(set (match_dup 0) (reg:HI HARD_D_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5893 + (set (reg:HI HARD_D_REGNUM) (match_dup 0))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5894 + (set (reg:HI HARD_D_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5895 + (plus:HI (reg:HI HARD_D_REGNUM) (match_dup 1))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5896 + (parallel [(set (match_dup 0) (reg:HI HARD_D_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5897 + (set (reg:HI HARD_D_REGNUM) (match_dup 0))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5898 + ] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5899 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5900 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5901 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5902 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5903 +; Splitter for addhi pattern #7 below |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5904 +(define_split |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5905 + [(set (match_operand:HI 0 "index_register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5906 + (plus:HI (match_dup 0) (match_operand:HI 1 "index_register_operand" "")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5907 + "reload_completed" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5908 + [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5909 + (parallel [(set (match_dup 1) (reg:HI HARD_D_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5910 + (set (reg:HI HARD_D_REGNUM) (match_dup 1))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5911 + (set (match_dup 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5912 + (plus:HI (reg:HI HARD_D_REGNUM) (match_dup 0))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5913 + (parallel [(set (match_dup 1) (reg:HI HARD_D_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5914 + (set (reg:HI HARD_D_REGNUM) (match_dup 1))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5915 + ] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5916 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5917 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5918 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5919 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5920 +; TODO - this is ugly. During RTL generation, we don't know what registers |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5921 +; are available, so the multiple-insn sequences can only be solved |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5922 +; via 'define_split's during matching. See andhi3 for an example. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5923 +; Keep the constraints with ? modifiers to help reload pick the right |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5924 +; registers. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5925 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5926 +; The forms are: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5927 +; 1. D += D, expand this into a shift instead. (rtx costs should be corrected |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5928 +; to avoid this even happening...) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5929 +; 2. D += U, require U to be pushed to memory. (Lots of patterns do this |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5930 +; now, is this a better way?) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5931 +; 3. Best choice: 'addd' |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5932 +; 4. Next best choice: 'lea' |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5933 +; 5. Hybrid of 3 and 4 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5934 +; 6. Same as 4, not bad |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5935 +; 7. BAD, no D register at all |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5936 +; 8. 'lea', as good as 4. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5937 +(define_insn "addhi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5938 + [(set (match_operand:HI 0 "nonimmediate_operand" "=d, d, d, a,?a, a,???T,a") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5939 + (plus:HI(match_operand:HI 1 "add_general_operand" "%0, 0, 0, d, 0, a, 0, a") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5940 + (match_operand:HI 2 "general_operand" " 0, !U, mi, a, m, d, T, i") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5941 + ))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5942 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5943 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5944 + lslb\t\t;addhi: R:%0 += R:%2\;rola\t\t;also R:%0 *= 2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5945 + pshs\t%2\t;addhi: R:%0 += R:%2\;add%0\t,s++ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5946 + add%0\t%2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5947 + lea%0\t%1,%2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5948 + # |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5949 + lea%0\t%2,%1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5950 + # |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5951 + lea%0\t%a2,%1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5952 + [(set_attr "length" "2,6,*,*,7,*,7,*")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5953 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5954 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5955 +(define_insn "addqi3_carry" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5956 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5957 + (unspec:QI [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5958 + (match_operand:QI 1 "whole_general_operand" "%0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5959 + (match_operand:QI 2 "whole_general_operand" "tmi")] UNSPEC_ADD_CARRY))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5960 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5961 + "adc%0\t%2\t;addqi_carry: R:%0 += %2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5962 + [(set_attr "length" "*")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5963 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5964 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5965 +; TODO: specifying 'A' for the first constraint, to force into the A register |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5966 +; is not working because of the way registers are currently set up. This will |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5967 +; take some work to get right. Thus the second alternative as a backup. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5968 +(define_insn "addqi3_decimal" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5969 + [(set (match_operand:QI 0 "nonimmediate_operand" "=A,?q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5970 + (unspec:QI [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5971 + (match_operand:QI 1 "general_operand" "%0,0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5972 + (match_operand:QI 2 "general_operand" "mi,mi")] UNSPEC_ADD_DECIMAL))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5973 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5974 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5975 + adda\t%2\;daa |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5976 + tfr\t%0,a\;adda\t%2\;daa\;tfr\ta,%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5977 + [(set_attr "length" "5,9")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5978 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5979 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5980 +(define_insn "addqi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5981 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q,q,m,m,q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5982 + (plus:QI (match_operand:QI 1 "whole_general_operand" "%0,0,0,0,0,0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5983 + (match_operand:QI 2 "whole_general_operand" " 0,I,N,I,N,mi")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5984 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5985 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5986 + asl%0\t\t;addqi: R:%0 = R:%0 + R:%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5987 + inc%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5988 + dec%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5989 + inc\t%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5990 + dec\t%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5991 + add%0\t%2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5992 + [(set_attr "length" "1,1,1,3,3,*")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5993 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5994 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5995 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5996 +;;- Subtract instructions. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5997 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5998 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5999 +(define_insn "subsi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6000 + [(set (match_operand:SI 0 "nonimmediate_operand" "=o") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6001 + (minus:SI (match_operand:SI 1 "general_operand" " o") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6002 + (match_operand:SI 2 "general_operand" " oi"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6003 + (clobber (match_scratch:HI 3 "=d"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6004 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6005 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6006 + m6809_output_addsi3 (MINUS, operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6007 + return ""; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6008 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6009 + [(set_attr "length" "21")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6010 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6011 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6012 +(define_insn "subhi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6013 + [(set (match_operand:HI 0 "register_operand" "=d, d, a") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6014 + (minus:HI (match_operand:HI 1 "register_operand" "0, 0, 0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6015 + (match_operand:HI 2 "general_operand" "mi, ?U,n")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6016 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6017 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6018 + sub%0\t%2\t;subhi: R:%0 -= %2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6019 + pshs\t%2\t;subhi: R:%0 -= R:%2\;sub%0\t,s++ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6020 + lea%0\t%n2,%1\t;subhi: R:%0 = R:%1 + %n2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6021 + [(set_attr "length" "*,5,3")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6022 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6023 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6024 +(define_insn "subqi3_carry" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6025 + [(set (match_operand:QI 0 "register_operand" "=q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6026 + (unspec:QI [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6027 + (match_operand:QI 1 "whole_general_operand" "%0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6028 + (match_operand:QI 2 "whole_general_operand" "tmi")] UNSPEC_SUB_CARRY))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6029 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6030 + "sbc%0\t%2\t;subqi_carry: R:%0 += %2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6031 + [(set_attr "length" "*")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6032 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6033 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6034 +(define_insn "subqi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6035 + [(set (match_operand:QI 0 "register_operand" "=q, q, !q, !q, q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6036 + (minus:QI (match_operand:QI 1 "whole_register_operand" "0, 0, I, tmn, 0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6037 + (match_operand:QI 2 "whole_general_operand" "I, mi, 0, 0, t")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6038 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6039 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6040 + dec%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6041 + sub%0\t%2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6042 + dec%0\;neg%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6043 + sub%0\t%1\;neg%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6044 + sub%0\t%2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6045 + [(set_attr "length" "1,3,2,4,3")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6046 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6047 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6048 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6049 +;;- Multiply instructions. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6050 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6051 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6052 +; TODO - merge these two instructions, using 'extend_operator' to match |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6053 +; either signed or zero extension. Everything else is the same. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6054 +(define_insn "mulqihi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6055 + [(set (match_operand:HI 0 "register_operand" "=d") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6056 + (mult:HI (sign_extend:HI (match_operand:QI 1 "general_operand" "%q")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6057 + (match_operand:QI 2 "general_operand" "tmK")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6058 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6059 + "lda\t%2\t;mulqihi3\;mul" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6060 + [(set_attr "length" "3")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6061 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6062 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6063 +(define_insn "umulqihi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6064 + [(set (match_operand:HI 0 "register_operand" "=d") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6065 + (mult:HI (zero_extend:HI (match_operand:QI 1 "general_operand" "%q")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6066 + (match_operand:QI 2 "general_operand" "tmK")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6067 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6068 + "lda\t%2\t;umulqihi3\;mul" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6069 + [(set_attr "length" "3")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6070 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6071 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6072 +; Expand a 16x16 multiplication into either a libcall or a shift. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6073 +; If the second operand is a small constant, use the above form. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6074 +; Otherwise, do a libcall. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6075 +(define_expand "mulhi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6076 + [(set (match_operand:HI 0 "nonimmediate_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6077 + (mult:HI (match_operand:HI 1 "general_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6078 + (match_operand:HI 2 "nonmemory_operand" "")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6079 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6080 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6081 + emit_libcall_insns (HImode, "mulhi3", operands, 2); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6082 + DONE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6083 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6084 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6085 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6086 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6087 +;;- Divide instructions. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6088 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6089 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6090 +(define_expand "divhi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6091 + [(set (match_operand:HI 0 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6092 + (div:HI (match_operand:HI 1 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6093 + (match_operand:HI 2 "register_operand" "")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6094 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6095 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6096 + emit_libcall_insns (HImode, "divhi3", operands, 2); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6097 + DONE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6098 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6099 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6100 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6101 +(define_expand "divqi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6102 + [(set (match_operand:QI 0 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6103 + (div:QI (match_operand:QI 1 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6104 + (match_operand:QI 2 "register_operand" "")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6105 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6106 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6107 + emit_libcall_insns (QImode, "divqi3", operands, 2); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6108 + DONE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6109 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6110 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6111 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6112 +(define_expand "udivhi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6113 + [(set (match_operand:HI 0 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6114 + (udiv:HI (match_operand:HI 1 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6115 + (match_operand:HI 2 "register_operand" "")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6116 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6117 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6118 + emit_libcall_insns (HImode, "udivhi3", operands, 2); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6119 + DONE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6120 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6121 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6122 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6123 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6124 +;;- mod |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6125 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6126 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6127 +(define_expand "modhi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6128 + [(set (match_operand:HI 0 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6129 + (mod:HI (match_operand:HI 1 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6130 + (match_operand:HI 2 "register_operand" "")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6131 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6132 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6133 + emit_libcall_insns (HImode, "modhi3", operands, 2); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6134 + DONE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6135 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6136 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6137 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6138 +(define_expand "modqi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6139 + [(set (match_operand:QI 0 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6140 + (mod:QI (match_operand:QI 1 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6141 + (match_operand:QI 2 "register_operand" "")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6142 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6143 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6144 + emit_libcall_insns (QImode, "modqi3", operands, 2); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6145 + DONE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6146 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6147 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6148 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6149 +(define_expand "umodhi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6150 + [(set (match_operand:HI 0 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6151 + (umod:HI (match_operand:HI 1 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6152 + (match_operand:HI 2 "register_operand" "")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6153 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6154 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6155 + emit_libcall_insns (HImode, "umodhi3", operands, 2); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6156 + DONE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6157 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6158 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6159 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6160 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6161 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6162 +;;- and, or, xor common patterns |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6163 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6164 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6165 +; Split a bitwise HImode into two QImode instructions, with one of |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6166 +; the sources in a pushable register. The register is pushed onto |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6167 +; the stack and memory pop operands (,s+) are used in the QI forms. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6168 +(define_split |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6169 + [(set (match_operand:HI 0 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6170 + (match_operator:HI 3 "logical_bit_operator" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6171 + [(match_operand:HI 1 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6172 + (match_operand:HI 2 "register_operand" "")]))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6173 + "reload_completed" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6174 + [(set (mem:HI (pre_dec:HI (reg:HI HARD_S_REGNUM))) (match_dup 2)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6175 + (set (reg:QI HARD_A_REGNUM) (match_op_dup:QI 3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6176 + [(reg:QI HARD_A_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6177 + (mem:QI (post_inc:QI (reg:HI HARD_S_REGNUM)))])) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6178 + (set (reg:QI HARD_D_REGNUM) (match_op_dup:QI 3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6179 + [(reg:QI HARD_D_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6180 + (mem:QI (post_inc:QI (reg:HI HARD_S_REGNUM)))])) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6181 + (use (reg:QI HARD_A_REGNUM))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6182 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6183 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6184 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6185 +; Split a bitwise HImode into two QImode instructions, with one |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6186 +; of the sources being a (MEM (MEM (...)); i.e. an indirect memory |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6187 +; reference. This requires dereferencing the pointer into a |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6188 +; temporary register (X), which must be saved/restored around the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6189 +; compute instructions. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6190 +(define_split |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6191 + [(set (match_operand:HI 0 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6192 + (match_operator:HI 3 "logical_bit_operator" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6193 + [(match_operand:HI 1 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6194 + (mem:HI (match_operand:HI 2 "memory_operand" ""))]))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6195 + "reload_completed" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6196 + [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6197 + (set (mem:HI (pre_dec:HI (reg:HI HARD_S_REGNUM))) (match_dup 4)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6198 + (set (match_dup 4) (match_dup 2)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6199 + (set (match_dup 4) (mem:HI (match_dup 4))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6200 + (set (reg:QI HARD_A_REGNUM) (match_op_dup:QI 3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6201 + [(reg:QI HARD_A_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6202 + (mem:QI (post_inc:QI (match_dup 4)))])) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6203 + (set (reg:QI HARD_D_REGNUM) (match_op_dup:QI 3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6204 + [(reg:QI HARD_D_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6205 + (mem:QI (post_inc:QI (match_dup 4)))])) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6206 + (use (reg:QI HARD_A_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6207 + (set (match_dup 4) (mem:HI (post_inc:HI (reg:HI HARD_S_REGNUM)))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6208 + ] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6209 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6210 + /* Use X for a temporary index register */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6211 + operands[4] = gen_rtx_REG (HImode, HARD_X_REGNUM); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6212 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6213 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6214 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6215 +; Split a bitwise HImode into two QImode instructions. This is |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6216 +; the common case. This handles splitting when neither of the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6217 +; above two cases applies. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6218 +(define_split |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6219 + [(set (match_operand:HI 0 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6220 + (match_operator:HI 3 "logical_bit_operator" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6221 + [(match_operand:HI 1 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6222 + (match_operand:HI 2 "general_operand" "")]))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6223 + "reload_completed" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6224 + [(set (reg:QI HARD_A_REGNUM) (match_op_dup:QI 3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6225 + [(reg:QI HARD_A_REGNUM) (match_dup 4)])) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6226 + (set (reg:QI HARD_D_REGNUM) (match_op_dup:QI 3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6227 + [(reg:QI HARD_D_REGNUM) (match_dup 5)])) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6228 + (use (reg:QI HARD_A_REGNUM))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6229 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6230 + if (GET_CODE (operands[2]) == CONST_INT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6231 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6232 + operands[4] = gen_rtx_const_high (operands[2]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6233 + operands[5] = gen_rtx_const_low (operands[2]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6234 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6235 + else if ((GET_CODE (operands[2]) == MEM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6236 + && (GET_CODE (XEXP (operands[2], 0)) == MEM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6237 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6238 + FAIL; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6239 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6240 + else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6241 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6242 + operands[4] = gen_highpart (QImode, operands[2]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6243 + operands[5] = gen_lowpart (QImode, operands[2]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6244 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6245 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6246 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6247 +; Below are the specific cases for each of the operators. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6248 +; The QImode versions are the simplest and can be implemented |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6249 +; directly on the hardware. The HImode cases are all output |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6250 +; using one of the above splitting techniques. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6251 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6252 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6253 +;;- and |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6254 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6255 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6256 +(define_insn "andhi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6257 + [(set (match_operand:HI 0 "register_operand" "=d") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6258 + (and:HI (match_operand:HI 1 "register_operand" "%0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6259 + (match_operand:HI 2 "general_operand" "mnU")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6260 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6261 + "#") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6262 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6263 +;; it is not clear that this is correct |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6264 +(define_insn "*andqi_2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6265 + [(set |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6266 + (match_operand:QI 0 "register_operand" "=q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6267 + (and:QI (match_operand:QI 1 "register_operand" "q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6268 + (match_operand 2 "const_int_operand" "i")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6269 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6270 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6271 + if (GET_CODE (operands[2]) == CONST_INT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6272 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6273 + operands[3] = GEN_INT(INTVAL(operands[2]) & 0xff); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6274 + return "and%0 %3"; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6275 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6276 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6277 + return "and%0 %2"; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6278 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6279 + [(set_attr "length" "2")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6280 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6281 +(define_insn "andqi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6282 + [(set (match_operand:QI 0 "register_operand" "=q,q,q,qc") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6283 + (and:QI (match_operand:QI 1 "whole_register_operand" "%0,0,0,0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6284 + (match_operand:QI 2 "whole_general_operand" " O,N,m,i")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6285 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6286 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6287 + clr%0\t;andqi(ZERO) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6288 + \t;andqi(-1) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6289 + and%0\t%2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6290 + and%0\t%2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6291 + [(set_attr "length" "1,0,3,2")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6292 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6293 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6294 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6295 +;;- or |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6296 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6297 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6298 +(define_insn "iorhi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6299 + [(set (match_operand:HI 0 "register_operand" "=d") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6300 + (ior:HI (match_operand:HI 1 "register_operand" "%0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6301 + (match_operand:HI 2 "general_operand" "mnU")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6302 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6303 + "#") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6304 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6305 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6306 +(define_insn "iorqi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6307 + [(set (match_operand:QI 0 "register_operand" "=q,q, qc") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6308 + (ior:QI (match_operand:QI 1 "whole_register_operand" "%0,0, 0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6309 + (match_operand:QI 2 "whole_general_operand" " O,m,i")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6310 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6311 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6312 + \t;iorqi(ZERO) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6313 + or%0\t%2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6314 + or%0\t%2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6315 + [(set_attr "length" "0,3,2")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6316 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6317 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6318 +;;- xor |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6319 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6320 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6321 +(define_insn "xorhi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6322 + [(set (match_operand:HI 0 "register_operand" "=d") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6323 + (xor:HI (match_operand:HI 1 "register_operand" "%0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6324 + (match_operand:HI 2 "general_operand" "mnU")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6325 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6326 + "#") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6327 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6328 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6329 +(define_insn "xorqi3" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6330 + [(set (match_operand:QI 0 "register_operand" "=q,q,q,q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6331 + (xor:QI (match_operand:QI 1 "whole_register_operand" "%0,0,0,0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6332 + (match_operand:QI 2 "whole_general_operand" " O,N,m,i")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6333 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6334 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6335 + \t;xorqi(ZERO) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6336 + com%0\t;xorqi(-1) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6337 + eor%0\t%2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6338 + eor%0\t%2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6339 + [(set_attr "length" "0,1,3,2")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6340 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6341 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6342 +;;- Two's Complements |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6343 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6344 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6345 +(define_insn "neghi2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6346 + [(set (match_operand:HI 0 "nonimmediate_operand" "=d,!a") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6347 + (neg:HI (match_operand:HI 1 "general_operand" "0, 0")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6348 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6349 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6350 + nega\;negb\;sbca\t#0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6351 + exg\td,%0\;nega\;negb\;sbca\t#0\;exg\td,%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6352 + [(set_attr "length" "5,9")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6353 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6354 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6355 +(define_insn "negqi2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6356 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6357 + (neg:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6358 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6359 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6360 + neg%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6361 + neg\t%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6362 + [(set_attr "length" "1,3")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6363 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6364 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6365 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6366 +;;- One's Complements |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6367 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6368 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6369 +(define_insn "one_cmplhi2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6370 + [(set (match_operand:HI 0 "nonimmediate_operand" "=d,?tm,???a") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6371 + (not:HI (match_operand:HI 1 "general_operand" "0, 0, 0")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6372 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6373 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6374 + coma\;comb |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6375 + com\t%0\;com\t%L0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6376 + exg\td,%0\;coma\;comb\;exg\td,%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6377 + [(set_attr "length" "2,6,6")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6378 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6379 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6380 +(define_insn "one_cmplqi2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6381 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6382 + (not:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6383 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6384 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6385 + com%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6386 + com\t%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6387 + [(set_attr "length" "1,3")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6388 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6389 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6390 +;;- Shifts/rotates |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6391 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6392 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6393 +(define_code_iterator bit_code [ashift ashiftrt lshiftrt]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6394 +(define_code_attr bit_code_name [(ashift "ashl") (ashiftrt "ashr") (lshiftrt "lshr")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6395 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6396 +(define_mode_iterator bit_mode [QI HI]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6397 +(define_mode_attr bit_mode_name [(QI "qi3") (HI "hi3")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6398 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6399 +;; Emit RTL for any shift (handles all 3 opcodes and 2 mode sizes) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6400 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6401 +(define_expand "<bit_code:bit_code_name><bit_mode:bit_mode_name>" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6402 + [(set (match_operand:bit_mode 0 "nonimmediate_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6403 + (bit_code:bit_mode (match_operand:bit_mode 1 "general_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6404 + (match_operand:bit_mode 2 "nonmemory_operand" "")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6405 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6406 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6407 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6408 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6409 +; Individual instructions implemented in the CPU. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6410 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6411 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6412 +(define_insn "*ashift1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6413 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6414 + (ashift:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6415 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6416 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6417 + asl\t%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6418 + asl%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6419 + [(set_attr "length" "3,1")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6420 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6421 +(define_insn "*lshiftrt1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6422 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6423 + (lshiftrt:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6424 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6425 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6426 + lsr\t%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6427 + lsr%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6428 + [(set_attr "length" "3,1")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6429 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6430 +(define_insn "*ashiftrt1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6431 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6432 + (ashiftrt:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6433 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6434 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6435 + asr\t%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6436 + asr%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6437 + [(set_attr "length" "3,1")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6438 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6439 +(define_insn "*rotate1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6440 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6441 + (rotate:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6442 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6443 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6444 + rol\t%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6445 + rol%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6446 + [(set_attr "length" "3,1")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6447 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6448 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6449 +(define_insn "*rotatert1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6450 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6451 + (rotatert:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6452 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6453 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6454 + ror\t%0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6455 + ror%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6456 + [(set_attr "length" "3,1")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6457 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6458 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6459 +; A shift by 8 for D reg can be optimized by just moving |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6460 +; between the A/B halves, and then zero/sign extending or |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6461 +; filling in zeroes. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6462 +; Because GCC does not understand that 'A' and 'D' refer to |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6463 +; the same storage location, we must use 'USE' throughout |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6464 +; to prevent deletion of 'unnecessary' instructions. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6465 +; Similar optimization for MEM would require a scratch register |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6466 +; so is not done here. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6467 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6468 +(define_split |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6469 + [(set (reg:HI HARD_D_REGNUM) (ashift:HI (reg:HI HARD_D_REGNUM) (const_int 8)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6470 + "reload_completed" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6471 + [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6472 + (use (reg:HI HARD_D_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6473 + (set (reg:QI HARD_A_REGNUM) (reg:QI HARD_D_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6474 + (use (reg:QI HARD_A_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6475 + (set (reg:QI HARD_D_REGNUM) (const_int 0)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6476 + ] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6477 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6478 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6479 +(define_split |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6480 + [(set (reg:HI HARD_D_REGNUM) (lshiftrt:HI (reg:HI HARD_D_REGNUM) (const_int 8)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6481 + "reload_completed" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6482 + [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6483 + (use (reg:HI HARD_D_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6484 + (set (reg:QI HARD_D_REGNUM) (reg:QI HARD_A_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6485 + (use (reg:QI HARD_D_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6486 + (set (reg:HI HARD_D_REGNUM) (zero_extend:HI (reg:QI HARD_D_REGNUM))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6487 + ] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6488 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6489 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6490 +(define_split |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6491 + [(set (reg:HI HARD_D_REGNUM) (ashiftrt:HI (reg:HI HARD_D_REGNUM) (const_int 8)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6492 + "reload_completed" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6493 + [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6494 + (use (reg:HI HARD_D_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6495 + (set (reg:QI HARD_D_REGNUM) (reg:QI HARD_A_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6496 + (use (reg:QI HARD_D_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6497 + (set (reg:HI HARD_D_REGNUM) (sign_extend:HI (reg:QI HARD_D_REGNUM))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6498 + ] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6499 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6500 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6501 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6502 +; On the WPC hardware, there is a shift register that can be used |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6503 +; to compute (1<<n) efficiently in two instructions. Note that this |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6504 +; form only works when using -mint8 though, because C will promote |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6505 +; to 'int' when doing this operation. TODO : we need a 16-bit form too. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6506 +(define_insn "ashlqi3_wpc" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6507 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6508 + (ashift:QI (match_operand:QI 1 "immediate_operand" "I") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6509 + (match_operand:QI 2 "general_operand" "q")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6510 + "TARGET_WPC" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6511 + "st%2\t0x3FF7\;ld%0\t0x3FF7" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6512 + [(set_attr "length" "6")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6513 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6514 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6515 +; Internal instructions for shifting by a constant. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6516 +; Two forms are provided, one for QImode, one for HImode. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6517 +; These are always split into the above instructions |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6518 +; (except for QImode forms that directly match one of the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6519 +; above instructions, in which the condition will not |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6520 +; allow the splitter to match). |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6521 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6522 +(define_insn_and_split "<bit_code:bit_code_name>hi3_const" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6523 + [(set (match_operand:HI 0 "nonimmediate_operand" "=dm") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6524 + (bit_code:HI (match_operand:HI 1 "general_operand" "0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6525 + (match_operand:HI 2 "immediate_operand" "n")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6526 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6527 + "#" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6528 + "reload_completed" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6529 + [(const_int 0)] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6530 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6531 + m6809_split_shift (<bit_code:CODE>, operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6532 + DONE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6533 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6534 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6535 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6536 +(define_insn_and_split "<bit_code:bit_code_name>qi3_const" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6537 + [(set (match_operand:QI 0 "nonimmediate_operand" "=qm") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6538 + (bit_code:QI (match_operand:QI 1 "general_operand" "0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6539 + (match_operand:QI 2 "immediate_operand" "n")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6540 + "INTVAL (operands[2]) > 1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6541 + "#" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6542 + "&& reload_completed" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6543 + [(const_int 0)] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6544 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6545 + m6809_split_shift (<bit_code:CODE>, operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6546 + DONE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6547 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6548 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6549 +; Internal instructions for shifting by a nonconstant. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6550 +; These expand into complex assembly. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6551 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6552 +(define_insn "<bit_code:bit_code_name>hi3_reg" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6553 + [(set (match_operand:HI 0 "nonimmediate_operand" "=d") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6554 + (bit_code:HI (match_operand:HI 1 "general_operand" "0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6555 + (match_operand:HI 2 "nonimmediate_operand" "v")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6556 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6557 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6558 + m6809_output_shift_insn (<bit_code:CODE>, operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6559 + return ""; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6560 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6561 + [(set_attr "length" "20")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6562 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6563 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6564 +(define_insn "<bit_code:bit_code_name>qi3_reg" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6565 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6566 + (bit_code:QI (match_operand:QI 1 "general_operand" "0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6567 + (match_operand:QI 2 "nonimmediate_operand" "v")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6568 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6569 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6570 + m6809_output_shift_insn (<bit_code:CODE>, operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6571 + return ""; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6572 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6573 + [(set_attr "length" "16")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6574 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6575 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6576 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6577 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6578 +;;- Jumps and transfers |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6579 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6580 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6581 +;;; The casesi pattern is normally *not* defined; see 'tablejump' instead. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6582 +(define_expand "casesi" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6583 + [(match_operand:HI 0 "register_operand" "") ; index to jump on |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6584 + (match_operand:HI 1 "immediate_operand" "") ; lower bound |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6585 + (match_operand:HI 2 "immediate_operand" "") ; total range |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6586 + (match_operand 3 "" "") ; table label |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6587 + (match_operand 4 "" "")] ; out of range label |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6588 + "TARGET_BYTE_INT && TARGET_CASESI" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6589 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6590 + m6809_do_casesi (operands[0], operands[1], operands[2], |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6591 + operands[3], operands[4]); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6592 + DONE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6593 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6594 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6595 +(define_insn "tablejump_short_offset" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6596 + [(set (pc) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6597 + (mem:HI (plus:HI (match_operand:HI 1 "register_operand" "U") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6598 + (zero_extend:HI (match_operand:QI 0 "register_operand" "q")))))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6599 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6600 + "jmp\t[b,x]\t;tablejump_short_offset" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6601 + [(set_attr "length" "3")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6602 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6603 +(define_insn "tablejump_long_offset" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6604 + [(set (pc) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6605 + (mem:HI (plus:HI (match_operand:HI 1 "register_operand" "U") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6606 + (match_operand:HI 0 "register_operand" "d"))))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6607 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6608 + "jmp\t[d,x]\t;tablejump_long_offset" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6609 + [(set_attr "length" "3")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6610 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6611 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6612 + ;; A tablejump operation gives the address in operand 0, with the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6613 + ;; CODE_LABEL for the table in operand 1. The 'define_expand' |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6614 + ;; shows the arguments as GCC presents them. For a register |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6615 + ;; operand, the assembly code is straightforward. For a MEM, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6616 + ;; assumed to be a SYMBOL_REF, two forms are given, one normal |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6617 + ;; and one for PIC mode. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6618 + (define_expand "tablejump" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6619 + [(parallel [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6620 + (set (pc) (match_operand:HI 0 "" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6621 + (use (label_ref (match_operand 1 "" ""))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6622 + (clobber (match_scratch:HI 2 "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6623 + ])] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6624 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6625 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6626 + }) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6627 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6628 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6629 +(define_insn "*tablejump_reg" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6630 + [(parallel [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6631 + (set (pc) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6632 + (match_operand:HI 0 "register_operand" "a")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6633 + (use (label_ref (match_operand 1 "" ""))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6634 + (clobber (match_scratch:HI 2 "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6635 + ])] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6636 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6637 + "jmp\t,%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6638 + [(set_attr "length" "3")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6639 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6640 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6641 +(define_insn "*tablejump_symbol" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6642 + [(parallel [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6643 + (set (pc) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6644 + (mem:HI |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6645 + (plus:HI (match_operand:HI 0 "register_operand" "a") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6646 + (label_ref (match_operand 1 "" ""))))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6647 + (use (label_ref (match_dup 1))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6648 + (clobber (match_scratch:HI 2 "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6649 + ])] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6650 + "!flag_pic" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6651 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6652 + output_asm_insn ("jmp\t[%a1,%0]", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6653 + return ""; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6654 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6655 + [(set_attr "length" "4")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6656 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6657 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6658 +(define_insn "*tablejump_symbol_pic" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6659 + [(parallel [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6660 + (set (pc) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6661 + (mem:HI |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6662 + (plus:HI (match_operand:HI 0 "register_operand" "d") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6663 + (label_ref (match_operand 1 "" ""))))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6664 + (use (label_ref (match_dup 1))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6665 + (clobber (match_scratch:HI 2 "=&a")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6666 + ])] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6667 + "flag_pic" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6668 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6669 + output_asm_insn ("lea%2\t%a1,pcr", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6670 + output_asm_insn ("ld%0\t%0,%2", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6671 + output_asm_insn ("jmp\t%0,%2", operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6672 + return ""; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6673 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6674 + [(set_attr "length" "8")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6675 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6676 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6677 +(define_insn "indirect_jump" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6678 + [(set (pc) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6679 + (match_operand:HI 0 "register_operand" "a"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6680 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6681 + "jmp\t,%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6682 + [(set_attr "length" "3")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6683 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6684 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6685 +(define_insn "jump" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6686 + [(set (pc) (label_ref (match_operand 0 "" "")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6687 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6688 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6689 + return output_branch_insn ( LABEL_REF, operands, get_attr_length (insn)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6690 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6691 + [(set (attr "type") (const_string "branch"))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6692 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6693 +; Output assembly for a condition branch instruction. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6694 +(define_insn "*cond_branch" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6695 + [(set (pc) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6696 + (if_then_else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6697 + (match_operator 1 "comparison_operator" [(cc0) (const_int 0)]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6698 + (label_ref (match_operand 0 "" "")) (pc)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6699 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6700 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6701 + return output_branch_insn ( GET_CODE(operands[1]), |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6702 + operands, get_attr_length (insn)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6703 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6704 + [(set (attr "type") (const_string "cbranch"))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6705 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6706 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6707 +; Similar to above, but for a condition branch instruction that |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6708 +; had its operands reversed at some point. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6709 +(define_insn "*cond_branch_reverse" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6710 + [(set (pc) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6711 + (if_then_else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6712 + (match_operator 1 "comparison_operator" [(cc0) (const_int 0)]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6713 + (pc) (label_ref (match_operand 0 "" ""))))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6714 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6715 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6716 + return output_branch_insn ( reverse_condition (GET_CODE(operands[1])), |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6717 + operands, get_attr_length (insn)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6718 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6719 + [(set (attr "type") (const_string "cbranch"))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6720 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6721 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6722 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6723 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6724 +;;- Calls |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6725 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6726 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6727 +;; Generate a call instruction for a function that does not |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6728 +;; return a value. The expander is used during RTL generation. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6729 +;; The instructions below are used during matching; only one |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6730 +;; of them will be used, depending on the type of function |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6731 +;; being called. The different conditions are: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6732 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6733 +;; 1) far_functionp - is this a far function? Those need |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6734 +;; to be output as indirect calls through a far-function |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6735 +;; handler. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6736 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6737 +;; 2) noreturn_functionp - if the function does not return, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6738 +;; we can use a 'jmp' instead of a 'jsr' to call it. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6739 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6740 +;; 3) is PIC mode enabled? If so, we'll always use |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6741 +;; relative calls (lbsr or lbra). |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6742 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6743 +;; Note: not all combinations are fully supported, especially |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6744 +;; relating to PIC. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6745 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6746 +;; The 'bsr' instruction is never generated. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6747 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6748 +(define_expand "call" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6749 + [(call (match_operand:HI 0 "memory_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6750 + (match_operand:HI 1 "general_operand" ""))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6751 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6752 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6753 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6754 +(define_insn "*call_nopic_far" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6755 + [(call (match_operand:HI 0 "memory_operand" "m") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6756 + (match_operand:HI 1 "general_operand" "g"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6757 + "far_functionp (operands[0])" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6758 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6759 + output_far_call_insn (operands, 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6760 + return ""; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6761 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6762 + [(set_attr "length" "6")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6763 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6764 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6765 +; PIC forms come first, and should only match |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6766 +; (MEM (SYMBOL_REF)). Other MEM forms are treated as usual. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6767 +(define_insn "*call_pic" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6768 + [(call (mem:HI (match_operand:HI 0 "symbolic_operand" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6769 + (match_operand:HI 1 "general_operand" "g"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6770 + "flag_pic && !noreturn_functionp (operands[0])" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6771 + "lbsr\t%C0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6772 + [(set_attr "length" "4")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6773 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6774 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6775 +(define_insn "*call_nopic" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6776 + [(call (match_operand:HI 0 "memory_operand" "m") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6777 + (match_operand:HI 1 "general_operand" "g"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6778 + "!noreturn_functionp (operands[0])" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6779 + "jsr\t%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6780 + [(set_attr "length" "3") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6781 + (set (attr "cycles") (const_int JSR_EXTENDED_CYCLES))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6782 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6783 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6784 +(define_insn "*call_noreturn_pic" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6785 + [(call (mem:HI (match_operand:HI 0 "symbolic_operand" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6786 + (match_operand:HI 1 "general_operand" "g"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6787 + "flag_pic && noreturn_functionp (operands[0])" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6788 + "lbra\t%C0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6789 + [(set_attr "length" "4")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6790 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6791 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6792 +(define_insn "*call_noreturn_nopic" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6793 + [(call (match_operand:HI 0 "memory_operand" "m") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6794 + (match_operand:HI 1 "general_operand" "g"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6795 + "noreturn_functionp (operands[0])" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6796 + "jmp\t%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6797 + [(set_attr "length" "3")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6798 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6799 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6800 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6801 +;; Same as above, but for functions that do return a value. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6802 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6803 +(define_expand "call_value" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6804 + [(set (match_operand 0 "" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6805 + (call (match_operand:HI 1 "memory_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6806 + (match_operand:HI 2 "general_operand" "")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6807 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6808 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6809 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6810 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6811 +(define_insn "*call_value_far" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6812 + [(set (match_operand 0 "" "=gz") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6813 + (call (match_operand:HI 1 "memory_operand" "m") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6814 + (match_operand:HI 2 "general_operand" "g")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6815 + "far_functionp (operands[1])" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6816 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6817 + output_far_call_insn (operands, 1); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6818 + return ""; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6819 +} |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6820 + [(set_attr "length" "6")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6821 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6822 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6823 +(define_insn "*call_value_pic" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6824 + [(set (match_operand 0 "" "=gz") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6825 + (call (mem:HI (match_operand:HI 1 "symbolic_operand" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6826 + (match_operand:HI 2 "general_operand" "g")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6827 + "flag_pic" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6828 + "lbsr\t%C1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6829 + [(set_attr "length" "4")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6830 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6831 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6832 +(define_insn "*call_value_nopic" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6833 + [(set (match_operand 0 "" "=gz") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6834 + (call (match_operand:HI 1 "memory_operand" "m") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6835 + (match_operand:HI 2 "general_operand" "g")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6836 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6837 + "jsr\t%1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6838 + [(set_attr "length" "3") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6839 + (set (attr "cycles") (const_int JSR_EXTENDED_CYCLES))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6840 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6841 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6842 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6843 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6844 +;; How to generate an untyped call. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6845 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6846 +(define_expand "untyped_call" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6847 + [(parallel [(call (match_operand 0 "" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6848 + (const_int 0)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6849 + (match_operand 1 "" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6850 + (match_operand 2 "" "")])] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6851 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6852 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6853 + int i; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6854 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6855 + emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6856 + for (i=0; i < XVECLEN (operands[2], 0); i++) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6857 + { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6858 + rtx set = XVECEXP (operands[2], 0, i); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6859 + emit_move_insn (SET_DEST (set), SET_SRC (set)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6860 + } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6861 + emit_insn (gen_blockage ()); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6862 + DONE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6863 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6864 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6865 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6866 +(define_expand "sibcall" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6867 + [(parallel |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6868 + [(call (match_operand:HI 0 "memory_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6869 + (match_operand:HI 1 "immediate_operand" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6870 + (use (reg:HI HARD_PC_REGNUM))])] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6871 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6872 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6873 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6874 +(define_insn "*sibcall_1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6875 + [(parallel |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6876 + [(call (match_operand:HI 0 "memory_operand" "m") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6877 + (match_operand:HI 1 "immediate_operand" "i")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6878 + (use (reg:HI HARD_PC_REGNUM))])] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6879 + "SIBLING_CALL_P(insn)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6880 + "jmp\t%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6881 + [(set_attr "length" "4")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6882 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6883 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6884 +(define_expand "sibcall_value" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6885 + [(parallel |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6886 + [(set (match_operand 0 "" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6887 + (call (match_operand:HI 1 "memory_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6888 + (match_operand:HI 2 "immediate_operand" ""))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6889 + (use (reg:HI HARD_PC_REGNUM))])] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6890 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6891 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6892 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6893 +(define_insn "*sibcall_value_1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6894 + [(parallel |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6895 + [(set (match_operand 0 "" "=gz") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6896 + (call (match_operand:HI 1 "memory_operand" "m") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6897 + (match_operand:HI 2 "immediate_operand" "i"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6898 + (use (reg:HI HARD_PC_REGNUM))])] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6899 + "SIBLING_CALL_P(insn)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6900 + "jmp\t%1" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6901 + [(set_attr "length" "4")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6902 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6903 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6904 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6905 +;;- Function Entry and Exit |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6906 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6907 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6908 +;; On entry to a function, the stack frame looks as follows: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6909 +;; - return address (pushed by the caller) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6910 +;; - saved registers |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6911 +;; - local variable storage |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6912 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6913 +;; If the function does not modify the stack after that, then |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6914 +;; any of these can be accessed directly as an offset from |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6915 +;; STACK_POINTER_REGNUM. Otherwise, a frame pointer is required. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6916 +;; In that case, the prologue must also initialize HARD_FRAME_POINTER_REGNUM |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6917 +;; and all references to the stack frame will use that as a base instead. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6918 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6919 +(define_expand "prologue" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6920 + [(const_int 0)] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6921 + "prologue_epilogue_required ()" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6922 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6923 + emit_prologue_insns (); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6924 + DONE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6925 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6926 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6927 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6928 +;; The function epilogue does exactly the reverse of the prologue, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6929 +;; deallocating local variable space, restoring saved registers, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6930 +;; and returning. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6931 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6932 +;; For the 6809, the return may be 'rti' if the function was |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6933 +;; declared as an interrupt function, but is normally 'rts'. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6934 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6935 +;; Also, as an optimization, the register restore and the 'rts' |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6936 +;; can be combined into a single instruction, by adding 'PC' to the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6937 +;; list of registers to be restored. This is only done if there are |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6938 +;; any saved registers, as 'rts' is more efficient by itself. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6939 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6940 +(define_expand "epilogue" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6941 + [(const_int 0)] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6942 + "prologue_epilogue_required ()" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6943 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6944 + emit_epilogue_insns (false); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6945 + DONE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6946 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6947 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6948 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6949 +(define_expand "sibcall_epilogue" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6950 + [(const_int 0)] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6951 + "prologue_epilogue_required ()" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6952 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6953 + emit_epilogue_insns (true); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6954 + DONE; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6955 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6956 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6957 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6958 +;; The RTS instruction |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6959 +(define_insn "return_rts" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6960 + [(return) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6961 + (use (reg:HI HARD_PC_REGNUM))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6962 + "!m6809_current_function_has_type_attr_p (\"interrupt\") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6963 + && m6809_get_live_regs () == 0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6964 + "rts" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6965 + [(set_attr "length" "1") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6966 + (set (attr "cycles") (const_int RTS_CYCLES))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6967 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6968 +(define_insn "return_puls_pc" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6969 + [(return) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6970 + (use (reg:HI HARD_PC_REGNUM))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6971 + "!m6809_current_function_has_type_attr_p (\"interrupt\") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6972 + && m6809_get_live_regs () != 0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6973 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6974 + [(set_attr "length" "1") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6975 + (set (attr "cycles") (const_int RTS_CYCLES))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6976 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6977 +;; The RTI instruction |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6978 +(define_insn "return_rti" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6979 + [(return) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6980 + (use (reg:HI HARD_PC_REGNUM))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6981 + "m6809_current_function_has_type_attr_p (\"interrupt\")" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6982 + "rti" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6983 + [(set_attr "length" "1") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6984 + (set (attr "cycles") (const_int RTI_CYCLES))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6985 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6986 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6987 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6988 +;;- Unspecified instructions |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6989 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6990 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6991 +;; An instruction that has the effect of an unspec_volatile, but |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6992 +;; which doesn't require emitting any assembly code. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6993 +(define_insn "blockage" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6994 + [(unspec_volatile [(const_int 0)] UNSPEC_BLOCKAGE)] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6995 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6996 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6997 + [(set_attr "length" "0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6998 + (set (attr "cycles") (const_int 0))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6999 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7000 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7001 +;; Say how to push multiple registers onto the stack, using |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7002 +;; the 6809 'pshs' instruction. The operand is a regset |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7003 +;; specifying which registers to push. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7004 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7005 +;; The operand mode is not given intentionally, so as to allow |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7006 +;; any possible integer mode for the regset. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7007 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7008 +;; See below for a peephole that can combine consecutive push |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7009 +;; instructions that qualify for merging. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7010 +(define_insn "register_push" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7011 + [(use (reg:HI HARD_S_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7012 + (unspec_volatile |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7013 + [(match_operand 0 "immediate_operand" "")] UNSPEC_PUSH_RS) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7014 + (clobber (reg:HI HARD_S_REGNUM))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7015 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7016 + "pshs\t%R0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7017 + [(set_attr "length" "2") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7018 + (set (attr "cycles") (const_int PSH_PUL_CYCLES))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7019 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7020 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7021 +;; Say how to pop multiple registers from the stack, using |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7022 +;; the 6809 'puls' instruction. The operand is the register |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7023 +;; bitset value. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7024 +(define_insn "register_pop" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7025 + [(use (reg:HI HARD_S_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7026 + (unspec_volatile |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7027 + [(match_operand 0 "immediate_operand" "")] UNSPEC_POP_RS) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7028 + (clobber (reg:HI HARD_S_REGNUM))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7029 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7030 + "puls\t%R0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7031 + [(set_attr "length" "2") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7032 + (set (attr "cycles") (const_int PSH_PUL_CYCLES))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7033 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7034 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7035 +(define_insn "m6809_swi" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7036 + [(unspec_volatile |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7037 + [(match_operand:QI 0 "immediate_operand" "I,n")] UNSPEC_SWI)] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7038 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7039 + "@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7040 + swi |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7041 + swi%c0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7042 + [(set_attr "length" "1,2") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7043 + (set (attr "cycles") (const_int SWI_CYCLES))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7044 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7045 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7046 +;; Generate the CWAI instruction |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7047 +(define_insn "m6809_cwai" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7048 + [(unspec_volatile |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7049 + [(match_operand:QI 0 "immediate_operand" "")] UNSPEC_CWAI)] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7050 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7051 + "cwai\t%0" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7052 + [(set_attr "length" "2") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7053 + (set (attr "cycles") (const_int CWAI_CYCLES))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7054 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7055 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7056 +;; Generate the SYNC instruction |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7057 +(define_insn "m6809_sync" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7058 + [(unspec_volatile [(const_int 0)] UNSPEC_SYNC)] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7059 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7060 + "sync" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7061 + [(set_attr "length" "1") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7062 + (set (attr "cycles") (const_int SYNC_CYCLES))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7063 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7064 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7065 +;; Generate the NOP instruction |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7066 +(define_insn "nop" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7067 + [(const_int 0)] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7068 + "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7069 + "nop" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7070 + [(set_attr "length" "1") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7071 + (set (attr "cycles") (const_int NOP_CYCLES))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7072 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7073 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7074 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7075 +;;- Peepholes |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7076 +;;-------------------------------------------------------------------- |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7077 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7078 +;;; Each peephole has an ID that is used for debugging. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7079 +;;; Each peephole condition is bracketed by calls to |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7080 +;;; m6809_match_peephole2() also for debugging. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7081 +(define_constants [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7082 + (PEEP_END 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7083 + (PEEP_COND 1) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7084 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7085 + (PEEP_STACK_STORE_INC 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7086 + (PEEP_STACK_CLEAR_INC 1) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7087 + (PEEP_LSRB_ADCB 2) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7088 + (PEEP_ABX 3) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7089 + (PEEP_ABX2 4) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7090 + (PEEP_INDEXED_INC 5) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7091 + (PEEP_MEM_DEC 6) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7092 + (PEEP_MEM_INC 7) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7093 + (PEEP_MEM_DEC_CMP 8) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7094 + (PEEP_PUSH2 9) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7095 + (PEEP_STORE_IMPLIES_CC 10) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7096 + (PEEP_DEC_IMPLIES_CC 11) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7097 + (PEEP_LEAB 12) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7098 + (PEEP_LDX_INDIRECT 13) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7099 + (PEEP_POP_JUNK 14) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7100 +]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7101 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7102 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7103 +;;; Optimize 'leas -1,s' followed by 'stb ,s'. This can happen if the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7104 +;;; function prologue needs to allocate stack space and 'b' is placed |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7105 +;;; into that local right away. Combine the stack allocation with the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7106 +;;; store using preincrement mode. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7107 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7108 + [(set (reg:HI HARD_S_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7109 + (plus:HI (reg:HI HARD_S_REGNUM) (const_int -1))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7110 + (set (mem:QI (reg:HI HARD_S_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7111 + (match_operand:QI 0 "register_operand" ""))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7112 + "m6809_match_peephole2 (PEEP_STACK_STORE_INC, PEEP_END)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7113 + [(set (mem:QI (pre_dec:HI (reg:HI HARD_S_REGNUM))) (match_dup 0))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7114 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7115 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7116 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7117 +;;; Same as above, but for a 'clr ,s' that follows the prologue. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7118 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7119 + [(set (reg:HI HARD_S_REGNUM) (plus:HI (reg:HI HARD_S_REGNUM) (const_int -1))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7120 + (set (mem:QI (reg:HI HARD_S_REGNUM)) (const_int 0))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7121 + "m6809_match_peephole2 (PEEP_STACK_CLEAR_INC, PEEP_END)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7122 + [(set (mem:QI (pre_dec:HI (reg:HI HARD_S_REGNUM))) (const_int 0))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7123 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7124 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7125 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7126 +;;; Merge two consecutive push instructions into a single register_push. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7127 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7128 + [(set (match_operand 0 "push_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7129 + (match_operand 1 "register_operand" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7130 + (set (match_operand 2 "push_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7131 + (match_operand 3 "register_operand" ""))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7132 + "m6809_match_peephole2 (PEEP_PUSH2, PEEP_COND) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7133 + && reload_completed |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7134 + && GET_MODE (operands[1]) == GET_MODE (operands[3]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7135 + && m6809_can_merge_pushpop_p (UNSPEC_PUSH_RS, 1 << REGNO (operands[1]), 1 << REGNO (operands[3])) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7136 + && m6809_match_peephole2 (PEEP_PUSH2, PEEP_END)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7137 + [(parallel [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7138 + (use (reg:HI HARD_S_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7139 + (unspec_volatile [(match_dup 4)] UNSPEC_PUSH_RS) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7140 + (clobber (reg:HI HARD_S_REGNUM))]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7141 + (use (match_dup 1)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7142 + (use (match_dup 3))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7143 +{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7144 + operands[4] = gen_rtx_CONST_INT (QImode, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7145 + (1 << REGNO (operands[1])) | (1 << REGNO (operands[3]))); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7146 +}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7147 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7148 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7149 +;;; Convert 'stX ,--s' into a push instruction. Use the regset |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7150 +;;; notation, so that it may be combined with an adjacent regset. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7151 +;;; TBD - this doesn't compile some code cleanly. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7152 +;(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7153 +; [(set (mem:HI (pre_dec:HI (reg:HI HARD_S_REGNUM))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7154 +; (reg:HI HARD_X_REGNUM))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7155 +; "reload_completed" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7156 +; [(parallel [ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7157 +; (use (reg:HI HARD_S_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7158 +; (unspec_volatile [(match_dup 0)] UNSPEC_PUSH_RS) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7159 +; (clobber (reg:HI HARD_S_REGNUM))])] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7160 +;{ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7161 +; operands[0] = gen_rtx_CONST_INT (HImode, X_REGBIT); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7162 +;}) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7163 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7164 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7165 +;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7166 +;;; q = (q+1)/2 can be optimized as "lsrb; adcb". This also |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7167 +;;; won't overflow when q=0xFF. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7168 +;;; TODO : this form isn't accounting for promotion when |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7169 +;;; using 16-bit ints. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7170 +;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7171 +(define_peephole |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7172 + [(set (reg:QI HARD_D_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7173 + (lshiftrt:QI (plus:HI (match_dup 0) (const_int 1)) (const_int 1)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7174 + "m6809_match_peephole2 (PEEP_LSRB_ADCB, PEEP_END)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7175 + "lsrb\;adcb\t#0; peephole" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7176 + [(set_attr "length" "2")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7177 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7178 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7179 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7180 +;; Optimize the case of following a register store with a test |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7181 +;; of reg or mem just moved. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7182 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7183 +(define_peephole |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7184 + [(set (match_operand:HI 0 "memory_operand" "=m") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7185 + (match_operand:HI 1 "register_operand" "r")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7186 + (set (cc0) (match_operand:HI 2 "general_operand" "g"))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7187 + "m6809_match_peephole2 (PEEP_STORE_IMPLIES_CC, PEEP_COND) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7188 + && (operands[2] == operands[0] || operands[2] == operands[1]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7189 + && m6809_match_peephole2 (PEEP_STORE_IMPLIES_CC, PEEP_END)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7190 + "st%1\t%0\t;movhi: R:%1 -> %0 w/ implied test of %2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7191 + [(set_attr "length" "4")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7192 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7193 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7194 +;; Optimize a pair of SET instructions in which the second insn |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7195 +;; is the reverse of the first one. I.e. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7196 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7197 +;; A = B |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7198 +;; ----> A = B |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7199 +;; B = A |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7200 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7201 +;; The second insn is redundant. Define two patterns, one for QI, one for HI. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7202 +;; But don't do this if either is a VOLATILE MEM. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7203 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7204 + [(set (match_operand:HI 0 "nonimmediate_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7205 + (match_operand:HI 1 "nonimmediate_operand" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7206 + (set (match_dup 1) (match_dup 0))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7207 + "!MEM_P (operands[0]) || !MEM_P (operands[1]) || (!MEM_VOLATILE_P (operands[0]) && !MEM_VOLATILE_P (operands[1]))" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7208 + [(set (match_dup 0) (match_dup 1))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7209 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7210 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7211 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7212 + [(set (match_operand:QI 0 "nonimmediate_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7213 + (match_operand:QI 1 "nonimmediate_operand" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7214 + (set (match_dup 1) (match_dup 0))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7215 + "!MEM_P (operands[0]) || !MEM_P (operands[1]) || (!MEM_VOLATILE_P (operands[0]) && !MEM_VOLATILE_P (operands[1]))" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7216 + [(set (match_dup 0) (match_dup 1))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7217 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7218 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7219 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7220 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7221 +;; Optimize the sum of an 8-bit and 16-bit using the 'abx' instruction |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7222 +;; if B and X can be used. Two patterns are provided to catch both |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7223 +;; X=X+D and X=D+X. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7224 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7225 +(define_peephole |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7226 + [(set (reg:HI HARD_D_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7227 + (zero_extend:HI (match_operand:QI 0 "general_operand" "q"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7228 + (set (reg:HI HARD_X_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7229 + (plus:HI (reg:HI HARD_D_REGNUM) (reg:HI HARD_X_REGNUM)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7230 + "m6809_match_peephole2 (PEEP_ABX, PEEP_END)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7231 + "abx" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7232 + [(set_attr "length" "1")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7233 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7234 +(define_peephole |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7235 + [(set (reg:HI HARD_D_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7236 + (zero_extend:HI (match_operand:QI 0 "general_operand" "q"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7237 + (set (reg:HI HARD_X_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7238 + (plus:HI (reg:HI HARD_X_REGNUM) (reg:HI HARD_D_REGNUM)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7239 + "m6809_match_peephole2 (PEEP_ABX, PEEP_END)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7240 + "abx" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7241 + [(set_attr "length" "1")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7242 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7243 +;;; Likewise, handle when B is scaled by 2 prior to the add. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7244 +;;; Instead of shifting B in 4 cycles, just do the ABX a second |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7245 +;;; time, in only 3 cycles. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7246 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7247 +(define_peephole |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7248 + [(set (reg:HI HARD_D_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7249 + (zero_extend:HI (match_operand:QI 0 "general_operand" "q"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7250 + (set (reg:HI HARD_D_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7251 + (ashift:HI (reg:HI HARD_D_REGNUM) (const_int 1))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7252 + (set (reg:HI HARD_X_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7253 + (plus:HI (reg:HI HARD_D_REGNUM) (reg:HI HARD_X_REGNUM)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7254 + "m6809_match_peephole2 (PEEP_ABX2, PEEP_END)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7255 + "abx\;abx" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7256 + [(set_attr "length" "2")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7257 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7258 +(define_peephole |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7259 + [(set (reg:HI HARD_D_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7260 + (zero_extend:HI (match_operand:QI 0 "general_operand" "q"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7261 + (set (reg:HI HARD_D_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7262 + (ashift:HI (reg:HI HARD_D_REGNUM) (const_int 1))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7263 + (set (reg:HI HARD_X_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7264 + (plus:HI (reg:HI HARD_X_REGNUM) (reg:HI HARD_D_REGNUM)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7265 + "m6809_match_peephole2 (PEEP_ABX2, PEEP_END)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7266 + "abx\;abx" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7267 + [(set_attr "length" "2")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7268 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7269 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7270 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7271 +;; Work around a compiler bug that generates bad code when copying |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7272 +;; between 32-bit memory addresses after a libcall. The problem seen is |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7273 +;; that the source is MEM (REG X), but X is used as the reload register. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7274 +;; The second half of the copy therefore fails. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7275 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7276 +;; The solution is to switch the reload register to D, since that is guaranteed |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7277 +;; not to be in use right after a libcall. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7278 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7279 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7280 + [(set (reg:HI HARD_X_REGNUM) (mem:HI (reg:HI HARD_X_REGNUM))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7281 + (set (match_operand:HI 0 "nonimmediate_operand" "") (reg:HI HARD_X_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7282 + (set (reg:HI HARD_X_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7283 + (mem:HI (plus:HI (reg:HI HARD_X_REGNUM) (const_int 2)))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7284 + (set (match_operand:HI 1 "nonimmediate_operand" "") (reg:HI HARD_X_REGNUM))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7285 + "reload_completed" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7286 + [(set (reg:HI HARD_D_REGNUM) (mem:HI (reg:HI HARD_X_REGNUM))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7287 + (set (match_dup 0) (reg:HI HARD_D_REGNUM)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7288 + (set (reg:HI HARD_X_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7289 + (mem:HI (plus:HI (reg:HI HARD_X_REGNUM) (const_int 2)))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7290 + (set (match_dup 1) (reg:HI HARD_X_REGNUM))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7291 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7292 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7293 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7294 +;; Turn "and then test" into a "bit test" operation. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7295 +;; Provide variants for immediate and memory sources |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7296 +;; This is the most used peephople. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7297 +; (define_peephole |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7298 +; [(set (match_operand:QI 0 "register_operand" "=q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7299 +; (and:QI (match_operand:QI 1 "register_operand" "0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7300 +; (match_operand:QI 2 "immediate_operand" "i"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7301 +; (set (cc0) (match_dup 0))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7302 +; "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7303 +; "bit%0\t%2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7304 +; [(set_attr "length" "3")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7305 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7306 +; (define_peephole |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7307 +; [(set (match_operand:QI 0 "register_operand" "=q") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7308 +; (and:QI (match_operand:QI 1 "register_operand" "0") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7309 +; (match_operand:QI 2 "memory_operand" "m"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7310 +; (set (cc0) (match_dup 0))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7311 +; "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7312 +; "bit%0\t%2" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7313 +; [(set_attr "length" "4")]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7314 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7315 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7316 +;; Turn a "decrement, then test" sequence into just a "decrement". |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7317 +;; The test can be omitted, since it is implicitly done. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7318 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7319 + [(set (match_operand:QI 0 "nonimmediate_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7320 + (plus:QI (match_operand:QI 1 "whole_general_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7321 + (match_operand:QI 2 "immediate_operand" ""))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7322 + (set (cc0) (match_dup 0))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7323 + "m6809_match_peephole2 (PEEP_DEC_IMPLIES_CC, PEEP_END)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7324 + [(set (match_dup 0) (plus:QI (match_dup 1) (match_dup 2)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7325 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7326 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7327 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7328 +;; Merge an indexed register increment with a previous usage. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7329 +;; This is usually done automatically, but not always |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7330 +;; The 'use' should be optional; in all cases where this has been |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7331 +;; seen, it is required though. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7332 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7333 + [(set (match_operand:QI 0 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7334 + (mem:QI (match_operand:HI 1 "index_register_operand" ""))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7335 + (use (match_dup 0)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7336 + (set (match_dup 1) (plus:HI (match_dup 1) (const_int 1)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7337 + "m6809_match_peephole2 (PEEP_INDEXED_INC, PEEP_END)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7338 + [(set (match_dup 0) (mem:QI (post_inc:HI (match_dup 1)))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7339 + (use (match_dup 0))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7340 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7341 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7342 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7343 +;;; Merge "ldX MEM; ldX ,X" into a single instruction using |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7344 +;;; the indirect mode. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7345 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7346 + [(set (reg:HI HARD_X_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7347 + (mem:HI (match_operand:HI 0 "general_operand" ""))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7348 + (set (reg:HI HARD_X_REGNUM) (mem:HI (reg:HI HARD_X_REGNUM)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7349 + "reload_completed && m6809_match_peephole2 (PEEP_LDX_INDIRECT, PEEP_END)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7350 + [(set (reg:HI HARD_X_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7351 + (mem:HI (mem:HI (match_dup 0))))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7352 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7353 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7354 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7355 +;;; Reorder a store followed by a unary operation on that memory |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7356 +;;; so that the unary is performed and then the store. Consider |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7357 +;;; a binary shift operation, which will be decomposed into |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7358 +;;; identical single shifts, also. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7359 +;;; TODO - recognize more than just 'ashift' here. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7360 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7361 + [(set (match_operand:QI 0 "memory_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7362 + (match_operand:QI 1 "register_operand" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7363 + (set (match_dup 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7364 + (ashift:QI (match_dup 0) (match_operand:QI 2 "immediate_operand")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7365 + "reload_completed" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7366 + [(set (match_dup 1) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7367 + (ashift:QI (match_dup 1) (match_operand:QI 2 "immediate_operand"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7368 + (set (match_dup 0) (match_dup 1))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7369 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7370 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7371 +;;; Likewise, reorder a unary MEM followed by a load, so that the load |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7372 +;;; is done first, then use the REG instead of the MEM. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7373 +;;;(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7374 +;;; [(set (match_dup 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7375 +;;; (ashift:QI (match_dup 0) (match_operand:QI 2 "immediate_operand"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7376 +;;; (set (match_operand:QI 0 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7377 +;;; (match_operand:QI 1 "memory_operand" ""))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7378 +;;; "reload_completed" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7379 +;;; [(set (match_dup 0) (match_dup 1)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7380 +;;; (set (match_dup 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7381 +;;; (ashift:QI (match_dup 0) (match_operand:QI 2 "immediate_operand")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7382 +;;; "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7383 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7384 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7385 +;;; Replace sex; leaX d,Y with leaX b,Y. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7386 +;;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7387 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7388 + [(set (reg:HI HARD_D_REGNUM) (sign_extend:HI (reg:QI HARD_D_REGNUM))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7389 + (set (match_operand:HI 0 "index_register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7390 + (plus:HI (match_operand:HI 1 "index_register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7391 + (reg:HI HARD_D_REGNUM)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7392 + "reload_completed && m6809_match_peephole2 (PEEP_LEAB, PEEP_END)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7393 + [(set (match_dup 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7394 + (plus:HI (match_dup 1) (reg:QI HARD_D_REGNUM)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7395 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7396 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7397 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7398 + [(set (reg:HI HARD_D_REGNUM) (sign_extend:HI (reg:QI HARD_D_REGNUM))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7399 + (set (match_operand:HI 0 "index_register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7400 + (plus:HI (reg:HI HARD_D_REGNUM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7401 + (match_operand:HI 1 "index_register_operand" "")))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7402 + "reload_completed && m6809_match_peephole2 (PEEP_LEAB, PEEP_END)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7403 + [(set (match_dup 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7404 + (plus:HI (match_dup 1) (reg:QI HARD_D_REGNUM)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7405 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7406 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7407 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7408 +;;; Replace ldb; decb; stb; tstb with dec(mem). If the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7409 +;;; register is not needed, then the load will get deleted |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7410 +;;; automatically, but it may be needed for comparisons. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7411 +;;; Same for incb/inc. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7412 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7413 + [(set (match_operand:QI 0 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7414 + (match_operand:QI 1 "nonimmediate_operand" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7415 + (set (match_dup 0) (plus:QI (match_dup 0) (const_int -1))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7416 + (set (match_dup 1) (match_dup 0)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7417 + (set (cc0) (match_dup 0))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7418 + "m6809_match_peephole2 (PEEP_MEM_DEC_CMP, PEEP_END)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7419 + [(set (match_dup 1) (plus:QI (match_dup 1) (const_int -1)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7420 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7421 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7422 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7423 +;;; Replace ldb; decb; stb with dec(mem); ldb. If the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7424 +;;; register is not needed, then the load will get deleted |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7425 +;;; automatically, but it may be needed for comparisons. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7426 +;;; Same for incb/inc. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7427 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7428 + [(set (match_operand:QI 0 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7429 + (match_operand:QI 1 "nonimmediate_operand" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7430 + (set (match_dup 0) (plus:QI (match_dup 0) (const_int -1))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7431 + (set (match_dup 1) (match_dup 0))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7432 + "m6809_match_peephole2 (PEEP_MEM_DEC, PEEP_END)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7433 + [(set (match_dup 1) (plus:QI (match_dup 1) (const_int -1))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7434 + (set (match_dup 0) (match_dup 1))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7435 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7436 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7437 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7438 + [(set (match_operand:QI 0 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7439 + (match_operand:QI 1 "nonimmediate_operand" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7440 + (set (match_dup 0) (plus:QI (match_dup 0) (const_int 1))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7441 + (set (match_dup 1) (match_dup 0))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7442 + "m6809_match_peephole2 (PEEP_MEM_INC, PEEP_END)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7443 + [(set (match_dup 1) (plus:QI (match_dup 1) (const_int 1))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7444 + (set (match_dup 0) (match_dup 1))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7445 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7446 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7447 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7448 +;;; Replace "andb #N; cmpb #N; bhi" with "andb #N", if it can be proven |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7449 +;;; that the branch can never occur because of the limited range of B. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7450 +;;; N must be a power of two for this to make sense. This helps with |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7451 +;;; the default cases of switch statements on a value (x & N). |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7452 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7453 + [(set (match_operand:QI 0 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7454 + (and:QI (match_dup 0) (match_operand:QI 1 "immediate_operand" ""))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7455 + (set (cc0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7456 + (compare (match_dup 0) (match_dup 1))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7457 + (set (pc) (if_then_else (gtu (cc0) (const_int 0)) (match_operand 2 "" "") (match_operand 3 "" ""))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7458 + ] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7459 + "reload_completed && power_of_two_p (INTVAL (operands[1]) + 1)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7460 + [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7461 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7462 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7463 +;;; Replace ldd <mem>; addd #1; std <mem> with 16-bit increment |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7464 +;;; of the mem, but only if D is dead. Same for 16-bit decrement. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7465 +;;; <mem> must be offsettable for the instruction to match. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7466 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7467 + [(set (match_operand:HI 0 "register_operand" "") (match_operand:HI 1 "memory_operand" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7468 + (set (match_dup 0) (plus:HI (match_dup 0) (const_int 1))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7469 + (set (match_dup 1) (match_dup 0))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7470 + "reload_completed |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7471 + && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7472 + && peep2_reg_dead_p (3, operands[0])" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7473 + [(set (match_dup 1) (plus:HI (match_dup 1) (const_int 1)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7474 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7475 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7476 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7477 + [(set (match_operand:HI 0 "register_operand" "") (match_operand:HI 1 "memory_operand" "")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7478 + (set (match_dup 0) (plus:HI (match_dup 0) (const_int -1))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7479 + (set (match_dup 1) (match_dup 0))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7480 + "reload_completed |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7481 + && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7482 + && peep2_reg_dead_p (3, operands[0])" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7483 + [(set (match_dup 1) (plus:HI (match_dup 1) (const_int -1)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7484 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7485 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7486 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7487 +;;; Replace a load or store using an indexed register, followed by an increment of that |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7488 +;;; register, with the combined form using autoincrement. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7489 +(define_peephole2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7490 + [(set (match_operand:QI 0 "register_operand" "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7491 + (mem:QI (match_operand:HI 1 "index_register_operand" ""))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7492 + (set (match_dup 1) (plus:HI (match_dup 1) (const_int 1)))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7493 + "reload_completed" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7494 + [(set (match_dup 0) (mem:QI (post_inc (match_dup 1))))] |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7495 + "") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7496 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7497 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7498 +;;- mode:emacs-lisp |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7499 +;;- comment-start: ";;- " |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7500 +;;- eval: (set-syntax-table (copy-sequence (syntax-table))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7501 +;;- eval: (modify-syntax-entry ?[ "(]") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7502 +;;- eval: (modify-syntax-entry ?] ")[") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7503 +;;- eval: (modify-syntax-entry ?{ "(}") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7504 +;;- eval: (modify-syntax-entry ?} "){") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7505 +;-; vim: set ts=2: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7506 +;-; vim: set expandtab: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7507 +;-; vim: set filetype=lisp: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7508 +;;- End: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7509 diff -urN gcc-4.6.4-clean/gcc/config/m6809/m6809.opt gcc-4.6.4/gcc/config/m6809/m6809.opt |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7510 --- gcc-4.6.4-clean/gcc/config/m6809/m6809.opt 1969-12-31 17:00:00.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7511 +++ gcc-4.6.4/gcc/config/m6809/m6809.opt 2015-07-20 19:44:52.770843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7512 @@ -0,0 +1,98 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7513 +; Options for the M6809 port of the compiler |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7514 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7515 +; Copyright (C) 2005 Free Software Foundation, Inc. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7516 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7517 +; This file is part of GCC. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7518 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7519 +; GCC is free software; you can redistribute it and/or modify it under |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7520 +; the terms of the GNU General Public License as published by the Free |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7521 +; Software Foundation; either version 2, or (at your option) any later |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7522 +; version. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7523 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7524 +; GCC is distributed in the hope that it will be useful, but WITHOUT |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7525 +; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7526 +; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7527 +; License for more details. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7528 +; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7529 +; You should have received a copy of the GNU General Public License |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7530 +; along with GCC; see the file COPYING. If not, write to the Free |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7531 +; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7532 +; 02110-1301, USA. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7533 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7534 +margcount |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7535 +Target Mask(ARGCOUNT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7536 +Push argument count |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7537 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7538 +mint8 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7539 +Target RejectNegative Mask(BYTE_INT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7540 +Use 8-bit integers |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7541 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7542 +mint16 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7543 +Target RejectNegative |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7544 +Use 16-bit integers InverseMask(BYTE_INT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7545 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7546 +mreg-args |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7547 +Target Mask(REG_ARGS) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7548 +Use registers for function arguments |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7549 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7550 +mshort_size |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7551 +Target RejectNegative Mask(SMALL_SIZE_T) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7552 +Use 8-bit size_t |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7553 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7554 +mlong_size |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7555 +Target RejectNegative InverseMask(SMALL_SIZE_T) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7556 +Use 16-bit size_t |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7557 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7558 +mdirect |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7559 +Target Mask(DIRECT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7560 +Enable direct addressing |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7561 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7562 +mwpc |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7563 +Target RejectNegative Mask(WPC) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7564 +Enable WPC platform extensions |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7565 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7566 +mexperiment |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7567 +Target RejectNegative Mask(EXPERIMENT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7568 +Enable current experimental feature |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7569 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7570 +m6309 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7571 +Target RejectNegative Mask(6309) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7572 +Enable Hitachi 6309 extensions |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7573 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7574 +mcasesi |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7575 +Target RejectNegative Mask(CASESI) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7576 +Enable the casesi pattern |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7577 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7578 +mfar-code-page= |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7579 +Target RejectNegative Joined Var(far_code_page_option) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7580 +Sets the far code page value for this compilation unit |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7581 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7582 +mcode-section= |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7583 +Target RejectNegative Joined Var(code_section_ptr) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7584 +Sets the name of the section for code |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7585 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7586 +mdata-section= |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7587 +Target RejectNegative Joined Var(data_section_ptr) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7588 +Sets the name of the section for initialized data |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7589 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7590 +mbss-section= |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7591 +Target RejectNegative Joined Var(bss_section_ptr) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7592 +Sets the name of the section for uninitialized data |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7593 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7594 +mabi_version= |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7595 +Target RejectNegative Joined Var(m6809_abi_version_ptr) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7596 +Sets the calling convention |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7597 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7598 +msoft-reg-count= |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7599 +Target RejectNegative Joined Var(m6809_soft_reg_count) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7600 +Sets the number of soft registers that can be used |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7601 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7602 +mdret |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7603 +Target RejectNegative Mask(DRET) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7604 +Put function call results in D, not X |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7605 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7606 +mfar-stack-param |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7607 +Target Mask(FAR_STACK_PARAM) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7608 +Enable stack parameters to a farcall |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7609 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7610 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7611 diff -urN gcc-4.6.4-clean/gcc/config/m6809/m6809-protos.h gcc-4.6.4/gcc/config/m6809/m6809-protos.h |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7612 --- gcc-4.6.4-clean/gcc/config/m6809/m6809-protos.h 1969-12-31 17:00:00.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7613 +++ gcc-4.6.4/gcc/config/m6809/m6809-protos.h 2015-07-20 19:44:52.770843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7614 @@ -0,0 +1,94 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7615 +/* GCC for 6809 : machine-specific function prototypes |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7616 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7617 +This file is part of GCC. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7618 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7619 +GCC is free software; you can redistribute it and/or modify |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7620 +it under the terms of the GNU General Public License as published by |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7621 +the Free Software Foundation; either version 3, or (at your option) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7622 +any later version. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7623 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7624 +GCC is distributed in the hope that it will be useful, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7625 +but WITHOUT ANY WARRANTY; without even the implied warranty of |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7626 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7627 +GNU General Public License for more details. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7628 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7629 +You should have received a copy of the GNU General Public License |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7630 +along with GCC; see the file COPYING3. If not see |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7631 +<http://www.gnu.org/licenses/>. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7632 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7633 +#ifndef __M6809_PROTOS_H__ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7634 +#define __M6809_PROTOS_H__ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7635 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7636 +void print_options (FILE *file); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7637 +void m6809_cpu_cpp_builtins (void); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7638 +void m6809_override_options (void); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7639 +void m6809_init_builtins (void); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7640 +unsigned int m6809_get_live_regs (void); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7641 +const char * m6809_get_regs_printable (unsigned int regs); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7642 +unsigned int m6809_get_regs_size (unsigned int regs); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7643 +int m6809_function_has_type_attr_p (tree decl, const char *); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7644 +int m6809_current_function_has_type_attr_p (const char *); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7645 +int prologue_epilogue_required (void); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7646 +int noreturn_functionp (rtx x); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7647 +void output_function_prologue (FILE *file, int size); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7648 +void output_function_epilogue (FILE *file, int size); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7649 +int check_float_value (enum machine_mode mode, double *d, int overflow); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7650 +void m6809_asm_named_section (const char *name, unsigned int flags, tree decl); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7651 +void m6809_asm_file_start (void); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7652 +void m6809_output_ascii (FILE *fp, const char *str, unsigned long size); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7653 +void m6809_declare_function_name (FILE *asm_out_file, const char *name, tree decl); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7654 +void m6809_reorg (void); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7655 +int m6809_current_function_is_void (void); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7656 +int m6809_can_merge_pushpop_p (int op, int regs1, int regs2); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7657 +int m6809_function_value_regno_p (unsigned int regno); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7658 +void emit_prologue_insns (void); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7659 +void emit_epilogue_insns (bool); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7660 +void m6809_conditional_register_usage (void); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7661 +void m6809_output_quoted_string (FILE *asm_file, const char *string); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7662 +int m6809_match_peephole2 (unsigned int peephole_id, unsigned int stage); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7663 +int m6809_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7664 +int power_of_two_p (unsigned int n); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7665 +void m6809_do_casesi (rtx index, rtx lower_bound, rtx range, rtx table_label, rtx default_label); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7666 +void m6809_output_addsi3 (int rtx_code, rtx *operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7667 +rtx m6809_function_arg_on_stack (CUMULATIVE_ARGS *cump); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7668 +void expand_constant_shift (int code, rtx dst, rtx src, rtx count); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7669 +int m6809_single_operand_operator (rtx exp); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7670 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7671 +#ifdef TREE_CODE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7672 +int m6809_init_cumulative_args (CUMULATIVE_ARGS cum, tree fntype, rtx libname); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7673 +#endif /* TREE_CODE */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7674 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7675 +#ifdef RTX_CODE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7676 +void print_direct_prefix (FILE *file, rtx addr); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7677 +void print_operand (FILE *file, rtx x, int code); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7678 +void print_operand_address (FILE *file, rtx addr); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7679 +void notice_update_cc (rtx exp, rtx insn); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7680 +enum reg_class m6809_preferred_reload_class (rtx x, enum reg_class regclass); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7681 +rtx gen_rtx_const_high (rtx r); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7682 +rtx gen_rtx_const_low (rtx r); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7683 +rtx gen_rtx_register_pushpop (int pop_flag, int regs); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7684 +void emit_libcall_insns (enum machine_mode mode, const char *name, rtx *operands, int count); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7685 +const char * output_branch_insn (enum rtx_code code, rtx *operands, int length); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7686 +void output_far_call_insn (rtx *operands, int has_return); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7687 +void m6809_initialize_trampoline (rtx tramp, tree fndecl, rtx cxt); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7688 +rtx m6809_expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, int ignore); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7689 +const char * far_functionp (rtx x); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7690 +rtx m6809_function_value (const tree valtype, const tree func); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7691 +void m6809_output_shift_insn (int rtx_code, rtx *operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7692 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7693 +const char * m6809_get_decl_bank (tree decl); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7694 +void output_branch_insn1 (const char *opcode, rtx *operands, int long_p); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7695 +rtx m6809_builtin_operand (tree arglist, enum machine_mode mode, int opnum); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7696 +const char * far_function_type_p (tree type); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7697 +void m6809_asm_trampoline_template(FILE *f); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7698 +bool m6809_frame_pointer_required (void); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7699 +int m6809_can_eliminate (int from, int to); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7700 +int m6809_initial_elimination_offset (int from, int to); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7701 +void m6809_emit_move_insn (rtx dst, rtx src); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7702 +void m6809_split_shift (enum rtx_code code, rtx *operands); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7703 +bool m6809_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7704 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7705 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7706 +#endif /* RTX_CODE */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7707 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7708 +#endif /* __M6809_PROTOS_H__ */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7709 diff -urN gcc-4.6.4-clean/gcc/config/m6809/predicates.md gcc-4.6.4/gcc/config/m6809/predicates.md |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7710 --- gcc-4.6.4-clean/gcc/config/m6809/predicates.md 1969-12-31 17:00:00.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7711 +++ gcc-4.6.4/gcc/config/m6809/predicates.md 2015-07-20 19:44:52.770843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7712 @@ -0,0 +1,78 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7713 +;; Predicate definitions for Motorola 6809 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7714 +;; Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7715 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7716 +;; This file is part of GCC. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7717 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7718 +;; GCC is free software; you can redistribute it and/or modify |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7719 +;; it under the terms of the GNU General Public License as published by |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7720 +;; the Free Software Foundation; either version 3, or (at your option) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7721 +;; any later version. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7722 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7723 +;; GCC is distributed in the hope that it will be useful, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7724 +;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7725 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7726 +;; GNU General Public License for more details. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7727 +;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7728 +;; You should have received a copy of the GNU General Public License |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7729 +;; along with GCC; see the file COPYING3. If not see |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7730 +;; <http://www.gnu.org/licenses/>. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7731 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7732 +;; whole_register_operand is like register_operand, but it |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7733 +;; does not allow SUBREGs. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7734 +(define_predicate "whole_register_operand" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7735 + (and (match_code "reg") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7736 + (match_operand 0 "register_operand"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7737 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7738 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7739 +;; A predicate that matches any index register. This can be used in nameless |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7740 +;; patterns and peepholes which need a 16-bit reg, but not D. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7741 +(define_predicate "index_register_operand" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7742 + (and (match_code "reg") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7743 + (match_test "REGNO (op) == HARD_X_REGNUM || REGNO (op) == HARD_Y_REGNUM || REGNO (op) == HARD_U_REGNUM"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7744 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7745 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7746 +;; match only X |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7747 +(define_predicate "register_operand_x" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7748 + (and (match_code "reg") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7749 + (match_test "REGNO (op) == HARD_X_REGNUM"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7750 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7751 +;; match only D |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7752 +(define_predicate "register_operand_d" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7753 + (and (match_code "reg") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7754 + (match_test "REGNO (op) == HARD_D_REGNUM"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7755 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7756 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7757 +;; Likwise, a replacement for general_operand which excludes |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7758 +;; SUBREGs. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7759 +(define_predicate "whole_general_operand" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7760 + (and (match_code "const_int,const_double,const,symbol_ref,label_ref,reg,mem") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7761 + (match_operand 0 "general_operand"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7762 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7763 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7764 +(define_predicate "add_general_operand" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7765 + (and (match_code "const_int,const_double,const,symbol_ref,label_ref,reg,mem") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7766 + (match_operand 0 "general_operand") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7767 + (match_test "REGNO (op) != SOFT_AP_REGNUM"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7768 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7769 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7770 +(define_predicate "shift_count_operand" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7771 + (and (match_code "const_int") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7772 + (and (match_operand 0 "const_int_operand") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7773 + (match_test "INTVAL (op) == 1 || INTVAL (op) == 8")))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7774 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7775 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7776 +;; A predicate that matches any bitwise logical operator. This |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7777 +;; allows for a single RTL pattern to be used for multiple operations. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7778 +(define_predicate "logical_bit_operator" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7779 + (ior (match_code "and") (match_code "ior") (match_code "xor"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7780 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7781 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7782 +;; A predicate that matches any shift or rotate operator. This |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7783 +;; allows for a single RTL pattern to be used for multiple operations. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7784 +(define_predicate "shift_rotate_operator" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7785 + (ior (match_code "ashift") (match_code "ashiftrt") (match_code "lshiftrt") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7786 + (match_code "rotate") (match_code "rotatert"))) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7787 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7788 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7789 +(define_predicate "symbolic_operand" (match_code "symbol_ref")) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7790 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7791 diff -urN gcc-4.6.4-clean/gcc/config/m6809/t-coco gcc-4.6.4/gcc/config/m6809/t-coco |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7792 --- gcc-4.6.4-clean/gcc/config/m6809/t-coco 1969-12-31 17:00:00.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7793 +++ gcc-4.6.4/gcc/config/m6809/t-coco 2015-07-20 19:44:52.770843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7794 @@ -0,0 +1,6 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7795 +# For a few minor differences in code generation on the CoCo... |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7796 +T_CFLAGS = -DTARGET_COCO |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7797 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7798 +# For doing the startup differently on the CoCo... |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7799 +CRT0STUFF_T_CFLAGS += -Wa,--globalize-symbols -DTARGET_COCO |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7800 +# vim: set filetype=make: |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7801 diff -urN gcc-4.6.4-clean/gcc/config/m6809/t-m6809 gcc-4.6.4/gcc/config/m6809/t-m6809 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7802 --- gcc-4.6.4-clean/gcc/config/m6809/t-m6809 1969-12-31 17:00:00.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7803 +++ gcc-4.6.4/gcc/config/m6809/t-m6809 2015-07-20 19:44:52.770843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7804 @@ -0,0 +1,64 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7805 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7806 +# ranlib doesn't exist, so define it to 'true' to make it a no-op |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7807 +RANLIB_FOR_TARGET = true |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7808 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7809 +# Stubs for libgcc defined by m6809 are here |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7810 +LIB1ASMSRC = m6809/libgcc1.s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7811 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7812 +# Here are the functions that are implemented within libgcc1.s |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7813 +LIB1ASMFUNCS = _mulhi3 _divhi3 _modhi3 _udivhi3 _umodhi3 \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7814 + _euclid _seuclid _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _softregs \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7815 + _ashlhi3 _ashrhi3 _lshrhi3 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7816 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7817 +# Flags to use when building libgcc. IN_GCC does not seem necessary, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7818 +# although the compile breaks without it. -DDF=SF is required to set |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7819 +# the size of "double" to the same as the size of a "float". |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7820 +TARGET_LIBGCC2_CFLAGS =-DIN_GCC -Dinhibit_libc -DDF=SF -DLIBGCC2_HAS_SF_MODE=0 -DLIBGCC2_HAS_DF_MODE=0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7821 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7822 +LIB2ADDEH = |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7823 +LIB2ADDEHSTATIC = |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7824 +LIB2ADDEHSHARED = |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7825 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7826 +LIBGCC2_DEBUG_CFLAGS = |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7827 +LIBGCC2_CFLAGS = -Os $(LIBGCC2_INCLUDES) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) -DIN_LIBGCC2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7828 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7829 +# Multilib information |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7830 +# This creates multiple versions of libgcc.a for each set of incompatible |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7831 +# -mxxx options. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7832 +MULTILIB_OPTIONS = fpic mdret |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7833 +MULTILIB_DIRNAMES = |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7834 +MULTILIB_MATCHES = |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7835 +MULTILIB_EXCEPTIONS = |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7836 +EXTRA_MULTILIB_PARTS = crt0.o |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7837 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7838 +LIBGCC = stmp-multilib |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7839 +INSTALL_LIBGCC = install-multilib |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7840 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7841 +# We want fine grained libraries, so use the new code to build the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7842 +# floating point emulation libraries. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7843 +FPBIT = fp-bit.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7844 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7845 +fp-bit.c: $(srcdir)/config/fp-bit.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7846 + echo '#define FLOAT' > fp-bit.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7847 + echo '#define FLOAT_ONLY' >> fp-bit.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7848 + echo '#define CMPtype HItype' >> fp-bit.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7849 + echo '#define SMALL_MACHINE' >> fp-bit.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7850 + echo '#ifdef __LITTLE_ENDIAN__' >> fp-bit.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7851 + echo '#define FLOAT_BIT_ORDER_MISMATCH' >>fp-bit.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7852 + echo '#endif' >> fp-bit.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7853 + echo '#define DI SI' >> fp-bit.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7854 + cat $(srcdir)/config/fp-bit.c >> fp-bit.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7855 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7856 +# crt0.o is built from the following source file |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7857 +CRT0_S = $(srcdir)/config/m6809/crt0.S |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7858 +MCRT0_S = $(srcdir)/config/m6809/crt0.S |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7859 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7860 +# Flags to use when building crt0.o |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7861 +CRT0STUFF_T_CFLAGS += -fno-builtin -nostartfiles -nostdlib |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7862 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7863 +# Assemble startup files. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7864 +$(T)crt0.o: $(CRT0_S) $(GCC_PASSES) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7865 + $(GCC_FOR_TARGET) $(CRT0STUFF_T_CFLAGS) $(MULTILIB_CFLAGS) -c -o $(T)crt0.o -x assembler-with-cpp $(CRT0_S) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7866 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7867 +$(T)mcrt0.o: $(MCRT0_S) $(GCC_PASSES) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7868 + $(GCC_FOR_TARGET) $(CRT0STUFF_T_CFLAGS) $(MULTILIB_CFLAGS) -c -o $(T)mcrt0.o -x assembler-with-cpp $(MCRT0_S) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7869 diff -urN gcc-4.6.4-clean/gcc/config/m6809/t-sim gcc-4.6.4/gcc/config/m6809/t-sim |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7870 --- gcc-4.6.4-clean/gcc/config/m6809/t-sim 1969-12-31 17:00:00.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7871 +++ gcc-4.6.4/gcc/config/m6809/t-sim 2015-07-20 19:44:52.770843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7872 @@ -0,0 +1 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7873 +CRT0STUFF_T_CFLAGS += -DTARGET_SIM |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7874 diff -urN gcc-4.6.4-clean/gcc/config.gcc gcc-4.6.4/gcc/config.gcc |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7875 --- gcc-4.6.4-clean/gcc/config.gcc 2013-03-06 10:40:07.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7876 +++ gcc-4.6.4/gcc/config.gcc 2015-07-20 19:44:52.770843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7877 @@ -375,6 +375,9 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7878 cpu_type=m32r |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7879 extra_options="${extra_options} g.opt" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7880 ;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7881 +m6809-*-*) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7882 + cpu_type=m6809 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7883 + ;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7884 m68k-*-*) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7885 extra_headers=math-68881.h |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7886 ;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7887 @@ -1706,6 +1709,12 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7888 thread_file='posix' |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7889 fi |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7890 ;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7891 +m6809-coco-*) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7892 + tmake_file="${tmake_file} m6809/t-m6809 m6809/t-coco" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7893 + ;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7894 +m6809-*-*) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7895 + tmake_file="${tmake_file} m6809/t-m6809 m6809/t-sim" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7896 + ;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7897 # m68hc11 and m68hc12 share the same machine description. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7898 m68hc11-*-*|m6811-*-*) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7899 tm_file="dbxelf.h elfos.h usegas.h newlib-stdint.h m68hc11/m68hc11.h" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7900 diff -urN gcc-4.6.4-clean/gcc/gcse.c gcc-4.6.4/gcc/gcse.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7901 --- gcc-4.6.4-clean/gcc/gcse.c 2011-02-02 23:04:04.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7902 +++ gcc-4.6.4/gcc/gcse.c 2015-07-20 19:44:52.770843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7903 @@ -833,7 +833,6 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7904 max_distance = (GCSE_COST_DISTANCE_RATIO * cost) / 10; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7905 if (max_distance == 0) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7906 return 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7907 - |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7908 gcc_assert (max_distance > 0); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7909 } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7910 else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7911 diff -urN gcc-4.6.4-clean/gcc/libgcc2.c gcc-4.6.4/gcc/libgcc2.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7912 --- gcc-4.6.4-clean/gcc/libgcc2.c 2011-01-03 13:52:22.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7913 +++ gcc-4.6.4/gcc/libgcc2.c 2015-07-20 19:44:52.770843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7914 @@ -485,6 +485,7 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7915 #endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7916 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7917 #ifdef L_bswapsi2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7918 +#if MIN_UNITS_PER_WORD > 1 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7919 SItype |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7920 __bswapsi2 (SItype u) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7921 { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7922 @@ -494,7 +495,9 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7923 | (((u) & 0x000000ff) << 24)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7924 } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7925 #endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7926 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7927 #ifdef L_bswapdi2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7928 +#if LONG_LONG_TYPE_SIZE > 32 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7929 DItype |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7930 __bswapdi2 (DItype u) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7931 { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7932 @@ -508,6 +511,7 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7933 | (((u) & 0x00000000000000ffull) << 56)); |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7934 } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7935 #endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7936 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7937 #ifdef L_ffssi2 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7938 #undef int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7939 int |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7940 @@ -1280,7 +1284,7 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7941 UDWtype |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7942 __fixunssfDI (SFtype a) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7943 { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7944 -#if LIBGCC2_HAS_DF_MODE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7945 +#if LIBGCC2_HAS_DF_MODE || (FLT_MANT_DIG >= W_TYPE_SIZE) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7946 /* Convert the SFtype to a DFtype, because that is surely not going |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7947 to lose any bits. Some day someone else can write a faster version |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7948 that avoids converting to DFtype, and verify it really works right. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7949 @@ -1298,7 +1302,7 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7950 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7951 /* Assemble result from the two parts. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7952 return ((UDWtype) hi << W_TYPE_SIZE) | lo; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7953 -#elif FLT_MANT_DIG < W_TYPE_SIZE |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7954 +#else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7955 if (a < 1) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7956 return 0; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7957 if (a < Wtype_MAXp1_F) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7958 @@ -1334,8 +1338,6 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7959 return (DWtype)counter << shift; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7960 } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7961 return -1; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7962 -#else |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7963 -# error |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7964 #endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7965 } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7966 #endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7967 diff -urN gcc-4.6.4-clean/gcc/longlong.h gcc-4.6.4/gcc/longlong.h |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7968 --- gcc-4.6.4-clean/gcc/longlong.h 2011-10-04 01:28:50.000000000 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7969 +++ gcc-4.6.4/gcc/longlong.h 2015-07-20 19:44:52.770843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7970 @@ -528,6 +528,11 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7971 : "cbit") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7972 #endif /* __M32R__ */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7973 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7974 +#if defined (__m6309__) || defined (__m6809__) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7975 +#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7976 +#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctz (X)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7977 +#endif |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7978 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7979 #if defined (__mc68000__) && W_TYPE_SIZE == 32 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7980 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7981 __asm__ ("add%.l %5,%1\n\taddx%.l %3,%0" \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7982 diff -urN gcc-4.6.4-clean/gcc/Makefile.in gcc-4.6.4/gcc/Makefile.in |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7983 --- gcc-4.6.4-clean/gcc/Makefile.in 2013-04-01 02:32:34.000000000 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7984 +++ gcc-4.6.4/gcc/Makefile.in 2015-07-20 19:44:52.770843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7985 @@ -2003,14 +2003,14 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7986 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7987 # Compile the start modules crt0.o and mcrt0.o that are linked with |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7988 # every program |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7989 -$(T)crt0.o: s-crt0 ; @true |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7990 -$(T)mcrt0.o: s-crt0; @true |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7991 +crt0.o: s-crt0 ; @true |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7992 +mcrt0.o: s-crt0; @true |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7993 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7994 s-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7995 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7996 - -o $(T)crt0.o -c $(CRT0_S) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7997 + -o crt0.o -c $(CRT0_S) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7998 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7999 - -o $(T)mcrt0.o -c $(MCRT0_S) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8000 + -o mcrt0.o -c $(MCRT0_S) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8001 $(STAMP) s-crt0 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8002 # |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8003 # Compiling object files from source files. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8004 diff -urN gcc-4.6.4-clean/gcc/opth-gen.awk gcc-4.6.4/gcc/opth-gen.awk |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8005 --- gcc-4.6.4-clean/gcc/opth-gen.awk 2011-02-08 10:41:00.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8006 +++ gcc-4.6.4/gcc/opth-gen.awk 2015-07-20 19:44:52.774843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8007 @@ -121,7 +121,7 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8008 END { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8009 print "/* This file is auto-generated by opth-gen.awk. */" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8010 print "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8011 -print "#ifndef OPTIONS_H" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8012 +print "#if !defined(OPTIONS_H) && !defined(IN_LIBGCC2)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8013 print "#define OPTIONS_H" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8014 print "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8015 print "#include \"flag-types.h\"" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8016 @@ -432,18 +432,9 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8017 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8018 for (i = 0; i < n_opts; i++) { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8019 opt = opt_args("InverseMask", flags[i]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8020 - if (opt ~ ",") { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8021 - vname = var_name(flags[i]) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8022 - macro = "OPTION_" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8023 - mask = "OPTION_MASK_" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8024 - if (vname == "") { |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8025 - vname = "target_flags" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8026 - macro = "TARGET_" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8027 - mask = "MASK_" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8028 - } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8029 - print "#define " macro nth_arg(1, opt) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8030 - " ((" vname " & " mask nth_arg(0, opt) ") == 0)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8031 - } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8032 + if (opt ~ ",") |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8033 + print "#define TARGET_" nth_arg(1, opt) \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8034 + " ((target_flags & MASK_" nth_arg(0, opt) ") == 0)" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8035 } |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8036 print "" |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8037 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8038 diff -urN gcc-4.6.4-clean/gcc/tree.h gcc-4.6.4/gcc/tree.h |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8039 --- gcc-4.6.4-clean/gcc/tree.h 2011-10-06 13:57:52.000000000 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8040 +++ gcc-4.6.4/gcc/tree.h 2015-07-20 19:44:52.774843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8041 @@ -3563,6 +3563,8 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8042 TI_UINTDI_TYPE, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8043 TI_UINTTI_TYPE, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8044 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8045 + TI_UINT8_TYPE, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8046 + TI_UINT16_TYPE, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8047 TI_UINT32_TYPE, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8048 TI_UINT64_TYPE, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8049 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8050 diff -urN gcc-4.6.4-clean/gcc/version.c gcc-4.6.4/gcc/version.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8051 --- gcc-4.6.4-clean/gcc/version.c 2009-04-21 13:03:23.000000000 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8052 +++ gcc-4.6.4/gcc/version.c 2015-07-20 19:44:52.774843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8053 @@ -21,16 +21,16 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8054 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8055 /* This is the location of the online document giving instructions for |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8056 reporting bugs. If you distribute a modified version of GCC, |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8057 - please configure with --with-bugurl pointing to a document giving |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8058 - instructions for reporting bugs to you, not us. (You are of course |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8059 - welcome to forward us bugs reported to you, if you determine that |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8060 - they are not bugs in your modifications.) */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8061 + please change this to refer to a document giving instructions for |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8062 + reporting bugs to you, not us. (You are of course welcome to |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8063 + forward us bugs reported to you, if you determine that they are |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8064 + not bugs in your modifications.) */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8065 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8066 -const char bug_report_url[] = BUGURL; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8067 +const char bug_report_url[] = "<URL:http://lost.l-w.ca/coco/lwtools/>"; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8068 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8069 /* The complete version string, assembled from several pieces. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8070 BASEVER, DATESTAMP, DEVPHASE, and REVISION are defined by the |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8071 Makefile. */ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8072 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8073 -const char version_string[] = BASEVER DATESTAMP DEVPHASE REVISION; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8074 +const char version_string[] = BASEVER DATESTAMP DEVPHASE REVISION " (gcc6809lw)"; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8075 const char pkgversion_string[] = PKGVERSION; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8076 diff -urN gcc-4.6.4-clean/libgcc/config.host gcc-4.6.4/libgcc/config.host |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8077 --- gcc-4.6.4-clean/libgcc/config.host 2011-11-23 15:15:54.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8078 +++ gcc-4.6.4/libgcc/config.host 2015-07-20 19:44:52.774843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8079 @@ -371,6 +371,8 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8080 ;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8081 m32rle-*-linux*) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8082 ;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8083 +m6809*) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8084 + ;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8085 m68hc11-*-*|m6811-*-*) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8086 ;; |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8087 m68hc12-*-*|m6812-*-*) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8088 diff -urN gcc-4.6.4-clean/libgcc/fixed-obj.mk gcc-4.6.4/libgcc/fixed-obj.mk |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8089 --- gcc-4.6.4-clean/libgcc/fixed-obj.mk 2007-09-17 16:18:13.000000000 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8090 +++ gcc-4.6.4/libgcc/fixed-obj.mk 2015-07-20 19:44:52.774843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8091 @@ -23,7 +23,7 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8092 #$(info $o$(objext): -DL$($o-label) $($o-opt)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8093 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8094 $o$(objext): %$(objext): $(gcc_srcdir)/config/fixed-bit.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8095 - $(gcc_compile) -DL$($*-label) $($*-opt) -c $(gcc_srcdir)/config/fixed-bit.c $(vis_hide) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8096 + $(gcc_compile) -DL$($*-label) $($*-opt) -c $(gcc_srcdir)/config/fixed-bit.c $(vis_hide) -save-temps |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8097 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8098 ifeq ($(enable_shared),yes) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8099 $(o)_s$(objext): %_s$(objext): $(gcc_srcdir)/config/fixed-bit.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8100 diff -urN gcc-4.6.4-clean/libgcc/Makefile.in gcc-4.6.4/libgcc/Makefile.in |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8101 --- gcc-4.6.4-clean/libgcc/Makefile.in 2012-12-04 12:11:33.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8102 +++ gcc-4.6.4/libgcc/Makefile.in 2015-07-20 19:44:52.774843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8103 @@ -374,8 +374,8 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8104 # Build lib2funcs. For the static library also include LIB2FUNCS_ST. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8105 lib2funcs-o = $(patsubst %,%$(objext),$(lib2funcs) $(LIB2FUNCS_ST)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8106 $(lib2funcs-o): %$(objext): $(gcc_srcdir)/libgcc2.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8107 - $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8108 - $(vis_hide) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8109 + ln -sf $(gcc_srcdir)/libgcc2.c $*.c && \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8110 + $(gcc_compile) -DL$* -c $*.c $(vis_hide) -save-temps |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8111 libgcc-objects += $(lib2funcs-o) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8112 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8113 ifeq ($(enable_shared),yes) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8114 @@ -410,8 +410,9 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8115 # Build LIB2_DIVMOD_FUNCS. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8116 lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8117 $(lib2-divmod-o): %$(objext): $(gcc_srcdir)/libgcc2.c |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8118 - $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8119 - -fexceptions -fnon-call-exceptions $(vis_hide) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8120 + ln -sf $(gcc_srcdir)/libgcc2.c $*.c && \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8121 + $(gcc_compile) -DL$* -c $*.c \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8122 + -fexceptions -fnon-call-exceptions $(vis_hide) -save-temps |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8123 libgcc-objects += $(lib2-divmod-o) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8124 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8125 ifeq ($(enable_shared),yes) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8126 @@ -443,7 +444,8 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8127 ifneq ($(FPBIT),) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8128 fpbit-o = $(patsubst %,%$(objext),$(FPBIT_FUNCS)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8129 $(fpbit-o): %$(objext): $(FPBIT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8130 - $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(FPBIT) $(vis_hide) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8131 + ln -sf $(FPBIT) $*.c && \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8132 + $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $*.c $(vis_hide) -save-temps |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8133 libgcc-objects += $(fpbit-o) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8134 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8135 ifeq ($(enable_shared),yes) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8136 @@ -458,7 +460,8 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8137 ifneq ($(DPBIT),) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8138 dpbit-o = $(patsubst %,%$(objext),$(DPBIT_FUNCS)) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8139 $(dpbit-o): %$(objext): $(DPBIT) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8140 - $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(DPBIT) $(vis_hide) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8141 + ln -sf $(DPBIT) $*.c && \ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8142 + $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $*.c $(vis_hide) -save-temps |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8143 libgcc-objects += $(dpbit-o) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8144 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8145 ifeq ($(enable_shared),yes) |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8146 diff -urN gcc-4.6.4-clean/README.LW gcc-4.6.4/README.LW |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8147 --- gcc-4.6.4-clean/README.LW 1969-12-31 17:00:00.000000000 -0700 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8148 +++ gcc-4.6.4/README.LW 2015-07-20 19:44:52.774843181 -0600 |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8149 @@ -0,0 +1,14 @@ |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8150 +This is a port of gcc6809 which is designed to work with the lwtools |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8151 +cross-assembler and linker package. You will need several scripts from that |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8152 +package, available at http://lost.l-w.ca/coco/lwtools/, in order to use |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8153 +this. Instructions for building are present in the lwtools package. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8154 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8155 +This work is based extensively on the gcc6809 4.3.4-3 release by Brian |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8156 +Dominy (brian@oddchange.com) with some significant renovations to make it |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8157 +work with gcc 4.6.1. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8158 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8159 +There is no guarantee that it will work for any particular purpose you |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8160 +choose to put it to. |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8161 + |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8162 +If you run into any problems, contact William Astle (lost@l-w.ca). DO NOT |
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8163 +contact the main GCC developers! |