OpenCores
URL https://opencores.org/ocsvn/zipcpu/zipcpu/trunk

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [sw/] [gcc-zippatch.patch] - Blame information for rev 110

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/config.sub gcc-5.3.0-zip/config.sub
2
--- gcc-5.3.0-original/config.sub       2015-01-02 04:30:21.000000000 -0500
3
+++ gcc-5.3.0-zip/config.sub    2016-01-30 12:27:56.023073747 -0500
4
@@ -316,7 +316,7 @@
5
        | visium \
6
        | we32k \
7
        | x86 | xc16x | xstormy16 | xtensa \
8
-       | z8k | z80)
9
+       | z8k | z80 | zip)
10
                basic_machine=$basic_machine-unknown
11
                ;;
12
        c54x)
13
@@ -1547,6 +1547,9 @@
14
 # system, and we'll never get to this point.
15
 
16
 case $basic_machine in
17
+       zip-*)
18
+               os=-elf
19
+               ;;
20
        score-*)
21
                os=-elf
22
                ;;
23
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/configure gcc-5.3.0-zip/configure
24
--- gcc-5.3.0-original/configure        2015-05-03 13:29:57.000000000 -0400
25
+++ gcc-5.3.0-zip/configure     2016-01-30 16:19:48.264867231 -0500
26
@@ -3927,6 +3927,8 @@
27
   vax-*-*)
28
     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
29
     ;;
30
+  zip*)
31
+    noconfigdirs="$noconfigdirs target-libffi target-boehm-gc gdb gprof"
32
 esac
33
 
34
 # If we aren't building newlib, then don't build libgloss, since libgloss
35
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/configure.ac gcc-5.3.0-zip/configure.ac
36
--- gcc-5.3.0-original/configure.ac     2015-05-03 13:29:57.000000000 -0400
37
+++ gcc-5.3.0-zip/configure.ac  2016-02-12 10:47:23.847194843 -0500
38
@@ -1274,6 +1274,10 @@
39
   vax-*-*)
40
     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
41
     ;;
42
+  zip*)
43
+    noconfigdirs="$noconfigdirs target-libffi target-boehm-gc gdb gprof"
44
+    unsupported_languages="$unsupported_languages fortran java"
45
+    ;;
46
 esac
47
 
48
 # If we aren't building newlib, then don't build libgloss, since libgloss
49
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/common/config/zip/zip-common.c gcc-5.3.0-zip/gcc/common/config/zip/zip-common.c
50
--- gcc-5.3.0-original/gcc/common/config/zip/zip-common.c       1969-12-31 19:00:00.000000000 -0500
51
+++ gcc-5.3.0-zip/gcc/common/config/zip/zip-common.c    2016-02-14 00:54:31.821055716 -0500
52
@@ -0,0 +1,52 @@
53
+////////////////////////////////////////////////////////////////////////////////
54
+//
55
+// Filename:   common/config/zip/zip-common.c
56
+//
57
+// Project:    Zip CPU backend for the GNU Compiler Collection
58
+//
59
+// Purpose:    To eliminate the frame register automatically.
60
+//
61
+// Creator:    Dan Gisselquist, Ph.D.
62
+//             Gisselquist Technology, LLC
63
+//
64
+////////////////////////////////////////////////////////////////////////////////
65
+//
66
+// Copyright (C) 2016, Gisselquist Technology, LLC
67
+//
68
+// This program is free software (firmware): you can redistribute it and/or
69
+// modify it under the terms of  the GNU General Public License as published
70
+// by the Free Software Foundation, either version 3 of the License, or (at
71
+// your option) any later version.
72
+//
73
+// This program is distributed in the hope that it will be useful, but WITHOUT
74
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
75
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
76
+// for more details.
77
+//
78
+// You should have received a copy of the GNU General Public License along
79
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
80
+// target there if the PDF file isn't present.)  If not, see
81
+// <http://www.gnu.org/licenses/> for a copy.
82
+//
83
+// License:    GPL, v3, as defined and found on www.gnu.org,
84
+//             http://www.gnu.org/licenses/gpl.html
85
+//
86
+//
87
+////////////////////////////////////////////////////////////////////////////////
88
+#include "config.h"
89
+#include "system.h"
90
+#include "coretypes.h"
91
+#include "tm.h"
92
+#include "common/common-target.h"
93
+#include "common/common-target-def.h"
94
+
95
+static const struct default_options zip_option_optimization_table[] =
96
+  {
97
+    { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 },
98
+    { OPT_LEVELS_NONE, 0, NULL, 0 }
99
+  };
100
+
101
+#undef TARGET_OPTION_OPTIMIZATION_TABLE
102
+#define        TARGET_OPTION_OPTIMIZATION_TABLE        zip_option_optimization_table
103
+
104
+struct gcc_targetm_common      targetm_common = TARGETM_COMMON_INITIALIZER;
105
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/aarch64/aarch64-linux.h gcc-5.3.0-zip/gcc/config/aarch64/aarch64-linux.h
106 103 dgisselq
--- gcc-5.3.0-original/gcc/config/aarch64/aarch64-linux.h       2016-03-08 04:57:02.962902614 -0500
107 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/aarch64/aarch64-linux.h    2015-07-24 12:00:26.000000000 -0400
108
@@ -21,7 +21,7 @@
109
 #ifndef GCC_AARCH64_LINUX_H
110
 #define GCC_AARCH64_LINUX_H
111
 
112
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
113
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
114
 
115
 #undef  ASAN_CC1_SPEC
116
 #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
117
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/alpha/linux-elf.h gcc-5.3.0-zip/gcc/config/alpha/linux-elf.h
118 103 dgisselq
--- gcc-5.3.0-original/gcc/config/alpha/linux-elf.h     2016-03-08 04:57:02.962902614 -0500
119 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/alpha/linux-elf.h  2015-01-05 07:33:28.000000000 -0500
120
@@ -23,8 +23,8 @@
121
 #define EXTRA_SPECS \
122
 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
123
 
124
-#define GLIBC_DYNAMIC_LINKER   "/tools/lib/ld-linux.so.2"
125
-#define UCLIBC_DYNAMIC_LINKER "/tools/lib/ld-uClibc.so.0"
126
+#define GLIBC_DYNAMIC_LINKER   "/lib/ld-linux.so.2"
127
+#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
128
 #if DEFAULT_LIBC == LIBC_UCLIBC
129
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
130
 #elif DEFAULT_LIBC == LIBC_GLIBC
131
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/arm/linux-eabi.h gcc-5.3.0-zip/gcc/config/arm/linux-eabi.h
132 103 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-eabi.h      2016-03-08 04:57:02.962902614 -0500
133 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/arm/linux-eabi.h   2015-01-05 07:33:28.000000000 -0500
134
@@ -68,8 +68,8 @@
135
    GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI.  */
136
 
137
 #undef  GLIBC_DYNAMIC_LINKER
138
-#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/tools/lib/ld-linux.so.3"
139
-#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/tools/lib/ld-linux-armhf.so.3"
140
+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
141
+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
142
 #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
143
 
144
 #define GLIBC_DYNAMIC_LINKER \
145
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/arm/linux-elf.h gcc-5.3.0-zip/gcc/config/arm/linux-elf.h
146 103 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-elf.h       2016-03-08 04:57:02.962902614 -0500
147 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/arm/linux-elf.h    2015-06-23 05:26:54.000000000 -0400
148
@@ -62,7 +62,7 @@
149
 
150
 #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
151
 
152
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
153
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
154
 
155
 #define LINUX_TARGET_LINK_SPEC  "%{h*} \
156
    %{static:-Bstatic} \
157
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/bfin/linux.h gcc-5.3.0-zip/gcc/config/bfin/linux.h
158 103 dgisselq
--- gcc-5.3.0-original/gcc/config/bfin/linux.h  2016-03-08 04:57:02.962902614 -0500
159 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/bfin/linux.h       2015-01-05 07:33:28.000000000 -0500
160
@@ -45,7 +45,7 @@
161
   %{shared:-G -Bdynamic} \
162
   %{!shared: %{!static: \
163
    %{rdynamic:-export-dynamic} \
164
-   -dynamic-linker /tools/lib/ld-uClibc.so.0} \
165
+   -dynamic-linker /lib/ld-uClibc.so.0} \
166
    %{static}} -init __init -fini __fini"
167
 
168
 #undef TARGET_SUPPORTS_SYNC_CALLS
169
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/cris/linux.h gcc-5.3.0-zip/gcc/config/cris/linux.h
170 103 dgisselq
--- gcc-5.3.0-original/gcc/config/cris/linux.h  2016-03-08 04:57:02.962902614 -0500
171 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/cris/linux.h       2015-01-05 07:33:28.000000000 -0500
172
@@ -102,7 +102,7 @@
173
 #undef CRIS_DEFAULT_CPU_VERSION
174
 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
175
 
176
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
177
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
178
 
179
 #undef CRIS_LINK_SUBTARGET_SPEC
180
 #define CRIS_LINK_SUBTARGET_SPEC \
181
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/freebsd-spec.h gcc-5.3.0-zip/gcc/config/freebsd-spec.h
182 103 dgisselq
--- gcc-5.3.0-original/gcc/config/freebsd-spec.h        2016-03-08 04:57:02.962902614 -0500
183 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/freebsd-spec.h     2015-06-25 13:53:14.000000000 -0400
184
@@ -129,9 +129,9 @@
185
 #endif
186
 
187
 #if FBSD_MAJOR < 6
188
-#define FBSD_DYNAMIC_LINKER "/tools/libexec/ld-elf.so.1"
189
+#define FBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.1"
190
 #else
191
-#define FBSD_DYNAMIC_LINKER "/tools/libexec/ld-elf.so.1"
192
+#define FBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
193
 #endif
194
 
195
 /* NOTE: The freebsd-spec.h header is included also for various
196
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/frv/linux.h gcc-5.3.0-zip/gcc/config/frv/linux.h
197 103 dgisselq
--- gcc-5.3.0-original/gcc/config/frv/linux.h   2016-03-08 04:57:02.962902614 -0500
198 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/frv/linux.h        2015-01-05 07:33:28.000000000 -0500
199
@@ -34,7 +34,7 @@
200
 #define ENDFILE_SPEC \
201
   "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
202
 
203
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
204
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
205
 
206
 #undef LINK_SPEC
207
 #define LINK_SPEC "\
208
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/gnu.h gcc-5.3.0-zip/gcc/config/i386/gnu.h
209 103 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/gnu.h    2016-03-08 04:57:02.962902614 -0500
210 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/gnu.h 2015-01-05 07:33:28.000000000 -0500
211
@@ -22,7 +22,7 @@
212
 #define GNU_USER_LINK_EMULATION "elf_i386"
213
 
214
 #undef GNU_USER_DYNAMIC_LINKER
215
-#define GNU_USER_DYNAMIC_LINKER "/tools/lib/ld.so"
216
+#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so"
217
 
218
 #undef STARTFILE_SPEC
219
 #if defined HAVE_LD_PIE
220
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu64.h gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu64.h
221 103 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu64.h 2016-03-08 04:57:02.962902614 -0500
222 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu64.h      2015-01-05 07:33:28.000000000 -0500
223
@@ -22,6 +22,6 @@
224
 #define GNU_USER_LINK_EMULATION64 "elf_x86_64_fbsd"
225
 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64_fbsd"
226
 
227
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld.so.1"
228
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib/ld-kfreebsd-x86-64.so.1"
229
-#define GLIBC_DYNAMIC_LINKERX32 "/tools/lib/ld-kfreebsd-x32.so.1"
230
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
231
+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-kfreebsd-x86-64.so.1"
232
+#define GLIBC_DYNAMIC_LINKERX32 "/lib/ld-kfreebsd-x32.so.1"
233
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu.h gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu.h
234 103 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu.h   2016-03-08 04:57:02.962902614 -0500
235 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu.h        2015-01-05 07:33:28.000000000 -0500
236
@@ -19,4 +19,4 @@
237
 <http://www.gnu.org/licenses/>.  */
238
 
239
 #define GNU_USER_LINK_EMULATION "elf_i386_fbsd"
240
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
241
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
242
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/linux64.h gcc-5.3.0-zip/gcc/config/i386/linux64.h
243 103 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux64.h        2016-03-08 04:57:02.962902614 -0500
244 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/linux64.h     2015-01-05 07:33:28.000000000 -0500
245
@@ -27,6 +27,6 @@
246
 #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
247
 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
248
 
249
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-linux.so.2"
250
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib64/ld-linux-x86-64.so.2"
251
-#define GLIBC_DYNAMIC_LINKERX32 "/tools/libx32/ld-linux-x32.so.2"
252
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
253
+#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
254
+#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
255
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/linux.h gcc-5.3.0-zip/gcc/config/i386/linux.h
256 103 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux.h  2016-03-08 04:57:02.962902614 -0500
257 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/linux.h       2015-01-05 07:33:28.000000000 -0500
258
@@ -20,4 +20,4 @@
259
 <http://www.gnu.org/licenses/>.  */
260
 
261
 #define GNU_USER_LINK_EMULATION "elf_i386"
262
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
263
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
264
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/ia64/linux.h gcc-5.3.0-zip/gcc/config/ia64/linux.h
265 103 dgisselq
--- gcc-5.3.0-original/gcc/config/ia64/linux.h  2016-03-08 04:57:02.962902614 -0500
266 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/ia64/linux.h       2015-01-05 07:33:28.000000000 -0500
267
@@ -55,7 +55,7 @@
268
 /* Define this for shared library support because it isn't in the main
269
    linux.h file.  */
270
 
271
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux-ia64.so.2"
272
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
273
 
274
 #undef LINK_SPEC
275
 #define LINK_SPEC "\
276
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/knetbsd-gnu.h gcc-5.3.0-zip/gcc/config/knetbsd-gnu.h
277 103 dgisselq
--- gcc-5.3.0-original/gcc/config/knetbsd-gnu.h 2016-03-08 04:57:02.962902614 -0500
278 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/knetbsd-gnu.h      2015-01-05 07:33:28.000000000 -0500
279
@@ -32,4 +32,4 @@
280
 
281
 
282
 #undef GNU_USER_DYNAMIC_LINKER
283
-#define GNU_USER_DYNAMIC_LINKER "/tools/lib/ld.so.1"
284
+#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
285
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h gcc-5.3.0-zip/gcc/config/kopensolaris-gnu.h
286 103 dgisselq
--- gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h    2016-03-08 04:57:02.962902614 -0500
287 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/kopensolaris-gnu.h 2015-01-05 07:33:28.000000000 -0500
288
@@ -31,5 +31,4 @@
289
   while (0)
290
 
291
 #undef GNU_USER_DYNAMIC_LINKER
292
-#define GNU_USER_DYNAMIC_LINKER "/tools/lib/ld.so.1"
293
-
294
+#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
295
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/linux.h gcc-5.3.0-zip/gcc/config/linux.h
296 103 dgisselq
--- gcc-5.3.0-original/gcc/config/linux.h       2016-03-08 04:57:02.962902614 -0500
297 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/linux.h    2015-01-05 07:33:28.000000000 -0500
298
@@ -73,10 +73,10 @@
299
    GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
300
    GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
301
    supporting both 32-bit and 64-bit compilation.  */
302
-#define UCLIBC_DYNAMIC_LINKER "/tools/lib/ld-uClibc.so.0"
303
-#define UCLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-uClibc.so.0"
304
-#define UCLIBC_DYNAMIC_LINKER64 "/tools/lib/ld64-uClibc.so.0"
305
-#define UCLIBC_DYNAMIC_LINKERX32 "/tools/lib/ldx32-uClibc.so.0"
306
+#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
307
+#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
308
+#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
309
+#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
310
 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
311
 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
312
 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
313
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/lm32/uclinux-elf.h gcc-5.3.0-zip/gcc/config/lm32/uclinux-elf.h
314 103 dgisselq
--- gcc-5.3.0-original/gcc/config/lm32/uclinux-elf.h    2016-03-08 04:57:02.962902614 -0500
315 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/lm32/uclinux-elf.h 2015-01-05 07:33:28.000000000 -0500
316
@@ -67,7 +67,7 @@
317
    %{shared:-shared} \
318
    %{symbolic:-Bsymbolic} \
319
    %{rdynamic:-export-dynamic} \
320
-   -dynamic-linker /tools/lib/ld-linux.so.2"
321
+   -dynamic-linker /lib/ld-linux.so.2"
322
 
323
 #define TARGET_OS_CPP_BUILTINS() GNU_USER_TARGET_OS_CPP_BUILTINS()
324
 
325
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/m68k/linux.h gcc-5.3.0-zip/gcc/config/m68k/linux.h
326 103 dgisselq
--- gcc-5.3.0-original/gcc/config/m68k/linux.h  2016-03-08 04:57:02.962902614 -0500
327 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/m68k/linux.h       2015-01-05 07:33:28.000000000 -0500
328
@@ -71,7 +71,7 @@
329
    When the -shared link option is used a final link is not being
330
    done.  */
331
 
332
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
333
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
334
 
335
 #undef LINK_SPEC
336
 #define LINK_SPEC "-m m68kelf %{shared} \
337
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/microblaze/linux.h gcc-5.3.0-zip/gcc/config/microblaze/linux.h
338 103 dgisselq
--- gcc-5.3.0-original/gcc/config/microblaze/linux.h    2016-03-08 04:57:02.962902614 -0500
339 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/microblaze/linux.h 2015-05-28 10:08:19.000000000 -0400
340
@@ -28,7 +28,7 @@
341
 #undef TLS_NEEDS_GOT
342
 #define TLS_NEEDS_GOT 1
343
 
344
-#define DYNAMIC_LINKER "/tools/lib/ld.so.1"
345
+#define DYNAMIC_LINKER "/lib/ld.so.1"
346
 #undef  SUBTARGET_EXTRA_SPECS
347
 #define SUBTARGET_EXTRA_SPECS \
348
   { "dynamic_linker", DYNAMIC_LINKER }
349
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/mips/linux.h gcc-5.3.0-zip/gcc/config/mips/linux.h
350 103 dgisselq
--- gcc-5.3.0-original/gcc/config/mips/linux.h  2016-03-08 04:57:02.962902614 -0500
351 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/mips/linux.h       2015-01-05 07:33:28.000000000 -0500
352
@@ -22,20 +22,20 @@
353
 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
354
 
355
 #define GLIBC_DYNAMIC_LINKER32 \
356
-  "%{mnan=2008:/tools/lib/ld-linux-mipsn8.so.1;:/tools/lib/ld.so.1}"
357
+  "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
358
 #define GLIBC_DYNAMIC_LINKER64 \
359
-  "%{mnan=2008:/tools/lib64/ld-linux-mipsn8.so.1;:/tools/lib64/ld.so.1}"
360
+  "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}"
361
 #define GLIBC_DYNAMIC_LINKERN32 \
362
-  "%{mnan=2008:/tools/lib32/ld-linux-mipsn8.so.1;:/tools/lib32/ld.so.1}"
363
+  "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}"
364
 
365
 #undef UCLIBC_DYNAMIC_LINKER32
366
 #define UCLIBC_DYNAMIC_LINKER32 \
367
-  "%{mnan=2008:/tools/lib/ld-uClibc-mipsn8.so.0;:/tools/lib/ld-uClibc.so.0}"
368
+  "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
369
 #undef UCLIBC_DYNAMIC_LINKER64
370
 #define UCLIBC_DYNAMIC_LINKER64 \
371
-  "%{mnan=2008:/tools/lib/ld64-uClibc-mipsn8.so.0;:/tools/lib/ld64-uClibc.so.0}"
372
+  "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
373
 #define UCLIBC_DYNAMIC_LINKERN32 \
374
-  "%{mnan=2008:/tools/lib32/ld-uClibc-mipsn8.so.0;:/tools/lib32/ld-uClibc.so.0}"
375
+  "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
376
 
377
 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
378
 #define GNU_USER_DYNAMIC_LINKERN32 \
379
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/mn10300/linux.h gcc-5.3.0-zip/gcc/config/mn10300/linux.h
380 103 dgisselq
--- gcc-5.3.0-original/gcc/config/mn10300/linux.h       2016-03-08 04:57:02.962902614 -0500
381 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/mn10300/linux.h    2015-01-05 07:33:28.000000000 -0500
382
@@ -32,7 +32,7 @@
383
 #undef  ASM_SPEC
384
 #define ASM_SPEC ""
385
 
386
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
387
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
388
 
389
 #undef  LINK_SPEC
390
 #define LINK_SPEC "%{mrelax:--relax} %{shared:-shared} \
391
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/pa/pa-linux.h gcc-5.3.0-zip/gcc/config/pa/pa-linux.h
392 103 dgisselq
--- gcc-5.3.0-original/gcc/config/pa/pa-linux.h 2016-03-08 04:57:02.962902614 -0500
393 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/pa/pa-linux.h      2015-09-24 20:04:26.000000000 -0400
394
@@ -37,7 +37,7 @@
395
 /* Define this for shared library support because it isn't in the main
396
    linux.h file.  */
397
 
398
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
399
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
400
 
401
 #undef LINK_SPEC
402
 #define LINK_SPEC "\
403
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/rs6000/linux64.h gcc-5.3.0-zip/gcc/config/rs6000/linux64.h
404 103 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/linux64.h      2016-03-08 04:57:02.966902587 -0500
405 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/rs6000/linux64.h   2015-03-09 19:18:57.000000000 -0400
406
@@ -357,14 +357,14 @@
407
 #undef LINK_OS_DEFAULT_SPEC
408
 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
409
 
410
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld.so.1"
411
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
412
 #ifdef LINUX64_DEFAULT_ABI_ELFv2
413
-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/tools/lib64/ld64.so.1;:/tools/lib64/ld64.so.2}"
414
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
415
 #else
416
-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/tools/lib64/ld64.so.2;:/tools/lib64/ld64.so.1}"
417
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
418
 #endif
419
-#define UCLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-uClibc.so.0"
420
-#define UCLIBC_DYNAMIC_LINKER64 "/tools/lib/ld64-uClibc.so.0"
421
+#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
422
+#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
423
 #if DEFAULT_LIBC == LIBC_UCLIBC
424
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
425
 #elif DEFAULT_LIBC == LIBC_GLIBC
426
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/rs6000/sysv4.h gcc-5.3.0-zip/gcc/config/rs6000/sysv4.h
427 103 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/sysv4.h        2016-03-08 04:57:02.966902587 -0500
428 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/rs6000/sysv4.h     2015-09-24 09:46:45.000000000 -0400
429
@@ -757,8 +757,8 @@
430
 
431
 #define LINK_START_LINUX_SPEC ""
432
 
433
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
434
-#define UCLIBC_DYNAMIC_LINKER "/tools/lib/ld-uClibc.so.0"
435
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
436
+#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
437
 #if DEFAULT_LIBC == LIBC_UCLIBC
438
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
439
 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
440
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/s390/linux.h gcc-5.3.0-zip/gcc/config/s390/linux.h
441 103 dgisselq
--- gcc-5.3.0-original/gcc/config/s390/linux.h  2016-03-08 04:57:02.966902587 -0500
442 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/s390/linux.h       2015-05-11 03:14:10.000000000 -0400
443
@@ -60,8 +60,8 @@
444
 #define MULTILIB_DEFAULTS { "m31" }
445
 #endif
446
 
447
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld.so.1"
448
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib/ld64.so.1"
449
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
450
+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
451
 
452
 #undef  LINK_SPEC
453
 #define LINK_SPEC \
454
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sh/linux.h gcc-5.3.0-zip/gcc/config/sh/linux.h
455 103 dgisselq
--- gcc-5.3.0-original/gcc/config/sh/linux.h    2016-03-08 04:57:02.966902587 -0500
456 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/sh/linux.h 2015-01-05 07:33:28.000000000 -0500
457
@@ -43,7 +43,7 @@
458
 
459
 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
460
 
461
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
462
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
463
 
464
 #undef SUBTARGET_LINK_EMUL_SUFFIX
465
 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
466
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sparc/linux64.h gcc-5.3.0-zip/gcc/config/sparc/linux64.h
467 103 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux64.h       2016-03-08 04:57:02.966902587 -0500
468 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/sparc/linux64.h    2015-01-05 07:33:28.000000000 -0500
469
@@ -84,8 +84,8 @@
470
    When the -shared link option is used a final link is not being
471
    done.  */
472
 
473
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-linux.so.2"
474
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib64/ld-linux.so.2"
475
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
476
+#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
477
 
478
 #ifdef SPARC_BI_ARCH
479
 
480
@@ -193,7 +193,7 @@
481
 #else /* !SPARC_BI_ARCH */
482
 
483
 #undef LINK_SPEC
484
-#define LINK_SPEC "-m elf64_sparc -Y P,%R/tools/lib64 %{shared:-shared} \
485
+#define LINK_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
486
   %{!shared: \
487
     %{!static: \
488
       %{rdynamic:-export-dynamic} \
489
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sparc/linux.h gcc-5.3.0-zip/gcc/config/sparc/linux.h
490 103 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux.h 2016-03-08 04:57:02.966902587 -0500
491 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/sparc/linux.h      2015-01-05 07:33:28.000000000 -0500
492
@@ -83,7 +83,7 @@
493
    When the -shared link option is used a final link is not being
494
    done.  */
495
 
496
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
497
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
498
 
499
 #undef  LINK_SPEC
500
 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
501
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/vax/linux.h gcc-5.3.0-zip/gcc/config/vax/linux.h
502 103 dgisselq
--- gcc-5.3.0-original/gcc/config/vax/linux.h   2016-03-08 04:57:02.966902587 -0500
503 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/vax/linux.h        2015-01-05 07:33:28.000000000 -0500
504
@@ -41,7 +41,7 @@
505
   %{!shared: \
506
     %{!static: \
507
       %{rdynamic:-export-dynamic} \
508
-      -dynamic-linker /tools/lib/ld.so.1} \
509
+      -dynamic-linker /lib/ld.so.1} \
510
     %{static:-static}}"
511
 
512
 #undef  WCHAR_TYPE
513
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/xtensa/linux.h gcc-5.3.0-zip/gcc/config/xtensa/linux.h
514 103 dgisselq
--- gcc-5.3.0-original/gcc/config/xtensa/linux.h        2016-03-08 04:57:02.966902587 -0500
515 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/xtensa/linux.h     2015-01-05 07:33:28.000000000 -0500
516
@@ -44,7 +44,7 @@
517
   %{mlongcalls:--longcalls} \
518
   %{mno-longcalls:--no-longcalls}"
519
 
520
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
521
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
522
 
523
 #undef LINK_SPEC
524
 #define LINK_SPEC \
525
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/netbsd.h gcc-5.3.0-zip/gcc/config/zip/netbsd.h
526
--- gcc-5.3.0-original/gcc/config/zip/netbsd.h  1969-12-31 19:00:00.000000000 -0500
527
+++ gcc-5.3.0-zip/gcc/config/zip/netbsd.h       2016-01-30 15:04:14.796899050 -0500
528
@@ -0,0 +1,82 @@
529
+////////////////////////////////////////////////////////////////////////////////
530
+//
531
+// Filename:   netbsd.h
532
+//
533
+// Project:    Zip CPU backend for the GNU Compiler Collection
534
+//
535
+// Purpose:
536
+//
537
+// Creator:    Dan Gisselquist, Ph.D.
538
+//             Gisselquist Technology, LLC
539
+//
540
+////////////////////////////////////////////////////////////////////////////////
541
+//
542
+// Copyright (C) 2016, Gisselquist Technology, LLC
543
+//
544
+// This program is free software (firmware): you can redistribute it and/or
545
+// modify it under the terms of  the GNU General Public License as published
546
+// by the Free Software Foundation, either version 3 of the License, or (at
547
+// your option) any later version.
548
+//
549
+// This program is distributed in the hope that it will be useful, but WITHOUT
550
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
551
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
552
+// for more details.
553
+//
554
+// You should have received a copy of the GNU General Public License along
555
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
556
+// target there if the PDF file isn't present.)  If not, see
557
+// <http://www.gnu.org/licenses/> for a copy.
558
+//
559
+// License:    GPL, v3, as defined and found on www.gnu.org,
560
+//             http://www.gnu.org/licenses/gpl.html
561
+//
562
+//
563
+////////////////////////////////////////////////////////////////////////////////
564
+#ifndef        ZIP_NETBSD_H
565
+#define        ZIP_NETBSD_H
566
+
567
+/* Define default target values. */
568
+
569
+#undef MACHINE_TYPE
570
+#define        MACHINE_TYPE    "NetBSD/Zip ELF"
571
+
572
+#undef TARGET_OS_CPP_BUILTINS
573
+#define        TARGET_OS_CPP_BUILTINS()        \
574
+       do { NETBSD_OS_CPP_BUILTINS_ELF();              \
575
+       builtin_define("__ZIPCPU__");                   \
576
+       builtin_assert("cpu=zip");                      \
577
+       builtin_assert("machine=zip");                  \
578
+       } while(0);
579
+
580
+#undef CPP_SPEC
581
+#define        CPP_SPEC        NETBSD_CPP_SPEC
582
+
583
+#undef STARTFILE_SPEC
584
+#define        STARTFILE_SPEC  NETBSD_STARTFILE_SPEC
585
+
586
+#undef ENDFILE_SPEC
587
+#define        ENDFILE_SPEC    NETBSD_ENDFILE_SPEC
588
+
589
+#undef LIB_SPEC
590
+#define        LIB_SPEC        NETBSD_LIB_SPEC
591
+
592
+#undef TARGET_VERSION
593
+#define        TARGET_VERSION  fprintf(stderr, " (%s)", MACHINE_TYPE);
594
+
595
+/* Make gcc agree with <machine/ansi.h> */
596
+
597
+#undef WCHAR_TYPE
598
+#define        WCHAR_TYPE      "int"
599
+
600
+#undef WCHAR_TYPE_SIZE
601
+#define        WCHAR_TYPE_SIZE 32
602
+
603
+#undef WINT_TYPE
604
+#define        WINT_TYPE       "int"
605
+
606
+/* Clean up after the generic Zip/ELF configuration. */
607
+#undef MD_EXEC_PREFIX
608
+#undef MD_STARTFILE_PREFIX
609
+
610
+#endif /* ZIP_NETBSD_H */
611
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/t-zip gcc-5.3.0-zip/gcc/config/zip/t-zip
612
--- gcc-5.3.0-original/gcc/config/zip/t-zip     1969-12-31 19:00:00.000000000 -0500
613
+++ gcc-5.3.0-zip/gcc/config/zip/t-zip  2016-02-04 19:00:59.939652587 -0500
614
@@ -0,0 +1,47 @@
615
+################################################################################
616
+##
617
+## Filename:   t-zip
618
+##
619
+## Project:    Zip CPU backend for the GNU Compiler Collection
620
+##
621
+## Purpose:
622
+##
623
+## Creator:    Dan Gisselquist, Ph.D.
624
+##             Gisselquist Technology, LLC
625
+##
626
+################################################################################
627
+##
628
+## Copyright (C) 2016, Gisselquist Technology, LLC
629
+##
630
+## This program is free software (firmware): you can redistribute it and/or
631
+## modify it under the terms of  the GNU General Public License as published
632
+## by the Free Software Foundation, either version 3 of the License, or (at
633
+## your option) any later version.
634
+##
635
+## This program is distributed in the hope that it will be useful, but WITHOUT
636
+## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
637
+## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
638
+## for more details.
639
+##
640
+## You should have received a copy of the GNU General Public License along
641
+## with this program.  (It's in the $(ROOT)/doc directory, run make with no
642
+## target there if the PDF file isn't present.)  If not, see
643
+## <http://www.gnu.org/licenses/> for a copy.
644
+##
645
+## License:    GPL, v3, as defined and found on www.gnu.org,
646
+##             http://www.gnu.org/licenses/gpl.html
647
+##
648
+##
649
+################################################################################
650
+
651
+FPBIT = fp-bit.c
652
+DPBIT = dp-bit.c
653
+
654
+# dp-bit.c: $(srcdir)/config/fp-bit.c
655
+       # cat $(srcdir)/config/fp-bit.c > dp-bit.c
656
+#
657
+# fp-bit.c: $(srcdir)/config/fp-bit.c
658
+       # echo '#define FLOAT" > fp-bit.c
659
+       # cat $(srcdir)/config/fp-bit.c >> fp-bit.c
660
+
661
+
662
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.c gcc-5.3.0-zip/gcc/config/zip/zip.c
663
--- gcc-5.3.0-original/gcc/config/zip/zip.c     1969-12-31 19:00:00.000000000 -0500
664 103 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.c  2016-03-08 04:27:14.906499512 -0500
665
@@ -0,0 +1,2175 @@
666 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
667
+//
668
+// Filename:   zip.c
669
+//
670
+// Project:    Zip CPU backend for the GNU Compiler Collection
671
+//
672
+// Purpose:
673
+//
674
+// Creator:    Dan Gisselquist, Ph.D.
675
+//             Gisselquist Technology, LLC
676
+//
677
+////////////////////////////////////////////////////////////////////////////////
678
+//
679
+// Copyright (C) 2016, Gisselquist Technology, LLC
680
+//
681
+// This program is free software (firmware): you can redistribute it and/or
682
+// modify it under the terms of  the GNU General Public License as published
683
+// by the Free Software Foundation, either version 3 of the License, or (at
684
+// your option) any later version.
685
+//
686
+// This program is distributed in the hope that it will be useful, but WITHOUT
687
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
688
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
689
+// for more details.
690
+//
691
+// You should have received a copy of the GNU General Public License along
692
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
693
+// target there if the PDF file isn't present.)  If not, see
694
+// <http://www.gnu.org/licenses/> for a copy.
695
+//
696
+// License:    GPL, v3, as defined and found on www.gnu.org,
697
+//             http://www.gnu.org/licenses/gpl.html
698
+//
699
+//
700
+////////////////////////////////////////////////////////////////////////////////
701
+#include "config.h"
702
+#include "system.h"
703
+#include "coretypes.h"
704
+#include "tm.h"
705
+#include "rtl.h"
706
+#include "dominance.h"
707
+#include "cfg.h"
708
+#include "cfgrtl.h"
709
+#include "cfganal.h"
710
+#include "lcm.h"
711
+#include "cfgbuild.h"
712
+#include "cfgcleanup.h"
713
+#include "predict.h"
714
+#include "basic-block.h"
715
+#include "df.h"
716
+#include "hashtab.h"
717
+#include "hash-set.h"
718
+#include "machmode.h"
719
+#include "symtab.h"
720
+#include "rtlhash.h"
721
+#include "tree.h"
722
+#include "regs.h"
723
+#include "hard-reg-set.h"
724
+#include "real.h"
725
+#include "insn-config.h"
726
+#include "conditions.h"
727
+#include "output.h"
728
+#include "insn-attr.h"
729
+#include "flags.h"
730
+#include "expr.h"
731
+#include "function.h"
732
+#include "recog.h"
733
+#include "toplev.h"
734
+#include "ggc.h"
735
+#include "builtins.h"
736
+#include "calls.h"
737
+#include "langhooks.h"
738
+#include "optabs.h"
739
+#include "explow.h"
740
+#include "emit-rtl.h"
741
+
742
+// #include "tmp_p.h"
743
+#include "target.h"
744
+#include "target-def.h"
745
+// #include "tm-constrs.h"
746
+// #include "tm-preds.h"
747
+
748
+#include "diagnostic.h"
749
+// #include "integrate.h"
750
+
751
+// static int  zip_arg_partial_bytes(CUMULATIVE_ARGS *, enum machine_mode, tree, bool);
752
+// static      bool    zip_pass_by_reference(CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool);
753
+static bool    zip_return_in_memory(const_tree, const_tree);
754
+static bool    zip_frame_pointer_required(void);
755
+// static      bool    zip_must_pass_in_stack(enum machine_mode, const_tree);
756
+
757
+// static      void    zip_setup_incoming_varargs(CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int);
758
+static void zip_function_arg_advance(cumulative_args_t ca, enum machine_mode mode,
759
+               const_tree type, bool named);
760
+static rtx zip_function_arg(cumulative_args_t ca, enum machine_mode mode, const_tree type, bool named);
761
+
762
+static void    zip_asm_trampoline_template(FILE *);
763
+static void    zip_trampoline_init(rtx, tree, rtx);
764
+static void    zip_init_builtins(void);
765
+static tree zip_builtin_decl(unsigned, bool);
766
+// static void zip_asm_output_anchor(rtx x);
767
+       void    zip_asm_output_def(FILE *s, const char *n, const char *v);
768
+       void    zip_update_cc_notice(rtx exp, rtx_insn *insn);
769
+static rtx     zip_expand_builtin(tree exp, rtx target, rtx subtarget,
770
+                       enum machine_mode tmode, int    ignore);
771
+static bool    zip_scalar_mode_supported_p(enum machine_mode mode);
772
+static bool    zip_libgcc_floating_mode_supported_p(enum machine_mode mode);
773
+static int     zip_address_cost(rtx addr, enum machine_mode mode, addr_space_t as, bool spd);
774
+static bool    zip_mode_dependent_address_p(const_rtx addr, addr_space_t);
775
+static unsigned HOST_WIDE_INT  zip_const_anchor = 0x20000;
776
+static          HOST_WIDE_INT  zip_min_anchor_offset = -0x20000;
777
+static          HOST_WIDE_INT  zip_max_anchor_offset =  0x1ffff;
778
+static          HOST_WIDE_INT  zip_min_mov_offset = -0x1000;
779
+static          HOST_WIDE_INT  zip_max_mov_offset =  0x0fff;
780
+static int     zip_sched_issue_rate(void) { return 1; }
781
+static bool    zip_legitimate_address_p(machine_mode, rtx, bool);
782
+static bool    zip_legitimate_move_operand_p(machine_mode, rtx, bool);
783
+       void    zip_debug_rtx_pfx(const char *, const_rtx x);
784
+       void    zip_debug_rtx(const_rtx x);
785
+static void    zip_override_options(void);
786
+static bool    zip_can_eliminate(int from ATTRIBUTE_UNUSED, int to);
787
+// static      void    zip_canonicalize_comparison(int *, rtx *, rtx *, bool);
788
+static int     zip_memory_move_cost(machine_mode, reg_class_t, bool);
789
+
790
+
791 103 dgisselq
+#define        ALL_DEBUG_OFF   false
792 102 dgisselq
+#define        ALL_DEBUG_ON    false
793
+
794
+enum ZIP_BUILTIN_ID_CODE {
795
+       ZIP_BUILTIN_RTU,
796
+       ZIP_BUILTIN_HALT,
797
+       ZIP_BUILTIN_IDLE,
798
+       ZIP_BUILTIN_SYSCALL,
799
+       ZIP_BUILTIN_SAVE_CONTEXT,
800
+       ZIP_BUILTIN_RESTORE_CONTEXT,
801
+       ZIP_BUILTIN_BITREV,
802
+       ZIP_BUILTIN_CC,
803
+       ZIP_BUILTIN_MAX
804
+};
805
+
806
+static GTY (()) tree   zip_builtins[(int)ZIP_BUILTIN_MAX];
807
+static enum insn_code  zip_builtins_icode[(int)ZIP_BUILTIN_MAX];
808
+
809
+
810
+#include "gt-zip.h"
811
+
812
+/* The Global 'targetm' Variable. */
813
+struct gcc_target      targetm = TARGET_INITIALIZER;
814
+
815
+
816
+enum   reg_class zip_reg_class(int);
817
+
818
+#define        LOSE_AND_RETURN(msgid, x)               \
819
+       do {                                    \
820
+               zip_operand_lossage(msgid, x);  \
821
+               return;                         \
822
+       } while(0)
823
+
824
+/* Per-function machine data. */
825
+struct GTY(()) machine_function
826
+{
827
+       /* number of pretented arguments for varargs */
828
+       int     pretend_size;
829
+
830
+       /* Number of bytes saved on the stack for local variables. */
831
+       int     local_vars_size;
832
+
833
+       /* Number of bytes saved on stack for register save area */
834
+       int     saved_reg_size;
835
+       int     save_ret;
836
+
837
+       int     sp_fp_offset;
838
+       bool    fp_needed;
839
+       int     size_for_adjusting_sp;
840
+};
841
+
842
+/* Allocate a chunk of memory for per-function machine-dependent data. */
843
+
844
+static struct machine_function *
845
+zip_init_machine_status(void) {
846
+       return ggc_cleared_alloc<machine_function>();
847
+}
848
+
849
+static void
850
+zip_override_options(void)
851
+{
852
+       init_machine_status = zip_init_machine_status;
853
+}
854
+
855
+enum   reg_class
856
+zip_reg_class(int regno)
857
+{
858
+       if (is_ZIP_GENERAL_REG(regno)) {
859
+               return GENERAL_REGS;
860
+       } else if (is_ZIP_REG(regno)) {
861
+               return ALL_REGS;
862
+       } return NO_REGS;
863
+}
864
+
865
+/* Worker function for TARGET_RETURN_IN_MEMORY. */
866
+static bool
867
+zip_return_in_memory(const_tree type, const_tree fntype ATTRIBUTE_UNUSED) {
868
+       const   HOST_WIDE_INT size = int_size_in_bytes(type);
869
+       return (size == -1)||(size > UNITS_PER_WORD);
870
+}
871
+
872
+/* Emit an error emssage when we're in an asm, and a fatal error for "normal"
873
+ * insn.  Formatted output isn't easily implemented, since we use output operand
874
+ * lossage to output the actual message and handle the categorization of the
875
+ * error.  */
876
+
877
+static void
878
+zip_operand_lossage(const char *msgid, rtx op) {
879
+       fprintf(stderr, "Operand lossage??\n");
880
+       debug_rtx(op);
881
+       zip_debug_rtx(op);
882
+       output_operand_lossage("%s", msgid);
883
+}
884
+
885
+/* The PRINT_OPERAND_ADDRESS worker.   */
886
+void
887
+zip_print_operand_address(FILE *file, rtx x) {
888
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
889
+
890
+       if (dbg) zip_debug_rtx(x);
891
+       switch(GET_CODE(x)) {
892
+               case REG:
893
+                       fprintf(file, "(%s)", reg_names[REGNO(x)]);
894
+                       break;
895
+               case SYMBOL_REF:
896
+                       fprintf(file, "%s", XSTR(x,0));
897
+                       break;
898
+               case LABEL_REF:
899
+                       x = LABEL_REF_LABEL(x);
900
+               case CODE_LABEL:
901
+                       { char buf[256];
902
+                       ASM_GENERATE_INTERNAL_LABEL(buf, "L", CODE_LABEL_NUMBER(x));
903
+#ifdef ASM_OUTPUT_LABEL_REF
904
+                       ASM_OUTPUT_LABEL_REF(file, buf);
905
+#else
906
+                       assemble_name(file, buf);
907
+#endif
908
+                       }
909
+                       break;
910
+               case PLUS:
911
+                       if (!REG_P(XEXP(x, 0)))
912
+                               abort();
913
+                       if (CONST_INT_P(XEXP(x, 1))) {
914
+                               if (INTVAL(XEXP(x,1))!=0) {
915
+                                       fprintf(file, "%ld(%s)",
916
+                                       INTVAL(XEXP(x, 1)),
917
+                                       reg_names[REGNO(XEXP(x, 0))]);
918
+                               } else {
919
+                                       fprintf(file, "(%s)",
920
+                                       reg_names[REGNO(XEXP(x, 0))]);
921
+                               }
922
+                       } else if (GET_CODE(XEXP(x,1)) == SYMBOL_REF) {
923
+                               fprintf(file, "%s(%s)", XSTR(x,0),
924
+                                       reg_names[REGNO(XEXP(x, 0))]);
925
+                       } else if ((GET_CODE(XEXP(x, 1)) == MINUS)
926
+                               && (GET_CODE(XEXP(XEXP(x, 1), 0))==SYMBOL_REF)
927
+                               && (GET_CODE(XEXP(XEXP(x, 1), 1))==SYMBOL_REF)) {
928
+                               fprintf(file, "%s-%s(%s)",
929
+                                       XSTR(XEXP(XEXP(x, 1),0),0),
930
+                                       XSTR(XEXP(XEXP(x, 1),1),0),
931
+                                       reg_names[REGNO(XEXP(x, 0))]);
932
+                       } else
933
+                               fprintf(file, "#INVALID(%s)",
934
+                                       reg_names[REGNO(XEXP(x, 0))]);
935
+                       /*
936
+                       else if (GET_CODE(XEXP(addr, 1)) == LABEL)
937
+                               fprintf(file, "%s(%s)",
938
+                                       GET_CODE(XEXP(addr, 1)),
939
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
940
+                       else if ((GET_CODE(XEXP(addr, 1)) == MINUS)
941
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 0))==LABEL)
942
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 1))==LABEL)) {
943
+                               fprintf(file, "%s-%s(%s)",
944
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
945
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
946
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
947
+                       }
948
+                       */
949
+                       break;
950
+               // We don't support direct memory addressing within our
951
+               // instruction set, even though the instructions themselves
952
+               // would support direct memory addressing of the lower 18 bits
953
+               // of memory space.
954
+               case MEM:
955
+                       if (dbg) zip_debug_rtx(x);
956
+                       zip_print_operand_address(file, XEXP(x, 0));
957
+                       break;
958
+               default:
959
+                       abort(); break;
960
+                       // output_addr_const(file, x);
961
+               break;
962
+       }
963
+}
964
+
965
+/* The PRINT_OPERAND worker. */
966
+
967
+void
968
+zip_print_operand(FILE *file, rtx x, int code)
969
+{
970
+       rtx operand = x;
971
+       int     rgoff = 0;
972
+
973
+       // fprintf(file, "Print Operand!\n");
974
+
975
+       /* New code entries should just be added to the switch below.  If
976
+        * handling is finished, just return.  If handling was just a
977
+        * modification of the operand, the modified operand should be put in
978
+        * "operand", and then do a break to let default handling
979
+        * (zero-modifier) output the operand.
980
+        */
981
+       switch(code) {
982
+               case 0:
983
+                       /* No code, print as usual. */
984
+                       break;
985
+               case 'L':
986
+                       /* Lower of two registers, print one up */
987
+                       rgoff = 1;
988
+                       break;
989
+               case 'R':
990
+               case 'H':
991
+                       /* Higher of a register pair, print normal */
992
+                       break;
993
+
994
+               default:
995
+                       LOSE_AND_RETURN("invalid operand modifier letter", x);
996
+       }
997
+
998
+       /* Print an operand as without a modifier letter. */
999
+       switch (GET_CODE(operand)) {
1000
+       case REG:
1001
+               if (REGNO(operand)+rgoff >= FIRST_PSEUDO_REGISTER)
1002
+                       internal_error("internal error: bad register: %d", REGNO(operand));
1003
+               fprintf(file, "%s", reg_names[REGNO(operand)+rgoff]);
1004
+               return;
1005
+       case SCRATCH:
1006
+               LOSE_AND_RETURN("Need a scratch register", x);
1007
+               return;
1008
+
1009
+       case CODE_LABEL:
1010
+       case LABEL_REF:
1011
+       case SYMBOL_REF:
1012
+       case PLUS:
1013
+               PRINT_OPERAND_ADDRESS(file, operand);
1014
+               return;
1015
+       case MEM:
1016
+               PRINT_OPERAND_ADDRESS(file, XEXP(operand, 0));
1017
+               return;
1018
+
1019
+       default:
1020
+               /* No need to handle all strange variants, let
1021
+                * output_addr_const do it for us.
1022
+                */
1023
+               if (CONSTANT_P(operand)) {
1024
+                       output_addr_const(file, operand);
1025
+                       return;
1026
+               }
1027
+
1028
+               LOSE_AND_RETURN("unexpected operand", x);
1029
+       }
1030
+}
1031
+
1032
+static bool
1033
+zip_frame_pointer_required(void)
1034
+{
1035
+       // This should really depend upon whether we have variable sized
1036
+       // arguments in our frame or not.  Once this fails, let's look
1037
+       // at what the problem was and then whether or not we can detect
1038
+       // it.
1039
+       //
1040
+       // Use a GCC global to determine our answer
1041 103 dgisselq
+       if (cfun->calls_alloca)
1042
+               return true;
1043 102 dgisselq
+       return (frame_pointer_needed);
1044
+/*
1045
+       fprintf(stderr, "ZIP_FRAME_POINTER_REQUIRED()\n");
1046
+       if (frame_pointer_needed) {
1047
+               fprintf(stderr, "FRAME_POINTER_NEEDED is true\n");
1048
+               zip_debug_rtx(frame_pointer_rtx);
1049
+               if (frame_pointer_rtx == NULL_RTX)
1050
+                       return true;
1051
+               if (GET_CODE(frame_pointer_rtx)==PLUS) {
1052
+                       if ((REG_P(XEXP(frame_pointer_rtx,0)))
1053
+                               &&(REGNO(XEXP(frame_pointer_rtx, 0))==zip_SP)
1054
+                               &&(CONST_INT_P(XEXP(frame_pointer_rtx,1))))
1055
+                               return false;
1056
+                       if ((REG_P(XEXP(frame_pointer_rtx,1)))
1057
+                               &&(REGNO(XEXP(frame_pointer_rtx, 1))==zip_SP)
1058
+                               &&(CONST_INT_P(XEXP(frame_pointer_rtx,0))))
1059
+                               return false;
1060
+                       return true;
1061
+               } else if ((REG_P(frame_pointer_rtx))
1062
+                               &&(REGNO(frame_pointer_rtx) == zip_SP))
1063
+                       return false;
1064
+               return true;
1065
+       } else return false;
1066
+*/
1067
+}
1068
+
1069
+/* Determine whether or not a register needs to be saved on the stack or not.
1070
+ */
1071
+static bool
1072
+zip_save_reg(int regno) {
1073
+       if (regno == 0)
1074
+               return ((!crtl->is_leaf)
1075
+                       ||((df_regs_ever_live_p(0))&&(!call_used_regs[0])));
1076
+       else if ((regno == zip_GOT)&&(!ZIP_PIC))
1077
+               return  ((df_regs_ever_live_p(regno))
1078
+                               &&(!call_used_regs[regno]));
1079
+       else if (regno == zip_FP)
1080
+               return((zip_frame_pointer_required())||((df_regs_ever_live_p(regno))
1081
+                               &&(!call_used_regs[regno])));
1082
+       else if (regno < zip_FP)
1083
+               return  ((df_regs_ever_live_p(regno))
1084
+                               &&(!call_used_regs[regno]));
1085
+       return false;
1086
+}
1087
+
1088
+/* Compute the size of the local area and the size to be adjusted by the
1089
+ * prologue and epilogue.
1090
+ *
1091
+ * Here's what we are looking at (top is the current, bottom is the last ...)
1092
+ *
1093
+ *     Stack Pointer ->
1094
+ *                     Local variables (could be variable size)
1095
+ *     Frame Pointer ->        (= Stack Pointer + sp_fp_offset)
1096
+ *                     Saved return address, if saved
1097
+ *                     Other Saved registers
1098
+ *                     Saved frame pointer (if used)
1099
+ *                     Saved R12, if used
1100
+ *                     (Stack pointer is not saved)
1101
+ *     Original stack pointer ->       (= Stack_Pointer +size_for_adjusting_sp)
1102
+ *                     Called arguments (not passed in registers)
1103
+ *                     Return arguments (not R1, args.pretend_args_size)
1104
+ *             (Prior function's stack frame ... )
1105
+ *
1106
+ */
1107
+static void
1108
+zip_compute_frame(void) {
1109
+       int     regno;
1110
+       int     args_size;
1111
+
1112
+       // gcc_assert(crtl);
1113
+       gcc_assert(cfun);
1114
+       gcc_assert(cfun->machine);
1115
+
1116
+       args_size=(ACCUMULATE_OUTGOING_ARGS ? crtl->outgoing_args_size : 0);
1117
+
1118
+       if(crtl->args.pretend_args_size > 0) {
1119
+               args_size += crtl->args.pretend_args_size;
1120
+               // printf("%s pretend_args_size : %d\n", current_function_name(),
1121
+                       // crtl->args.pretend_args_size);
1122
+               cfun->machine->pretend_size = crtl->args.pretend_args_size;
1123
+       }
1124
+
1125
+       cfun->machine->local_vars_size = get_frame_size();
1126
+
1127
+       // Save callee-saved registers.
1128
+       cfun->machine->saved_reg_size = 0;
1129
+       for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1130
+               if (zip_save_reg(regno))
1131
+                       cfun->machine->saved_reg_size ++;
1132
+       }
1133
+
1134
+       cfun->machine->fp_needed = (zip_frame_pointer_required());
1135
+
1136
+       if ((cfun->machine->fp_needed)&&
1137
+                       (!df_regs_ever_live_p(zip_FP))) {
1138
+               cfun->machine->saved_reg_size ++;
1139
+       }
1140
+
1141
+       cfun->machine->sp_fp_offset = args_size + cfun->machine->local_vars_size;
1142
+       cfun->machine->size_for_adjusting_sp = cfun->machine->local_vars_size
1143
+                       + cfun->machine->saved_reg_size
1144
+                       + args_size;
1145
+
1146
+       /*
1147
+       if (cfun->machine->fp_needed)
1148
+               frame_pointer_rtx = gen_rtx_REG(Pmode, zip_FP);
1149
+       else
1150
+               frame_pointer_rtx = plus_constant(Pmode, gen_rtx_REG(Pmode, zip_SP),
1151
+                       cfun->machine->sp_fp_offset);
1152
+       */
1153
+}
1154
+
1155
+void
1156
+zip_expand_prologue(void) {
1157
+       rtx     insn;
1158
+
1159
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1160
+       zip_compute_frame();
1161
+
1162 103 dgisselq
+       if (dbg)  fprintf(stderr, "Computing Prologue instructions\n");
1163 102 dgisselq
+       if (cfun->machine->size_for_adjusting_sp != 0) {
1164
+               insn = emit_insn(gen_subsi3(stack_pointer_rtx,
1165
+                               stack_pointer_rtx,
1166
+                       gen_int_mode(cfun->machine->size_for_adjusting_sp,
1167
+                               SImode)));
1168
+                       // cfun->machine->sp_fp_offset
1169
+
1170
+               RTX_FRAME_RELATED_P(insn) = 1;
1171
+       }
1172
+
1173
+       {
1174
+               int offset = 0, regno;
1175
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1176
+                       if (zip_save_reg(regno)) {
1177
+                               insn=emit_insn(gen_movsi_sto(
1178
+                                       gen_rtx_MEM(SImode, plus_constant(
1179
+                                               Pmode, stack_pointer_rtx,
1180
+                                               cfun->machine->sp_fp_offset
1181
+                                               +offset++, true)),
1182
+                                       gen_rtx_REG(SImode, regno)));
1183
+                               RTX_FRAME_RELATED_P(insn) = 1;
1184
+                       }
1185
+               }
1186 103 dgisselq
+               if (dbg)  fprintf(stderr, "%d registers saved%s\n", offset,
1187
+                       (crtl->saves_all_registers)?", should be all of them":", less than all");
1188 102 dgisselq
+       }
1189
+
1190
+       if (cfun->machine->fp_needed) {
1191
+               if (dbg) zip_debug_rtx(stack_pointer_rtx);
1192
+               if (dbg) zip_debug_rtx(frame_pointer_rtx);
1193
+               insn = emit_insn(gen_movsi_reg_off(frame_pointer_rtx,
1194
+                               stack_pointer_rtx, gen_int_mode(
1195
+                                               cfun->machine->sp_fp_offset,
1196
+                                               SImode)));
1197
+               RTX_FRAME_RELATED_P(insn) = 1;
1198 103 dgisselq
+               if (dbg)  fprintf(stderr, "sp_fp_offset is %d\n", cfun->machine->sp_fp_offset);
1199 102 dgisselq
+       }
1200
+}
1201
+
1202
+bool
1203
+zip_use_return_insn(void)
1204
+{
1205
+       if ((!reload_completed)||(cfun->machine->fp_needed)
1206
+                       ||(get_frame_size()!=0)) {
1207
+               // If R0 ever gets pushed to the stack, then we cannot
1208
+               // use a master return from anywhere.  We need to clean up the
1209
+               // stack first.
1210
+               if ((!crtl->is_leaf)||((df_regs_ever_live_p(0))
1211
+                                               &&(!call_used_regs[0]))) {
1212
+                       return false;
1213
+               }
1214
+       }
1215
+       zip_compute_frame();
1216
+       return (cfun->machine->size_for_adjusting_sp == 0);
1217
+}
1218
+
1219
+/* As per the notes in M68k.c, quote the function epilogue should not depend
1220
+ * upon the current stack pointer.  It should use the frame poitner only,
1221
+ * if there is a frame pointer.  This is mandatory because of alloca; we also
1222
+ * take advantage of it to omit stack adjustments before returning ...
1223
+ *
1224
+ * Let's see if we can use their approach here.
1225
+ *
1226
+ * We can't.  Consider our choices:
1227
+ *     LOD (FP),R0
1228
+ *     LOD 1(FP),R4
1229
+ *     LOD 2(FP),R5
1230
+ *     LOD 3(FP),R6
1231
+ *     LOD 4(FP),FP
1232
+ *     ... Then what is the stack pointer?
1233
+ * or
1234
+ *     LOD (FP),R0
1235
+ *     LOD 1(FP),R4
1236
+ *     LOD 2(FP),R5
1237
+ *     LOD 3(FP),R6
1238
+ *     MOV FP,SP
1239
+ *     LOD 4(SP),FP
1240
+ *     ... Which suffers unnecessary pipeline stalls, and certainly doesn't
1241
+ *     exploit our pipeline memory function
1242
+ * or
1243
+ *     MOV FP,SP
1244
+ *     LOD (SP),R0
1245
+ *     LOD 1(SP),R4
1246
+ *     LOD 2(SP),R5
1247
+ *     LOD 3(SP),R6
1248
+ *     LOD 4(SP),FP
1249
+ * Which will be our choice.  Note that we do use the stack pointer, eventually.
1250
+ *
1251
+ */
1252
+void
1253
+zip_expand_epilogue(void) {
1254
+       int     regno, offset;
1255
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1256
+
1257
+       zip_compute_frame();
1258
+
1259
+       if (dbg) fprintf(stderr, "EPILOG::\n");
1260
+       if (cfun->machine->fp_needed) {
1261
+               if (dbg) fprintf(stderr, "EPILOG::Moving frame pointer to stack register\n");
1262
+               emit_insn(gen_movsi_reg(stack_pointer_rtx, frame_pointer_rtx));
1263
+       }
1264
+
1265
+       if (cfun->machine->saved_reg_size != 0) {
1266
+               offset =  (cfun->machine->size_for_adjusting_sp -
1267
+                               cfun->machine->sp_fp_offset
1268
+                       - cfun->machine->saved_reg_size);
1269
+               if (dbg) fprintf(stderr, "EPILOG::Saved_REG_Size = %d\n", cfun->machine->saved_reg_size);
1270
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1271
+                       if (zip_save_reg(regno)) {
1272
+                               if (dbg) fprintf(stderr, "EPILOG::RESTORING R%d\n", regno);
1273
+                               emit_insn(gen_movsi_lod(
1274
+                                               gen_rtx_REG(SImode, regno),
1275
+                                       gen_rtx_MEM(SImode, plus_constant( SImode,
1276
+                                               stack_pointer_rtx, offset++, true))));
1277
+                       }
1278
+               }
1279
+       }
1280
+
1281
+       if (cfun->machine->size_for_adjusting_sp != 0) {
1282
+               if (dbg) fprintf(stderr, "EPILOG::ADDSI3(StackPtr, %d)\n",
1283
+                               cfun->machine->size_for_adjusting_sp);
1284
+               emit_insn(gen_addsi3(stack_pointer_rtx, stack_pointer_rtx,
1285
+                       gen_int_mode(
1286
+                               cfun->machine->size_for_adjusting_sp
1287
+                               -cfun->machine->sp_fp_offset, SImode)));
1288
+       }
1289
+       if (dbg) fprintf(stderr, "EPILOG::EMITTING-RETURN\n");
1290
+
1291
+       emit_jump_insn(ret_rtx);
1292
+}
1293
+
1294
+/* Implement RETURN_ADDR_RTX(COUNT, FRAMEADDR).
1295
+ *
1296
+ * We currently only support calculating the return address for the current
1297
+ * frame.
1298
+ */
1299
+
1300
+/*
1301
+rtx
1302
+zip_return_addr_rtx(int count, rtx frame ATTRIBUTE_UNUSED)
1303
+{
1304
+       if (count)
1305
+               return NULL_RTX;
1306
+
1307
+       zip_compute_frame();
1308
+
1309
+       // saved return address for current function is at fp - 1
1310
+       if (cfun->machine->save_ret)
1311
+               return gen_rtx_MEM(Pmode, plus_constant(frame_pointer_rtx,
1312
+                               -UNITS_PER_WORD));
1313
+       return get_hard_reg_initial_val(Pmode, RETURN_ADDRESS_REGNUM);
1314
+}
1315
+*/
1316
+
1317
+/* Implements the macro INITIAL_ELIMINATION_OFFSET,
1318
+ * return the OFFSET.
1319
+ */
1320
+/*
1321
+int
1322
+zip_initial_elimination_offset(int from, int to) {
1323
+       int     ret = 0;
1324
+       zip_compute_frame();
1325
+
1326
+       if (((from) == FRAME_POINTER_REGNUM)&&((to) == STACK_POINTER_REGNUM)) {
1327
+               ret = cfun->machine->sp_fp_offset;
1328
+       } else if (((from)=ARG_POINTER_REGNUM)&&((to)==FRAME_POINTER_REGNUM)) {
1329
+               ret = cfun->machine->local_vars_size;
1330
+       } else {
1331
+               abort();
1332
+       }
1333
+
1334
+       return ret;
1335
+}
1336
+*/
1337
+
1338
+/* Return non-zero if the function argument described by TYPE is to be passed
1339
+ * by reference.
1340
+ */
1341
+/*
1342
+static bool
1343
+zip_pass_by_reference(CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
1344
+               enum machine_mode mode, const_tree type,
1345
+               bool name ATTRIBUTE_UNUSED) {
1346
+       unsigned        HOST_WIDE_INT   size;
1347
+
1348
+       if (type) {
1349
+               if (AGGREGATE_TYPE_P(type)) {
1350
+                       return TRUE;
1351
+               } size = int_size_in_bytes(type);
1352
+       } else
1353
+               size = GET_MODE_SIZE(mode);
1354
+
1355
+       return (size > GET_MODE_SIZE(SImode)); // > 1 word : is this okay?
1356
+       // The idea is to pass everything larger than an int by reference (or
1357
+       // on the stack)
1358
+}
1359
+*/
1360
+
1361
+/*
1362
+ * Code taken from m68k ...
1363
+ */
1364
+static bool
1365
+zip_can_eliminate(int from, int to)
1366
+{
1367
+       // fprintf(stderr, "CAN_ELIMINATE::QUERYING(%d,%d)\n", from, to);
1368
+       if ((from == zip_FP)&&(to == zip_SP))
1369
+               return !cfun->machine->fp_needed;
1370
+       return true;
1371
+}
1372
+
1373
+/*
1374
+static bool
1375
+zip_must_pass_in_stack(enum machine_mode mode, const_tree type)
1376
+{
1377
+       if (mode == BLKmode) {
1378
+               return true;
1379
+       } if (type == NULL) {
1380
+               return false;
1381
+       } return AGGREGATE_TYPE_P(type);
1382
+}
1383
+*/
1384
+
1385
+/*
1386
+static void
1387
+zip_basic_check(void)
1388
+{
1389
+       gcc_assert(mode_base_align[SImode]==4);
1390
+       if ((BITS_PER_UNIT != 32)
1391
+                       ||(GET_MODE_SIZE(SImode)!=1)
1392
+                       ||(GET_MODE_SIZE(DImode)!=1)
1393
+                       ||(HARD_REGNO_NREGS(0,SImode)!=1)) {
1394
+               printf("SIZEOF(SIMode) == %d\n", GET_MODE_SIZE(SImode));
1395
+               printf("BITS_PER_UNIT  == %d\n", BITS_PER_UNIT);
1396
+               gcc_assert(BITS_PER_UNIT==32);
1397
+               gcc_assert(GET_MODE_SIZE(SImode)==1);
1398
+               gcc_assert(HARD_REGNO_NREGS(0,SImode)==1);
1399
+       }
1400
+}
1401
+*/
1402
+
1403
+#define        zip_basic_check()
1404
+
1405
+/* Compute the number of word sized regiters needed to hold a function
1406
+ * argument of mode INT_MODE and tree type TYPE.
1407
+ */
1408
+int
1409
+zip_num_arg_regs(enum machine_mode mode, const_tree type) {
1410
+       int     size;
1411
+
1412
+       zip_basic_check();
1413
+
1414
+       if (targetm.calls.must_pass_in_stack(mode, type))
1415
+               return 0;
1416
+
1417
+       if ((type)&&(mode == BLKmode))
1418
+               size = int_size_in_bytes(type);
1419
+       else
1420
+               size = GET_MODE_SIZE(mode);
1421
+
1422
+       return (size + UNITS_PER_WORD - 1)/UNITS_PER_WORD;
1423
+}
1424
+
1425
+/* pushed in function prologue */
1426
+/*
1427
+static void
1428
+zip_setup_incoming_varargs(CUMULATIVE_ARGS *cum, enum machine_mode mode,
1429
+               tree type, int *pretend_size, int no_rtl) {
1430
+       if (no_rtl)
1431
+               return;
1432
+
1433
+       gcc_assert(mode != BLKmode);
1434
+
1435
+       if (*cum < (ZIP_LAST_ARG_REGNO+1)) {
1436
+               int size = ZIP_FIRST_ARG_REGNO + ZIP_NUM_ARGS_REGS - *cum;
1437
+               rtx     regblock;
1438
+               int     offset = (*cum - ZIP_FIRST_ARG_REGNO) * UNITS_PER_WORD;
1439
+               regblock = gen_rtx_MEM(BLKmode,
1440
+                       plus_constant(arg_pointer_rtx, offset));
1441
+               move_block_from_reg(*cum, regblock, size);
1442
+               *pretend_size = size * UNITS_PER_WORD;
1443
+       }
1444
+
1445
+       if (targetm.calls.strict_argument_naming(cum))
1446
+               *cum = *cum + zip_num_arg_regs(mode, type);
1447
+}
1448
+*/
1449
+
1450
+/*
1451
+static int
1452
+zip_arg_partial_bytes(CUMULATIVE_ARGS *cum, enum machine_mode mode,
1453
+               tree type, bool name ATTRIBUTE_UNUSED) {
1454
+       int     words;
1455
+       unsigned int    regs = zip_num_arg_regs(mode, type);
1456
+
1457
+       if (*cum >= ZIP_LAST_ARG_REGNO + 1)
1458
+               words = 0;
1459
+       else if ((*cum + regs) > ZIP_LAST_ARG_REGNO + 1)
1460
+               words = (*cum + regs) - ZIP_LAST_ARG_REGNO + 1;
1461
+       else
1462
+               words = 0;
1463
+
1464
+       return words * UNITS_PER_WORD;
1465
+}
1466
+*/
1467
+
1468
+static void
1469
+zip_function_arg_advance(cumulative_args_t ca, machine_mode mode,
1470
+               const_tree type, bool named ATTRIBUTE_UNUSED) {
1471
+       CUMULATIVE_ARGS *cum;
1472
+       int     nreg;
1473
+
1474
+       zip_basic_check();
1475
+
1476
+       cum = get_cumulative_args(ca);
1477
+       nreg = zip_num_arg_regs(mode, type);
1478
+       if (((*cum)+nreg) > NUM_ARG_REGS)
1479
+               (*cum) = NUM_ARG_REGS;
1480
+       else
1481
+               (*cum) += nreg;
1482
+}
1483
+
1484
+static rtx
1485
+zip_function_arg(cumulative_args_t ca, machine_mode mode,
1486
+               const_tree type ATTRIBUTE_UNUSED, bool named) {
1487
+       CUMULATIVE_ARGS *cum;
1488
+
1489
+       zip_basic_check();
1490
+
1491
+
1492
+       if (!named)
1493
+               return NULL_RTX;
1494
+       //if (targetm.calls.must_pass_in_stack(mode, type))
1495
+               //return NULL_RTX;
1496
+       cum = get_cumulative_args(ca);
1497
+
1498
+       if ((*cum) >= NUM_ARG_REGS)
1499
+               return NULL_RTX;
1500
+       return
1501
+               gen_rtx_REG(mode, (*cum)+1);
1502
+}
1503
+
1504
+/* NOTICE_UPDATE_CC sends us here
1505
+ */
1506
+void
1507
+zip_update_cc_notice(rtx exp, rtx_insn *insn)
1508
+{
1509
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1510
+       enum    attr_ccresult  ccr;
1511
+       enum    attr_conditional  conditionally_executed;
1512
+
1513
+       // The default is that nothing has changed.
1514
+       // cc_status = cc_status_prev;
1515
+       rtx     src, dest;
1516
+
1517
+       if (dbg) fprintf(stderr, "CC-NOTICE ...\n");
1518
+       if (dbg) zip_debug_rtx_pfx("CC :", exp);
1519
+       if (dbg) debug_rtx(exp);
1520
+
1521
+       ccr = get_attr_ccresult(insn);
1522
+       if (ccr == CCRESULT_UNKNOWN) {
1523
+               CC_STATUS_INIT;
1524
+               if (dbg) fprintf(stderr, "\tINIT-CC\n");
1525
+               return;
1526
+       } else if (ccr == CCRESULT_UNCHANGED) {
1527
+               if (dbg) fprintf(stderr, "\tUnchanged CC\n");
1528
+               return;
1529
+       }
1530
+
1531
+       if ((GET_CODE(exp) == PARALLEL)&&(GET_CODE(XVECEXP(exp, 0, 0))==SET)) {
1532
+               // This works up and until we add cc0 parallel instructions
1533
+               // to our instruction set.
1534
+               dest = SET_DEST(XVECEXP(exp, 0, 0));
1535
+               src  = SET_SRC (XVECEXP(exp, 0, 0));
1536
+       } else if (GET_CODE(exp) == SET) {
1537
+               dest = SET_DEST(exp);
1538
+               src  = SET_SRC (exp);
1539
+       } else {
1540
+               // First, do nothing if we haven't touched the condition codes.
1541
+               // Condition codes can only be changed as a result of a set
1542
+               // expression ...?
1543
+               if (dbg) fprintf(stderr, "Non-set expression, doesn\'t touch condition codes\n");
1544
+               return;
1545
+       }
1546
+
1547
+       // Gotta wait on this test, until we know whether or not the
1548
+       // conditionally executed instruction was designed to set the
1549
+       // CC0 register.
1550
+       conditionally_executed = get_attr_conditional(insn);
1551
+       if ((conditionally_executed == CONDITIONAL_YES)&&(dest != cc0_rtx)) {
1552
+               // cc_status is unchanged
1553
+               if (dbg) fprintf(stderr, "\tCC -- unchanged (conditional exec)\n");
1554
+               return;
1555
+       }
1556
+
1557
+       if (ccr == CCRESULT_VALIDZN)
1558
+               cc_status.flags = CC_NO_OVERFLOW;
1559
+       else
1560
+               cc_status.flags = 0;
1561
+       cc_status.value1 = dest;
1562
+       if (dest == cc0_rtx)
1563
+               cc_status.value2 = src;
1564
+       else if((REG_P(dest))&&(!reg_mentioned_p(dest, src)))
1565
+               cc_status.value2 = src;
1566
+       else if((SUBREG_P(dest))&&(!reg_mentioned_p(XEXP(dest,0), src)))
1567
+               cc_status.value2 = src;
1568
+       else
1569
+               cc_status.value2 = 0;
1570
+       if (dbg) fprintf(stderr, "\tCC -- Set flags for\n");
1571
+       if (dbg) zip_debug_rtx_pfx("V1: ", dest);
1572
+       if ((dbg)&&(cc_status.value2)) zip_debug_rtx_pfx("V2: ", src);
1573
+       else if (dbg)   fprintf(stderr, "V2: (No SRC)\n");
1574
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "src refers to dest ?? %s\n",
1575
+               refers_to_regno_p(REGNO(dest),REGNO(dest),src,NULL)?"Yes":"No");
1576
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "Occurrs %d times\n",
1577
+               count_occurrences(dest,src,0));
1578
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "%s mentioned\n",
1579
+               reg_mentioned_p(dest,src)?"Is":"Is not");
1580
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "%s referenced\n",
1581
+               reg_referenced_p(dest,src)?"Is":"Is not");
1582
+
1583
+//
1584
+// These results are only used in final.c, where they are used to remove
1585
+// compare instructions if the optimizer is on.  If I produce nothing, no
1586
+// compare instructions will be removed.  If I produce something, a smart
1587
+// decision may be made to remove compare instructions.
1588
+//
1589
+// cc_status will be compared  with subsequent
1590
+//     (set (cc0) (something)) (i.e. compare only) instructions
1591
+//
1592
+//     (set (cc0) (compare (x) (y)))
1593
+//     dst = cc0 -- the destination of the set is ignored, save that it must be
1594
+//             cc0
1595
+//     src1 = (compare (x) (y))
1596
+//     if (src1 == compare)&&(y == (const_int 0))
1597
+//             src2 = (x)
1598
+//     else
1599
+//             src2 = null
1600
+//
1601
+//     Four conditions:
1602
+//     1. if (val1)&&(src1 == val1)
1603
+//             This would be true if I had seen a (set (val1) (src1)) insn
1604
+//             If I have seen a (set (val1) (src1))
1605
+//                     or equivalently a (set (val1) (compare (x) (y)))
1606
+//     or
1607
+//     2. if (val2)&&(src1 == val2)
1608
+//             This would be true if I had seen a (set (val1) (src1)) insn,
1609
+//             and only if val2 was still valid.
1610
+//     or
1611
+//     3. if (src2)&&(value1)&&(src2 == value1)
1612
+//             This would be true if we are comparing against zero, and the
1613
+//             number we are comparing against zero is value 1
1614
+//     or
1615
+//     4. if (src2)&&(value2)&&(src2 == value2)
1616
+//             ... or value2.  This is the common ZipCPU case.
1617
+//
1618
+//             then delete the compare.
1619
+//
1620
+}
1621
+
1622
+
1623
+/* totally buggy - we can't return pointers to nested functions */
1624
+static void
1625
+zip_asm_trampoline_template(FILE *f) {
1626
+       // Whereas at one time I thought I wouldn't need it, now I know I
1627
+       // need this trampoline function, although it is for a completely
1628
+       // different purpose than the one I was familiar with.
1629
+       fprintf(f, "\tldihi 0,r1\n");
1630
+       fprintf(f, "\tldilo 0,r1\n");
1631
+       fprintf(f, "\tjmp r1\n");
1632
+}
1633
+
1634
+/* Worker function for TARGET_TRAMPOLINE_INIT. */
1635
+static void
1636
+zip_trampoline_init(rtx m_tramp ATTRIBUTE_UNUSED,
1637
+       tree fndecl ATTRIBUTE_UNUSED,
1638
+       rtx chain_value ATTRIBUTE_UNUSED) {
1639
+// #warning "This needs to be filled out"
1640
+       abort();
1641
+}
1642
+
1643
+static tree
1644
+def_builtin(const char *name, enum insn_code icode, enum ZIP_BUILTIN_ID_CODE code,
1645
+       tree type)
1646
+{
1647
+       tree t = add_builtin_function(name,type,code,BUILT_IN_MD, NULL, NULL_TREE);
1648
+       zip_basic_check();
1649
+
1650
+       if(t) {
1651
+               zip_builtins[code] = t;
1652
+               zip_builtins_icode[code] = icode;
1653
+       }
1654
+
1655
+       return t;
1656
+
1657
+}
1658
+
1659
+void   zip_init_builtins(void) {
1660
+       zip_basic_check();
1661
+
1662
+  tree void_ftype_void = build_function_type_list(void_type_node, NULL_TREE);
1663
+#ifdef HAVE_zip_rtu
1664
+  def_builtin("zip_rtu", CODE_FOR_zip_rtu, ZIP_BUILTIN_RTU, void_ftype_void);
1665
+#endif
1666
+#ifdef HAVE_zip_halt
1667
+  def_builtin("zip_halt",  CODE_FOR_zip_halt,  ZIP_BUILTIN_HALT, void_ftype_void);
1668
+#endif
1669
+#ifdef HAVE_zip_idle
1670
+  def_builtin("zip_idle", CODE_FOR_zip_idle, ZIP_BUILTIN_IDLE, void_ftype_void);
1671
+#endif
1672
+
1673
+#ifdef HAVE_zip_syscall
1674
+// Support int SYSCALL(callID, int a, int b, int c);
1675
+  def_builtin("zip_syscall", CODE_FOR_zip_syscall, ZIP_BUILTIN_SYSCALL,
1676
+                       build_function_type_list(void_type_node, NULL_TREE));
1677
+#endif
1678
+
1679
+#ifdef HAVE_zip_save_context
1680
+  def_builtin("zip_save_context", CODE_FOR_zip_save_context, ZIP_BUILTIN_SAVE_CONTEXT,
1681
+               build_function_type_list(void_type_node, ptr_type_node, 0));
1682
+#endif
1683
+
1684
+#ifdef HAVE_zip_restore_context
1685
+  def_builtin("zip_restore_context", CODE_FOR_zip_restore_context, ZIP_BUILTIN_RESTORE_CONTEXT,
1686
+       build_function_type_list(void_type_node, ptr_type_node, 0));
1687
+#endif
1688
+
1689
+#ifdef HAVE_zip_bitrev
1690
+  def_builtin("zip_bitrev", CODE_FOR_zip_bitrev, ZIP_BUILTIN_BITREV,
1691
+       build_function_type_list(unsigned_type_node, unsigned_type_node,
1692
+               NULL_TREE));
1693
+#endif
1694
+
1695
+#ifdef HAVE_zip_cc
1696
+  def_builtin("zip_cc", CODE_FOR_zip_cc, ZIP_BUILTIN_CC,
1697
+       build_function_type_list(unsigned_type_node, NULL_TREE));
1698
+#endif
1699
+
1700
+}
1701
+
1702
+static tree
1703
+zip_builtin_decl(unsigned zip_builtin_code, bool initialize_p ATTRIBUTE_UNUSED)
1704
+{
1705
+  if (zip_builtin_code >= ZIP_BUILTIN_MAX)
1706
+    return error_mark_node;
1707
+
1708
+  return zip_builtins[zip_builtin_code];
1709
+}
1710
+
1711
+static rtx
1712
+zip_expand_builtin(tree exp, rtx target,
1713
+               rtx subtarget ATTRIBUTE_UNUSED,
1714
+               machine_mode tmode ATTRIBUTE_UNUSED,
1715
+               int     ignore ATTRIBUTE_UNUSED) {
1716
+
1717
+       tree    fndecl = TREE_OPERAND(CALL_EXPR_FN(exp), 0);
1718
+       bool    nonvoid = (TREE_TYPE(TREE_TYPE(fndecl)) != void_type_node);
1719
+       enum    ZIP_BUILTIN_ID_CODE code=(enum ZIP_BUILTIN_ID_CODE)DECL_FUNCTION_CODE(fndecl);
1720
+       enum    insn_code icode = zip_builtins_icode[code];
1721
+       rtx     pat, op[5];
1722
+       call_expr_arg_iterator  iter;
1723
+       tree    arg;
1724
+
1725
+       if ((code == ZIP_BUILTIN_SAVE_CONTEXT)
1726
+                       ||(code == ZIP_BUILTIN_RESTORE_CONTEXT)) {
1727
+               arg = first_call_expr_arg(exp, &iter);
1728
+               if (arg == error_mark_node)
1729
+                       return NULL_RTX;
1730
+               op[0] = expand_normal(arg);
1731
+               if (GET_CODE(op[0]) != REG)
1732
+                       op[0] = force_reg(Pmode, op[0]);
1733
+               pat = GEN_FCN(icode)(op[0]);
1734
+       } else if (code == ZIP_BUILTIN_BITREV) {
1735
+               arg = first_call_expr_arg(exp, &iter);
1736
+               if (arg == error_mark_node) {
1737
+                       return NULL_RTX;
1738
+               }
1739
+               op[0] = expand_normal(arg);
1740
+               if (!target)
1741
+                       target = gen_reg_rtx(SImode);
1742
+               pat = GEN_FCN(icode)(target, op[0]);
1743
+       } else if (code == ZIP_BUILTIN_CC) {
1744
+               if (!target)
1745
+                       target = gen_reg_rtx(SImode);
1746
+               pat = GEN_FCN(icode)(target);
1747
+       } else // RTU, HALT, IDLE
1748
+               pat = GEN_FCN(icode)();
1749
+       if (!pat)
1750
+               return NULL_RTX;
1751
+       emit_insn(pat);
1752
+       return (nonvoid ? target : const0_rtx);
1753
+}
1754
+
1755
+static bool
1756
+zip_scalar_mode_supported_p(enum machine_mode mode) {
1757
+       zip_basic_check();
1758
+
1759
+       return ((mode)==SImode)||((mode)==DImode); // ||((mode)==SFmode);
1760
+}
1761
+
1762
+static bool
1763
+zip_libgcc_floating_mode_supported_p(enum machine_mode mode) {
1764
+       return ((mode)==SFmode)||((mode)==DFmode);
1765
+}
1766
+
1767
+static int
1768
+zip_address_cost(rtx addr ATTRIBUTE_UNUSED,
1769
+       enum machine_mode mode ATTRIBUTE_UNUSED,
1770
+       addr_space_t as ATTRIBUTE_UNUSED, bool spd ATTRIBUTE_UNUSED) {
1771
+       return 1;
1772
+}
1773
+
1774
+static bool
1775
+zip_mode_dependent_address_p(const_rtx addr ATTRIBUTE_UNUSED,
1776
+       addr_space_t as ATTRIBUTE_UNUSED) {
1777
+       return false;
1778
+}
1779
+
1780
+/*
1781
+static void
1782
+zip_asm_output_anchor(rtx x) {
1783
+       printf("ANCHOR: OP(%d)\n", GET_CODE(x));
1784
+}
1785
+*/
1786
+
1787
+static void
1788
+zip_debug_print(const char *pfx, int lvl, const char *str) {
1789
+       int     i;
1790
+       i = lvl;
1791
+       if ((true)||(lvl == 0))
1792
+               fprintf(stderr, "%s", pfx);
1793
+       else
1794
+               i += strlen(pfx);
1795
+       while(i-->0)
1796
+               fprintf(stderr, "  ");
1797
+       fprintf(stderr, "%s\n", str);
1798
+}
1799
+
1800
+static void
1801
+zip_debug_print_m(const char *pfx, int lvl, const char *str, enum machine_mode m) {
1802
+       int     i;
1803
+
1804
+       i = lvl;
1805
+       if ((true)||(lvl == 0))
1806
+               fprintf(stderr, "%s", pfx);
1807
+       else
1808
+               i = lvl+strlen(pfx);
1809
+       while(i-->0)
1810
+               fprintf(stderr, "  ");
1811
+       switch(m) {
1812
+               case VOIDmode:
1813
+                       fprintf(stderr, "%s:V\n", str);
1814
+                       break;
1815
+               case BLKmode:
1816
+                       fprintf(stderr, "%s:BLK\n", str);
1817
+                       break;
1818
+               case BImode:
1819
+                       fprintf(stderr, "%s:BI\n", str);
1820
+                       break;
1821
+#ifdef HAVE_QImode
1822
+               case QImode:
1823
+                       fprintf(stderr, "%s:QI\n", str);
1824
+                       break;
1825
+#endif
1826
+#ifdef HAVE_HImode
1827
+               case HImode:
1828
+                       fprintf(stderr, "%s:HI\n", str);
1829
+                       break;
1830
+#endif
1831
+               case SImode:
1832
+                       fprintf(stderr, "%s:SI\n", str);
1833
+                       break;
1834
+               case DImode:
1835
+                       fprintf(stderr, "%s:DI\n", str);
1836
+                       break;
1837
+               default:
1838
+                       fprintf(stderr, "%s:?\n", str);
1839
+       }
1840
+}
1841
+
1842
+static void
1843
+zip_debug_rtx_1(const char *pfx, const_rtx x, int lvl) {
1844
+       if (x == NULL_RTX) {
1845
+               zip_debug_print(pfx, lvl, "(NULL-RTX)");
1846
+               return;
1847
+       } else if (GET_CODE(x) > NUM_RTX_CODE) {
1848
+               char    buf[64];
1849
+               sprintf(buf, "(BAD-RTX-CODE %d)", GET_CODE(x));
1850
+               zip_debug_print(pfx, lvl, buf);
1851
+               return;
1852
+       } switch(GET_CODE(x)) { // rtl.def
1853
+       case PARALLEL: zip_debug_print(pfx, lvl, "(PARALLEL");
1854
+               debug_rtx(x); break;
1855
+       case INT_LIST: zip_debug_print(pfx, lvl, "(INT-LIST"); break;
1856
+       case SEQUENCE: zip_debug_print(pfx, lvl, "(SEQUENCE"); break;
1857
+       case ADDRESS: zip_debug_print(pfx, lvl, "(ADDRESS"); break;
1858
+       case DEBUG_INSN: zip_debug_print(pfx, lvl, "(DEBUG-INSN"); break;
1859
+       case INSN:
1860
+               zip_debug_print(pfx, lvl, "(INSN");
1861
+               /*
1862
+               { const rtx_insn *tmp_rtx;
1863
+               for(tmp_rtx = as_a <const rtx_insn *>(x); tmp_rtx != 0; tmp_rtx = NEXT_INSN(tmp_rtx)) {
1864
+                       zip_debug_rtx_1(tmp_rtx, lvl+1);
1865
+               }}
1866
+               */
1867
+               zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
1868
+               debug_rtx(x);
1869
+               zip_debug_print(pfx, lvl, ")");
1870
+               break;
1871
+       case JUMP_INSN: zip_debug_print(pfx, lvl, "(JUMP-INSN");
1872
+               if (JUMP_LABEL(x)) {
1873
+                       zip_debug_print(pfx, lvl+1, "(w/Label)");
1874
+               } else
1875
+                       zip_debug_print(pfx, lvl+1, "(NO label)");
1876
+               break;
1877
+       case CALL:
1878
+               zip_debug_print(pfx, lvl, "(CALL (Adr) (Args)");
1879
+               zip_debug_rtx_1(pfx, XEXP(x,0), lvl+1);
1880
+               zip_debug_rtx_1(pfx, XEXP(x,1), lvl+1);
1881
+               zip_debug_print(pfx, lvl, ")");
1882
+               break;
1883
+       case CALL_INSN: zip_debug_print(pfx, lvl, "(CALL-INSN");
1884
+               debug_rtx(x);
1885
+               break;
1886
+       case BARRIER: zip_debug_print(pfx, lvl, "(BARRIER)"); break;
1887
+       case RETURN: zip_debug_print(pfx, lvl, "(RETURN)"); break;
1888
+       case NOTE:
1889
+               {       char buf[128];
1890
+                       sprintf(buf, "(NOTE %s)", GET_REG_NOTE_NAME(GET_MODE(x)));
1891
+                       zip_debug_print(pfx, lvl, buf);
1892
+               }break;
1893
+       case COND_EXEC: zip_debug_print(pfx, lvl, "(COND_EXEC)");
1894
+               debug_rtx(x);
1895
+               break;
1896
+       case ASM_INPUT: zip_debug_print(pfx, lvl, "(ASM INPUT)"); break;
1897
+       case ASM_OPERANDS: zip_debug_print(pfx, lvl, "(ASM OPERANDS)"); break;
1898
+       case UNSPEC: zip_debug_print(pfx, lvl, "(UNSPEC)"); break;
1899
+       case UNSPEC_VOLATILE: zip_debug_print(pfx, lvl, "(UNSPEC_VOLATILE)"); break;
1900
+       case CODE_LABEL:
1901
+               {
1902
+                       char    buf[64];
1903
+                       sprintf(buf, "(CODE_LABEL %d)", CODE_LABEL_NUMBER(x));
1904
+                       zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
1905
+               } break;
1906
+       case SET:
1907
+               zip_debug_print_m(pfx, lvl, "(SET", GET_MODE(x));
1908
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
1909
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
1910
+               zip_debug_print(pfx, lvl, ")");
1911
+               break;
1912
+       case REG:
1913
+               if (REGNO(x) == zip_PC)
1914
+                       zip_debug_print(pfx, lvl, "(PC)");
1915
+               else if (REGNO(x) == zip_CC)
1916
+                       zip_debug_print(pfx, lvl, "(CC0)");
1917
+               else if (REGNO(x) == zip_SP)
1918
+                       zip_debug_print(pfx, lvl, "(SP)");
1919
+               else if (REGNO(x) == zip_FP)
1920
+                       zip_debug_print(pfx, lvl, "(REG FP)");
1921
+               else if (REGNO(x) == zip_GOT)
1922
+                       zip_debug_print(pfx, lvl, "(REG GBL)");
1923
+               else if (FUNCTION_VALUE_REGNO_P(REGNO(x)))
1924
+                       zip_debug_print(pfx, lvl, "(REG RTN-VL)");
1925
+               else if (REGNO(x) == RETURN_ADDRESS_REGNUM)
1926
+                       zip_debug_print(pfx, lvl, "(REG RTN-AD)");
1927
+               else { char buf[25];
1928
+               sprintf(buf, "(REG %d)", REGNO(x));
1929
+               zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
1930
+               } break;
1931
+       case IF_THEN_ELSE: // 51
1932
+               zip_debug_print(pfx, lvl, "(IF-THEN-ELSE");
1933
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
1934
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
1935
+               zip_debug_rtx_1(pfx, XEXP(x,2),lvl+1);
1936
+               zip_debug_print(pfx, lvl, ")");
1937
+               break;
1938
+       case PC:
1939
+               zip_debug_print(pfx, lvl, "(PC)");
1940
+               break;
1941
+       case CC0:
1942
+               zip_debug_print(pfx, lvl, "(CC0)");
1943
+               break;
1944
+       case COMPARE:
1945
+               zip_debug_print(pfx, lvl, "(COMPARE");
1946
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
1947
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
1948
+               zip_debug_print(pfx, lvl, ")");
1949
+               break;
1950
+       case CONST_INT:
1951
+               { char buf[25];
1952
+               if (GET_MODE(x)==SImode)
1953
+                       sprintf(buf, "(CONST:SI %ld)", INTVAL(x));
1954
+               else if (GET_MODE(x)==VOIDmode)
1955
+                       sprintf(buf, "(CONST:V %ld)", INTVAL(x));
1956
+               else
1957
+                       sprintf(buf, "(CONST:? %ld)", INTVAL(x));
1958
+               zip_debug_print(pfx, lvl, buf);
1959
+               } break;
1960
+       case LABEL_REF:
1961
+               zip_debug_print(pfx, lvl, "(LABEL)");
1962
+               break;
1963
+       case SYMBOL_REF:
1964
+               {
1965
+                       char buf[64];
1966
+                       sprintf(buf, "(SYMBOL: %s)", XSTR(x,0));
1967
+                       // fprintf(file, "%s", XSTR(x,0));
1968
+                       zip_debug_print(pfx, lvl, buf);
1969
+               }
1970
+               break;
1971
+       case MEM:
1972
+               zip_debug_print_m(pfx, lvl, "(MEM", GET_MODE(x));
1973
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
1974
+               zip_debug_print(pfx, lvl, ")");
1975
+               break;
1976
+       /*
1977
+       case VALUE:
1978
+               {
1979
+                       char buf[64];
1980
+                       sprintf(buf, "(VALUE: %d)", INTVAL(XEXP,0));
1981
+                       zip_debug_print_m(pfx, lvl, "buf", GET_MODE(x));
1982
+               }
1983
+               break;
1984
+       */
1985
+       case PLUS:
1986
+               zip_debug_print_m(pfx, lvl, "(PLUS", GET_MODE(x));
1987
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
1988
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
1989
+               zip_debug_print(pfx, lvl, ")");
1990
+               break;
1991
+       case MINUS:
1992
+               zip_debug_print_m(pfx, lvl, "(MINUS", GET_MODE(x));
1993
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
1994
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
1995
+               zip_debug_print(pfx, lvl, ")");
1996
+               break;
1997
+       case AND:
1998
+               zip_debug_print_m(pfx, lvl, "(AND", GET_MODE(x));
1999
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2000
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2001
+               zip_debug_print(pfx, lvl, ")");
2002
+               break;
2003
+       case IOR:
2004
+               zip_debug_print_m(pfx, lvl, "(OR", GET_MODE(x));
2005
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2006
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2007
+               zip_debug_print(pfx, lvl, ")");
2008
+               break;
2009
+       case XOR:
2010
+               zip_debug_print_m(pfx, lvl, "(XOR", GET_MODE(x));
2011
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2012
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2013
+               zip_debug_print(pfx, lvl, ")");
2014
+               break;
2015
+       case MULT:
2016
+               zip_debug_print_m(pfx, lvl, "(MULT", GET_MODE(x));
2017
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2018
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2019
+               zip_debug_print(pfx, lvl, ")");
2020
+               break;
2021
+       case EQ:        //
2022
+               zip_debug_print_m(pfx, lvl, "(EQ", GET_MODE(x));
2023
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2024
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2025
+               zip_debug_print(pfx, lvl, ")");
2026
+               break;
2027
+       case NE:        //
2028
+               zip_debug_print_m(pfx, lvl, "(NE", GET_MODE(x));
2029
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2030
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2031
+               zip_debug_print(pfx, lvl, ")");
2032
+               break;
2033
+       case GE:        //
2034
+               zip_debug_print_m(pfx, lvl, "(GE", GET_MODE(x));
2035
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2036
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2037
+               zip_debug_print(pfx, lvl, ")");
2038
+               break;
2039
+       case GT:        //
2040
+               zip_debug_print_m(pfx, lvl, "(GT", GET_MODE(x));
2041
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2042
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2043
+               zip_debug_print(pfx, lvl, ")");
2044
+               break;
2045
+       case LE:        //
2046
+               zip_debug_print_m(pfx, lvl, "(LE", GET_MODE(x));
2047
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2048
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2049
+               zip_debug_print(pfx, lvl, ")");
2050
+               break;
2051
+       case LT:        //
2052
+               zip_debug_print_m(pfx, lvl, "(LT", GET_MODE(x));
2053
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2054
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2055
+               zip_debug_print(pfx, lvl, ")");
2056
+               break;
2057
+       case GEU:       //
2058
+               zip_debug_print_m(pfx, lvl, "(GEU", GET_MODE(x));
2059
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2060
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2061
+               zip_debug_print(pfx, lvl, ")");
2062
+               break;
2063
+       case GTU:       //
2064
+               zip_debug_print_m(pfx, lvl, "(GTU", GET_MODE(x));
2065
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2066
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2067
+               zip_debug_print(pfx, lvl, ")");
2068
+               break;
2069
+       case LEU:       //
2070
+               zip_debug_print_m(pfx, lvl, "(LEU", GET_MODE(x));
2071
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2072
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2073
+               zip_debug_print(pfx, lvl, ")");
2074
+               break;
2075
+       case LTU:       //
2076
+               zip_debug_print_m(pfx, lvl, "(LTU", GET_MODE(x));
2077
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2078
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2079
+               zip_debug_print(pfx, lvl, ")");
2080
+               break;
2081
+       case SCRATCH:   //
2082
+               zip_debug_print_m(pfx, lvl, "(SCRATCH)", GET_MODE(x));
2083
+               break;
2084
+       case SUBREG:
2085
+               { char buf[25];
2086
+               sprintf(buf, "(SUBREG %d/%d)", REGNO(XEXP(x,0)),
2087
+                       SUBREG_BYTE(x));
2088
+               zip_debug_print(pfx, lvl, buf);
2089
+               } break;
2090
+       default:
2091
+               { char buf[25];
2092
+               sprintf(buf, "(? = %d) -- calling DEBUG-RTX", GET_CODE(x));
2093
+               zip_debug_print(pfx, lvl, buf);
2094
+               debug_rtx(x);
2095
+               } break;
2096
+       }
2097
+}
2098
+
2099
+void
2100
+zip_debug_rtx_pfx(const char *pfx, const_rtx x) {
2101
+       zip_debug_rtx_1(pfx, x, 0);
2102
+}
2103
+
2104
+void
2105
+zip_debug_rtx(const_rtx x) {
2106
+       zip_debug_rtx_pfx("", x);
2107
+}
2108
+
2109
+void
2110
+zip_debug_insn(rtx_insn *insn ATTRIBUTE_UNUSED) {
2111
+}
2112
+
2113
+void
2114
+zip_debug_bb(basic_block bb) {
2115
+       rtx_insn        *insn;
2116
+
2117
+       fprintf(stderr, "************ BASIC-BLOCK ***************\n");
2118
+       FOR_BB_INSNS(bb, insn)
2119
+       {
2120
+               zip_debug_rtx(insn);
2121
+       }
2122
+}
2123
+
2124
+
2125
+static bool
2126
+zip_legitimate_operand_address(const_rtx x, bool strict)
2127
+{
2128 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2129 102 dgisselq
+
2130
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS\n");
2131
+       if (dbg) zip_debug_rtx_pfx("Test: ", x);
2132
+
2133
+       /*
2134
+        * While this might seem to make sense, it sends GCC into an infinite
2135
+        * loop.
2136
+        *
2137
+       if (GET_CODE(x) == MEM) {
2138
+               return (zip_legitimate_operand_address(XEXP(x,0),strict));
2139
+       }
2140
+       */
2141
+
2142
+       /*
2143
+       if (MEM_P(x)) {
2144
+               if((REG_P(XEXP(x,0)))||(GET_CODE(XEXP(x,0))==PLUS))
2145
+                       return (zip_legitimate_operand_address(XEXP(x,0),strict));
2146
+       } else
2147
+       */
2148
+
2149
+       if (NULL_RTX == x)
2150
+               return false;
2151
+       else if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode))
2152
+               return false;
2153
+       else if (REG_P(x)) {
2154
+               // Only insist the register b a valid register if strict is true
2155
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS -> YES! (Reg)\n");
2156
+               return (!strict)||(REGNO(x) != zip_CC);
2157
+       } else if (GET_CODE(x) == PLUS) {
2158
+               // Is it a valid register?
2159
+               /*
2160
+               if (GET_CODE(XEXP(x,0))==PLUS) {
2161
+                       return (zip_legitimate_operand_address(XEXP(XEXP(x,0),0), strict))
2162
+                               &&(zip_const_address_operand(XEXP(XEXP(x,0),1)));
2163
+               } */
2164
+               if(!REG_P(XEXP(x,0))) {
2165
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS -> No (No reg in +%s)\n",
2166
+                       (GET_CODE(XEXP(x,1))==REG)?", reg in op[1]":"");
2167
+                       return false;
2168
+               } if ((strict)&&(REGNO(XEXP(x,0)) == zip_CC)) {
2169
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS -> No (Wrong reg in +, %d)\n", REGNO(XEXP(x,0)));
2170
+                       return false;
2171
+               } if ((GET_CODE(XEXP(x, 1)) == CONST_INT)
2172
+                       &&(INTVAL(XEXP(x, 1)) <= zip_max_anchor_offset)
2173
+                       &&(INTVAL(XEXP(x, 1)) >= zip_min_anchor_offset)) {
2174
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS -> YES! (reg+int)\n");
2175 103 dgisselq
+                       // if((INTVAL(XEXP(x,1))<0)&&(REGNO(XEXP(x,0))==zip_SP))
2176
+                               // gcc_unreachable();
2177 102 dgisselq
+                       return true;
2178
+               } if ((GET_CODE(XEXP(x, 1)) == LABEL_REF)
2179
+                       ||(GET_CODE(XEXP(x, 1)) == SYMBOL_REF)) {
2180
+                       // While we can technically support this, the problem
2181
+                       // is that the symbol address could be anywhere, and we
2182
+                       // have no way of recovering if it's outside of our
2183
+                       // 14 allowable bits.
2184
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS -> No. (reg+lbl)\n");
2185
+                       return false;
2186
+               } if ((GET_CODE(XEXP(x, 1)) == MINUS)
2187
+                       &&((GET_CODE(XEXP(XEXP(x,1),0)) == LABEL_REF)
2188
+                               ||(GET_CODE(XEXP(XEXP(x,1),0)) == CONST_INT)
2189
+                               ||(GET_CODE(XEXP(XEXP(x,1),0)) == SYMBOL_REF))
2190
+                       &&((GET_CODE(XEXP(XEXP(x,1),1)) == LABEL_REF)
2191
+                               ||(GET_CODE(XEXP(XEXP(x,1),0)) == CONST_INT)
2192
+                               ||(GET_CODE(XEXP(XEXP(x,1),1)) == SYMBOL_REF))
2193
+                       &&((GET_CODE(XEXP(XEXP(x,1),0)))
2194
+                               == (GET_CODE(XEXP(XEXP(x,1),1))))) {
2195
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS -> YES! (lbl-lbl+reg)\n");
2196
+                       return true;
2197
+               }
2198
+       }
2199
+
2200
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS -> No\n");
2201
+       if (dbg) zip_debug_rtx(x);
2202
+       return false;
2203
+}
2204
+
2205
+static bool
2206
+zip_legitimate_move_operand_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict) {
2207
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2208
+
2209
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND\n");
2210
+       if (dbg) zip_debug_rtx_pfx("VMov?: ", x);
2211
+
2212
+       if (NULL_RTX == x)
2213
+               return false;
2214
+       else if (REG_P(x)) {
2215
+               // Only insist the register b a valid register if strict is true
2216
+               if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> YES! (Reg)\n");
2217
+               return (!strict)||(REGNO(x) != zip_CC);
2218
+       } else if (GET_CODE(x) == PLUS) {
2219
+               // Is it a valid register?
2220
+               if (GET_CODE(XEXP(x,0))==PLUS) {
2221
+                       return (zip_legitimate_operand_address(XEXP(x,0), strict))
2222
+                               &&(zip_const_address_operand(XEXP(x,0)));
2223
+               } if(GET_CODE(XEXP(x,0)) != REG) {
2224
+                       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> No (No reg in +%s)\n",
2225
+                       (GET_CODE(XEXP(x,1))==REG)?", reg in op[1]":"");
2226
+                       return false;
2227
+               } if ((strict)&&(REGNO(XEXP(x,0)) == zip_CC)) {
2228
+                       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> No (Wrong reg in +, %d)\n", REGNO(XEXP(x,0)));
2229
+                       return false;
2230
+               } if ((GET_CODE(XEXP(x, 1)) == CONST_INT)
2231
+                       &&(INTVAL(XEXP(x, 1)) <= zip_max_mov_offset)
2232
+                       &&(INTVAL(XEXP(x, 1)) >= zip_min_mov_offset)) {
2233
+                       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> YES! (reg+int)\n");
2234
+                       return true;
2235
+               }
2236
+       }
2237
+
2238
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> No\n");
2239
+       if (dbg) zip_debug_rtx(x);
2240
+       return false;
2241
+}
2242
+
2243
+int
2244
+zip_pd_mov_operand(rtx op)
2245
+{
2246
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2247
+
2248
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOV(predicate) for OPERAND\n");
2249
+       return zip_legitimate_move_operand_p(VOIDmode, op, !can_create_pseudo_p());
2250
+}
2251
+
2252
+int
2253
+zip_address_operand(rtx op)
2254
+{
2255
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2256
+
2257
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS for OPERAND\n");
2258
+       return zip_legitimate_operand_address(op, !can_create_pseudo_p());
2259
+}
2260
+
2261
+int
2262
+zip_pd_address_operand(rtx op)
2263
+{
2264
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2265
+
2266
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS(predicate) for OPERAND\n");
2267
+       return zip_legitimate_operand_address(op, !can_create_pseudo_p());
2268
+}
2269
+
2270
+int
2271
+zip_ct_address_operand(rtx op)
2272
+{
2273
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2274
+
2275
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS(constraint) for OPERAND\n");
2276
+       return zip_legitimate_operand_address(op, !can_create_pseudo_p());
2277
+}
2278
+
2279
+int
2280
+zip_const_address_operand(rtx x) {
2281
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2282
+
2283
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS?\n");
2284
+       if (dbg) zip_debug_rtx(x);
2285
+       if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode))
2286
+               return false;
2287
+       if ((GET_CODE(x) == LABEL_REF)
2288
+                       ||(GET_CODE(x) == CODE_LABEL)
2289
+                       ||(GET_CODE(x) == SYMBOL_REF)) {
2290
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES!\n");
2291
+               return true;
2292
+       } else if (CONST_INT_P(x)) {
2293
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES!\n");
2294
+               return true;
2295
+       } else if (GET_CODE(x) == PLUS) {
2296
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(PLUS)\n");
2297
+               return ((zip_const_address_operand(XEXP(x,0)))
2298
+                       &&(CONST_INT_P(XEXP(x,1))));
2299
+       } else if (GET_CODE(x) == MINUS) {
2300
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(MINUS)\n");
2301
+               return ((zip_const_address_operand(XEXP(x,0)))
2302
+                       &&(zip_const_address_operand(XEXP(x,1))));
2303
+       }
2304
+
2305
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> No\n");
2306
+       if (dbg) zip_debug_rtx(x);
2307
+       return false;
2308
+}
2309
+
2310
+int
2311
+zip_ct_const_address_operand(rtx x) {
2312
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2313
+
2314
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(constraint)\n");
2315
+       return zip_const_address_operand(x);
2316
+}
2317
+
2318
+int
2319
+zip_pd_const_address_operand(rtx x) {
2320
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2321
+
2322
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(predicate)\n");
2323
+       return zip_const_address_operand(x);
2324
+}
2325
+
2326
+
2327
+static bool
2328
+zip_legitimate_address_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict)
2329
+{
2330
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2331
+
2332
+       if (dbg) fprintf(stderr, "Zip-LEGITIMATE-ADDRESS-P\n");
2333
+       if (dbg) zip_debug_rtx(x);
2334
+
2335
+       // Only insist the register be a valid register if strict is true
2336
+       if (zip_legitimate_operand_address(x, strict))
2337
+               return true;
2338
+       else if (zip_const_address_operand(x))
2339
+               return true;
2340
+
2341
+       return false;
2342
+}
2343
+
2344
+void
2345
+zip_asm_output_def(FILE *stream, const char *name, const char *value)
2346
+{
2347
+       assemble_name(stream, name);
2348
+       fprintf(stream, "\t.equ ");
2349
+       assemble_name(stream, value);
2350
+       fputc('\n', stream);
2351
+}
2352
+
2353
+/*
2354
+bool   zip_load_address_lod(rtx regrx, rtx memrx) {
2355
+       fprintf(stderr, "ZIP-LOAD-ADDRESS-LOD\n");
2356
+       if (!MEM_P(memrx))
2357
+               return false;
2358
+       if (GET_CODE(regrx) != REG)
2359
+               return false;
2360
+       enum    rtx_code ic = GET_CODE(memrx);
2361
+       if ((ic == SYMBOL_REF)
2362
+               ||(ic == CODE_LABEL)
2363
+               ||(ic == LABEL_REF)) {
2364
+               if (can_create_pseudo_p()) {
2365
+                       rtx scratch_reg;
2366
+                       scratch_reg = gen_rtx_SCRATCH(SImode);
2367
+                       emit_insn(gen_movsi_ldi(scratch_reg, XEXP(memrx, 0)));
2368
+                       emit_insn(gen_movsi_lod(regrx, scratch_reg));
2369
+                       return true;
2370
+               } else return false;
2371
+       } else return false;
2372
+}
2373
+
2374
+bool   zip_load_address_sto(rtx memrx, rtx regrx) {
2375
+       fprintf(stderr,  "CHECKING-IN-W/ZIP_LOAD_ADDRESS_STORE\n");
2376
+       if (!MEM_P(memrx))
2377
+               return false;
2378
+       if (GET_CODE(regrx) != REG)
2379
+               return false;
2380
+       enum    rtx_code ic = GET_CODE(memrx);
2381
+       if ((ic == SYMBOL_REF)
2382
+               ||(ic == CODE_LABEL)
2383
+               ||(ic == LABEL_REF)) {
2384
+               if (can_create_pseudo_p()) {
2385
+                       rtx scratch_reg;
2386
+                       scratch_reg = gen_rtx_SCRATCH(SImode);
2387
+                       emit_insn(gen_movsi_ldi(scratch_reg, XEXP(memrx, 0)));
2388
+                       emit_insn(gen_movsi_sto(scratch_reg, regrx));
2389
+                       return true;
2390
+               } else return false;
2391
+       } return false;
2392
+}
2393
+*/
2394
+
2395
+#define        SREG_P(RTX) ((REG_P(RTX))||(SUBREG_P(RTX)))
2396
+
2397
+bool   zip_gen_move_rtl(rtx dst, rtx src) {
2398 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2399 102 dgisselq
+
2400
+       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE\n");
2401
+       if (dbg) zip_debug_rtx_pfx("FROM: ", src);
2402
+       if (dbg) zip_debug_rtx_pfx("TO  : ", dst);
2403
+       if (dbg) fprintf(stderr, "PSEUDOs: %s\n", can_create_pseudo_p()?"true":"false");
2404
+       if ((SREG_P(dst))&&(SREG_P(src))) {
2405
+               // First type of move... register to register
2406
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/REG -- EMIT\n");
2407
+               emit_insn(gen_movsi_reg(dst, src));
2408
+       } else if ((MEM_P(dst))&&(MEM_P(XEXP(dst,0)))) {
2409
+               if (can_create_pseudo_p()) {
2410
+                       rtx     tmp = gen_reg_rtx(Pmode);
2411
+                       zip_gen_move_rtl(tmp, XEXP(dst,0));
2412 103 dgisselq
+                       // mark_reg_pointer(tmp,0);
2413 102 dgisselq
+                       zip_gen_move_rtl(gen_rtx_MEM(GET_MODE(src), tmp), src);
2414
+               } else {
2415
+                       fprintf(stderr, "ZIP:Cannot move into mem w/o pseudo\n");
2416
+                       return false;
2417
+               }
2418
+       } else if ((MEM_P(src))&&(MEM_P(XEXP(src,0)))) {
2419
+               if (can_create_pseudo_p()) {
2420
+                       rtx     tmp = gen_reg_rtx(Pmode);
2421
+                       zip_gen_move_rtl(tmp, XEXP(src,0));
2422 103 dgisselq
+                       // mark_reg_pointer(tmp,0);
2423 102 dgisselq
+                       zip_gen_move_rtl(dst, gen_rtx_MEM(GET_MODE(src), tmp));
2424
+               } else {
2425
+                       fprintf(stderr, "ZIP: Cannot move from mem(mem(ptr)) w/o pseudo\n");
2426
+                       return false;
2427
+               }
2428
+       } else if ((SREG_P(dst))&&(GET_CODE(src)==PLUS)
2429
+                       &&(REG_P(XEXP(src,0)))
2430
+                       &&(CONST_INT_P(XEXP(src,1)))) {
2431
+               // Second type of move... register plus offset to register
2432
+               if ((INTVAL(XEXP(src, 1)) <= zip_max_mov_offset)
2433
+                       &&(INTVAL(XEXP(src, 1)) >= zip_min_mov_offset)) {
2434
+                       // The offset is within bounds
2435
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/REG+OFF -- EMIT\n");
2436
+                       emit_insn(gen_movsi_reg_off(dst, XEXP(src,0),XEXP(src,1)));
2437
+               } else if (can_create_pseudo_p()) {
2438
+                       // The offset is out of bounds, get a new register and
2439
+                       // generate an add instruction to split this up.
2440
+                       rtx     tmp = gen_reg_rtx(GET_MODE(XEXP(src,0)));
2441
+
2442
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LDI\n");
2443
+                       emit_insn(gen_movsi_ldi(tmp, XEXP(src,1)));
2444
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/ADD\n");
2445
+                       emit_insn(gen_addsi3(tmp, tmp, XEXP(src,0)));
2446
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/DST\n");
2447
+                       emit_insn(gen_movsi_reg(dst, tmp));
2448
+               } else {
2449
+                       fprintf(stderr, "ZIP: Cannot move a(r),b w/o pseudo for out of bounds a\n");
2450
+                       return false;
2451
+               }
2452
+       } else if ((MEM_P(dst))&&(MEM_P(src))) {
2453
+               rtx     tmp;
2454
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/MEM/MEM\n");
2455
+               if (can_create_pseudo_p()) {
2456
+                       tmp = gen_reg_rtx(GET_MODE(src));
2457
+                       emit_insn(gen_movsi(tmp, src));
2458
+                       emit_insn(gen_movsi(dst, tmp));
2459
+               } else {
2460
+                       fprintf(stderr, "ZIP: Cannot move mem(A) to mem(B) w/o pseudo\n");
2461
+                       return false;
2462
+               }
2463
+       } else if ((SREG_P(dst))&&(MEM_P(src))) {
2464
+               // Memory load
2465
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LOD\n");
2466
+               if (zip_legitimate_operand_address(XEXP(src, 0), false)) {
2467
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/SIMPLE-LOD(ADDR)\n");
2468
+                       if (dbg) zip_debug_rtx_pfx("Smple-Addr: ", src);
2469 103 dgisselq
+                       // if (REG_P(XEXP(src,0)))
2470
+                               // mark_reg_pointer(XEXP(src,0),0);
2471
+                       // else if ((GET_CODE(XEXP(src,0))==PLUS)
2472
+                                       // &&(REG_P(XEXP(XEXP(src,0),0))))
2473
+                               // mark_reg_pointer(XEXP(XEXP(src,0),0),0);
2474 102 dgisselq
+                       emit_insn(gen_movsi_lod(dst, src));
2475
+               } else if (zip_const_address_operand(XEXP(src,0))) {
2476
+                       if (can_create_pseudo_p()) {
2477
+                               rtx     tmp;
2478
+                               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LOD(CONST-ADDR)\n");
2479
+                               tmp = gen_reg_rtx(Pmode);
2480
+                               emit_insn(gen_movsi_ldi(tmp, XEXP(src,0)));
2481 103 dgisselq
+                               // mark_reg_pointer(tmp,0);
2482 102 dgisselq
+                               emit_insn(gen_movsi_lod(dst, gen_rtx_MEM(GET_MODE(src),tmp)));
2483
+                       } else {
2484
+                               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LOD(CONST-ADDR,SELF)\n");
2485
+                               emit_insn(gen_movsi_ldi(dst, XEXP(src,0)));
2486
+                               emit_insn(gen_movsi_lod(dst, gen_rtx_MEM(GET_MODE(src),dst)));
2487
+                       }
2488
+               } else {
2489
+                       internal_error("%s", "ZIP/No usable load\n");
2490
+               }
2491
+       } else if ((MEM_P(dst))&&(SREG_P(src))) {
2492
+               // Memory store
2493
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO\n");
2494
+               if (zip_legitimate_operand_address(XEXP(dst, 0), false)) {
2495
+                       // If it's a legitimate address already, do nothing mor
2496
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO(Legit Addr)--EMIT\n");
2497 103 dgisselq
+                       // if (REG_P(XEXP(dst,0)))
2498
+                               // mark_reg_pointer(XEXP(dst,0),0);
2499
+                       // else if ((GET_CODE(XEXP(dst,0))==PLUS)
2500
+                                       // &&(REG_P(XEXP(XEXP(dst,0),0))))
2501
+                               // mark_reg_pointer(XEXP(XEXP(dst,0),0),0);
2502 102 dgisselq
+                       emit_insn(gen_movsi_sto(dst, src));
2503
+               } else if (zip_const_address_operand(XEXP(dst,0))) {
2504
+                       rtx     tmp;
2505
+
2506
+                       if (can_create_pseudo_p()) {
2507
+                               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO(Const Addr,Reg) -- EMIT\n");
2508
+                               // Otherwise we need to load the memory address
2509
+                               // into a register
2510
+                               tmp = gen_reg_rtx(Pmode);
2511 103 dgisselq
+                               // mark_reg_pointer(tmp,0);
2512 102 dgisselq
+                               emit_insn(gen_movsi_ldi(tmp, XEXP(dst,0)));
2513
+                               //
2514
+                               // Then we can do our load
2515
+                               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO -- emit\n");
2516
+                               emit_insn(gen_movsi_sto(gen_rtx_MEM(GET_MODE(src), tmp), src));
2517
+                       } else {
2518
+                               fprintf(stderr, "Cannot move src -> mem(dst) w/o pseudo\n");
2519
+                               return false;
2520
+                       }
2521
+               } else if (can_create_pseudo_p())
2522
+                       internal_error("%s", "ZIP/No usable store\n");
2523
+               else {
2524
+                       fprintf(stderr, "ZIP/Unanticipated store problem\n");
2525
+                       return false;
2526
+               }
2527
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO -- DONE\n");
2528
+       } else if ((MEM_P(dst))&&((CONST_INT_P(src))||(GET_CODE(src)==SYMBOL_REF))) {
2529
+               // Store a constant into memory
2530
+               rtx     tmp;
2531
+
2532
+               if (can_create_pseudo_p()) {
2533
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/CONST->MEM\n");
2534
+                       // Load the source constant into a register first
2535
+                       tmp = gen_reg_rtx((GET_MODE(src)==VOIDmode)?GET_MODE(dst):GET_MODE(src));
2536
+                       emit_insn(gen_movsi_ldi(tmp,src));
2537
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/CONST->REG->MEM -- RECURSE\n");
2538
+
2539
+                       // Then do a normal move, recursing to handle memory
2540
+                       // properly
2541
+                       zip_gen_move_rtl(dst, tmp);
2542
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/CONST->MEM -- DONE\n");
2543
+               } else {
2544
+                       fprintf(stderr, "ZIP/Cannot store constant into mem w/o pseudo\n");
2545
+                       return false;
2546
+               }
2547
+       } else if ((SREG_P(dst))&&(CONST_INT_P(src))) {
2548
+               // Load a constant into a register
2549
+               // The assembler really takes care of all of this, since
2550
+               // the assembler will split the constant if it doesn't fit
2551
+               // into a single instruction.
2552
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/CONST->REG\n");
2553
+               // if ((GET_MODE(dst)==VOIDmode)&&(GET_MODE(src)==VOIDmode))
2554
+                       // PUT_MODE(dst,SImode);
2555
+               emit_insn(gen_movsi_ldi(dst, src));
2556
+       } else if ((REG_P(dst))&&
2557
+                       ((LABEL_P(src))
2558
+                       ||(GET_CODE(src)==SYMBOL_REF)
2559
+                       ||(GET_CODE(src)==LABEL_REF))) {
2560
+               // Load a constant into a register
2561
+               // The assembler really takes care of all of this, since
2562
+               // the assembler will split the constant if it doesn't fit
2563
+               // into a single instruction.
2564
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LABEL->REG\n");
2565
+               emit_insn(gen_movsi_ldi(dst, src));
2566
+       } else {
2567
+               fprintf(stderr, "ZIP/No usable move\n");
2568
+               zip_debug_rtx_pfx("TO  : ", dst);
2569
+               zip_debug_rtx_pfx("FROM: ", src);
2570
+               debug_rtx(dst);
2571
+               debug_rtx(src);
2572
+               return false;
2573
+       }
2574
+       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE -- DONE\n");
2575
+       return true;
2576
+}
2577
+
2578
+const char *zip_set_zero_or_one(rtx condition, rtx dst) {
2579 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2580 102 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::SET-ZERO-OR-ONE\n");
2581
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
2582
+       if (dbg) zip_debug_rtx_pfx("REG", dst);
2583
+       switch(GET_CODE(condition)) {
2584
+       case EQ:        return "LDI\t0,%0\n\tLDILO.Z\t1,%0";
2585
+       case NE:        return "LDI\t0,%0\n\tLDILO.NZ\t1,%0";
2586
+       case LT:        return "LDI\t0,%0\n\tLDILO.LT\t1,%0";
2587
+       case GT:        return "LDI\t0,%0\n\tLDILO.GT\t1,%0";
2588
+       case LE:        return "LDI\t1,%0\n\tLDILO.GT\t0,%0";
2589
+       case GE:        return "LDI\t0,%0\n\tLDILO.GE\t1,%0";
2590
+       case LTU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0";
2591
+       case GTU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0\n\tLDILO.Z\t0,%0";
2592
+       case LEU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0\n\tLDILO.Z\t1,%0";
2593
+       case GEU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0";
2594
+       default:
2595
+               zip_debug_rtx(condition);
2596
+               internal_error("CSTORE Unsupported condition");
2597
+               return NULL;
2598
+       }
2599
+}
2600
+
2601
+const char *zip_binary_movsicc(rtx_code condition, const char *op, const int opno) {
2602
+       static char     result[64] = "";
2603
+       switch(condition) {
2604
+               //
2605
+               // Result already exists in the iffalse register
2606
+               // Can't change it.  Therefore, on the
2607
+               // condition ... move true register to the
2608
+               // destination
2609
+               //
2610
+               case EQ:        sprintf(result, "%s.Z\t%%%d,%%0", op, opno); break;
2611
+               case NE:        sprintf(result, "%s.NZ\t%%%d,%%0", op, opno); break;
2612
+               case LT:        sprintf(result, "%s.LT\t%%%d,%%0", op, opno); break;
2613
+               case GT:        sprintf(result, "%s.GT\t%%%d,%%0", op, opno); break;
2614
+               // .LE doesn't exist on Zip CPU--turn this into two instructions
2615
+               case LE:        sprintf(result, "%s.LT\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
2616
+               case GE:        sprintf(result, "%s.GE\t%%%d,%%0", op, opno); break;
2617
+               case LTU:       sprintf(result, "%s.C\t%%%d,%%0", op, opno); break;
2618
+               //
2619
+               // .GTU doesn't exist on the Zip CPU either. We also note that
2620
+               // .C will never be set on an equal condition.  Therefore, we
2621
+               // turn this into a XOR.NZ 2,CC, which will set the .C condition
2622
+               // as long as .Z wasn't true.  We then undo this when we're
2623
+               // done.  This is possible since none of these instructions
2624
+               // (LDI/MOV/Lod conditional, nor Xor conditional) will ever set
2625
+               // the condition codes.
2626
+               //
2627
+               // This is obviously not very optimal.  Avoid this by all means
2628
+               // if you can
2629
+               case GTU:       sprintf(result, "XOR.NZ\t2,CC\n%s.C\t%%%d,%%0\n\tXOR.NZ\t2,CC", op, opno); break;
2630
+               // .LEU doesn't exist on Zip CPU either--turn this into another
2631
+               // two instructions
2632
+               case LEU:       sprintf(result, "%s.C\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
2633
+               //
2634
+               // .GEU doesn't exist on Zip CPU.  Implementing it her is
2635
+               // painful.  We can change the condition codes to make it so,
2636
+               // but the instruction requires the condition codes not be
2637
+               // changed.  Hence, we must change them back if we do so.
2638
+               //
2639
+               // .C will be set on less than but not equal.  Hence !.C will
2640
+               // be true on greater than or equal.
2641
+               case GEU:       sprintf(result, "XOR\t2,CC\n%s.C\t%%%d,%%0\n\tXOR\t2,CC", op, opno); break;
2642
+               default:
2643
+                       internal_error("MOVSICC(BINARY) Unsupported condition");
2644
+                       return NULL;
2645
+       } return result;
2646
+}
2647
+
2648
+const char *zip_tertiary_movsicc(rtx condition, const char *optrue, const char *opfalse) {
2649
+       static  char    result[64] = "";
2650
+       switch(GET_CODE(condition)) {
2651
+               case EQ:        sprintf(result,"%s\t%%3,%%0\n\t%s.Z\t%%2,%%0", opfalse, optrue); break;
2652
+               case NE:        sprintf(result,"%s\t%%3,%%0\n\t%s.NZ\t%%2,%%0", opfalse, optrue); break;
2653
+               case LT:        sprintf(result,"%s\t%%3,%%0\n\t%s.LT\t%%2,%%0", opfalse, optrue); break;
2654
+               case GT:        sprintf(result,"%s\t%%3,%%0\n\t%s.GT\t%%2,%%0", opfalse, optrue); break;
2655
+               // LE doesn't exist on a Zip CPU.  Accomplish this by
2656
+               // reversing the condition: i.e., load the false value into
2657
+               // the register, and the on condition load the true value.
2658
+               case LE:        sprintf(result,"%s\t%%2,%%0\n\t%s.GT\t%%3,%%0", optrue, opfalse); break;
2659
+               case GE:        sprintf(result,"%s\t%%3,%%0\n\t%s.GE\t%%2,%%0", opfalse, optrue); break;
2660
+               case LTU:       sprintf(result,"%s\t%%3,%%0\n\t%s.C\t%%2,%%0", opfalse, optrue); break;
2661
+               //
2662
+               case GTU:       sprintf(result,"%s\t%%2,%%0\n\t%s.C\t%%3,%%0\n\t%s.Z\t%%3,%%0", optrue, opfalse, opfalse); break;
2663
+               case LEU:       sprintf(result,"%s\t%%3,%%0\n\t%s.C\t%%2,%%0\n\t%s.Z\t%%2,%%0", opfalse, optrue, optrue); break;
2664
+               case GEU:       sprintf(result,"%s\t%%2,%%0\n\t%s.C\t%%3,%%0\n", optrue, opfalse); break;
2665
+               default:
2666
+                       internal_error("MOVSICC Unsupported condition");
2667
+                       return NULL;
2668
+       } return result;
2669
+}
2670
+
2671
+const char *zip_movsicc(rtx dst, rtx condition, rtx iftrue, rtx iffalse) {
2672 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2673 102 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::MOVSICC\n");
2674
+       if (dbg) zip_debug_rtx_pfx("DST", dst);
2675
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
2676
+       if (dbg) zip_debug_rtx_pfx("TRU", iftrue);
2677
+       if (dbg) zip_debug_rtx_pfx("FAL", iffalse);
2678
+       if ((REG_P(iftrue))&&(REGNO(dst)==REGNO(iftrue))) {
2679
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- CASE if(X) -> R\n");
2680
+               if (zip_legitimate_move_operand_p(SImode, iffalse, true))
2681
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "MOV", 3);
2682
+               else if (zip_const_address_operand(iffalse))
2683
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LDI", 3);
2684
+               else if (zip_const_address_operand(iffalse))
2685
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LDI", 3);
2686
+               else if ((MEM_P(iffalse))&&(zip_legitimate_operand_address(XEXP(iffalse,0), true)))
2687
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LOD", 3);
2688
+               else {
2689
+                       internal_error("MOVSICC Unsupported mode");
2690
+                       return NULL;
2691
+               }
2692
+       } if ((REG_P(iftrue))&&(REGNO(dst)==REGNO(iftrue))) {
2693
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- CASE if(!X) -> R\n");
2694
+               if (zip_legitimate_move_operand_p(SImode, iftrue, true))
2695
+                       return zip_binary_movsicc(GET_CODE(condition), "MOV",2);
2696
+               else if (zip_const_address_operand(iffalse))
2697
+                       return zip_binary_movsicc(GET_CODE(condition), "LDI",2);
2698
+               else if (zip_const_address_operand(iffalse))
2699
+                       return zip_binary_movsicc(GET_CODE(condition), "LDI",2);
2700
+               else if ((MEM_P(iffalse))&&(zip_legitimate_operand_address(XEXP(iffalse,0), true)))
2701
+                       return zip_binary_movsicc(GET_CODE(condition), "LOD",2);
2702
+               else {
2703
+                       internal_error("MOVSICC Unsupported mode");
2704
+                       return NULL;
2705
+               }
2706
+       } if ((zip_const_address_operand(iftrue))&&(zip_const_address_operand(iffalse))) {
2707
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) #1 ELSE #2\n");
2708
+               return zip_tertiary_movsicc(condition, "LDI", "LDI");
2709
+       } if ((zip_const_address_operand(iftrue))&&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
2710
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) #1 ELSE A+B\n");
2711
+               return zip_tertiary_movsicc(condition, "LDI", "MOV");
2712
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))&&(zip_const_address_operand(iffalse))) {
2713
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE #x\n");
2714
+               return zip_tertiary_movsicc(condition, "MOV", "LDI");
2715
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))
2716
+                       &&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
2717
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE C+D\n");
2718
+               return zip_tertiary_movsicc(condition, "MOV", "MOV");
2719
+       }
2720
+       if ((MEM_P(iftrue))
2721
+               &&(zip_legitimate_operand_address(XEXP(iftrue,0), true))
2722
+               &&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
2723
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A[B] ELSE C+D\n");
2724
+               return zip_tertiary_movsicc(condition, "LOD", "MOV");
2725
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))
2726
+               &&(MEM_P(iffalse))&&(zip_legitimate_operand_address(XEXP(iffalse,0), true))) {
2727
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE C[D]\n");
2728
+               return zip_tertiary_movsicc(condition, "MOV", "LOD");
2729
+       } if ((MEM_P(iftrue))&&(zip_legitimate_operand_address(XEXP(iftrue,0), true))
2730
+               &&(MEM_P(iffalse))&&(zip_legitimate_operand_address(XEXP(iffalse,0), true))) {
2731
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A[B] ELSE C[D]\n");
2732
+               return zip_tertiary_movsicc(condition, "LOD", "LOD");
2733
+       }
2734
+
2735
+       internal_error("MOVSICC Operands not supported");
2736
+}
2737
+
2738
+const char *zip_addsicc(rtx dst, rtx condition, rtx ifsrc, rtx addv ATTRIBUTE_UNUSED) {
2739
+       // We know upon entry that REG_P(dst) must be true
2740
+       if (!REG_P(dst))
2741
+               internal_error("%s","ADDSICC into something other than register");
2742
+       if ((REG_P(ifsrc))&&(REGNO(dst)==REGNO(ifsrc))) {
2743
+               switch (GET_CODE(condition)) {
2744
+               case EQ: return "ADD.Z\t%3,%0";
2745
+               case NE: return "ADD.NZ\t%3,%0";
2746
+               case LT: return "ADD.LT\t%3,%0";
2747
+               case GT: return "ADD.GT\t%3,%0";
2748
+               case LE: return "ADD.LT\t%3,%0\n\tADD.Z\t%3,%0";
2749
+               case GE: return "ADD.GE\t%3,%0";
2750
+               case LTU: return "ADD.C\t%3,%0";
2751
+               case LEU: return "ADD.C\t%3,%0\n\tADD.Z\t%3,%0";
2752
+               case GEU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tXOR\t2,CC";
2753
+               // Can do a GEU comparison, and then undo on the Zero condition
2754
+               case GTU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tSUB.Z\t%3,%0\n\tXOR\t2,CC";
2755
+               default:
2756
+                       internal_error("%s", "Zip/No usable addsi expansion");
2757
+                       break;
2758
+               }
2759
+       } else {
2760
+               // MOV A+REG,REG
2761
+               switch (GET_CODE(condition)) {
2762
+               case EQ: return "MOV.Z\t%3+%2,%0";
2763
+               case NE: return "MOV.NZ\t%3+%2,%0";
2764
+               case LT: return "MOV.LT\t%3+%2,%0";
2765
+               case GT: return "MOV.GT\t%3+%2,%0";
2766
+               case LE: return "MOV.LT\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
2767
+               case GE: return "MOV.GE\t%3+%2,%0";
2768
+               case LTU: return "MOV.C\t%3+%2,%0";
2769
+               case LEU: return "MOV.C\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
2770
+               case GEU: return "XOR\t2,CC\n\tMOV.C\t%3+%2,%0\n\tXOR\t2,CC";
2771
+               // Can do a GEU comparison, and then undo on the Zero condition
2772
+               // EXCEPT: with a move instruction, what's there to undo?  We
2773
+               // just clobbered our register!
2774
+               // case GTU: return "XOR\t2,CC\n\tMOV.C\t%3,%0\n\tSUB.Z\t%3,%0XOR\t2,CC";
2775
+               default:
2776
+                       internal_error("%s", "Zip/No usable addsi(reg,reg) expansion");
2777
+                       break;
2778
+               }
2779
+       }
2780
+
2781
+       return "BREAK";
2782
+}
2783
+
2784
+static void
2785
+zip_canonicalize_comparison(int *code ATTRIBUTE_UNUSED, rtx *op0 ATTRIBUTE_UNUSED, rtx *op1 ATTRIBUTE_UNUSED, bool preserve_op0 ATTRIBUTE_UNUSED)
2786
+{
2787
+/*
2788
+ * While I'd like to keep and have this code, it does absolutely nothing.  The
2789
+ * code apparently only gets called on non-CC0 targets.
2790
+ *
2791
+ *
2792
+       const bool      dbg = true;
2793
+
2794
+       if (dbg) fprintf(stderr, "CANONICALIZE ...%s\n", (preserve_op0)?"(Preserve Op0)":"");
2795
+       if (dbg) zip_debug_rtx_pfx("CODE", gen_rtx_fmt_ee((rtx_code)*code, VOIDmode, cc0_rtx, const0_rtx));
2796
+       if (dbg) zip_debug_rtx_pfx("OP0 ", *op0);
2797
+       if (dbg) zip_debug_rtx_pfx("OP1 ", *op1);
2798
+
2799
+       if ((!preserve_op0)&&((*code == LE)||(*code == GTU)||(*code == GEU))) {
2800
+               rtx tem = *op0;
2801
+               *op0 = *op1;
2802
+               *op1 = tem;
2803
+               *code = (int)swap_condition((enum rtx_code)*code);
2804
+       }
2805
+
2806
+       if ((*code == LE)||(*code == LEU)||(*code==GTU)) {
2807
+               int     offset = (*code == GTU) ? 1 : -1;
2808
+               bool    swap = false;
2809
+               // A < B => A <= B-1
2810
+               if (CONST_INT_P(*op1)) {
2811
+                       *op1 = GEN_INT(INTVAL(*op1)+offset);
2812
+                       swap = true;
2813
+               } else if (REG_P(*op1)) {
2814
+                       *op1 = plus_constant(SImode, *op1, offset, true);
2815
+                       swap = true;
2816
+               } else if ((GET_CODE(*op1)==PLUS)&&(CONST_INT_P(XEXP(*op1,1)))){
2817
+                       *op1 = plus_constant(GET_MODE(*op1),XEXP(*op1,0),
2818
+                                       INTVAL(XEXP(*op1,1))+offset);
2819
+                       swap = true;
2820
+               } if (swap) {
2821
+                       if (*code == LE)
2822
+                               (*code) = LT;
2823
+                       else if (*code == LEU)
2824
+                               (*code) = LTU;
2825
+                       else // (*code) == GTU
2826
+                               (*code) = GEU;
2827
+               }
2828
+       }
2829
+*/
2830
+}
2831
+
2832 103 dgisselq
+static int     zip_memory_move_cost(machine_mode mode, reg_class_t ATTRIBUTE_UNUSED, bool in ATTRIBUTE_UNUSED) {
2833 102 dgisselq
+       int     rv = 14;
2834
+       if ((mode == DImode)||(mode == DFmode))
2835
+               rv += 2;
2836
+       return rv;
2837
+}
2838
+
2839 103 dgisselq
+// #warning "How do we tell the compiler LDI label is expensive as 2 ops"?
2840 102 dgisselq
+
2841
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.h gcc-5.3.0-zip/gcc/config/zip/zip.h
2842
--- gcc-5.3.0-original/gcc/config/zip/zip.h     1969-12-31 19:00:00.000000000 -0500
2843 103 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.h  2016-03-07 20:19:32.623843475 -0500
2844
@@ -0,0 +1,3707 @@
2845 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
2846
+//
2847
+// Filename:   gcc/config/zip/zip.h
2848
+//
2849
+// Project:    Zip CPU backend for the GNU Compiler Collection
2850
+//
2851
+// Purpose:
2852
+//
2853
+// Creator:    Dan Gisselquist, Ph.D.
2854
+//             Gisselquist Technology, LLC
2855
+//
2856
+////////////////////////////////////////////////////////////////////////////////
2857
+//
2858
+// Copyright (C) 2016, Gisselquist Technology, LLC
2859
+//
2860
+// This program is free software (firmware): you can redistribute it and/or
2861
+// modify it under the terms of  the GNU General Public License as published
2862
+// by the Free Software Foundation, either version 3 of the License, or (at
2863
+// your option) any later version.
2864
+//
2865
+// This program is distributed in the hope that it will be useful, but WITHOUT
2866
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
2867
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2868
+// for more details.
2869
+//
2870
+// You should have received a copy of the GNU General Public License along
2871
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
2872
+// target there if the PDF file isn't present.)  If not, see
2873
+// <http://www.gnu.org/licenses/> for a copy.
2874
+//
2875
+// License:    GPL, v3, as defined and found on www.gnu.org,
2876
+//             http://www.gnu.org/licenses/gpl.html
2877
+//
2878
+//
2879
+////////////////////////////////////////////////////////////////////////////////
2880
+#ifndef        GCC_ZIP_H
2881
+#define        GCC_ZIP_H
2882
+
2883
+
2884
+//
2885
+//
2886
+// Zip CPU configuration registers
2887
+//
2888
+//
2889
+#define        ZIP_USER        0        // Assume we are in supervisor mode
2890
+#define        ZIP_MULTIPLY    1       // Assume we have multiply instructions
2891
+#define        ZIP_DIVIDE      1       // Assume we have divide instructions
2892
+#define        ZIP_FPU         0        // Assume we have no floating point instructions
2893
+#define        ZIP_PIPELINED   1       // Assume our instructions are pipelined
2894
+#define        ZIP_VLIW        1       // Assume we have the VLIW feature
2895
+#define        ZIP_ATOMIC      ((ZIP_PIPELINED)&&(ZIP_VLIW))
2896
+#define        ZIP_PIC         0        // Attempting to produce PIC code, with GOT
2897
+#define        ZIP_HAS_DI      1
2898
+
2899
+// Zip has 16 registers in each user mode.
2900
+//     Register 15 is the program counter (PC)
2901
+//     Register 14 is the condition codes (CC)
2902
+//     Register 13 is the stack pointer   (SP)
2903
+//     Register 12 (may be) the Global Offset Table pointer (GOT)
2904
+//     Register  0 (may be) the return address pointer
2905
+// Registers 16-31 may only be used in supervisor mode.
2906
+#define        is_ZIP_GENERAL_REG(REGNO)       ((REGNO)<13)
2907
+#define        is_ZIP_REG(REGNO)               ((REGNO)<16)
2908
+
2909
+#undef STARTFILE_SPEC
2910
+#define        STARTFILE_SPEC  "_start"
2911
+
2912
+#undef ENDFILE_SPEC
2913
+#define        ENDFILE_SPEC    ""
2914
+
2915
+#undef LIB_SPEC
2916
+#define        LIB_SPEC        "%{!g:-lc} %{g:-lg} -lzip"
2917
+
2918 103 dgisselq
+// #define     zip_FP_PSEUDO   16
2919
+#define        zip_PC          15
2920
+#define        zip_CC          14
2921
+#define        zip_SP          13
2922
+#define        zip_FP          12
2923
+#define        zip_GOT         11
2924
+#define        zip_AP          10
2925
+#define        zip_R1          1
2926
+#define        zip_R0          0
2927 102 dgisselq
+
2928
+#define        ZIP_FIRST_ARG_REGNO     1
2929
+#define        ZIP_LAST_ARG_REGNO      5
2930
+#define        NUM_ARG_REGS            5
2931
+#define        MAX_PARM_REGS           5
2932
+
2933
+/* The overall framework of an assembler file */
2934
+
2935
+#undef ASM_SPEC
2936
+#define        ASM_COMMENT_START       ";"
2937
+#define        ASM_APP_ON              ""
2938
+#define        ASM_APP_OFF             ""
2939
+
2940
+#define        FILE_ASM_OP             "\t.file\n"
2941
+
2942
+/* Output and Generation of Labels */
2943
+#define        GLOBAL_ASM_OP           "\t.global\t"
2944
+
2945
+#undef BITS_PER_UNIT
2946
+#define        BITS_PER_UNIT   (32)
2947
+
2948
+/* Assembler Commands for Alignment */
2949
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
2950
+               { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
2951
+
2952
+
2953
+/* A C compound statement to output to stdio stream STREAM the assembler syntax
2954
+ * for an instruction operand X. */
2955
+#define        PRINT_OPERAND(STREAM, X, CODE)  zip_print_operand(STREAM, X, CODE)
2956
+#define        PRINT_OPERAND_ADDRESS(STREAM, X) zip_print_operand_address(STREAM, X)
2957
+
2958
+/* Passing arguments in registers */
2959
+#define        FUNCTION_VALUE_REGNO_P(REGNO)   ((REGNO)==zip_R1)
2960
+
2961
+/* Define how to find the value returned by a function.  VALTYPE is the data
2962
+ * type of the value (as a tree).  If the precise function being called is known
2963
+ * FUNC is its FUNCTION_DECL; otherwise, FUNC is 0. */
2964
+#define        FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx_REG(TYPE_MODE(VALTYPE), zip_R1)
2965
+
2966
+/* Define how to find the value returned by a library function assuming the
2967
+ * value has mode MODE.
2968
+ */
2969
+#define        LIBCALL_VALUE(MODE)     gen_rtx_REG(MODE, zip_R1)
2970
+
2971
+
2972
+/* STACK AND CALLING */
2973
+
2974
+
2975
+/* Define this macro as a C expression that is nonzero for registers that are
2976
+ * used by the epilogue or the return pattern.  The stack and frame pointer
2977
+ * registers are already assumed to be used as needed.
2978
+ */
2979
+#define        EPILOGUE_USES(R)        (R == RETURN_ADDRESS_REGNUM)
2980
+
2981
+
2982
+/* Normal alignment required for function parameters on the stack, in bits.  All
2983
+ * stack parameters receive at leaswt this much alignment regardless of data
2984
+ * type. */
2985
+#define        PARM_BOUNDARY   32
2986
+
2987
+/* Alignment of field after 'int : 0' in a structure. */
2988
+#define        EMPTY_FIELD_BOUNDARY    32
2989
+
2990
+/* No data type wants to be aligned rounder than this. */
2991
+#define        BIGGEST_ALIGNMENT       32
2992
+
2993
+/* The best alignment to use in cases where we have a choice. */
2994
+#define        FASTEST_ALIGNMENT       32
2995
+
2996
+/* Every structures size must be a multiple of 32-bits. */
2997
+#define        STRUCTURE_SIZE_BOUNDARY 32
2998
+
2999
+/* PCC_BITFIELD_TYPE_MATTERS -- define this if you wish to imitate the the way
3000
+ * other C compilers handle alignment of bit-fields and the structures that
3001
+ * contain them.
3002
+ *
3003
+ * The behavior is that the type written for a named bit-field (int, short, or
3004
+ * other integer type) imposes an alignment for the entire structure, as if the
3005
+ * structure really did contain an ordinary field of that type.  In addition,
3006
+ * the bit-field is placed within the structure so that it would fit within
3007
+ * such a field, not crossing a boundary for it.
3008
+ *
3009
+ * Thus, no most machines, a named bit-field whose type is written as int would
3010
+ * not cross a four-byte boundary, and would force four-byte alignment for the
3011
+ * whole structure.  (The alignment used may not be four bytes; it is controlled
3012
+ * by other alignment parameters.)
3013
+ *
3014
+ * An unnamed bit-field will not affect the alignment of the containing
3015
+ * structure.
3016
+ *
3017
+ * If thhe macro is defined, its definition should be a C expression, a non
3018
+ * zero value for the expression enables this behavior.
3019
+ * Look at the fundamental type that is used for a bit-field and use that to
3020
+ * impose alignment on the enclosing structure.  struct s{int a:8}; should
3021
+ * have the same alignment as 'int', not 'char'.
3022
+ */
3023
+#undef PCC_BITFIELD_TYPE_MATTERS
3024
+#define        PCC_BITFIELD_TYPE_MATTERS       0
3025
+
3026
+/* MAX_FIXED_MODE_SIZE -- An integer expression for the size in bits of the
3027
+ * largest integer machine mode that should actually be used.  All integer
3028
+ * machine modes of this size and smaller can be used for structures and unions
3029
+ * with the appropriate sizes.  If this macro is undefined,
3030
+ * GET_MODE_BITSIZE(DImode) is assumed.
3031
+ *
3032
+ * ZipCPU -- The default looks good enough for us.
3033
+ */
3034
+
3035
+/* Make strings word-aligned so strcpy from constants will be faster. */
3036
+#define        CONSTANT_ALIGNMENT(EXP, ALIGN)  (((TREE_CODE(EXP)==STRING_CST)  \
3037
+       && ((ALIGN) < FASTEST_ALIGNMENT)) ? FASTEST_ALIGNMENT : (ALIGN))
3038
+
3039
+/* Make arrays of chars word-aligned for the same reasons. */
3040
+#define        DATA_ALIGNMENT(TYPE, ALIGN)     ((TREE_CODE(TYPE) == ARRAY_TYPE) \
3041
+       && (TYPE_MODE(TREE_TYPE(TYPE)) == QImode)               \
3042
+       && ((ALIGN < FASTEST_ALIGNMENT) ? FASTEST_ALIGNMENT : (ALIGN)))
3043
+
3044
+/* Generate Code for Profiling
3045
+ */
3046
+#define        FUNCTION_PROFILER(FILE,LABELNO)         (abort(), 0)
3047
+
3048
+
3049
+/* A C expression which is nonzero if register number NUM is suitable for use
3050
+ * as an index register in operand addresses.
3051
+ */
3052
+#define        REGNO_OK_FOR_INDEX_P(NUM)       0
3053
+
3054
+
3055
+/* A C compound statement with a conditional 'goto LABEL;' executed if X
3056
+ * (an RTX) is a legitimate memory address on the target machine for a memory
3057
+ * operand of mode MODE.
3058
+ */
3059
+/* 17.03 Run-time Target Specification */
3060
+
3061
+/* TARGET_CPU_CPP_BUILTINS() ... This function-like macro expands to a block of
3062
+ * code that defines built-in preprocessor macros and assertions for the target
3063
+ * CPU, using the functions builtin_define, builtin_define_std, and
3064
+ * builtin_assert.  When the front end calls this macro it provides a trailing
3065
+ * semicolon, and since it has finished command line option proccessing your
3066
+ * code can use those results freely.
3067
+ *
3068
+ * ZipCPU --- We should probably capture in this macro what capabilities the
3069
+ * command line parameters we've been given indicate that our CPU has.  That
3070
+ * way, code can be adjusted depending upon the CPU's capabilities.
3071
+ */
3072
+#define        TARGET_CPU_CPP_BUILTINS()                       \
3073
+       { builtin_define("__ZIPCPU__");                 \
3074
+       if (ZIP_FPU) builtin_define("__ZIPFPU__");      \
3075
+       if (ZIP_ATOMIC) builtin_define("__ZIPATOMIC__");        \
3076
+       }
3077
+       // If (zip_param_has_fpu)  builtin_define("__ZIPFPU__");
3078
+       // If (zip_param_has_div)  builtin_define("__ZIPDIV__");
3079
+       // If (zip_param_has_mpy)  builtin_define("__ZIPMPY__");
3080
+       // If (zip_param_has_lock) builtin_define("__ZIPLOCK__");
3081
+       // If (zip_param_supervisor) builtin_define("__ZIPUREGS__");
3082
+       // If (we support int64s) builtin_define("___int64_t_defined");
3083
+
3084
+/* TARGET_OS_CPP_BUILTINS() ... Similarly to TARGET_CPU_CPP_BUILTINS but this
3085
+ * macro is optional and is used for the target operating system instead.
3086
+ */
3087
+
3088
+/* Option macros: (we need to define these eventually ... )
3089
+ *
3090
+ *     TARGET_HANDLE_OPTION
3091
+ *     TARGET_HANDLE_C_OPTION
3092
+ *     TARGET_OBJ_CONSTRUCT_STRING_OBJECT
3093
+ *     TARGET_OBJ_DECLARE_UNRESOLVED_CLASS_REFERENCE
3094
+ *     TARGET_OBJ_DECLARE_CLASS_DEFINITION
3095
+ *     TARGET_STRING_OBJECT_REF_TYPE_P
3096
+ *     TARGET_CHECK_STRING_OBJECT_FORMAT_ARG
3097
+ *     TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE(VOID)
3098
+ *     C_COMMON_OVERRIDE_OTPTIONS
3099
+ *     TARGET_OPTION_OPTIMIZATION_TABLE
3100
+ *     TARGET_OPTION_INIT_STRUCT
3101
+ *     TARGET_OPTION_DEFAULT_PARAMS
3102
+ */
3103
+
3104
+/* SWITCHABLE_TARGET
3105
+ *
3106
+ * Zip CPU doesn't need this, so it defaults to zero.  No need to change it
3107
+ * here.
3108
+ */
3109
+
3110
+/* TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(VOID) ... Returns true if the
3111
+ * target supports IEEE 754 floating-point exceptions and rounding modes, false
3112
+ * otherwise.  This is intended to relate to the float and double types, but not
3113
+ * necessarily "long double".  By default, returns true if the adddf3
3114
+ * instruction pattern is available and false otherwise, on the assumption that
3115
+ * hardware floating point supports exceptions and rounding modes but software
3116
+ * floating point does not.
3117
+ *
3118
+ * ZipCPU floating point is barely going to be functional, I doubt it will
3119
+ * support all of these bells and whistles when full functionality is even
3120
+ * achieved.  Therefore, we won't support these modes.  However, we can't just
3121
+ * set this to zero, so let's come back to this.
3122
+ */
3123
+// #warning "Wrong answer encoded to date"
3124 103 dgisselq
+// #undef      TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
3125 102 dgisselq
+// #define     TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(X) 0
3126
+
3127
+/* 17.04 Defining data structures for per-function information */
3128
+
3129
+/* INIT_EXPANDERS ... Macro called to initialize any target specific
3130
+ * information.  This macro is called once per function, before generation of
3131
+ * any RTL has begun.  The intention is to allow the initialization of the
3132
+ * function pointer init_machine_status.
3133
+ */
3134
+// #warning "I may need to define this to handle function return addresses ..."
3135
+
3136
+/* 17.05 Storage Layout */
3137
+
3138
+/* Storage Layout */
3139
+#define        BITS_BIG_ENDIAN         0        // MSB has highest number
3140
+#define        BYTES_BIG_ENDIAN        1       // 1 if MSB is lowest number
3141
+#define        WORDS_BIG_ENDIAN        1       // 1 if MSW is lowest number
3142
+#define        FLOAT_WORDS_BIG_ENDIAN  1
3143
+#define        BITS_PER_WORD           32
3144
+// #define     MAX_BITS_PER_WORD       // defaults to BITS_PER_WORD
3145
+#define        UNITS_PER_WORD          1       // Storage units in a word, pwr of 2:1-8
3146
+#define        MIN_UNITS_PER_WORD      1       // Default is UNITS_PER_WORD
3147
+/* POINTER_SIZE ... Width of a pointer in bits.  You must specify a value no
3148
+ * wider than the width of Pmode.  If it is not equal to the width of Pmode,
3149
+ * you must define POINTERS_EXTEND_UNSIGNED. If you do not specify a value the
3150
+ * default is BITS_PER_WORD.
3151
+ *
3152
+ * ZipCPU --- All of our pointers are 32-bits, the width of our address bus.
3153
+ */
3154
+#define        POINTER_SIZE            32      // Ptr width in bits
3155
+/* POINTERS_EXTEND_UNSIGNED ... A C expression that determines how pointers
3156
+ * should be extended from ptr_mode to either Pmode or word_mode.  It is greater
3157
+ * than zero if pointers should be zero-extended, zero if they should be sign
3158
+ * extended, and negative if some other conversion is needed.  In the last case,
3159
+ * the extension is done by the target's ptr_extend instruction.
3160
+ *
3161
+ * You need not define this macro if the ptr_mode, Pmode, and word_mode are all
3162
+ * the same width.
3163
+ *
3164
+ * ZipCPU --- While we shouldn't need this, QImode and HImode have the same
3165
+ * number of bits as SImode.  Therefore, one might wish to convert between the
3166
+ * two.  Hence, we specify how we would do that here.
3167
+ */
3168
+#define        POINTERS_EXTEND_UNSIGNED        0
3169
+
3170
+/* PROMOTE_MODE(m,unsignedp,type) ... A macro to update m and unsignedp when an
3171
+ * object whose type is type and which has he specified mode and signedness is
3172
+ * to be stored in a register.  This macro is only called when type is a scalar
3173
+ * type.
3174
+ *
3175
+ * On most RISC machines, which only have operations that operate on a full
3176
+ * register, define this macro to set m to word_mode if m is an integer mode
3177
+ * narrower than BITS_PER_WORD.  In most cases, only integer modes should be
3178
+ * widened because wider precision floating-point operations are usually more
3179
+ * expensive than their narrower counterparts.
3180
+ *
3181
+ * For most machines, the macro definition does not change unsigndep.  However,
3182
+ * some machines, have instructions that preferentially handle either signed or
3183
+ * unsigned quantities of certain modes.  For example, on the DEC Alpha, 32-bit
3184
+ * loads from memory and 32-bit add instructions sign-extend the result to
3185
+ * 64-bits. On such machines, set unsignedp according to which kind of extension
3186
+ * is more efficient.
3187
+ *
3188
+ * Do not define this macro if it would never modify m.
3189
+ *
3190
+ * ZipCPU --- We need to always (if possible) promote everything to SImode where
3191
+ * we can handle things.  HImode and QImode just don't make sense on this CPU.
3192
+ */
3193
+#define        PROMOTE_MODE(M,U,T)     if ((GET_MODE_CLASS(M)==MODE_INT)&&(GET_MODE_SIZE(M)<2)) (M)=SImode;
3194
+
3195
+// TARGET_PROMOTE_FUNCTION_MODE
3196
+/* PARM_BOUNDARY ... Normal alignment required for function parameters on the
3197
+ * stack, in bits.  All stack parameters receive at least this much alignment
3198
+ * regardless of data type.  On most machines, this is the same as the size of
3199
+ * an integer.
3200
+ */
3201
+#define        PARM_BOUNDARY   32
3202
+
3203
+/* STACK_BOUNDARY ... Define this macro to the minimum alignment enforced by
3204
+ * hardware for the stack pointer on this machine.  The definition is a C
3205
+ * expression for the desired alignment (measured in bits).  This value is used
3206
+ * as a default if PREFERRED_STACK_BOUNDARY is not defined.  On most machines,
3207
+ * this should be the same as PARM_BOUNDARY.
3208
+ */
3209
+#define        STACK_BOUNDARY  PARM_BOUNDARY
3210
+
3211
+/* PREFERRED_STACK_BOUNDARY ... Define this ... */
3212
+
3213
+/* INCOMING_STACK_BOUNDARY
3214
+ */
3215
+
3216
+/* FUNCTION_BOUNDARY ... Alignment required for a function entry point, in bits.
3217
+ */
3218
+#define        FUNCTION_BOUNDARY       32
3219
+
3220
+/* BIGGEST_ALIGNMENT ... Biggest alignment that any data type can require on
3221
+ * this machine, in bits.  Note that this is not the biggest alignment that is
3222
+ * supported, just the biggest alignment that, when violated, may cause a fault.
3223
+ */
3224
+#define BIGGEST_ALIGNMENT      32
3225
+
3226
+/* MINIMUM_ATOMIC_ALIGNMENT ... If defined, the smallest alignment, that can be
3227
+ * given to an object that can be referenced in one operation, without
3228
+ * disturbing any nearby object.  Normally, this is BITS_PER_UNIT, but may be
3229
+ * larger on machines that don't have byte or halfword store operations.
3230
+ */
3231
+#define        MINIMUM_ATOMIC_ALIGNMENT        BITS_PER_UNIT
3232
+
3233
+/* STRICT_ALIGNMENT ... Set this nonzero if move instructions will actually
3234
+ * fail to work when given unaligned data.  If instructions will merely go
3235
+ * slower in that case, define this macro as 0.
3236
+ */
3237
+#define        STRICT_ALIGNMENT        1
3238
+
3239
+/* MAX_FIXED_MODE_SIZE ... An integer expression for the size in bits of the
3240
+ * largest integer machine mode that should actually be used.  All integer
3241
+ * machine modes of this size or smaller can be used for structures and unions
3242
+ * with the appropriate sizes.  If this macro is undefined,
3243
+ * GET_MODE_BITSIZE(DImode) is assumed.
3244
+ *
3245
+ * ZipCPU ... Get_MOD_BITSIZE(DImode) will be 64, and this is really not the
3246
+ * size on bits of the largest integer machine mode.  However, that's the case
3247
+ * with most DI implementations: A long is two words, spliced together.  We'd
3248
+ * like to support that eventually, but we need to get there.  Hence, let's use
3249
+ * compile time flag (ZIP_HAS_DI) that we can enable when we're ready.
3250
+ */
3251
+#if (ZIP_HAS_DI != 0)
3252
+#define        MAX_FIXED_MODE_SIZE     64
3253
+#else
3254
+#define        MAX_FIXED_MODE_SIZE     32
3255
+#endif
3256
+
3257
+
3258
+/* 17.06 Layout of Source Language Data Types */
3259
+
3260
+#undef CHAR_TYPE_SIZE
3261
+#undef SHORT_TYPE_SIZE
3262
+#undef INT_TYPE_SIZE
3263
+#undef LONG_TYPE_SIZE
3264
+#undef LONG_LONG_TYPE_SIZE
3265
+//
3266
+#define        CHAR_TYPE_SIZE  32
3267
+#define        SHORT_TYPE_SIZE 32
3268
+#define        INT_TYPE_SIZE   32
3269
+#define        LONG_TYPE_SIZE  32
3270
+#define        LONG_LONG_TYPE_SIZE     64
3271
+// BOOL_TYPE_SIZE defaults to CHAR_TYPE_SIZE
3272
+#undef FLOAT_TYPE_SIZE
3273
+#undef DOUBLE_TYPE_SIZE
3274
+#undef LONG_DOUBLE_TYPE_SIZE
3275
+#define        FLOAT_TYPE_SIZE         32
3276
+#define        DOUBLE_TYPE_SIZE        FLOAT_TYPE_SIZE // Zip CPU doesn't support dbls
3277
+#define        LONG_DOUBLE_TYPE_SIZE   64      // This'll need to be done via emulation
3278
+// SHORT_FRAC_TYPE_SIZE
3279
+// LONG_FFRACT_TYPE_SIZE
3280
+// LONG_LONG_FRACT_TIME_SIZE
3281
+#undef SHORT_ACCUM_TYPE_SIZE
3282
+#undef ACCUM_TYPE_SIZE
3283
+#undef LONG_ACCUM_TYPE_SIZE
3284
+#define        SHORT_ACCUM_TYPE_SIZE   SHORT_TYPE_SIZE
3285
+#define        ACCUM_TYPE_SIZE         INT_TYPE_SIZE
3286
+#define        LONG_ACCUM_TYPE_SIZE    LONG_TYPE_SIZE
3287
+
3288
+/* LIBGCC2_GNU_PREFIX ... This macro corresponds to the TARGET_GNU_PREFIX target
3289
+ * hook and should be defined if that hook is overriden to be true.  It causes
3290
+ * function names in libgcc to be changed to use a __gnu_ prefix for their name
3291
+ * rather than the default __.  A port which uses this macro should also arrange
3292
+ * to use t-gnu-prefix in the libgcc config.host.
3293
+ *
3294
+ * ZipCPU -- I see no reason to define and therefore change this behavior.
3295
+ */
3296
+
3297
+/* TARGET_FLT_EVAL_METHOD ... A C expression for the value for FLT_EVAL_METHOD
3298
+ * in float.h,, assuming, if applicable, that the floating-point control word
3299
+ * is in its default state.  If you do not define this macro the value of
3300
+ * FLT_EVAL_METHOD will be zero.
3301
+ *
3302
+ * ZipCPU --- ???
3303
+ */
3304
+
3305
+/* WIDEST_HARDWARE_FP_SIZE ... A C expression for the size in bits of the widest
3306
+ * floating-point format supported by the hardware.  If you define this macro,
3307
+ * you must specify a value less than or equal to the value of LONG_DOUBLE_...
3308
+ * If you do not define this macro, the value of LONG_DOUBLE_TYPE_SIZE is the
3309
+ * default.
3310
+ *
3311
+ * ZipCPU supports 32-bit IEEE floats--IF THE SUPPORT IS COMPILED IN!  This
3312
+ * really needs to be determined, then, based upon a compile time parameter
3313
+ * where the one compiling the code states whether or not the H/W even has
3314
+ * floating point support.
3315
+ *
3316
+ * For now, we'll assume it does--but once we implement GCC parameters, we'll
3317
+ * need to change this.
3318
+ */
3319
+#undef WIDEST_HARDWARE_FP_SIZE
3320
+// #warning "Definition needs to change if no FPU present"
3321
+#define        WIDEST_HARDWARE_FP_SIZE FLOAT_TYPE_SIZE
3322
+
3323
+/* DEFAULT_SIGNED_CHAR ... An expression whose value is 1 or 0, according to
3324
+ * whether the type char should be signed or unsigned by default.  The user
3325
+ * can always override this default with the options -fsigned-char and
3326
+ * -funsigned-char.
3327
+ *
3328
+ * ZipCPU--let's go with the default behavior.
3329
+ */
3330
+#define        DEFAULT_SIGNED_CHAR     1
3331
+
3332
+/* TARGET_DEFAULT_SHORT_ENUMS(VOID) ... This target hook should return true if
3333 103 dgisselq
+ * the compiler should give an enum type only as many bytes as it takes to
3334 102 dgisselq
+ * represent the range of possible values of that type.  It should return
3335
+ * false if all enum types should be allocated like int.
3336
+ *
3337
+ * The default is to return false.  This is what the ZipCPU needs, so we won't
3338
+ * override it.
3339
+ */
3340
+
3341
+/* SIZE_TYPE ... A C expression for a string describing the name of the data
3342
+ * type to use for size values.  The typedef name size_t is defined using the
3343
+ * contents of the string.
3344
+ *
3345
+ * If you don't define this macro, the default is "long unsigned int".  Since
3346
+ * on the ZipCPU this is a 32-bit number, and all ZipCPU values are 32-bits,
3347
+ * the default seems perfect for us.
3348
+ */
3349
+#define        SIZE_TYPE       "unsigned int"
3350
+
3351
+/* SIZETYPE ... GCC defines internal types () for expressions dealing with size.
3352
+ * This macro is a C expression for a string describing the name of the data
3353
+ * type from which the precision of sizetype is extracted.  The string has the
3354
+ * same restrictions as SIZE_TYPE string.  If you don't define this macro, the
3355
+ * default is SIZE_TYPE --- which seems good enough for us.
3356
+ */
3357
+
3358
+/* PTRDIFF_TYPE ... A C expression for a string describing the name of the data
3359
+ * type to use fo rthe result of subtracting two pointers.  The typedef name
3360
+ * ptrdiff_t is defined using the contents of the string.  See SIZE_TYPE for
3361
+ * more information.
3362
+ *
3363
+ * The default is "long int" which for the ZipCPU is 32-bits---still good enough
3364
+ * for us.
3365
+ */
3366
+#define        PTRDIFF_TYPE    "int"
3367
+
3368
+/* WCHAR_TYPE ... A C expression for a string describing the name of the data
3369
+ * type to use for wide characters.  The typedef name wchar_t is defined using
3370
+ * the contents of  the string.  If you don't define this macro, the default is
3371
+ * 'int'--good enough for ZipCPU.
3372
+ */
3373
+
3374
+/* WCHAR_TYPE_SIZE ... A C expression for the size in bits of the data type for
3375
+ * wide characters.  This is used in cpp, which cannot make use of WCHAR_TYPE.
3376
+ */
3377
+#undef WCHAR_TYPE_SIZE
3378
+#define        WCHAR_TYPE_SIZE 32
3379
+
3380
+/* WINT_TYPE ... A C expression for a string describing the name of the data
3381
+ * type to use for wide characters passed to printf and returned from getwc.
3382
+ * The typedef name wint_t is defined using the contents of the string.  See
3383
+ *
3384 103 dgisselq
+ * ZipCPU -- If you don't define this macro, the default is "unsigned int"--also
3385
+ * best for us again.
3386 102 dgisselq
+ */
3387
+
3388
+/* INTMAX_TYPE ... A C expression for a string describing the name of the
3389
+ * data type that can represent any value of any standard or extended signed
3390
+ * integer type.  The typedef name intmax_t is defined using the contents of
3391
+ * the string.
3392
+ *
3393
+ * If you don't define this macro, the default is the first of "int", "long int"
3394
+ * or "long long int" that has as much precision as "long long int".
3395
+ */
3396
+
3397
+/* UINTMAX_TYPE ... same as INTMAX_TYPE, but for unsigned
3398
+ */
3399
+
3400
+#undef SIG_ATOMIC_TYPE
3401
+#if (ZIP_ATOMIC != 0)
3402
+#define        SIG_ATOMIC_TYPE "int"
3403
+#else
3404
+#define        SIG_ATOMIC_TYPE NULL    // We have no atomic types, but registers
3405
+#endif
3406
+#undef INT8_TYPE
3407
+#define        INT8_TYPE               NULL    // We have no 8-bit integer type
3408
+#undef INT16_TYPE
3409
+#define        INT16_TYPE              NULL
3410
+#undef INT32_TYPE
3411
+#define        INT32_TYPE              "int"
3412
+#undef UINT8_TYPE
3413
+#define        UINT8_TYPE              NULL
3414
+#undef UINT16_TYPE
3415
+#define        UINT16_TYPE             NULL
3416
+#undef UINT32_TYPE
3417
+#define        UINT32_TYPE             "unsigned int"
3418
+#undef INT_LEAST8_TYPE
3419
+#define        INT_LEAST8_TYPE         "int"
3420
+#undef INT_LEAST16_TYPE
3421
+#define        INT_LEAST16_TYPE        "int"
3422
+#undef INT_LEAST32_TYPE
3423
+#define        INT_LEAST32_TYPE        "int"
3424
+#undef UINT_LEAST8_TYPE
3425
+#define        UINT_LEAST8_TYPE        "unsigned int"
3426
+#undef UINT_LEAST16_TYPE
3427
+#define        UINT_LEAST16_TYPE       "unsigned int"
3428
+#undef UINT_LEAST32_TYPE
3429
+#define        UINT_LEAST32_TYPE       "unsigned int"
3430
+#undef INT_FAST8_TYPE
3431
+#define        INT_FAST8_TYPE          "int"
3432
+#undef INT_FAST16_TYPE
3433
+#define        INT_FAST16_TYPE         "int"
3434
+#undef INT_FAST32_TYPE
3435
+#define        INT_FAST32_TYPE         "int"
3436
+#undef UINT_FAST8_TYPE
3437
+#define        UINT_FAST8_TYPE         "unsigned int"
3438
+#undef UINT_FAST16_TYPE
3439
+#define        UINT_FAST16_TYPE        "unsigned int"
3440
+#undef UINT_FAST32_TYPE
3441
+#define        UINT_FAST32_TYPE        "unsigned int"
3442
+#undef INTPTR_TYPE
3443
+#define        INTPTR_TYPE             "unsigned int"
3444
+#undef UINTPTR_TYPE
3445
+#define        UINTPTR_TYPE            "unsigned int"
3446
+
3447
+#undef INT64_TYPE
3448
+#undef UINT64_TYPE
3449
+#undef INT_LEAST64_TYPE
3450
+#undef UINT_LEAST64_TYPE
3451
+#undef INT_FAST64_TYPE
3452
+#undef UINT_FAST64_TYPE
3453
+
3454
+#if (ZIP_HAS_DI != 0)
3455
+#define        INT64_TYPE              "long int"
3456
+#define        UINT64_TYPE             "long unsigned int"
3457
+#define        INT_LEAST64_TYPE        "long int"
3458
+#define        UINT_LEAST64_TYPE       "long unsigned int"
3459
+#define        INT_FAST64_TYPE         "long int"
3460
+#define        UINT_FAST64_TYPE        "long unsigned int"
3461
+#else
3462
+#define        INT64_TYPE              NULL
3463
+#define        UINT64_TYPE             NULL
3464
+#define        INT_LEAST64_TYPE        NULL
3465
+#define        UINT_LEAST64_TYPE       NULL
3466
+#define        INT_FAST64_TYPE         NULL
3467
+#define        UINT_FAST64_TYPE        NULL
3468
+#endif
3469
+
3470
+#define        TARGET_PTRMEMFUNC_VBI_LOCATION  ptrmemfunc_vbit_in_pfn
3471
+
3472
+
3473
+/* 17.07 Register Usage / Register definitions */
3474
+
3475
+/* FIRST_PSEUDO_REGISTER ... Number of hardware registers known to the compiler.
3476
+ * They receive numbers 0 through FIRST_PSEUDO_REGISTER-1; thus the first
3477
+ * pseudo register's numbrer really is assigned the number
3478
+ * FIRST_PSEUDO_REGISTER.
3479
+ *
3480
+ * ZipCPU---There are 16 registers in the ZipCPU, numbered 0-15 with the CC
3481
+ * and PC register being numbered 14 and 15 respectively.  Therefore, the
3482
+ * compiler can take register number 16 and above and do whatever it wants
3483
+ * with it.
3484
+ */
3485
+#ifdef DEFINE_USER_REGS
3486 103 dgisselq
+#  define      FIRST_PSEUDO_REGISTER   32
3487 102 dgisselq
+#else
3488 103 dgisselq
+#  ifdef       zip_FP_PSEUDO
3489
+#    define    FIRST_PSEUDO_REGISTER   (zip_FP_PSEUDO+1)
3490
+#  else
3491
+#    define    FIRST_PSEUDO_REGISTER   16
3492
+#  endif
3493 102 dgisselq
+#endif
3494
+
3495
+/* FIXED_REGISTERS ... An initializer that says which registers are used for
3496
+ * fixed purposes all throughout the compiled code and are therefore not
3497
+ * available for general allocation.  These would include the stack pointer, the
3498
+ * frame pointer (except on machines where that can be used as a general
3499
+ * register when no frame pointer is needed), the program counter on machines
3500
+ * where that is considered one of the addressable registers, and any other
3501
+ * numbered register with a standard use.
3502
+ *
3503
+ * This information is expressed as a sequence of numbers, separated by commas,
3504
+ * and surrounded by braces.  The nth number is 1 if register n is fixed, 0
3505
+ * otherwise.
3506
+ *
3507
+ * For the Zip CPU, we have three fixed registers that are not available for
3508
+ * general allocation:
3509
+ *
3510
+ *     SP      The stack pointer
3511
+ *     CC      The condition codes and CPU state register
3512
+ *     PC      The program counter
3513
+ *
3514
+ * Other registers, such as FP (the frame pointer) or GBL (the global offset
3515
+ * table pointer) are registers that we hope will not be so fixed.
3516
+ */
3517 103 dgisselq
+#ifdef zip_FP_PSEUDO
3518
+#  define      FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1 }
3519
+#else
3520
+#  define      FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1 }
3521
+#endif
3522 102 dgisselq
+
3523
+/* CALL_USED_REGISTERS ... like FIXED_REGISTERS but has 1 for each register
3524
+ * that is clobbered (in general) by function calls as well as for fixed
3525
+ * registers.  This macro therefore identifies the registers that are not
3526
+ * available for general allocation of values that must live across function
3527
+ * calls.
3528
+ *
3529
+ * If a register has 0 in CALL_USED_REGISTERS, the compiler automatically saves
3530
+ * it on function entry and restores it on function exit, if the register is
3531
+ * used within the function.
3532
+ *
3533
+ * On the Zip CPU, we must save R0 (the return address), and (let's pick) any
3534
+ * register above R5.
3535
+ */
3536 103 dgisselq
+#ifdef zip_FP_PSEUDO
3537
+#  define      CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1 }
3538
+#else
3539
+#  define      CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1 }
3540
+#endif
3541 102 dgisselq
+
3542
+/* CALL_REALLY_USED_REGISTERS ...  optional macro that, if not defined, defaults
3543
+ * to the value of CALL_USED_REGISTERS.
3544
+ */
3545
+
3546
+/* HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE) ... A C expression that is nonzero
3547
+ * if it is not permissible to store a value of mode MODE in hard register REGNO
3548
+ * across a call without some part of it being clobbbered.  For most machines,
3549
+ * this macro need not be defined.  It is only required for machines that do
3550 103 dgisselq
+ * not preserve the entire contents of a register across a call.
3551 102 dgisselq
+ *
3552
+ * In the Zip CPU, we clobber R0 with our return address during a call, so let's
3553
+ * make sure this gets included here.
3554
+ */
3555
+#define        HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE)      (REGNO==0)
3556
+
3557
+/* TARGET_CONDITIONAL_REGISTER_USAGE(VOID) ... This hook may conditionally
3558
+ * modify five variables fixed_regs, call_used_regs, global_regs, reg_names, and
3559
+ * reg_class_contents, to take into account any dependence of these register
3560
+ * sets on target flags.  The first three of these are of type char[]
3561
+ * (interpreted as Boolean vectors).  global_regs is a const char *[] and
3562
+ * reg_class_contents is a HARD_REG_SET.  Before the macro is called,
3563
+ * fixed_regs, call_used_regs, reg_class_contents, and reg_names have been
3564
+ * initialized from FIXED_REGISTERS, CALL_USED_REGISTERS, REG_CLASS_CONTENTS,
3565
+ * and REGISTER_NAMES, respectively.  global_regs has been cleared, and any
3566
+ * -ffixed-reg, -fcall-used-reg, and -fcall-saved-reg command options have been
3567
+ * applied.
3568
+ *
3569
+ * ZipCPU -- I may need to return and define this depending upon how FP and
3570
+ * GBL register allocation go.  But for now, we'll leave this at its default
3571
+ * value.
3572
+ */
3573
+// #warning "Revisit me after FP and GBL allocation"
3574
+
3575
+/* INCOMING_REGNO(out) ... Define this macro if the target machine has register
3576
+ * windows. ...
3577
+ *
3578
+ * Zip CPU has no register windows.
3579
+ */
3580
+
3581
+/* OUTGOING_REGNO ... same thing.
3582
+ */
3583
+
3584
+/* LOCAL_REGNO ... same thing.
3585
+ */
3586
+
3587
+/* PC_REGNUM ... If the program counter has a register number, define this as
3588
+ * that register number.  Otherwise do not define it.
3589
+ */
3590
+#define        PC_REGNUM       zip_PC
3591
+
3592
+
3593
+/* REG_ALLOC_ORDER ... If defined, an initializer for a vector of integers,
3594
+ * containing the number of hard registers in the order in which GCC should
3595
+ * prefer to use them (from most preferred to least.
3596
+ *
3597 103 dgisselq
+ * If this macro is not defined, registers are used lowest numbered first (all
3598 102 dgisselq
+ * else being equal).
3599
+ *
3600
+ * Since the default is the ZipCPU desired case, we won't define this here.
3601
+ */
3602
+
3603
+/* ADJUST_REG_ALLOC_ORDER ... on most machines it is not necessary to define
3604
+ * this macro, so we won't either.
3605
+ */
3606
+
3607
+/* HONOR_REG_ALLOC_ORDER ...
3608
+ */
3609
+
3610
+/* HONOR_REG_ALLOC_ORDER ... on most machines it is not necessary to define
3611
+ * this macro, so we won't either.
3612
+ */
3613
+
3614
+/* HARD_REGNO_NREGS(REGNO, MODE) ... A C expression for the number of
3615
+ * consecutive hard registers, starting at register number REGNO, required to
3616
+ * hold a value of mode MODE.
3617
+ *
3618
+ * On a machine where all registers are exactly one word, a suitable definition
3619
+ * is given of ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)/UNITS_PER_WORD.
3620
+ *
3621
+ * On ZipCPU, we might do
3622
+ *     ((((MODE)==DImode)||((MODE)==DFmode))?2:1)
3623
+ * but I think the default (above) code should work as well.  Hence, let's stick
3624
+ * with the default, lest someone try to create larger modes (TImode, OImode,
3625
+ * XImode) and expect us to follow them properly some how.
3626
+ *
3627
+ * Okay, now in hind sight, we know that the default doesn't work for our
3628
+ * architecture, since GET_MODE_SIZE(SImode)=4, not 1.  Thus, let's rearrange
3629
+ * this expression to work in bits rather than in bytes and we'll know more
3630
+ * of what we are doing.
3631
+ */
3632
+#undef HARD_REGNO_NREGS
3633
+#define        HARD_REGNO_NREGS(REGNO, MODE)   ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)\
3634
+               / (UNITS_PER_WORD))
3635
+
3636
+/* HARD_REGNO_NREGS_HAS_PADDING(REGNO,MODE) ... A C expression that is nonzero
3637
+ * if a value of mode MODE, stored in memory, ends with padding that causes it
3638
+ * to take up more space than in registers starting at register number REGNO
3639
+ * (as determined by multiplying GCC's notion of the size of the register when
3640
+ * containing this mode by the number of registers returned by HARD_REGNO_NREGS)
3641
+ * By default this is zero.
3642
+ *
3643
+ * Zip CPU --- The default looks good enough to me.
3644
+ */
3645
+
3646
+/* HARD_REGNO_NREGS_WITH_PADDING(REGNO, MODE)
3647
+ *
3648
+ * ZipCPU ---
3649
+ */
3650
+
3651
+/* REGMODE_NATURAL_SIZE(MODE) -- Define this macro if the natural size of
3652
+ * registers that hold values of mode mode is not the word size.  It is a C
3653
+ * expression that should give the natural size in bytes for the specified mode.
3654
+ * It is used by the register allocator to try to optimize its results.
3655
+ *
3656
+ * ZipCPU ---
3657
+ */
3658
+// #define     REGMODE_NATURAL_SIZE(MODE)      (((MODE)==DImode)?2:1)
3659
+
3660
+/* HARD_REGNO_MODE_OK ... A C expression that is nonzero if it is permissible
3661 103 dgisselq
+ * to store a value of mode MODE in a hard register number REGNO (or in several
3662 102 dgisselq
+ * registers starting with that one).  For a machine where all registers are
3663
+ * equivalent, a suitable definition is '1'.  You need not include code to check
3664
+ * for the numbers of fixed registers, because the allocation mechanism
3665
+ * considered them to be always occupied.
3666
+ *
3667
+ * ZipCPU --- As long as you are already avoiding the fixed registers, the
3668
+ * suitable default definition mentioned above should be sufficient.
3669
+ */
3670
+#undef HARD_REGNO_MODE_OK
3671 103 dgisselq
+#define        HARD_REGNO_MODE_OK(R,M) (R<zip_CC)
3672 102 dgisselq
+
3673
+/* HARD_REGNO_RENAME_OK(FROM,TO) ... A C expression that is nonzero if it is
3674
+ * okay to rename a hard register FROM to another hard register TO.  One common
3675
+ * use of this macro is to prevernt renaming of a register to another register
3676
+ * that is not saved by a prologue in an interrupt handler.  The default is
3677
+ * always nonzero.
3678
+ *
3679
+ * ZipCPU --- The default looks good enough to us.
3680
+ */
3681
+#undef HARD_REGNO_RENAME_OK
3682
+#define        HARD_REGNO_RENAME_OK(FROM,TO)   ((is_ZIP_GENERAL_REG(FROM))&&(is_ZIP_GENERAL_REG(TO)))
3683
+
3684
+
3685
+/* MODES_TIABLE_P(M1, M2) ... A C expression that is nonzero if a value of mode
3686
+ * M1 is accessible in mode M2 without copying.
3687
+ *
3688
+ * ZipCPU --- well, that's true for us (although we support scant few modes) ...
3689
+ * so lets' set to one.
3690
+ */
3691
+#define        MODES_TIEABLE_P(M1,M2)  1
3692
+
3693
+/* TARGET_HARD_REGNO_SCRATCH_OK(REGNO)
3694
+ * This target hook should return true if it is OK to use a hard register
3695
+ * REGNO has a scratch register in peephole2.  One common use of this macro is
3696
+ * to prevent using of a register that is not saved by a prologue in an
3697
+ * interrupt handler.  The default version of this hook always returns true.
3698
+ *
3699
+ * ZipCPU --- the default works for us as well.  If you are in an interrupt
3700
+ * context, you have an entirely new set of registers (the supervisor set), so
3701
+ * this is a non-issue.
3702
+ */
3703
+
3704
+/* AVOID_CCMODE_COPIES ... define this macro if the compiler should avoid
3705
+ * copies to/from CCmode register(s).  You should only define this macro if
3706
+ * support for copying to/from CCmode is incomplete.
3707
+ *
3708
+ * ZipCPU --- CCmode register copies work like any other, so we'll keep with the
3709
+ * default definition.
3710
+ */
3711
+
3712
+/* STACK_REGS ... Define this if the machine has any stack-like registers.
3713
+ *
3714
+ * Zip CPU has no stack-like registers, as their definition is different from
3715
+ * the ZipCPU stack pointer register.
3716
+ */
3717
+
3718
+#define        ZIP_REG_BYTE_SIZE       1
3719
+
3720
+/* 17.08 Register Classes */
3721
+
3722
+/* enum reg_class ... An enumerate type that must be defined with all the
3723
+ * register class names as enumerated values.  NO_REGS must be first.  ALL_REGS
3724
+ * must be the last register class, followed by one more enumerated value,
3725
+ * LIM_REG_CLASSES, which is not a register class but rather tells how many
3726
+ * classes there are.
3727
+ *
3728
+ * ZipCPU --- We'll defined register 0-13 as general registers, 14-15 in
3729
+ * all_regs, and go from there.
3730
+ */
3731
+enum   reg_class {
3732
+       NO_REGS, GENERAL_REGS,
3733
+#ifdef DEFINE_USER_REGS
3734
+       USER_REGS,
3735
+#endif
3736
+       ALL_REGS, LIM_REG_CLASSES
3737
+};
3738
+
3739
+/* N_REG_CLASSES ... the number of distinct register classes, defined as follows
3740
+ */
3741
+#define        N_REG_CLASSES   (int)LIM_REG_CLASSES
3742
+
3743
+/* REG_CLASS_NAMES ... An initializer containing the names of the register
3744
+ * classes as C string constants.  These names are used in writing some of the
3745
+ * debugging dumps.
3746
+ */
3747
+#define        REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "ALL_REGS" }
3748
+
3749
+/* REG_CLASS_CONTENTS ... An initializer containing the contents of the register
3750
+ * classes, as integerss which are bit masks.  The nth integer specifies the
3751
+ * contents of class n.  That way the integer mask is interpreted as that
3752
+ * register r is in the class if (mask&(1<<r)) is 1.
3753
+ *
3754
+ * When the machine has more than 32 registers ... that's not us.
3755
+ *
3756
+ * ZipCPU --- This is straight forward, three register classes, etc.
3757
+ */
3758 103 dgisselq
+#ifdef zip_FP_PSEUDO
3759
+#define        REG_CLASS_CONTENTS { { 0x00000}, {0x13fff}, {0x1ffff} }
3760
+#else
3761 102 dgisselq
+#define        REG_CLASS_CONTENTS { { 0x00000}, {0x03fff}, {0x0ffff} }
3762 103 dgisselq
+#endif
3763 102 dgisselq
+
3764
+#ifdef DEFINE_USER_REGS
3765
+#define        REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "USER_REGS", "ALL_REGS" }
3766
+#define        REG_CLASS_CONTENTS { { 0x00000},{0x03fff},{0x0ffff0000},{0x0ffffffff} }
3767
+#define        FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }
3768
+#define        CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }
3769
+#endif
3770
+
3771
+/* REGNO_REG_CLASS ... A C expression whose value is a register class
3772
+ * containing hard register REGNO.  In general there is more than one such
3773
+ * class;  Choose a class which is minimal, meaning that no smaller class also
3774
+ * contains the register.
3775
+ */
3776
+#undef REGNO_REG_CLASS
3777 103 dgisselq
+#ifdef zip_FP_PSEUDO
3778
+#define        REGNO_REG_CLASS(R)      (is_ZIP_REG(R)?((((R)<=13)||((R)==zip_FP_PSEUDO))?GENERAL_REGS:ALL_REGS):NO_REGS)
3779
+#else
3780 102 dgisselq
+#define        REGNO_REG_CLASS(R)      (is_ZIP_REG(R)?((R<=13)?GENERAL_REGS:ALL_REGS):NO_REGS)
3781 103 dgisselq
+#endif
3782 102 dgisselq
+
3783
+/* BASE_REG_CLASS ... A macro whose definition is the name of the class to which
3784
+ * a valid base register must belong.  A base register is one used in an address
3785
+ * which is the register value plus a displacement.
3786
+ */
3787
+#undef BASE_REG_CLASS
3788
+#define        BASE_REG_CLASS  GENERAL_REGS
3789
+
3790
+/* MODE_BASE_CLASS(MODE) ... This is a variation of the BASE_REG_CLASS macro
3791
+ * which allows the selection of a bse register in a mode dependent manner.  If
3792
+ * mode is VOIDmode then it should return the same value as BASE_REG_CLASS.
3793
+ */
3794
+#undef MODE_BASE_CLASS
3795
+#define        MODE_BASE_CLASS(MODE)   GENERAL_REGS
3796
+
3797
+/* MODE_BASE_REG_REG_CLASS(MODE) ... A C expression whose value is the register
3798
+ * class to which a valid base register must belong in order to be used in a
3799
+ * base plus index register address.  You should define this macro if base plus
3800
+ * index addresses have different requirements than other base register uses.
3801
+ *
3802
+ * Zip CPU does not support the base plus index addressing mode, thus ...
3803
+ */
3804
+#undef MODE_BASE_REG_REG_CLASS
3805
+#define        MODE_BASE_REG_REG_CLASS(MODE)   NO_REGS
3806
+
3807
+/* INDEX_REG_CLASS ... A macro whose definition is the name of the class to
3808
+ * which a valid index register must belong.  An index register is one used in
3809
+ * an address where its value is either multiplied by a scale factor or added
3810
+ * to another register (as well as added to a displacement).
3811
+ *
3812
+ * ZipCPU -- Has no index registers.
3813
+ */
3814
+#undef INDEX_REG_CLASS
3815
+#define        INDEX_REG_CLASS NO_REGS
3816
+
3817
+/* REGNO_OK_FOR_BASE_P(NUM) ... A C expression which is nonzero if register
3818
+ * number num is suitable for use as a base register in operand addresses.
3819
+ */
3820
+#undef REGNO_OK_FOR_BASE_P
3821
+#ifdef DEFINE_USER_REGS
3822
+# define REGNO_OK_FOR_BASE_P(NUM)      ((NUM != zip_CC)&&(NUM < 16))
3823
+#else
3824
+# define REGNO_OK_FOR_BASE_P(NUM)      (NUM != zip_CC)
3825
+#endif
3826
+
3827
+/* REGNO_MODE_OK_FOR_BASE_P ... A C expressison that is just like
3828
+ * REGNO_OK_FOR_BASE_P, except that that expression may examine the mode of the
3829
+ * memory refgerence in MODE.  You should define this macro if the mode of the
3830
+ * memory reference affects whether a register may be used as a base register.
3831
+ *
3832
+ * ZipCPU --- the mode doesn't affect anything, so we don't define this.
3833
+ */
3834
+
3835
+/* REGNO_MODE_OK_FOR_REG_BASE_P(NUM, MODE) ... base plus index operand
3836
+ * addresses, accessing memory in mode mode.
3837
+ *
3838
+ * Use of this macro is deprecated.
3839
+ */
3840
+
3841
+/* REGNO_MODE_CODE_OK_FRO_BASE_P(N,M,AS,OC,IC) ... A C expression which is
3842
+ * nonzero if a register number N is suitable for use as a base register in
3843
+ * operand addresses, accessing memory in mode M in address space AS.  This is
3844
+ * similar to REGNO_MODE_OK_FOR_BASE_P, except that the expression may examine
3845
+ * the context in which the register appears in the memory reference.
3846
+ *
3847
+ * ZipCPU---We aren't specific in how we use our registers.
3848
+ */
3849
+#define        REGNO_MODE_CODE_OK_FOR_BASE_P(N,M,AS,OC,IC) REGNO_OK_FOR_BASE_P(N)
3850
+
3851
+/* REGNO_OK_FOR_INDEX_P(REGNO) ... A C expression which is nonzero if register
3852
+ * num is suitable for use as an index register in opernad addressess.  It may
3853
+ * be either a suitable hard register or a pseudo register that has been
3854
+ * allocated usch as a hard register.
3855
+ *
3856
+ * ZipCPU has no index registers, therefore we declare this to be zero.
3857
+ */
3858
+#undef REGNO_OK_FOR_INDEX_P
3859
+#define        REGNO_OK_FOR_INDEX_P(REGNO)     0
3860
+
3861
+/* TARGET_PREFERRED_RENAME_CLASS(RCLASS) ... A target hook that places
3862
+ * additional preference on the register class to use when it is necessary to
3863
+ * rename a register in class RCLASS to another class, or perhaps NO_REGS, if no
3864
+ * preferred register class is found or hook preferred_rename_class is not
3865
+ * implemented.  SOmething returning a more restrictive class makes better code.
3866
+ * For example, on ARM, thumb-2 instructions using LO_REGS may be smaller than
3867
+ * instructions using GENERIC_REGS.  By returning LO_REGS from
3868
+ * preferred_rename_class, code size can be reduced.
3869
+ */
3870
+// #undef TARGET_PREFERRED_RENAME_CLASS
3871
+// #define     TARGET_PREFERRED_RENAME_CLASS(RCLASS)   RCLASS
3872
+
3873
+/* TARGET_PREFERRED_RELOAD_CLASS(X,RC) ... A target hook that places additional
3874
+ * restri tions on the register class to use when it is necessary to copy value
3875
+ * X into a register in class RC.  The value is a register class; rehaps RC, or
3876
+ * perhaps a smaller class.
3877
+ *
3878
+ * The default fversion of this hook always returns value of RC argument, which
3879
+ * sounds quite appropriate for the ZipCPU.
3880
+ */
3881
+
3882
+/* PREFERRED_RELOAD_CLASS(X,CLASS) ... A C expression that places additional
3883
+ * restrictions on the register class to use when it is necessary to copy
3884
+ * value X into a register in class CLASS.  On many machines, the following
3885
+ * definition is safe: PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
3886
+ * Sometimes returning a more restrictive class makes better code.  For example,
3887
+ * on the 68k, when x is an integer constant that is in range for a moveq
3888
+ * instruction, the value of this macro is always DATA_REGS as long as CLASS
3889
+ * includes the data registers.  Requiring a Ddata register guarantees that a
3890
+ * 'moveq' will be used.
3891
+ *
3892
+ * ZipCPU --- you can't load certain values into all members of ALL_REGS.  For
3893
+ * example, loading (sleep and !gie) into the CC register could halt the CPU.
3894
+ * Hence, we only allow loads into the GENERAL_REG class.
3895
+ */
3896
+#define        PREFERRED_RELOAD_CLASS(X, CLASS)        GENERAL_REGS
3897
+
3898
+/* TARGET_PREFERRED_OUTPUT_RELOAD_CLASS(RTX,RCLASS) ... Like TARGET_PREFERRED_..
3899
+ * RELOAD_CLASS, but for output instead of input reloads.
3900
+ *
3901
+ * ZipCPU --- there's gotta be a valid default behaviour for this.
3902
+ */
3903
+
3904
+/* LIMIT_RELOAD_CLASS(MODE, CL) ...
3905
+ *
3906
+ * Don't define this macro unless the target machine has limitations which
3907
+ * require the macro to do something nontrivial.  ZipCPU doesn't, so we won't.
3908
+ */
3909
+
3910
+/* TARGET_SECONDARY_RELOAD
3911
+ * SECONDARY_ ...
3912
+ * Don't think we need these ...
3913
+ */
3914
+
3915
+/* CLASS_MAX_NREGS(CLASS,MODE) ... A C expression for the maximum number of
3916
+ * consecutive registers of class CLASS needed to hold a value of mode MODE.
3917
+ *
3918
+ * This is closely related to the macro HARD_REGNO_NREGS.  In fact, the value
3919
+ * of the macro CLASS_MAX_REGS(CL,M) should be the maximum value of
3920
+ * HARD_REGNO_NREGS(REGNO,MODE) for all REGNO values in the class CLASS.
3921
+ *
3922
+ * This macro helps control the handling of multiple word values in the reload
3923
+ * pass.
3924
+ *
3925
+ * ZipCPU --- We'll just use HARDNO_REGNO_NREGS, since CLASS is independent for
3926
+ * us.  We'll also choose register R0, since ... well, since it simply doesn't
3927
+ * matter.  (HARD_REGNO_NREGS ignores this anyway)
3928
+ */
3929
+#define        CLASS_MAX_NREGS(CLASS, MODE)    HARD_REGNO_NREGS(0,MODE)
3930
+
3931
+/* CANNOT_CHANGE_MODE_CLASS
3932
+ * ???
3933
+ */
3934
+
3935
+/* TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS
3936
+ */
3937
+
3938
+/* TARRGET_LRA_P
3939
+ * Default looks good.
3940
+ */
3941
+
3942
+/* TARGET_REGISTER_PRIORITY(INT) ... A target hook which returns the register
3943
+ * priority number to which the register HARD_REGNO belongs to.  THe bigger the
3944
+ * number
3945
+ *
3946
+ * The default version of this target hook returns always zero---good enough for
3947
+ * the ZipCPU.
3948
+ */
3949
+
3950
+/* TARGET_REGISTER_USAGE_LEVELING_P(VOID) ... A target hook which returns true
3951
+ * if we need register usage leveling.  That means if a few hard registers are
3952
+ * equally good for the assignment, we choose the least used hard register.  The
3953
+ * register usage leveling may be profitable for some targets.  Don't use usage
3954
+ * leveling for targets with conditional execution or targets with big register
3955
+ * files as it hurts if-conversion and cross-jumping optimizations.  The default
3956
+ * version of this target hook returns always false.
3957
+ *
3958
+ * ZipCPU --- Default is the right answer.
3959
+ */
3960
+
3961
+/* TARGET_DIFFERENT_ADDR_DISPLACEMENT_P ...
3962
+ * Default looks good.
3963
+ */
3964
+
3965
+/* TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV_P ...
3966
+ * Default looks good.
3967
+ */
3968
+
3969
+/* TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT ....
3970
+ */
3971
+
3972
+/* TARGET_SPILL_CLASS
3973
+ *
3974
+ * ZipCPU --- If we were running in supervisor mode only, this might be the
3975
+ * user set of registers.  However, we're not building for that mode (now),
3976
+ * so we'll leave this at the default of NO_REGS.
3977
+ */
3978
+
3979
+/* TARGET_CSTORE_MODE(ICODE) ... Defines the machine mode to use for the
3980
+ * boolean result of conditional store patterns.  The OCIDE argument is the
3981
+ * instruction code for the cstore being performed.  Not defining this hook is
3982
+ * the same as accepting the mode encoded into operand 0 of the cstore expander
3983
+ * patterns.
3984
+ *
3985
+ * ??? ZipCPU --- I don't follow this documentation.  We'll leave this at the
3986
+ * default therefore.
3987
+ */
3988
+
3989
+/* 17.09 Stack Layout and Calling Conventions */
3990
+
3991
+
3992
+/* STACK_GROWS_DOWNWARD ... Define this macro if pushing a word onto the stack
3993
+ * moves the stack pointer to a smaller address, and false otherwise.
3994
+ *
3995
+ * ZipCPU ... well, our stack does grow downward, but it doesn't do so auto-
3996
+ * magically.  We have to move the stack pointer ourselves.  However, since this
3997
+ * is our convention, we'll define it as such.
3998
+ */
3999
+#undef STACK_GROWS_DOWNWARD
4000
+#define        STACK_GROWS_DOWNWARD    1
4001
+
4002
+/* STACK_PUSH_CODE ... This macro defines the operation used when something is
4003
+ * pushed on the stack.  In RTL, a push operation will be
4004
+ * (set (mem( STACK_PUSH_CODE(reg sp))) ...) The choiecs are PRE_DEC, POST_DEC,
4005
+ * PRE_INC, and POST_INC.  Which of these is correct depends on the stack
4006
+ * direction and on whether the stack pointer points to the last item on the
4007
+ * stack or whether it points to the space for the next item on the stack.
4008
+ * The default is PRE_DECC when STACK_GROWS_DOWNWARD is true, which is almost
4009
+ * always right, and PRE_INC otherwise, which is often wrong.
4010
+ *
4011
+ * ZipCPU --- None of these is right, so let's leave this at the default and
4012
+ * see how badly we get mangled.  In particular, ZipCPU doesn't have any of the
4013
+ * PRE_DEC, POST_DEC, PRE_INC, or POST_INC addressing modes used here.
4014
+ */
4015
+
4016
+/* FRAME_GROWS_DOWNWARD ... Define this macro to nonzero if the addresses of
4017
+ * local variable slots are at negative offsets from the frame pointer.
4018
+ *
4019
+ * ZipCPU --- If the frame pointer is defined as the stack pointer upon the
4020 103 dgisselq
+ * start of function execution, and that stack pointer grows downward, then
4021 102 dgisselq
+ * this should be the case as well.
4022
+ */
4023
+#undef FRAME_GROWS_DOWNWARD
4024
+#define        FRAME_GROWS_DOWNWARD    1
4025
+// #define     FRAME_GROWS_DOWNWARD    0        // This was ECO32's value
4026
+
4027
+
4028
+/* ARGS_GROW_DOWNWARD ... Define this macro if successive arguments to a
4029
+ * function occupy decreasing addresses on the stack.
4030
+ *
4031
+ * ZipCPU -- we can leave this up to the compiler's preferred implementation,
4032
+ * it is of no consequence to the hardware.
4033
+ */
4034
+
4035
+/* STARTING_FRAME_OFFSET ... Offset from the frame pointer to the first local
4036
+ * variable slot to be allocated.  If FRAME_GROWS_DOWNWARD, find the next slot's
4037
+ * offset by subtracting the firstt slot's length from STARTING_FRAME_OFFSET.
4038
+ * Otherwise it is found by adding the length of the first slot to the value
4039
+ * START_FRAME_OFFSET.
4040
+ *
4041
+ * ZipCPU --- I'm not certain on this, let's come back after we look at how
4042
+ * the code is getting generated.  However, the ECO32 code I am copying from
4043
+ * suggests that 0 is the right value, so we'll use that here.
4044
+ */
4045
+// #warning "Re-evaluate me"
4046
+#define        STARTING_FRAME_OFFSET   0
4047
+
4048
+/* STACK_ALIGNMENT_NEEDED ... Define to zero to disable final alignment of the
4049
+ * stack during reload.  The nonzero default for this macro is suitable for most
4050
+ * ports.
4051
+ *
4052
+ * ZipCPU --- we'll leave this at the default, although if any alignment code
4053
+ * shows up on the stack we may need to adjust it.
4054
+ */
4055
+
4056
+/* STACK_POINTER_OFFSET ... Offset from the SP register to the first location at
4057
+ * which outgoing arguments are placed.  If not specified, the default value
4058
+ * of zero is used.  This is the proper value for most machines.
4059
+ */
4060
+#define        STACK_POINTER_OFFSET    0
4061
+
4062
+/* FIRST_PARM_OFFSET ... Offset from the argument pointer register to the first
4063
+ * argument's address.  On some machines it may depend on the data type of the
4064
+ * function.
4065
+ */
4066
+#define        FIRST_PARM_OFFSET(F)    0
4067
+
4068
+/* STACK_DYNAMIC_OFFSET(F) ... Offset from the stack pointer register to an item
4069
+ * dynamically allocated on the stack, e.g., by alloca.  The default value for
4070
+ * this macro is STACK_POINTER_OFFSET plus the length of the outgoing arguments.
4071
+ * The default is correct for most machines, ...
4072
+ *
4073
+ * ZipCPU --- so we'll use it for the ZipCPU.
4074
+ */
4075
+
4076
+/* INITIAL_FRAME_ADDRESS_RTX ... A C expression whose value is RTL representing
4077
+ * the address of the initial stack frame.  This address is passed to
4078
+ * RETURN_ADDR_RTX and DYNAMIC_CHAIN_ADDRESS.  If you don't define this macro,
4079
+ * a reasonable default value will be used.  Define this macro in order to make
4080
+ * frame pointer elimination work in the presence of __builtin_frame_address(C)
4081
+ * and __builtin_return_address(C) for (C) not equal to zero.
4082
+ *
4083
+ * ZipCPU --- Let's try the reasonable default and see what happens.
4084
+ */
4085
+
4086
+/* SETUP_FRAME_ADDRESSES ... A C expression that produces the machine-specific
4087
+ * code to setup the stack so that arbitrary frames can be accessed.  For
4088
+ * example, on the SPARC, we must flush all of the register windows to the stack
4089
+ * before we can access arbitrary stack frames.  You will seldom need to define
4090
+ * this macro.  The default is to do nothing.
4091
+ *
4092
+ * ZipCPU --- which is what we shall do here.
4093
+ */
4094
+
4095
+/* TARGET_BUILTIN_SETJMP_FRAME_VALUE(VOID) ... This target hook should return
4096
+ * an RTX that is used to store the address of the current frame into the
4097
+ * builtin setjmp buffer.  The default value, virtual_stack_vars_rtx, is correct
4098
+ * for most machines.  One reason you may need to define this target hook is if
4099
+ * hard_frame_pointer_rtx is the appropriate value on your machine.
4100
+ *
4101
+ * ZipCPU --- leave this undefined, since the default value should be correct
4102
+ * for "most" machines.
4103
+ */
4104
+
4105
+/* FRAME_ADDR_RTX ... most machines do not need to define it.
4106
+ */
4107
+
4108
+/* RETURN_ADDR_RTX(COUNT,FRAMEADDR) ... A C expression whose value is RTL
4109
+ * representing the value of the return address for the frame COUNT steps up
4110
+ * from the current frame, after the prologue.  FRAMEADDR is the frame pointer
4111
+ * of the COUNT frame, or the frame pointer of the COUNT-1 frame if
4112
+ * RETURN_ADDR_IN_PREVIOUS_FRAME is nonzero.  The value of the expression must
4113
+ * always be the correct address when COUNT is nonzero, but may be NULL_RTX if
4114
+ * there is no way to determine the return address of other frames.
4115
+ *
4116
+ * ZipCPU --- I have no idea how we'd do this, so let's just return NULL_RTX.
4117
+ */
4118
+#undef RETURN_ADDR_RTX
4119
+#define        RETURN_ADDR_RTX(COUNT,FRAMEADDR)        NULL_RTX
4120
+
4121
+/* RETURN_ADDR_IN_PREVIOUS_FRAME ... Define this macro to nonzero value if the
4122
+ * return address of a particular stack frame is accessed from the frame pointer
4123
+ * of the previous stack frame.  The zero default for this macro is suitable
4124
+ * for most ports.
4125
+ *
4126
+ * ZipCPU---Default works here as well.
4127
+ */
4128
+
4129
+/* INCOMING_RETURN_ADDR_RTX ... A C expression whose value is RTL representing
4130
+ * the location of the incoming return address at the beginning of any function,
4131
+ * before the prologue.  This RTL is either a REG, indicating that the return
4132
+ * value is saved in 'REG', or a MEM representing the location in the stack.
4133
+ * If this RTL is a REG, you should define DWARF_RETURN_COLUMN to
4134
+ * DWARF_FRAME_REGNUM(REGNO).
4135
+ *
4136
+ * ZipCPU --- While our incoming return address could theoretically be in any
4137
+ * register, our machine description file is going to place it into register
4138
+ * R0, so that's what we return here.
4139
+ */
4140
+#undef INCOMING_RETURN_ADDR_RTX
4141
+#define        INCOMING_RETURN_ADDR_RTX        gen_rtx_REG(SImode, zip_R0)
4142
+
4143
+
4144
+/* DWARF_ALT_FRAME_RETURN_COLUMN
4145
+ */
4146
+
4147
+/* DWARF_ZERO_REG ... A C exrpession whose value is an integer giving a DWARF2
4148
+ * register number that is considered to always have the value zero.  This
4149
+ * should only be defined if the target has an architected zero register (ZipCPU
4150
+ * does not), and someone decided it was a good idea to use that register number
4151
+ * to terminate the stack backtrace.  New ports should avoid this (so the
4152
+ * ZipCPU port will avoid it as well).
4153
+ *
4154
+ */
4155
+
4156
+/* TARGET_DWARF_HANDLE_FRAME_UNSPEC
4157
+ */
4158
+
4159
+/* INCOMING_FRAME_SP_OFFSET
4160
+ */
4161
+#define        INCOMING_FRAME_SP_OFFSET        0
4162
+
4163
+/* ARG_POINTER_CFA_OFFSET
4164
+ */
4165
+
4166
+/* FRAME_POINTER_CFA_OFFSET
4167
+ */
4168
+
4169
+/* CFA_FRAME_BASE_OFFSET
4170
+ */
4171
+
4172
+/* 17.09.02 Exception handling support */
4173
+
4174
+/* EH_RETURN_DATA_REGNO(N) ... A C expression whose value is the Nth register
4175
+ * number used for data by exception handlers, or INVALID_REGNUM if fewer than
4176
+ * N registers are usable.  The exception handling library routines communicate
4177
+ * with the exception handlers via a set of agreed upon registers.  Ideally
4178
+ * these registers should be call clobbered; it is possible to use call-saved
4179
+ * registers, but may negatively impact code size.  The target must support at
4180
+ * least 2 data registers, but should define 4 if their are enough free
4181
+ * registers.
4182
+ *
4183
+ * You must define this macro if you want to support call frame exception
4184
+ * handling like that provided by DWARF 2.
4185
+ */
4186
+#define        EH_RETURN_DATA_REGNO(N) (((N<ZIP_FIRST_ARG_REGNO)||(N>ZIP_LAST_ARG_REGNO))?(N-1):INVALID_REGNUM)
4187
+
4188
+/* EH_RETURN_STACKADJ_RTX ... A C expression whose value is RTL representing
4189
+ * a location in which to store a stack adjustment to be applied before function
4190
+ * return.  This is used to unwind the stack to an exception handler's call
4191
+ * frame.  It will be assigned zero on code paths that return normally.
4192
+ *
4193
+ * Do not define this macro if the stack pointer is saved and restored by the
4194
+ * regular prolog and epilog code in the call frame itself (which it is for the
4195
+ * ZipCPU); in this case, the exception handling library routines will update
4196
+ * the stack location to be restored in place.  Otherwise, you must define this
4197
+ * macro if you want to support call frame exception handling like that provided
4198
+ * by DWARF 2.
4199
+ *
4200
+ */
4201
+
4202
+/* EH_RETURN_HANDLER_RTX ... A C expression whose value is RTL representing a
4203
+ * location in which to store the address of an exception handler to which we
4204
+ * should return.  It will not be assigned on code paths that return normally.
4205
+ *
4206
+ * Typcally this is the location in the call frame at which the normal return
4207
+ * address is stored.  For targets that return by popping an address of the
4208
+ * stack, this might be a memory address just below the target callf rame
4209
+ * rather than inside the current call frame.  If defined,
4210
+ * EH_RETURN_STACKADJ_RTX will have already been assigned, so it may be used
4211
+ * to calculate the location of the target call frame.
4212
+ *
4213
+ * If you want to support call frame exception handling, you must define either
4214
+ * this macro or the eh_return instruction pattern.
4215
+ */
4216
+// #warning "I don't know what to do here."
4217
+
4218
+/*
4219
+ *
4220
+ *
4221
+ *
4222
+ *   REST OF SECTION SKIPPED ...
4223
+ *
4224
+ *
4225
+ *
4226
+ */
4227
+
4228
+/* 17.09.03 Specifying how stack checking is done */
4229
+
4230
+/* STACK_CHECK_BUILTIN ... a non-zero value if stack checking is done by the
4231
+ * configuration files in a machine-dependent manner.  You should define this
4232
+ * macro if stack checking is required by the ABI of your machine or if you
4233
+ * would like to do stack checking in some more efficient way than the generic
4234
+ * appraoch.  The default value of this macro is zero.
4235
+ *
4236
+ * ZipCPU --- The default makes sense for us.
4237
+ */
4238
+// #define STACK_CHECK_BUILTIN 0
4239
+
4240
+/* STACK_CHECK_STATIC_BUILTIN ... A nonzero value if static stack checking is
4241
+ * done by the configuration files in a machine-dependent manner.  You should
4242
+ * define this macro if you would like to do static stack checking in some more
4243
+ * efficient way than the generic approach.  The default value of this macro
4244
+ * is zero.
4245
+ *
4246
+ * ZipCPU --- The default makes sense for us.
4247
+ */
4248
+
4249
+/* STACK_CHECK_PROBE_INTERVAL_EXP ...  An integer specifying the interval at
4250
+ * which GCC must generate stack probe instructions, defined as 2 raised to this
4251
+ * interval.  You will normally define this macro so that the interval is no
4252
+ * larger than the size of the "guard pages" at the end of a stack area.  The
4253
+ * default value of 12 (4096-byte interval) is suitable for most systems.
4254
+ *
4255
+ * ZipCPU --- Default.
4256
+ */
4257
+
4258
+/* STACK_CHECK_MOVING_SP ... An integer which is non-zero if GCC should move
4259
+ * the stack pointer page by page when doing probes.  This can be necessary
4260
+ * on systems where the stack pointer contains the bottom address of the memory
4261
+ * area accessible to the executing thread at any point in time.  In this
4262
+ * situation, an alternate signal stack is required in order to be able to
4263
+ * recover from a stack overflow.  The default value of this macro is zero.
4264
+ *
4265
+ * ZipCPU -- Default.
4266
+ */
4267
+
4268
+/* STACK_CHECK_PROTECT
4269
+ */
4270
+/* STACK_CHECK_MAX_FRAME_SIZE
4271
+ * ... you should normally not change the default value of this macro.
4272
+ */
4273
+/* STACK_CHECK_FIXED_FRAME_SIZE
4274
+ * ... you ... will normally use the default of four words.
4275
+ */
4276
+
4277
+/* STACK_CHECK_MAX_VAR_SIZE
4278
+ * ... you will normally not need to override that default.
4279
+ */
4280
+
4281
+/* 17.09.04 Registers that Address the Stack Frame*/
4282
+
4283
+/* STACK_POINTER_REGNUM ... The register number of the stack pointer register,
4284
+ * which must also be a fixed register according to FIXED_REGISTERS.  On most
4285
+ * machines, the hardware determines which register this is.
4286
+ */
4287
+#undef STACK_POINTER_REGNUM
4288
+#define        STACK_POINTER_REGNUM    zip_SP
4289
+
4290
+/* FRAME_POINTER_REGNUM ... The register number of the frame pointer register,
4291
+ * which is used to access certain automatic variables in the stack frame.  On
4292
+ * some machines, the hardware determines which register this is.  On other
4293
+ * machines you can choose any register you wish for this purpose.
4294
+ *
4295
+ * ZipCPU --- While I'd like to dump this pointer, since I don't really see
4296
+ * a need for it, alloca() requires it.  Therefore let's assine a register to
4297
+ * this purpose and watch what the compiler does with it.
4298
+ */
4299 103 dgisselq
+#ifdef zip_FP_PSEUDO
4300
+#define        FRAME_POINTER_REGNUM    zip_FP_PSEUDO
4301
+#else
4302 102 dgisselq
+#define        FRAME_POINTER_REGNUM    zip_FP
4303 103 dgisselq
+#endif
4304 102 dgisselq
+
4305
+/* HARD_FRAME_POINTER_REGNUM ... On some machines the offset between the frame
4306
+ * pointer and starting offset of the automatic variables is not known until
4307
+ * after register allocation has been done (for example, because the saved
4308
+ * registers are between these two locations).  On those machines, define
4309
+ * FRAME_POINTER_REGNUM the number of a special, fixed register to be used
4310
+ * internally until the offset is known, and define HARD_FRAME_POINTER_REGNUM
4311
+ * to be the actual hard register number used for the frame pointer.
4312
+ *
4313
+ * Do not define this macro if it would be the same as FRAME_POINTER_REGNUM
4314
+ *
4315
+ * ZipCPU --- we do not define this macro.
4316
+ */
4317 103 dgisselq
+#if (zip_FP == FRAME_POINTER_REGNUM)
4318
+#define HARD_FRAME_POINTER_REGNUM      zip_FP
4319
+#endif
4320 102 dgisselq
+
4321
+/* ARG_POINTER_REGNUM ... The register number of the arg pointer register, which
4322
+ * is used to access the function's argument list.  On some machines, this is
4323
+ * the same as the frame pointer register.  On some machines, the hardware
4324
+ * determines which register this is.  On other machines, you can choose any
4325
+ * register you wish for this purpose.  If this is not the same register as the
4326
+ * frame pointer register, then you must mark it as a fixed register according
4327
+ * to FIXED_REGISTERs, or arrange to be able to eliminate it.
4328
+ *
4329
+ * ZipCPU --- We really don't want to lose another register to something
4330
+ * pointless, so let's set this to be the frame pointer register.  Especially
4331
+ * given the ZipCPU's ease of accessing things via offsets of registers, this
4332
+ * should work for a rather large stack frame.
4333
+ */
4334 103 dgisselq
+#define ARG_POINTER_REGNUM     FRAME_POINTER_REGNUM
4335 102 dgisselq
+
4336
+/* HARD_FRAME_POINTER_IS_FRAME_POINTER ... define this to be a preprocessor
4337
+ * constant that is nonzero if hard_frame_pointer_rtx and frame_pointer_rtx
4338
+ * should be the same.  The default definition is sufficient for us.
4339
+ */
4340
+
4341
+/* HARD_FRAME_POINTER_IS_ARG_POINTER ...
4342
+ * ZipCPU doesn't need this macro
4343
+ */
4344
+
4345
+/* RETURN_ADDRESS_POINTER_REGNUM ... The register number of the return address
4346
+ * pointer register, which is used to access the current function's return
4347
+ * address from the stack.  On some machines, the return address is not at a
4348
+ * fixed offset from the frame pointer or stack pointer or argument pointer.
4349
+ * This register can be defined to point to the return address on the stack, and
4350
+ * then to be converted by ELIMINABLE_REGS into either the frame pointer or the
4351
+ * stack pointer.
4352
+ *
4353
+ * Do not define this macro unless there is no other way to get the return
4354
+ * address from the stack.
4355
+ *
4356
+ * ZipCPU---we need this.
4357
+ */
4358
+#define        RETURN_ADDRESS_REGNUM   zip_R0
4359
+
4360
+
4361
+/* STATIC_CHAIN_REGNUM ... Register numbers used for passing a function's
4362
+ * static chain pointer.  If register windows are used, the register number as
4363
+ * seen by the called function is STATIC_CHAIN_INCOMING_REGNUM, while the
4364
+ * register number as seen by the calling function is STATIC_CHAIN_REGNUM.  If
4365
+ * these register are the same, STATIC_CHAIN_INCOMING_REGNUM need not be
4366
+ * defined.
4367
+ *
4368
+ * ZipCPU doesn't have register windows, so we don't need to define this.
4369
+ */
4370
+// #warning "I have no reason to believe this will even work"
4371
+#define        STATIC_CHAIN_REGNUM     zip_GOT
4372
+
4373
+/* TARGET_STATIC_CHAIN ... This hook replaces the use of STATIC_CHAIN_REGNUM et
4374
+ * al for targets that may use different static chain locations for different
4375
+ * nested functions.  This may be required if the target has function attributes
4376
+ * that affect the calling conventions of the function and those calling
4377
+ * conventions use different static chain locations.
4378
+ *
4379
+ * ZipCPU --- don't need this.
4380
+ */
4381
+// #define     STATIC_CHAIN_REGNUM     zip_R11
4382
+
4383
+
4384
+/* DWARF_FRAME_REGISTERS ... This macro specifies  the maximum number of hard
4385
+ * registers that can be saved in a call frame.  This is used to size data
4386
+ * structures used in DWARF2 exception handling.
4387
+ *
4388
+ * Prior to GCC 3.0, this macro was needed in order to establish a stable
4389
+ * exception handling ABI in the face of adding new hard registers for ISA
4390
+ * extensions.  In GCC 3.0 and later, the EH ABI is insulated from changes in
4391
+ * the number of hard registers.  Nevertheless, this macro can still be used to
4392
+ * reduce the runtime memory requirements of the exception handling routines,
4393
+ * which can be substantial if the ISA contains a lot of registers that are not
4394
+ * call-saved.
4395
+ *
4396
+ * If this macro is not defined, it defaults to FIRST_PSEUDO_REGISTER.
4397
+ *
4398
+ * ZipCPU --- The default is not sufficient.  The CC and PC registers need to
4399
+ * be saved and examined as well in any debug/exception context.  Hence, we
4400
+ * define this to be all of our registers.
4401
+ */
4402
+#undef DWARF_FRAME_REGISTERS
4403
+#define        DWARF_FRAME_REGISTERS   16
4404
+
4405
+/* PRE_GCC3_DWARF_FRAME_REGISTERS ... This macro is similar to DWARF_FRAME_REG..
4406
+ * but is provided for backward compatibility in pre GCC 3.0 compiled code.
4407
+ *
4408
+ * If not defined, it defaults to DWARF_FRAME_REGISTERS---which is perfect for
4409
+ * the ZipCPU.
4410
+ */
4411
+
4412
+/* DWARF_REG_TO_UNWIND_COLUMN(REGNO) ... Define this macro if the target's
4413
+ * representation for dwarf registers is different than the internal
4414
+ * representation for unwind column.  Given a dwarf register, this macro should
4415
+ * return the unwind column number to use instead.
4416
+ *
4417
+ * ... ???
4418
+ */
4419
+
4420
+/* DWARF_FRAME_REGNUM(REGNO) ... Define this macro is the target's
4421
+ * representation for dwarf registers used in .eh_frame or .debug_frame is
4422
+ * different from that used in other debug info sections.  Given a GCC hard
4423
+ * register number, this macro should return the .eh_frame register number.
4424
+ * The default is DBX_REGISTER_NUMBER(REGNO).
4425
+ *
4426
+ * ZipCPU --- provided we define DBX_REGISTER_NUMBER(REGNO) well, this default
4427
+ * should still work for us.
4428
+ */
4429
+
4430
+/* DWARF2_FRAME_REG_OUT(REGNO, FOR_EH) ... Define this macro to map register
4431
+ * numbers held in the call frame info that GCC has collected using
4432
+ * DWARF_FRAME_REGNO to those that should be output in .debug_frame (for_eh is
4433
+ * zero) and .eh_frame (for_eh is non-zero). The default is to return REGNO.
4434
+ *
4435
+ * ZipCPU --- Default is good enough.
4436
+ */
4437
+
4438
+/* REG_VALUE_IN_UNWIND_CONTEXT ... Define this macro if the target stores
4439
+ * register values as _Unwind_Word type in unwind context.  It should be defined
4440
+ * if target register size is larger than the size of void *.  The default
4441
+ * is to store register values as void *type.
4442
+ *
4443
+ * ZipCPU --- Default is what we need.
4444
+ */
4445
+
4446
+/* ASSUME_EXTENDED_UNWIND_CONTEXT ... Define this macro to be 1 if the target
4447
+ * always uses extended unwind context with version, args_size, and by_value
4448
+ * fields.  If it is undefined, it will always be defined to 1 when REG_VALUE_IN_UNWIND_CONTEXT is defined and 0 otherwise.
4449
+ *
4450
+ */
4451
+
4452
+
4453
+/* 17.09.05 Eliminating Frame Pointer and Arg Pointer */
4454
+
4455
+/* TARGET_FRAME_POINTER_REQUIRED(VOID) ... This target hook should return true
4456
+ * if a function must have and use a frame pointer.  This target hook is
4457
+ * called in the reload pass.  If its return value is true, the function will
4458
+ * have a frame pointer.
4459
+ *
4460
+ * This target hook can in principle examine the current function and decide
4461
+ * according to the facts, but on most machines the constant false or the
4462
+ * constant true suffices.  Use false when the machine allows code to be
4463
+ * generated with no frame pointer, and doing so saves some time or space.
4464
+ * Use true when there is no possible advantage to avoiding a frame pointer.
4465
+ *
4466
+ * ZipCPU---if we add in a frame pointer, we become register starved.  Hence,
4467
+ * we'll treat this as a constant false--which is also the default value.
4468
+ */
4469
+#define        target_frame_pointer_required   zip_frame_pointer_required
4470
+
4471
+/* INITIAL_FRAME_POINTER_OFFSET ... A C statement to store in the variable
4472
+ * depth-var the difference between the frame pointer and the stack pointer
4473
+ * values immediately after the function prologue.  The value would be computed
4474
+ * from information such as the result of get_frame_size() and the tables of
4475
+ * registers regs_ever_live and call_used_regs.
4476
+ *
4477
+ * If ELIMINABLE_REGS is defined, this macro will not be used and need not be
4478
+ * defined.  Otherwise, it must be defined even if TARGET_FRAME_POINTER_REQD
4479
+ * always returns true; in that case you may set depth-var to anything.
4480
+ *
4481
+ * ZipCPU --- we intend to set ELIMINABLE_REGS, so this is not necessary.
4482
+ */
4483
+// #define     INITIAL_FRAME_POINTER_OFFSET(DEPTH)     (DEPTH) = 0
4484
+
4485
+
4486
+/* ELIMINABLE_REGS ... If defined, this macro specifies a table of register
4487
+ * pairs used to eliminate unneeded registers that point into the stack frame.
4488
+ * If it is not defined, the only elimination attempted by the compiler is to
4489
+ * replace references to the frame pointer with references to the stack pointer.
4490
+ *
4491
+ * On some machines, the position of the argument pointer is not known until
4492
+ * the compilation is completed.  In such a case, a separate hard register
4493
+ * must be used for the argument pointer.  This register can be eliminated by
4494
+ * replacing it with either the frame pointer or the argument pointer,
4495
+ * depending on whether or not the frame pointer has been eliminated.
4496
+ *
4497
+ * ZipCPU we'll take their suggestion and define this as:
4498
+ */
4499
+#undef ELIMINABLE_REGS
4500 103 dgisselq
+#ifdef zip_FP_PSEUDO
4501 102 dgisselq
+#define        ELIMINABLE_REGS \
4502 103 dgisselq
+        {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM},          \
4503
+         { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM},     \
4504
+         { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM},        \
4505
+         { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
4506
+#else
4507
+# if (ARG_POINTER_REGNUM == FRAME_POINTER_REGNUM)
4508
+#  define      ELIMINABLE_REGS \
4509
+        {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
4510
+# else
4511
+#  define      ELIMINABLE_REGS \
4512 102 dgisselq
+       {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM },  \
4513
+        { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM },  \
4514
+        { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
4515 103 dgisselq
+# endif
4516
+#endif
4517 102 dgisselq
+
4518
+/* bool TARGET_CAN_ELIMINATE(FROM,TO) ... This target function should return
4519
+ * true if the compiler is allowed to try to replace register number FROM with
4520
+ * register number TO.  This target hook need only be defined if ELIMINABLE_REGS
4521
+ * is defined, and will usually return true since most of the cases preventing
4522
+ * register elimination are things that the compiler  already knows about.
4523
+ *
4524
+ * ZipCPU ... does the compiler  know about my decision as to whether or not
4525
+ * the frame pointer was needed?  The m68k code suggests it does not ...
4526
+ */
4527
+#define TARGET_CAN_ELIMINATE   zip_can_eliminate
4528
+
4529
+/* INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) ... This macro is similar to
4530
+ * INITIAL_FRAME_POINTER_OFFSET.  It specifies the initial difference between
4531
+ * the specified pair of registers.  This macro must be defined if
4532
+ * ELIMINABLE_REGS is defined.
4533
+ *
4534
+ * ZipCPU---Is there a default we can use?
4535
+ */
4536
+#define        INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)    (OFFSET)=0
4537
+/*
4538
+#define        INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)            \
4539
+       do { (OFFSET) = zip_initial_elimination_offset((FROM), (TO)); } \
4540
+       while(0)                                        \
4541
+*/
4542
+
4543
+/* 17.09.06 Passing function arguments on the stack */
4544
+
4545
+/* TARGET_PROMOTE_PROTOTYPES ... Returns true if an argument declared in a
4546
+ * prototype as an integral type smaller than int should actually be
4547
+ * passed as an int.  In addition to avoiding errors in certain cases of
4548
+ * mismatch, it also makes for better code on certain machines.  The default is
4549
+ * to not promote prototypes.
4550
+ *
4551
+ * Since everything is an int on the ZipCPU, let's promote anything smaller
4552
+ * (which should still be an int) up to an int anyway.
4553
+ */
4554
+#undef TARGET_PROMOTE_PROTOTYPES
4555
+#define        TARGET_PROMOTE_PROTOTYPES       hook_bool_const_tree_true
4556
+
4557
+/* PUSH_ARGS ... A C expression.  If nonzero, push instructions will be used to
4558
+ * pass outgoing arguments.  If the target machine does not have a push
4559
+ * instruction, set it to zero.  That directs GCC to use an alternate strategy:
4560
+ * to allocate the entire argument block and then store the arguments into it.
4561
+ * When PUSH_ARGS is nonzero, PUSH_ROUNDING must be defined too.
4562
+ *
4563
+ * ZipCPU does not have a push instruction, so we set this to zero.
4564
+ */
4565
+#undef PUSH_ARGS
4566
+#define        PUSH_ARGS       0
4567
+
4568
+/* PUSH_ARGS_REVERSED ... A C expression.  If nonzero, function arguments will
4569
+ * be evaluated last to first, rather than first to last.  If this macro is
4570
+ * not defined, it defaults to PUSH_ARGS on targets where the stack and args
4571
+ * grow in opposite directions, and zero otherwise.
4572
+ *
4573
+ * ZipCPU---Let's evaluate our arguments first to last.
4574
+ */
4575
+#define        PUSH_ARGS_REVERSED      1
4576
+
4577
+/* PUSH_ROUNDING(NPUSHED) ... A C expression that is the number of bytes
4578
+ * actually pushed onto the stack when an instruction attempts to push
4579
+ * (NPUSHED) bytes.
4580
+ *
4581
+ * ZipCPU---We cannot push bytes.  Let's leave this undefined and see what
4582
+ * happens.
4583
+ */
4584
+// #warning "No appropriate definition seemed right."
4585
+
4586
+/* ACCUMULATE_OUTGOING_ARGS ... A C expression.  If non-zero, the maximum amount
4587
+ * of space required for outgoing arguments will be computed and placed into
4588
+ * crtl->outgoing_args_size.  No space will be pushed onto the stack for each call; instead the function prologue should increase the stack frame size by this
4589
+ * amount.
4590
+ *
4591
+ * ZipCPU---This is *cool* and so necessary---it saves an extra two instructions
4592
+ * each time we try to call a function/routine.  Yes, we want and *need* this
4593
+ * for good performance.  I mean, think of it, free performance increase?  Who
4594
+ * could argue with that?
4595
+ */
4596
+#undef ACCUMULATE_OUTGOING_ARGS
4597
+#define        ACCUMULATE_OUTGOING_ARGS        1
4598
+
4599
+
4600
+/* REG_PARM_STACK_SPACCE(FN) ... Define this macro if functions should assume
4601
+ * that stack space has been allocated for arguments even when their values
4602
+ * are passed in registers.  The value of this macro is the size, in bytes, of
4603
+ * the area reserved for arguments passed in registers for the function
4604
+ * represented by FN, which can be zero if GCC is calling a library function.
4605
+ * The argument FN can be the FUNCTION_DECL, or the type itself of the function.
4606
+ *
4607
+ * This space can be allocated by the caller, or be part of the machine
4608
+ * dependent stack frame: OUTGOING_REG_PARM_STACK_SPACE says which.
4609
+ *
4610
+ * ZipCPU --- Why allocate space you won't use?  Let's leave this undefined
4611
+ * therefore.
4612
+ */
4613
+// #undef      REG_PARM_STACK_SPACE
4614
+
4615
+
4616
+
4617
+/* INCOMING_REG_PARM_STACK_SPACE(FN) ... Like REG_PARM_STACK_SPACE, but for
4618
+ * incoming register arguments.  Define this macro if space guaranteed when
4619
+ * compiling a function body is different to space required when making a call,
4620
+ * a situation that can arise with K&R style function definitions.
4621
+ *
4622
+ */
4623
+
4624
+/* OUTGOING_REG_PARM_STACK_SPACE(FN) ... Define this to a nonzero value if it
4625
+ * is the responsibility of the caller to allocate the area reserved for
4626
+ * arguments passed in registers when calling a function of FN.  FN may be NULL
4627
+ * if the function called is a library function.
4628
+ *
4629
+ * ZipCPU---Why allocate space you don't need?
4630
+ */
4631
+#define        OUTGOING_REG_PARM_STACK_SPACE(FNTYPE)   0
4632
+
4633
+
4634
+/* STACK_PARMS_IN_REG_PARM_AREA ... Define this macro if REG_PARM_STACK_SPACE
4635
+ * is defined, buyt the stack parameters don't skip the area specified by it.
4636
+ *
4637
+ * ZipCPU---We didn't define REG_PARM_STACK_SPACE, so we won't define this.
4638
+ */
4639
+
4640
+/* TARGET_RETURN_POPS_ARGS(DECL,FNTYPE,SZ) ... This target hook returns the
4641
+ * number of bytes of its own arguments that a function pops on returning, or 0
4642
+ * if the function pops no arguments and the caller must therefore pop them all
4643
+ * after the function returns.
4644
+ *
4645
+ * ZipCPU --- If we define this, we'll lose our gain from
4646
+ * ACCUMULATE_OUTOING_ARGS.  Thus, we leave this undefined.
4647
+ */
4648
+
4649
+/* CALL_POPS_ARGS(CUM) ... A C expression that should indicate the number of
4650
+ * bytes a call sequence pops off of the stack.  It is added to the value of
4651
+ * RETURN_POPS_ARGS when compiling a function call.  CUM is the variable in
4652
+ * which all arguments to the function have been accumulated.
4653
+ *
4654
+ * ZipCPU---The call sequence, by itself, doesn't touch the stack.  Therefore
4655
+ * this is zero.
4656
+ */
4657
+#undef CALL_POPS_ARGS
4658
+#define        CALL_POPS_ARGS(CUM)     0
4659
+
4660
+
4661
+/* 17.09.07 Passing arguments in registers */
4662
+
4663
+/* TARGET_FUNCTION_ARG ... Return an RTX indicating whether a function argument
4664
+ * is passed in a register, and if so, which register.
4665
+ */
4666
+/*
4667
+ * This has been poisoned ... so let's not define it anymore and look for
4668
+ * a better way to do this ...
4669
+ *
4670
+ * #define     FUNCTION_ARG(CUM, MODE, TYPE, NAMED) (((NAMED) == 0) ? NULL_RTX
4671
+ *     : targetm.calls.must_pass_in_stack(MODE, TYPE)  ? NULL_RTX
4672
+ *     : (CUM) > ZIP_LAST_ARG_REGNO                    ? NULL_RTX
4673
+ *     : gen_rtx_REG(MODE, CUM))
4674
+ */
4675
+#define        TARGET_FUNCTION_ARG     zip_function_arg
4676
+
4677
+
4678
+/* TARGET_MUST_PASS_IN_STACK ...
4679
+ */
4680
+// #undef      TARGET_MUST_PASS_IN_STACK
4681
+// #define     TARGET_MUST_PASS_IN_STACK       zip_must_pass_in_stack
4682
+
4683
+/* TARGET_FUNCTION_INCOMING_ARG ... Define this hook if the target machine
4684
+ * has register windows, ... which ZipCPU does not have.
4685
+ */
4686
+
4687
+/* TARGET_USE_PSEUDO_PIC_REG(void) ... This hook should return 1 in case
4688
+ * pseudo register should be created for pic_offset_table_rtx during function
4689
+ * expand.
4690
+ *
4691
+ * This should be defined by global parameters, isn't it?
4692
+ */
4693
+
4694
+/* TARGET_INIT_PIC_REG(v) ... Perform a target dependent initialization of
4695
+ * pic_offset_table_rtx.  This hook is called at the start of register
4696
+ * allocation.
4697
+ *
4698
+ * ZipCPU---Let's revisit this.
4699
+ */
4700
+// #warning "Come back and relook at relocations"
4701
+
4702
+/* TARGET_ARG_PARTIAL_BYTES ... This target hook returns the number of bytes
4703
+ * at the beginning of an argument that must be put in registers.  The value
4704
+ * must be zero for arguments that are passed entirely in registers or that
4705
+ * are entirely pushed on the stack.
4706
+ */
4707
+// #undef      TARGET_ARG_PARTIAL_BYTES
4708
+// #define     TARGET_ARG_PARTIAL_BYTES        zip_arg_partial_bytes
4709
+
4710
+/* TARGET_PASS_BY_REFERENCE(CUM,MOD,TREE,NAMED) ... This target hook should
4711
+ * return true if an argument at the position indicated by CUM should be passed
4712
+ * by reference.  This predicate is queried after target independent reasons
4713
+ * for being pssed by reference, such as TREE_ADDRESSABLE(TREE).
4714
+ *
4715
+ */
4716
+// #undef      TARGET_PASS_BY_REFERENCE
4717
+// #define     TARGET_PASS_BY_REFERENCE        zip_pass_by_reference
4718
+
4719
+/* CUMULATIVE ARGS ...  A C type for declaring a variable that is used as the
4720
+ * first argument of 'FUNCTION_ARG' and other related values.
4721
+ *
4722
+ * ZipCPU---We're in trouble if an 'int' won't work, so let's just use that.
4723
+ */
4724
+#define        CUMULATIVE_ARGS int
4725
+
4726
+/*
4727
+ * OVERRIDE_ABI_FORMAT
4728
+ */
4729
+
4730
+/* INIT_CUMULATIVE_ARGS ... A C statement (sans semicolon) for initializing the
4731
+ * variable CUM for the state at the beginning of the argument list.
4732
+ *
4733
+ *
4734
+ * ZipCPU---The first argument is passed in register ZIP_FIRST_ARG_REGNO, or
4735
+ * R1 (unless it has been redefined above ...)
4736
+ */
4737
+#define        INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) (CUM = 0)
4738
+
4739
+/* INIT_CUMULATIVE_LIBCALL_ARGS
4740
+ * INIT_CUMULATIVE_INCOMING_ARGS
4741
+ *
4742
+ * These default to the last INIT_CUM_ARGS value above.
4743
+ */
4744
+
4745
+/* TARGET_FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) .. This hook updates
4746
+ * the summarizer variable pointed to by CUM to advance past an argument in
4747
+ * the argument list.  The values MODE, TYPE, and NAMED describe that
4748
+ * argument.  Once this is done, the variable CUM is suitable for analyzing the
4749
+ * following argument with TARGET_FUNCTION_ARG, etc.  This hook need not do
4750
+ * anything if the argument in question was passed on the stack.  The compiler
4751
+ * knows how to track the amount of stack space used for arguments without
4752
+ * any special help.
4753
+ *
4754
+ * ZipCPU---Here we simply copy from ECO32.
4755
+ */
4756
+#define        TARGET_FUNCTION_ARG_ADVANCE     zip_function_arg_advance
4757
+
4758
+/*
4759
+ * TARGET_ARG_OFFSET --- not necessary
4760
+ * FUNCTION_ARG_PADDING        --- not necessary, since we shouldn't be padding
4761
+ * PAD_VARARGS_DOWN    --- not necessary, since we shouldn't be padding
4762
+ * BLOCK_REG_PADDING
4763
+ * TARGET_FUNCTION_ARG_BOUNDARY
4764
+ * TARGET_FUNCTION_ARG_ROUND_BOUNDARY
4765
+ */
4766
+
4767
+/* FUNCTION_ARG_REGNO_P(REGNO) ... A C expression that is nonzero if REGNO is
4768
+ * the number of a hard register in which function arguments are sometimes
4769
+ * passed.  This does not include implicit arguments such as the static chain
4770
+ * and the structure-value address.  On many machines, no registers can be used
4771
+ * for this purpose since all function arguments are pushed on the stack.
4772
+ */
4773
+#define        FUNCTION_ARG_REGNO_P(r) ((r >= ZIP_FIRST_ARG_REGNO)&&(r<=ZIP_LAST_ARG_REGNO))
4774
+
4775
+/* TARGET_SPLIT_COMPLEX_ARG(TYPE) ... This hook should return true if parameter
4776
+ * of type TYPE are passed as two scalar parameters.  By default, GCC will
4777
+ * attempt to pack complex arguments into the target's word size.  Some ABI's
4778
+ * require complex arguments to be split and treated as their individual
4779
+ * components.
4780
+ *
4781
+ * The default value of this hook is NULL, which is treated as always false,
4782
+ * and which should be good enough for ZipCPU--which can go either way.
4783
+ */
4784
+
4785
+/* TARGET_BUILD_BUILTIN_VA_LIST ... This hook returns a type node for va_list
4786
+ * for the target.  The default version of the hook returns void*.
4787
+ *
4788
+ */
4789
+
4790
+/* TARGET_ENUM_VA_LIST_P
4791
+ */
4792
+
4793
+/* TARGET_FN_ABI_VA_LIST ... This hook returns the va_list type of the calling
4794
+ * convention specified by FN.  The default version of this returns va_list_type_node.
4795
+ */
4796
+
4797
+/* TARGET_FN_ABI_VA_LIST
4798
+ */
4799
+
4800
+/* TARGET_CANONICAL_VA_LIST_TYPE
4801
+ */
4802
+
4803
+/* TARGET_GIMPLIFY_VA_ARG_EXPR
4804
+ */
4805
+
4806
+/* TARGET_VALID_POINTER_MODE(MODE) ... Define this to return nonzero if the
4807
+ * port can handle pointers with machine mode MODE.  The default version of this
4808
+ * hook returns true for both ptr_mode and Pmode.
4809
+ *
4810
+ * ZipCPU---if Pmode is properly defined (above, and I think it is), then the
4811
+ * default behavior is quite appropriate.
4812
+ */
4813
+
4814
+/* TARGET_REF_MAY_ALIAS_ERRNO(REFP) ... Define this to return nonzero if the
4815
+ * memory reference REF may alias with the system C library errno location.
4816
+ * The default version of this hook assumes the system C library errno location
4817
+ * is either a declaration of type int or accessed by dereferencing a pointer
4818
+ * to int.
4819
+ *
4820
+ * ZipCPU --- Default sounds good to me.
4821
+ */
4822
+
4823
+
4824
+/* TARGET_SCALAR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if
4825
+ * the port is prepared to handl instructions involving scalar mode MODE.  For
4826
+ * a scalar mode to be considered supported, all the basic arithmetic and
4827
+ * comparisons must work.
4828
+ *
4829
+ * The default version of this hook returns true for any mode required to
4830
+ * handle the basic C types (as defined by the port).  Included here are the
4831
+ * double-word arithmetic supported by the code in optabs.c.
4832
+ */
4833
+#undef TARGET_SCALAR_MODE_SUPPORTED_P
4834
+#define        TARGET_SCALAR_MODE_SUPPORTED_P  zip_scalar_mode_supported_p
4835
+
4836
+/* TARGET_VECTOR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if the
4837
+ * port is prepared to handle instructions involving vector mode MODE.  At the
4838
+ * very least, it must have move patterns for this mode.
4839
+ *
4840
+ * ZipCPU---does not support any vector modes.
4841
+ */
4842
+#undef TARGET_VECTOR_MODE_SUPPORTED_P
4843
+#define        TARGET_VECTOR_MODE_SUPPORTED_P  hook_bool_mode_false
4844
+
4845
+/* TARGET_ARRAY_MODE_SUPPORTED_P(MODE, NELEMS) ... Return true if GCC should
4846
+ * try to use a scalar mode to store an array of NELEMS elements, given that
4847
+ * each element has mode MODE.  Returning true here overrides the usual MAX_FIXED_MODE limit and allows GCC to use any defined integer mode.
4848
+ *
4849
+ * ZipCPU---Sounds good.
4850
+ */
4851
+// #undef      TARGET_ARRAY_MODE_SUPPORTED_P
4852
+// #define     TARGET_ARRAY_MODE_SUPPORTED_P   zip_array_mode_supported_p
4853
+
4854
+/* TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P(MODE) ... Define this to return
4855
+ * nonzero if libgcc provides support for the floating-point mode MODE, which is
4856
+ * known to pass TARGET_SCALAR_MODE_SUPPORTED_P.  The default version of this
4857
+ * hook returns true for all of SFmode, DFmode, XFmode, and TFmode, if such
4858
+ * modes exist.
4859
+ *
4860
+ * ZipCPU---We only support SFmode and DFmode, but for now only in emulation
4861
+ * (if we can).  Let's allow both of those and see how far we get.
4862
+ */
4863
+#undef TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P
4864
+#define        TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P zip_libgcc_floating_mode_supported_p
4865
+
4866
+/* TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P(MODE) ... Define this to return
4867
+ * nonzero for machine modes for which the port has small register classes.  If
4868
+ * target hook returns nonzero for a given MODE, the compiler will try to
4869
+ * minimize the lifetime of registers in MODE.  The hook may be called with
4870
+ * VOIDmode as an argument.  In this case, the hook is expected to return
4871
+ * nonzero if it returns nonzero for any mode.
4872
+ *
4873
+ * The default version of this hook returns false for any mode.
4874
+ *
4875
+ * ZipCPU---Default sounds good.
4876
+ */
4877
+
4878
+/* 17.09.08 How scalar function values are returned */
4879
+
4880
+/* TARGET_FUNCTION_VALUE
4881
+ */
4882
+
4883
+/* LIBCALL_VALUE
4884
+ */
4885
+
4886
+
4887
+/* 17.09.09 How large values are returned */
4888
+
4889
+/* TARGET_RETURN_IN_MEMORY(TYP,FNTYP) ... This target hook should return a
4890
+ * nonzero value to say to return the function value in memory, just as large
4891
+ * structures are always returned.  Here type will be the data type of the value
4892
+ * and FNTYP will be the type of the function doing the returning, or NULL
4893
+ * for libcalls.
4894
+ *
4895
+ */
4896
+#undef TARGET_RETURN_IN_MEMORY
4897
+#define        TARGET_RETURN_IN_MEMORY zip_return_in_memory
4898
+
4899
+/* DEFAULT_PCC_STRUCT_RETURN
4900
+ * TARGET_STRUCT_VALUE_RTX
4901
+ * PCC_STATIC_STRUCT_RETURN
4902
+ * TARGET_GET_RAW_RESULT_MODE
4903
+ * TARGET_GET_RAW_ARG_MODE
4904
+ */
4905
+
4906
+
4907
+/* 17.09.10 Caller-Saves Register Allocation */
4908
+/* 17.09.11 Function Entry and Exit */
4909
+/* 17.09.12 Generating code for profiling */
4910
+/* 17.09.13 Permitting tail calls*/
4911
+/* 17.09.14 Stack smashing protection */
4912
+/* 17.09.15 Miscellaneous register hooks */
4913
+
4914
+/* TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
4915
+ * ZipCPU --- default is good enough for us.
4916
+ */
4917
+
4918
+/* 17.10 Implementing VARARGS MACROS */
4919
+
4920
+/* ...
4921
+ */
4922
+
4923
+/* void TARGET_SETUP_INCOMING_VARARGS(A,M,T,I,S) ... This target hook offers an
4924
+ * alternative to using __builtin_saveregs and defining the hook TARGET_EXPAND..
4925
+ * _BUILTIN_SAVEREGS.  Use it to store the anonymous register arguments into the
4926
+ * stack so that all the arguments appear to have been passed consecutively
4927
+ * on the stack.  Once this is done, you can use the standard implementation
4928
+ * of varargs that works for machines that pass all their arguments on the
4929
+ * stack.
4930
+ */
4931
+// #undef      TARGET_SETUP_INCOMING_VARARGS
4932
+// #define     TARGET_SETUP_INCOMING_VARARGS   zip_setup_incoming_varargs
4933
+
4934
+/* ...
4935
+ */
4936
+
4937
+/* 17.11 Trampolines for Nested Functions */
4938
+
4939
+/* TARGET_ASM_TRAMPOLINE_TEMPLATE ... This hook is called by
4940
+ * assemble_trampoline_template to output, on the stream f, assembler code for
4941
+ * a block of data that contains the constant parts of a trampoline.  This code
4942
+ * should not include a label--the label is taken care of automatically.
4943
+ *
4944
+ * ZipCPU -- looks like we need to do this.
4945
+ */
4946
+#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
4947
+#define        TARGET_ASM_TRAMPOLINE_TEMPLATE  zip_asm_trampoline_template
4948
+
4949
+/* TRAMPOLINE_SECTION ... Return the section into which the trampoline template
4950
+ * is to be placed.  The default value is readonly_data_section.
4951
+ *
4952
+ * ZipCPU--default should be good enough.
4953
+ */
4954
+
4955
+/* TRAMPOLINE_SIZE ... A C expression for the size (in bytes) of the trampoline
4956
+ * as an integer.
4957
+ *
4958
+ * ZipCPU--it's three instructions, or 96 bits.  However, 32-bits is our minimal
4959
+ * addressible unit, so what size do we offer here?  We'll stick with the number
4960
+ * of bytes, but we may need to change this later.
4961
+ *
4962
+ */
4963
+// #warning "May need to redefine trampoline_size in words, not bytes"
4964
+#undef TRAMPOLINE_SIZE
4965
+#define        TRAMPOLINE_SIZE 3
4966
+
4967
+/* TRAMPOLINE_ALIGNMENT ... alignment required for trampolines, in bits.
4968
+ *
4969
+ * Well that's well known in ZipCPU --- 32-bits.
4970
+ */
4971
+#undef TRAMPOLINE_ALIGNMENT
4972
+#define        TRAMPOLINE_ALIGNMENT    32
4973
+
4974
+/* void TARGET_TRAMPOLINE_INIT(RTX,TREE,RTX CH) ... This hook is called to
4975
+ * initialize a trampoline.  m_tramp is an RTX for the memory block for the
4976
+ * trampoline; TREE is the FUNCTION_DECL for the nested fucntion;  CH is an
4977
+ * rtx for the static chain value that should be passed to the function when
4978
+ * it is called.
4979
+ *
4980
+ * ZipCPU ... Can we get by without this?
4981
+ */
4982
+#undef TARGET_TRAMPOLINE_INIT
4983
+#define        TARGET_TRAMPOLINE_INIT  zip_trampoline_init
4984
+
4985
+/* TARGET_TRAMPOLINE_ADJUST_ADDRESS(RTX) ... This hook should perform any
4986
+ * machine-specific adjustment in the address of the trampoline.  Its argument
4987
+ * contains the address of the memory block that was passed to
4988
+ * TARGET_TRAMPOLINE_INIT.  In case the address to be used for a function call
4989
+ * should be different from the address at which the template was stored, the
4990
+ * different address should be returned; otherwise addr should be returned
4991
+ * unchanged.  If the hook is not defined, RTX (addr) will be used for function
4992
+ * calls.
4993
+ *
4994
+ * ZipCPU--works for us!
4995
+ */
4996
+
4997
+/* CLEAR_INSN_CACHE(BEG,END) ... If defined, expands to a C expression clearing
4998
+ * the instruction cache in the specified interval.  The definition of this
4999
+ * macro would typically be a series of asm statements.   Both BEG and END are
5000
+ * pointer expressions.
5001
+ *
5002
+ * ZipCPU --- Ouch!  We have no way to do this (yet)!
5003
+ */
5004
+
5005
+/* TRANSFER_FROM_TRAMPOLINE ... Define this macro is trampolines need a special
5006
+ * subroutine to do their work.  THe macro should expand to a series of asm
5007
+ * statements which will be compiled with GCC.  They go in a library function
5008
+ * named __transfer_from_trampoline.
5009
+ *
5010
+ * We may need to rethink trampolines on ZipCPU.
5011
+ */
5012
+
5013
+
5014
+/* 17.12 Implicit Calls to Library Routines */
5015
+
5016
+/* DECLARE_LIBRARY_RENAMES
5017
+ *
5018
+ * ZipCPU: Don't need it.
5019
+ */
5020
+
5021
+/* TARGET_INIT_LIBFUNCS(VOID) ... This hook should declare additional library
5022
+ * routines or rename existing ones, using the functions set_optab_libfunc and
5023
+ * init_one_libfunc defined in optabs.c.  init_optabs calls this macro after
5024
+ * initializing all the normal library routines.
5025
+ *
5026
+ * Most ports don't need to define this hook, so we won't either.
5027
+ */
5028
+
5029
+/* TARGET_LIBFUNC_GNU_PREFIX ... If false (the default), internal library
5030
+ * routines start with two underscores.  If set to true, these routines start
5031
+ * with __gnu_ instead.
5032
+ *
5033
+ * ZipCPU: No change necessary.
5034
+ */
5035
+
5036
+/* FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE,COMPARISON) ... This macro should return
5037
+ * true if the library routine that implements the floating point comparison
5038
+ * operator comparison in mode mode will return a boolean and false if it will
5039
+ * return a tristate.
5040
+ *
5041
+ * Most ports don't need to define this macro, so Zip CPU won't either.
5042
+ */
5043
+
5044
+/* TARGET_HAS_NO_HW_DIVIDE ... This macro should be defined if the target has no
5045
+ * hardware divide instructions.  If this macro is defined, GCC will use an
5046
+ * algorithm which makes use of simple logical and arithmetic operations for
5047
+ * 64-bit division.  If the macro is not defined, GCC will use an algorithm
5048
+ * which makes use of a 64-bit by 32-bit divide primitive.
5049
+ *
5050
+ * Zip CPU, though, doesn't have the 64-bit by 32-bit divide primitive, thus
5051
+ * we have no HW DIVIDE (for now).
5052
+ */
5053
+#define        TARGET_HAS_NO_HW_DIVIDE
5054
+
5055
+/* TARGET_EDOM ... The value of EDOM on the target machine, as a C integer
5056
+ * expression.  If you don't define this macro, GCC does not attempt to deposit
5057
+ * the value of EDOM into errno directly.  Look in /usr/include/errno.h to find
5058
+ * the value of EDOM on your system.
5059
+ *
5060
+ * EDOM is the error created when a math argument is out of the domain of the
5061
+ * function.
5062
+ *
5063
+ * ZipCPU: Don't need it---I don't think.
5064
+ */
5065
+
5066
+/* GEN_ERRNO_RTX ... Define this macro as a C exrpession to create an rtl
5067
+ * expression that refers to the global "variable" errno.  (On certain
5068
+ * systems, errno may not actually be a variable.)  If you don't define this
5069
+ * macro, a reasonable default is used.
5070
+ *
5071
+ * ZipCPU --- if a reasonable default is used, we'll use that--especially since
5072
+ * I doubt we'll be using errno for a while.
5073
+ */
5074
+
5075
+/* NEXT_OBJC_RUNTIME ... Set this macro to 1 to use the "NeXT" Objective-C
5076
+ * message sending conventions by default.  This calling convention involves
5077
+ * passing the object, the selector and the method arguments all at once to the
5078
+ * method-lookup library function.  This is the usual setting when targetting
5079
+ * Darwin/Mac OS X systems, which have the NeXT runtime installed.
5080
+ *
5081
+ * If the macro is set to 0, ...
5082
+ *
5083
+ * Doesn't look relevant (yet) for the Zip CPU--especially since we don't have
5084
+ * an O/S yet.
5085
+ */
5086
+
5087
+
5088
+
5089
+/* 17.13 Addressing Modes */
5090
+
5091
+/* C expressions that are nonzero if the machine supports pre-increment,
5092
+ * pre-decrement, post-increment, or post-decrement addressing respectively.
5093
+ */
5094
+#define        HAVE_PRE_INCREMENT      (0)
5095
+#define        HAVE_PRE_DECREMENT      (0)
5096
+#define        HAVE_POST_INCREMENT     (0)
5097
+#define        HAVE_POST_DECREMENT     (0)
5098
+
5099
+/* C expression that is nonzero if the machine supports pre- or post- address
5100
+ * side-effect generation involving constants other than the size of the memory
5101
+ * operand.
5102
+ */
5103
+#define        HAVE_PRE_MODIFY_DISP    (0)
5104
+#define        HAVE_POST_MODIFY_DISP   (0)
5105
+
5106
+/* C expression that is non-zero if the machine supports pre- or post-address
5107
+ * side-effect generation involving a register displacement.
5108
+ */
5109
+#define        HAVE_PRE_MODIFY_REG     (0)
5110
+#define        HAVE_POST_MODIFY_REG    (0)
5111
+
5112
+/* CONSTANT_ADDRESS_P(X) ... A C expression that is 1 if the RTX X is a constant
5113
+ * which is a valid address.  On most machines the default definition ... is
5114
+ * acceptable, but a few machines are more restrictive as to which constant
5115
+ * addresses are supported.
5116
+ *
5117
+ * Zip CPU is designed for offset addresses, not constant addresses.  Although
5118
+ * the CPU will support 18-bit signed constant addresses, the assembler and
5119
+ * general programming model do not.  Further, without knowing where the final
5120
+ * address will be located, this is an unusable model.  Therefore we will
5121
+ * define this as not supported.
5122
+ *
5123
+ * In hindsight, this isn't true--labels and symbols are valid addresses, and
5124
+ * they are also constant addresses.  Hence, we leave this at its default.
5125
+ */
5126
+// #undef      CONSTANT_ADDRESS_P
5127
+// #define     CONSTANT_ADDRESS_P(X)   (0)
5128
+
5129
+/* CONSTANT_P(X) ... CONSTANT_P, which is defined by target-independent code, accepts integer values expressions whose values are not explicitly known, such as symbol_ref, label_ref, and high expressions and const arithmetic expressions, in addition to const_int and const_double expressions.
5130
+ *
5131
+ * Huh???
5132
+ */
5133
+// #define CONSTANT_P(X) ???
5134
+
5135
+/* A number, the maximum number of registers that can appear in a valid memory
5136
+ * address.
5137
+ */
5138
+#define        MAX_REGS_PER_ADDRESS    1
5139
+
5140
+/* TARGET_LEGITIMATE_ADDRESS_P(MODE,RTX,STRICT) ... A function that returns
5141
+ * whether RTX is a legitimate memory address on the target machine for a
5142
+ * memory operation of mode MODE.
5143
+ */
5144
+#undef TARGET_LEGITIMATE_ADDRESS_P
5145
+#define TARGET_LEGITIMATE_ADDRESS_P    zip_legitimate_address_p
5146
+
5147
+/* ECO32 suggested we do something like ... */
5148
+#ifdef IGNORE_THIS_FOR_NOW
5149
+#define        TARGET_LEGITIMATE_ADDRESS_P(MODE,X,STRICT)                      \
5150
+       do {                                                    \
5151
+               if (GET_CODE(X) == PLUS) {                      \
5152
+                       rtx     op1, op2;                       \
5153
+                       op1 = XEXP(X, 0); op2 = XEXP(X, 1);     \
5154
+                       if ((GET_CODE(op1) == REG)              \
5155
+                               &&(CONSTANT_ADDRESS_P(op2))     \
5156
+                               &&(REGNO_OK_FOR_BASE_P(REGNO(op1))))    \
5157
+                               goto LABEL;                     \
5158
+               } if ((REG_P(X))&&(REGNO_OK_FOR_BASE_P(REGNO(X)))) \
5159
+                       goto LABEL;                             \
5160
+               if ((GET_CODE(X) == SYMBOL_REF)                 \
5161
+                       ||(GET_CODE(X) == LABEL_REF)            \
5162
+                       ||(GET_CODE(X) == CONST))               \
5163
+                       goto LABEL;                             \
5164
+       } while(0)
5165
+#endif
5166
+
5167
+
5168
+/* TARGET_MEM_CONSTRAINT ... A single character to be used instead of the
5169
+ * default 'm' character for general memory addresses.  This defines the
5170
+ * constraint letter which matches the memory addresses accepted by
5171
+ * TARGET_LEGITIMATE_ADDRESS_P.  Define this macro if you want to support new
5172
+ * address format in your back end without changing the semantics of the 'm'
5173
+ * constraint.  This is necessary in order to preserve functionality of inline
5174
+ * assembly constructs using the 'm' constraint.
5175
+ *
5176
+ * ZipCPU--doesn't look like we need to define this at all.
5177
+ */
5178
+
5179
+/* FIND_BASE_TERM(X) ... A C expression to determine the base term of address
5180
+ * X or to provide a simplified version of X from which alias.c can easily find
5181
+ * the base term.  This macro is used in only two places: find_base_value and
5182
+ * find_base_term in alias.c.
5183
+ *
5184
+ * It is always safe for this macro  to not be defined.  It exists so that
5185
+ * alias analysis can understand machine-dependent addresses.
5186
+ *
5187
+ * ZipCPU: We'll skip this then.
5188
+ */
5189
+
5190
+/* TARGET_LEGITIMIZE_ADDRESS(RTX,OLD,MODE) ... This hook is given an invalid
5191
+ * memory address RTX for an operand of mode MODE and should try to return a
5192
+ * valid memory address.  RTX will always be the result of a call to
5193
+ * break_out_memory_refs, and OLD will be the operand that was given to that
5194
+ * function to produce RTX.
5195
+ *
5196
+ * ZipCPU -- this may be worth coming back to.
5197
+ */
5198
+// #undef      TARGET_LEGITIMIZE_ADDRESS
5199
+// #define     TARGET_LEGITIMIZE_ADDRESS       zip_legitimize_address
5200
+
5201
+/* LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OP,TYPE,IND,WIN) ... A C compound statement
5202
+ * that attempts to replace X, which is an address that needs reloading, with
5203
+ * a valid memory address for an operand of mode MODE.  WIN will be a C
5204
+ * statement label elsewhere in the code.  It is not necessary to define this
5205
+ * macro, but it might be useful for performance reasons.
5206
+ *
5207
+ * ZipCPU: This is worth coming back to, according to the notes page, but it
5208
+ * may also be a difficult macro to use.  Look at other implementations before
5209
+ * we dive into this.
5210
+ */
5211
+// #undef LEGITIMIZE_RELOAD_ADDRESS
5212
+// #define LEGITIMIZE_RELOAD_ADDRESS
5213
+
5214
+/* TARGET_MODE_DEPENDENT_ADDRESS_P(ADDR,SPACE) ... This hook returns true
5215
+ * if memory address addr in address space addrspace can have different meanings
5216
+ * depending on the machine mode of the memory reference it is used for or if
5217
+ * the address is valid for some modes but not others.
5218
+ */
5219
+#undef TARGET_MODE_DEPENDENT_ADDRESS_P
5220
+#define        TARGET_MODE_DEPENDENT_ADDRESS_P         zip_mode_dependent_address_p
5221
+
5222
+/* TARGET_LEGITIMATE_CONSTANT_P
5223
+ */
5224
+
5225
+/* TARGET_DELIGITIMIZE_ADDRESS(RTX)
5226
+ */
5227
+
5228
+/* TARGET_CONST_NOT_OK_FOR_DEBUG_P(RTX) ... This hook should return true if RTX
5229
+ * should not be emitted into debug sections.
5230
+ */
5231
+
5232
+/* TARGET_CANNOT_FORCE_CONST_MEM(MODE,RTX) ... This hook should return true if
5233
+ * RTX is a form that cannot (or should not) be spilled to the constant pool.
5234
+ * MODE is the mode of X.  The default version returns false.
5235
+ */
5236
+
5237
+/* TARGET_USE_BLOCKS_FOR_CONSTANT_P(MODE,RTX) ... This hook should return true
5238
+ * if pool entries for constant RTX can be placed in an object_block structure.
5239
+ * MODE is the mode of X.  The default version returns false for all constants.
5240
+ *
5241
+ *????
5242
+ */
5243
+// #warning "Huh?"
5244
+
5245
+/* TARGET_USE_BLOCKS_FOR_DECL_P(DECL) ... This hook should return true if pool
5246
+ * entries for DECL should be placed in an object_block structure.  The default
5247
+ * version returns true for all DECL's.
5248
+ *
5249
+ * Sounds good.
5250
+ */
5251
+
5252
+/* TARGET_BUILTIN_RECIPROCAL(TREE) ... This hook should return the DECL of a
5253
+ * function that implements the reciprocal of the machine specific builtin
5254
+ * function fndecl, or NULL_TREE if such a function is not available.
5255
+ */
5256
+
5257
+/* TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD(VOID) ... This hook should return the
5258
+ * DECL of a function f that given an address addr as an argument returns a mask
5259
+ * m that can be used to extrract from two vectors the relevant data that
5260
+ * resides in addr in case addr is not properly aligned.
5261
+ *
5262
+ * Zip CPU does not support vectorization.
5263
+ */
5264
+
5265
+/* Other vector, SIMD, and GOACC macros skipped as Zip CPU doesn't support
5266
+ * such data accesses and manipulation.
5267
+ */
5268
+
5269
+/* 17.14 Anchored Addresses */
5270
+
5271
+/* TARGET_MIN_ANCHOR_OFFSET ... The minimum offset that should be applied to
5272
+ * a section anchor.  On most targets, it should be the smallest offset that
5273
+ * can be applied to a base register while still giving a legitimate address for
5274
+ * every mode.  The default value is 0.
5275
+ *
5276
+ * On the Zip CPU, this is the minimum operand B offset to a LOD or STO
5277
+ * operation, which would be a signed 14 bit number.
5278
+ */
5279
+#undef TARGET_MIN_ANCHOR_OFFSET
5280
+#define TARGET_MIN_ANCHOR_OFFSET       zip_min_anchor_offset
5281
+
5282
+/* TARGET_MAX_ANCHOR_OFFSET ... Like TARGET_MIN_ANCHOR_OFFSET, but the maximum
5283
+ * (inclusive) offset that should be applied to section anchors.  The default
5284
+ * value is 0.
5285
+ */
5286
+#undef TARGET_MAX_ANCHOR_OFFSET
5287
+#define TARGET_MAX_ANCHOR_OFFSET       zip_max_anchor_offset
5288
+
5289
+/* TARGET_ASM_OUTPUT_ANCHOR(RTX) ... Write the assembly code to define section
5290
+ * anchor RTX, which is a SYMBOL_REF for which 'SYMBOL_REF_ANCHOR_P(RTL) is
5291
+ * true.  The hook is called with the assembly output position set to the
5292
+ * beginning of SYMBOL_REF_BLOCK(X).
5293
+ *
5294
+ * If ASM_OUTPUT_DEF is available, the hook's default definition uses it to
5295
+ * define the symbol as '. + SYMBOL_REF_BLOCK_OFFSET(RTL)'.  If ASM_OUTPUT_DEF
5296
+ * is not available, the hook's default definition is NULL, which disables the
5297
+ * use of section anchors altogether.
5298
+ *
5299
+ * Section anchors will be very valuable in Zip CPU assembly, therefore we
5300
+ * must define this hook.
5301
+ */
5302
+// #undef      TARGET_ASM_OUTPUT_ANCHOR
5303
+// #define     TARGET_ASM_OUTPUT_ANCHOR        zip_asm_output_anchor
5304
+
5305
+/* TARGET_USE_ANCHORS_FOR_SYMBOL_P(RTX) ... Return true if GCC should attempt
5306
+ * to use anchors to access SYMBOL_REF X.  You can assume SYMBOL_REF_HAS_BLOCK_INFO_P(X) and !SYMBOL_REF_ANCHOR_P(X).
5307
+ *
5308
+ * The default version is correct for most targets, but you might need to intercept this hook to handle things like target specific attributes or target-specific sections.
5309
+ *
5310
+ * Not knowing anything more, we'll leave the default as is for the Zip CPU.
5311
+ */
5312
+// #undef TARGET_USE_ANCHORS_FOR_SYMBOL_P
5313
+// #define TARGET_USE_ANCHORS_FOR_SYMBOL_P     zip_use_anchors_for_symbol_p
5314
+
5315
+/* 17.15 Condition Code Status */
5316
+
5317
+/* 17.15.1 Representation of condition codes using (cc0) --- that's us */
5318
+
5319
+/* CC_STATUS_MDEP ... C code for a data type which is used for declaring
5320
+ * the mdep component of cc_status.  It defaults to int.
5321
+ *
5322
+ * ZipCPU---Int is good for us.
5323
+ */
5324
+
5325
+/* CC_STATUS_MDEP_INIT ... A C expression to initialize the mdep field to
5326
+ * "empty".  The default definition does nothing, since most machines don't
5327
+ * use the field anyway.  If you want to use the field, you should probably
5328
+ * define  this macro to initialize it.
5329
+ */
5330
+
5331
+/* NOTICE_UPDATE_CC(EXP, INSN) ... A C compound statement to set the components
5332
+ * of cc_status appropriately for an insn insn whose body is exp.  It is this
5333
+ * macro's responsibility to recognize insns that set the condition code as
5334
+ * a byproduct of other activity as well as those that explicitly set (cc0).
5335
+ *
5336
+ * ZipCPU --- We need this, as not all expressions set (cc0).
5337
+ *
5338
+ */
5339
+#define        NOTICE_UPDATE_CC(EXP, INSN)     zip_update_cc_notice(EXP, INSN)
5340
+
5341
+
5342
+/* 17.15.2 Representation of condition codes using registers */
5343
+/* ... which the ZipCPU doesn't have.  The ZipCPU has a CC0 register, and hence
5344
+ * this section isn't supposed to apply.
5345
+ */
5346
+
5347
+/* SELECT_CC_MODE(op, x, y)
5348
+ */
5349
+
5350
+/* TARGET_CANONICALIZE_COMPARISON(int,rtx *, rtx *, bool) ... On some machines
5351
+ * (such as the ZipCPU) not all possible comparisons are defined, but you can
5352
+ * convert an invalid comparison into a valid one.  For example, the Alpha
5353
+ * does not have a GT comparison, but you can use an LT comparison instead and
5354
+ * swap the order of the operands.
5355
+ *
5356
+ * On such machines, implement this hook to do any required conversions:  code
5357
+ * is the initial comparison code and op0 and op1 are the left and right
5358
+ * operands of the comparison, respectively.  If op0_preserve_value is true the
5359
+ * implementation is not allowed to change the value of op0 since the value
5360
+ * might be used in RTXs which aren't comparisons.  E.g. the implementation is
5361
+ * not allowed to swap operands in that case.
5362
+ *
5363
+ * GCC will not assume that the comparison resulting from this macro is valid
5364
+ * but will see if the resulting insn matches a pattern in the 'md' file.
5365
+ *
5366
+ * You need not implement this hook if it would never change the comparison
5367
+ * code or operands.
5368
+ *
5369
+ * In the case of the ZipCPU, the ZipCPU only keeps track of 8 possible
5370
+ * comparisons, and bastardizing other comparisons into those 8 is extremely
5371
+ * painful.  Therefore, we *need* this capability to make certain we can use
5372
+ * our comparisons successfully.
5373
+ *
5374
+ * The only problem is ... this hook appears to only be called on non-CC0
5375
+ * machines.  Hence, defining it hasn't done anything for us.
5376
+ */
5377
+// #define     TARGET_CANONICALIZE_COMPARISON  zip_canonicalize_comparison
5378
+
5379
+/* 17.16 Relative costs of operations */
5380
+
5381
+
5382
+// #define     REGISTER_MOVE_COST(MODE,FROM,TO)        ((MODE==DImode)||(MODE==DFmode))?4:2
5383
+// #define     TARGET_REGISTER_MOVE_COST
5384
+// #define     MEMORY_MOVE_COST(MODE, CLASS, IN)       ((MODE==DImode)||(MODE==DFmode))?8:7
5385
+/* TARGET_REGISTER_MOVE_COST(M,FRM,TO) ... This target hook should return the
5386
+ * cost of moving data of mode M from a register in class FRM to one in class
5387
+ * TO.  The classes are expressed using the enumeration values such as
5388
+ * GENERAL_REGS.  A value of 2 is the default; other values are interpreted
5389
+ * relative to that.
5390
+ *
5391
+ * It is not required that the cost always equal 2 when FROM is the same as TO;
5392
+ * on some machines it is expensive to move between registers if they are not
5393
+ * general registers.
5394
+ *
5395
+ * If reload sees ...
5396
+ *
5397
+ * ZipCPU ... We can leave this at its default value of 2.
5398
+ */
5399
+
5400
+/* TARGET_MEMORY_MOVE_COST(MOD,CL,IN) ... This target hook should return the
5401
+ * cost of moving data of mode MOD between a register of class CL and memory.
5402
+ * IN is false if the value is to be written to memory, true if it is to be
5403
+ * read in.  This cost is relative to those in TARGET_REGISTER_MOVE_COST.
5404
+ * If moving between registers and memory is more expensive that between two
5405
+ * registers, you should add this target hook to express the relative cost.
5406
+ *
5407
+ * If you do not add this target hook, GCC uses a default cost of 4 plus the
5408
+ * cost of copying via a secondary reload register, if one is needed.  If your
5409
+ * machine requires a secondary reload register to copy between memory and a
5410
+ * register of CL but the reload mechanism is more complex than copying via
5411
+ * an intermediate, use this target hook to reflect the actual cost of the
5412
+ * move.
5413
+ *
5414
+ * ZipCPU --- Memory moves are more expensive than twice the cost of register
5415
+ * moves, so let's make certain this is defined.
5416
+ */
5417
+#define        TARGET_MEMORY_MOVE_COST zip_memory_move_cost
5418
+
5419
+// #warning "This needs to be double checked, and annotated"
5420
+#define        BRANCH_COST(SPEED,PREDICTABLE)          ((SPEED)?2:5)
5421
+
5422
+/* Define this macro as a C expression which is nonzero if accessing less than
5423
+ * a word of memory (i.e. a 'char' or a 'short') is no faster than accessing
5424
+ * a word of memory.
5425
+ */
5426
+#define        SLOW_BYTE_ACCESS        1
5427
+
5428
+/* MOVE_RATIO(SPD) ... The threshold of number of scalar memory-to-memory move
5429
+ * instructions, below which a sequence of instructions should be generated
5430
+ * instead of a string move instruction or a library call.  Increasing the
5431
+ * value will always make code faster, but eventually incurs high cost in
5432
+ * increased code size.
5433
+ */
5434
+#define        MOVE_RATIO(SPD) 5
5435
+
5436
+/* TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(SZ,ALGN,OP,SPD) ...
5437
+ */
5438
+// #undef      TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)
5439
+// #define     TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)// needs hook
5440
+
5441
+/* CLEAR_RATIO(SPD) ... The threshold number of scalar move instructions, below
5442
+ * which a sequence of instructions should be generated to clear memory instead
5443
+ * of a string clear instruction or a library call.  Increasing the value will
5444
+ * always make the code faster, but eventually incurs high cost in increased
5445
+ * code size.
5446
+ */
5447
+#define        CLEAR_RATIO(SPD)        MOVE_RATIO(SPD)
5448
+
5449
+/* NO_FUNCTION_CSE ... Define this macro to be true if it is as good or better
5450
+ * to call a constant function address than to call an address kept in a
5451
+ * register.
5452
+ *
5453
+ * On the Zip CPU, constant function addresses--especially relative ones,
5454
+ * can be optimized into a single cycle delay.  Register jumps will always
5455
+ * stall the whole (5-stage) pipeline.
5456
+ */
5457
+#define        NO_FUNCTION_CSE
5458
+
5459
+/* TARGET_ADDRESS_COST ... This hook computes the cost of an addressing mode
5460
+ * that contains address.  If not defined, the cost is computed from the
5461
+ * address expression and the TARGET_RTX_COST hook.
5462
+ */
5463
+// We should define this for ZIP ... we're just not there yet
5464
+// int TARGET_ADDRESS_COST(rtx address, machine_mode mode, addr_space_t as, bool speed)
5465
+/* TARGET_ADDRESS_COST(ADDR,MODE,AS, SPD) ... This hook computes the cost of an
5466
+ * addressing mode that contains ADDR.  If not defined, the cost is computed
5467
+ * from the ADDR expression and the TARGET_RTX_COST hook.  In cases where more
5468
+ * than one form of an address is known, the form with the lowest cost will be
5469
+ * used.  If multiple forms have the same, lowest, cost, the one that is the
5470
+ * most complex will be used.
5471
+ *
5472
+ * ZipCPU really has only one address cost, the only type of address it
5473
+ * supports.  Sure, index addressing would cost us more, but we don't support
5474
+ * that so ... I think we're okay defining this as a constant.  Indeed, the
5475
+ * docs state that, "On RISC amchines, all instructions normally have the same
5476
+ * length and execution time.  Hence all addresses will have equal costs."
5477
+ */
5478
+#undef TARGET_ADDRESS_COST
5479
+#define        TARGET_ADDRESS_COST     zip_address_cost
5480
+
5481
+
5482
+/* TARGET_NO_SPECULATION_IN_DELAY_SLOTS_P ... This predicate controls the use
5483
+ * of the eager delay slot filler to disallow speculatively executed
5484
+ * instructions being placed in delay slots.  Targets such as certain MIPS
5485
+ * architectures posess both branches with and without delay slots.  As the
5486
+ * eager delay slot filler can decrease performance, disabling it is beneficial
5487
+ * when ordinary branches are available.  Use of delay slot branches filled
5488
+ * using basic filler is often still desirable as the delay slot can hide a
5489
+ * pipeline bubble.
5490
+ */
5491
+// How should Zip CPU define this--we have no delay slots.
5492
+
5493
+
5494
+/* 17.17 Instruction Scheduler */
5495
+
5496
+#define        TARGET_SCHED_ISSUE_RATE zip_sched_issue_rate
5497
+
5498
+/* 17.18 Dividing the Output into Sections */
5499
+
5500
+/* Switch to the text or data segment. */
5501
+#define        TEXT_SECTION_ASM_OP     "\t.text"
5502
+#define        DATA_SECTION_ASM_OP     "\t.data"
5503
+
5504
+// #undef      TARGET_LIBGCC_SDATA_SECTION
5505
+// #define     TARGET_LIBGCC_SDATA_SECTION     ".sdata"
5506
+
5507
+
5508
+/* 17.19 Position Independent Code */
5509
+
5510
+#define        PIC_OFFSET_TABLE_REGNUM                 zip_GOT
5511
+#define        PIC_OFFSET_TABLE_REG_CALL_CLOBBERED     0
5512
+// #define LEGITIMATE_PIC_OPERAND_P(X) should evaluate to X(GOT) only
5513
+
5514
+/* 17.20 Defining the Output Assembler Language */
5515
+
5516
+/* 17.20.4 Output and Generation of Labels */
5517
+
5518
+/* ASM_OUTPUT_LABEL
5519
+ * ... A default definition of this macro is provided which is correct for
5520
+ * most systems.
5521
+ */
5522
+
5523
+/* ASM_OUTPUT_FUNCTION_LABEL
5524
+ * ... if not defined, then the function name is defined in the usual manner
5525
+ * as a label.
5526
+ */
5527
+
5528
+/* ASM_OUTPUT_INTERNAL_LABEL ... Identical to ASM_OUTPUT_LABEL, except that name
5529
+ * is known to refer to a compiler-generated label.  The default definition
5530
+ * uses assemble_name_raw, which is like assemble_name except that it is more
5531
+ * efficient.
5532
+ */
5533
+
5534
+/* SIZE_ASM_OP ... A C string containing the appropriate assembler directive
5535
+ * to specify the size of a symbol, without any arguments.  ON systems that
5536
+ * use ELF, the dfault is "\t.size\t"; on other systems, the default is not to
5537
+ * define this macro.
5538
+ *
5539
+ * Define this amcro only if it is correct to use the default definitions of
5540
+ * ASM_OUTPUT_SIZE_DERECTIVE and ASM_OUTPUT_MEASURED_SIZE for your system.
5541
+ * If you need your own custom definitions of those macros, or if you do not
5542
+ * need explicit symbol sizes at all, do not define this macro.
5543
+ */
5544
+
5545
+/* ASM_OUTPUT_SIZE_DIRECTIVE
5546
+ * ASM_OUTPUT_MEASURED_SIZE
5547
+ */
5548
+
5549
+/* NO_DOLLAR_IN_LABEL ... Define this macro if the assembler does not accept
5550
+ * the character '$' in label names.  By default constructors and destructors
5551
+ * in G++ have "$" in the identifiers.  If this label is defined, '.' is
5552
+ * used instead.
5553
+ */
5554
+
5555
+/* NO_DOT_IN_LABEL ... Define this macro if the assembler does not accept the
5556
+ * character '.' in label names.  By default constructors and destructors in
5557
+ * G++ have names that use '.'.  If this macro is defined, these names are
5558
+ * rewritten to avoid '.'.
5559
+ */
5560
+
5561
+/* TYPE_ASM_OP ... A C string containing the appropriate assembler directive to
5562
+ * specify the type of a symbol, without any arguments.  On systems that use
5563
+ * ELF the default in config/elfos.h is "\t.type\t"; on other systems, the default is not to define this macro.
5564
+ *
5565
+ * Define this macro only if it is correct to use the default definition of
5566
+ * ASM_OUTPUT_TYPE_DIRECTIVE forr your system.  If you need your own custom
5567
+ * definition of this macr, or if you do not need explicit symbol types at all,
5568
+ * do not define this macro.
5569
+ */
5570
+
5571
+/* TYPE OPERAND_FMD ... A
5572
+ */
5573
+
5574
+/* ASM_OUTPUT_TYPE_DIRECTIVE
5575
+ */
5576
+
5577
+/* ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) ...
5578
+ * if this macro is not defined, then the function name is defined in the usual
5579
+ * manner as a label (by means of ASM_OUTPUT_FUNCTION_LABEL).
5580
+ */
5581
+
5582
+/* ASM_DECLARE_FUNCTION_SIZE
5583
+ * ASM_DECLARE_COLD_FUNCTION_NAME
5584
+ * ASM_DECLARE_COLD_FUNCTION_SIZE
5585
+ * ASM_DECLARE_OBJECT_NAME
5586
+ * TARGET_ASM_DECLARE_CONSTANT_NAME
5587
+ */
5588
+/* ASM_DECLARE_REGISTER_GLOBAL(STREAM, DECL, REGNO, NAME) ... A C statement
5589
+ * (sans semicolon) to output to the stdio stream STREAM any text necessary for
5590
+ * claiming a register REGNO for a global variable DECL with name NAME.
5591
+ *
5592
+ * If you don't defin this macro, that is equivalent to dfining it to do
5593
+ * nothing.
5594
+ */
5595
+
5596
+/* ASM_FINISH_DECLARE_OBJECT
5597
+ * TARGET_ASM_GLOBALIZE_LABEL
5598
+ * TARGET_ASM_GLOBALIZE_DECL_NAME
5599
+ * TARGET_ASM_ASSEMBLE_UNDEFINED_DECL
5600
+ * ASM_WEAKEN_LABEL
5601
+ * ASM_WEAKEN_DECL
5602
+ * ASM_OUTPUT_WEAKREF
5603
+ * SUPPORTS_WEAK
5604
+ * TARGET_SUPPORTS_WEAK
5605
+ * MAKE_DECL_ONE_ONLY
5606
+ * SUPPORTS_ONE_ONLY
5607
+ * TARGTE_ASM_ASSEMBLE_VISIBILITY
5608
+ * TARGET_WEAK_NOT_IN_ARCHIVE_TOC
5609
+ * ASM_OUTPUT_EXTERNAL
5610
+ * TARGET_ASM_EXTERNAL_LIBCALL
5611
+ * TARGET_ASM_MARK_DECLPRESERVED
5612
+ * ASM_OUTPUT_LABELREF
5613
+ * TARGET_MANGLE_ASSEMBLER_NAME
5614
+ * ASM_OUTPUT_SYMBOL_REF
5615
+ * ASM_OUTPUT_LABEL_REF
5616
+ * TARGET_ASM_INTERNAL_LABEL
5617
+ * ASM_OUTPUT_DEBUG_LABEL
5618
+ * ASM_GENERATE_INTERNAL_LABEL
5619
+ * ASM_FORMAT_PRIVATE_NAME
5620
+ */
5621
+
5622
+/* ASM_OUTPUT_DEF ... A C statement to output to the stdio stream STREAM
5623
+ * assembler code which defines (equates) the symbol NAME to have the value
5624
+ * VALUE.
5625
+ *
5626
+ * ZipCPU---So many other things that we need depend upon this, that we need
5627
+ * to implement a non-default version.
5628
+ */
5629
+#define        ASM_OUTPUT_DEF  zip_asm_output_def
5630
+
5631
+/* ASM_OUTPUT_DEF_FROM_DECLS
5632
+ * TARGET_DEFERRED_OUTPUT_DEFS
5633
+ * ASM_OUTPUT_WEAK_ALIAS
5634
+ * OBJ_GEN_METHOD_LABEL
5635
+ */
5636
+
5637
+
5638
+/* 17.20.7 Output of Assembler Instructions */
5639
+
5640
+#define        REGISTER_NAMES { "R0","R1","R2","R3","R4","R5","R6","R7","R8","R9", \
5641
+       "R10","R11","R12","SP","CC","PC" }
5642
+
5643
+/* REGISTER_PREFIX     (Undefined by default)
5644
+ * LOCAL_LABEL_PREFIX  (Undefined by default)
5645
+ * USER_LABEL_PREFIX   defaults to "*"
5646
+ * IMMEDIATE_PREFIX    (Undefined by default)
5647
+ *
5648
+ * If defined, C string expressions to be used for the '%R', '%L', '%U', and
5649
+ * '%I' options of asm_fprintf (see 'final.c').  These are useful when a single
5650
+ * 'md' file must support multiple assembler formats.  In that case, the various
5651
+ * 'tm.h' files can define these macros differently.
5652
+ */
5653
+// #define     USER_LABEL_PREFIX       "*"
5654
+
5655
+/* Defining memory operand address formats is in this section. */
5656
+
5657
+/* 17.20.10 Assembler Commands for Alignment */
5658
+
5659
+/* JUMP_ALIGN(label) ... The alignment (log base 2) to put in front of label,
5660
+ * which is a common destination of jumps and has no fallthru incoming
5661
+ * edge.  This macro need not be defined if you don't want any special alignment
5662
+ * to be done at such a time.  Most machine descriptions do not currently define
5663
+ * this macro.
5664
+ *
5665
+ * ZipCPU---The assembler should automatically deal with label alignment, so
5666
+ * let's not do anything about it here.
5667
+ */
5668
+
5669
+/* TARGET_ASM_JUMP_ALIGN_MAX_SKIP
5670
+ */
5671
+
5672
+/* LABEL_ALIGN_AFTER_BARRIER
5673
+ * TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
5674
+ */
5675
+
5676
+/* LOOP_ALIGN(label)
5677
+ * TARGET_ASM_LOOP_ALIGN_MAX_SKIP
5678
+ * LABEL_ALIGN
5679
+ * TARGET_ASM_LABEL_ALIGN_MAX_SKIP
5680
+ */
5681
+
5682
+/* ASM_OUTPUT_SKIP(STREAM, NBYTES) A C statement to output to the stdio
5683
+ * stream an assembler instruction to advance the location counter by nbytes
5684
+ * bytes.
5685
+ */
5686
+
5687
+/* TARGET_ASM_LABEL_ALIGN */
5688
+/* Assembler Commands for Alignment */
5689
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
5690
+               { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
5691
+
5692
+
5693
+
5694
+/* 17.21 Controlling Debugging Information Format */
5695
+/* 17.22 Cross Compilation and Floating Point */
5696
+/* 17.23 Mode switching instructions */
5697
+/* 17.24 Defining target-specific uses of __attribute__ */
5698
+#undef TARGET_OPTION_OVERRIDE
5699
+#define        TARGET_OPTION_OVERRIDE  zip_override_options
5700
+
5701
+/* 17.25 Emulating TLS */
5702
+/* 17.26 Defining coprocessor specifics for MIPS targets*/
5703
+
5704
+ // ZipCPU isn't MIPS.
5705
+
5706
+/* 17.27 Parameters for Precompiled Header Validity Checking */
5707
+/* 17.28 C++ ABI parameters */
5708
+/* 17.29 Adding support for named address spaces */
5709
+/* 17.30 Miscellaneous Parameters */
5710
+
5711
+/* HAS_LONG_COND_BRANCH ... Define this boolean macro to indicate whether or
5712
+ * not your architecture has conditional branches that can span all of memory.
5713
+ * It is used in conjunction with an optimization that partitions hot and
5714
+ * cold basic blocks into separate sections of the executable.  If this macro
5715
+ * is set to false, gcc will convert any conditional branches that attempt to
5716
+ * cross between sections into unconditional branches or indirect jumps.
5717
+ *
5718
+ * ZipCPU --- The assembler renders long unconditional branch code without
5719
+ * problems, so we can pretend that such long branches exist.
5720
+ */
5721
+#define        HAS_LONG_COND_BRANCH true
5722
+
5723
+/* HAS_LONG_UNCOND_BRANCH ... Define this boolean macro to indicate whether
5724
+ * or not your architecture has unconditional branches that can span all of
5725
+ * memory.  (ZipCPU does ... via the LOD (PC),PC instruction.)  It is used in
5726
+ * conjunction with an optimization that partitions hot and cold basic blocks
5727
+ * into separate sections of the executable.  If this macro is set to false,
5728
+ * gcc will convert any unconditional branches that attempt to cross between
5729
+ * sections into indirect jumps.
5730
+ *
5731
+ * ZipCPU has the LOD (PC),PC instruction which can be used to implement a long
5732
+ * jump.
5733
+ */
5734
+#define        HAS_LONG_UNCOND_BRANCH  true
5735
+
5736
+/* CASE_VECTOR_MODE ... An alias for a machine mode name.  This is the machine
5737
+ * mode that eleemnts of a jump-table should have.
5738
+ *
5739
+ */
5740
+#define        CASE_VECTOR_MODE        SImode
5741
+
5742
+/* CASE_VECTOR_SHORTEN_MODE(MIN,MAX,BODY) ... Optional: return the preferred
5743
+ * mode for an addr_diff_vec when the minimum and maximum offset are known.
5744
+ * If you define this, it enables extra code in branch shortening to deal with
5745
+ * addr_diff_vec.  To make this work, you also have to define INSN_ALIGN and
5746
+ * make the alignment for addr_diff_vec explicit.  The body argument is provided so that the offset_unsigned and scale flags can be updated.
5747
+ *
5748
+ * ZipCPU---No advantage here.
5749
+ */
5750
+
5751
+/* CASE_VECTOR_PC_RELATIVE ... Define this exrpession to indicate when
5752
+ * jump-tables should contain relative addresses.  You need not define this
5753
+ * macro if jump-tables never contain relative addresses, or jump-tables
5754
+ * should contain relative addresses only when -fPIC or -FPIC is in effect.
5755
+ *
5756
+ * ZipCPU---No advantage in PC-Relative jump tables--except in PIC relative
5757
+ * code.
5758
+ */
5759
+
5760
+/* TARGET_CASE_VALUES_THRESHOLD(VOID) ... This function returns the smallest
5761
+ * number of different values for which it is best to use a jump-table instead
5762
+ * of a tree of conditional branches.  The default is four for machines with a
5763
+ * casesi instruction and five otherwise.  This is best for most machines.
5764
+ *
5765
+ * ZipCPU---Leave at the default.
5766
+ */
5767
+
5768
+/* WORD_REGISTER_OPERATIONS ... Define this macro to 1 if operations between
5769
+ * registers with integral mode smaller than a word are always performed on the
5770
+ * entire register.  Most RISC machines have this property and most CISC
5771
+ * machines do not.
5772
+ *
5773
+ * ZipCPU---We have the property, 'cause we're fairly risk.
5774
+ */
5775
+#undef WORD_REGISTER_OPERATIONS
5776
+#define        WORD_REGISTER_OPERATIONS        1
5777
+
5778
+/* LOAD_EXTEND_OP(MEMODE) ... Define this macro to be a C expression indicating
5779
+ * when insns that read memory in MEMMODE, an integral mode narrower than a
5780
+ * word, set the bits outside of MEMMODE to be either the sign extension or
5781
+ * zero-extension of the data read.  Return SIGN_EXTEND for values of MEMMODE
5782
+ * for which the insn sign-extends, ZERO_EXTEND for which it zero-extends, and
5783
+ * UNKNOWN for other modes.
5784
+ *
5785
+ * Do not define this macro if it would always return UNKNOWN.
5786
+ *
5787
+ * ZipCPU---This should be irrelevant, so we leave it undefined.
5788
+ */
5789
+#undef LOAD_EXTEND_OP
5790
+#define        LOAD_EXTEND_OP(MEM)     SIGN_EXTEND
5791
+
5792
+/* SHORT_IMMEDIATES_SIGN_EXTEND ... Define this macro to 1 if loading short immediate values into registers sign extends.
5793
+ *
5794
+ * ZipCPU---All immediates are sign extended, so yes.
5795
+ */
5796
+#undef SHORT_IMMEDIATES_SIGN_EXTEND
5797
+#define        SHORT_IMMEDIATES_SIGN_EXTEND    1
5798
+
5799
+/* TARGET_MIN_DIVISIONS_FOR_RECIP_MUL
5800
+ */
5801
+
5802
+/* MOVE_MAX ... The maximum number of bytes that a single instruction can move
5803
+ * quickly between memory and registers or between two memory locations.
5804
+ *
5805
+ * ZipCPU --- Although we can move 32-bits at a time, and most people would call
5806
+ * this 4-bytes, the compiler defines a byte as the minimum addressable unit.
5807
+ * Therefore, this is defined to be one.
5808
+ */
5809
+#define        MOVE_MAX        1
5810
+
5811
+/* MAX_MOVE_MAX ... The maximum number of bytes that a single instruction can
5812
+ * move quickly between memory and registers or between two memory ...
5813
+ *
5814
+ * ZipCPU --- this sounds just the same as MOVE_MAX, which is the default
5815
+ * definition of this.
5816
+ */
5817
+
5818
+/* SHIFT_COUNT_TRUNCATED ... A C expression that is nonzero if on this machine
5819
+ * the number of bits actually used for the count of a shift operation is equal
5820
+ * to the number of bits needed to represent the size of the object being
5821
+ * shifted.
5822
+ *
5823
+ * You need not define this macro if it would have the value of zero.
5824
+ *
5825
+ * ZipCPU---A shift of 33 (or more) in either direction will wipe out the
5826
+ * value in the register, therefore this value should be zero, the default.
5827
+ */
5828
+
5829
+/* TARGET_SHIFT_TRUNCATION_MASK(MODE) ... This function describes how the
5830
+ * standard shift patterns for MODE deal with shifts by negative amounts or by
5831
+ * more than the width of the mode.
5832
+ *
5833
+ * ZipCPU---The default is zero, since we didn't define SHIFT_COUNT_TRUNCATED.
5834
+ * This is the case for the ZipCPU as well.
5835
+ */
5836
+
5837
+/* TRULY_NOOP_TRUNCATION(OUTPREC,INPREC) ... A C expression which is nonzero
5838
+ * if on this machine it is safe to "convert" an integer of INPREC bits to one
5839
+ * of OUTPREC bits (where OUTPREC is smaller than INPREC) by merely operating on
5840
+ * it as if it had OUTPREC bist.  On many machines, this expression can be 1.
5841
+ *
5842
+ * ZiPCPU ... If both values are 32-bit, what conversion takes place?  If one is
5843
+ * 64-bit and the other 32-bit ... I suppose it would then be safe.
5844
+ */
5845
+#undef TRULY_NOOP_TRUNCATION
5846
+#define TRULY_NOOP_TRUNCATION(O,I)     1
5847
+
5848
+/* TARGET_MODE_REP_EXTENDED(MODE,REPMODE) ... The representation of an integral
5849
+ * mode can be such that the values are always extended to a wider integral
5850
+ * mode.  Return SIGN_EXTEND if values of MODE are represented in sign-extended
5851
+ * form to REPMODE.  Return UNKNOWN otherwise.  (Currently none of the targets
5852
+ * use zero-extended.
5853
+ *
5854
+ */
5855
+// #undef      TARGET_MODE_REP_EXTENDED
5856
+// #define     TARGET_MODE_REP_EXTENDED(R,M)   SIGN_EXTEND
5857
+
5858
+/* STORE_FLAG_VALUE ... A C expression describing the value returned by a
5859
+ * comparison operator with an integral mode and stored by a store-flag
5860
+ * instruction (cstoremode4) when the condition is true.  This description
5861
+ * must apply to all the cstoremode4 patterns and all the comparison operators
5862
+ * whose results have MODE_INT mode.
5863
+ *
5864
+ * ZipCPU---Doesn't really have a STORE_FLAG_VALUE instruction ...
5865
+ */
5866
+
5867
+/* FLOAT_STORE_FLAG_VALUE
5868
+ *
5869
+ * ZipCPU
5870
+ */
5871
+
5872
+/* VECTOR_STORE_FLAG_VALUE ... define this macro on machines that have vector
5873
+ * comparison operations that return a vector result ...
5874
+ *
5875
+ * ZipCPU---Doesn't support vector operations.
5876
+ */
5877
+
5878
+/* CLZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
5879
+ * CTZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
5880
+ *
5881
+ * A C expression that indicates whetther the architecture defines a value for
5882
+ * clz or ctz with a zero operand.  A result of 0 indicates the value is
5883
+ * undefined.  If the value is defined for only the RTL expression, the macro should evaluate to 1.  If the value also applies to the corresponding optab
5884
+ * entry, then the macro should evaluate to 2.  In cases where the value is
5885
+ * defined, value should be set to this value.
5886
+ * If this macro is not defined, the value of clz or ctz at zero is assumed to
5887
+ * be undefined.
5888
+ *
5889
+ * ZipCPU---Has neither clz nor ctz instructions, so we don't need this.
5890
+ */
5891
+
5892
+/* Pmode ... An alias for the machine mode for pointers.  On most machines,
5893
+ * define this to be the integer mode corresponding to the width of a
5894
+ * hardware pointer.  SImode on 32-bits machines, or DImode on 64-bit machines.
5895
+ * On some machines you must define this to be one of the partial
5896
+ * integer modes, such as PSImode.
5897
+ */
5898
+#undef Pmode
5899
+#define        Pmode   SImode
5900
+
5901
+/* FUNCTION_MODE ... An alais for the machine mode used for memory references to
5902
+ * function being called, in call RTL expressions.  On most CISC machines, where
5903
+ * an instruction can begin at any byte address, this should be QImode.  On most
5904
+ * RISC machines, where all instructions have fixed size and alignment, this
5905
+ * should be a mode with the same size and alignment as the machine instruction
5906
+ * words--typically SImode or HImode.
5907
+ *
5908
+ * ZipCPU---Definitely SImode, as with Pmode.  (All words are 32-bits, including
5909
+ * addresses on the ZipCPU.
5910
+ */
5911
+#undef FUNCTION_MODE
5912
+#define        FUNCTION_MODE   SImode
5913
+
5914
+/* STDC_0_IN_SYSTEM_HEADERS
5915
+ */
5916
+
5917
+/* TARGET_C_PREINCLUDE(V) ... Define this hook to return the name of  a header
5918
+ * file to be included at the start of all compilations, as if it had been
5919
+ * included with #include <file>.  If this hook returns NULL, or is not defined,
5920
+ * or if the header is not found, or if the user specifies -ffreestanding or
5921
+ * -nostdinc, no header is included.
5922
+ *
5923
+ * ZipCPU --- We don't have a standard library defined yet, so we'll leave this
5924
+ * as NULL.
5925
+ */
5926
+#undef TARGET_C_PREINCLUDE
5927
+#define        TARGET_C_PREINCLUDE     NULL
5928
+
5929
+/* TARGET_CXX_IMPLICIT_EXTERN_C(CONST CHAR *) ... Define this hook to add target
5930
+ * specific C++ implicit extern C functions.  If this function returns true
5931
+ * for the name of a file-scope function, that function implicitly gets extern
5932
+ * "C" linkage rather than whatever linkage the declaration would normally have.
5933
+ * An example of such function is WinMain on Win32 targets.
5934
+ *
5935
+ * ZipCPU---Not ready to deal with this yet.
5936
+ */
5937
+
5938
+/* NO_IMPLICIT_EXTERN_C ... Define this macro if the system header files
5939
+ * support C++ as well as C.  This macro inhibits the usual method of using
5940
+ * system header files in C++, which is to pretend that the file's contents
5941
+ * are enclosed in 'extern "C" {...}'.
5942
+ *
5943
+ *
5944
+ * ZipCPU --- Don't have either C or C++ headers, so let's skip this for now.
5945
+ * Eventually, though, I think ZipCPU and C++ would go very well together.
5946
+ */
5947
+
5948
+/* REGISTER_TARGET_PRAGMAS ... Define this macro if you want to implement any
5949
+ * target specific pragmas.
5950
+ *
5951
+ * ZipCPU --- let's not.
5952
+ */
5953
+
5954
+/* HANDLE_PRAGMA_PACK_WITH_EXPANSION ... Define this macro if macros should be
5955
+ * expanded in the arguments of #pragma pack().
5956
+ *
5957
+ * ZipCPU ... why?
5958
+ */
5959
+
5960
+/* TARGET_DEFAULT_PACK_STRUCT ... If your target requires a struct packing
5961
+ * default other than 0 (meaning the machine default), define this macro to
5962
+ * the necessary value (in bytes).  This must be a value that would also be
5963
+ * valid to use with #pragma pack() (that is a small power of two.
5964
+ */
5965
+
5966
+/* DOLLARS_IN_IDENTIFIERS
5967
+ * ZipCPU --- Default (not changing C)
5968
+ */
5969
+
5970
+/* INSN_SETS_ARE_DELAYED(INSN) ... Define this macro as a C expression that
5971
+ * is nonzero if it is safe for the delay slot schedule to place instructions
5972
+ * in the delay slot of INSN, even if they appear to use a resource set or
5973
+ * clobbered in INSN.  INSN is always a ...
5974
+ *
5975
+ * ZipCPU --- You need not define this macro if it would always return zero.
5976
+ */
5977
+
5978
+/* INSN_REFERENCES_ARE_DELAYED(INSN) ... Define this macro as a C expression
5979
+ * that is nonzero if it is safe for the delay slot schedule to place
5980
+ * instructions in the delay slot of INSN, even if they appear to set or clobber
5981
+ * a resource referenced in INSN.  INSN is always a jump_insn or an insn.  On
5982
+ * machines where some insn or jump_insn is really a function call and ...
5983
+ *
5984
+ * ZipCPU --- You need not define this macro if it would always return zero.
5985
+ */
5986
+
5987
+/* MULTIPLE_SYMBOL_SPACES ... Define this macro as a C expression that is
5988
+ * nonzero if, in some cases, global symbols from one translation unit may not
5989
+ * be bound to undefined symbols in another translation unit without user
5990
+ * intervention.  For instance, under Microsoft Windows symbols must be
5991
+ * explicitly imported from shared libraries (DLLs).
5992
+ *
5993
+ * ZipCPU---You need not define this macro if it would always evaluate to zero,
5994
+ * so we won't.
5995
+ */
5996
+
5997
+/* TARGET_MD_ASM_ADJUST
5998
+ */
5999
+/* MATH_LIBRARY ... Define this macro as a C constant ... you only need to
6000
+ * define this macro if the default of "m" is wrong.
6001
+ *
6002
+ * ZipCPU --- as we don't have a math library yet, building one such that "m"
6003
+ * works doesn't sound like a problem.  Let's not define this.
6004
+ */
6005
+
6006
+/* LIBRARY_PATH_ENV ... Define this as a C string constant for the environment
6007
+ * variable that specifies where the linker should look for libraries.
6008
+ *
6009
+ * Just in case we want to add libraries for ZipCPU, let's place them in
6010
+ * /usr/local/zip/lib, so as not to confuse them with our local systems
6011
+ * libraries.
6012
+ */
6013
+#define        LIBRARY_PATH_ENV        "/usr/local/zip/lib"
6014
+
6015
+/* TARGET_POSIX_IO ... Define this macro if the target supports the following
6016
+ * POSIX file fucntions: access, mkdir, and file locking with fcntl/F_SETLKW.
6017
+ *
6018
+ * ZipCPU does not.
6019
+ */
6020
+
6021
+/* MAX_CONDITIONAL_EXECUTE ... A C expression for the maximum number of
6022
+ * instructions to execute via conditional execution instructions instead of a
6023
+ * branch.  A value of BRANCH_COST+1 is the default if the machine does not use
6024
+ * cc0 and 1 if it does use cc0.
6025
+ *
6026
+ * ZipCPU---This sounds good enough for the ZipCPU as well--as long as we have
6027
+ * BRANCH_COST defined.  However, BRANCH_COST is defined as conditionally to
6028
+ * something else, so let's keep looking into this.
6029
+ */
6030
+
6031
+/* IFCVT_MODIFY_TESTS(CEINFO,TRUE,FALSE) ... Used if the target needs to
6032 103 dgisselq
+ * perform machine-dependent modifications on the conditionals used for turning
6033 102 dgisselq
+ * basic blocks into conditionally executed code.  CEINFO points to a data
6034
+ * structure, struct ce_if_block, which contains information about the currently
6035
+ * processed blocks.  TRUE and FALSE are the tests that are used for
6036
+ * converting the then-block and the else-block, respectively.  Set either TRUE
6037
+ * or FALSE to a null pointer if the tests cannot be converted.
6038
+ *
6039
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6040
+ * execution and conditional testing capabilities.
6041
+ */
6042
+// #warning "Need to come back to this."
6043
+
6044
+/* IFCVT_MODIFY_MULTIPLE_TESTS(CEINFO, BB, TRUE, FALSE) ... Like
6045
+ * IFCVT_MODIFY_TESTS, but used when converting more complicated if-statements
6046
+ * into conditions combined by and and or operations.  BB contains the basic
6047
+ * block that contains the test that is currently being processed and about to
6048
+ * be turned into a condition.
6049
+ *
6050
+ *
6051
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6052
+ * execution and conditional testing capabilities.
6053
+ */
6054
+// #warning "Need to come back to this."
6055
+
6056
+
6057
+/* IFCVT_MODIFY_INSN(CEINFO, PATTERN, INSN) ... A C expression to modify the
6058
+ * PATTERN of an INSN that is to be converted to conditional execution format.
6059
+ * CEINFO points to a data structure, struct ce_if_block, which contains
6060
+ * information about the currently processed blocks.
6061
+ *
6062
+ *
6063
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6064
+ * execution and conditional testing capabilities.
6065
+ */
6066
+// #warning "Need to come back to this."
6067
+
6068
+
6069
+/* IFCVT_MODIFY_FINAL(CEINFO) ... A C expression to perform any final
6070
+ * machine dependent modifications in converting code to conditional
6071
+ * execution.  The involved basic blocks can be found in struct ce_if_block
6072
+ * structure pointed to be CEINFO.
6073
+ *
6074
+ *
6075
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6076
+ * execution and conditional testing capabilities.
6077
+ */
6078
+// #warning "Need to come back to this."
6079
+
6080
+
6081
+/* IFCVT_MODIFY_CANCEL(CEINFO) ... A C expression to cancel any machine
6082
+ * dependent modifications in converting code to conditional execution.  The
6083
+ * involved basic blocks can be found in the struct ce_if_block structure that
6084
+ * is pointed to by CEINFO.
6085
+ *
6086
+ *
6087
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6088
+ * execution and conditional testing capabilities.
6089
+ */
6090
+// #warning "Need to come back to this."
6091
+
6092
+
6093
+/* IFCVT_MACHDEP_INIT(CEINFO) ... A C expression to initialize any machine
6094
+ * specific data for if-conversion of the if-block in the CEINFO block structure
6095
+ * that is pointed by CEINFO.
6096
+ *
6097
+ *
6098
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6099
+ * execution and conditional testing capabilities.
6100
+ */
6101
+// #warning "Need to come back to this."
6102
+
6103
+
6104
+/* TARGET_MACHINE_DEPENDENT_REORG(VOID) ... If non-null, this hook performs a
6105
+ * target specific pass over the instruction stream.  The compiler will run it
6106
+ * at all optimization levels, just before the point at which it normally does
6107
+ * delayed branch scheduling.
6108
+ *
6109
+ * You need not implement the hook if it has nothing to do.
6110
+ *
6111
+ * ZipCPU---This may be part of a later upgrade, but shouldn't be needed to
6112
+ * just get us started.
6113
+ */
6114
+
6115
+
6116
+/* TARGET_INIT_BUILTINS(VOID) ... Define this hook if you ahve any machine
6117
+ * specific builtin functions that need to be defined.  It should be a function
6118
+ * that performs the necessary setup.  Machine specific builtin functions can be
6119
+ * useful to expand special machine instructions that would otherwise not
6120
+ * normally be generated because they have no equivalent in the source language.
6121
+ *
6122
+ * To create a built in function, call the function lang_hooks.builtin_function
6123
+ * which is defined by the language front end.  You can use any type nodes
6124
+ * set up by build_common_tree_nodes; only language front ends that use those
6125
+ * two functions will call "TARGET_INIT_BUILTINS".
6126
+ *
6127
+ * ZipCPU---We need to come back to this.  We should have several built-ins
6128
+ * defined: rtu(), wait(), halt(), save_context(cstackregno), and
6129
+ * restore_context(cstackregno).
6130
+ *
6131
+ */
6132
+#undef TARGET_INIT_BUILTINS
6133
+#define        TARGET_INIT_BUILTINS    zip_init_builtins
6134
+
6135
+/* TARGET_BUILTIN_DECL(CODE,INITP) ... Define this hook if you have any
6136
+ * machine specific builtin functions that need to be defined.  It should be a
6137
+ * function that returns the builtin function declaration for the builtin
6138
+ * function code code.  If there is no such builtin and it cannot be initialized
6139
+ * at this time if INITP is true the function should return NULL_TREE.  If
6140
+ * CODE is out of range the fucntion should return error-mark_node.
6141
+ *
6142
+ * ZipCPU ... needs to be done, don't know how to do it yet.
6143
+ */
6144
+#undef TARGET_BUILTIN_DECL
6145
+#define        TARGET_BUILTIN_DECL     zip_builtin_decl
6146
+
6147
+
6148
+/* TARGET_EXPAND_BUILTIN(TREE,TGT,SUB,MODE,IGNORE) ... Expand a call to a
6149
+ * machine specific built-in function that was set up by TARGET_INIT_BUILTINS.
6150
+ * TREE is the expression for the function call; the result should go to
6151
+ * TGT if that is convenient, and have mode MODE if that is convenient.  SUB
6152
+ * may be used as the target for computing one of EXP's operands.  IGNORE is
6153
+ * non-zero if the value is to be ignored.  This function should return the
6154
+ * result of the call to the built-in function.
6155
+ *
6156
+ * ZipCPU ... needs to do it, just to get our special intrinsic functions
6157
+ */
6158
+#define        TARGET_EXPAND_BUILTIN   zip_expand_builtin
6159
+
6160
+
6161
+/* TARGET_BUILTIN_CHKP_FUNCTION(FCODE) ... Allows the target to redefine
6162
+ * builtin functions used by Pointer Bounds Checker for code instrumentation.
6163
+ *
6164
+ * ZipCPU --- not interested.
6165
+ */
6166
+/* TARGET_CHKP_BOUND_TYPE
6167
+ * TARGET_CHKP_MAKE_BOUNDS_CONSTANT
6168
+ * TARGET_CHKP_INITIALIZE_BOUNDS
6169
+ *
6170
+ * ZipCPU --- Same as last one.
6171
+ */
6172
+
6173
+
6174
+/* TARGET_RESOLVE_OVERLOADED_BUILTIN(LOC, FN, ARGS) ... Select a replacement
6175
+ * for a machine specific built-in function that was set up by
6176
+ * TARGET_INIT_BUILTINS.
6177
+ *
6178
+ * ZipCPU --- If I go to the trouble to create a builtin, why would I want
6179
+ * to then overload it?
6180
+ */
6181
+
6182
+/* TARGET_FOLD_BUILTIN(FN,NARGS,ARGP,IGNORE) ... Fold a call to a machine
6183
+ * specific built-in function that was set up by 'TARGET_INIT_BUILTINS'  FN
6184
+ * is the declaration of the built-in function.  NARGS is the number of
6185
+ * arguments passed to the function; the arguments themselves are pointed to by
6186
+ * ARGP.  The result is another tree, valid for both GIMPLE and GENERIC,
6187
+ * containing as simplified expression for the call's result.  If IGNORE is
6188
+ * true the value will be ignored.
6189
+ *
6190
+ * ZipCPU --- You know, this and the previous couple sound like something
6191
+ * whereby I might be able replace bit-reversal code with my bit reverse
6192
+ * instruction.  That would be very useful, but not necessary to get me
6193
+ * started.
6194
+ */
6195
+
6196
+/* TARGET_GIMPLE_FOLD_BUILTIN
6197
+ * TARGET_COMPARE_VERSION_PRIORITY
6198
+ * TARGET_GET_FUNCTION_VERSIONS_DISPATCHER
6199
+ * TARGET_GENERATE_VERSION_DISPATCHER_BODY
6200
+ * TARGET_CAN_USE_DOLOOP_P
6201
+ * TARGET_INVALID_WITHIN_DOOLOOP
6202
+ * TARGET_LEGITIMATE_COMBINED_INSN
6203
+ * TARGET_CAN_FOLLOW_JUMP
6204
+ * TARGET_COMMUTATIVE_P
6205
+ */
6206
+
6207
+/* TARGET_ALLOCATE_INITIAL_VALUE(REGNO)  ... When the initial value of a hard
6208
+ * register has been copied in a pseudo register, it is often not necessary
6209
+ * ...
6210
+ */
6211
+/* TARGET_UNSPEC_MAY_TRAP_P(RTX,FLAGS)  ... This target hook returns nonzero in
6212
+ * RTX, un unspec or unspec_volatile operation, might cause a trap.  Targets
6213
+ * can use this hook to enhance precision of analysis for unspec and
6214
+ * unspec_volatile operations.  You may call may_trap_p_1 to analyze inner
6215
+ * elements of RTX in which case flags should be passed along.
6216
+ */
6217
+
6218
+/* TARGET_SET_CURRENT_FUNCTION(TREE)  The compiler invokes this hook whenever
6219
+ * it changes its current function context (CFUN).  You can define this
6220
+ * function if the back end needs to perform any initialization or reset
6221
+ * actions on a per-function basis.  For example, it may be used to implement
6222
+ * function attributes that affect register usage or code generation patterns.
6223
+ */
6224
+
6225
+/* TARGET_OBJECT_SUFFIX ... Define this macro to be a C string representing the
6226
+ * suffix for object files on your target machine.  If you do not define this
6227
+ * macro, GCC will use ".o" as the suffix for object files.
6228
+ */
6229
+#define        TARGET_OBJECT_SUFFIX    ".o"
6230
+
6231
+/* TARGET_EXECUTABLE_SUFFIX
6232
+ */
6233
+#define        TARGET_EXECUTABLE_SUFFIX        ""
6234
+
6235
+/* COLLECT_EXPORT_LIST ... If defined, collect2 will scan the individual object
6236
+ * files specified on its command line and create an export list for the linker.
6237
+ * Define this macro for systems like AIX, where the linker discards object
6238
+ * files that are not referenced from main and uses export lists.
6239
+ *
6240
+ * ZipCPU --- shoudln't need this.
6241
+ */
6242
+
6243
+/* MODIFY_JNI_METHOD_CALL(MDECL)  ... Define this macro to a C expression
6244
+ * representing a variant of the method call mdecl, if Java Native Interface
6245
+ * (JNI) methods must be invoked differently from other methods on your
6246
+ * target.  For example, on 32-bit MSWindows, JNI methods must be invoked
6247
+ * using the stdcall calling convention and this macro is then ...
6248
+ *
6249
+ * ZipCPU----Don't need this.  (yet)
6250
+ */
6251
+
6252
+
6253
+/* TARGET_CANNOT_MODIFY_JUMPS_P ... This target hook returns true past the
6254
+ * point in which a new jump instructions could be created.  On machines that
6255
+ * require a register for every jump such as the SHmedia ISA of SH5, this point
6256
+ * would typically be reload, so thiss target hook should be defined to a
6257
+ * function such as:
6258
+ *
6259
+ * ZipCPU --- I don't get what this is for.
6260
+ */
6261
+
6262
+/* TARGET_BRANCH_TARGET_REGISTER_CLASS ... This target hook returns a register
6263
+ * class for which branch target register optimizations should be applied.  All
6264
+ * registers in this class should be usable interchangably.  After reload,
6265
+ * registers in this class will be re-allocated and loads will be hoisted out of
6266
+ * loops and be subjected to inter-block scheduling.
6267
+ *
6268
+ * ZipCPU---GENERAL_REGS, but this should be a default already ...
6269
+ */
6270
+
6271
+
6272
+/* TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED ...  Branch target register
6273
+ * optimization will by default exclude callee-saved registers that are not
6274
+ * already live during the current function.  If this target hook returns true,
6275
+ * they will be included.  The target code must then make sure that all target
6276
+ * registers in the class returned by TARGET_BRANCH_REGISTER_CLASS that might
6277
+ * be saved are saaved.
6278
+ *
6279
+ * ZipCPU---
6280
+ */
6281
+
6282
+
6283
+/* TARGET_HAVE_CONDITIONAL_EXECUTION(VOID) ... This target hook returns true
6284
+ * if the target supports conditional execution.  This target hook is required
6285
+ * only when the target has several different modes and they have different
6286
+ * conditional execution capability, such as ARM.
6287
+ *
6288
+ * ZipCPU---Yes!  All instructions may be conditionally executed (except the
6289
+ * long version load immediate ...)
6290
+ */
6291
+#define        TARGET_HAVE_CONDITIONAL_EXECUTION       hook_bool_void_true
6292
+
6293
+/* TARGET_GEN_CCMP_FIRST(PREP,GEN,CODE,OP0,OP1) .. This function prepares to
6294
+ * emit a comparison instruction for the first compare in a sequence of
6295
+ * conditional comparisons.  It returns an appropriate comparison with CC for
6296
+ * passing to gen_ccmp_next or cbranch_optab.  The instructions to prepare the
6297
+ * compare are saved in prep_seq and the compare instructions are saved in
6298
+ * gen_seq.  They will be emitted when all the compares in the conditional
6299
+ * comparison are generated without error.  CODE is the rtx_code of the compare
6300
+ * for op0 and op1.
6301
+ *
6302
+ *
6303
+ * ZipCPU---???
6304
+ */
6305
+
6306
+/* TARGET_GEN_CCMP_NEXT(PREP,GEN,PREV,CMP,OP0,OP1,BITCODE) ... This function
6307
+ * prepares to emit a conditional comparison within a sequence of conditional
6308
+ * comparisons.  It returns an appropriate comparison with CC for passing to
6309
+ * gen_ccmp_next or cbranch_optab.  The insn to prepare the compare are saved
6310
+ * in prep_seq and the compare instructions are saved in gen_seq.  They will be
6311
+ * emitted when all the compares in the conditional comparison are generated
6312
+ * without error.  The pPREV expression is the result of a prior call to either
6313
+ * gen_ccmp_first or gen_ccmp_next.  It may return NULL if the combination of
6314
+ * PREV and this comparison is not supported, otherwise the result must be the
6315
+ * appropriate for passing to gen_ccmp_next or cbranch_optab.  CODE is the RTX
6316
+ * code of the compare for op0 and op1.  BITCODE is AND or IOR, which is the op
6317
+ * on the compares.
6318
+ *
6319
+ *
6320
+ * ZipCPU --- ???
6321
+ */
6322
+
6323
+/* TARGET_LOOP_UNROLL_ADJUST(NUNROLL, LOOP) ... This target hook returns a new
6324
+ * value for the number of times loop should be unrolled.  The parameter NUNROLL
6325
+ * is the number of times the loop is to be unrolled.  The parameter loop is a
6326
+ * pointer to the loop, which is going to be checked for unrolling.  The target
6327
+ * hook is required only when the target has special constraints like maximum number of memory accesses.
6328
+ *
6329
+ *
6330
+ * ZipCPU -- ???
6331
+ */
6332
+
6333
+
6334
+/* POWI_MAX_MULTS ... If defined, this macro is interpreted as a signed integer
6335
+ * C expression that specifies the maximum number of floating point
6336
+ * multiplications that should be emitted when expanding exponentiation by an
6337
+ * integer constant inline.  When this value is defined, exponentiation
6338
+ * requiring more than this number of multiplications is implemented by calling
6339
+ * the system library's pow, powf, or powl routines.  The default value
6340
+ places no upper bound on the multiplication count.
6341
+ *
6342
+ * ZipCPU---As we have no system library pow() routine (yet) ... we're not
6343
+ * ready for this macro.
6344
+ */
6345
+
6346
+
6347
+/* TARGET_EXTRA_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6348
+ * register any extra include files for the target.  The parameter stdinc
6349
+ * indicates if normal include files are present.  The parameter SYSROOT is the
6350
+ * system root directory.  The parameter PFX is the prefix for the GCC
6351
+ * directoiry.
6352
+ *
6353
+ *
6354
+ * ZipCPU---None yet.
6355
+ */
6356
+
6357
+/* TARGET_EXTRA_PRE_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6358
+ * register any extrra include files for the target before any standard headers.
6359
+ * The parameter stdinc indicates if normal include files are present.
6360
+ *
6361
+ * ZipCPU --- None.
6362
+ */
6363
+
6364
+/* TARGET_OPTF(PATH) ... This target hook should register special include paths
6365
+ * for the target.  The parameter path is the integer to register.  On Darwin
6366
+ * systems, this is used for Framework includes, which have semantics that are
6367
+ * different from -I.
6368
+ *
6369
+ *
6370
+ * ZipCPU --- None.
6371
+ */
6372
+
6373
+/* TARGET_USE_LOCAL_THUNK_ALIAS_P(FN) ... This target macro returns if it is
6374
+ * safe to use a local alias for a virtual function FN when constructing
6375
+ * thunks, false otherwise.  By default, the macro returns true for all
6376
+ * functions, if a target supports aliases (i.e. defines ASM_OUTPUT_DEF),
6377
+ * false otherwise.
6378
+ *
6379
+ *
6380
+ * ZipCPU --- ???
6381
+ */
6382
+// #warning "ASM_OUTPUT_DEF's definition has not been considered"
6383
+
6384
+
6385
+/* TARGET_FORMAT_TYPES ... If defined, this macro is the name of a global
6386
+ * variable containing target-specific format checking information for the
6387
+ * -Wformat option.  The default is to have no target-specific format checks.
6388
+ *
6389
+ * ZipCPU --- Default
6390
+ */
6391
+
6392
+/* TARGET_N_FORMAT_TYPES
6393
+ *
6394
+ * ZipCPU --- Default
6395
+ */
6396
+
6397
+/* TARGET_OVERRIDES_FORMAT_ATTRIBUTES ... If defined, this macro is the name of
6398
+ * a global variable containing target-specific format overrides for the
6399
+ * -Wformat option.  The default is to have no target specific format overrides.
6400
+ *
6401
+ * ZipCPU --- Default
6402
+ */
6403
+
6404
+/* TARGET_OVERRIDEES_FORMAT_ATTRIBUTES
6405
+ * TARGET_OVERRIDEES_FORMAT_ATTRIBUTES_COUNT
6406
+ *
6407
+ * If defined, the (first) macro is the name of a global variable containing
6408
+ * target-specific format overrides for the -Wformat option.
6409
+ */
6410
+/* TARGET_OVERRIDES_FORMAT_INIT ... If defined, this macro specifies the
6411
+ * optional initialization routine for target specific customizations of the
6412
+* system printf and scanf formatter settings.
6413
+ */
6414
+
6415
+/* TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN(TLIST,FN,VAL) ... If defined, this
6416
+ * macro returns the diagnostic message when it is illegal to pass an argument
6417
+ * VAL to function FN with prototype TLIST.
6418
+ *
6419
+ * ZipCPU---Default.
6420
+ */
6421
+
6422
+/* TARGET_INVALID_CONVERSION
6423
+ * TARGET_INVALID_UNARY_OP
6424
+ * TARGET_INVALID_BINARY_OP
6425
+ * TARGET_INVALID_PARAMETER_TYPE
6426
+ * TARGET_INVALID_RETURN_TYPE
6427
+ * TARGET_PROMOTED_TYPE
6428
+ * TARGET_CONVERT_TO_TYPE
6429
+ * TARGET_USE_JCR_SECTION_TYPE
6430
+ * OBJC_JBLEN
6431
+ * LIBGCC2_UNWIND_ATTRIBUTE
6432
+ * TARGET_UPDATE_STACK_BOUNDARY
6433
+ * TARGET_GET_DRAP_RTX
6434
+ * TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS
6435
+ */
6436
+/* TARGET_CONST_ANCHOR ... On some architectures it can take multiple
6437
+ * instructions to synthesize a constant. If there is another constant already
6438
+ * in a register that is close enough in value then it is preferable that the
6439
+ * new constant is computed from the register using immediate addition or
6440
+ * subtraction.  We accomplish this through CSE.  Besides the value of the
6441
+ * constant we also add a lower and an upper constant anchor to the available
6442
+ * expressions.  These are then queried when encountering new constants.  The
6443
+ * anchors are computed by rounding the constant up and down to a multiple of
6444
+ * the value of TARGET_CONST_ANCHOR.  TARGET_CONST_ANCHOR should be the maximum
6445
+ * positive value accepted by immediate-add plus one.  We currently assume that
6446
+ * the value of TARGET_CONST_ANCHOR is a poewr of 2.  For example, on MIPS,
6447
+ * where add-immediate takes a 16-bit signed value, TARGET_CONST_ANCHOR is set
6448
+ * to 0x8000.  The default value is zero, which disables this optimization.
6449
+ *
6450
+ * ZipCPU---One of the great strengths of the ZipCPU ISA is its ability to
6451
+ * access registers plus immediates.  To use this, we *need* this capability.
6452
+ * So, we define it here. (to 0x20000, or 2^17 because we can handle 18-bits of
6453
+ * signed immediate offsets)
6454
+ *
6455
+ * On ZipCPU---2^17
6456
+ */
6457
+#define        TARGET_CONST_ANCHOR     zip_const_anchor
6458
+
6459
+/* TARGET_ASAN_SHADOW_OFFSET ... Return the offset bitwise ored into shifted
6460
+ * address to get corresponding Address Sanitizer shadow memory address.  NULL
6461
+ * if address Sanitizer is not supported by the target.
6462
+ */
6463
+#define        TARGET_ASAN_SHADOW_OFFSET       NULL
6464
+
6465
+/* TARGET_MEMMODEL_CHECK
6466
+ */
6467
+/* TARGET_ATOMIC_TEST_AND_SET_TRUEVAL ... This value should be set if the result
6468
+ * written by atomic test and set is not exactly 1, i.e. the bool true.
6469
+ */
6470
+/* TARGET_HAS_IFUNC_P ... It returns true if the target supports GNU indirect
6471
+ * functions.  The support includes the assembler, linker, and dynamic linker.
6472
+ * The default value of this hook is based on target's libc.
6473
+ */
6474
+#define        TARGET_HAS_IFUNC_P      hook_bool_void_true
6475
+
6476
+/* TARGET_ATOMIC_ALIGN_FOR_MODE(MODE) ... If defined, this function returns
6477
+ * an appropriate alignment in bits for an atomic object of machine mode
6478
+ * MODE.  If 0 is returned then the default alignment for the specified mode
6479
+ * is used.
6480
+ *
6481
+ * ZipCPU---Both default and 2 would be valid.  We'll stick to the default.
6482
+ */
6483
+
6484
+/* TARGET_ATOMIC_ASSIGN_EXPAND_FENV --- ISO C11 requires atomic compound
6485
+ * assignments that may raise floating-point exceptions to raise exceptions
6486
+ * corresponding to the arithmetic operation whose result was successfully
6487
+ * stored in a compare-and-exchange sequence.  This requires code equivalent to
6488
+ * calls to feholdexcept, feclearexcept and feupdateenv to be generated at
6489
+ * appropriate points in the compare-and-exchange sequence.  This hook should
6490
+ * set *hold to an expression equivalent
6491
+ *
6492
+ * ZipCPU --- ???
6493
+ */
6494
+
6495
+/* TARGET_RECORD_OFFLOAD_SYMBOL ... Used when offloaded functions are seen in
6496
+ * the compilation unit and no named sections are available.  It is called once
6497
+ * for each symbol that must be recorded in the offload function and variable
6498
+ * table.
6499
+ *
6500
+ * ZipCPU --- Offloaded functions?
6501
+ */
6502
+
6503
+/* TARGET_OFFLOAD_OPTIONS
6504
+ *
6505
+ * ZipCPU---none defined
6506
+ */
6507
+
6508
+/* TARGET_SUPPORTS_WIDE_INT ... On older ports, large integers are stored
6509
+ * in CONST_DOUBLE rtl objects.  Newer ports define TARGET_SUPPORTS_WIDE_INT
6510
+ * to be nonzero to indicate that large integers are stored in CONST_WIDE_INT
6511
+ * rtl objects.  The CONST_WIDE_INT allows very large integer constants to be
6512
+ * represented.  CONST_DOUBLE is limited to twice the size of the hosts
6513
+ * HOST_WIDE_INT representation.
6514
+ *
6515
+ * ZipCPU---We don't need these yet, so this isn't yet relevant.  (These ints
6516
+ * are wider than DImode ...)
6517
+ */
6518
+#define        TARGET_SUPPORTS_WIDE_INT        0
6519
+
6520
+
6521
+/* Now, for the prototype functions ...*/
6522
+// These have been moved to zip-protos.h
6523
+
6524
+// extern void zip_init_builtins(void);
6525
+// extern void zip_asm_output_anchor(rtx x);
6526
+// extern bool zip_legitimate_address_p(enum machine_mode mode, rtx x, bool string);
6527
+// extern void zip_asm_trampoline_template(FILE *);
6528
+// extern void zip_initial_elimination_offset(int from, int to);
6529
+// extern void zip_print_operand(FILE *stream, rtx *x, int code);
6530
+// extern void zip_print_operand_address(FILE *stream, rtx *x);
6531
+// extern void zip_asm_output_def(FILE *s, const char *n, const char *v);
6532
+// extern void zip_update_cc_notice(rtx exp, rtx_insn *insn);
6533
+// extern      int zip_address_operand(rtx op);
6534
+// extern      int zip_const_address_operand(rtx op);
6535
+// extern void zip_expand_prologue(void);
6536
+// extern void zip_expand_epilogue(void);
6537
+// extern bool zip_gen_move_rtl(rtx, rtx);
6538
+// extern bool zip_load_address_lod(rtx, rtx);
6539
+// extern bool zip_load_address_sto(rtx, rtx);
6540
+// extern void zip_print_operand(FILE *fp, rtx x, int code);
6541
+// extern void zip_print_operand_address(FILE *fp, rtx x);
6542
+// extern bool zip_use_return_insn(void);
6543
+
6544
+#define        QImode  SImode
6545
+#define        HImode  SImode
6546
+
6547
+#include "insn-modes.h"
6548
+#include "zip-protos.h"
6549
+
6550
+#endif /* GCC_ZIP_H */
6551
+
6552
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.md gcc-5.3.0-zip/gcc/config/zip/zip.md
6553
--- gcc-5.3.0-original/gcc/config/zip/zip.md    1969-12-31 19:00:00.000000000 -0500
6554 103 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.md 2016-03-07 18:21:44.060561458 -0500
6555
@@ -0,0 +1,1736 @@
6556 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6557
+;;
6558
+;; Filename:   zip.md
6559
+;;
6560
+;; Project:    Zip CPU -- a small, lightweight, RISC CPU soft core
6561
+;;
6562
+;; Purpose:    This is the machine description of the Zip CPU as needed by the
6563
+;;             GNU compiler collection (GCC).
6564
+;;
6565
+;;
6566
+;; Creator:    Dan Gisselquist, Ph.D.
6567
+;;             Gisselquist Technology, LLC
6568
+;;
6569
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6570
+;;
6571
+;; Copyright (C) 2015, Gisselquist Technology, LLC
6572
+;;
6573
+;; This program is free software (firmware): you can redistribute it and/or
6574
+;; modify it under the terms of  the GNU General Public License as published
6575
+;; by the Free Software Foundation, either version 3 of the License, or (at
6576
+;; your option) any later version.
6577
+;;
6578
+;; This program is distributed in the hope that it will be useful, but WITHOUT
6579
+;; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
6580
+;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6581
+;; for more details.
6582
+;;
6583
+;; License:    GPL, v3, as defined and found on www.gnu.org,
6584
+;;             http://www.gnu.org/licenses/gpl.html
6585
+;;
6586
+;;
6587
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6588
+;;
6589
+;;
6590
+;; - Immediate integer operand constraints
6591
+;;     'I'     -2^22 ... 2^22-1, or -4194304 .. 4194303        (LDI insn)
6592
+;;     'M'     -2^12 ... 2^12-1, or -4096 ... 4095             (MOV offset)
6593
+;;     'N'     -2^14 ... 2^14-1, or -16384 ... 16383           (OpB offset)
6594
+;;     'O'     -2^17 ... 2^17-1, or -131072 ... 131071         (OpB Immediate)
6595
+;;     'R'     0...31                                          (Shift value)
6596
+;; - Memory constraints
6597
+;;     'Q'     Op-B capable references to memory
6598
+;;     'S'     References to constant memory
6599
+;; - Address constraints
6600
+;;     'P'     Op-B capable references to memory
6601
+;;     'T'     Constant memory addresses
6602
+(define_constraint "M"
6603
+  "An 13-bit signed immediate such as a MOV instruction can handle"
6604
+  (and (match_code "const_int")
6605
+       (match_test "(ival < 0x1000) && (ival >= -0x1000)")))
6606
+(define_constraint "N"
6607
+  "An 14-bit signed immediate offset such as an Op-B register offset"
6608
+  (and (match_code "const_int")
6609
+       (match_test "(ival < 0x2000) && (ival >= -0x2000)")))
6610
+(define_constraint "O"
6611
+  "An 18-bit signed immediate such as an Op-B Immediate can handle"
6612
+  (and (match_code "const_int")
6613
+       (match_test "(ival < 0x20000) && (ival >= -0x20000)")))
6614
+(define_constraint "R"
6615
+  "Bits that a value may be shifted"
6616
+  (and (match_code "const_int")
6617
+       (match_test "(ival < 32) && (ival >= 0)")))
6618
+;;
6619
+;
6620
+;
6621
+; Our builtin functions, by identifier
6622
+;
6623
+(define_constants
6624
+       [(UNSPEC_RTU            1)
6625
+       (UNSPEC_HALT            2)
6626
+       (UNSPEC_IDLE            3)
6627
+       (UNSPEC_SYSCALL         4)
6628
+       (UNSPEC_SAVE_CONTEXT    5)
6629
+       (UNSPEC_RESTORE_CONTEXT 6)
6630
+       (UNSPEC_BITREV          7)
6631
+       (UNSPEC_GETCC           8)
6632
+       (UNSPEC_LDILO           9)
6633
+       ])
6634
+;
6635
+;
6636
+; Registers by name
6637
+(define_constants
6638
+  [(RTN_REG            0)      ; Return address register
6639
+   (RTNV_REG           1)      ; Subroutine return value register
6640
+   (AP_REG             10)     ; Hopefully never used
6641
+   (GBL_REG            11)     ; Hopefully never used, but just in case ...
6642
+   (FP_REG             12)
6643
+   (SP_REG             13)
6644
+   (CC_REG             14)
6645
+   (PC_REG             15)
6646
+  ])
6647
+;
6648
+;
6649
+;
6650
+
6651
+;; Predicates
6652
+(define_predicate "zip_const_address_operand_p"
6653
+       (match_code "symbol_ref,const,label_ref,code_label")
6654
+{
6655
+       return zip_const_address_operand(op);
6656
+})
6657
+
6658
+(define_predicate "zip_address_operand_p"
6659
+       (match_code "reg,plus")
6660
+{
6661
+       return zip_pd_address_operand(op);
6662
+})
6663
+
6664
+(define_predicate "zip_mov_operand_p"
6665
+       (match_code "reg,plus")
6666
+{
6667
+       return zip_pd_mov_operand(op);
6668
+})
6669
+
6670
+(define_predicate "zip_memory_operand_p"
6671
+       (match_code "mem")
6672
+{
6673
+       return zip_pd_address_operand(XEXP(op,0));
6674
+})
6675
+
6676
+;; Constraints
6677
+;
6678
+(define_memory_constraint "S"
6679
+       "Any memory referenced by a constant address, possibly unknown at compile time"
6680
+       (and (match_code "mem")
6681
+               (match_test "zip_ct_const_address_operand(XEXP(op,0))")))
6682
+(define_memory_constraint "Q"
6683
+       "Any memory addressed suitably for a load or store instruction"
6684
+       (and (match_code "mem")
6685
+               (match_test "zip_ct_address_operand(XEXP(op,0))")))
6686
+(define_address_constraint "U"
6687
+       "An address suitable for a load or store instruction"
6688
+       (and (match_code "reg,plus")
6689
+               (match_test "zip_ct_address_operand(op)")))
6690
+(define_address_constraint "T"
6691
+       "Any constant address, to include those made by symbols unknown at compile time"
6692
+       (and (match_code "label_ref,code_label,symbol_ref,const")
6693
+               (match_test "zip_ct_const_address_operand(op)")))
6694
+;
6695
+;
6696
+;; Attributes
6697
+;
6698
+(define_attr "predicable"  "no,yes" (const_string "yes"))
6699
+(define_attr "conditional" "no,yes" (const_string "no"))
6700
+(define_attr "ccresult" "set,unknown,unchanged,validzn" (const_string "set"))
6701
+;
6702
+; Mode attributes
6703
+; (define_mode_iterator ZI [QI HI SI])
6704
+; (define_mode_attr zipa [(QI "") (HI "") (SI "")])
6705
+(define_mode_iterator ZI [SI])
6706
+(define_mode_attr zipa [(SI "")])
6707
+;
6708
+;
6709
+;
6710
+;; Instructions
6711
+;
6712
+; (define_insn
6713
+;      optional name
6714
+;      RTL template -- a vector of incomplete RTL expressions describing the
6715
+;              semantics of the instruction.  It is incomplete because it may
6716
+;              contain match_operand, match_operator, and match_dup expressions
6717
+;      The condition --- contains a C expression, may be an empty string
6718
+;      output template or output statement--fragment of C code returning a str
6719
+;      Attributes --
6720
+;      )
6721
+;
6722
+; (match_operand:m n predicate constraint)
6723
+;      Placeholder for operand #n of the instruction
6724
+;      Predicate       string that is the name of a fucntion w/ 2 arguments:
6725
+;                              (expression, machine mode)
6726
+;              we can build functions:
6727
+;                      "isregister"    to describe a register
6728
+;                      "isimmediate"   to describe an immediate
6729
+;                      "offsetreg"     to describe a register plus offset
6730
+;                      "anyregister"   to describe *ANY* register (uRx or Rx)
6731
+;              But ... functions "address_operand", "immediate_operand",
6732
+;                      "register_operand", "indirect_operand"
6733
+;              "comparison_operatot" and "ordered_comparison_operator"
6734
+;              are also available--be aware, they include more comparisons
6735
+;              than Zip CPU can do.
6736
+;
6737
+;
6738
+;
6739
+;
6740
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6741
+;;
6742
+;; Move instructions: both
6743
+;      (arbitrary) from variables to variables, but this gets
6744
+;              expanded into:
6745
+;      from registers to registers
6746
+;      from immediates to registers
6747
+;;
6748
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6749
+;
6750
+;
6751
+;
6752
+(define_expand "mov<mode>"
6753
+       [(set (match_operand:ZI 0 "nonimmediate_operand" "") ; =r,Q,r,r")
6754
+               (match_operand:ZI 1 "general_operand" ""))] ; r,r,Q,i"))]
6755
+       ""
6756
+       {/* Everything except mem=const or mem=mem can be done easily */
6757
+       if (zip_gen_move_rtl(operands[0], operands[1]))
6758
+               DONE;
6759
+       else internal_error("%s", "Zip/No usable movsi expansion\n");
6760
+       }
6761
+       [(set_attr "ccresult" "unchanged")])
6762
+(define_insn "mov<mode>_reg"   ; Register to register move
6763
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6764
+               (match_operand:ZI 1 "register_operand" "r"))]
6765
+       ""
6766
+       "MOV    %1,%0"
6767
+       [(set_attr "ccresult" "unchanged")])
6768
+(define_insn "mov<mode>_reg_off"       ; Register to register move
6769
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6770
+               (plus:ZI (match_operand:ZI 1 "register_operand" "r")
6771
+                       (match_operand:ZI 2 "const_int_operand" "M")))]
6772
+       ""
6773
+       "MOV    %2(%1),%0"
6774
+       [(set_attr "ccresult" "unchanged")])
6775 103 dgisselq
+;(define_insn "mov<mode>_lod"  ; Load from memory
6776
+;      [(set (match_operand:ZI 0 "register_operand" "=r")
6777
+;              (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
6778
+;      ""
6779
+;      "LOD    %1,%0"
6780
+;      [(set_attr "ccresult" "unchanged")])
6781
+;(define_insn "mov<mode>_sto"  ; Store into memory
6782
+;      [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
6783
+;              (match_operand:ZI 1 "register_operand" "r"))]
6784
+;      ""
6785
+;      "STO    %1,%0"
6786
+;      [(set_attr "ccresult" "unchanged")])
6787
+(define_expand "mov<mode>_lod" ; Load from memory
6788 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6789
+               (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
6790 103 dgisselq
+       "")
6791
+(define_insn "*movsi_lod"
6792
+       [(set (match_operand:SI 0 "register_operand" "=r")
6793
+               (mem:SI (match_operand:SI 1 "register_operand" "r")))]
6794 102 dgisselq
+       ""
6795 103 dgisselq
+       "LOD\t%1,%0"
6796
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
6797
+(define_insn "*movsi_lod_off"
6798
+       [(set (match_operand:SI 0 "register_operand" "=r")
6799
+               (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
6800
+                       (match_operand:SI 2 "const_int_operand" "N"))))]
6801
+       ""
6802
+       "LOD\t%2(%1),%0"
6803
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
6804
+(define_expand "mov<mode>_sto" ; Store into memory
6805 102 dgisselq
+       [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
6806
+               (match_operand:ZI 1 "register_operand" "r"))]
6807 103 dgisselq
+       "")
6808
+(define_insn "*movsi_sto"
6809
+       [(set (mem:SI (match_operand:SI 0 "register_operand" "r"))
6810
+               (match_operand:SI 1 "register_operand" "r"))]
6811 102 dgisselq
+       ""
6812 103 dgisselq
+       "STO\t%1,(%0)"
6813
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
6814
+(define_insn "*movsi_sto_off"
6815
+       [(set (mem:SI (plus:SI
6816
+                       (match_operand:SI 0 "register_operand" "r")
6817
+                       (match_operand:SI 1 "const_int_operand" "N")))
6818
+               (match_operand:SI 2 "register_operand" "r"))]
6819
+       ""
6820
+       "STO\t%2,%1(%0)"
6821
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
6822 102 dgisselq
+(define_insn "mov<mode>_ldi"   ; Load immediate
6823
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6824
+               (match_operand:ZI 1 "immediate_operand" "ipU"))]
6825
+       ""
6826
+       "LDI    %1,%0"
6827
+       [(set_attr "ccresult" "unchanged")])
6828
+;
6829
+;
6830
+;
6831
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6832
+;;
6833
+;; Load and store multiple values
6834
+;;
6835
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6836
+;
6837
+; So far, from the code I've seen from GCC's output,
6838
+; these instructions do not appear to be necessary.
6839
+;
6840
+;(define_insn "load_multiple"
6841
+;      for(a=0; a<%2; a++)
6842
+;              LOD a(%1),%0+a
6843
+;(define_insn "store_multiple"
6844
+;      for(a=0; a<%2; a++)
6845
+;              STO %0+a,a(%1)
6846
+; pushsi -- Do not define, compiler will work around it nicely w/o our help
6847
+;
6848
+;
6849
+;
6850
+;
6851
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6852
+;;
6853
+;; General arithmetic instructions
6854
+;;
6855
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6856
+;
6857
+;
6858
+;
6859
+;
6860
+(define_insn "add<mode>3" ; Fastest/best instruction always goes first
6861
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6862 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
6863
+                       (match_operand:ZI 2 "nonmemory_operand" "rO")))
6864 102 dgisselq
+       ]
6865
+       ""
6866
+       "ADD    %2,%0"
6867
+       [(set_attr "ccresult" "set")])
6868
+(define_insn "add<mode>3_off" ; Fastest/best instruction always goes first
6869
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6870 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
6871
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
6872 102 dgisselq
+                               (match_operand:ZI 3 "const_int_operand" "N"))))
6873
+       ]
6874
+       ""
6875
+       "ADD    %3+%2,%0"
6876
+       [(set_attr "ccresult" "set")])
6877
+;
6878
+;
6879
+;
6880 103 dgisselq
+(define_expand "sub<mode>3"
6881 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6882 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
6883
+                       (match_operand:ZI 2 "nonmemory_operand" "")))
6884
+       ])
6885
+(define_insn "*subsi3"
6886
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6887
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
6888
+                       (match_operand:ZI 2 "nonmemory_operand" "rO")))
6889 102 dgisselq
+       ]
6890
+       ""
6891
+       "SUB    %2,%0"
6892
+       [(set_attr "ccresult" "set")])
6893
+(define_insn "sub<mode>3_off"
6894
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6895 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
6896
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "%r")
6897 102 dgisselq
+                               (match_operand:ZI 3 "const_int_operand" "N"))))
6898
+       ]
6899
+       ""
6900
+       "SUB    %3+%2,%0"
6901
+       [(set_attr "ccresult" "set")])
6902
+(define_insn "mul<mode>3"
6903
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6904
+               (mult:ZI (match_operand:ZI 1 "register_operand" "%r")
6905
+                       (match_operand:ZI 2 "register_operand" "r")))
6906
+       (clobber (match_scratch:ZI 3 "=r"))]
6907
+       ; "(R0 != R1)&&(R0 != R2)&&(R0!=R3)&&(R1!=R2)&&(R1=R3)&&(R2!=R3)"
6908
+       ""
6909
+       "MOV    %1,%0
6910
+       MPYS    %2,%0
6911
+       MOV     %1,%3
6912
+       ROL     16,%3
6913
+       MPYS    %2,%3
6914
+       ROL     16,%3
6915
+       AND     0x0ffff,%3
6916
+       ADD     %3,%0
6917
+       MOV     %2,%3
6918
+       ROL     16,%3
6919
+       MPYS    %1,%3
6920
+       ROL     16,%3
6921
+       AND     0x0ffff,%3
6922
+       ADD     %3,%0"
6923
+       [(set_attr "ccresult" "unknown")])
6924
+
6925
+(define_insn "div<mode>3"
6926
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6927 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
6928
+                       (match_operand:ZI 2 "nonmemory_operand" "rO")))]
6929 102 dgisselq
+       ""
6930
+       "DIVS   %2,%0"
6931
+       [(set_attr "ccresult" "set")])
6932
+(define_insn "div<mode>3_off"
6933
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6934 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
6935
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
6936 102 dgisselq
+                               (match_operand:ZI 3 "const_int_operand" "N"))))]
6937
+       ""
6938
+       "DIVS   %3+%2,%0"
6939
+       [(set_attr "ccresult" "set")])
6940
+(define_insn "udiv<mode>3"
6941
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6942 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
6943
+                       (match_operand:ZI 2 "nonmemory_operand" "rO")))]
6944 102 dgisselq
+       ""
6945
+       "DIVU   %2,%0"
6946
+       [(set_attr "ccresult" "set")])
6947
+(define_insn "udiv<mode>3_off"
6948
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6949 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
6950
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
6951 102 dgisselq
+                               (match_operand:ZI 3 "const_int_operand" "N"))))]
6952
+       ""
6953
+       "DIVU   %3+%2,%0"
6954
+       [(set_attr "ccresult" "set")])
6955
+;;
6956
+;; modsi3
6957
+;; umodsi3
6958
+;;
6959
+(define_insn "umin<mode>3"
6960
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6961
+               (umin:ZI (match_operand:ZI 1 "register_operand" "%0")
6962
+                       (match_operand:ZI 2 "register_operand" "r")))
6963
+       ]
6964
+       ""
6965
+       "CMP    %0,%2
6966
+       MOV.C   %2,%0"
6967
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
6968
+(define_insn "umax<mode>3"
6969
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6970
+               (umax:ZI (match_operand:ZI 1 "register_operand" "%0")
6971
+                       (match_operand:ZI 2 "register_operand" "r")))
6972
+       ]
6973
+       ""
6974
+       "CMP    %2,%0
6975
+       MOV.C   %2,%0"
6976
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
6977
+(define_insn "smin<mode>3"
6978
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6979
+               (smin:ZI (match_operand:ZI 1 "register_operand" "%0")
6980
+                       (match_operand:ZI 2 "register_operand" "r")))
6981
+       ]
6982
+       ""
6983
+       "CMP    %2,%0
6984
+       MOV.GT  %2,%0"
6985
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
6986
+(define_insn "smax<mode>3"
6987
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6988
+               (smax:ZI (match_operand:ZI 1 "register_operand" "%0")
6989
+                       (match_operand:ZI 2 "register_operand" "r")))
6990
+       ]
6991
+       ""
6992
+       "CMP    %0,%2
6993
+       MOV.LT  %2,%0"
6994
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
6995
+(define_insn "and<mode>3"
6996
+       [(set (match_operand:ZI 0 "register_operand" "=r")
6997
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
6998 103 dgisselq
+                       (match_operand:ZI 2 "nonmemory_operand" "rO")))
6999 102 dgisselq
+       ]
7000
+       ""
7001
+       "AND    %2,%0"
7002
+       [(set_attr "ccresult" "set")])
7003
+(define_insn "and<mode>3_off"
7004
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7005
+               (and:ZI (match_operand:ZI 1 "register_operand" "0")
7006
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7007
+                               (match_operand:ZI 3 "const_int_operand" "N"))))
7008
+       ]
7009
+       ""
7010
+       "AND    %3+%2,%0"
7011
+       [(set_attr "ccresult" "set")])
7012
+(define_insn "ior<mode>3"
7013
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7014
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
7015 103 dgisselq
+                       (match_operand:ZI 2 "nonmemory_operand" "rO")))
7016 102 dgisselq
+       ]
7017
+       ""
7018
+       "OR     %2,%0"
7019
+       [(set_attr "ccresult" "set")])
7020
+(define_insn "ior<mode>3_off"
7021
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7022
+               (ior:ZI (match_operand:ZI 1 "register_operand" "0")
7023
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7024 103 dgisselq
+                               (match_operand:ZI 3 "nonmemory_operand" "N"))))
7025 102 dgisselq
+       ]
7026
+       ""
7027
+       "OR     %3+%2,%0"
7028
+       [(set_attr "ccresult" "set")])
7029
+(define_insn "xor<mode>3"
7030
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7031
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
7032 103 dgisselq
+                       (match_operand:ZI 2 "nonmemory_operand" "rO")))
7033 102 dgisselq
+       ]
7034
+       ""
7035
+       "XOR    %2,%0"
7036
+       [(set_attr "ccresult" "set")])
7037
+(define_insn "xor<mode>3_off"
7038
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7039
+               (xor:ZI (match_operand:ZI 1 "register_operand" "0")
7040
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7041 103 dgisselq
+                               (match_operand:ZI 3 "nonmemory_operand" "N"))))
7042 102 dgisselq
+       ]
7043
+       ""
7044
+       "XOR    %3+%2,%0"
7045
+       [(set_attr "ccresult" "set")])
7046
+;(define_insn "addv<mode>4"
7047
+       ;[(set (match_operand:ZI 0 "register_operand" "=r")
7048
+               ;(plus:ZI (match_operand:ZI 1 "register_operand" "%r")
7049
+                       ;(match_operand:ZI 2 "general_operand" "rO")))
7050
+       ;(set (pc) (if_then_else (eq (cc0) (const_int 0))
7051
+                       ;(label_ref (match_operand 3))
7052
+                       ;(pc)))]
7053
+       ;""
7054
+       ;"MOV   %1,%0
7055
+       ;ADD    %2,%0
7056
+       ;BV     %3"
7057
+       ;[(set_attr "predicable" "no") (set_attr "ccresult" "set")])
7058
+;;(define_insn "subvsi4"
7059
+;;     MOV     %1,%0
7060
+;;     SUB     %2,%0
7061
+;;     BV      %3
7062
+;;(mulvsi4)
7063
+;;(define_insn "uaddvsi4"
7064
+;;     ADD     %2,%0
7065
+;;     BC      %3
7066
+;;(define_insn "usubvsi4"
7067
+;;     MOV     %1,%0
7068
+;;     SUB     %2,%0
7069
+;;     BC      %3
7070
+;;
7071
+;; (define_insn "umulvsi4"
7072
+;;     ... ???)
7073
+;;
7074
+(define_insn "ashr<mode>3"
7075
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7076
+               (ashiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
7077 103 dgisselq
+                       (match_operand:ZI 2 "nonmemory_operand" "rR")))]
7078 102 dgisselq
+       ""
7079
+       "ASR    %2,%0"
7080
+       [(set_attr "ccresult" "set")])
7081
+(define_insn "lshr<mode>3"
7082
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7083
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
7084
+                       (match_operand:ZI 2 "register_operand" "rR")))]
7085
+       ""
7086
+       "LSR    %2,%0"
7087
+       [(set_attr "ccresult" "set")])
7088
+(define_insn "rotl<mode>3"
7089
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7090
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
7091 103 dgisselq
+                       (match_operand:ZI 2 "nonmemory_operand" "rR")))]
7092 102 dgisselq
+       ""
7093
+       "ROL    %2,%0"
7094
+       [(set_attr "ccresult" "set")])
7095
+;
7096
+(define_insn "neg<mode>2"
7097
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7098
+               (neg:ZI (match_operand:ZI 1 "register_operand" "r")))
7099
+       ]
7100
+       ""
7101
+       "NEG    %1,%0"
7102
+       [(set_attr "ccresult" "validzn")])
7103
+(define_insn "abs<mode>2"
7104
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7105
+               (abs:ZI (match_operand:ZI 1 "register_operand" "0")))
7106
+       ]
7107
+       ""
7108
+       "TEST   %0
7109
+       NEG.LT  %0"
7110
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7111
+(define_insn "popcount<mode>2"
7112
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7113
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
7114
+       ]
7115
+       ""
7116
+       "POPC   %1,%0"
7117
+       [(set_attr "ccresult" "set")])
7118
+(define_expand "parity<mode>2"
7119
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7120
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
7121
+       (set (match_dup:ZI 0) (and:ZI (match_dup:ZI 0) (const_int -2)))
7122
+       ])
7123
+(define_insn "one_cmpl<mode>2"
7124
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7125
+               (not:ZI (match_operand:ZI 1 "register_operand" "0")))
7126
+       ]
7127
+       ""
7128
+       "XOR    -1,%0"
7129
+       [(set_attr "ccresult" "set")])
7130
+;
7131
+;
7132
+;
7133
+;
7134
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7135
+;;
7136
+;; General arithmetic instructions -- double words
7137
+;;
7138
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7139
+;
7140
+;
7141
+;
7142
+(define_insn "adddi3" ; Fastest/best instruction always goes first
7143
+       [(set (match_operand:DI 0 "register_operand" "=r")
7144 103 dgisselq
+               (plus:DI (match_operand:DI 1 "register_operand" "0")
7145 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
7146
+       ]
7147
+       ""
7148
+       "ADD    %L2,%L0\n\tADD.C\t1,%H0\n\tADD\t%H2,%H0"
7149
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7150
+;
7151
+(define_insn "subdi3"
7152
+       [(set (match_operand:DI 0 "register_operand" "=r")
7153 103 dgisselq
+               (minus:DI (match_operand:DI 1 "register_operand" "0")
7154 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
7155
+       ]
7156
+       ""
7157
+       "SUB    %L2,%L0\n\tSUB.C\t1,%H0\n\tSUB\t%H2,%H0"
7158
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7159
+;
7160
+(define_insn "anddi3"
7161
+       [(set (match_operand:DI 0 "register_operand" "=r")
7162
+               (and:DI (match_operand:DI 1 "register_operand" "%0")
7163
+                       (match_operand:DI 2 "register_operand" "r")))
7164
+       ]
7165
+       ""
7166
+       "AND    %L2,%L0\n\tAND\t%H2,%H0"
7167
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7168
+;
7169
+(define_insn "iordi3"
7170
+       [(set (match_operand:DI 0 "register_operand" "=r")
7171
+               (ior:DI (match_operand:DI 1 "register_operand" "%0")
7172
+                       (match_operand:DI 2 "register_operand" "r")))
7173
+       ]
7174
+       ""
7175
+       "OR     %2,%0\n\tOR\t%H2,%H0"
7176
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7177
+;
7178
+(define_insn "xordi3"
7179
+       [(set (match_operand:DI 0 "register_operand" "=r")
7180
+               (xor:DI (match_operand:DI 1 "register_operand" "%0")
7181
+                       (match_operand:DI 2 "register_operand" "r")))
7182
+       ]
7183
+       ""
7184
+       "XOR    %2,%0\n\tXOR\t%H2,%H0"
7185
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7186
+;
7187
+(define_insn "negdi2"
7188
+       [(set (match_operand:DI 0 "register_operand" "=r")
7189
+               (neg:DI (match_operand:DI 1 "register_operand" "0")))]
7190
+       ""
7191
+       "XOR    -1,%L0\n\tXOR\t-1,%H0\n\tADD\t1,%L0\n\tADD.C\t1,%H0"
7192
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7193
+;
7194
+(define_insn "absdi2"
7195
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7196
+               (abs:ZI (match_operand:ZI 1 "register_operand" "0")))
7197
+       (clobber (match_scratch:SI 2 "=r"))]
7198
+       ""
7199
+       "CLR    %2
7200
+       TEST    %H0             ; Problem, we can't tell conditions
7201
+       LDILO.LT        1,%2
7202
+       XOR.LT  -1,%L0
7203
+       XOR.LT  -1,%H0
7204
+       ADD     %2,%L0
7205
+       ADD.C   %1,%HI"
7206
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7207
+(define_insn "one_cmpldi2"
7208
+       [(set (match_operand:DI 0 "register_operand" "=r")
7209
+               (not:DI (match_operand:DI 1 "register_operand" "0")))
7210
+       ]
7211
+       ""
7212
+       "XOR    -1,%L0\n\tXOR\t-1,%H0"
7213
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7214
+(define_insn "umindi3"
7215
+       [(set (match_operand:DI 0 "register_operand" "=r")
7216
+               (umin:DI (match_operand:DI 1 "register_operand" "%0")
7217
+                       (match_operand:DI 2 "register_operand" "r")))
7218
+       ]
7219
+       ""
7220
+       "CMP    %H0,%H2
7221
+       CMP.Z   %L0,%L2
7222
+       MOV.C   %H2,%H0
7223
+       MOV.C   %L2,%L0"
7224
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7225
+(define_insn "umaxdi3"
7226
+       [(set (match_operand:DI 0 "register_operand" "=r")
7227
+               (umax:DI (match_operand:DI 1 "register_operand" "%0")
7228
+                       (match_operand:DI 2 "register_operand" "r")))
7229
+       ]
7230
+       ""
7231
+       "CMP    %H2,%H0
7232
+       CMP.Z   %L2,%L0
7233
+       MOV.C   %H2,%H0
7234
+       MOV.C   %L2,%L0"
7235
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7236
+(define_insn "popcountdi2"
7237
+       [(set (match_operand:SI 0 "register_operand" "=r")
7238
+               (popcount (match_operand:DI 1 "register_operand" "r")))
7239
+       (clobber (match_scratch:SI 2 "=r"))
7240
+       ]
7241
+       ""
7242
+       "POPC   %L1,%0
7243
+       POPC    %H1,%2
7244
+       ADD     %2,%0"
7245
+       [(set_attr "predicable" "no") (set_attr "ccresult" "set")])
7246
+(define_expand "paritydi2"
7247
+       [(set (match_operand:SI 0 "register_operand" "=r")
7248
+               (popcount (match_operand:DI 1 "register_operand" "r")))
7249
+       (set (match_dup 0) (and:SI (match_dup 0) (const_int -2)))
7250
+       ])
7251
+;
7252
+; Still missing DI instructions for smin:DI, smax:DI, movdicc, adddicc,
7253
+;      mult:di, div:di, divu:di
7254
+;
7255
+;
7256
+;
7257
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7258
+;;
7259
+;; Conditional arithmetic instructions
7260
+;;
7261
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7262
+;
7263
+;
7264
+;
7265
+;
7266
+(define_expand "cstore<mode>4" ; Store 0 or 1 in %0 based on cmp between %2&%3
7267
+       [(set (cc0) (compare (match_operand:ZI 2 "register_operand" "r")
7268
+               (match_operand:ZI 3 "nonmemory_operand" "rO")))
7269
+       (set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
7270
+                       (match_operator 1 "ordered_comparison_operator"
7271
+                                       [(cc0) (const_int 0)])
7272
+                       (const_int 1) (const_int 0)))]
7273
+       ""
7274
+       )
7275
+(define_insn "cstoredi4" ; Store 0 or 1 in %0 based on cmp between %2&%3
7276
+       [(set (match_operand:SI 0 "register_operand" "=r")
7277
+               (if_then_else:SI (match_operator 1 "ordered_comparison_operator"
7278
+                       [(compare (match_operand:DI 2 "register_operand" "r")
7279
+                               (match_operand:DI 3 "register_operand" "r"))])
7280
+                       (const_int 1) (const_int 0)))]
7281
+       ""
7282
+       {
7283
+               switch(GET_CODE(operands[1])) {
7284
+               case EQ:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.Z\t1,%0\n";
7285
+               case NE:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.NZ\t%L3,%L2\n\tLDILO.NZ\t1,%0\n";
7286
+               case LTU:       return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.C\t1,%0\n";
7287
+               case LEU:       return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.C\t1,%0\n\tLDILO.Z\t1,%0\n";
7288
+               case GTU:       return "CLR\t%0\n\tCMP\t%H2,%H3\n\tCMP.Z\t%L2,%L3\n\tLDILO.C\t1,%0\n";
7289
+               case GEU:       return "CLR\t%0\n\tCMP\t%H2,%H3\n\tCMP.Z\t%L2,%L3\n\tLDILO.C\t1,%0\n\tLDILO.Z\t1,%0\n";
7290
+               default:
7291
+                       gcc_unreachable();
7292
+               }
7293
+       }
7294
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7295
+;
7296
+;
7297
+;
7298
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7299
+;;
7300
+;; Comparison instructions, both compare and test
7301
+;;
7302
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7303
+;
7304
+;
7305
+;
7306
+;; This will only work so well, since the direction of the compare is
7307
+;; important in unsigned compares.
7308
+;;
7309
+(define_insn "cmp<mode>"
7310
+       [(set (cc0) (compare (match_operand:ZI 0 "register_operand" "r")
7311
+               (match_operand:ZI 1 "nonmemory_operand" "rO")))]
7312
+       ""
7313
+       "CMP\t%1,%0"
7314
+       [(set_attr "ccresult" "set")])
7315
+(define_insn "cmp<mode>_off"
7316
+       [(set (cc0) (compare (match_operand:ZI 0 "register_operand" "r")
7317
+               (plus:ZI (match_operand:ZI 1 "register_operand" "r")
7318
+                       (match_operand:ZI 2 "const_int_operand" "N"))))]
7319
+       ""
7320
+       "CMP\t%2+%1,%0"
7321
+       [(set_attr "ccresult" "set")])
7322
+(define_insn "test<mode>"
7323
+       [(set (cc0) (compare (and:ZI (match_operand:ZI 0 "register_operand" "r")
7324
+                               (match_operand:ZI 1 "nonmemory_operand" "rO"))
7325
+                       (const_int 0)))]
7326
+       ""
7327
+       "TEST   %1,%0"
7328
+       [(set_attr "ccresult" "set")])
7329
+(define_insn "test<mode>_off"
7330
+       [(set (cc0) (compare (and:ZI (match_operand:ZI 0 "register_operand" "r")
7331
+                               (plus:ZI
7332
+                                 (match_operand:ZI 1 "register_operand" "r")
7333
+                                 (match_operand:ZI 2 "const_int_operand" "N")))
7334
+                       (const_int 0)))]
7335
+       ""
7336
+       "TEST   %2+%1,%0"
7337
+       [(set_attr "ccresult" "set")])
7338
+(define_insn "nop"
7339
+       [(const_int 0)]
7340
+       ""
7341
+       "NOOP"
7342
+       [(set_attr "ccresult" "unchanged")])
7343
+;
7344
+;
7345
+;
7346
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7347
+;;
7348
+;; Conditional execution predicates
7349
+;;
7350
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7351
+;
7352
+; Sadly, these aren't complete like they should be.  Although these are all of
7353
+; the conditional execution prefixes that the Zip CPU supports, GCC looks for
7354
+; other conditions then these.  That is, (cond_exec ...) is not as well
7355
+; recognized as (if_then_else ...).  So we have to duplicate things to support
7356
+; both methods.
7357
+;
7358
+(define_cond_exec
7359
+       [(ne (cc0) (const_int 0))]
7360
+       ""
7361
+       "(NZ)"
7362
+       [(set_attr "conditional" "yes")])
7363
+(define_cond_exec
7364
+       [(lt (cc0) (const_int 0))]
7365
+       ""
7366
+       "(LT)"
7367
+       [(set_attr "conditional" "yes")])
7368
+(define_cond_exec
7369
+       [(eq (cc0) (const_int 0))]
7370
+       ""
7371
+       "(Z)"
7372
+       [(set_attr "conditional" "yes")])
7373
+(define_cond_exec
7374
+       [(gt (cc0) (const_int 0))]
7375
+       ""
7376
+       "(GT)"
7377
+       [(set_attr "conditional" "yes")])
7378
+(define_cond_exec
7379
+       [(ge (cc0) (const_int 0))]
7380
+       ""
7381
+       "(GE)"
7382
+       [(set_attr "conditional" "yes")])
7383
+(define_cond_exec
7384
+       [(ltu (cc0) (const_int 0))]
7385
+       ""
7386
+       "(C)"
7387
+       [(set_attr "conditional" "yes")])
7388
+;
7389
+;
7390
+;
7391
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7392
+;;
7393
+;; Conditional move instructions, since these won't accept conditional
7394
+;;     execution RTL
7395
+;;
7396
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7397
+;
7398
+; // Look for #define HAVE_conditional_move to understand how these might be
7399
+; // used.
7400
+;
7401
+(define_insn "set_zero_or_one<mode>"
7402
+       [(set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
7403
+                       (match_operator 1 "ordered_comparison_operator"
7404
+                                       [(cc0) (const_int 0)])
7405
+                       (const_int 1) (const_int 0)))]
7406
+       ""
7407
+       { return (zip_set_zero_or_one(operands[1], operands[0]));
7408
+       }
7409
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7410
+(define_insn "mov<mode>cc"
7411
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7412
+               (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
7413
+                       [(cc0) (const_int 0)])
7414
+                       (match_operand:ZI 2 "general_operand" "rio")
7415
+                       (match_operand:ZI 3 "nonmemory_operand" "rio")))]
7416
+       ""
7417
+       {
7418
+       return zip_movsicc(operands[0], operands[1], operands[2], operands[3]);
7419
+       }
7420
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7421
+(define_insn "add<mode>cc"
7422
+       [(set (match_operand:ZI 0 "register_operand" "=r,r")
7423
+               (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
7424
+                       [(cc0) (const_int 0)])
7425
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "0,r")
7426
+                               (match_operand:ZI 3 "nonmemory_operand" "rO,M"))
7427
+                       (match_dup 0)))]
7428
+       ""
7429
+       {
7430
+       return zip_addsicc(operands[0], operands[1], operands[2], operands[3]);
7431
+       }
7432
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7433
+;
7434
+;
7435
+;(define_expand "mov<mode>cc"
7436
+;      [(set (match_operand:ZI 0 "general_operand" "=rm,rm,r,r,r"
7437
+;              (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
7438
+;                      [(cc0) (const_int 0)])
7439
+;                      (match_operand:ZI 2 "general_operand" "0,r,0,m,rm")
7440
+;                      (match_operand:ZI 3 "general_operand" "r,0,m,0,rm"))))]
7441
+;      )
7442
+;
7443
+;
7444
+;
7445
+; While an interesting approach, the following suffers from problems when the
7446
+; move amount is constant.  At anything less than four, moves should not require
7447
+; the movmemSI instruction.  At anything greater, if constant, the initial tests
7448
+; are not required and should result in a hardcoded result.  Practically,
7449
+; though, this should really be a define_expand instruction, calling on the
7450
+; RTX's of all the respective subinstructions found below.
7451
+;
7452
+;(define_insn "movmemSI"
7453
+;      [(parallel [(set (mem:BLK (match_operand 0 "register_operand" "+r"));Dst
7454
+;                      (mem:BLK (match_operand 1 "register_operand" "+r")));Src
7455
+;              (use (match_operand:SI 2 "register_operand" "+r"))]); Length
7456
+;              (match_operand 3 "" "")                 ;Alignment
7457
+;              (clobber (match_scratch:SI 4 "=r"))
7458
+;              (clobber (match_scratch:SI 5 "=r"))
7459
+;              (clobber (match_scratch:SI 6 "=r"))
7460
+;              (clobber (match_scratch:SI 7 "=r"))]
7461
+;      ""
7462
+;      "TEST\t1,%2
7463
+;      LOD.NZ\t%1,%4
7464
+;      STO.NZ\t%4,%0
7465
+;      ADD.NZ\t1,%0
7466
+;      ADD.NZ\t1,%1
7467
+;      TEST\t2,%2
7468
+;      LOD.NZ\t%1,%4
7469
+;      LOD.NZ\t1(%1),%5
7470
+;      STO.NZ\t%4,(%0)
7471
+;      STO.NZ\t%4,1(%0)
7472
+;      ADD.NZ\t2,%0
7473
+;      ADD.NZ\t2,%1
7474
+;      AND\t-4,%2
7475
+;      BZ\t.Lskp%=\n.Ltop%=:
7476
+;      LOD\t(%1),%4
7477
+;      LOD\t1(%1),%5
7478
+;      LOD\t2(%1,%6
7479
+;      LOD\t3(%1),%7
7480
+;      STO\t%4,(%1)
7481
+;      STO\t%5,1(%1)
7482
+;      STO\t%6,2(%1)
7483
+;      STO\t%7,3(%1)
7484
+;      SUB\t4,%2
7485
+;      BZ\t%.Lskp%=
7486
+;      BRA\t.Ltop%=\n.Lskp%=:"
7487
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7488
+;(define_insn "setmemsi"
7489
+;      [(parallel
7490
+;              [(set (mem:BLK
7491
+;                      (match_operand 0 "register_operand" "+r")); Destination
7492
+;                      (match_operand:SI 2 "register_operand" "r")) ; Source
7493
+;              (use (match_operand:SI 1 "register_operand" "+r"))])  ; Length
7494
+;              (match_operand 3 "" "")]
7495
+;      ""
7496
+;      "TEST\t1,%1
7497
+;      STO.NZ\t%2,(%0)
7498
+;      ADD.NZ\t1,%0
7499
+;      TEST\t2,%1
7500
+;      STO.NZ\t%2,(%0)
7501
+;      STO.NZ\t%2,1(%0)
7502
+;      ADD.NZ\t2,%0
7503
+;      AND\t-4,%1
7504
+;      BZ\t.Lskp%=\n.Ltop%=:\n
7505
+;      STO\t%2,(%0)
7506
+;      STO\t%2,1(%0)
7507
+;      STO\t%2,2(%0)
7508
+;      STO\t%2,3(%0)
7509
+;      SUB\t%4,%0
7510
+;      BZ\t.Lskp%=
7511
+;      BRA\t.Ltop%=\n.Lskp%=:"
7512
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7513
+;;
7514
+;
7515
+;
7516
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7517
+;;
7518
+;; Control flow instructions
7519
+;;
7520
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7521
+;
7522
+;
7523
+;
7524
+(define_expand "jump"
7525
+       [(set (pc)
7526
+               (label_ref (match_operand 0 "" "")))]); // Was general-op, "mro"
7527
+(define_insn "jump_const"      ; Must be modeless, VOIDmode, not SI or any othr
7528
+       [(set (pc)      ; Otherwise it won't accept jumps to labels
7529
+               (match_operand:SI 0 "zip_const_address_operand_p" ""))]
7530
+       ""
7531
+       "BRA    %0"
7532
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7533
+(define_insn "jump_label"      ; Must be modeless, VOIDmode, not SI or any othr
7534
+       [(set (pc)      ; Otherwise it won't accept jumps to labels
7535
+               (label_ref (match_operand 0 "" "")))]
7536
+       ""
7537
+       "BRA    %0"
7538
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7539
+;
7540
+; This is really the same thing as an indirect jump ... the big difference
7541
+; is that the zip_address_operand_p checks for an "N" type condition, not an
7542
+; "M" type condition ... a bug, but one that works for now.  (The assembler
7543
+; should be able to catch and except on it ...)
7544
+;
7545
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
7546
+(define_insn "jump_variable"
7547
+       [(set (pc)
7548
+               (match_operand:SI 0 "zip_address_operand_p" ""))]
7549
+       ""
7550
+       "JMP    %0"
7551
+       [(set_attr "ccresult" "unchanged")])
7552
+;
7553
+; Indirect jumps ... both to registers, and registers plus offsets
7554
+;
7555
+(define_insn "indirect_jump"
7556
+       [(set (pc)
7557
+               (match_operand:SI 0 "register_operand" "r"))]
7558
+       ""
7559
+       "JMP    %0"
7560
+       [(set_attr "ccresult" "unchanged")])
7561
+(define_insn "indirect_jump_mem"
7562
+       [(set (pc) (match_operand:SI 0 "zip_memory_operand_p" "o"))]
7563
+       ""
7564
+       "LOD    %0,PC"
7565
+       [(set_attr "ccresult" "unchanged")])
7566
+(define_insn "indirect_jump_off"
7567
+       [(set (pc)
7568
+               (plus:SI (match_operand:SI 0 "register_operand" "r")
7569
+                       (match_operand:SI 1 "const_int_operand" "M")))]
7570
+       ""
7571
+       "JMP    %1(%0)"
7572
+       [(set_attr "ccresult" "unchanged")])
7573
+;;
7574
+; cbranchsi4
7575
+;;     Op 0 = the comparison operator (le,lt,eq,ne,gt,ge,and usgn ltu,geu,etc.)
7576
+;;     Op 1&2 the operands of the compare instruction
7577
+;;     Op 3 is the jump label
7578
+;;
7579
+;;
7580
+;; #warning Need to adjust this so that the "LT" code doesnt get generated ...
7581
+;;
7582
+(define_expand "cbranch<mode>4"
7583
+       [(set (cc0) (compare (match_operand:ZI 1 "register_operand" "r")
7584
+               (match_operand:ZI 2 "nonmemory_operand" "rO")))
7585
+       (set (pc) (if_then_else (match_operator 0 "ordered_comparison_operator"
7586
+                       [(cc0) (const_int 0)])
7587
+                       (label_ref (match_operand 3 "" ""))
7588
+                       (pc)))]
7589
+       ""
7590
+       {
7591
+               // extern void zip_debug_rtx(const_rtx);
7592
+               //; Two branches give us no end of difficulty when implementing.
7593
+               //; Let's check for these two branch codes, and swap the
7594
+               //; comparison to simplify them.
7595
+               // fprintf(stderr, "CBRANCH\n");
7596
+               // zip_debug_rtx(operands[0]);
7597
+               // zip_debug_rtx(operands[1]);
7598
+               // zip_debug_rtx(operands[2]);
7599
+               // zip_debug_rtx(operands[3]);
7600
+               if ((GET_CODE(operands[0])==GTU)&&(REG_P(operands[2]))) {
7601
+                       // fprintf(stderr, "CBRANCH:(GTU,?,REG,?)\n");
7602
+                       emit_insn(gen_rtx_SET(VOIDmode, cc0_rtx,
7603
+                               gen_rtx_COMPARE(VOIDmode, operands[2], operands[1])));
7604
+                       emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
7605
+                       DONE;
7606
+               } else if((GET_CODE(operands[0])==GEU)&&(REG_P(operands[2]))) {
7607 103 dgisselq
+                       // fprintf(stderr, "CBRANCH:(GEU,?,REG,?)\n");
7608 102 dgisselq
+                       emit_insn(gen_rtx_SET(VOIDmode, cc0_rtx,
7609
+                               gen_rtx_COMPARE(VOIDmode, operands[2], operands[1])));
7610
+                       emit_jump_insn(gen_cbranch_jmp_leu(operands[3]));
7611
+                       DONE;
7612
+               } // ; Otherwise ... just handle the branch normally
7613
+
7614
+               //; Except ... we can do better for some instructions, such as
7615
+               //; LE.  While we could exchange CMP Rx,Ry into -1(Rx),Ry, it
7616
+               //; would be difficult to explain to users why MIN_INT didn't
7617
+               //; compare properly.  Hence we only adjust constant integers.
7618
+               //;
7619
+               if ((GET_CODE(operands[0])==LE)
7620
+                               &&(CONST_INT_P(operands[2]))
7621
+                               &&(INTVAL(operands[2])>(1<<17)-2)) {
7622
+                       // fprintf(stderr, "CBRANCH:(LE,?,#,?)\n");
7623
+                       emit_insn(gen_rtx_SET(VOIDmode, cc0_rtx,
7624
+                               gen_rtx_COMPARE(VOIDmode, operands[1],
7625
+                                       GEN_INT(INTVAL(operands[2])+1))));
7626
+                       emit_insn(gen_cbranch_jmp_lt(operands[3]));
7627
+                       DONE;
7628
+               } else if ((GET_CODE(operands[0])==LEU)
7629
+                               &&(CONST_INT_P(operands[2]))
7630
+                               &&(INTVAL(operands[2])<(1<<17)-2)) {
7631
+                       // fprintf(stderr, "CBRANCH:(LEU,?,#,?)\n");
7632
+                       emit_insn(gen_rtx_SET(VOIDmode, cc0_rtx,
7633
+                               gen_rtx_COMPARE(VOIDmode, operands[1],
7634
+                                       GEN_INT(INTVAL(operands[2])+1))));
7635
+                       emit_insn(gen_cbranch_jmp_ltu(operands[3]));
7636
+                       DONE;
7637
+               }
7638
+       })
7639
+(define_insn "cbranch_jmp_eq"
7640
+       [(set (pc) (if_then_else (eq (cc0) (const_int 0))
7641
+                (label_ref (match_operand 0 "" ""))
7642
+                (pc)))]
7643
+       ""
7644
+       "BZ\t%0"
7645
+       [(set_attr "predicable" "no")
7646
+               (set_attr "conditional" "yes")
7647
+               (set_attr "ccresult" "unchanged")])
7648
+(define_insn "cbranch_jmp_neq"
7649
+       [(set (pc) (if_then_else (ne (cc0) (const_int 0))
7650
+                (label_ref (match_operand 0 "" ""))
7651
+                (pc)))]
7652
+       ""
7653
+       "BNZ\t%0"
7654
+       [(set_attr "predicable" "no")
7655
+               (set_attr "conditional" "yes")
7656
+               (set_attr "ccresult" "unchanged")])
7657
+(define_insn "cbranch_jmp_lt"
7658
+       [(set (pc) (if_then_else (lt (cc0) (const_int 0))
7659
+                (label_ref (match_operand 0 "" ""))
7660
+                (pc)))]
7661
+       ""
7662
+       "BLT\t%0"
7663
+       [(set_attr "predicable" "no")
7664
+               (set_attr "conditional" "yes")
7665
+               (set_attr "ccresult" "unchanged")])
7666
+(define_insn "cbranch_jmp_le"
7667
+       [(set (pc) (if_then_else (le (cc0) (const_int 0))
7668
+                (label_ref (match_operand 0 "" ""))
7669
+                (pc)))]
7670
+       ""
7671
+       "BLT\t%0
7672
+       BZ\t%0"
7673
+       [(set_attr "predicable" "no")
7674
+               (set_attr "conditional" "yes")
7675
+               (set_attr "ccresult" "unchanged")])
7676
+(define_insn "cbranch_jmp_gt"
7677
+       [(set (pc) (if_then_else (gt (cc0) (const_int 0))
7678
+                (label_ref (match_operand 0 "" ""))
7679
+                (pc)))]
7680
+       ""
7681
+       "BGT\t%0"
7682
+       [(set_attr "predicable" "no")
7683
+               (set_attr "conditional" "yes")
7684
+               (set_attr "ccresult" "unchanged")])
7685
+(define_insn "cbranch_jmp_ge"
7686
+       [(set (pc) (if_then_else (ge (cc0) (const_int 0))
7687
+                (label_ref (match_operand 0 "" ""))
7688
+                (pc)))]
7689
+       ""
7690
+       "BGE\t%0"
7691
+       [(set_attr "predicable" "no")
7692
+               (set_attr "conditional" "yes")
7693
+               (set_attr "ccresult" "unchanged")])
7694
+(define_insn "cbranch_jmp_ltu"
7695
+       [(set (pc) (if_then_else (ltu (cc0) (const_int 0))
7696
+                (label_ref (match_operand 0 "" ""))
7697
+                (pc)))]
7698
+       ""
7699
+       "BC\t%0"
7700
+       [(set_attr "predicable" "no")
7701
+               (set_attr "conditional" "yes")
7702
+               (set_attr "ccresult" "unchanged")])
7703
+(define_insn "cbranch_jmp_gtu"
7704
+       [(set (pc) (if_then_else (gtu (cc0) (const_int 0))
7705
+                (label_ref (match_operand 0 "" ""))
7706
+                (pc)))]
7707
+       ""      ; Flip the condition, and then we can jump
7708
+       "XOR\t2,CC
7709
+       BC\t%0"
7710
+       [(set_attr "predicable" "no")
7711
+               (set_attr "conditional" "yes")
7712
+               (set_attr "ccresult" "unknown")])
7713
+(define_insn "cbranch_jmp_leu"
7714
+       [(set (pc) (if_then_else (leu (cc0) (const_int 0))
7715
+                (label_ref (match_operand 0 "" ""))
7716
+                (pc)))]
7717
+       ""      ; Need to check for both LTU (i.e. C) and Z
7718
+       "BC\t%0
7719
+       BZ\t%0"
7720
+       [(set_attr "predicable" "no")
7721
+               (set_attr "conditional" "yes")
7722
+               (set_attr "ccresult" "unchanged")])
7723
+(define_insn "cbranch_jmp_geu"
7724
+       [(set (pc) (if_then_else (geu (cc0) (const_int 0))
7725
+                (label_ref (match_operand 0 "" ""))
7726
+                (pc)))]
7727
+       ""      ; Flip the comparison, then check for GEU (once flipped)a
7728
+               ; Z is naturally checked for, as C would've never been set on Z
7729
+               ; so by flipping it, it is tantamount to saying Z or GTU.
7730
+       "BZ\t%0
7731
+       XOR\t2,CC
7732
+       BC\t%0"
7733
+       [(set_attr "predicable" "no")
7734
+               (set_attr "conditional" "yes")
7735
+               (set_attr "ccresult" "unknown")])
7736
+(define_insn "cbranchdi4"
7737
+       [(set (pc) (if_then_else
7738
+               (match_operator 0 "ordered_comparison_operator"
7739
+                       [(match_operand:DI 1 "register_operand" "r")
7740
+                               (match_operand:DI 2 "nonmemory_operand" "rO")])
7741
+                       (label_ref (match_operand 3 "" ""))
7742
+                       (pc)))
7743
+       (clobber (cc0))]
7744
+       ""
7745
+       {
7746
+               switch(GET_CODE(operands[0])) {
7747
+               case EQ:
7748
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBZ\t%3";
7749
+               case NE:
7750
+                       return "CMP\t%H2,%H1\n\tCMP.NZ\t%L2,%L1\n\tBNZ\t%3";
7751
+               case LE:
7752
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
7753
+               case GT:
7754
+                       return "CMP\t%H1,%H2\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L1,%L2\n\tBC\t%3\n.Ldi%=:";
7755
+               case LT:
7756
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L2,%L1\n\tBC\t%3\n.Ldi%=:";
7757
+               case GE:
7758
+                       return "CMP\t%H1,%H2\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L1,%L2\n\tBC\t%3\nBZ\t%3\n.Ldi%=:";
7759
+               case LTU:
7760
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n";
7761
+               case LEU:
7762
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
7763
+               case GTU:
7764
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\n";
7765
+               case GEU:
7766
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\nBZ\t%3";
7767
+               default:
7768
+                       gcc_unreachable();
7769
+               }
7770
+       }
7771
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7772
+;
7773
+;
7774
+;
7775
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7776
+;;
7777
+;; Subroutine call
7778
+;;
7779
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7780
+;
7781
+;
7782
+; There are two types of calls: "call" and "call_value".
7783
+;
7784
+; Each of these types of calls are then expanded into one of:
7785
+;
7786
+;      _const          - A call to a constant address, such as a symbol
7787
+;                      reference or a fixed location
7788
+;
7789
+;      _label          - This should be the same as _const, except that for
7790
+;                      some reason the RTL and matching rules are separate.
7791
+;                      Hence we have a separate rule for this.
7792
+;
7793
+;      _mem            - The memory address we wish to jump to is stored in
7794
+;                      memory somewhere, and we have only a pointer.  In this
7795
+;                      case, we load that pointer straight to the PC and go.
7796
+;
7797
+;      _var            - The address to jump to is given as an offset to a
7798
+;                      register, such as X+R3.  This is an indirect jump.
7799
+;                      Although we support it, it does require different RTL
7800
+;                      code.
7801
+;
7802
+(define_expand "call"
7803
+       [(call (match_operand 0 "" "")
7804
+               (match_operand 1 "" ""))]
7805
+       ""
7806
+       {
7807
+               if (MEM_P(operands[0])) {
7808
+                       // This should always be the case
7809
+                       rtx addr = XEXP(operands[0],0);
7810
+                       if (zip_const_address_operand_p(addr, SImode)) {
7811
+                               // fprintf(stderr, "Generating gen_void_call_const()\n");
7812
+                               emit_call_insn(gen_void_call_const(addr,
7813
+                                               operands[1]));
7814
+                       } else if ((MEM_P(addr))&&(zip_address_operand(
7815
+                                                       XEXP(addr,0)))) {
7816
+                               emit_call_insn(gen_void_call_mem(XEXP(addr,0),
7817
+                                                                operands[1]));
7818
+                       } else {
7819
+                               emit_call_insn(gen_void_call_var(addr,
7820
+                                                                operands[1]));
7821
+                       }
7822
+                       DONE;
7823
+               }
7824
+       })
7825
+;
7826
+;
7827
+;
7828
+; How do we want to do this better?
7829
+;      Replace the RTL w/
7830
+;              return_label= gen_label_rtx();
7831
+;              emit_movsi(gen_rtx_REG(zip_R0),plus_constant(
7832
+;                      gen_rtx_REG(zip_PC),return_label));
7833
+;              emit_jump(label_rtx(
7834
+;
7835
+;              emit_label(return_label);
7836
+;
7837
+; The problem is: we can't!  GCC distinguishes between jumps and calls when
7838
+; optimizing, and it doesn't see the need to keep the label around.  Thus, the
7839
+; label gets removed and the call gets lost.  Hence we do it this way (below).
7840
+; I'll probably bastardize a means of getting a new codelabel that GCC doesn't
7841
+; recognize as such, but for now we'll use .Lcall# as our label.
7842
+;
7843
+(define_insn "void_call_const"
7844
+       [(parallel [(call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
7845
+                       (match_operand 1 "" ""))
7846
+               (clobber (reg:SI RTN_REG))])]
7847
+       ""
7848
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
7849
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7850
+;(define_insn "void_call_label"
7851
+;      [(parallel [(call (mem:SI (label_ref (match_operand 0 "" "")))
7852
+;                      (match_operand 1 "" ""))
7853
+;              (clobber (reg:SI RTN_REG))])]
7854
+;      ""
7855
+;      "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
7856
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7857
+(define_insn "void_call_mem"
7858
+       [(parallel [(call (mem:SI (mem:SI (match_operand:SI 0 "zip_address_operand_p" "")))
7859
+                       (match_operand 1 "" ""))
7860
+               (clobber (reg:SI RTN_REG))])]
7861
+       ""
7862
+       "MOV    .Lcall%=(PC),R0\;LOD\t%0,PC\n.Lcall%=:"
7863
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7864
+;
7865
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
7866
+(define_insn "void_call_var"
7867
+       [(parallel [(call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
7868
+                       (match_operand 1 "" ""))
7869
+               (clobber (reg:SI RTN_REG))])]
7870
+       ""
7871
+       "MOV    .Lcall%=(PC),R0\;JMP\t%0\n.Lcall%=:"
7872
+       ; emit_move_insn(??)
7873
+       ;       emit_jump(where);
7874
+       ;       emit_label(return_address);
7875
+       ;
7876
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7877
+(define_expand "call_value"
7878
+       [(set (reg:SI RTNV_REG)
7879
+               (call (match_operand:SI 1 "" "")
7880
+                       (match_operand 2 "" "")))
7881
+       (set (match_operand:SI 0 "register_operand" "=r") (reg:SI RTNV_REG))]
7882
+       ""
7883
+       {
7884
+               // extern void zip_debug_rtx(const_rtx);
7885
+               // fprintf(stderr, "ZIP.MD::CALL-VALUE()\n");
7886
+               // zip_debug_rtx(operands[1]);
7887
+               if (MEM_P(operands[1])) {
7888
+                       // fprintf(stderr, "ZIP.MD::CALL-VALUE() MEM_P\n");
7889
+                       // zip_debug_rtx(operands[1]);
7890
+                       // This should always be the case
7891
+                       rtx addr = XEXP(operands[1],0);
7892
+                       if (zip_const_address_operand_p(addr, SImode)) {
7893
+                               // fprintf(stderr, "Generating gen_reg_call_const()\n");
7894
+                               emit_call_insn(gen_reg_call_const(addr, operands[2]));
7895
+                       } else if ((MEM_P(addr))&&(zip_address_operand(XEXP(addr,0)))) {
7896
+                               // fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
7897
+                               emit_call_insn(gen_reg_call_mem(XEXP(addr,0), operands[2]));
7898
+                       } else {
7899
+                               // fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
7900
+                               emit_call_insn(gen_reg_call_var(addr, operands[2]));
7901
+                       }
7902
+                       DONE;
7903
+               }
7904
+       })
7905
+(define_insn "reg_call_const"
7906
+       [(parallel [(set (reg:SI RTNV_REG)
7907
+               (call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
7908
+                       (match_operand 1 "" "")))
7909
+               (clobber (reg:SI RTN_REG))])]
7910
+       ""
7911
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
7912
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7913
+;(define_insn "reg_call_label"
7914
+;      [(parallel [(set (reg:SI RTNV_REG)
7915
+;              (call (mem:SI (match_operand 0 "" ""))
7916
+;                      (match_operand 1 "" "")))
7917
+;              (clobber (reg:SI RTN_REG))])]
7918
+;      ""
7919
+;      "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
7920
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7921
+(define_insn "reg_call_mem"
7922
+       [(set (reg:SI RTNV_REG)
7923
+               (call (mem:SI (mem:SI (match_operand:SI 0 "zip_address_operand_p" "")))
7924
+                       (match_operand 1 "" "")))
7925
+               (clobber (reg:SI RTN_REG))]
7926
+       ""
7927
+       "MOV    .Lcall%=(PC),R0\;LOD\t%0,PC\n.Lcall%=:" ; emit_label(return_lbl);
7928
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7929
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
7930
+(define_insn "reg_call_var"
7931
+       [(parallel [(set (reg:SI RTNV_REG)
7932
+               (call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
7933
+                       (match_operand 1 "" "")))
7934
+               (clobber (reg:SI RTN_REG))])]
7935
+       ""
7936
+       "MOV    .Lcall%=(PC),R0\;JMP\t%0\n.Lcall%=:"
7937
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7938
+;
7939
+;
7940
+;
7941
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7942
+;;
7943
+;; Frame manipulation RTX
7944
+;;
7945
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7946
+;
7947
+;
7948
+;
7949
+(define_expand "prologue"
7950
+       [(const_int 0)]
7951
+       ""
7952
+       "{ zip_expand_prologue(); DONE; }")
7953
+(define_expand "epilogue"
7954
+       [(return)]
7955
+       ""
7956
+       "{ zip_expand_epilogue(); DONE; }")
7957
+(define_expand "return" ; In order to use the function predicate, this *must*
7958
+       [(return)]      ; be a define_expand
7959
+       "zip_use_return_insn()")
7960
+       ; "JMP  R0"
7961
+       ; [(set_attr "ccresult" "unchanged")])
7962
+(define_insn "*return" ; A "*" -- means it cannot be called from C
7963
+       [(return)]
7964
+       ""
7965
+       "JMP    R0"
7966
+       [(set_attr "ccresult" "unchanged")])
7967
+(define_insn "simple_return"   ; A "*" -- means it cannot be called from C
7968
+       [(simple_return)]
7969
+       ""
7970
+       "JMP    R0"
7971
+       [(set_attr "ccresult" "unchanged")])
7972
+;
7973
+;
7974
+;
7975
+;;;;;;;;;;;;;;;;;;;;;;;;;;
7976
+;;
7977
+;; Zip Builtin Functions
7978
+;;
7979
+;;;;;;;;;;;;;;;;;;;;;;;;;;
7980
+;
7981
+;
7982
+;
7983
+(define_insn "zip_rtu"
7984
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_RTU)
7985
+       (clobber (cc0))]
7986
+       "(!ZIP_USER)"
7987
+       "RTU"
7988
+       [(set_attr "ccresult" "unknown")])
7989
+(define_insn "zip_halt" ; Needs to be unspec_volatile, or optimizer will opt out
7990
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_HALT)
7991
+       (clobber (cc0))]
7992
+       "(!ZIP_USER)"
7993
+       "HALT"
7994
+       [(set_attr "ccresult" "unknown")])
7995
+(define_insn "zip_idle"
7996
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_IDLE)
7997
+       (clobber (cc0))]
7998
+       ""
7999
+       "WAIT"
8000
+       [(set_attr "ccresult" "unknown")])
8001
+(define_insn "zip_syscall"
8002
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_SYSCALL)]
8003
+       ""
8004
+       "CLR\tCC"
8005
+       [(set_attr "ccresult" "unknown")])
8006
+;
8007
+;
8008
+; Operator "save_context"
8009
+;
8010
+;      operand 0 missing output reload ... ?
8011
+;
8012
+(define_insn "zip_save_context"
8013
+       [(parallel [
8014
+               (unspec_volatile
8015
+                       [ (match_operand:SI 0 "register_operand" "r") ]
8016
+                       UNSPEC_SAVE_CONTEXT)
8017
+               (clobber (match_scratch:SI 1 "=r"))
8018
+               (clobber (match_scratch:SI 2 "=r"))
8019
+               (clobber (match_scratch:SI 3 "=r"))
8020
+               (clobber (match_scratch:SI 4 "=r"))
8021
+               (use (match_dup 0))])]
8022
+       "(!ZIP_USER)"
8023
+       "MOV\tuR0,%1
8024
+       MOV\tuR1,%2
8025
+       MOV\tuR2,%3
8026
+       MOV\tuR3,%4
8027
+       STO\t%1,%0
8028
+       STO\t%2,1(%0)
8029
+       STO\t%3,2(%0)
8030
+       STO\t%4,3(%0)
8031
+       MOV\tuR4,%1
8032
+       MOV\tuR5,%2
8033
+       MOV\tuR6,%3
8034
+       MOV\tuR7,%4
8035
+       STO\t%1,4(%0)
8036
+       STO\t%2,5(%0)
8037
+       STO\t%3,6(%0)
8038
+       STO\t%4,7(%0)
8039
+       MOV\tuR8,%1
8040
+       MOV\tuR9,%2
8041
+       MOV\tuR10,%3
8042
+       MOV\tuR11,%4
8043
+       STO\t%1,8(%0)
8044
+       STO\t%2,9(%0)
8045
+       STO\t%3,10(%0)
8046
+       STO\t%4,11(%0)
8047
+       MOV\tuR12,%1
8048
+       MOV\tuSP,%2
8049
+       MOV\tuCC,%3
8050
+       MOV\tuPC,%4
8051
+       STO\t%1,12(%0)
8052
+       STO\t%2,13(%0)
8053
+       STO\t%3,14(%0)
8054
+       STO\t%4,15(%0)"
8055
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8056
+(define_insn "zip_restore_context"
8057
+       [(unspec_volatile [
8058
+               (match_operand:SI 0 "register_operand" "r")] UNSPEC_RESTORE_CONTEXT)
8059
+               ; (match_scratch:SI 1 "r")
8060
+               ; (match_scratch:SI 2 "r")
8061
+               ; (match_scratch:SI 3 "r")
8062
+               ; (match_scratch:SI 4 "r")] 6)
8063
+       (clobber (match_scratch:SI 1 "=r"))
8064
+       (clobber (match_scratch:SI 2 "=r"))
8065
+       (clobber (match_scratch:SI 3 "=r"))
8066
+       (clobber (match_scratch:SI 4 "=r"))
8067
+       (use (match_dup 0))]
8068
+       "(!ZIP_USER)"
8069
+       "LOD\t0(%0),%1
8070
+       LOD\t1(%0),%2
8071
+       LOD\t2(%0),%3
8072
+       LOD\t3(%0),%4
8073
+       MOV\t%1,uR0
8074
+       MOV\t%2,uR1
8075
+       MOV\t%3,uR2
8076
+       MOV\t%4,uR3
8077
+       LOD\t4(%0),%1
8078
+       LOD\t5(%0),%2
8079
+       LOD\t6(%0),%3
8080
+       LOD\t7(%0),%4
8081
+       MOV\t%1,uR4
8082
+       MOV\t%2,uR5
8083
+       MOV\t%3,uR6
8084
+       MOV\t%4,uR7
8085
+       LOD\t8(%0),%1
8086
+       LOD\t9(%0),%2
8087
+       LOD\t10(%0),%3
8088
+       LOD\t11(%0),%4
8089
+       MOV\t%1,uR8
8090
+       MOV\t%2,uR9
8091
+       MOV\t%3,uR10
8092
+       MOV\t%4,uR11
8093
+       LOD\t12(%0),%1
8094
+       LOD\t13(%0),%2
8095
+       LOD\t14(%0),%3
8096
+       LOD\t15(%0),%4
8097
+       MOV\t%1,uR12
8098
+       MOV\t%2,uSP
8099
+       MOV\t%3,uCC
8100
+       MOV\t%4,uPC"
8101
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8102
+(define_insn "zip_bitrev"
8103
+       [(set (match_operand:SI 0 "register_operand" "=r")
8104
+               (unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_BITREV))
8105
+       ]
8106
+       ""
8107
+       "BREV\t%1,%0"
8108
+       [(set_attr "ccresult" "set")])
8109
+(define_insn "zip_cc"
8110
+       [(set (match_operand:SI 0 "register_operand" "=r")
8111
+               (unspec:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
8112
+       ""
8113
+       "MOV\tCC,%0"
8114
+       [(set_attr "ccresult" "unchanged")])
8115
+(define_insn "ldilo"
8116
+       [(set (match_operand:SI 0 "register_operand" "=r")
8117
+               (unspec:SI [(match_operand:SI 1 "immediate_operand" "")] UNSPEC_LDILO))]
8118
+       ""
8119
+       "LDILO  %1,%0"
8120
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
8121
+
8122
+;
8123
+;
8124
+;
8125
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8126
+;;
8127
+;; Floating point Op-codes
8128
+;;
8129
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8130
+;
8131
+;
8132
+;
8133
+(define_insn "addsf3"
8134
+       [(set (match_operand:SF 0 "register_operand" "=r")
8135
+               (plus:SF (match_operand:SF 1 "register_operand" "0")
8136
+                       (match_operand:SF 2 "register_operand" "r")))]
8137
+       "(ZIP_FPU)"
8138
+       "FPADD  %2,%0"
8139
+       [(set_attr "ccresult" "unknown")])
8140
+(define_insn "subsf3"
8141
+       [(set (match_operand:SF 0 "register_operand" "=r")
8142
+               (minus:SF (match_operand:SF 1 "register_operand" "0")
8143
+                       (match_operand:SF 2 "register_operand" "r")))]
8144
+       "(ZIP_FPU)"
8145
+       "FPSUB  %2,%0"
8146
+       [(set_attr "ccresult" "unknown")])
8147
+(define_insn "mulsf3"
8148
+       [(set (match_operand:SF 0 "register_operand" "=r")
8149
+               (mult:SF (match_operand:SF 1 "register_operand" "0")
8150
+                       (match_operand:SF 2 "register_operand" "r")))]
8151
+       "(ZIP_FPU)"
8152
+       "FPMUL  %2,%0"
8153
+       [(set_attr "ccresult" "unknown")])
8154
+(define_insn "divsf3"
8155
+       [(set (match_operand:SF 0 "register_operand" "=r")
8156
+               (div:SF (match_operand:SF 1 "register_operand" "0")
8157
+                       (match_operand:SF 2 "register_operand" "r")))]
8158
+       "(ZIP_FPU)"
8159
+       "FPDIV  %2,%0"
8160
+       [(set_attr "ccresult" "unknown")])
8161
+
8162
+;
8163
+;
8164
+;
8165
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8166
+;;
8167
+;; Trap Instruction
8168
+;;
8169
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8170
+;
8171
+;
8172
+; The ZipCPU doesn't really have a "trap" instruction per se.  The goal is that
8173
+; *nothing* should ever trap, and so we should never get here.  However, the
8174
+; compiler seems to want a trap instruction for some reason.  (It keeps us
8175
+; from calling the abort() function, if we don't define these ...)  So let's
8176
+; just grab onto the break instruction and declare it to be a trap instruction
8177
+; for our purposes.  Alternatively, we might've used a syscall, but ... this
8178
+; will work for both user and system instructions.
8179
+;
8180
+(define_insn "trap"
8181
+       [(trap_if (const_int 1) (const_int 0))]
8182
+       ""
8183
+       "BREAK"
8184
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
8185
+;
8186
+(define_expand "ctrap<mode>4"
8187
+       [(set (cc0) (compare (match_operand:ZI 1 "register_operand" "r")
8188
+               (match_operand:ZI 2 "nonmemory_operand" "rO")))
8189
+       (trap_if (match_operator 0 "ordered_comparison_operator"
8190
+                       [(cc0) (const_int 0)])
8191
+                       (match_operand 3 "const_int_operand" "O"))]
8192
+       ""
8193
+       )
8194
+(define_insn "trapif"
8195
+       [(trap_if (match_operator 0 "ordered_comparison_operator"
8196
+                       [(cc0) (const_int 0)])
8197
+                       (match_operand 1 "const_int_operand" "O"))]
8198
+       ""
8199
+       "BREAK\t%1"
8200
+       [(set_attr "predicable" "no")])
8201
+;
8202
+;
8203
+;
8204
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8205
+;;
8206
+;; Unimplemented (or not yet implemented) RTL Codes
8207
+;;
8208
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8209
+;
8210
+;
8211
+;
8212
+; The book says that add<mode>3 is used if addptr<mode>3 is undefined.
8213
+; Hence we leave this as unimplemented.
8214
+;
8215
+;(define_insn "addptrsi3"
8216
+;      [(set (match_operand:SI 0 "register_operand" "=r")
8217
+;              (plus:SI (match_operand:SI 1 "register_operand" "r")
8218
+;                      (match_operand:SI 2 "general_operand" "M")))]
8219
+;      ; Addptr is not allowed to clobber condition codes, thus we *must*
8220
+;      ; use the mov (A+B),C form of the add.
8221
+;      ""
8222
+;      "MOV    %2(%1),%0"
8223
+;      [(set_attr "ccresult" "unchanged")])
8224
+;
8225
+; (define_insn "casesi"
8226
+;      "LDI    %4,R0
8227
+;      SUB     %2,%1
8228
+;      BLT     %5
8229
+;      CMP     %3,%1
8230
+;      BGT     %5
8231
+;      ADD     %1,R0
8232
+;      LOD     (R0),pc"
8233
+;      "")
8234
+; (define_insn "decrement_and_branch_until_zero"
8235
+       ; [(parallel [
8236
+               ; (set (match_operand:SI 0 "regiser_operand" "r")
8237
+                       ; (minus:SI (match_dup 0) (const_int 1)))
8238
+               ; (set (pc) (if_then_else
8239
+                               ; (ge (minus:SI (match_dup 0) (const_int 1)))
8240
+                               ; (label_ref (match_operand 1 "" ""))
8241
+                               ; (pc)))])]
8242
+       ; ""
8243
+; ;    SUB     1,%0
8244
+; ;    BNZ     %1
8245
+; ;     .vice the faster (optimize for speed)
8246
+       ; "SUB  1,%0
8247
+       ; BZ    %=
8248
+       ; BRA   %1
8249
+       ; %=:"
8250
+       ; [(set_attr "predicable" "no") (set_attr "ccresult" "set")])
8251
+; doloop_end - do not define--would require cost of an unopt register to use
8252
+; allocate_stack       - do not define ...
8253
+; nonlocal_goto - do not define
8254
+;(define_insn "ctrapmm4"
8255
+;      CMP     %1,%2
8256
+;      MOV.%0  %3,R0
8257
+;      LDILO.%0 0,(CC)
8258
+;
8259
+;(define_insn "sync_compare_and_swapsi"
8260
+;      [(set ...
8261
+;              )]
8262
+;      "(ZIP_ATMOC)"
8263
+;      LOCK            (alu)           // Hmmm ... need to modify if I will
8264
+;      LOD     %1,%0   OP-VALID        // operate on the value before the store
8265
+;      CMP     %0,%2   DCD-valid
8266
+;      STO.Z   %2,%1   PF-valid
8267
+;
8268
+;(define_insn "sync_lock_test_and_setsi"
8269
+;      LOCK
8270
+;      LOD     %1,%0
8271
+;      STO     %0,%1
8272
+;
8273
+;(define_insn "sync_lock_releasesi"
8274
+;      STO     %1,%0
8275
+;
8276
+;
8277
+;(define_insn "negvsi3"
8278
+;      "MOV    %1,%0
8279
+;      XOR     -1,%0
8280
+;      ADD     1,%0
8281
+;      BV      %2"
8282
+;      "")
8283
+
8284
+;
8285
+; STILL MISSING:
8286
+;      SYSCALL(ID)
8287
+;              MOV %ID,R0
8288
+;              CLR     CC
8289
+;      cmove   ... the conditional move, created from a
8290
+;      (set (match_op 0 "" "r") (if_then_else (condition) (a) (reg X))))
8291
+;      pattern
8292
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip-modes.def gcc-5.3.0-zip/gcc/config/zip/zip-modes.def
8293
--- gcc-5.3.0-original/gcc/config/zip/zip-modes.def     1969-12-31 19:00:00.000000000 -0500
8294
+++ gcc-5.3.0-zip/gcc/config/zip/zip-modes.def  2016-03-04 17:13:26.438204784 -0500
8295
@@ -0,0 +1,21 @@
8296
+/*
8297
+ * Commends in C-long comment form
8298
+ * class
8299
+ *     Mode = "SI"
8300
+ *     PRECISION, BYTESIZE, COUNT ??
8301
+ *     FORMAT
8302
+ *     EXPR
8303
+ */
8304
+// INT_MODE(QI, 1);
8305
+// INT_MODE(HI, 1);
8306
+// INT_MODE(SI, 1);
8307
+// INT_MODE(DI, 2);
8308
+
8309
+// FLOAT_MODE(SF, 1, ieee_single_format);
8310
+// FLOAT_MODE(DF, 2, ieee_single_format);
8311
+
8312
+// We cannot override machmodes.def from here.  Thus, even though our QI,
8313
+// HI, and SI modes are all 1-byte, we cant set them that way here.  The
8314
+// change needed to be made in machmodes.def.  Hence, here is a target
8315
+// configuration change--in machmodes.def--that properly belonged in the
8316
+// config directory.
8317
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip-protos.h gcc-5.3.0-zip/gcc/config/zip/zip-protos.h
8318
--- gcc-5.3.0-original/gcc/config/zip/zip-protos.h      1969-12-31 19:00:00.000000000 -0500
8319
+++ gcc-5.3.0-zip/gcc/config/zip/zip-protos.h   2016-03-02 10:35:53.661426308 -0500
8320
@@ -0,0 +1,69 @@
8321
+////////////////////////////////////////////////////////////////////////////////
8322
+//
8323
+// Filename:   zip-protos.h
8324
+//
8325
+// Project:    Zip CPU backend for the GNU Compiler Collection
8326
+//
8327
+// Purpose:
8328
+//
8329
+// Creator:    Dan Gisselquist, Ph.D.
8330
+//             Gisselquist Technology, LLC
8331
+//
8332
+////////////////////////////////////////////////////////////////////////////////
8333
+//
8334
+// Copyright (C) 2016, Gisselquist Technology, LLC
8335
+//
8336
+// This program is free software (firmware): you can redistribute it and/or
8337
+// modify it under the terms of  the GNU General Public License as published
8338
+// by the Free Software Foundation, either version 3 of the License, or (at
8339
+// your option) any later version.
8340
+//
8341
+// This program is distributed in the hope that it will be useful, but WITHOUT
8342
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
8343
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8344
+// for more details.
8345
+//
8346
+// You should have received a copy of the GNU General Public License along
8347
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
8348
+// target there if the PDF file isn't present.)  If not, see
8349
+// <http://www.gnu.org/licenses/> for a copy.
8350
+//
8351
+// License:    GPL, v3, as defined and found on www.gnu.org,
8352
+//             http://www.gnu.org/licenses/gpl.html
8353
+//
8354
+//
8355
+////////////////////////////////////////////////////////////////////////////////
8356
+#ifndef        ZIP_PROTOS_H
8357
+#define        ZIP_PROTOS_H
8358
+
8359
+extern void    zip_expand_prologue(void);
8360
+extern void    zip_expand_epilogue(void);
8361
+extern int     zip_initial_elimination_offset(int, int);
8362
+extern void    zip_print_operand(FILE *, rtx, int);
8363
+extern void    zip_print_operand_address(FILE *, rtx);
8364
+extern enum    reg_class       zip_reg_class(int);
8365
+extern rtx     zip_return_addr_rtx(int, rtx);
8366
+extern int     zip_num_arg_regs(enum machine_mode, tree);
8367
+
8368
+extern void    zip_asm_output_def(FILE *s, const char *n, const char *v);
8369
+extern void    zip_update_cc_notice(rtx exp, rtx_insn *insn);
8370
+extern int     zip_address_operand(rtx op);
8371
+extern int     zip_const_address_operand(rtx op);
8372
+extern bool    zip_gen_move_rtl(rtx, rtx);
8373
+// extern      bool    zip_load_address_lod(rtx, rtx);
8374
+// extern      bool    zip_load_address_sto(rtx, rtx);
8375
+extern bool    zip_use_return_insn(void);
8376
+extern const char *zip_set_zero_or_one(rtx, rtx);
8377
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
8378
+
8379
+extern int     zip_ct_address_operand(rtx op);
8380
+extern int     zip_pd_address_operand(rtx op);
8381
+extern int     zip_pd_mov_operand(rtx op);
8382
+extern int     zip_ct_const_address_operand(rtx op);
8383
+extern int     zip_pd_const_address_operand(rtx op);
8384
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
8385
+extern const char *zip_addsicc(rtx, rtx, rtx, rtx);
8386
+// extern      void    zip_canonicalize_comparison(int *, rtx *, rtx *, bool);
8387
+
8388
+#endif
8389
+
8390
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config.gcc gcc-5.3.0-zip/gcc/config.gcc
8391
--- gcc-5.3.0-original/gcc/config.gcc   2015-09-10 10:17:53.000000000 -0400
8392
+++ gcc-5.3.0-zip/gcc/config.gcc        2016-02-14 00:53:37.389411987 -0500
8393
@@ -479,6 +479,10 @@
8394
 tilepro*-*-*)
8395
        cpu_type=tilepro
8396
        ;;
8397
+zip*)
8398
+       cpu_type=zip
8399
+       tmake_file=zip/t-zip
8400
+       ;;
8401
 esac
8402
 
8403
 tm_file=${cpu_type}/${cpu_type}.h
8404
@@ -2972,6 +2976,15 @@
8405
        c_target_objs="m32c-pragma.o"
8406
        cxx_target_objs="m32c-pragma.o"
8407
        ;;
8408
+zip-*-netbsd*)
8409
+       tm_file="${tm_file} elfos.h netbsd.h netbsd-elf.h zip/netbsd.h"
8410
+       tmake_file="${tmake_file} zip/t-zip"
8411
+       ;;
8412
+zip*)
8413
+       target_has_targetm_common=yes
8414
+       tm_file="elfos.h newlib-stdint.h ${tm_file}"
8415
+       tmake_file="${tmake_file} zip/t-zip"
8416
+       ;;
8417
 *)
8418
        echo "*** Configuration ${target} not supported" 1>&2
8419
        exit 1
8420
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/cse.c gcc-5.3.0-zip/gcc/cse.c
8421
--- gcc-5.3.0-original/gcc/cse.c        2015-02-03 15:41:38.000000000 -0500
8422
+++ gcc-5.3.0-zip/gcc/cse.c     2016-03-05 20:34:50.226907590 -0500
8423
@@ -634,6 +634,14 @@
8424
 
8425
 /* Nonzero if X has the form (PLUS frame-pointer integer).  */
8426
 
8427
+#ifdef DO_ZIP_DEBUGS
8428
+#include <stdio.h>
8429
+extern void zip_debug_rtx(const_rtx);
8430
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s\n", STR); zip_debug_rtx(RTX); } while(0)
8431
+#else
8432
+#define        ZIP_DEBUG_LINE(STR,RTX)
8433
+#endif
8434
+
8435
 static bool
8436
 fixed_base_plus_p (rtx x)
8437
 {
8438
@@ -2843,6 +2851,7 @@
8439
   enum rtx_code code;
8440
   const char *fmt;
8441
 
8442
+       ZIP_DEBUG_LINE("CANON-REG", insn);
8443
   if (x == 0)
8444
     return x;
8445
 
8446
@@ -2898,6 +2907,7 @@
8447
          validate_canon_reg (&XVECEXP (x, i, j), insn);
8448
     }
8449
 
8450
+       ZIP_DEBUG_LINE("CANON-REG-RTN", x);
8451
   return x;
8452
 }
8453
 
8454
@@ -3144,14 +3154,16 @@
8455
   if (x == 0)
8456
     return x;
8457
 
8458
+       ZIP_DEBUG_LINE("FOLD-RTX", x);
8459
   /* Try to perform some initial simplifications on X.  */
8460
   code = GET_CODE (x);
8461
   switch (code)
8462
     {
8463
     case MEM:
8464
     case SUBREG:
8465
-      if ((new_rtx = equiv_constant (x)) != NULL_RTX)
8466
-        return new_rtx;
8467
+      if ((new_rtx = equiv_constant (x)) != NULL_RTX) {
8468
+       ZIP_DEBUG_LINE("FOLD-RTX-NEW", new_rtx);
8469
+        return new_rtx; }
8470
       return x;
8471
 
8472
     case CONST:
8473
@@ -3208,6 +3220,8 @@
8474
        rtx folded_arg = XEXP (x, i), const_arg;
8475
        machine_mode mode_arg = GET_MODE (folded_arg);
8476
 
8477
+       ZIP_DEBUG_LINE("FOLD-RTX-ARG = ", folded_arg);
8478
+
8479
        switch (GET_CODE (folded_arg))
8480
          {
8481
          case MEM:
8482
@@ -3317,6 +3331,7 @@
8483
        }
8484
 
8485
       apply_change_group ();
8486
+       ZIP_DEBUG_LINE("FOLD-RTX-CANONICALIZED = ", insn);
8487
     }
8488
 
8489
   /* If X is an arithmetic operation, see if we can simplify it.  */
8490
@@ -4203,6 +4218,7 @@
8491
 {
8492
   rtx dest = SET_DEST (set);
8493
   rtx src = SET_SRC (set);
8494
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG", insn);
8495
 
8496
   if (REG_P (dest)
8497
       && REG_P (src) && ! HARD_REGISTER_P (src)
8498
@@ -4258,6 +4274,7 @@
8499
            }
8500
        }
8501
     }
8502
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG, done", insn);
8503
 }
8504
 
8505
 /* Record all the SETs in this instruction into SETS_PTR,
8506
@@ -4351,6 +4368,7 @@
8507
   rtx tem;
8508
   rtx x = PATTERN (insn);
8509
   int i;
8510
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN", insn);
8511
 
8512
   if (CALL_P (insn))
8513
     {
8514
@@ -4364,6 +4382,7 @@
8515
       canon_reg (SET_SRC (x), insn);
8516
       apply_change_group ();
8517
       fold_rtx (SET_SRC (x), insn);
8518
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN, was set:", insn);
8519
     }
8520
   else if (GET_CODE (x) == CLOBBER)
8521
     {
8522
@@ -4400,6 +4419,7 @@
8523
     canon_reg (PATTERN (insn), insn);
8524
   else if (GET_CODE (x) == PARALLEL)
8525
     {
8526
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/parallel", insn);
8527
       for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
8528
        {
8529
          rtx y = XVECEXP (x, 0, i);
8530
@@ -4491,6 +4511,7 @@
8531
 
8532
      The result of apply_change_group can be ignored; see canon_reg.  */
8533
 
8534
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/done", insn);
8535
   apply_change_group ();
8536
 }
8537
 
8538
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/defaults.h gcc-5.3.0-zip/gcc/defaults.h
8539
--- gcc-5.3.0-original/gcc/defaults.h   2015-03-03 10:04:02.000000000 -0500
8540
+++ gcc-5.3.0-zip/gcc/defaults.h        2016-02-06 16:57:53.939410173 -0500
8541
@@ -480,6 +480,8 @@
8542
 #define LOG2_BITS_PER_UNIT 3
8543
 #elif BITS_PER_UNIT == 16
8544
 #define LOG2_BITS_PER_UNIT 4
8545
+#elif BITS_PER_UNIT == 32
8546
+#define LOG2_BITS_PER_UNIT 5
8547
 #else
8548
 #error Unknown BITS_PER_UNIT
8549
 #endif
8550
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/doc/gcc.log gcc-5.3.0-zip/gcc/doc/gcc.log
8551
--- gcc-5.3.0-original/gcc/doc/gcc.log  1969-12-31 19:00:00.000000000 -0500
8552
+++ gcc-5.3.0-zip/gcc/doc/gcc.log       2016-01-30 15:18:43.262724969 -0500
8553
@@ -0,0 +1,214 @@
8554
+This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) (format=pdfetex 2014.5.7)  30 JAN 2016 15:17
8555
+entering extended mode
8556
+ restricted \write18 enabled.
8557
+ file:line:error style messages enabled.
8558
+ %&-line parsing enabled.
8559
+**\catcode126=12 \def\normaltilde{~}\catcode126=13 \let~\normaltilde  \input ./
8560
+gcc.texi
8561
+(./gcc.texi (/usr/share/texmf/tex/texinfo/texinfo.tex
8562
+Loading texinfo [version 2013-09-11.11]:
8563
+\bindingoffset=\dimen16
8564
+\normaloffset=\dimen17
8565
+\pagewidth=\dimen18
8566
+\pageheight=\dimen19
8567
+\outerhsize=\dimen20
8568
+\outervsize=\dimen21
8569
+\cornerlong=\dimen22
8570
+\cornerthick=\dimen23
8571
+\topandbottommargin=\dimen24
8572
+\headlinebox=\box16
8573
+\footlinebox=\box17
8574
+\margin=\insert252
8575
+\EMsimple=\toks13
8576
+\groupbox=\box18
8577
+\groupinvalidhelp=\toks14
8578
+\mil=\dimen25
8579
+\exdentamount=\skip18
8580
+\inmarginspacing=\skip19
8581
+\centerpenalty=\count27
8582
+ pdf,
8583
+\tempnum=\count28
8584
+\lnkcount=\count29
8585
+\filename=\toks15
8586
+\filenamelength=\count30
8587
+\pgn=\count31
8588
+\toksA=\toks16
8589
+\toksB=\toks17
8590
+\toksC=\toks18
8591
+\toksD=\toks19
8592
+\boxA=\box19
8593
+\countA=\count32
8594
+\nopdfimagehelp=\toks20
8595
+ fonts,
8596
+\sffam=\fam8
8597
+\textleading=\dimen26
8598
+ markup,
8599
+\fontdepth=\count33
8600
+ glyphs,
8601
+\errorbox=\box20
8602
+
8603
+page headings,
8604
+\titlepagetopglue=\skip20
8605
+\titlepagebottomglue=\skip21
8606
+\evenheadline=\toks21
8607
+\oddheadline=\toks22
8608
+\evenfootline=\toks23
8609
+\oddfootline=\toks24
8610
+ tables,
8611
+\tableindent=\dimen27
8612
+\itemindent=\dimen28
8613
+\itemmargin=\dimen29
8614
+\itemmax=\dimen30
8615
+\itemno=\count34
8616
+\multitableparskip=\skip22
8617
+\multitableparindent=\skip23
8618
+\multitablecolspace=\dimen31
8619
+\multitablelinespace=\skip24
8620
+\colcount=\count35
8621
+\everytab=\toks25
8622
+ conditionals,
8623
+\doignorecount=\count36
8624
+ indexing,
8625
+\whatsitskip=\skip25
8626
+\whatsitpenalty=\count37
8627
+\secondaryindent=\skip26
8628
+\partialpage=\box21
8629
+\doublecolumnhsize=\dimen32
8630
+ sectioning,
8631
+\unnumberedno=\count38
8632
+\chapno=\count39
8633
+\secno=\count40
8634
+\subsecno=\count41
8635
+\subsubsecno=\count42
8636
+\appendixno=\count43
8637
+\absseclevel=\count44
8638
+\secbase=\count45
8639
+\chapheadingskip=\skip27
8640
+\secheadingskip=\skip28
8641
+\subsecheadingskip=\skip29
8642
+ toc,
8643
+\tocfile=\write0
8644
+\contentsrightmargin=\skip30
8645
+\savepageno=\count46
8646
+\lastnegativepageno=\count47
8647
+\tocindent=\dimen33
8648
+ environments,
8649
+\lispnarrowing=\skip31
8650
+\envskipamount=\skip32
8651
+\circthick=\dimen34
8652
+\cartouter=\dimen35
8653
+\cartinner=\dimen36
8654
+\normbskip=\skip33
8655
+\normpskip=\skip34
8656
+\normlskip=\skip35
8657
+\lskip=\skip36
8658
+\rskip=\skip37
8659
+\nonfillparindent=\dimen37
8660
+\tabw=\dimen38
8661
+\verbbox=\box22
8662
+
8663
+defuns,
8664
+\defbodyindent=\skip38
8665
+\defargsindent=\skip39
8666
+\deflastargmargin=\skip40
8667
+\defunpenalty=\count48
8668
+\parencount=\count49
8669
+\brackcount=\count50
8670
+ macros,
8671
+\paramno=\count51
8672
+\macname=\toks26
8673
+ cross references,
8674
+\auxfile=\write1
8675
+\savesfregister=\count52
8676
+\toprefbox=\box23
8677
+\printedrefnamebox=\box24
8678
+\infofilenamebox=\box25
8679
+\printedmanualbox=\box26
8680
+ insertions,
8681
+\footnoteno=\count53
8682
+\SAVEfootins=\box27
8683
+\SAVEmargin=\box28
8684
+
8685
+(/usr/share/texlive/texmf-dist/tex/generic/epsf/epsf.tex
8686
+This is `epsf.tex' v2.7.4 <14 February 2011>
8687
+\epsffilein=\read1
8688
+\epsfframemargin=\dimen39
8689
+\epsfframethickness=\dimen40
8690
+\epsfrsize=\dimen41
8691
+\epsftmp=\dimen42
8692
+\epsftsize=\dimen43
8693
+\epsfxsize=\dimen44
8694
+\epsfysize=\dimen45
8695
+\pspoints=\dimen46
8696
+)
8697
+\noepsfhelp=\toks27
8698
+ localization,
8699
+\nolanghelp=\toks28
8700
+\countUTFx=\count54
8701
+\countUTFy=\count55
8702
+\countUTFz=\count56
8703
+ formatting,
8704
+\defaultparindent=\dimen47
8705
+ and turning on texinfo input format.)
8706
+\openout1 = `gcc.aux'.
8707
+
8708
+@cpindfile=@write2
8709
+@fnindfile=@write3
8710
+@vrindfile=@write4
8711
+@tpindfile=@write5
8712
+@kyindfile=@write6
8713
+@pgindfile=@write7
8714
+texinfo.tex: doing @include of gcc-common.texi
8715
+
8716
+
8717
+./gcc.texi:25: I can't find file `gcc-common.texi'.
8718
+@temp ->@input gcc-common.texi
8719
+
8720
+@includezzz ...and @input #1 }@expandafter }@temp
8721
+                                                  @popthisfilestack
8722
+l.25 @include gcc-common.texi
8723
+
8724
+(Press Enter to retry, or Control-D to exit)
8725
+Please type another input file name: include/gcc-common.texi
8726
+(./include/gcc-common.texi
8727
+texinfo.tex: doing @include of gcc-vers.texi
8728
+
8729
+
8730
+./include/gcc-common.texi:11: I can't find file `gcc-vers.texi'.
8731
+@temp ->@input gcc-vers.texi
8732
+
8733
+@includezzz ...and @input #1 }@expandafter }@temp
8734
+                                                  @popthisfilestack
8735
+l.11 @include gcc-vers.texi
8736
+
8737
+(Press Enter to retry, or Control-D to exit)
8738
+Please type another input file name: include/gcc-vers.texi
8739
+./include/gcc-common.texi:11: I can't find file `include/gcc-vers.texi'.
8740
+@temp ->@input gcc-vers.texi
8741
+
8742
+@includezzz ...and @input #1 }@expandafter }@temp
8743
+                                                  @popthisfilestack
8744
+l.11 @include gcc-vers.texi
8745
+
8746
+(Press Enter to retry, or Control-D to exit)
8747
+Please type another input file name:
8748
+./include/gcc-common.texi:11: I can't find file `include/gcc-vers.texi'.
8749
+@temp ->@input gcc-vers.texi
8750
+
8751
+@includezzz ...and @input #1 }@expandafter }@temp
8752
+                                                  @popthisfilestack
8753
+l.11 @include gcc-vers.texi
8754
+
8755
+(Press Enter to retry, or Control-D to exit)
8756
+Please type another input file name:
8757
+./include/gcc-common.texi:11: Emergency stop.
8758
+@temp ->@input gcc-vers.texi
8759
+
8760
+@includezzz ...and @input #1 }@expandafter }@temp
8761
+                                                  @popthisfilestack
8762
+l.11 @include gcc-vers.texi
8763
+
8764
+End of file on the terminal!
8765
+
8766
+./include/gcc-common.texi:11:  ==> Fatal error occurred, no output PDF file pro
8767
+duced!
8768
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/expr.c gcc-5.3.0-zip/gcc/expr.c
8769
--- gcc-5.3.0-original/gcc/expr.c       2015-04-07 10:34:06.000000000 -0400
8770 103 dgisselq
+++ gcc-5.3.0-zip/gcc/expr.c    2016-03-08 04:07:01.426335724 -0500
8771 102 dgisselq
@@ -7999,6 +7999,8 @@
8772
    the back of the caller.
8773
    The normal operating mode is to pass FALSE for this parameter.  */
8774
 
8775
+#include "print-tree.h"
8776
+
8777
 rtx
8778
 expand_expr_real (tree exp, rtx target, machine_mode tmode,
8779
                  enum expand_modifier modifier, rtx *alt_rtl,
8780
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/genmodes.c gcc-5.3.0-zip/gcc/genmodes.c
8781
--- gcc-5.3.0-original/gcc/genmodes.c   2015-01-05 07:33:28.000000000 -0500
8782
+++ gcc-5.3.0-zip/gcc/genmodes.c        2016-03-04 21:27:49.669147699 -0500
8783
@@ -330,7 +330,8 @@
8784
         the size of a CC mode is four units.  */
8785
       validate_mode (m, UNSET, UNSET, UNSET, UNSET, UNSET);
8786
 
8787
-      m->bytesize = 4;
8788
+       /* For the ZipCPU, however, it is only one unit */
8789
+      m->bytesize = 1;
8790
       m->ncomponents = 1;
8791
       m->component = 0;
8792
       break;
8793
@@ -766,11 +767,12 @@
8794
 
8795
   /* So put the default value unless the target needs a non standard
8796
      value. */
8797
-#ifdef BITS_PER_UNIT
8798
-  bits_per_unit = BITS_PER_UNIT;
8799
-#else
8800
-  bits_per_unit = 8;
8801
-#endif
8802
+// #ifdef BITS_PER_UNIT
8803
+  // bits_per_unit = BITS_PER_UNIT;
8804
+// #else
8805
+  bits_per_unit = 32;
8806
+#warning "Is there a more automated way to set bits per unit?"
8807
+// #endif
8808
 
8809
 #ifdef MAX_BITSIZE_MODE_ANY_INT
8810
   max_bitsize_mode_any_int = MAX_BITSIZE_MODE_ANY_INT;
8811
@@ -1083,7 +1085,7 @@
8812
       first = modes[c];
8813
       last = 0;
8814
       for (m = first; m; last = m, m = m->next)
8815
-       ;
8816
+       if ((m->next)&&(m->next->bytesize == m->bytesize)) first = m;
8817
 
8818
       /* Don't use BImode for MIN_MODE_INT, since otherwise the middle
8819
         end will try to use it for bitfields in structures and the
8820
@@ -1268,7 +1270,7 @@
8821
            continue;
8822
          if (m->precision != (unsigned int) -1)
8823
            {
8824
-             if (m2->precision != 2 * m->precision)
8825
+             if (m2->precision < 2 * m->precision)
8826
                continue;
8827
            }
8828
          else
8829
@@ -1323,7 +1325,6 @@
8830
       tagged_printf ("MODE_MASK (%u)", m->precision, m->name);
8831
     else
8832
       tagged_printf ("MODE_MASK (%u*BITS_PER_UNIT)", m->bytesize, m->name);
8833
-
8834
   puts ("#undef MODE_MASK");
8835
   print_closer ();
8836
 }
8837
@@ -1351,12 +1352,23 @@
8838
   int c;
8839
   struct mode_data *m;
8840
 
8841
+  puts(
8842
+"\n\n/* This is a rather strange conundrum.  Alignment is used by the host in\n"
8843
+" * the assembly file, whereas the size is used by the target.  Thus, for\n"
8844
+" * now, to align to a single target word means to align to 4 8-bit bytes in\n"
8845
+" * assembly.  If you get it wrong, the assembler will try to help.  Thus,\n"
8846
+" * aligning to anything less than 4 (1 target word) will cause an alignment\n"
8847
+" * of the target word in size.  However, this tries to do a little something\n"
8848
+" * teach our compiler what we are doing.\n"
8849
+" */\n");
8850
   print_maybe_const_decl ("%sunsigned char",
8851
                          "mode_base_align", "NUM_MACHINE_MODES",
8852
                          alignment);
8853
 
8854
   for_all_modes (c, m)
8855
-    tagged_printf ("%u", m->alignment, m->name);
8856
+    tagged_printf ("%u", 4*m->bytesize,
8857
+               // m->alignment,
8858
+               m->name);
8859
 
8860
   print_closer ();
8861
 }
8862
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.def gcc-5.3.0-zip/gcc/machmode.def
8863
--- gcc-5.3.0-original/gcc/machmode.def 2015-01-05 07:33:28.000000000 -0500
8864
+++ gcc-5.3.0-zip/gcc/machmode.def      2016-03-04 22:47:59.406632941 -0500
8865
@@ -184,11 +184,11 @@
8866
    larger types, then corresponding modes must be added here.  The
8867
    name OI is reserved for a 256-bit type (needed by some back ends).
8868
     */
8869
-INT_MODE (QI, 1);
8870
-INT_MODE (HI, 2);
8871
-INT_MODE (SI, 4);
8872
-INT_MODE (DI, 8);
8873
-INT_MODE (TI, 16);
8874
+// INT_MODE (QI, 1);
8875
+// INT_MODE (HI, 1);
8876
+INT_MODE (SI, 1);
8877
+INT_MODE (DI, 2);
8878
+INT_MODE (TI, 4);
8879
 
8880
 /* No partial integer modes are defined by default.  */
8881
 
8882
@@ -206,8 +206,8 @@
8883
    These are the IEEE mappings.  They can be overridden with
8884
    RESET_FLOAT_FORMAT or at runtime (in TARGET_OPTION_OVERRIDE).  */
8885
 
8886
-FLOAT_MODE (SF, 4, ieee_single_format);
8887
-FLOAT_MODE (DF, 8, ieee_double_format);
8888
+FLOAT_MODE (SF, 1, ieee_single_format);
8889
+FLOAT_MODE (DF, 2, ieee_double_format);
8890
 
8891
 /* Basic CC modes.
8892
    FIXME define this only for targets that need it.  */
8893
@@ -215,16 +215,16 @@
8894
 
8895
 /* Fixed-point modes.  */
8896
 FRACT_MODE (QQ, 1, 7); /* s.7 */
8897
-FRACT_MODE (HQ, 2, 15); /* s.15 */
8898
-FRACT_MODE (SQ, 4, 31); /* s.31 */
8899
-FRACT_MODE (DQ, 8, 63); /* s.63 */
8900
-FRACT_MODE (TQ, 16, 127); /* s.127 */
8901
+FRACT_MODE (HQ, 1, 15); /* s.15 */
8902
+FRACT_MODE (SQ, 1, 31); /* s.31 */
8903
+FRACT_MODE (DQ, 2, 63); /* s.63 */
8904
+FRACT_MODE (TQ, 4, 127); /* s.127 */
8905
 
8906
 UFRACT_MODE (UQQ, 1, 8); /* .8 */
8907
-UFRACT_MODE (UHQ, 2, 16); /* .16 */
8908
-UFRACT_MODE (USQ, 4, 32); /* .32 */
8909
-UFRACT_MODE (UDQ, 8, 64); /* .64 */
8910
-UFRACT_MODE (UTQ, 16, 128); /* .128 */
8911
+UFRACT_MODE (UHQ, 1, 16); /* .16 */
8912
+UFRACT_MODE (USQ, 1, 32); /* .32 */
8913
+UFRACT_MODE (UDQ, 2, 64); /* .64 */
8914
+UFRACT_MODE (UTQ, 4, 128); /* .128 */
8915
 
8916
 ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
8917
 ACCUM_MODE (SA, 4, 16, 15); /* s16.15 */
8918
@@ -246,9 +246,9 @@
8919
 COMPLEX_MODES (FLOAT);
8920
 
8921
 /* Decimal floating point modes.  */
8922
-DECIMAL_FLOAT_MODE (SD, 4, decimal_single_format);
8923
-DECIMAL_FLOAT_MODE (DD, 8, decimal_double_format);
8924
-DECIMAL_FLOAT_MODE (TD, 16, decimal_quad_format);
8925
+DECIMAL_FLOAT_MODE (SD, 1, decimal_single_format);
8926
+DECIMAL_FLOAT_MODE (DD, 2, decimal_double_format);
8927
+DECIMAL_FLOAT_MODE (TD, 4, decimal_quad_format);
8928
 
8929
 /* The symbol Pmode stands for one of the above machine modes (usually SImode).
8930
    The tm.h file specifies which one.  It is not a distinct mode.  */
8931
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.h gcc-5.3.0-zip/gcc/machmode.h
8932
--- gcc-5.3.0-original/gcc/machmode.h   2015-01-05 07:33:28.000000000 -0500
8933
+++ gcc-5.3.0-zip/gcc/machmode.h        2016-02-06 17:21:49.592924065 -0500
8934
@@ -180,13 +180,7 @@
8935
 /* Get the size in bytes and bits of an object of mode MODE.  */
8936
 
8937
 extern CONST_MODE_SIZE unsigned char mode_size[NUM_MACHINE_MODES];
8938
-#if GCC_VERSION >= 4001
8939
-#define GET_MODE_SIZE(MODE) \
8940
-  ((unsigned short) (__builtin_constant_p (MODE) \
8941
-                    ? mode_size_inline (MODE) : mode_size[MODE]))
8942
-#else
8943
 #define GET_MODE_SIZE(MODE)    ((unsigned short) mode_size[MODE])
8944
-#endif
8945
 #define GET_MODE_BITSIZE(MODE) \
8946
   ((unsigned short) (GET_MODE_SIZE (MODE) * BITS_PER_UNIT))
8947
 
8948
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/objc/objc-encoding.c gcc-5.3.0-zip/gcc/objc/objc-encoding.c
8949
--- gcc-5.3.0-original/gcc/objc/objc-encoding.c 2015-01-09 15:18:42.000000000 -0500
8950
+++ gcc-5.3.0-zip/gcc/objc/objc-encoding.c      2016-03-04 22:53:40.431902505 -0500
8951
@@ -765,10 +765,14 @@
8952
        {
8953
          switch (TYPE_MODE (type))
8954
            {
8955
+#ifdef HAVE_QImode
8956
            case QImode:
8957
              charType = 'C'; break;
8958
+#endif
8959
+#ifdef HAVE_HImode
8960
            case HImode:
8961
              charType = 'S'; break;
8962
+#endif
8963
            case SImode:
8964
              {
8965
                if (type == long_unsigned_type_node)
8966
@@ -788,10 +792,14 @@
8967
        {
8968
          switch (TYPE_MODE (type))
8969
            {
8970
+#ifdef HAVE_QImode
8971
            case QImode:
8972
              charType = 'c'; break;
8973
+#endif
8974
+#ifdef HAVE_HImode
8975
            case HImode:
8976
              charType = 's'; break;
8977
+#endif
8978
            case SImode:
8979
              {
8980
                if (type == long_integer_type_node)
8981
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/postreload.c gcc-5.3.0-zip/gcc/postreload.c
8982
--- gcc-5.3.0-original/gcc/postreload.c 2015-07-17 09:50:38.000000000 -0400
8983 103 dgisselq
+++ gcc-5.3.0-zip/gcc/postreload.c      2016-03-07 18:24:22.263499116 -0500
8984 102 dgisselq
@@ -71,6 +71,13 @@
8985
 #include "df.h"
8986
 #include "dbgcnt.h"
8987
 
8988
+#ifdef DO_ZIP_DEBUGS
8989
+extern void zip_debug_rtx(const_rtx);
8990
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
8991
+#else
8992
+#define        ZIP_DEBUG_LINE(STR,RTX)
8993
+#endif
8994
+
8995
 static int reload_cse_noop_set_p (rtx);
8996
 static bool reload_cse_simplify (rtx_insn *, rtx);
8997
 static void reload_cse_regs_1 (void);
8998
@@ -120,6 +127,8 @@
8999
   basic_block insn_bb = BLOCK_FOR_INSN (insn);
9000
   unsigned insn_bb_succs = EDGE_COUNT (insn_bb->succs);
9001
 
9002
+       ZIP_DEBUG_LINE("RELOAD-CSE-SIMPLIFY:",insn);
9003
+
9004
   if (GET_CODE (body) == SET)
9005
     {
9006
       int count = 0;
9007
@@ -147,6 +156,7 @@
9008
        apply_change_group ();
9009
       else
9010
        reload_cse_simplify_operands (insn, testreg);
9011
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
9012
     }
9013
   else if (GET_CODE (body) == PARALLEL)
9014
     {
9015
@@ -205,6 +215,7 @@
9016
        apply_change_group ();
9017
       else
9018
        reload_cse_simplify_operands (insn, testreg);
9019
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
9020
     }
9021
 
9022
 done:
9023
@@ -246,6 +257,7 @@
9024
          cfg_changed |= reload_cse_simplify (insn, testreg);
9025
 
9026
        cselib_process_insn (insn);
9027
+       ZIP_DEBUG_LINE("End-CSE-REGS-1:",insn);
9028
       }
9029
 
9030
   /* Clean up.  */
9031
@@ -276,6 +288,8 @@
9032
 #endif
9033
   bool speed = optimize_bb_for_speed_p (BLOCK_FOR_INSN (insn));
9034
 
9035
+
9036
+       ZIP_DEBUG_LINE("RELOAD:Attempting to simplify set",set);
9037
   dreg = true_regnum (SET_DEST (set));
9038
   if (dreg < 0)
9039
     return 0;
9040
@@ -427,6 +441,7 @@
9041
   /* Array of alternatives, sorted in order of decreasing desirability.  */
9042
   int *alternative_order;
9043
 
9044
+       ZIP_DEBUG_LINE("Simplify-Operands", insn);
9045
   extract_constrain_insn (insn);
9046
 
9047
   if (recog_data.n_alternatives == 0 || recog_data.n_operands == 0)
9048
@@ -519,6 +534,7 @@
9049
          SET_HARD_REG_BIT (equiv_regs[i], REGNO (l->loc));
9050
     }
9051
 
9052
+       ZIP_DEBUG_LINE("Simplify-Operands - A", insn);
9053
   alternative_mask preferred = get_preferred_alternatives (insn);
9054
   for (i = 0; i < recog_data.n_operands; i++)
9055
     {
9056
@@ -617,6 +633,7 @@
9057
            }
9058
        }
9059
     }
9060
+       ZIP_DEBUG_LINE("Simplify-Operands - B", insn);
9061
 
9062
   /* Record all alternatives which are better or equal to the currently
9063
      matching one in the alternative_order array.  */
9064
@@ -666,6 +683,7 @@
9065
       validate_change (insn, recog_data.operand_loc[i],
9066
                       gen_rtx_REG (mode, op_alt_regno[i][j]), 1);
9067
     }
9068
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
9069
 
9070
   for (i = recog_data.n_dups - 1; i >= 0; i--)
9071
     {
9072
@@ -679,6 +697,7 @@
9073
                       gen_rtx_REG (mode, op_alt_regno[op][j]), 1);
9074
     }
9075
 
9076
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
9077
   return apply_change_group ();
9078
 }
9079
 
9080 103 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload1.c gcc-5.3.0-zip/gcc/reload1.c
9081
--- gcc-5.3.0-original/gcc/reload1.c    2015-01-15 08:28:42.000000000 -0500
9082
+++ gcc-5.3.0-zip/gcc/reload1.c 2016-03-07 18:25:12.311162959 -0500
9083
@@ -2271,11 +2271,11 @@
9084
               && spill_stack_slot_width[from_reg] >= total_size
9085
               && (GET_MODE_SIZE (GET_MODE (spill_stack_slot[from_reg]))
9086
                   >= inherent_size)
9087
-              && MEM_ALIGN (spill_stack_slot[from_reg]) >= min_align)
9088
+              && MEM_ALIGN (spill_stack_slot[from_reg]) >= min_align) {
9089
        x = spill_stack_slot[from_reg];
9090
 
9091
       /* Allocate a bigger slot.  */
9092
-      else
9093
+      } else
9094
        {
9095
          /* Compute maximum size needed, both for inherent size
9096
             and for total size.  */
9097
@@ -3477,11 +3477,14 @@
9098
   /* Eliminate all eliminable registers occurring in operands that
9099
      can be handled by reload.  */
9100
   extract_insn (insn);
9101
+
9102
   for (i = 0; i < recog_data.n_operands; i++)
9103
     {
9104
       orig_operand[i] = recog_data.operand[i];
9105
       substed_operand[i] = recog_data.operand[i];
9106
 
9107
+       if (insn_data[icode].operand[i].eliminable)
9108
+
9109
       /* For an asm statement, every operand is eliminable.  */
9110
       if (insn_is_asm || insn_data[icode].operand[i].eliminable)
9111
        {
9112 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload.c gcc-5.3.0-zip/gcc/reload.c
9113
--- gcc-5.3.0-original/gcc/reload.c     2015-01-15 08:28:42.000000000 -0500
9114
+++ gcc-5.3.0-zip/gcc/reload.c  2016-02-19 08:15:17.546189655 -0500
9115
@@ -2707,8 +2707,17 @@
9116
     no_output_reloads = 1;
9117
 
9118
 #ifdef HAVE_cc0
9119
+  // If the instruction depends upon cc0, such as a branch, if_then_else, or
9120
+  // cond_exec instruction, we cannot change the input so that the instruction
9121
+  // relies on another register--cc0 is specific.  This requries that the
9122
+  // references be only cc0 and (const_int 0), rather than allowing other
9123
+  // registers here as well.
9124
   if (reg_referenced_p (cc0_rtx, PATTERN (insn)))
9125
     no_input_reloads = 1;
9126
+  // If the result of an instruction is the cc0 register, that cannot
9127
+  // be changed, therefore no output reloading is allowed.  This only
9128
+  // works if instructions *only* set the cc0 register, and not multiple
9129
+  // registers.
9130
   if (reg_set_p (cc0_rtx, PATTERN (insn)))
9131
     no_output_reloads = 1;
9132
 #endif
9133
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/testsuite/lib/target-supports.exp gcc-5.3.0-zip/gcc/testsuite/lib/target-supports.exp
9134
--- gcc-5.3.0-original/gcc/testsuite/lib/target-supports.exp    2015-11-26 05:10:58.000000000 -0500
9135
+++ gcc-5.3.0-zip/gcc/testsuite/lib/target-supports.exp 2016-01-30 15:14:21.620586694 -0500
9136
@@ -503,6 +503,11 @@
9137
        return 0
9138
     }
9139
 
9140
+    # Zip CPU doesn't support profiling (yet)
9141
+    if { [istarget zip*] }
9142
+        return 0
9143
+    }
9144
+
9145
     # MinGW does not support -p.
9146
     if { [istarget *-*-mingw*] && $test_what == "-p" } {
9147
        return 0
9148
@@ -986,6 +991,12 @@
9149
        }]
9150
     }
9151
 
9152
+    # No real hardware FPU support for ZipCPU yet--even though the instruction
9153
+    # set supports it, the CPU just isn't ready yet.
9154
+    if { [istarget zip*-*-*] } {
9155
+        return 0
9156
+    }
9157
+
9158
     # This proc is actually checking the availabilty of FPU
9159
     # support for doubles, so on the RX we must fail if the
9160
     # 64-bit double multilib has been selected.
9161
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/tree-ssa-math-opts.c gcc-5.3.0-zip/gcc/tree-ssa-math-opts.c
9162
--- gcc-5.3.0-original/gcc/tree-ssa-math-opts.c 2015-08-11 03:58:07.000000000 -0400
9163
+++ gcc-5.3.0-zip/gcc/tree-ssa-math-opts.c      2016-02-12 11:21:11.309149239 -0500
9164
@@ -972,7 +972,7 @@
9165
     {
9166
       if (val & 1)
9167
        {
9168
-         digit = val & ((1 << POWI_WINDOW_SIZE) - 1);
9169
+         digit = val & ((1l << POWI_WINDOW_SIZE) - 1);
9170
          result += powi_lookup_cost (digit, cache)
9171
                    + POWI_WINDOW_SIZE + 1;
9172
          val >>= POWI_WINDOW_SIZE;
9173
@@ -1012,7 +1012,7 @@
9174
     }
9175
   else if (n & 1)
9176
     {
9177
-      digit = n & ((1 << POWI_WINDOW_SIZE) - 1);
9178
+      digit = n & ((1l << POWI_WINDOW_SIZE) - 1);
9179
       op0 = powi_as_mults_1 (gsi, loc, type, n - digit, cache);
9180
       op1 = powi_as_mults_1 (gsi, loc, type, digit, cache);
9181
     }
9182
@@ -1651,7 +1651,7 @@
9183
 };
9184
 
9185
 #define BITS_PER_MARKER 8
9186
-#define MARKER_MASK ((1 << BITS_PER_MARKER) - 1)
9187
+#define MARKER_MASK ((1l << BITS_PER_MARKER) - 1)
9188
 #define MARKER_BYTE_UNKNOWN MARKER_MASK
9189
 #define HEAD_MARKER(n, size) \
9190
   ((n) & ((uint64_t) MARKER_MASK << (((size) - 1) * BITS_PER_MARKER)))
9191
@@ -1687,7 +1687,7 @@
9192
   /* Zero out the extra bits of N in order to avoid them being shifted
9193
      into the significant bits.  */
9194
   if (size < 64 / BITS_PER_MARKER)
9195
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
9196
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
9197
 
9198
   switch (code)
9199
     {
9200
@@ -1714,7 +1714,7 @@
9201
     }
9202
   /* Zero unused bits for size.  */
9203
   if (size < 64 / BITS_PER_MARKER)
9204
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
9205
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
9206
   return true;
9207
 }
9208
 
9209
@@ -1761,7 +1761,7 @@
9210
   n->n = CMPNOP;
9211
 
9212
   if (size < 64 / BITS_PER_MARKER)
9213
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
9214
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
9215
 
9216
   return true;
9217
 }
9218
@@ -2020,7 +2020,7 @@
9219
          {
9220
            int i, size = TYPE_PRECISION (n->type) / BITS_PER_UNIT;
9221
            uint64_t val = int_cst_value (rhs2), mask = 0;
9222
-           uint64_t tmp = (1 << BITS_PER_UNIT) - 1;
9223
+           uint64_t tmp = (1l << BITS_PER_UNIT) - 1;
9224
 
9225
            /* Only constants masking full bytes are allowed.  */
9226
            for (i = 0; i < size; i++, tmp <<= BITS_PER_UNIT)
9227
@@ -2064,7 +2064,7 @@
9228
              {
9229
                /* If STMT casts to a smaller type mask out the bits not
9230
                   belonging to the target type.  */
9231
-               n->n &= ((uint64_t) 1 << (type_size * BITS_PER_MARKER)) - 1;
9232
+               n->n &= ((uint64_t) 1l << (type_size * BITS_PER_MARKER)) - 1;
9233
              }
9234
            n->type = type;
9235
            if (!n->base_addr)
9236
@@ -2177,7 +2177,7 @@
9237
     {
9238
       uint64_t mask;
9239
 
9240
-      mask = ((uint64_t) 1 << (n->range * BITS_PER_MARKER)) - 1;
9241
+      mask = ((uint64_t) 1l << (n->range * BITS_PER_MARKER)) - 1;
9242
       cmpxchg >>= (64 / BITS_PER_MARKER - n->range) * BITS_PER_MARKER;
9243
       cmpnop &= mask;
9244
     }
9245
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/var-tracking.c gcc-5.3.0-zip/gcc/var-tracking.c
9246
--- gcc-5.3.0-original/gcc/var-tracking.c       2015-03-26 09:19:00.000000000 -0400
9247
+++ gcc-5.3.0-zip/gcc/var-tracking.c    2016-03-05 20:43:22.535221161 -0500
9248
@@ -143,6 +143,13 @@
9249
 #include "rtl-iter.h"
9250
 #include "fibonacci_heap.h"
9251
 
9252
+#ifdef DO_ZIP_DEBUG
9253
+#include <stdio.h>
9254
+extern void zip_debug_rtx(const_rtx);
9255
+#define ZIP_DEBUG_LINE(STR,RTX) do {fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
9256
+#else
9257
+#define ZIP_DEBUG_LINE(STR,RTX)
9258
+#endif
9259
 typedef fibonacci_heap <long, basic_block_def> bb_heap_t;
9260
 typedef fibonacci_node <long, basic_block_def> bb_heap_node_t;
9261
 
9262
@@ -6356,6 +6363,7 @@
9263
                machine_mode indmode
9264
                  = TYPE_MODE (TREE_TYPE (argtype));
9265
                rtx mem = gen_rtx_MEM (indmode, x);
9266
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref", mem);
9267
                cselib_val *val = cselib_lookup (mem, indmode, 0, VOIDmode);
9268
                if (val && cselib_preserved_value_p (val))
9269
                  {
9270
@@ -6462,12 +6470,14 @@
9271
       machine_mode mode
9272
        = TYPE_MODE (TREE_TYPE (OBJ_TYPE_REF_EXPR (obj_type_ref)));
9273
       rtx clobbered = gen_rtx_MEM (mode, this_arg);
9274
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered", clobbered);
9275
       HOST_WIDE_INT token
9276
        = tree_to_shwi (OBJ_TYPE_REF_TOKEN (obj_type_ref));
9277
       if (token)
9278
        clobbered = plus_constant (mode, clobbered,
9279
                                   token * GET_MODE_SIZE (mode));
9280
       clobbered = gen_rtx_MEM (mode, clobbered);
9281
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered-2", clobbered);
9282
       x = gen_rtx_CONCAT (mode, gen_rtx_CLOBBER (VOIDmode, pc_rtx), clobbered);
9283
       call_arguments
9284
        = gen_rtx_EXPR_LIST (VOIDmode, x, call_arguments);
9285
@@ -9790,6 +9800,7 @@
9286
              machine_mode indmode
9287
                = TYPE_MODE (TREE_TYPE (TREE_TYPE (parm)));
9288
              rtx mem = gen_rtx_MEM (indmode, incoming);
9289
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/incoming", incoming);
9290
              cselib_val *val = cselib_lookup_from_insn (mem, indmode, true,
9291
                                                         VOIDmode,
9292
                                                         get_insns ());
9293
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgcc/config.host gcc-5.3.0-zip/libgcc/config.host
9294
--- gcc-5.3.0-original/libgcc/config.host       2015-10-01 08:01:18.000000000 -0400
9295
+++ gcc-5.3.0-zip/libgcc/config.host    2016-01-30 15:16:00.459883558 -0500
9296
@@ -195,6 +195,9 @@
9297
 tic6x-*-*)
9298
        cpu_type=c6x
9299
        ;;
9300
+zip*)
9301
+       cpu_type=zip
9302
+       ;;
9303
 esac
9304
 
9305
 # Common parts for widely ported systems.
9306
@@ -1300,6 +1303,9 @@
9307
        echo "*** Configuration ${host} not supported" 1>&2
9308
        exit 1
9309
        ;;
9310
+zip*)
9311
+       tmake_file="${tmake_file} t-softfp-sfdf t-softfp"
9312
+       ;;
9313
 esac
9314
 
9315
 case ${host} in
9316
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgomp/configure.tgt gcc-5.3.0-zip/libgomp/configure.tgt
9317
--- gcc-5.3.0-original/libgomp/configure.tgt    2015-03-13 06:57:07.000000000 -0400
9318
+++ gcc-5.3.0-zip/libgomp/configure.tgt 2016-01-30 15:16:51.323521641 -0500
9319
@@ -150,6 +150,9 @@
9320
        # Need to link with -lpthread so libgomp.so is self-contained.
9321
        XLDFLAGS="${XLDFLAGS} -lpthread"
9322
        ;;
9323
+  zip*)
9324
+        config_path="bsd posix"
9325
+        ;;
9326
 
9327
   *)
9328
        ;;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.