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

Subversion Repositories zipcpu

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

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 111 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/cgraphbuild.c gcc-5.3.0-zip/gcc/cgraphbuild.c
50
--- gcc-5.3.0-original/gcc/cgraphbuild.c        2015-01-09 15:18:42.000000000 -0500
51
+++ gcc-5.3.0-zip/gcc/cgraphbuild.c     2016-03-24 22:13:24.815287808 -0400
52
@@ -62,6 +62,13 @@
53
 #include "ipa-prop.h"
54
 #include "ipa-inline.h"
55
 
56
+#ifdef DO_ZIP_DEBUGS
57
+extern void zip_debug_rtx(const_rtx);
58
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
59
+#else
60
+#define        ZIP_DEBUG_LINE(STR,RTX)
61
+#endif
62
+
63
 /* Context of record_reference.  */
64
 struct record_reference_ctx
65
 {
66 102 dgisselq
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
67
--- gcc-5.3.0-original/gcc/common/config/zip/zip-common.c       1969-12-31 19:00:00.000000000 -0500
68
+++ gcc-5.3.0-zip/gcc/common/config/zip/zip-common.c    2016-02-14 00:54:31.821055716 -0500
69
@@ -0,0 +1,52 @@
70
+////////////////////////////////////////////////////////////////////////////////
71
+//
72
+// Filename:   common/config/zip/zip-common.c
73
+//
74
+// Project:    Zip CPU backend for the GNU Compiler Collection
75
+//
76
+// Purpose:    To eliminate the frame register automatically.
77
+//
78
+// Creator:    Dan Gisselquist, Ph.D.
79
+//             Gisselquist Technology, LLC
80
+//
81
+////////////////////////////////////////////////////////////////////////////////
82
+//
83
+// Copyright (C) 2016, Gisselquist Technology, LLC
84
+//
85
+// This program is free software (firmware): you can redistribute it and/or
86
+// modify it under the terms of  the GNU General Public License as published
87
+// by the Free Software Foundation, either version 3 of the License, or (at
88
+// your option) any later version.
89
+//
90
+// This program is distributed in the hope that it will be useful, but WITHOUT
91
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
92
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
93
+// for more details.
94
+//
95
+// You should have received a copy of the GNU General Public License along
96
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
97
+// target there if the PDF file isn't present.)  If not, see
98
+// <http://www.gnu.org/licenses/> for a copy.
99
+//
100
+// License:    GPL, v3, as defined and found on www.gnu.org,
101
+//             http://www.gnu.org/licenses/gpl.html
102
+//
103
+//
104
+////////////////////////////////////////////////////////////////////////////////
105
+#include "config.h"
106
+#include "system.h"
107
+#include "coretypes.h"
108
+#include "tm.h"
109
+#include "common/common-target.h"
110
+#include "common/common-target-def.h"
111
+
112
+static const struct default_options zip_option_optimization_table[] =
113
+  {
114
+    { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 },
115
+    { OPT_LEVELS_NONE, 0, NULL, 0 }
116
+  };
117
+
118
+#undef TARGET_OPTION_OPTIMIZATION_TABLE
119
+#define        TARGET_OPTION_OPTIMIZATION_TABLE        zip_option_optimization_table
120
+
121
+struct gcc_targetm_common      targetm_common = TARGETM_COMMON_INITIALIZER;
122
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
123 111 dgisselq
--- gcc-5.3.0-original/gcc/config/aarch64/aarch64-linux.h       2016-03-25 10:21:47.127775498 -0400
124 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/aarch64/aarch64-linux.h    2015-07-24 12:00:26.000000000 -0400
125
@@ -21,7 +21,7 @@
126
 #ifndef GCC_AARCH64_LINUX_H
127
 #define GCC_AARCH64_LINUX_H
128
 
129
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
130
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
131
 
132
 #undef  ASAN_CC1_SPEC
133
 #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
134
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
135 111 dgisselq
--- gcc-5.3.0-original/gcc/config/alpha/linux-elf.h     2016-03-25 10:21:47.127775498 -0400
136 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/alpha/linux-elf.h  2015-01-05 07:33:28.000000000 -0500
137
@@ -23,8 +23,8 @@
138
 #define EXTRA_SPECS \
139
 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
140
 
141
-#define GLIBC_DYNAMIC_LINKER   "/tools/lib/ld-linux.so.2"
142
-#define UCLIBC_DYNAMIC_LINKER "/tools/lib/ld-uClibc.so.0"
143
+#define GLIBC_DYNAMIC_LINKER   "/lib/ld-linux.so.2"
144
+#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
145
 #if DEFAULT_LIBC == LIBC_UCLIBC
146
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
147
 #elif DEFAULT_LIBC == LIBC_GLIBC
148
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
149 111 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-eabi.h      2016-03-25 10:21:47.243774882 -0400
150 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/arm/linux-eabi.h   2015-01-05 07:33:28.000000000 -0500
151
@@ -68,8 +68,8 @@
152
    GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI.  */
153
 
154
 #undef  GLIBC_DYNAMIC_LINKER
155
-#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/tools/lib/ld-linux.so.3"
156
-#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/tools/lib/ld-linux-armhf.so.3"
157
+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
158
+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
159
 #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
160
 
161
 #define GLIBC_DYNAMIC_LINKER \
162
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
163 111 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-elf.h       2016-03-25 10:21:47.243774882 -0400
164 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/arm/linux-elf.h    2015-06-23 05:26:54.000000000 -0400
165
@@ -62,7 +62,7 @@
166
 
167
 #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
168
 
169
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
170
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
171
 
172
 #define LINUX_TARGET_LINK_SPEC  "%{h*} \
173
    %{static:-Bstatic} \
174
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/bfin/linux.h gcc-5.3.0-zip/gcc/config/bfin/linux.h
175 111 dgisselq
--- gcc-5.3.0-original/gcc/config/bfin/linux.h  2016-03-25 10:21:47.243774882 -0400
176 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/bfin/linux.h       2015-01-05 07:33:28.000000000 -0500
177
@@ -45,7 +45,7 @@
178
   %{shared:-G -Bdynamic} \
179
   %{!shared: %{!static: \
180
    %{rdynamic:-export-dynamic} \
181
-   -dynamic-linker /tools/lib/ld-uClibc.so.0} \
182
+   -dynamic-linker /lib/ld-uClibc.so.0} \
183
    %{static}} -init __init -fini __fini"
184
 
185
 #undef TARGET_SUPPORTS_SYNC_CALLS
186
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/cris/linux.h gcc-5.3.0-zip/gcc/config/cris/linux.h
187 111 dgisselq
--- gcc-5.3.0-original/gcc/config/cris/linux.h  2016-03-25 10:21:47.243774882 -0400
188 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/cris/linux.h       2015-01-05 07:33:28.000000000 -0500
189
@@ -102,7 +102,7 @@
190
 #undef CRIS_DEFAULT_CPU_VERSION
191
 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
192
 
193
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
194
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
195
 
196
 #undef CRIS_LINK_SUBTARGET_SPEC
197
 #define CRIS_LINK_SUBTARGET_SPEC \
198
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/freebsd-spec.h gcc-5.3.0-zip/gcc/config/freebsd-spec.h
199 111 dgisselq
--- gcc-5.3.0-original/gcc/config/freebsd-spec.h        2016-03-25 10:21:47.243774882 -0400
200 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/freebsd-spec.h     2015-06-25 13:53:14.000000000 -0400
201
@@ -129,9 +129,9 @@
202
 #endif
203
 
204
 #if FBSD_MAJOR < 6
205
-#define FBSD_DYNAMIC_LINKER "/tools/libexec/ld-elf.so.1"
206
+#define FBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.1"
207
 #else
208
-#define FBSD_DYNAMIC_LINKER "/tools/libexec/ld-elf.so.1"
209
+#define FBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
210
 #endif
211
 
212
 /* NOTE: The freebsd-spec.h header is included also for various
213
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/frv/linux.h gcc-5.3.0-zip/gcc/config/frv/linux.h
214 111 dgisselq
--- gcc-5.3.0-original/gcc/config/frv/linux.h   2016-03-25 10:21:47.243774882 -0400
215 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/frv/linux.h        2015-01-05 07:33:28.000000000 -0500
216
@@ -34,7 +34,7 @@
217
 #define ENDFILE_SPEC \
218
   "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
219
 
220
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
221
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
222
 
223
 #undef LINK_SPEC
224
 #define LINK_SPEC "\
225
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/gnu.h gcc-5.3.0-zip/gcc/config/i386/gnu.h
226 111 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/gnu.h    2016-03-25 10:21:47.243774882 -0400
227 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/gnu.h 2015-01-05 07:33:28.000000000 -0500
228
@@ -22,7 +22,7 @@
229
 #define GNU_USER_LINK_EMULATION "elf_i386"
230
 
231
 #undef GNU_USER_DYNAMIC_LINKER
232
-#define GNU_USER_DYNAMIC_LINKER "/tools/lib/ld.so"
233
+#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so"
234
 
235
 #undef STARTFILE_SPEC
236
 #if defined HAVE_LD_PIE
237
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
238 111 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu64.h 2016-03-25 10:21:47.243774882 -0400
239 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu64.h      2015-01-05 07:33:28.000000000 -0500
240
@@ -22,6 +22,6 @@
241
 #define GNU_USER_LINK_EMULATION64 "elf_x86_64_fbsd"
242
 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64_fbsd"
243
 
244
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld.so.1"
245
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib/ld-kfreebsd-x86-64.so.1"
246
-#define GLIBC_DYNAMIC_LINKERX32 "/tools/lib/ld-kfreebsd-x32.so.1"
247
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
248
+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-kfreebsd-x86-64.so.1"
249
+#define GLIBC_DYNAMIC_LINKERX32 "/lib/ld-kfreebsd-x32.so.1"
250
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
251 111 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu.h   2016-03-25 10:21:47.243774882 -0400
252 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu.h        2015-01-05 07:33:28.000000000 -0500
253
@@ -19,4 +19,4 @@
254
 <http://www.gnu.org/licenses/>.  */
255
 
256
 #define GNU_USER_LINK_EMULATION "elf_i386_fbsd"
257
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
258
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
259
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/linux64.h gcc-5.3.0-zip/gcc/config/i386/linux64.h
260 111 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux64.h        2016-03-25 10:21:47.243774882 -0400
261 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/linux64.h     2015-01-05 07:33:28.000000000 -0500
262
@@ -27,6 +27,6 @@
263
 #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
264
 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
265
 
266
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-linux.so.2"
267
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib64/ld-linux-x86-64.so.2"
268
-#define GLIBC_DYNAMIC_LINKERX32 "/tools/libx32/ld-linux-x32.so.2"
269
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
270
+#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
271
+#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
272
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/linux.h gcc-5.3.0-zip/gcc/config/i386/linux.h
273 111 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux.h  2016-03-25 10:21:47.243774882 -0400
274 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/linux.h       2015-01-05 07:33:28.000000000 -0500
275
@@ -20,4 +20,4 @@
276
 <http://www.gnu.org/licenses/>.  */
277
 
278
 #define GNU_USER_LINK_EMULATION "elf_i386"
279
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
280
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
281
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/ia64/linux.h gcc-5.3.0-zip/gcc/config/ia64/linux.h
282 111 dgisselq
--- gcc-5.3.0-original/gcc/config/ia64/linux.h  2016-03-25 10:21:47.243774882 -0400
283 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/ia64/linux.h       2015-01-05 07:33:28.000000000 -0500
284
@@ -55,7 +55,7 @@
285
 /* Define this for shared library support because it isn't in the main
286
    linux.h file.  */
287
 
288
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux-ia64.so.2"
289
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
290
 
291
 #undef LINK_SPEC
292
 #define LINK_SPEC "\
293
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/knetbsd-gnu.h gcc-5.3.0-zip/gcc/config/knetbsd-gnu.h
294 111 dgisselq
--- gcc-5.3.0-original/gcc/config/knetbsd-gnu.h 2016-03-25 10:21:47.243774882 -0400
295 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/knetbsd-gnu.h      2015-01-05 07:33:28.000000000 -0500
296
@@ -32,4 +32,4 @@
297
 
298
 
299
 #undef GNU_USER_DYNAMIC_LINKER
300
-#define GNU_USER_DYNAMIC_LINKER "/tools/lib/ld.so.1"
301
+#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
302
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h gcc-5.3.0-zip/gcc/config/kopensolaris-gnu.h
303 111 dgisselq
--- gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h    2016-03-25 10:21:47.243774882 -0400
304 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/kopensolaris-gnu.h 2015-01-05 07:33:28.000000000 -0500
305
@@ -31,5 +31,4 @@
306
   while (0)
307
 
308
 #undef GNU_USER_DYNAMIC_LINKER
309
-#define GNU_USER_DYNAMIC_LINKER "/tools/lib/ld.so.1"
310
-
311
+#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
312
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/linux.h gcc-5.3.0-zip/gcc/config/linux.h
313 111 dgisselq
--- gcc-5.3.0-original/gcc/config/linux.h       2016-03-25 10:21:47.243774882 -0400
314 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/linux.h    2015-01-05 07:33:28.000000000 -0500
315
@@ -73,10 +73,10 @@
316
    GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
317
    GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
318
    supporting both 32-bit and 64-bit compilation.  */
319
-#define UCLIBC_DYNAMIC_LINKER "/tools/lib/ld-uClibc.so.0"
320
-#define UCLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-uClibc.so.0"
321
-#define UCLIBC_DYNAMIC_LINKER64 "/tools/lib/ld64-uClibc.so.0"
322
-#define UCLIBC_DYNAMIC_LINKERX32 "/tools/lib/ldx32-uClibc.so.0"
323
+#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
324
+#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
325
+#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
326
+#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
327
 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
328
 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
329
 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
330
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
331 111 dgisselq
--- gcc-5.3.0-original/gcc/config/lm32/uclinux-elf.h    2016-03-25 10:21:47.243774882 -0400
332 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/lm32/uclinux-elf.h 2015-01-05 07:33:28.000000000 -0500
333
@@ -67,7 +67,7 @@
334
    %{shared:-shared} \
335
    %{symbolic:-Bsymbolic} \
336
    %{rdynamic:-export-dynamic} \
337
-   -dynamic-linker /tools/lib/ld-linux.so.2"
338
+   -dynamic-linker /lib/ld-linux.so.2"
339
 
340
 #define TARGET_OS_CPP_BUILTINS() GNU_USER_TARGET_OS_CPP_BUILTINS()
341
 
342
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/m68k/linux.h gcc-5.3.0-zip/gcc/config/m68k/linux.h
343 111 dgisselq
--- gcc-5.3.0-original/gcc/config/m68k/linux.h  2016-03-25 10:21:47.243774882 -0400
344 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/m68k/linux.h       2015-01-05 07:33:28.000000000 -0500
345
@@ -71,7 +71,7 @@
346
    When the -shared link option is used a final link is not being
347
    done.  */
348
 
349
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
350
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
351
 
352
 #undef LINK_SPEC
353
 #define LINK_SPEC "-m m68kelf %{shared} \
354
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/microblaze/linux.h gcc-5.3.0-zip/gcc/config/microblaze/linux.h
355 111 dgisselq
--- gcc-5.3.0-original/gcc/config/microblaze/linux.h    2016-03-25 10:21:47.243774882 -0400
356 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/microblaze/linux.h 2015-05-28 10:08:19.000000000 -0400
357
@@ -28,7 +28,7 @@
358
 #undef TLS_NEEDS_GOT
359
 #define TLS_NEEDS_GOT 1
360
 
361
-#define DYNAMIC_LINKER "/tools/lib/ld.so.1"
362
+#define DYNAMIC_LINKER "/lib/ld.so.1"
363
 #undef  SUBTARGET_EXTRA_SPECS
364
 #define SUBTARGET_EXTRA_SPECS \
365
   { "dynamic_linker", DYNAMIC_LINKER }
366
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/mips/linux.h gcc-5.3.0-zip/gcc/config/mips/linux.h
367 111 dgisselq
--- gcc-5.3.0-original/gcc/config/mips/linux.h  2016-03-25 10:21:47.243774882 -0400
368 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/mips/linux.h       2015-01-05 07:33:28.000000000 -0500
369
@@ -22,20 +22,20 @@
370
 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
371
 
372
 #define GLIBC_DYNAMIC_LINKER32 \
373
-  "%{mnan=2008:/tools/lib/ld-linux-mipsn8.so.1;:/tools/lib/ld.so.1}"
374
+  "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
375
 #define GLIBC_DYNAMIC_LINKER64 \
376
-  "%{mnan=2008:/tools/lib64/ld-linux-mipsn8.so.1;:/tools/lib64/ld.so.1}"
377
+  "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}"
378
 #define GLIBC_DYNAMIC_LINKERN32 \
379
-  "%{mnan=2008:/tools/lib32/ld-linux-mipsn8.so.1;:/tools/lib32/ld.so.1}"
380
+  "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}"
381
 
382
 #undef UCLIBC_DYNAMIC_LINKER32
383
 #define UCLIBC_DYNAMIC_LINKER32 \
384
-  "%{mnan=2008:/tools/lib/ld-uClibc-mipsn8.so.0;:/tools/lib/ld-uClibc.so.0}"
385
+  "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
386
 #undef UCLIBC_DYNAMIC_LINKER64
387
 #define UCLIBC_DYNAMIC_LINKER64 \
388
-  "%{mnan=2008:/tools/lib/ld64-uClibc-mipsn8.so.0;:/tools/lib/ld64-uClibc.so.0}"
389
+  "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
390
 #define UCLIBC_DYNAMIC_LINKERN32 \
391
-  "%{mnan=2008:/tools/lib32/ld-uClibc-mipsn8.so.0;:/tools/lib32/ld-uClibc.so.0}"
392
+  "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
393
 
394
 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
395
 #define GNU_USER_DYNAMIC_LINKERN32 \
396
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/mn10300/linux.h gcc-5.3.0-zip/gcc/config/mn10300/linux.h
397 111 dgisselq
--- gcc-5.3.0-original/gcc/config/mn10300/linux.h       2016-03-25 10:21:47.243774882 -0400
398 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/mn10300/linux.h    2015-01-05 07:33:28.000000000 -0500
399
@@ -32,7 +32,7 @@
400
 #undef  ASM_SPEC
401
 #define ASM_SPEC ""
402
 
403
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
404
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
405
 
406
 #undef  LINK_SPEC
407
 #define LINK_SPEC "%{mrelax:--relax} %{shared:-shared} \
408
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
409 111 dgisselq
--- gcc-5.3.0-original/gcc/config/pa/pa-linux.h 2016-03-25 10:21:47.243774882 -0400
410 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/pa/pa-linux.h      2015-09-24 20:04:26.000000000 -0400
411
@@ -37,7 +37,7 @@
412
 /* Define this for shared library support because it isn't in the main
413
    linux.h file.  */
414
 
415
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
416
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
417
 
418
 #undef LINK_SPEC
419
 #define LINK_SPEC "\
420
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/rs6000/linux64.h gcc-5.3.0-zip/gcc/config/rs6000/linux64.h
421 111 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/linux64.h      2016-03-25 10:21:47.243774882 -0400
422 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/rs6000/linux64.h   2015-03-09 19:18:57.000000000 -0400
423
@@ -357,14 +357,14 @@
424
 #undef LINK_OS_DEFAULT_SPEC
425
 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
426
 
427
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld.so.1"
428
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
429
 #ifdef LINUX64_DEFAULT_ABI_ELFv2
430
-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/tools/lib64/ld64.so.1;:/tools/lib64/ld64.so.2}"
431
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
432
 #else
433
-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/tools/lib64/ld64.so.2;:/tools/lib64/ld64.so.1}"
434
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
435
 #endif
436
-#define UCLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-uClibc.so.0"
437
-#define UCLIBC_DYNAMIC_LINKER64 "/tools/lib/ld64-uClibc.so.0"
438
+#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
439
+#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
440
 #if DEFAULT_LIBC == LIBC_UCLIBC
441
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
442
 #elif DEFAULT_LIBC == LIBC_GLIBC
443
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/rs6000/sysv4.h gcc-5.3.0-zip/gcc/config/rs6000/sysv4.h
444 111 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/sysv4.h        2016-03-25 10:21:47.315774500 -0400
445 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/rs6000/sysv4.h     2015-09-24 09:46:45.000000000 -0400
446
@@ -757,8 +757,8 @@
447
 
448
 #define LINK_START_LINUX_SPEC ""
449
 
450
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
451
-#define UCLIBC_DYNAMIC_LINKER "/tools/lib/ld-uClibc.so.0"
452
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
453
+#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
454
 #if DEFAULT_LIBC == LIBC_UCLIBC
455
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
456
 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
457
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/s390/linux.h gcc-5.3.0-zip/gcc/config/s390/linux.h
458 111 dgisselq
--- gcc-5.3.0-original/gcc/config/s390/linux.h  2016-03-25 10:21:47.315774500 -0400
459 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/s390/linux.h       2015-05-11 03:14:10.000000000 -0400
460
@@ -60,8 +60,8 @@
461
 #define MULTILIB_DEFAULTS { "m31" }
462
 #endif
463
 
464
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld.so.1"
465
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib/ld64.so.1"
466
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
467
+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
468
 
469
 #undef  LINK_SPEC
470
 #define LINK_SPEC \
471
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sh/linux.h gcc-5.3.0-zip/gcc/config/sh/linux.h
472 111 dgisselq
--- gcc-5.3.0-original/gcc/config/sh/linux.h    2016-03-25 10:21:47.315774500 -0400
473 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/sh/linux.h 2015-01-05 07:33:28.000000000 -0500
474
@@ -43,7 +43,7 @@
475
 
476
 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
477
 
478
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
479
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
480
 
481
 #undef SUBTARGET_LINK_EMUL_SUFFIX
482
 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
483
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sparc/linux64.h gcc-5.3.0-zip/gcc/config/sparc/linux64.h
484 111 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux64.h       2016-03-25 10:21:47.315774500 -0400
485 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/sparc/linux64.h    2015-01-05 07:33:28.000000000 -0500
486
@@ -84,8 +84,8 @@
487
    When the -shared link option is used a final link is not being
488
    done.  */
489
 
490
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-linux.so.2"
491
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib64/ld-linux.so.2"
492
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
493
+#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
494
 
495
 #ifdef SPARC_BI_ARCH
496
 
497
@@ -193,7 +193,7 @@
498
 #else /* !SPARC_BI_ARCH */
499
 
500
 #undef LINK_SPEC
501
-#define LINK_SPEC "-m elf64_sparc -Y P,%R/tools/lib64 %{shared:-shared} \
502
+#define LINK_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
503
   %{!shared: \
504
     %{!static: \
505
       %{rdynamic:-export-dynamic} \
506
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sparc/linux.h gcc-5.3.0-zip/gcc/config/sparc/linux.h
507 111 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux.h 2016-03-25 10:21:47.315774500 -0400
508 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/sparc/linux.h      2015-01-05 07:33:28.000000000 -0500
509
@@ -83,7 +83,7 @@
510
    When the -shared link option is used a final link is not being
511
    done.  */
512
 
513
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
514
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
515
 
516
 #undef  LINK_SPEC
517
 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
518
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/vax/linux.h gcc-5.3.0-zip/gcc/config/vax/linux.h
519 111 dgisselq
--- gcc-5.3.0-original/gcc/config/vax/linux.h   2016-03-25 10:21:47.315774500 -0400
520 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/vax/linux.h        2015-01-05 07:33:28.000000000 -0500
521
@@ -41,7 +41,7 @@
522
   %{!shared: \
523
     %{!static: \
524
       %{rdynamic:-export-dynamic} \
525
-      -dynamic-linker /tools/lib/ld.so.1} \
526
+      -dynamic-linker /lib/ld.so.1} \
527
     %{static:-static}}"
528
 
529
 #undef  WCHAR_TYPE
530
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/xtensa/linux.h gcc-5.3.0-zip/gcc/config/xtensa/linux.h
531 111 dgisselq
--- gcc-5.3.0-original/gcc/config/xtensa/linux.h        2016-03-25 10:21:47.315774500 -0400
532 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/xtensa/linux.h     2015-01-05 07:33:28.000000000 -0500
533
@@ -44,7 +44,7 @@
534
   %{mlongcalls:--longcalls} \
535
   %{mno-longcalls:--no-longcalls}"
536
 
537
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
538
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
539
 
540
 #undef LINK_SPEC
541
 #define LINK_SPEC \
542
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/netbsd.h gcc-5.3.0-zip/gcc/config/zip/netbsd.h
543
--- gcc-5.3.0-original/gcc/config/zip/netbsd.h  1969-12-31 19:00:00.000000000 -0500
544
+++ gcc-5.3.0-zip/gcc/config/zip/netbsd.h       2016-01-30 15:04:14.796899050 -0500
545
@@ -0,0 +1,82 @@
546
+////////////////////////////////////////////////////////////////////////////////
547
+//
548
+// Filename:   netbsd.h
549
+//
550
+// Project:    Zip CPU backend for the GNU Compiler Collection
551
+//
552
+// Purpose:
553
+//
554
+// Creator:    Dan Gisselquist, Ph.D.
555
+//             Gisselquist Technology, LLC
556
+//
557
+////////////////////////////////////////////////////////////////////////////////
558
+//
559
+// Copyright (C) 2016, Gisselquist Technology, LLC
560
+//
561
+// This program is free software (firmware): you can redistribute it and/or
562
+// modify it under the terms of  the GNU General Public License as published
563
+// by the Free Software Foundation, either version 3 of the License, or (at
564
+// your option) any later version.
565
+//
566
+// This program is distributed in the hope that it will be useful, but WITHOUT
567
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
568
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
569
+// for more details.
570
+//
571
+// You should have received a copy of the GNU General Public License along
572
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
573
+// target there if the PDF file isn't present.)  If not, see
574
+// <http://www.gnu.org/licenses/> for a copy.
575
+//
576
+// License:    GPL, v3, as defined and found on www.gnu.org,
577
+//             http://www.gnu.org/licenses/gpl.html
578
+//
579
+//
580
+////////////////////////////////////////////////////////////////////////////////
581
+#ifndef        ZIP_NETBSD_H
582
+#define        ZIP_NETBSD_H
583
+
584
+/* Define default target values. */
585
+
586
+#undef MACHINE_TYPE
587
+#define        MACHINE_TYPE    "NetBSD/Zip ELF"
588
+
589
+#undef TARGET_OS_CPP_BUILTINS
590
+#define        TARGET_OS_CPP_BUILTINS()        \
591
+       do { NETBSD_OS_CPP_BUILTINS_ELF();              \
592
+       builtin_define("__ZIPCPU__");                   \
593
+       builtin_assert("cpu=zip");                      \
594
+       builtin_assert("machine=zip");                  \
595
+       } while(0);
596
+
597
+#undef CPP_SPEC
598
+#define        CPP_SPEC        NETBSD_CPP_SPEC
599
+
600
+#undef STARTFILE_SPEC
601
+#define        STARTFILE_SPEC  NETBSD_STARTFILE_SPEC
602
+
603
+#undef ENDFILE_SPEC
604
+#define        ENDFILE_SPEC    NETBSD_ENDFILE_SPEC
605
+
606
+#undef LIB_SPEC
607
+#define        LIB_SPEC        NETBSD_LIB_SPEC
608
+
609
+#undef TARGET_VERSION
610
+#define        TARGET_VERSION  fprintf(stderr, " (%s)", MACHINE_TYPE);
611
+
612
+/* Make gcc agree with <machine/ansi.h> */
613
+
614
+#undef WCHAR_TYPE
615
+#define        WCHAR_TYPE      "int"
616
+
617
+#undef WCHAR_TYPE_SIZE
618
+#define        WCHAR_TYPE_SIZE 32
619
+
620
+#undef WINT_TYPE
621
+#define        WINT_TYPE       "int"
622
+
623
+/* Clean up after the generic Zip/ELF configuration. */
624
+#undef MD_EXEC_PREFIX
625
+#undef MD_STARTFILE_PREFIX
626
+
627
+#endif /* ZIP_NETBSD_H */
628
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/t-zip gcc-5.3.0-zip/gcc/config/zip/t-zip
629
--- gcc-5.3.0-original/gcc/config/zip/t-zip     1969-12-31 19:00:00.000000000 -0500
630
+++ gcc-5.3.0-zip/gcc/config/zip/t-zip  2016-02-04 19:00:59.939652587 -0500
631
@@ -0,0 +1,47 @@
632
+################################################################################
633
+##
634
+## Filename:   t-zip
635
+##
636
+## Project:    Zip CPU backend for the GNU Compiler Collection
637
+##
638
+## Purpose:
639
+##
640
+## Creator:    Dan Gisselquist, Ph.D.
641
+##             Gisselquist Technology, LLC
642
+##
643
+################################################################################
644
+##
645
+## Copyright (C) 2016, Gisselquist Technology, LLC
646
+##
647
+## This program is free software (firmware): you can redistribute it and/or
648
+## modify it under the terms of  the GNU General Public License as published
649
+## by the Free Software Foundation, either version 3 of the License, or (at
650
+## your option) any later version.
651
+##
652
+## This program is distributed in the hope that it will be useful, but WITHOUT
653
+## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
654
+## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
655
+## for more details.
656
+##
657
+## You should have received a copy of the GNU General Public License along
658
+## with this program.  (It's in the $(ROOT)/doc directory, run make with no
659
+## target there if the PDF file isn't present.)  If not, see
660
+## <http://www.gnu.org/licenses/> for a copy.
661
+##
662
+## License:    GPL, v3, as defined and found on www.gnu.org,
663
+##             http://www.gnu.org/licenses/gpl.html
664
+##
665
+##
666
+################################################################################
667
+
668
+FPBIT = fp-bit.c
669
+DPBIT = dp-bit.c
670
+
671
+# dp-bit.c: $(srcdir)/config/fp-bit.c
672
+       # cat $(srcdir)/config/fp-bit.c > dp-bit.c
673
+#
674
+# fp-bit.c: $(srcdir)/config/fp-bit.c
675
+       # echo '#define FLOAT" > fp-bit.c
676
+       # cat $(srcdir)/config/fp-bit.c >> fp-bit.c
677
+
678
+
679
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.c gcc-5.3.0-zip/gcc/config/zip/zip.c
680
--- gcc-5.3.0-original/gcc/config/zip/zip.c     1969-12-31 19:00:00.000000000 -0500
681 111 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.c  2016-03-24 21:28:04.199373113 -0400
682
@@ -0,0 +1,2324 @@
683 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
684
+//
685
+// Filename:   zip.c
686
+//
687
+// Project:    Zip CPU backend for the GNU Compiler Collection
688
+//
689
+// Purpose:
690
+//
691
+// Creator:    Dan Gisselquist, Ph.D.
692
+//             Gisselquist Technology, LLC
693
+//
694
+////////////////////////////////////////////////////////////////////////////////
695
+//
696
+// Copyright (C) 2016, Gisselquist Technology, LLC
697
+//
698
+// This program is free software (firmware): you can redistribute it and/or
699
+// modify it under the terms of  the GNU General Public License as published
700
+// by the Free Software Foundation, either version 3 of the License, or (at
701
+// your option) any later version.
702
+//
703
+// This program is distributed in the hope that it will be useful, but WITHOUT
704
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
705
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
706
+// for more details.
707
+//
708
+// You should have received a copy of the GNU General Public License along
709
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
710
+// target there if the PDF file isn't present.)  If not, see
711
+// <http://www.gnu.org/licenses/> for a copy.
712
+//
713
+// License:    GPL, v3, as defined and found on www.gnu.org,
714
+//             http://www.gnu.org/licenses/gpl.html
715
+//
716
+//
717
+////////////////////////////////////////////////////////////////////////////////
718
+#include "config.h"
719
+#include "system.h"
720
+#include "coretypes.h"
721
+#include "tm.h"
722
+#include "rtl.h"
723
+#include "dominance.h"
724
+#include "cfg.h"
725
+#include "cfgrtl.h"
726
+#include "cfganal.h"
727
+#include "lcm.h"
728
+#include "cfgbuild.h"
729
+#include "cfgcleanup.h"
730
+#include "predict.h"
731
+#include "basic-block.h"
732
+#include "df.h"
733
+#include "hashtab.h"
734
+#include "hash-set.h"
735
+#include "machmode.h"
736
+#include "symtab.h"
737
+#include "rtlhash.h"
738
+#include "tree.h"
739
+#include "regs.h"
740
+#include "hard-reg-set.h"
741
+#include "real.h"
742
+#include "insn-config.h"
743
+#include "conditions.h"
744
+#include "output.h"
745
+#include "insn-attr.h"
746
+#include "flags.h"
747
+#include "expr.h"
748
+#include "function.h"
749
+#include "recog.h"
750
+#include "toplev.h"
751
+#include "ggc.h"
752
+#include "builtins.h"
753
+#include "calls.h"
754
+#include "langhooks.h"
755
+#include "optabs.h"
756
+#include "explow.h"
757
+#include "emit-rtl.h"
758
+
759
+// #include "tmp_p.h"
760
+#include "target.h"
761
+#include "target-def.h"
762
+// #include "tm-constrs.h"
763
+// #include "tm-preds.h"
764
+
765
+#include "diagnostic.h"
766
+// #include "integrate.h"
767
+
768
+// static int  zip_arg_partial_bytes(CUMULATIVE_ARGS *, enum machine_mode, tree, bool);
769
+// static      bool    zip_pass_by_reference(CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool);
770
+static bool    zip_return_in_memory(const_tree, const_tree);
771
+static bool    zip_frame_pointer_required(void);
772
+// static      bool    zip_must_pass_in_stack(enum machine_mode, const_tree);
773
+
774
+// static      void    zip_setup_incoming_varargs(CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int);
775
+static void zip_function_arg_advance(cumulative_args_t ca, enum machine_mode mode,
776
+               const_tree type, bool named);
777
+static rtx zip_function_arg(cumulative_args_t ca, enum machine_mode mode, const_tree type, bool named);
778
+
779
+static void    zip_asm_trampoline_template(FILE *);
780
+static void    zip_trampoline_init(rtx, tree, rtx);
781
+static void    zip_init_builtins(void);
782
+static tree zip_builtin_decl(unsigned, bool);
783
+// static void zip_asm_output_anchor(rtx x);
784
+       void    zip_asm_output_def(FILE *s, const char *n, const char *v);
785
+       void    zip_update_cc_notice(rtx exp, rtx_insn *insn);
786
+static rtx     zip_expand_builtin(tree exp, rtx target, rtx subtarget,
787
+                       enum machine_mode tmode, int    ignore);
788
+static bool    zip_scalar_mode_supported_p(enum machine_mode mode);
789
+static bool    zip_libgcc_floating_mode_supported_p(enum machine_mode mode);
790
+static int     zip_address_cost(rtx addr, enum machine_mode mode, addr_space_t as, bool spd);
791
+static bool    zip_mode_dependent_address_p(const_rtx addr, addr_space_t);
792
+static unsigned HOST_WIDE_INT  zip_const_anchor = 0x20000;
793 111 dgisselq
+static          HOST_WIDE_INT  zip_min_opb_imm = -0x200000;
794
+static          HOST_WIDE_INT  zip_max_opb_imm =  0x1fffff;
795 102 dgisselq
+static          HOST_WIDE_INT  zip_min_anchor_offset = -0x20000;
796
+static          HOST_WIDE_INT  zip_max_anchor_offset =  0x1ffff;
797
+static          HOST_WIDE_INT  zip_min_mov_offset = -0x1000;
798
+static          HOST_WIDE_INT  zip_max_mov_offset =  0x0fff;
799
+static int     zip_sched_issue_rate(void) { return 1; }
800
+static bool    zip_legitimate_address_p(machine_mode, rtx, bool);
801
+static bool    zip_legitimate_move_operand_p(machine_mode, rtx, bool);
802
+       void    zip_debug_rtx_pfx(const char *, const_rtx x);
803
+       void    zip_debug_rtx(const_rtx x);
804
+static void    zip_override_options(void);
805
+static bool    zip_can_eliminate(int from ATTRIBUTE_UNUSED, int to);
806
+static int     zip_memory_move_cost(machine_mode, reg_class_t, bool);
807 111 dgisselq
+static rtx     zip_legitimize_address(rtx x, rtx oldx, machine_mode mode);
808 102 dgisselq
+
809
+
810 103 dgisselq
+#define        ALL_DEBUG_OFF   false
811 102 dgisselq
+#define        ALL_DEBUG_ON    false
812
+
813
+enum ZIP_BUILTIN_ID_CODE {
814
+       ZIP_BUILTIN_RTU,
815
+       ZIP_BUILTIN_HALT,
816
+       ZIP_BUILTIN_IDLE,
817
+       ZIP_BUILTIN_SYSCALL,
818
+       ZIP_BUILTIN_SAVE_CONTEXT,
819
+       ZIP_BUILTIN_RESTORE_CONTEXT,
820
+       ZIP_BUILTIN_BITREV,
821
+       ZIP_BUILTIN_CC,
822
+       ZIP_BUILTIN_MAX
823
+};
824
+
825
+static GTY (()) tree   zip_builtins[(int)ZIP_BUILTIN_MAX];
826
+static enum insn_code  zip_builtins_icode[(int)ZIP_BUILTIN_MAX];
827
+
828
+
829
+#include "gt-zip.h"
830
+
831
+/* The Global 'targetm' Variable. */
832
+struct gcc_target      targetm = TARGET_INITIALIZER;
833
+
834
+
835
+enum   reg_class zip_reg_class(int);
836
+
837
+#define        LOSE_AND_RETURN(msgid, x)               \
838
+       do {                                    \
839
+               zip_operand_lossage(msgid, x);  \
840
+               return;                         \
841
+       } while(0)
842
+
843
+/* Per-function machine data. */
844
+struct GTY(()) machine_function
845
+{
846
+       /* number of pretented arguments for varargs */
847
+       int     pretend_size;
848
+
849
+       /* Number of bytes saved on the stack for local variables. */
850
+       int     local_vars_size;
851
+
852
+       /* Number of bytes saved on stack for register save area */
853
+       int     saved_reg_size;
854
+       int     save_ret;
855
+
856
+       int     sp_fp_offset;
857
+       bool    fp_needed;
858
+       int     size_for_adjusting_sp;
859
+};
860
+
861
+/* Allocate a chunk of memory for per-function machine-dependent data. */
862
+
863
+static struct machine_function *
864
+zip_init_machine_status(void) {
865
+       return ggc_cleared_alloc<machine_function>();
866
+}
867
+
868
+static void
869
+zip_override_options(void)
870
+{
871
+       init_machine_status = zip_init_machine_status;
872
+}
873
+
874
+enum   reg_class
875
+zip_reg_class(int regno)
876
+{
877
+       if (is_ZIP_GENERAL_REG(regno)) {
878
+               return GENERAL_REGS;
879
+       } else if (is_ZIP_REG(regno)) {
880
+               return ALL_REGS;
881
+       } return NO_REGS;
882
+}
883
+
884
+/* Worker function for TARGET_RETURN_IN_MEMORY. */
885
+static bool
886
+zip_return_in_memory(const_tree type, const_tree fntype ATTRIBUTE_UNUSED) {
887
+       const   HOST_WIDE_INT size = int_size_in_bytes(type);
888
+       return (size == -1)||(size > UNITS_PER_WORD);
889
+}
890
+
891
+/* Emit an error emssage when we're in an asm, and a fatal error for "normal"
892
+ * insn.  Formatted output isn't easily implemented, since we use output operand
893
+ * lossage to output the actual message and handle the categorization of the
894
+ * error.  */
895
+
896
+static void
897
+zip_operand_lossage(const char *msgid, rtx op) {
898
+       fprintf(stderr, "Operand lossage??\n");
899
+       debug_rtx(op);
900
+       zip_debug_rtx(op);
901
+       output_operand_lossage("%s", msgid);
902
+}
903
+
904
+/* The PRINT_OPERAND_ADDRESS worker.   */
905
+void
906
+zip_print_operand_address(FILE *file, rtx x) {
907
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
908
+
909
+       if (dbg) zip_debug_rtx(x);
910
+       switch(GET_CODE(x)) {
911
+               case REG:
912
+                       fprintf(file, "(%s)", reg_names[REGNO(x)]);
913
+                       break;
914
+               case SYMBOL_REF:
915
+                       fprintf(file, "%s", XSTR(x,0));
916
+                       break;
917
+               case LABEL_REF:
918
+                       x = LABEL_REF_LABEL(x);
919
+               case CODE_LABEL:
920
+                       { char buf[256];
921
+                       ASM_GENERATE_INTERNAL_LABEL(buf, "L", CODE_LABEL_NUMBER(x));
922
+#ifdef ASM_OUTPUT_LABEL_REF
923
+                       ASM_OUTPUT_LABEL_REF(file, buf);
924
+#else
925
+                       assemble_name(file, buf);
926
+#endif
927
+                       }
928
+                       break;
929
+               case PLUS:
930 111 dgisselq
+                       if (!REG_P(XEXP(x, 0))) {
931
+                               fprintf(stderr, "Unsupported address construct\n");
932
+                               zip_debug_rtx(x);
933 102 dgisselq
+                               abort();
934 111 dgisselq
+                       } if (CONST_INT_P(XEXP(x, 1))) {
935 102 dgisselq
+                               if (INTVAL(XEXP(x,1))!=0) {
936
+                                       fprintf(file, "%ld(%s)",
937
+                                       INTVAL(XEXP(x, 1)),
938
+                                       reg_names[REGNO(XEXP(x, 0))]);
939
+                               } else {
940
+                                       fprintf(file, "(%s)",
941
+                                       reg_names[REGNO(XEXP(x, 0))]);
942
+                               }
943
+                       } else if (GET_CODE(XEXP(x,1)) == SYMBOL_REF) {
944
+                               fprintf(file, "%s(%s)", XSTR(x,0),
945
+                                       reg_names[REGNO(XEXP(x, 0))]);
946
+                       } else if ((GET_CODE(XEXP(x, 1)) == MINUS)
947
+                               && (GET_CODE(XEXP(XEXP(x, 1), 0))==SYMBOL_REF)
948
+                               && (GET_CODE(XEXP(XEXP(x, 1), 1))==SYMBOL_REF)) {
949
+                               fprintf(file, "%s-%s(%s)",
950
+                                       XSTR(XEXP(XEXP(x, 1),0),0),
951
+                                       XSTR(XEXP(XEXP(x, 1),1),0),
952
+                                       reg_names[REGNO(XEXP(x, 0))]);
953
+                       } else
954
+                               fprintf(file, "#INVALID(%s)",
955
+                                       reg_names[REGNO(XEXP(x, 0))]);
956
+                       /*
957
+                       else if (GET_CODE(XEXP(addr, 1)) == LABEL)
958
+                               fprintf(file, "%s(%s)",
959
+                                       GET_CODE(XEXP(addr, 1)),
960
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
961
+                       else if ((GET_CODE(XEXP(addr, 1)) == MINUS)
962
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 0))==LABEL)
963
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 1))==LABEL)) {
964
+                               fprintf(file, "%s-%s(%s)",
965
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
966
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
967
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
968
+                       }
969
+                       */
970
+                       break;
971
+               // We don't support direct memory addressing within our
972
+               // instruction set, even though the instructions themselves
973
+               // would support direct memory addressing of the lower 18 bits
974
+               // of memory space.
975
+               case MEM:
976
+                       if (dbg) zip_debug_rtx(x);
977
+                       zip_print_operand_address(file, XEXP(x, 0));
978
+                       break;
979 111 dgisselq
+               case CONST_INT:
980
+                       fprintf(file, "%ld",INTVAL(x));
981
+                       break;
982 102 dgisselq
+               default:
983 111 dgisselq
+                       fprintf(stderr, "Unknown address format\n");
984
+                       zip_debug_rtx(x);
985 102 dgisselq
+                       abort(); break;
986
+                       // output_addr_const(file, x);
987
+               break;
988
+       }
989
+}
990
+
991
+/* The PRINT_OPERAND worker. */
992
+
993
+void
994
+zip_print_operand(FILE *file, rtx x, int code)
995
+{
996
+       rtx operand = x;
997
+       int     rgoff = 0;
998
+
999
+       // fprintf(file, "Print Operand!\n");
1000
+
1001
+       /* New code entries should just be added to the switch below.  If
1002
+        * handling is finished, just return.  If handling was just a
1003
+        * modification of the operand, the modified operand should be put in
1004
+        * "operand", and then do a break to let default handling
1005
+        * (zero-modifier) output the operand.
1006
+        */
1007
+       switch(code) {
1008
+               case 0:
1009
+                       /* No code, print as usual. */
1010
+                       break;
1011
+               case 'L':
1012
+                       /* Lower of two registers, print one up */
1013
+                       rgoff = 1;
1014
+                       break;
1015
+               case 'R':
1016
+               case 'H':
1017
+                       /* Higher of a register pair, print normal */
1018
+                       break;
1019
+
1020
+               default:
1021
+                       LOSE_AND_RETURN("invalid operand modifier letter", x);
1022
+       }
1023
+
1024
+       /* Print an operand as without a modifier letter. */
1025
+       switch (GET_CODE(operand)) {
1026
+       case REG:
1027
+               if (REGNO(operand)+rgoff >= FIRST_PSEUDO_REGISTER)
1028
+                       internal_error("internal error: bad register: %d", REGNO(operand));
1029
+               fprintf(file, "%s", reg_names[REGNO(operand)+rgoff]);
1030
+               return;
1031
+       case SCRATCH:
1032
+               LOSE_AND_RETURN("Need a scratch register", x);
1033
+               return;
1034
+
1035
+       case CODE_LABEL:
1036
+       case LABEL_REF:
1037
+       case SYMBOL_REF:
1038
+       case PLUS:
1039
+               PRINT_OPERAND_ADDRESS(file, operand);
1040
+               return;
1041
+       case MEM:
1042
+               PRINT_OPERAND_ADDRESS(file, XEXP(operand, 0));
1043
+               return;
1044
+
1045
+       default:
1046
+               /* No need to handle all strange variants, let
1047
+                * output_addr_const do it for us.
1048
+                */
1049
+               if (CONSTANT_P(operand)) {
1050
+                       output_addr_const(file, operand);
1051
+                       return;
1052
+               }
1053
+
1054
+               LOSE_AND_RETURN("unexpected operand", x);
1055
+       }
1056
+}
1057
+
1058
+static bool
1059
+zip_frame_pointer_required(void)
1060
+{
1061
+       // This should really depend upon whether we have variable sized
1062
+       // arguments in our frame or not.  Once this fails, let's look
1063
+       // at what the problem was and then whether or not we can detect
1064
+       // it.
1065
+       //
1066
+       // Use a GCC global to determine our answer
1067 103 dgisselq
+       if (cfun->calls_alloca)
1068
+               return true;
1069 102 dgisselq
+       return (frame_pointer_needed);
1070
+/*
1071
+       fprintf(stderr, "ZIP_FRAME_POINTER_REQUIRED()\n");
1072
+       if (frame_pointer_needed) {
1073
+               fprintf(stderr, "FRAME_POINTER_NEEDED is true\n");
1074
+               zip_debug_rtx(frame_pointer_rtx);
1075
+               if (frame_pointer_rtx == NULL_RTX)
1076
+                       return true;
1077
+               if (GET_CODE(frame_pointer_rtx)==PLUS) {
1078
+                       if ((REG_P(XEXP(frame_pointer_rtx,0)))
1079
+                               &&(REGNO(XEXP(frame_pointer_rtx, 0))==zip_SP)
1080
+                               &&(CONST_INT_P(XEXP(frame_pointer_rtx,1))))
1081
+                               return false;
1082
+                       if ((REG_P(XEXP(frame_pointer_rtx,1)))
1083
+                               &&(REGNO(XEXP(frame_pointer_rtx, 1))==zip_SP)
1084
+                               &&(CONST_INT_P(XEXP(frame_pointer_rtx,0))))
1085
+                               return false;
1086
+                       return true;
1087
+               } else if ((REG_P(frame_pointer_rtx))
1088
+                               &&(REGNO(frame_pointer_rtx) == zip_SP))
1089
+                       return false;
1090
+               return true;
1091
+       } else return false;
1092
+*/
1093
+}
1094
+
1095
+/* Determine whether or not a register needs to be saved on the stack or not.
1096
+ */
1097
+static bool
1098
+zip_save_reg(int regno) {
1099
+       if (regno == 0)
1100
+               return ((!crtl->is_leaf)
1101
+                       ||((df_regs_ever_live_p(0))&&(!call_used_regs[0])));
1102
+       else if ((regno == zip_GOT)&&(!ZIP_PIC))
1103
+               return  ((df_regs_ever_live_p(regno))
1104
+                               &&(!call_used_regs[regno]));
1105
+       else if (regno == zip_FP)
1106
+               return((zip_frame_pointer_required())||((df_regs_ever_live_p(regno))
1107
+                               &&(!call_used_regs[regno])));
1108
+       else if (regno < zip_FP)
1109
+               return  ((df_regs_ever_live_p(regno))
1110
+                               &&(!call_used_regs[regno]));
1111
+       return false;
1112
+}
1113
+
1114
+/* Compute the size of the local area and the size to be adjusted by the
1115
+ * prologue and epilogue.
1116
+ *
1117
+ * Here's what we are looking at (top is the current, bottom is the last ...)
1118
+ *
1119
+ *     Stack Pointer ->
1120
+ *                     Local variables (could be variable size)
1121
+ *     Frame Pointer ->        (= Stack Pointer + sp_fp_offset)
1122
+ *                     Saved return address, if saved
1123
+ *                     Other Saved registers
1124
+ *                     Saved frame pointer (if used)
1125
+ *                     Saved R12, if used
1126
+ *                     (Stack pointer is not saved)
1127
+ *     Original stack pointer ->       (= Stack_Pointer +size_for_adjusting_sp)
1128
+ *                     Called arguments (not passed in registers)
1129
+ *                     Return arguments (not R1, args.pretend_args_size)
1130
+ *             (Prior function's stack frame ... )
1131
+ *
1132
+ */
1133
+static void
1134
+zip_compute_frame(void) {
1135
+       int     regno;
1136
+       int     args_size;
1137
+
1138
+       // gcc_assert(crtl);
1139
+       gcc_assert(cfun);
1140
+       gcc_assert(cfun->machine);
1141
+
1142
+       args_size=(ACCUMULATE_OUTGOING_ARGS ? crtl->outgoing_args_size : 0);
1143
+
1144
+       if(crtl->args.pretend_args_size > 0) {
1145
+               args_size += crtl->args.pretend_args_size;
1146
+               // printf("%s pretend_args_size : %d\n", current_function_name(),
1147
+                       // crtl->args.pretend_args_size);
1148
+               cfun->machine->pretend_size = crtl->args.pretend_args_size;
1149
+       }
1150
+
1151
+       cfun->machine->local_vars_size = get_frame_size();
1152
+
1153
+       // Save callee-saved registers.
1154
+       cfun->machine->saved_reg_size = 0;
1155
+       for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1156
+               if (zip_save_reg(regno))
1157
+                       cfun->machine->saved_reg_size ++;
1158
+       }
1159
+
1160
+       cfun->machine->fp_needed = (zip_frame_pointer_required());
1161
+
1162
+       if ((cfun->machine->fp_needed)&&
1163
+                       (!df_regs_ever_live_p(zip_FP))) {
1164
+               cfun->machine->saved_reg_size ++;
1165
+       }
1166
+
1167
+       cfun->machine->sp_fp_offset = args_size + cfun->machine->local_vars_size;
1168
+       cfun->machine->size_for_adjusting_sp = cfun->machine->local_vars_size
1169
+                       + cfun->machine->saved_reg_size
1170
+                       + args_size;
1171
+
1172
+       /*
1173
+       if (cfun->machine->fp_needed)
1174
+               frame_pointer_rtx = gen_rtx_REG(Pmode, zip_FP);
1175
+       else
1176
+               frame_pointer_rtx = plus_constant(Pmode, gen_rtx_REG(Pmode, zip_SP),
1177
+                       cfun->machine->sp_fp_offset);
1178
+       */
1179
+}
1180
+
1181
+void
1182
+zip_expand_prologue(void) {
1183
+       rtx     insn;
1184
+
1185
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1186
+       zip_compute_frame();
1187
+
1188 103 dgisselq
+       if (dbg)  fprintf(stderr, "Computing Prologue instructions\n");
1189 102 dgisselq
+       if (cfun->machine->size_for_adjusting_sp != 0) {
1190
+               insn = emit_insn(gen_subsi3(stack_pointer_rtx,
1191
+                               stack_pointer_rtx,
1192
+                       gen_int_mode(cfun->machine->size_for_adjusting_sp,
1193
+                               SImode)));
1194
+                       // cfun->machine->sp_fp_offset
1195
+
1196
+               RTX_FRAME_RELATED_P(insn) = 1;
1197
+       }
1198
+
1199
+       {
1200
+               int offset = 0, regno;
1201
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1202
+                       if (zip_save_reg(regno)) {
1203
+                               insn=emit_insn(gen_movsi_sto(
1204
+                                       gen_rtx_MEM(SImode, plus_constant(
1205
+                                               Pmode, stack_pointer_rtx,
1206
+                                               cfun->machine->sp_fp_offset
1207
+                                               +offset++, true)),
1208
+                                       gen_rtx_REG(SImode, regno)));
1209
+                               RTX_FRAME_RELATED_P(insn) = 1;
1210
+                       }
1211
+               }
1212 103 dgisselq
+               if (dbg)  fprintf(stderr, "%d registers saved%s\n", offset,
1213
+                       (crtl->saves_all_registers)?", should be all of them":", less than all");
1214 102 dgisselq
+       }
1215
+
1216
+       if (cfun->machine->fp_needed) {
1217
+               if (dbg) zip_debug_rtx(stack_pointer_rtx);
1218
+               if (dbg) zip_debug_rtx(frame_pointer_rtx);
1219
+               insn = emit_insn(gen_movsi_reg_off(frame_pointer_rtx,
1220
+                               stack_pointer_rtx, gen_int_mode(
1221
+                                               cfun->machine->sp_fp_offset,
1222
+                                               SImode)));
1223
+               RTX_FRAME_RELATED_P(insn) = 1;
1224 103 dgisselq
+               if (dbg)  fprintf(stderr, "sp_fp_offset is %d\n", cfun->machine->sp_fp_offset);
1225 102 dgisselq
+       }
1226
+}
1227
+
1228
+bool
1229
+zip_use_return_insn(void)
1230
+{
1231
+       if ((!reload_completed)||(cfun->machine->fp_needed)
1232
+                       ||(get_frame_size()!=0)) {
1233
+               // If R0 ever gets pushed to the stack, then we cannot
1234
+               // use a master return from anywhere.  We need to clean up the
1235
+               // stack first.
1236
+               if ((!crtl->is_leaf)||((df_regs_ever_live_p(0))
1237
+                                               &&(!call_used_regs[0]))) {
1238
+                       return false;
1239
+               }
1240
+       }
1241
+       zip_compute_frame();
1242
+       return (cfun->machine->size_for_adjusting_sp == 0);
1243
+}
1244
+
1245
+/* As per the notes in M68k.c, quote the function epilogue should not depend
1246
+ * upon the current stack pointer.  It should use the frame poitner only,
1247
+ * if there is a frame pointer.  This is mandatory because of alloca; we also
1248
+ * take advantage of it to omit stack adjustments before returning ...
1249
+ *
1250
+ * Let's see if we can use their approach here.
1251
+ *
1252
+ * We can't.  Consider our choices:
1253
+ *     LOD (FP),R0
1254
+ *     LOD 1(FP),R4
1255
+ *     LOD 2(FP),R5
1256
+ *     LOD 3(FP),R6
1257
+ *     LOD 4(FP),FP
1258
+ *     ... Then what is the stack pointer?
1259
+ * or
1260
+ *     LOD (FP),R0
1261
+ *     LOD 1(FP),R4
1262
+ *     LOD 2(FP),R5
1263
+ *     LOD 3(FP),R6
1264
+ *     MOV FP,SP
1265
+ *     LOD 4(SP),FP
1266
+ *     ... Which suffers unnecessary pipeline stalls, and certainly doesn't
1267
+ *     exploit our pipeline memory function
1268
+ * or
1269
+ *     MOV FP,SP
1270
+ *     LOD (SP),R0
1271
+ *     LOD 1(SP),R4
1272
+ *     LOD 2(SP),R5
1273
+ *     LOD 3(SP),R6
1274
+ *     LOD 4(SP),FP
1275
+ * Which will be our choice.  Note that we do use the stack pointer, eventually.
1276
+ *
1277
+ */
1278
+void
1279
+zip_expand_epilogue(void) {
1280
+       int     regno, offset;
1281
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1282
+
1283
+       zip_compute_frame();
1284
+
1285
+       if (dbg) fprintf(stderr, "EPILOG::\n");
1286
+       if (cfun->machine->fp_needed) {
1287
+               if (dbg) fprintf(stderr, "EPILOG::Moving frame pointer to stack register\n");
1288
+               emit_insn(gen_movsi_reg(stack_pointer_rtx, frame_pointer_rtx));
1289
+       }
1290
+
1291
+       if (cfun->machine->saved_reg_size != 0) {
1292
+               offset =  (cfun->machine->size_for_adjusting_sp -
1293
+                               cfun->machine->sp_fp_offset
1294
+                       - cfun->machine->saved_reg_size);
1295
+               if (dbg) fprintf(stderr, "EPILOG::Saved_REG_Size = %d\n", cfun->machine->saved_reg_size);
1296
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1297
+                       if (zip_save_reg(regno)) {
1298
+                               if (dbg) fprintf(stderr, "EPILOG::RESTORING R%d\n", regno);
1299
+                               emit_insn(gen_movsi_lod(
1300
+                                               gen_rtx_REG(SImode, regno),
1301
+                                       gen_rtx_MEM(SImode, plus_constant( SImode,
1302
+                                               stack_pointer_rtx, offset++, true))));
1303
+                       }
1304
+               }
1305
+       }
1306
+
1307
+       if (cfun->machine->size_for_adjusting_sp != 0) {
1308
+               if (dbg) fprintf(stderr, "EPILOG::ADDSI3(StackPtr, %d)\n",
1309
+                               cfun->machine->size_for_adjusting_sp);
1310
+               emit_insn(gen_addsi3(stack_pointer_rtx, stack_pointer_rtx,
1311
+                       gen_int_mode(
1312
+                               cfun->machine->size_for_adjusting_sp
1313
+                               -cfun->machine->sp_fp_offset, SImode)));
1314
+       }
1315
+       if (dbg) fprintf(stderr, "EPILOG::EMITTING-RETURN\n");
1316
+
1317
+       emit_jump_insn(ret_rtx);
1318
+}
1319
+
1320
+/* Implement RETURN_ADDR_RTX(COUNT, FRAMEADDR).
1321
+ *
1322
+ * We currently only support calculating the return address for the current
1323
+ * frame.
1324
+ */
1325
+
1326
+/*
1327
+rtx
1328
+zip_return_addr_rtx(int count, rtx frame ATTRIBUTE_UNUSED)
1329
+{
1330
+       if (count)
1331
+               return NULL_RTX;
1332
+
1333
+       zip_compute_frame();
1334
+
1335
+       // saved return address for current function is at fp - 1
1336
+       if (cfun->machine->save_ret)
1337
+               return gen_rtx_MEM(Pmode, plus_constant(frame_pointer_rtx,
1338
+                               -UNITS_PER_WORD));
1339
+       return get_hard_reg_initial_val(Pmode, RETURN_ADDRESS_REGNUM);
1340
+}
1341
+*/
1342
+
1343
+/* Implements the macro INITIAL_ELIMINATION_OFFSET,
1344
+ * return the OFFSET.
1345
+ */
1346
+/*
1347
+int
1348
+zip_initial_elimination_offset(int from, int to) {
1349
+       int     ret = 0;
1350
+       zip_compute_frame();
1351
+
1352
+       if (((from) == FRAME_POINTER_REGNUM)&&((to) == STACK_POINTER_REGNUM)) {
1353
+               ret = cfun->machine->sp_fp_offset;
1354
+       } else if (((from)=ARG_POINTER_REGNUM)&&((to)==FRAME_POINTER_REGNUM)) {
1355
+               ret = cfun->machine->local_vars_size;
1356
+       } else {
1357
+               abort();
1358
+       }
1359
+
1360
+       return ret;
1361
+}
1362
+*/
1363
+
1364
+/* Return non-zero if the function argument described by TYPE is to be passed
1365
+ * by reference.
1366
+ */
1367
+/*
1368
+static bool
1369
+zip_pass_by_reference(CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
1370
+               enum machine_mode mode, const_tree type,
1371
+               bool name ATTRIBUTE_UNUSED) {
1372
+       unsigned        HOST_WIDE_INT   size;
1373
+
1374
+       if (type) {
1375
+               if (AGGREGATE_TYPE_P(type)) {
1376
+                       return TRUE;
1377
+               } size = int_size_in_bytes(type);
1378
+       } else
1379
+               size = GET_MODE_SIZE(mode);
1380
+
1381
+       return (size > GET_MODE_SIZE(SImode)); // > 1 word : is this okay?
1382
+       // The idea is to pass everything larger than an int by reference (or
1383
+       // on the stack)
1384
+}
1385
+*/
1386
+
1387
+/*
1388
+ * Code taken from m68k ...
1389
+ */
1390
+static bool
1391
+zip_can_eliminate(int from, int to)
1392
+{
1393
+       // fprintf(stderr, "CAN_ELIMINATE::QUERYING(%d,%d)\n", from, to);
1394
+       if ((from == zip_FP)&&(to == zip_SP))
1395
+               return !cfun->machine->fp_needed;
1396
+       return true;
1397
+}
1398
+
1399
+/*
1400
+static bool
1401
+zip_must_pass_in_stack(enum machine_mode mode, const_tree type)
1402
+{
1403
+       if (mode == BLKmode) {
1404
+               return true;
1405
+       } if (type == NULL) {
1406
+               return false;
1407
+       } return AGGREGATE_TYPE_P(type);
1408
+}
1409
+*/
1410
+
1411
+/*
1412
+static void
1413
+zip_basic_check(void)
1414
+{
1415
+       gcc_assert(mode_base_align[SImode]==4);
1416
+       if ((BITS_PER_UNIT != 32)
1417
+                       ||(GET_MODE_SIZE(SImode)!=1)
1418
+                       ||(GET_MODE_SIZE(DImode)!=1)
1419
+                       ||(HARD_REGNO_NREGS(0,SImode)!=1)) {
1420
+               printf("SIZEOF(SIMode) == %d\n", GET_MODE_SIZE(SImode));
1421
+               printf("BITS_PER_UNIT  == %d\n", BITS_PER_UNIT);
1422
+               gcc_assert(BITS_PER_UNIT==32);
1423
+               gcc_assert(GET_MODE_SIZE(SImode)==1);
1424
+               gcc_assert(HARD_REGNO_NREGS(0,SImode)==1);
1425
+       }
1426
+}
1427
+*/
1428
+
1429
+#define        zip_basic_check()
1430
+
1431
+/* Compute the number of word sized regiters needed to hold a function
1432
+ * argument of mode INT_MODE and tree type TYPE.
1433
+ */
1434
+int
1435
+zip_num_arg_regs(enum machine_mode mode, const_tree type) {
1436
+       int     size;
1437
+
1438
+       zip_basic_check();
1439
+
1440
+       if (targetm.calls.must_pass_in_stack(mode, type))
1441
+               return 0;
1442
+
1443
+       if ((type)&&(mode == BLKmode))
1444
+               size = int_size_in_bytes(type);
1445
+       else
1446
+               size = GET_MODE_SIZE(mode);
1447
+
1448
+       return (size + UNITS_PER_WORD - 1)/UNITS_PER_WORD;
1449
+}
1450
+
1451
+/* pushed in function prologue */
1452
+/*
1453
+static void
1454
+zip_setup_incoming_varargs(CUMULATIVE_ARGS *cum, enum machine_mode mode,
1455
+               tree type, int *pretend_size, int no_rtl) {
1456
+       if (no_rtl)
1457
+               return;
1458
+
1459
+       gcc_assert(mode != BLKmode);
1460
+
1461
+       if (*cum < (ZIP_LAST_ARG_REGNO+1)) {
1462
+               int size = ZIP_FIRST_ARG_REGNO + ZIP_NUM_ARGS_REGS - *cum;
1463
+               rtx     regblock;
1464
+               int     offset = (*cum - ZIP_FIRST_ARG_REGNO) * UNITS_PER_WORD;
1465
+               regblock = gen_rtx_MEM(BLKmode,
1466
+                       plus_constant(arg_pointer_rtx, offset));
1467
+               move_block_from_reg(*cum, regblock, size);
1468
+               *pretend_size = size * UNITS_PER_WORD;
1469
+       }
1470
+
1471
+       if (targetm.calls.strict_argument_naming(cum))
1472
+               *cum = *cum + zip_num_arg_regs(mode, type);
1473
+}
1474
+*/
1475
+
1476
+/*
1477
+static int
1478
+zip_arg_partial_bytes(CUMULATIVE_ARGS *cum, enum machine_mode mode,
1479
+               tree type, bool name ATTRIBUTE_UNUSED) {
1480
+       int     words;
1481
+       unsigned int    regs = zip_num_arg_regs(mode, type);
1482
+
1483
+       if (*cum >= ZIP_LAST_ARG_REGNO + 1)
1484
+               words = 0;
1485
+       else if ((*cum + regs) > ZIP_LAST_ARG_REGNO + 1)
1486
+               words = (*cum + regs) - ZIP_LAST_ARG_REGNO + 1;
1487
+       else
1488
+               words = 0;
1489
+
1490
+       return words * UNITS_PER_WORD;
1491
+}
1492
+*/
1493
+
1494
+static void
1495
+zip_function_arg_advance(cumulative_args_t ca, machine_mode mode,
1496
+               const_tree type, bool named ATTRIBUTE_UNUSED) {
1497
+       CUMULATIVE_ARGS *cum;
1498
+       int     nreg;
1499
+
1500
+       zip_basic_check();
1501
+
1502
+       cum = get_cumulative_args(ca);
1503
+       nreg = zip_num_arg_regs(mode, type);
1504
+       if (((*cum)+nreg) > NUM_ARG_REGS)
1505
+               (*cum) = NUM_ARG_REGS;
1506
+       else
1507
+               (*cum) += nreg;
1508
+}
1509
+
1510
+static rtx
1511
+zip_function_arg(cumulative_args_t ca, machine_mode mode,
1512
+               const_tree type ATTRIBUTE_UNUSED, bool named) {
1513
+       CUMULATIVE_ARGS *cum;
1514
+
1515
+       zip_basic_check();
1516
+
1517
+
1518
+       if (!named)
1519
+               return NULL_RTX;
1520
+       //if (targetm.calls.must_pass_in_stack(mode, type))
1521
+               //return NULL_RTX;
1522
+       cum = get_cumulative_args(ca);
1523
+
1524
+       if ((*cum) >= NUM_ARG_REGS)
1525
+               return NULL_RTX;
1526
+       return
1527
+               gen_rtx_REG(mode, (*cum)+1);
1528
+}
1529
+
1530
+/* NOTICE_UPDATE_CC sends us here
1531
+ */
1532
+void
1533
+zip_update_cc_notice(rtx exp, rtx_insn *insn)
1534
+{
1535
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1536
+       enum    attr_ccresult  ccr;
1537
+       enum    attr_conditional  conditionally_executed;
1538
+
1539
+       // The default is that nothing has changed.
1540
+       // cc_status = cc_status_prev;
1541
+       rtx     src, dest;
1542
+
1543
+       if (dbg) fprintf(stderr, "CC-NOTICE ...\n");
1544
+       if (dbg) zip_debug_rtx_pfx("CC :", exp);
1545
+       if (dbg) debug_rtx(exp);
1546
+
1547
+       ccr = get_attr_ccresult(insn);
1548
+       if (ccr == CCRESULT_UNKNOWN) {
1549
+               CC_STATUS_INIT;
1550
+               if (dbg) fprintf(stderr, "\tINIT-CC\n");
1551
+               return;
1552
+       }
1553
+
1554
+       if ((GET_CODE(exp) == PARALLEL)&&(GET_CODE(XVECEXP(exp, 0, 0))==SET)) {
1555
+               // This works up and until we add cc0 parallel instructions
1556
+               // to our instruction set.
1557
+               dest = SET_DEST(XVECEXP(exp, 0, 0));
1558
+               src  = SET_SRC (XVECEXP(exp, 0, 0));
1559
+       } else if (GET_CODE(exp) == SET) {
1560
+               dest = SET_DEST(exp);
1561
+               src  = SET_SRC (exp);
1562
+       } else {
1563
+               // First, do nothing if we haven't touched the condition codes.
1564
+               // Condition codes can only be changed as a result of a set
1565
+               // expression ...?
1566
+               if (dbg) fprintf(stderr, "Non-set expression, doesn\'t touch condition codes\n");
1567
+               return;
1568
+       }
1569
+
1570 111 dgisselq
+
1571
+       if (ccr == CCRESULT_UNCHANGED) {
1572
+               if (dbg) fprintf(stderr, "\tUnchanged CC\n");
1573
+
1574
+               // We can't just run away here ... even though the CC result
1575
+               // hasn't changed, GCC's ability to recognize it as a valid
1576
+               // result has changed.  In other words, if we just 'set' a
1577
+               // value contained within either value1 or value2, then we'll
1578
+               // need to update those values so that they are no longer looked
1579
+               // upon as potentially containing the current CC values.
1580
+
1581
+               if (dest) {
1582
+                       if (dest == cc0_rtx)
1583
+                               CC_STATUS_INIT;
1584
+                       else if ((REG_P(dest))&&(dest != pc_rtx)) {
1585
+                               // An example here might be a load instruction
1586
+                               if (reg_mentioned_p(dest, cc_status.value1))
1587
+                                       cc_status.value1 = NULL_RTX;
1588
+                               if (reg_mentioned_p(dest, cc_status.value2))
1589
+                                       cc_status.value2 = NULL_RTX;
1590
+                       }
1591
+               }
1592
+               return;
1593
+       }
1594
+
1595 102 dgisselq
+       // Gotta wait on this test, until we know whether or not the
1596
+       // conditionally executed instruction was designed to set the
1597
+       // CC0 register.
1598
+       conditionally_executed = get_attr_conditional(insn);
1599
+       if ((conditionally_executed == CONDITIONAL_YES)&&(dest != cc0_rtx)) {
1600
+               // cc_status is unchanged
1601 111 dgisselq
+               // However, GCC's vision of it may have changed
1602
+               //
1603
+               // Initialize CC_STATUS
1604 102 dgisselq
+               if (dbg) fprintf(stderr, "\tCC -- unchanged (conditional exec)\n");
1605 111 dgisselq
+               CC_STATUS_INIT;
1606 102 dgisselq
+               return;
1607 111 dgisselq
+       } else if (GET_CODE(src)==IF_THEN_ELSE) {
1608
+               // Same thing as above
1609
+               CC_STATUS_INIT;
1610
+               return;
1611 102 dgisselq
+       }
1612
+
1613
+       if (ccr == CCRESULT_VALIDZN)
1614
+               cc_status.flags = CC_NO_OVERFLOW;
1615
+       else
1616
+               cc_status.flags = 0;
1617
+       cc_status.value1 = dest;
1618
+       if (dest == cc0_rtx)
1619
+               cc_status.value2 = src;
1620
+       else if((REG_P(dest))&&(!reg_mentioned_p(dest, src)))
1621
+               cc_status.value2 = src;
1622
+       else if((SUBREG_P(dest))&&(!reg_mentioned_p(XEXP(dest,0), src)))
1623
+               cc_status.value2 = src;
1624
+       else
1625
+               cc_status.value2 = 0;
1626
+       if (dbg) fprintf(stderr, "\tCC -- Set flags for\n");
1627
+       if (dbg) zip_debug_rtx_pfx("V1: ", dest);
1628
+       if ((dbg)&&(cc_status.value2)) zip_debug_rtx_pfx("V2: ", src);
1629
+       else if (dbg)   fprintf(stderr, "V2: (No SRC)\n");
1630
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "src refers to dest ?? %s\n",
1631
+               refers_to_regno_p(REGNO(dest),REGNO(dest),src,NULL)?"Yes":"No");
1632
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "Occurrs %d times\n",
1633
+               count_occurrences(dest,src,0));
1634
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "%s mentioned\n",
1635
+               reg_mentioned_p(dest,src)?"Is":"Is not");
1636
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "%s referenced\n",
1637
+               reg_referenced_p(dest,src)?"Is":"Is not");
1638
+
1639
+//
1640
+// These results are only used in final.c, where they are used to remove
1641
+// compare instructions if the optimizer is on.  If I produce nothing, no
1642
+// compare instructions will be removed.  If I produce something, a smart
1643
+// decision may be made to remove compare instructions.
1644
+//
1645
+// cc_status will be compared  with subsequent
1646
+//     (set (cc0) (something)) (i.e. compare only) instructions
1647
+//
1648
+//     (set (cc0) (compare (x) (y)))
1649
+//     dst = cc0 -- the destination of the set is ignored, save that it must be
1650
+//             cc0
1651
+//     src1 = (compare (x) (y))
1652
+//     if (src1 == compare)&&(y == (const_int 0))
1653
+//             src2 = (x)
1654
+//     else
1655
+//             src2 = null
1656
+//
1657
+//     Four conditions:
1658
+//     1. if (val1)&&(src1 == val1)
1659
+//             This would be true if I had seen a (set (val1) (src1)) insn
1660
+//             If I have seen a (set (val1) (src1))
1661
+//                     or equivalently a (set (val1) (compare (x) (y)))
1662
+//     or
1663
+//     2. if (val2)&&(src1 == val2)
1664
+//             This would be true if I had seen a (set (val1) (src1)) insn,
1665
+//             and only if val2 was still valid.
1666
+//     or
1667
+//     3. if (src2)&&(value1)&&(src2 == value1)
1668
+//             This would be true if we are comparing against zero, and the
1669
+//             number we are comparing against zero is value 1
1670
+//     or
1671
+//     4. if (src2)&&(value2)&&(src2 == value2)
1672
+//             ... or value2.  This is the common ZipCPU case.
1673
+//
1674
+//             then delete the compare.
1675
+//
1676
+}
1677
+
1678
+
1679
+/* totally buggy - we can't return pointers to nested functions */
1680
+static void
1681
+zip_asm_trampoline_template(FILE *f) {
1682
+       // Whereas at one time I thought I wouldn't need it, now I know I
1683
+       // need this trampoline function, although it is for a completely
1684
+       // different purpose than the one I was familiar with.
1685
+       fprintf(f, "\tldihi 0,r1\n");
1686
+       fprintf(f, "\tldilo 0,r1\n");
1687
+       fprintf(f, "\tjmp r1\n");
1688
+}
1689
+
1690
+/* Worker function for TARGET_TRAMPOLINE_INIT. */
1691
+static void
1692
+zip_trampoline_init(rtx m_tramp ATTRIBUTE_UNUSED,
1693
+       tree fndecl ATTRIBUTE_UNUSED,
1694
+       rtx chain_value ATTRIBUTE_UNUSED) {
1695
+// #warning "This needs to be filled out"
1696
+       abort();
1697
+}
1698
+
1699
+static tree
1700
+def_builtin(const char *name, enum insn_code icode, enum ZIP_BUILTIN_ID_CODE code,
1701
+       tree type)
1702
+{
1703
+       tree t = add_builtin_function(name,type,code,BUILT_IN_MD, NULL, NULL_TREE);
1704
+       zip_basic_check();
1705
+
1706
+       if(t) {
1707
+               zip_builtins[code] = t;
1708
+               zip_builtins_icode[code] = icode;
1709
+       }
1710
+
1711
+       return t;
1712
+
1713
+}
1714
+
1715
+void   zip_init_builtins(void) {
1716
+       zip_basic_check();
1717
+
1718
+  tree void_ftype_void = build_function_type_list(void_type_node, NULL_TREE);
1719
+#ifdef HAVE_zip_rtu
1720
+  def_builtin("zip_rtu", CODE_FOR_zip_rtu, ZIP_BUILTIN_RTU, void_ftype_void);
1721
+#endif
1722
+#ifdef HAVE_zip_halt
1723
+  def_builtin("zip_halt",  CODE_FOR_zip_halt,  ZIP_BUILTIN_HALT, void_ftype_void);
1724
+#endif
1725
+#ifdef HAVE_zip_idle
1726
+  def_builtin("zip_idle", CODE_FOR_zip_idle, ZIP_BUILTIN_IDLE, void_ftype_void);
1727
+#endif
1728
+
1729
+#ifdef HAVE_zip_syscall
1730
+// Support int SYSCALL(callID, int a, int b, int c);
1731
+  def_builtin("zip_syscall", CODE_FOR_zip_syscall, ZIP_BUILTIN_SYSCALL,
1732
+                       build_function_type_list(void_type_node, NULL_TREE));
1733
+#endif
1734
+
1735
+#ifdef HAVE_zip_save_context
1736
+  def_builtin("zip_save_context", CODE_FOR_zip_save_context, ZIP_BUILTIN_SAVE_CONTEXT,
1737
+               build_function_type_list(void_type_node, ptr_type_node, 0));
1738
+#endif
1739
+
1740
+#ifdef HAVE_zip_restore_context
1741
+  def_builtin("zip_restore_context", CODE_FOR_zip_restore_context, ZIP_BUILTIN_RESTORE_CONTEXT,
1742
+       build_function_type_list(void_type_node, ptr_type_node, 0));
1743
+#endif
1744
+
1745
+#ifdef HAVE_zip_bitrev
1746
+  def_builtin("zip_bitrev", CODE_FOR_zip_bitrev, ZIP_BUILTIN_BITREV,
1747
+       build_function_type_list(unsigned_type_node, unsigned_type_node,
1748
+               NULL_TREE));
1749
+#endif
1750
+
1751
+#ifdef HAVE_zip_cc
1752
+  def_builtin("zip_cc", CODE_FOR_zip_cc, ZIP_BUILTIN_CC,
1753
+       build_function_type_list(unsigned_type_node, NULL_TREE));
1754
+#endif
1755
+
1756
+}
1757
+
1758
+static tree
1759
+zip_builtin_decl(unsigned zip_builtin_code, bool initialize_p ATTRIBUTE_UNUSED)
1760
+{
1761
+  if (zip_builtin_code >= ZIP_BUILTIN_MAX)
1762
+    return error_mark_node;
1763
+
1764
+  return zip_builtins[zip_builtin_code];
1765
+}
1766
+
1767
+static rtx
1768
+zip_expand_builtin(tree exp, rtx target,
1769
+               rtx subtarget ATTRIBUTE_UNUSED,
1770
+               machine_mode tmode ATTRIBUTE_UNUSED,
1771
+               int     ignore ATTRIBUTE_UNUSED) {
1772
+
1773
+       tree    fndecl = TREE_OPERAND(CALL_EXPR_FN(exp), 0);
1774
+       bool    nonvoid = (TREE_TYPE(TREE_TYPE(fndecl)) != void_type_node);
1775
+       enum    ZIP_BUILTIN_ID_CODE code=(enum ZIP_BUILTIN_ID_CODE)DECL_FUNCTION_CODE(fndecl);
1776
+       enum    insn_code icode = zip_builtins_icode[code];
1777
+       rtx     pat, op[5];
1778
+       call_expr_arg_iterator  iter;
1779
+       tree    arg;
1780
+
1781
+       if ((code == ZIP_BUILTIN_SAVE_CONTEXT)
1782
+                       ||(code == ZIP_BUILTIN_RESTORE_CONTEXT)) {
1783
+               arg = first_call_expr_arg(exp, &iter);
1784
+               if (arg == error_mark_node)
1785
+                       return NULL_RTX;
1786
+               op[0] = expand_normal(arg);
1787
+               if (GET_CODE(op[0]) != REG)
1788
+                       op[0] = force_reg(Pmode, op[0]);
1789
+               pat = GEN_FCN(icode)(op[0]);
1790
+       } else if (code == ZIP_BUILTIN_BITREV) {
1791
+               arg = first_call_expr_arg(exp, &iter);
1792
+               if (arg == error_mark_node) {
1793
+                       return NULL_RTX;
1794
+               }
1795
+               op[0] = expand_normal(arg);
1796
+               if (!target)
1797
+                       target = gen_reg_rtx(SImode);
1798
+               pat = GEN_FCN(icode)(target, op[0]);
1799
+       } else if (code == ZIP_BUILTIN_CC) {
1800
+               if (!target)
1801
+                       target = gen_reg_rtx(SImode);
1802
+               pat = GEN_FCN(icode)(target);
1803
+       } else // RTU, HALT, IDLE
1804
+               pat = GEN_FCN(icode)();
1805
+       if (!pat)
1806
+               return NULL_RTX;
1807
+       emit_insn(pat);
1808
+       return (nonvoid ? target : const0_rtx);
1809
+}
1810
+
1811
+static bool
1812
+zip_scalar_mode_supported_p(enum machine_mode mode) {
1813
+       zip_basic_check();
1814
+
1815
+       return ((mode)==SImode)||((mode)==DImode); // ||((mode)==SFmode);
1816
+}
1817
+
1818
+static bool
1819
+zip_libgcc_floating_mode_supported_p(enum machine_mode mode) {
1820
+       return ((mode)==SFmode)||((mode)==DFmode);
1821
+}
1822
+
1823
+static int
1824
+zip_address_cost(rtx addr ATTRIBUTE_UNUSED,
1825
+       enum machine_mode mode ATTRIBUTE_UNUSED,
1826
+       addr_space_t as ATTRIBUTE_UNUSED, bool spd ATTRIBUTE_UNUSED) {
1827
+       return 1;
1828
+}
1829
+
1830
+static bool
1831
+zip_mode_dependent_address_p(const_rtx addr ATTRIBUTE_UNUSED,
1832
+       addr_space_t as ATTRIBUTE_UNUSED) {
1833
+       return false;
1834
+}
1835
+
1836
+/*
1837
+static void
1838
+zip_asm_output_anchor(rtx x) {
1839
+       printf("ANCHOR: OP(%d)\n", GET_CODE(x));
1840
+}
1841
+*/
1842
+
1843
+static void
1844
+zip_debug_print(const char *pfx, int lvl, const char *str) {
1845
+       int     i;
1846
+       i = lvl;
1847
+       if ((true)||(lvl == 0))
1848
+               fprintf(stderr, "%s", pfx);
1849
+       else
1850
+               i += strlen(pfx);
1851
+       while(i-->0)
1852
+               fprintf(stderr, "  ");
1853
+       fprintf(stderr, "%s\n", str);
1854
+}
1855
+
1856
+static void
1857
+zip_debug_print_m(const char *pfx, int lvl, const char *str, enum machine_mode m) {
1858
+       int     i;
1859
+
1860
+       i = lvl;
1861
+       if ((true)||(lvl == 0))
1862
+               fprintf(stderr, "%s", pfx);
1863
+       else
1864
+               i = lvl+strlen(pfx);
1865
+       while(i-->0)
1866
+               fprintf(stderr, "  ");
1867
+       switch(m) {
1868
+               case VOIDmode:
1869
+                       fprintf(stderr, "%s:V\n", str);
1870
+                       break;
1871
+               case BLKmode:
1872
+                       fprintf(stderr, "%s:BLK\n", str);
1873
+                       break;
1874
+               case BImode:
1875
+                       fprintf(stderr, "%s:BI\n", str);
1876
+                       break;
1877
+#ifdef HAVE_QImode
1878
+               case QImode:
1879
+                       fprintf(stderr, "%s:QI\n", str);
1880
+                       break;
1881
+#endif
1882
+#ifdef HAVE_HImode
1883
+               case HImode:
1884
+                       fprintf(stderr, "%s:HI\n", str);
1885
+                       break;
1886
+#endif
1887
+               case SImode:
1888
+                       fprintf(stderr, "%s:SI\n", str);
1889
+                       break;
1890
+               case DImode:
1891
+                       fprintf(stderr, "%s:DI\n", str);
1892
+                       break;
1893
+               default:
1894
+                       fprintf(stderr, "%s:?\n", str);
1895
+       }
1896
+}
1897
+
1898
+static void
1899
+zip_debug_rtx_1(const char *pfx, const_rtx x, int lvl) {
1900
+       if (x == NULL_RTX) {
1901
+               zip_debug_print(pfx, lvl, "(NULL-RTX)");
1902
+               return;
1903
+       } else if (GET_CODE(x) > NUM_RTX_CODE) {
1904
+               char    buf[64];
1905
+               sprintf(buf, "(BAD-RTX-CODE %d)", GET_CODE(x));
1906
+               zip_debug_print(pfx, lvl, buf);
1907
+               return;
1908
+       } switch(GET_CODE(x)) { // rtl.def
1909
+       case PARALLEL: zip_debug_print(pfx, lvl, "(PARALLEL");
1910
+               debug_rtx(x); break;
1911
+       case INT_LIST: zip_debug_print(pfx, lvl, "(INT-LIST"); break;
1912
+       case SEQUENCE: zip_debug_print(pfx, lvl, "(SEQUENCE"); break;
1913
+       case ADDRESS: zip_debug_print(pfx, lvl, "(ADDRESS"); break;
1914
+       case DEBUG_INSN: zip_debug_print(pfx, lvl, "(DEBUG-INSN"); break;
1915
+       case INSN:
1916
+               zip_debug_print(pfx, lvl, "(INSN");
1917
+               /*
1918
+               { const rtx_insn *tmp_rtx;
1919
+               for(tmp_rtx = as_a <const rtx_insn *>(x); tmp_rtx != 0; tmp_rtx = NEXT_INSN(tmp_rtx)) {
1920
+                       zip_debug_rtx_1(tmp_rtx, lvl+1);
1921
+               }}
1922
+               */
1923
+               zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
1924
+               zip_debug_print(pfx, lvl, ")");
1925
+               break;
1926
+       case JUMP_INSN: zip_debug_print(pfx, lvl, "(JUMP-INSN");
1927 111 dgisselq
+               zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
1928
+               zip_debug_print(pfx, lvl, ")");
1929
+               /*
1930 102 dgisselq
+               if (JUMP_LABEL(x)) {
1931 111 dgisselq
+                       if (GET_CODE(JUMP_LABEL(x)) == LABEL_REF) {
1932
+                               char    buf[64];
1933
+                               sprintf(buf, "(LABEL *.L%d))", CODE_LABEL_NUMBER(LABEL_REF_LABEL(JUMP_LABEL(x))));
1934
+                               zip_debug_print(pfx, lvl+1, buf);
1935
+                       } else if (GET_CODE(JUMP_LABEL(x))==CODE_LABEL) {
1936
+                               char    buf[64];
1937
+                               sprintf(buf, "(CODE_LABEL *.L%d))", CODE_LABEL_NUMBER(JUMP_LABEL(x)));
1938
+                               zip_debug_print(pfx, lvl+1, buf);
1939
+                       } else
1940
+                       zip_debug_print(pfx, lvl+1, "(w/Label))");
1941 102 dgisselq
+               } else
1942 111 dgisselq
+                       zip_debug_print(pfx, lvl+1, "(NO label))");
1943
+               debug_rtx(x);
1944
+               */
1945 102 dgisselq
+               break;
1946
+       case CALL:
1947
+               zip_debug_print(pfx, lvl, "(CALL (Adr) (Args)");
1948
+               zip_debug_rtx_1(pfx, XEXP(x,0), lvl+1);
1949
+               zip_debug_rtx_1(pfx, XEXP(x,1), lvl+1);
1950
+               zip_debug_print(pfx, lvl, ")");
1951
+               break;
1952
+       case CALL_INSN: zip_debug_print(pfx, lvl, "(CALL-INSN");
1953
+               debug_rtx(x);
1954
+               break;
1955
+       case BARRIER: zip_debug_print(pfx, lvl, "(BARRIER)"); break;
1956
+       case RETURN: zip_debug_print(pfx, lvl, "(RETURN)"); break;
1957
+       case NOTE:
1958
+               {       char buf[128];
1959
+                       sprintf(buf, "(NOTE %s)", GET_REG_NOTE_NAME(GET_MODE(x)));
1960
+                       zip_debug_print(pfx, lvl, buf);
1961
+               }break;
1962
+       case COND_EXEC: zip_debug_print(pfx, lvl, "(COND_EXEC)");
1963
+               debug_rtx(x);
1964
+               break;
1965
+       case ASM_INPUT: zip_debug_print(pfx, lvl, "(ASM INPUT)"); break;
1966
+       case ASM_OPERANDS: zip_debug_print(pfx, lvl, "(ASM OPERANDS)"); break;
1967
+       case UNSPEC: zip_debug_print(pfx, lvl, "(UNSPEC)"); break;
1968
+       case UNSPEC_VOLATILE: zip_debug_print(pfx, lvl, "(UNSPEC_VOLATILE)"); break;
1969
+       case CODE_LABEL:
1970
+               {
1971
+                       char    buf[64];
1972 111 dgisselq
+                       sprintf(buf, "(CODE_LABEL *.L%d)", CODE_LABEL_NUMBER(x));
1973 102 dgisselq
+                       zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
1974
+               } break;
1975
+       case SET:
1976
+               zip_debug_print_m(pfx, lvl, "(SET", GET_MODE(x));
1977
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
1978
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
1979
+               zip_debug_print(pfx, lvl, ")");
1980
+               break;
1981
+       case REG:
1982
+               if (REGNO(x) == zip_PC)
1983
+                       zip_debug_print(pfx, lvl, "(PC)");
1984
+               else if (REGNO(x) == zip_CC)
1985
+                       zip_debug_print(pfx, lvl, "(CC0)");
1986
+               else if (REGNO(x) == zip_SP)
1987
+                       zip_debug_print(pfx, lvl, "(SP)");
1988
+               else if (REGNO(x) == zip_FP)
1989
+                       zip_debug_print(pfx, lvl, "(REG FP)");
1990
+               else if (REGNO(x) == zip_GOT)
1991
+                       zip_debug_print(pfx, lvl, "(REG GBL)");
1992
+               else if (FUNCTION_VALUE_REGNO_P(REGNO(x)))
1993
+                       zip_debug_print(pfx, lvl, "(REG RTN-VL)");
1994
+               else if (REGNO(x) == RETURN_ADDRESS_REGNUM)
1995
+                       zip_debug_print(pfx, lvl, "(REG RTN-AD)");
1996
+               else { char buf[25];
1997
+               sprintf(buf, "(REG %d)", REGNO(x));
1998
+               zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
1999
+               } break;
2000
+       case IF_THEN_ELSE: // 51
2001
+               zip_debug_print(pfx, lvl, "(IF-THEN-ELSE");
2002
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2003
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2004
+               zip_debug_rtx_1(pfx, XEXP(x,2),lvl+1);
2005
+               zip_debug_print(pfx, lvl, ")");
2006
+               break;
2007
+       case PC:
2008
+               zip_debug_print(pfx, lvl, "(PC)");
2009
+               break;
2010
+       case CC0:
2011
+               zip_debug_print(pfx, lvl, "(CC0)");
2012
+               break;
2013
+       case COMPARE:
2014
+               zip_debug_print(pfx, lvl, "(COMPARE");
2015
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2016
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2017
+               zip_debug_print(pfx, lvl, ")");
2018
+               break;
2019 111 dgisselq
+       case CONST:
2020
+               zip_debug_print_m(pfx, lvl, "(CONST", GET_MODE(x));
2021
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2022
+               zip_debug_print(pfx, lvl, ")");
2023
+               break;
2024 102 dgisselq
+       case CONST_INT:
2025
+               { char buf[25];
2026
+               if (GET_MODE(x)==SImode)
2027 111 dgisselq
+                       sprintf(buf, "(CONST_INT:SI %ld)", INTVAL(x));
2028 102 dgisselq
+               else if (GET_MODE(x)==VOIDmode)
2029 111 dgisselq
+                       sprintf(buf, "(CONST_INT:V %ld)", INTVAL(x));
2030 102 dgisselq
+               else
2031 111 dgisselq
+                       sprintf(buf, "(CONST_INT:? %ld)", INTVAL(x));
2032 102 dgisselq
+               zip_debug_print(pfx, lvl, buf);
2033
+               } break;
2034
+       case LABEL_REF:
2035 111 dgisselq
+               { char buf[256], *bp;
2036
+               sprintf(buf, "(LABEL *.L%d)", CODE_LABEL_NUMBER(LABEL_REF_LABEL(x)));
2037
+               zip_debug_print(pfx, lvl, buf);
2038
+               }
2039 102 dgisselq
+               break;
2040
+       case SYMBOL_REF:
2041
+               {
2042
+                       char buf[64];
2043
+                       sprintf(buf, "(SYMBOL: %s)", XSTR(x,0));
2044
+                       // fprintf(file, "%s", XSTR(x,0));
2045
+                       zip_debug_print(pfx, lvl, buf);
2046
+               }
2047
+               break;
2048
+       case MEM:
2049
+               zip_debug_print_m(pfx, lvl, "(MEM", GET_MODE(x));
2050
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2051
+               zip_debug_print(pfx, lvl, ")");
2052
+               break;
2053
+       /*
2054
+       case VALUE:
2055
+               {
2056
+                       char buf[64];
2057
+                       sprintf(buf, "(VALUE: %d)", INTVAL(XEXP,0));
2058
+                       zip_debug_print_m(pfx, lvl, "buf", GET_MODE(x));
2059
+               }
2060
+               break;
2061
+       */
2062
+       case PLUS:
2063
+               zip_debug_print_m(pfx, lvl, "(PLUS", GET_MODE(x));
2064
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2065
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2066
+               zip_debug_print(pfx, lvl, ")");
2067
+               break;
2068
+       case MINUS:
2069
+               zip_debug_print_m(pfx, lvl, "(MINUS", GET_MODE(x));
2070
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2071
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2072
+               zip_debug_print(pfx, lvl, ")");
2073
+               break;
2074
+       case AND:
2075
+               zip_debug_print_m(pfx, lvl, "(AND", GET_MODE(x));
2076
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2077
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2078
+               zip_debug_print(pfx, lvl, ")");
2079
+               break;
2080
+       case IOR:
2081
+               zip_debug_print_m(pfx, lvl, "(OR", GET_MODE(x));
2082
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2083
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2084
+               zip_debug_print(pfx, lvl, ")");
2085
+               break;
2086
+       case XOR:
2087
+               zip_debug_print_m(pfx, lvl, "(XOR", GET_MODE(x));
2088
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2089
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2090
+               zip_debug_print(pfx, lvl, ")");
2091
+               break;
2092
+       case MULT:
2093
+               zip_debug_print_m(pfx, lvl, "(MULT", GET_MODE(x));
2094
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2095
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2096
+               zip_debug_print(pfx, lvl, ")");
2097
+               break;
2098
+       case EQ:        //
2099
+               zip_debug_print_m(pfx, lvl, "(EQ", GET_MODE(x));
2100
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2101
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2102
+               zip_debug_print(pfx, lvl, ")");
2103
+               break;
2104
+       case NE:        //
2105
+               zip_debug_print_m(pfx, lvl, "(NE", GET_MODE(x));
2106
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2107
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2108
+               zip_debug_print(pfx, lvl, ")");
2109
+               break;
2110
+       case GE:        //
2111
+               zip_debug_print_m(pfx, lvl, "(GE", GET_MODE(x));
2112
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2113
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2114
+               zip_debug_print(pfx, lvl, ")");
2115
+               break;
2116
+       case GT:        //
2117
+               zip_debug_print_m(pfx, lvl, "(GT", GET_MODE(x));
2118
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2119
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2120
+               zip_debug_print(pfx, lvl, ")");
2121
+               break;
2122
+       case LE:        //
2123
+               zip_debug_print_m(pfx, lvl, "(LE", GET_MODE(x));
2124
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2125
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2126
+               zip_debug_print(pfx, lvl, ")");
2127
+               break;
2128
+       case LT:        //
2129
+               zip_debug_print_m(pfx, lvl, "(LT", GET_MODE(x));
2130
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2131
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2132
+               zip_debug_print(pfx, lvl, ")");
2133
+               break;
2134
+       case GEU:       //
2135
+               zip_debug_print_m(pfx, lvl, "(GEU", GET_MODE(x));
2136
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2137
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2138
+               zip_debug_print(pfx, lvl, ")");
2139
+               break;
2140
+       case GTU:       //
2141
+               zip_debug_print_m(pfx, lvl, "(GTU", GET_MODE(x));
2142
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2143
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2144
+               zip_debug_print(pfx, lvl, ")");
2145
+               break;
2146
+       case LEU:       //
2147
+               zip_debug_print_m(pfx, lvl, "(LEU", GET_MODE(x));
2148
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2149
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2150
+               zip_debug_print(pfx, lvl, ")");
2151
+               break;
2152
+       case LTU:       //
2153
+               zip_debug_print_m(pfx, lvl, "(LTU", GET_MODE(x));
2154
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2155
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2156
+               zip_debug_print(pfx, lvl, ")");
2157
+               break;
2158
+       case SCRATCH:   //
2159
+               zip_debug_print_m(pfx, lvl, "(SCRATCH)", GET_MODE(x));
2160
+               break;
2161
+       case SUBREG:
2162
+               { char buf[25];
2163 111 dgisselq
+               if (REG_P(XEXP(x,0))) {
2164
+                       sprintf(buf, "(SUBREG %d/%d)", REGNO(XEXP(x,0)),
2165
+                               SUBREG_BYTE(x));
2166
+                       zip_debug_print(pfx, lvl, buf);
2167
+               } else if (MEM_P(XEXP(x,0))) {
2168
+                       sprintf(buf, "(SUBREG /%d", SUBREG_BYTE(x));
2169
+                       zip_debug_print(pfx, lvl, buf);
2170
+                       zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2171
+                       zip_debug_print(pfx, lvl, ")");
2172
+               } else {
2173
+                       sprintf(buf, "(SUBREG UNK /%d", SUBREG_BYTE(x));
2174
+                       zip_debug_print(pfx, lvl, buf);
2175
+                       zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2176
+                       zip_debug_print(pfx, lvl, ")");
2177
+               }}
2178
+               break;
2179 102 dgisselq
+       default:
2180 111 dgisselq
+               { char buf[128];
2181 102 dgisselq
+               sprintf(buf, "(? = %d) -- calling DEBUG-RTX", GET_CODE(x));
2182
+               zip_debug_print(pfx, lvl, buf);
2183
+               debug_rtx(x);
2184
+               } break;
2185
+       }
2186
+}
2187
+
2188
+void
2189
+zip_debug_rtx_pfx(const char *pfx, const_rtx x) {
2190
+       zip_debug_rtx_1(pfx, x, 0);
2191
+}
2192
+
2193
+void
2194
+zip_debug_rtx(const_rtx x) {
2195
+       zip_debug_rtx_pfx("", x);
2196
+}
2197
+
2198
+void
2199
+zip_debug_insn(rtx_insn *insn ATTRIBUTE_UNUSED) {
2200
+}
2201
+
2202
+void
2203
+zip_debug_bb(basic_block bb) {
2204
+       rtx_insn        *insn;
2205
+
2206
+       fprintf(stderr, "************ BASIC-BLOCK ***************\n");
2207
+       FOR_BB_INSNS(bb, insn)
2208
+       {
2209
+               zip_debug_rtx(insn);
2210
+       }
2211
+}
2212
+
2213
+
2214
+static bool
2215 111 dgisselq
+zip_legitimate_opb(const_rtx x, bool strict)
2216 102 dgisselq
+{
2217 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2218 102 dgisselq
+
2219 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB\n");
2220 102 dgisselq
+       if (dbg) zip_debug_rtx_pfx("Test: ", x);
2221
+
2222
+       if (NULL_RTX == x)
2223
+               return false;
2224
+       else if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode))
2225
+               return false;
2226
+       else if (REG_P(x)) {
2227 111 dgisselq
+               bool    res;
2228 102 dgisselq
+               // Only insist the register b a valid register if strict is true
2229 111 dgisselq
+               res = (!strict)||((is_ZIP_REG(REGNO(x)))&&(REGNO(x) != zip_CC));
2230
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> %s (Reg)\n",
2231
+                       (res)?"YES!":"No");
2232
+               return res;
2233
+       } else if ((!strict)&&(SUBREG_P(x))) {
2234
+               // Only insist the register b a valid register if strict is true
2235
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> (Subreg(Reg),recurse)\n");
2236
+               return zip_legitimate_opb(XEXP(x,0), strict);
2237
+       } else if ((CONST_INT_P(x))
2238
+               &&(INTVAL(x) >= zip_min_opb_imm)
2239
+               &&(INTVAL(x) <= zip_max_opb_imm)) {
2240
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> YES! (Const)\n");
2241
+               return true;
2242 102 dgisselq
+       } else if (GET_CODE(x) == PLUS) {
2243
+               // Is it a valid register?
2244
+               if(!REG_P(XEXP(x,0))) {
2245 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No (No reg in +%s)\n",
2246 102 dgisselq
+                       (GET_CODE(XEXP(x,1))==REG)?", reg in op[1]":"");
2247
+                       return false;
2248 111 dgisselq
+               } if ((strict)&&((!is_ZIP_REG(REGNO(XEXP(x,0))))||(REGNO(XEXP(x,0)) == zip_CC))) {
2249
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No (Wrong reg in +, %d)\n", REGNO(XEXP(x,0)));
2250 102 dgisselq
+                       return false;
2251
+               } if ((GET_CODE(XEXP(x, 1)) == CONST_INT)
2252
+                       &&(INTVAL(XEXP(x, 1)) <= zip_max_anchor_offset)
2253
+                       &&(INTVAL(XEXP(x, 1)) >= zip_min_anchor_offset)) {
2254 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> YES! (reg+int)\n");
2255 103 dgisselq
+                       // if((INTVAL(XEXP(x,1))<0)&&(REGNO(XEXP(x,0))==zip_SP))
2256
+                               // gcc_unreachable();
2257 102 dgisselq
+                       return true;
2258
+               } if ((GET_CODE(XEXP(x, 1)) == LABEL_REF)
2259
+                       ||(GET_CODE(XEXP(x, 1)) == SYMBOL_REF)) {
2260
+                       // While we can technically support this, the problem
2261
+                       // is that the symbol address could be anywhere, and we
2262
+                       // have no way of recovering if it's outside of our
2263
+                       // 14 allowable bits.
2264 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No. (reg+lbl)\n");
2265 102 dgisselq
+                       return false;
2266
+               }
2267 111 dgisselq
+               // if ((GET_CODE(XEXP(x, 1)) == MINUS)
2268
+               //      &&((GET_CODE(XEXP(XEXP(x,1),0)) == LABEL_REF)
2269
+               //              ||(GET_CODE(XEXP(XEXP(x,1),0)) == CONST_INT)
2270
+               //              ||(GET_CODE(XEXP(XEXP(x,1),0)) == SYMBOL_REF))
2271
+               //      &&((GET_CODE(XEXP(XEXP(x,1),1)) == LABEL_REF)
2272
+               //              ||(GET_CODE(XEXP(XEXP(x,1),0)) == CONST_INT)
2273
+               //              ||(GET_CODE(XEXP(XEXP(x,1),1)) == SYMBOL_REF))
2274
+               //      &&((GET_CODE(XEXP(XEXP(x,1),0)))
2275
+               //              == (GET_CODE(XEXP(XEXP(x,1),1))))) {
2276
+               //      if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS -> YES! (lbl-lbl+reg)\n");
2277
+               //      return true;
2278
+               //}
2279 102 dgisselq
+       }
2280
+
2281 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No\n");
2282 102 dgisselq
+       if (dbg) zip_debug_rtx(x);
2283
+       return false;
2284
+}
2285
+
2286
+static bool
2287
+zip_legitimate_move_operand_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict) {
2288
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2289
+
2290
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND\n");
2291
+       if (dbg) zip_debug_rtx_pfx("VMov?: ", x);
2292
+
2293
+       if (NULL_RTX == x)
2294
+               return false;
2295
+       else if (REG_P(x)) {
2296
+               // Only insist the register b a valid register if strict is true
2297
+               if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> YES! (Reg)\n");
2298 111 dgisselq
+               return (!strict)||((is_ZIP_REG(REGNO(x)))&&(REGNO(x) !=zip_CC));
2299 102 dgisselq
+       } else if (GET_CODE(x) == PLUS) {
2300 111 dgisselq
+               // if (GET_CODE(XEXP(x,0))==PLUS) {
2301
+               // return (zip_legitimate_opb(XEXP(x,0), strict))
2302
+               // &&(zip_const_address_operand(XEXP(x,0)));
2303
+               // }
2304 102 dgisselq
+               // Is it a valid register?
2305 111 dgisselq
+               if(GET_CODE(XEXP(x,0)) != REG) {
2306 102 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> No (No reg in +%s)\n",
2307
+                       (GET_CODE(XEXP(x,1))==REG)?", reg in op[1]":"");
2308
+                       return false;
2309 111 dgisselq
+               } if ((strict)&&
2310
+                       ((!is_ZIP_REG(REGNO(XEXP(x,0))))
2311
+                       ||(REGNO(XEXP(x,0)) == zip_CC))) {
2312 102 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> No (Wrong reg in +, %d)\n", REGNO(XEXP(x,0)));
2313
+                       return false;
2314
+               } if ((GET_CODE(XEXP(x, 1)) == CONST_INT)
2315
+                       &&(INTVAL(XEXP(x, 1)) <= zip_max_mov_offset)
2316
+                       &&(INTVAL(XEXP(x, 1)) >= zip_min_mov_offset)) {
2317
+                       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> YES! (reg+int)\n");
2318
+                       return true;
2319
+               }
2320
+       }
2321
+
2322
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> No\n");
2323
+       if (dbg) zip_debug_rtx(x);
2324
+       return false;
2325
+}
2326
+
2327
+int
2328
+zip_pd_mov_operand(rtx op)
2329
+{
2330
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2331
+
2332
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOV(predicate) for OPERAND\n");
2333
+       return zip_legitimate_move_operand_p(VOIDmode, op, !can_create_pseudo_p());
2334
+}
2335
+
2336
+int
2337 111 dgisselq
+zip_pd_mvimm_operand(rtx op)
2338
+{
2339
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2340
+
2341
+       if (dbg) fprintf(stderr, "ZIP-VALID-MVIMM(predicate) for OPERAND\n");
2342
+       if (!CONST_INT_P(op))
2343
+               return false;
2344
+       if (INTVAL(op) > zip_max_mov_offset)
2345
+               return false;
2346
+       if (INTVAL(op) < zip_min_mov_offset)
2347
+               return false;
2348
+       return true;
2349
+}
2350
+
2351
+int
2352
+zip_pd_imm_operand(rtx op)
2353
+{
2354
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2355
+
2356
+       if (dbg) fprintf(stderr, "ZIP-VALID-IMM(predicate) for OPERAND\n");
2357
+       if (!CONST_INT_P(op))
2358
+               return false;
2359
+       if (INTVAL(op) > zip_max_anchor_offset)
2360
+               return false;
2361
+       if (INTVAL(op) < zip_min_anchor_offset)
2362
+               return false;
2363
+       return true;
2364
+}
2365
+
2366
+int
2367 102 dgisselq
+zip_address_operand(rtx op)
2368
+{
2369
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2370
+
2371
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS for OPERAND\n");
2372 111 dgisselq
+       if ((REG_P(op))&&(REGNO(op)==zip_CC))
2373
+               return false;
2374
+       else if ((GET_CODE(op) == PLUS)&&(REG_P(XEXP(op,0)))
2375
+                       &&(REGNO(XEXP(op,0))==zip_CC))
2376
+               return false;
2377
+       else
2378
+               return zip_legitimate_opb(op, !can_create_pseudo_p());
2379 102 dgisselq
+}
2380
+
2381
+int
2382 111 dgisselq
+zip_pd_opb_operand(rtx op)
2383 102 dgisselq
+{
2384
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2385
+
2386 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-OPB(predicate) for OPERAND\n");
2387
+       return zip_legitimate_opb(op, !can_create_pseudo_p());
2388 102 dgisselq
+}
2389
+
2390
+int
2391
+zip_ct_address_operand(rtx op)
2392
+{
2393
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2394
+
2395
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS(constraint) for OPERAND\n");
2396 111 dgisselq
+       return zip_legitimate_opb(op, !can_create_pseudo_p());
2397 102 dgisselq
+}
2398
+
2399
+int
2400
+zip_const_address_operand(rtx x) {
2401
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2402
+
2403
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS?\n");
2404
+       if (dbg) zip_debug_rtx(x);
2405
+       if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode))
2406
+               return false;
2407
+       if ((GET_CODE(x) == LABEL_REF)
2408
+                       ||(GET_CODE(x) == CODE_LABEL)
2409
+                       ||(GET_CODE(x) == SYMBOL_REF)) {
2410
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES!\n");
2411
+               return true;
2412
+       } else if (CONST_INT_P(x)) {
2413
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES!\n");
2414
+               return true;
2415
+       } else if (GET_CODE(x) == PLUS) {
2416
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(PLUS)\n");
2417
+               return ((zip_const_address_operand(XEXP(x,0)))
2418
+                       &&(CONST_INT_P(XEXP(x,1))));
2419
+       } else if (GET_CODE(x) == MINUS) {
2420
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(MINUS)\n");
2421
+               return ((zip_const_address_operand(XEXP(x,0)))
2422
+                       &&(zip_const_address_operand(XEXP(x,1))));
2423
+       }
2424
+
2425
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> No\n");
2426
+       if (dbg) zip_debug_rtx(x);
2427
+       return false;
2428
+}
2429
+
2430
+int
2431
+zip_ct_const_address_operand(rtx x) {
2432
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2433
+
2434
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(constraint)\n");
2435
+       return zip_const_address_operand(x);
2436
+}
2437
+
2438
+int
2439
+zip_pd_const_address_operand(rtx x) {
2440
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2441
+
2442
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(predicate)\n");
2443
+       return zip_const_address_operand(x);
2444
+}
2445
+
2446
+
2447
+static bool
2448
+zip_legitimate_address_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict)
2449
+{
2450
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2451
+
2452
+       if (dbg) fprintf(stderr, "Zip-LEGITIMATE-ADDRESS-P\n");
2453
+       if (dbg) zip_debug_rtx(x);
2454
+
2455
+       // Only insist the register be a valid register if strict is true
2456 111 dgisselq
+       if (zip_legitimate_opb(x, strict))
2457 102 dgisselq
+               return true;
2458 111 dgisselq
+       // else if (zip_const_address_operand(x))
2459
+               // return true;
2460 102 dgisselq
+
2461
+       return false;
2462
+}
2463
+
2464 111 dgisselq
+static rtx
2465
+zip_legitimize_address(rtx x, rtx oldx ATTRIBUTE_UNUSED, machine_mode mode ATTRIBUTE_UNUSED) {
2466
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2467
+
2468
+       if (dbg) zip_debug_rtx_pfx("LEGITIMIZE: ", x);
2469
+       if (zip_legitimate_address_p(mode, x, !can_create_pseudo_p()))
2470
+               return x;
2471
+
2472
+       if (GET_CODE(x)==PLUS) {
2473
+               if (!REG_P(XEXP(x,0)))
2474
+                       XEXP(x,0) = force_reg(GET_MODE(x),XEXP(x,0));
2475
+               if ((!zip_legitimate_address_p(mode, x, !can_create_pseudo_p()))
2476
+                       &&(!CONST_INT_P(XEXP(x,1))))
2477
+                       x = force_reg(GET_MODE(x),x);
2478
+       } else if (MEM_P(x))
2479
+               x = force_reg(GET_MODE(x),x);
2480
+
2481
+       if (dbg) zip_debug_rtx_pfx("LEGITIMATE: ", x);
2482
+       return x;
2483
+}
2484
+
2485 102 dgisselq
+void
2486
+zip_asm_output_def(FILE *stream, const char *name, const char *value)
2487
+{
2488
+       assemble_name(stream, name);
2489
+       fprintf(stream, "\t.equ ");
2490
+       assemble_name(stream, value);
2491
+       fputc('\n', stream);
2492
+}
2493
+
2494
+/*
2495
+bool   zip_load_address_lod(rtx regrx, rtx memrx) {
2496
+       fprintf(stderr, "ZIP-LOAD-ADDRESS-LOD\n");
2497
+       if (!MEM_P(memrx))
2498
+               return false;
2499
+       if (GET_CODE(regrx) != REG)
2500
+               return false;
2501
+       enum    rtx_code ic = GET_CODE(memrx);
2502
+       if ((ic == SYMBOL_REF)
2503
+               ||(ic == CODE_LABEL)
2504
+               ||(ic == LABEL_REF)) {
2505
+               if (can_create_pseudo_p()) {
2506
+                       rtx scratch_reg;
2507
+                       scratch_reg = gen_rtx_SCRATCH(SImode);
2508
+                       emit_insn(gen_movsi_ldi(scratch_reg, XEXP(memrx, 0)));
2509
+                       emit_insn(gen_movsi_lod(regrx, scratch_reg));
2510
+                       return true;
2511
+               } else return false;
2512
+       } else return false;
2513
+}
2514
+
2515
+bool   zip_load_address_sto(rtx memrx, rtx regrx) {
2516
+       fprintf(stderr,  "CHECKING-IN-W/ZIP_LOAD_ADDRESS_STORE\n");
2517
+       if (!MEM_P(memrx))
2518
+               return false;
2519
+       if (GET_CODE(regrx) != REG)
2520
+               return false;
2521
+       enum    rtx_code ic = GET_CODE(memrx);
2522
+       if ((ic == SYMBOL_REF)
2523
+               ||(ic == CODE_LABEL)
2524
+               ||(ic == LABEL_REF)) {
2525
+               if (can_create_pseudo_p()) {
2526
+                       rtx scratch_reg;
2527
+                       scratch_reg = gen_rtx_SCRATCH(SImode);
2528
+                       emit_insn(gen_movsi_ldi(scratch_reg, XEXP(memrx, 0)));
2529
+                       emit_insn(gen_movsi_sto(scratch_reg, regrx));
2530
+                       return true;
2531
+               } else return false;
2532
+       } return false;
2533
+}
2534
+*/
2535
+
2536 111 dgisselq
+#define        USE_SUBREG
2537
+#ifdef USE_SUBREG
2538
+#define        SREG_P(RTX) ((SUBREG_P(RTX))&&(REG_P(XEXP(RTX,0))))
2539
+#define        SMEM_P(RTX) ((SUBREG_P(RTX))&&(MEM_P(XEXP(RTX,0))))
2540
+#else
2541
+#define        SREG_P(RTX)     false
2542
+#define        SMEM_P(RTX)     false
2543
+#endif
2544 102 dgisselq
+
2545
+bool   zip_gen_move_rtl(rtx dst, rtx src) {
2546 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2547 102 dgisselq
+
2548
+       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE\n");
2549
+       if (dbg) zip_debug_rtx_pfx("FROM: ", src);
2550
+       if (dbg) zip_debug_rtx_pfx("TO  : ", dst);
2551
+       if (dbg) fprintf(stderr, "PSEUDOs: %s\n", can_create_pseudo_p()?"true":"false");
2552 111 dgisselq
+       if (((REG_P(dst))||(SREG_P(dst)))
2553
+                       &&((REG_P(src))||(SREG_P(src)))) {
2554 102 dgisselq
+               // First type of move... register to register
2555
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/REG -- EMIT\n");
2556 111 dgisselq
+               // if (SREG_P(dst)) dst = gen_raw_REG(SImode,REGNO(XEXP(dst,0))+SUBREG_BYTE(dst));
2557
+               // if (SREG_P(src)) src = gen_raw_REG(SImode,REGNO(XEXP(src,0))+SUBREG_BYTE(src));
2558 102 dgisselq
+               emit_insn(gen_movsi_reg(dst, src));
2559
+       } else if ((MEM_P(dst))&&(MEM_P(XEXP(dst,0)))) {
2560 111 dgisselq
+               // An indirect store, (mem (mem (addr .))) = whatever ...
2561 102 dgisselq
+               if (can_create_pseudo_p()) {
2562
+                       rtx     tmp = gen_reg_rtx(Pmode);
2563
+                       zip_gen_move_rtl(tmp, XEXP(dst,0));
2564 103 dgisselq
+                       // mark_reg_pointer(tmp,0);
2565 102 dgisselq
+                       zip_gen_move_rtl(gen_rtx_MEM(GET_MODE(src), tmp), src);
2566
+               } else {
2567
+                       fprintf(stderr, "ZIP:Cannot move into mem w/o pseudo\n");
2568
+                       return false;
2569
+               }
2570
+       } else if ((MEM_P(src))&&(MEM_P(XEXP(src,0)))) {
2571 111 dgisselq
+               // If this is an indirect load, Rx = (mem (mem (addr)))
2572 102 dgisselq
+               if (can_create_pseudo_p()) {
2573
+                       rtx     tmp = gen_reg_rtx(Pmode);
2574
+                       zip_gen_move_rtl(tmp, XEXP(src,0));
2575 103 dgisselq
+                       // mark_reg_pointer(tmp,0);
2576 102 dgisselq
+                       zip_gen_move_rtl(dst, gen_rtx_MEM(GET_MODE(src), tmp));
2577
+               } else {
2578
+                       fprintf(stderr, "ZIP: Cannot move from mem(mem(ptr)) w/o pseudo\n");
2579
+                       return false;
2580
+               }
2581 111 dgisselq
+       } else if (((REG_P(dst))||(SREG_P(dst)))&&(GET_CODE(src)==PLUS)
2582 102 dgisselq
+                       &&(REG_P(XEXP(src,0)))
2583
+                       &&(CONST_INT_P(XEXP(src,1)))) {
2584 111 dgisselq
+               // if (SREG_P(dst)) dst = gen_raw_REG(SImode,REGNO(XEXP(dst,0))+SUBREG_BYTE(dst));
2585 102 dgisselq
+               // Second type of move... register plus offset to register
2586
+               if ((INTVAL(XEXP(src, 1)) <= zip_max_mov_offset)
2587
+                       &&(INTVAL(XEXP(src, 1)) >= zip_min_mov_offset)) {
2588
+                       // The offset is within bounds
2589
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/REG+OFF -- EMIT\n");
2590
+                       emit_insn(gen_movsi_reg_off(dst, XEXP(src,0),XEXP(src,1)));
2591
+               } else if (can_create_pseudo_p()) {
2592
+                       // The offset is out of bounds, get a new register and
2593
+                       // generate an add instruction to split this up.
2594
+                       rtx     tmp = gen_reg_rtx(GET_MODE(XEXP(src,0)));
2595
+
2596
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LDI\n");
2597
+                       emit_insn(gen_movsi_ldi(tmp, XEXP(src,1)));
2598
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/ADD\n");
2599
+                       emit_insn(gen_addsi3(tmp, tmp, XEXP(src,0)));
2600
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/DST\n");
2601
+                       emit_insn(gen_movsi_reg(dst, tmp));
2602
+               } else {
2603
+                       fprintf(stderr, "ZIP: Cannot move a(r),b w/o pseudo for out of bounds a\n");
2604
+                       return false;
2605
+               }
2606
+       } else if ((MEM_P(dst))&&(MEM_P(src))) {
2607
+               rtx     tmp;
2608
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/MEM/MEM\n");
2609
+               if (can_create_pseudo_p()) {
2610
+                       tmp = gen_reg_rtx(GET_MODE(src));
2611
+                       emit_insn(gen_movsi(tmp, src));
2612
+                       emit_insn(gen_movsi(dst, tmp));
2613
+               } else {
2614
+                       fprintf(stderr, "ZIP: Cannot move mem(A) to mem(B) w/o pseudo\n");
2615
+                       return false;
2616
+               }
2617 111 dgisselq
+       } else if (((REG_P(dst))||(SREG_P(dst)))&&(MEM_P(src))) {
2618 102 dgisselq
+               // Memory load
2619 111 dgisselq
+               // if (SREG_P(dst)) dst = gen_raw_REG(SImode,REGNO(XEXP(dst,0))+SUBREG_BYTE(dst));
2620 102 dgisselq
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LOD\n");
2621 111 dgisselq
+               if (zip_legitimate_opb(XEXP(src, 0), false)) {
2622 102 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/SIMPLE-LOD(ADDR)\n");
2623
+                       if (dbg) zip_debug_rtx_pfx("Smple-Addr: ", src);
2624
+                       emit_insn(gen_movsi_lod(dst, src));
2625
+               } else if (zip_const_address_operand(XEXP(src,0))) {
2626
+                       if (can_create_pseudo_p()) {
2627
+                               rtx     tmp;
2628
+                               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LOD(CONST-ADDR)\n");
2629
+                               tmp = gen_reg_rtx(Pmode);
2630
+                               emit_insn(gen_movsi_ldi(tmp, XEXP(src,0)));
2631
+                               emit_insn(gen_movsi_lod(dst, gen_rtx_MEM(GET_MODE(src),tmp)));
2632
+                       } else {
2633
+                               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LOD(CONST-ADDR,SELF)\n");
2634
+                               emit_insn(gen_movsi_ldi(dst, XEXP(src,0)));
2635
+                               emit_insn(gen_movsi_lod(dst, gen_rtx_MEM(GET_MODE(src),dst)));
2636
+                       }
2637
+               } else {
2638
+                       internal_error("%s", "ZIP/No usable load\n");
2639
+               }
2640 111 dgisselq
+       } else if ((MEM_P(dst))&&((REG_P(src))||(SREG_P(src)))) {
2641 102 dgisselq
+               // Memory store
2642 111 dgisselq
+               // if (SREG_P(src)) src = gen_raw_REG(SImode,REGNO(XEXP(src,0))+SUBREG_BYTE(src));
2643 102 dgisselq
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO\n");
2644 111 dgisselq
+               if (zip_legitimate_opb(XEXP(dst, 0), false)) {
2645 102 dgisselq
+                       // If it's a legitimate address already, do nothing mor
2646
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO(Legit Addr)--EMIT\n");
2647 103 dgisselq
+                       // if (REG_P(XEXP(dst,0)))
2648
+                               // mark_reg_pointer(XEXP(dst,0),0);
2649
+                       // else if ((GET_CODE(XEXP(dst,0))==PLUS)
2650
+                                       // &&(REG_P(XEXP(XEXP(dst,0),0))))
2651
+                               // mark_reg_pointer(XEXP(XEXP(dst,0),0),0);
2652 102 dgisselq
+                       emit_insn(gen_movsi_sto(dst, src));
2653
+               } else if (zip_const_address_operand(XEXP(dst,0))) {
2654
+                       rtx     tmp;
2655
+
2656
+                       if (can_create_pseudo_p()) {
2657
+                               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO(Const Addr,Reg) -- EMIT\n");
2658
+                               // Otherwise we need to load the memory address
2659
+                               // into a register
2660
+                               tmp = gen_reg_rtx(Pmode);
2661 103 dgisselq
+                               // mark_reg_pointer(tmp,0);
2662 102 dgisselq
+                               emit_insn(gen_movsi_ldi(tmp, XEXP(dst,0)));
2663
+                               //
2664
+                               // Then we can do our load
2665
+                               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO -- emit\n");
2666
+                               emit_insn(gen_movsi_sto(gen_rtx_MEM(GET_MODE(src), tmp), src));
2667
+                       } else {
2668
+                               fprintf(stderr, "Cannot move src -> mem(dst) w/o pseudo\n");
2669
+                               return false;
2670
+                       }
2671
+               } else if (can_create_pseudo_p())
2672
+                       internal_error("%s", "ZIP/No usable store\n");
2673
+               else {
2674
+                       fprintf(stderr, "ZIP/Unanticipated store problem\n");
2675
+                       return false;
2676
+               }
2677
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO -- DONE\n");
2678
+       } else if ((MEM_P(dst))&&((CONST_INT_P(src))||(GET_CODE(src)==SYMBOL_REF))) {
2679
+               // Store a constant into memory
2680
+               rtx     tmp;
2681
+
2682
+               if (can_create_pseudo_p()) {
2683
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/CONST->MEM\n");
2684
+                       // Load the source constant into a register first
2685
+                       tmp = gen_reg_rtx((GET_MODE(src)==VOIDmode)?GET_MODE(dst):GET_MODE(src));
2686
+                       emit_insn(gen_movsi_ldi(tmp,src));
2687
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/CONST->REG->MEM -- RECURSE\n");
2688
+
2689
+                       // Then do a normal move, recursing to handle memory
2690
+                       // properly
2691
+                       zip_gen_move_rtl(dst, tmp);
2692
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/CONST->MEM -- DONE\n");
2693
+               } else {
2694
+                       fprintf(stderr, "ZIP/Cannot store constant into mem w/o pseudo\n");
2695
+                       return false;
2696
+               }
2697 111 dgisselq
+       } else if (((REG_P(dst))||(SREG_P(dst)))&&(CONST_INT_P(src))) {
2698
+               // if (SREG_P(dst)) dst = gen_raw_REG(SImode,REGNO(XEXP(dst,0))+SUBREG_BYTE(dst));
2699 102 dgisselq
+               // Load a constant into a register
2700
+               // The assembler really takes care of all of this, since
2701
+               // the assembler will split the constant if it doesn't fit
2702
+               // into a single instruction.
2703
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/CONST->REG\n");
2704
+               // if ((GET_MODE(dst)==VOIDmode)&&(GET_MODE(src)==VOIDmode))
2705
+                       // PUT_MODE(dst,SImode);
2706
+               emit_insn(gen_movsi_ldi(dst, src));
2707
+       } else if ((REG_P(dst))&&
2708
+                       ((LABEL_P(src))
2709
+                       ||(GET_CODE(src)==SYMBOL_REF)
2710
+                       ||(GET_CODE(src)==LABEL_REF))) {
2711
+               // Load a constant into a register
2712
+               // The assembler really takes care of all of this, since
2713
+               // the assembler will split the constant if it doesn't fit
2714
+               // into a single instruction.
2715
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LABEL->REG\n");
2716
+               emit_insn(gen_movsi_ldi(dst, src));
2717 111 dgisselq
+       } else if ((REG_P(dst))&&
2718
+                       ((GET_CODE(src)==PLUS)
2719
+                       &&((GET_CODE(XEXP(src,0))==SYMBOL_REF)
2720
+                               ||(GET_CODE(XEXP(src,0))==LABEL_REF))
2721
+                       &&(CONST_INT_P(XEXP(src,1))))) {
2722
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LABEL+OFFSET->REG\n");
2723
+               if ((INTVAL(XEXP(src,1))>=zip_min_mov_offset)
2724
+                       &&(INTVAL(XEXP(src,1))<=zip_max_mov_offset)) {
2725
+                       emit_insn(gen_movsi_ldi(dst, XEXP(src,1)));
2726
+                       emit_insn(gen_movsi_reg_off(dst, dst, XEXP(src,1)));
2727
+               } else if (can_create_pseudo_p()) {
2728
+                       rtx tmp = gen_reg_rtx(Pmode);
2729
+                       emit_insn(gen_movsi_ldi(tmp, XEXP(src,1)));
2730
+                       emit_insn(gen_movsi_ldi(dst, src));
2731
+                       emit_insn(gen_addsi3(dst,dst,tmp));
2732
+                       return true;
2733
+               } else {
2734
+                       fprintf(stderr, "Cannot move LABEL+OFFSET -> dst w/o pseudo\n");
2735
+                       return false;
2736
+               }
2737
+       } else if (((REG_P(dst))||(SREG_P(dst)))&&(GET_CODE(src) == CONST)) {
2738
+               // if (SREG_P(dst)) dst = gen_raw_REG(SImode,REGNO(XEXP(dst,0))+SUBREG_BYTE(dst));
2739
+               zip_gen_move_rtl(dst, XEXP(src,0));
2740
+       } else if (SMEM_P(dst)) {
2741
+               rtx     addr = XEXP(XEXP(dst,0),0);
2742
+               if (REG_P(addr)) {
2743
+                       zip_gen_move_rtl(
2744
+                               gen_rtx_MEM(SImode, plus_constant(Pmode,addr,
2745
+                                       SUBREG_BYTE(dst),false)),src);
2746
+               } else if ((GET_CODE(addr)==PLUS)
2747
+                               &&(REG_P(XEXP(addr,0)))
2748
+                               &&(CONST_INT_P(XEXP(addr,1)))) {
2749
+                       rtx addreg = XEXP(addr,0);
2750
+                       zip_gen_move_rtl(
2751
+                               gen_rtx_MEM(SImode, plus_constant(Pmode,addreg,
2752
+                                       INTVAL(XEXP(addr,1))+SUBREG_BYTE(dst),
2753
+                                       false)),src);
2754
+               } else fprintf(stderr, "ZIP/Cannot understand SUBREG\n");
2755
+       } else if (SMEM_P(src)) {
2756
+               rtx     addr = XEXP(XEXP(src,0),0);
2757
+               if (REG_P(addr)) {
2758
+                       zip_gen_move_rtl(dst,
2759
+                               gen_rtx_MEM(SImode, plus_constant(Pmode,addr,
2760
+                                       SUBREG_BYTE(src),false)));
2761
+               } else if ((GET_CODE(addr)==PLUS)
2762
+                               &&(REG_P(XEXP(addr,0)))
2763
+                               &&(CONST_INT_P(XEXP(addr,1)))) {
2764
+                       rtx addreg = XEXP(addr,0);
2765
+                       zip_gen_move_rtl(dst,
2766
+                               gen_rtx_MEM(SImode, plus_constant(Pmode,addreg,
2767
+                                       INTVAL(XEXP(addr,1))+SUBREG_BYTE(src),
2768
+                                       false)));
2769
+               } else fprintf(stderr, "ZIP/Cannot understand SUBREG\n");
2770 102 dgisselq
+       } else {
2771
+               fprintf(stderr, "ZIP/No usable move\n");
2772
+               zip_debug_rtx_pfx("TO  : ", dst);
2773
+               zip_debug_rtx_pfx("FROM: ", src);
2774
+               debug_rtx(dst);
2775
+               debug_rtx(src);
2776
+               return false;
2777
+       }
2778
+       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE -- DONE\n");
2779
+       return true;
2780
+}
2781
+
2782
+const char *zip_set_zero_or_one(rtx condition, rtx dst) {
2783 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2784 102 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::SET-ZERO-OR-ONE\n");
2785
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
2786
+       if (dbg) zip_debug_rtx_pfx("REG", dst);
2787
+       switch(GET_CODE(condition)) {
2788
+       case EQ:        return "LDI\t0,%0\n\tLDILO.Z\t1,%0";
2789
+       case NE:        return "LDI\t0,%0\n\tLDILO.NZ\t1,%0";
2790
+       case LT:        return "LDI\t0,%0\n\tLDILO.LT\t1,%0";
2791
+       case GT:        return "LDI\t0,%0\n\tLDILO.GT\t1,%0";
2792
+       case LE:        return "LDI\t1,%0\n\tLDILO.GT\t0,%0";
2793
+       case GE:        return "LDI\t0,%0\n\tLDILO.GE\t1,%0";
2794
+       case LTU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0";
2795
+       case GTU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0\n\tLDILO.Z\t0,%0";
2796
+       case LEU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0\n\tLDILO.Z\t1,%0";
2797
+       case GEU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0";
2798
+       default:
2799
+               zip_debug_rtx(condition);
2800
+               internal_error("CSTORE Unsupported condition");
2801
+               return NULL;
2802
+       }
2803
+}
2804
+
2805
+const char *zip_binary_movsicc(rtx_code condition, const char *op, const int opno) {
2806
+       static char     result[64] = "";
2807
+       switch(condition) {
2808
+               //
2809
+               // Result already exists in the iffalse register
2810
+               // Can't change it.  Therefore, on the
2811
+               // condition ... move true register to the
2812
+               // destination
2813
+               //
2814
+               case EQ:        sprintf(result, "%s.Z\t%%%d,%%0", op, opno); break;
2815
+               case NE:        sprintf(result, "%s.NZ\t%%%d,%%0", op, opno); break;
2816
+               case LT:        sprintf(result, "%s.LT\t%%%d,%%0", op, opno); break;
2817
+               case GT:        sprintf(result, "%s.GT\t%%%d,%%0", op, opno); break;
2818
+               // .LE doesn't exist on Zip CPU--turn this into two instructions
2819
+               case LE:        sprintf(result, "%s.LT\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
2820
+               case GE:        sprintf(result, "%s.GE\t%%%d,%%0", op, opno); break;
2821
+               case LTU:       sprintf(result, "%s.C\t%%%d,%%0", op, opno); break;
2822
+               //
2823
+               // .GTU doesn't exist on the Zip CPU either. We also note that
2824
+               // .C will never be set on an equal condition.  Therefore, we
2825
+               // turn this into a XOR.NZ 2,CC, which will set the .C condition
2826
+               // as long as .Z wasn't true.  We then undo this when we're
2827
+               // done.  This is possible since none of these instructions
2828
+               // (LDI/MOV/Lod conditional, nor Xor conditional) will ever set
2829
+               // the condition codes.
2830
+               //
2831
+               // This is obviously not very optimal.  Avoid this by all means
2832
+               // if you can
2833
+               case GTU:       sprintf(result, "XOR.NZ\t2,CC\n%s.C\t%%%d,%%0\n\tXOR.NZ\t2,CC", op, opno); break;
2834
+               // .LEU doesn't exist on Zip CPU either--turn this into another
2835
+               // two instructions
2836
+               case LEU:       sprintf(result, "%s.C\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
2837
+               //
2838
+               // .GEU doesn't exist on Zip CPU.  Implementing it her is
2839
+               // painful.  We can change the condition codes to make it so,
2840
+               // but the instruction requires the condition codes not be
2841
+               // changed.  Hence, we must change them back if we do so.
2842
+               //
2843
+               // .C will be set on less than but not equal.  Hence !.C will
2844
+               // be true on greater than or equal.
2845
+               case GEU:       sprintf(result, "XOR\t2,CC\n%s.C\t%%%d,%%0\n\tXOR\t2,CC", op, opno); break;
2846
+               default:
2847
+                       internal_error("MOVSICC(BINARY) Unsupported condition");
2848
+                       return NULL;
2849
+       } return result;
2850
+}
2851
+
2852
+const char *zip_tertiary_movsicc(rtx condition, const char *optrue, const char *opfalse) {
2853
+       static  char    result[64] = "";
2854
+       switch(GET_CODE(condition)) {
2855
+               case EQ:        sprintf(result,"%s\t%%3,%%0\n\t%s.Z\t%%2,%%0", opfalse, optrue); break;
2856
+               case NE:        sprintf(result,"%s\t%%3,%%0\n\t%s.NZ\t%%2,%%0", opfalse, optrue); break;
2857
+               case LT:        sprintf(result,"%s\t%%3,%%0\n\t%s.LT\t%%2,%%0", opfalse, optrue); break;
2858
+               case GT:        sprintf(result,"%s\t%%3,%%0\n\t%s.GT\t%%2,%%0", opfalse, optrue); break;
2859
+               // LE doesn't exist on a Zip CPU.  Accomplish this by
2860
+               // reversing the condition: i.e., load the false value into
2861
+               // the register, and the on condition load the true value.
2862
+               case LE:        sprintf(result,"%s\t%%2,%%0\n\t%s.GT\t%%3,%%0", optrue, opfalse); break;
2863
+               case GE:        sprintf(result,"%s\t%%3,%%0\n\t%s.GE\t%%2,%%0", opfalse, optrue); break;
2864
+               case LTU:       sprintf(result,"%s\t%%3,%%0\n\t%s.C\t%%2,%%0", opfalse, optrue); break;
2865
+               //
2866
+               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;
2867
+               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;
2868
+               case GEU:       sprintf(result,"%s\t%%2,%%0\n\t%s.C\t%%3,%%0\n", optrue, opfalse); break;
2869
+               default:
2870
+                       internal_error("MOVSICC Unsupported condition");
2871
+                       return NULL;
2872
+       } return result;
2873
+}
2874
+
2875
+const char *zip_movsicc(rtx dst, rtx condition, rtx iftrue, rtx iffalse) {
2876 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2877 102 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::MOVSICC\n");
2878
+       if (dbg) zip_debug_rtx_pfx("DST", dst);
2879
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
2880
+       if (dbg) zip_debug_rtx_pfx("TRU", iftrue);
2881
+       if (dbg) zip_debug_rtx_pfx("FAL", iffalse);
2882
+       if ((REG_P(iftrue))&&(REGNO(dst)==REGNO(iftrue))) {
2883
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- CASE if(X) -> R\n");
2884
+               if (zip_legitimate_move_operand_p(SImode, iffalse, true))
2885
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "MOV", 3);
2886
+               else if (zip_const_address_operand(iffalse))
2887
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LDI", 3);
2888
+               else if (zip_const_address_operand(iffalse))
2889
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LDI", 3);
2890 111 dgisselq
+               else if ((MEM_P(iffalse))&&(zip_legitimate_opb(XEXP(iffalse,0), true)))
2891 102 dgisselq
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LOD", 3);
2892
+               else {
2893
+                       internal_error("MOVSICC Unsupported mode");
2894
+                       return NULL;
2895
+               }
2896
+       } if ((REG_P(iftrue))&&(REGNO(dst)==REGNO(iftrue))) {
2897
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- CASE if(!X) -> R\n");
2898
+               if (zip_legitimate_move_operand_p(SImode, iftrue, true))
2899
+                       return zip_binary_movsicc(GET_CODE(condition), "MOV",2);
2900
+               else if (zip_const_address_operand(iffalse))
2901
+                       return zip_binary_movsicc(GET_CODE(condition), "LDI",2);
2902
+               else if (zip_const_address_operand(iffalse))
2903
+                       return zip_binary_movsicc(GET_CODE(condition), "LDI",2);
2904 111 dgisselq
+               else if ((MEM_P(iffalse))&&(zip_legitimate_opb(XEXP(iffalse,0), true)))
2905 102 dgisselq
+                       return zip_binary_movsicc(GET_CODE(condition), "LOD",2);
2906
+               else {
2907
+                       internal_error("MOVSICC Unsupported mode");
2908
+                       return NULL;
2909
+               }
2910
+       } if ((zip_const_address_operand(iftrue))&&(zip_const_address_operand(iffalse))) {
2911
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) #1 ELSE #2\n");
2912
+               return zip_tertiary_movsicc(condition, "LDI", "LDI");
2913
+       } if ((zip_const_address_operand(iftrue))&&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
2914
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) #1 ELSE A+B\n");
2915
+               return zip_tertiary_movsicc(condition, "LDI", "MOV");
2916
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))&&(zip_const_address_operand(iffalse))) {
2917
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE #x\n");
2918
+               return zip_tertiary_movsicc(condition, "MOV", "LDI");
2919
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))
2920
+                       &&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
2921
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE C+D\n");
2922
+               return zip_tertiary_movsicc(condition, "MOV", "MOV");
2923
+       }
2924
+       if ((MEM_P(iftrue))
2925 111 dgisselq
+               &&(zip_legitimate_opb(XEXP(iftrue,0), true))
2926 102 dgisselq
+               &&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
2927
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A[B] ELSE C+D\n");
2928
+               return zip_tertiary_movsicc(condition, "LOD", "MOV");
2929
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))
2930 111 dgisselq
+               &&(MEM_P(iffalse))&&(zip_legitimate_opb(XEXP(iffalse,0), true))) {
2931 102 dgisselq
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE C[D]\n");
2932
+               return zip_tertiary_movsicc(condition, "MOV", "LOD");
2933 111 dgisselq
+       } if ((MEM_P(iftrue))&&(zip_legitimate_opb(XEXP(iftrue,0), true))
2934
+               &&(MEM_P(iffalse))&&(zip_legitimate_opb(XEXP(iffalse,0), true))) {
2935 102 dgisselq
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A[B] ELSE C[D]\n");
2936
+               return zip_tertiary_movsicc(condition, "LOD", "LOD");
2937 111 dgisselq
+       } if ((MEM_P(iftrue))
2938
+               &&(zip_legitimate_opb(XEXP(iftrue,0),true))
2939
+               &&(zip_const_address_operand(iffalse))) {
2940
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A[B] ELSE #x\n");
2941
+               return zip_tertiary_movsicc(condition, "LOD", "LDI");
2942
+       } if ((MEM_P(iffalse))
2943
+               &&(zip_legitimate_opb(XEXP(iffalse,0),true))
2944
+               &&(zip_const_address_operand(iftrue))) {
2945
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) #x ELSE A[B]\n");
2946
+               return zip_tertiary_movsicc(condition, "LDI", "LOD");
2947 102 dgisselq
+       }
2948
+
2949
+       internal_error("MOVSICC Operands not supported");
2950
+}
2951
+
2952
+const char *zip_addsicc(rtx dst, rtx condition, rtx ifsrc, rtx addv ATTRIBUTE_UNUSED) {
2953
+       // We know upon entry that REG_P(dst) must be true
2954
+       if (!REG_P(dst))
2955
+               internal_error("%s","ADDSICC into something other than register");
2956
+       if ((REG_P(ifsrc))&&(REGNO(dst)==REGNO(ifsrc))) {
2957
+               switch (GET_CODE(condition)) {
2958
+               case EQ: return "ADD.Z\t%3,%0";
2959
+               case NE: return "ADD.NZ\t%3,%0";
2960
+               case LT: return "ADD.LT\t%3,%0";
2961
+               case GT: return "ADD.GT\t%3,%0";
2962
+               case LE: return "ADD.LT\t%3,%0\n\tADD.Z\t%3,%0";
2963
+               case GE: return "ADD.GE\t%3,%0";
2964
+               case LTU: return "ADD.C\t%3,%0";
2965
+               case LEU: return "ADD.C\t%3,%0\n\tADD.Z\t%3,%0";
2966
+               case GEU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tXOR\t2,CC";
2967
+               // Can do a GEU comparison, and then undo on the Zero condition
2968
+               case GTU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tSUB.Z\t%3,%0\n\tXOR\t2,CC";
2969
+               default:
2970
+                       internal_error("%s", "Zip/No usable addsi expansion");
2971
+                       break;
2972
+               }
2973
+       } else {
2974
+               // MOV A+REG,REG
2975
+               switch (GET_CODE(condition)) {
2976
+               case EQ: return "MOV.Z\t%3+%2,%0";
2977
+               case NE: return "MOV.NZ\t%3+%2,%0";
2978
+               case LT: return "MOV.LT\t%3+%2,%0";
2979
+               case GT: return "MOV.GT\t%3+%2,%0";
2980
+               case LE: return "MOV.LT\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
2981
+               case GE: return "MOV.GE\t%3+%2,%0";
2982
+               case LTU: return "MOV.C\t%3+%2,%0";
2983
+               case LEU: return "MOV.C\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
2984
+               case GEU: return "XOR\t2,CC\n\tMOV.C\t%3+%2,%0\n\tXOR\t2,CC";
2985
+               // Can do a GEU comparison, and then undo on the Zero condition
2986
+               // EXCEPT: with a move instruction, what's there to undo?  We
2987
+               // just clobbered our register!
2988
+               // case GTU: return "XOR\t2,CC\n\tMOV.C\t%3,%0\n\tSUB.Z\t%3,%0XOR\t2,CC";
2989
+               default:
2990
+                       internal_error("%s", "Zip/No usable addsi(reg,reg) expansion");
2991
+                       break;
2992
+               }
2993
+       }
2994
+
2995
+       return "BREAK";
2996
+}
2997
+
2998 103 dgisselq
+static int     zip_memory_move_cost(machine_mode mode, reg_class_t ATTRIBUTE_UNUSED, bool in ATTRIBUTE_UNUSED) {
2999 102 dgisselq
+       int     rv = 14;
3000
+       if ((mode == DImode)||(mode == DFmode))
3001
+               rv += 2;
3002
+       return rv;
3003
+}
3004
+
3005 103 dgisselq
+// #warning "How do we tell the compiler LDI label is expensive as 2 ops"?
3006 102 dgisselq
+
3007
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.h gcc-5.3.0-zip/gcc/config/zip/zip.h
3008
--- gcc-5.3.0-original/gcc/config/zip/zip.h     1969-12-31 19:00:00.000000000 -0500
3009 111 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.h  2016-03-19 12:03:33.888255495 -0400
3010
@@ -0,0 +1,3889 @@
3011 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
3012
+//
3013
+// Filename:   gcc/config/zip/zip.h
3014
+//
3015
+// Project:    Zip CPU backend for the GNU Compiler Collection
3016
+//
3017
+// Purpose:
3018
+//
3019
+// Creator:    Dan Gisselquist, Ph.D.
3020
+//             Gisselquist Technology, LLC
3021
+//
3022
+////////////////////////////////////////////////////////////////////////////////
3023
+//
3024
+// Copyright (C) 2016, Gisselquist Technology, LLC
3025
+//
3026
+// This program is free software (firmware): you can redistribute it and/or
3027
+// modify it under the terms of  the GNU General Public License as published
3028
+// by the Free Software Foundation, either version 3 of the License, or (at
3029
+// your option) any later version.
3030
+//
3031
+// This program is distributed in the hope that it will be useful, but WITHOUT
3032
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
3033
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3034
+// for more details.
3035
+//
3036
+// You should have received a copy of the GNU General Public License along
3037
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
3038
+// target there if the PDF file isn't present.)  If not, see
3039
+// <http://www.gnu.org/licenses/> for a copy.
3040
+//
3041
+// License:    GPL, v3, as defined and found on www.gnu.org,
3042
+//             http://www.gnu.org/licenses/gpl.html
3043
+//
3044
+//
3045
+////////////////////////////////////////////////////////////////////////////////
3046
+#ifndef        GCC_ZIP_H
3047
+#define        GCC_ZIP_H
3048
+
3049
+
3050
+//
3051
+//
3052
+// Zip CPU configuration registers
3053
+//
3054
+//
3055
+#define        ZIP_USER        0        // Assume we are in supervisor mode
3056
+#define        ZIP_MULTIPLY    1       // Assume we have multiply instructions
3057
+#define        ZIP_DIVIDE      1       // Assume we have divide instructions
3058
+#define        ZIP_FPU         0        // Assume we have no floating point instructions
3059
+#define        ZIP_PIPELINED   1       // Assume our instructions are pipelined
3060
+#define        ZIP_VLIW        1       // Assume we have the VLIW feature
3061
+#define        ZIP_ATOMIC      ((ZIP_PIPELINED)&&(ZIP_VLIW))
3062
+#define        ZIP_PIC         0        // Attempting to produce PIC code, with GOT
3063
+#define        ZIP_HAS_DI      1
3064
+
3065
+// Zip has 16 registers in each user mode.
3066
+//     Register 15 is the program counter (PC)
3067
+//     Register 14 is the condition codes (CC)
3068
+//     Register 13 is the stack pointer   (SP)
3069
+//     Register 12 (may be) the Global Offset Table pointer (GOT)
3070
+//     Register  0 (may be) the return address pointer
3071
+// Registers 16-31 may only be used in supervisor mode.
3072
+#define        is_ZIP_GENERAL_REG(REGNO)       ((REGNO)<13)
3073
+#define        is_ZIP_REG(REGNO)               ((REGNO)<16)
3074
+
3075 103 dgisselq
+// #define     zip_FP_PSEUDO   16
3076
+#define        zip_PC          15
3077
+#define        zip_CC          14
3078
+#define        zip_SP          13
3079
+#define        zip_FP          12
3080
+#define        zip_GOT         11
3081
+#define        zip_AP          10
3082
+#define        zip_R1          1
3083
+#define        zip_R0          0
3084 102 dgisselq
+
3085
+#define        ZIP_FIRST_ARG_REGNO     1
3086
+#define        ZIP_LAST_ARG_REGNO      5
3087 111 dgisselq
+#define        NUM_ARG_REGS            (ZIP_LAST_ARG_REGNO-ZIP_FIRST_ARG_REGNO+1)
3088
+#define        MAX_PARM_REGS           (ZIP_LAST_ARG_REGNO-ZIP_FIRST_ARG_REGNO+1)
3089 102 dgisselq
+
3090
+/* The overall framework of an assembler file */
3091
+
3092
+#define        ASM_COMMENT_START       ";"
3093
+#define        ASM_APP_ON              ""
3094
+#define        ASM_APP_OFF             ""
3095
+
3096
+#define        FILE_ASM_OP             "\t.file\n"
3097
+
3098
+/* Output and Generation of Labels */
3099
+#define        GLOBAL_ASM_OP           "\t.global\t"
3100
+
3101
+#undef BITS_PER_UNIT
3102
+#define        BITS_PER_UNIT   (32)
3103
+
3104
+/* Assembler Commands for Alignment */
3105
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
3106
+               { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
3107
+
3108
+
3109
+/* A C compound statement to output to stdio stream STREAM the assembler syntax
3110
+ * for an instruction operand X. */
3111
+#define        PRINT_OPERAND(STREAM, X, CODE)  zip_print_operand(STREAM, X, CODE)
3112
+#define        PRINT_OPERAND_ADDRESS(STREAM, X) zip_print_operand_address(STREAM, X)
3113
+
3114
+/* Passing arguments in registers */
3115
+#define        FUNCTION_VALUE_REGNO_P(REGNO)   ((REGNO)==zip_R1)
3116
+
3117
+/* Define how to find the value returned by a function.  VALTYPE is the data
3118
+ * type of the value (as a tree).  If the precise function being called is known
3119
+ * FUNC is its FUNCTION_DECL; otherwise, FUNC is 0. */
3120
+#define        FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx_REG(TYPE_MODE(VALTYPE), zip_R1)
3121
+
3122
+/* Define how to find the value returned by a library function assuming the
3123
+ * value has mode MODE.
3124
+ */
3125
+#define        LIBCALL_VALUE(MODE)     gen_rtx_REG(MODE, zip_R1)
3126
+
3127
+
3128
+/* STACK AND CALLING */
3129
+
3130
+
3131
+/* Define this macro as a C expression that is nonzero for registers that are
3132
+ * used by the epilogue or the return pattern.  The stack and frame pointer
3133
+ * registers are already assumed to be used as needed.
3134
+ */
3135
+#define        EPILOGUE_USES(R)        (R == RETURN_ADDRESS_REGNUM)
3136
+
3137
+
3138
+/* Normal alignment required for function parameters on the stack, in bits.  All
3139
+ * stack parameters receive at leaswt this much alignment regardless of data
3140
+ * type. */
3141
+#define        PARM_BOUNDARY   32
3142
+
3143
+/* Alignment of field after 'int : 0' in a structure. */
3144
+#define        EMPTY_FIELD_BOUNDARY    32
3145
+
3146
+/* No data type wants to be aligned rounder than this. */
3147
+#define        BIGGEST_ALIGNMENT       32
3148
+
3149
+/* The best alignment to use in cases where we have a choice. */
3150
+#define        FASTEST_ALIGNMENT       32
3151
+
3152
+/* Every structures size must be a multiple of 32-bits. */
3153
+#define        STRUCTURE_SIZE_BOUNDARY 32
3154
+
3155
+/* PCC_BITFIELD_TYPE_MATTERS -- define this if you wish to imitate the the way
3156
+ * other C compilers handle alignment of bit-fields and the structures that
3157
+ * contain them.
3158
+ *
3159
+ * The behavior is that the type written for a named bit-field (int, short, or
3160
+ * other integer type) imposes an alignment for the entire structure, as if the
3161
+ * structure really did contain an ordinary field of that type.  In addition,
3162
+ * the bit-field is placed within the structure so that it would fit within
3163
+ * such a field, not crossing a boundary for it.
3164
+ *
3165
+ * Thus, no most machines, a named bit-field whose type is written as int would
3166
+ * not cross a four-byte boundary, and would force four-byte alignment for the
3167
+ * whole structure.  (The alignment used may not be four bytes; it is controlled
3168
+ * by other alignment parameters.)
3169
+ *
3170
+ * An unnamed bit-field will not affect the alignment of the containing
3171
+ * structure.
3172
+ *
3173
+ * If thhe macro is defined, its definition should be a C expression, a non
3174
+ * zero value for the expression enables this behavior.
3175
+ * Look at the fundamental type that is used for a bit-field and use that to
3176
+ * impose alignment on the enclosing structure.  struct s{int a:8}; should
3177
+ * have the same alignment as 'int', not 'char'.
3178
+ */
3179
+#undef PCC_BITFIELD_TYPE_MATTERS
3180
+#define        PCC_BITFIELD_TYPE_MATTERS       0
3181
+
3182
+/* MAX_FIXED_MODE_SIZE -- An integer expression for the size in bits of the
3183
+ * largest integer machine mode that should actually be used.  All integer
3184
+ * machine modes of this size and smaller can be used for structures and unions
3185
+ * with the appropriate sizes.  If this macro is undefined,
3186
+ * GET_MODE_BITSIZE(DImode) is assumed.
3187
+ *
3188
+ * ZipCPU -- The default looks good enough for us.
3189
+ */
3190
+
3191
+/* Make strings word-aligned so strcpy from constants will be faster. */
3192
+#define        CONSTANT_ALIGNMENT(EXP, ALIGN)  (((TREE_CODE(EXP)==STRING_CST)  \
3193
+       && ((ALIGN) < FASTEST_ALIGNMENT)) ? FASTEST_ALIGNMENT : (ALIGN))
3194
+
3195
+/* Make arrays of chars word-aligned for the same reasons. */
3196
+#define        DATA_ALIGNMENT(TYPE, ALIGN)     ((TREE_CODE(TYPE) == ARRAY_TYPE) \
3197
+       && (TYPE_MODE(TREE_TYPE(TYPE)) == QImode)               \
3198
+       && ((ALIGN < FASTEST_ALIGNMENT) ? FASTEST_ALIGNMENT : (ALIGN)))
3199
+
3200
+/* Generate Code for Profiling
3201
+ */
3202
+#define        FUNCTION_PROFILER(FILE,LABELNO)         (abort(), 0)
3203
+
3204
+
3205
+/* A C expression which is nonzero if register number NUM is suitable for use
3206
+ * as an index register in operand addresses.
3207
+ */
3208
+#define        REGNO_OK_FOR_INDEX_P(NUM)       0
3209
+
3210
+
3211
+/* A C compound statement with a conditional 'goto LABEL;' executed if X
3212
+ * (an RTX) is a legitimate memory address on the target machine for a memory
3213
+ * operand of mode MODE.
3214
+ */
3215 111 dgisselq
+/* 17.03 Controlling the Compilation Driver, 'gcc' */
3216
+// DRIVER_SELF_SPECS
3217
+// OPTION_DEFAULT_SPECS
3218
+// CPP_SPEC
3219
+// CPLUSPLUS_CPP_SPEC
3220
+// CC1_SPEC
3221
+// CC1PLUS_SPEC
3222
+/* ASM_SPEC ... A C string constant that tells the GCC driver program options
3223
+ * to pass to the assembler.  It can also specify how to translate options you
3224
+ * give to GCC into options for GCC to pass to the assembler.  See the file
3225
+ * 'sun3.h' for an example of this.
3226
+ *
3227
+ * Do not define thismacro if it does not need to do anything.
3228
+ */
3229
+// #undef      ASM_SPEC
3230
+// ASM_FINAL_SPEC
3231
+// ASM_NEEDS_DASH_FOR_PIPED_INPUT
3232
+
3233
+/* LINK_SPEC ... A C string constant that tells the GCC driver program options
3234
+ * to pass to the linker.  It can also specify how to translate options you give
3235
+ * to GCC into options for GCC to pass to the linker.
3236
+ *
3237
+ * Do not define this macro if it does not need to do anything.
3238
+ */
3239
+
3240
+/* LIB_SPEC ... Another C string constant very much like LINK_SPEC.  The
3241
+ * difference between the two is that LIB_SPEC is used at the end of the
3242
+ * command given to the linker.
3243
+ *
3244
+ * If this macro is not defined, a default is provided that loads the standard
3245
+ * C library from the usual place.  See 'gcc.c'.
3246
+ */
3247
+#undef LIB_SPEC
3248
+// #define     LIB_SPEC        "%{!g:-lc} %{g:-lg} -lzip"
3249
+#define        LIB_SPEC        ""
3250
+
3251
+/* LIBGCC_SPEC ... Another C string constant that tells the GCC driver program
3252
+ * hoow and when to place a reference to 'libgcc.a' into the linker command
3253
+ * line.  This constant is placed both before and after the value of LIB_SPEC.
3254
+ *
3255
+ * If this macro is not defined, the GCC driver provides a default that passes
3256
+ * the string '-lgcc' to the linker.
3257
+ */
3258
+#undef LIBGCC_SPEC
3259
+#define        LIBGCC_SPEC     ""
3260
+
3261
+/* REAL_LIBGCC_SPEC ... By default, if ENABLE_SHARED_LIBGCC is defined, the
3262
+ * LIBGCC_SPEC is not directly used by the driver program but is instead
3263
+ * modified to refer to different versions of 'libgcc.a' depending on the
3264
+ * values of the command line flags '-static', '-shared', '-static-libgcc',
3265
+ * and '-shared-libgcc'.  On targets where these modifications are
3266
+ * inappropriate, define REAL_LIBGCC_SPEC instead.  REAL_LIBGCC_SPEC tells the
3267
+ * driver how to place a reference to 'libgcc' on the link command line, but
3268
+ * unlike LIBGCC_SPEC, it is used unmodified.
3269
+ */
3270
+#define        REAL_LIBGCC_SPEC        ""
3271
+
3272
+// USE_LD_AS_NEEDED
3273
+// LINK_EH_SPEC
3274
+
3275
+/* STARTFILE_SPEC ... Another C string constant used much like LINK_SPEC.  The
3276
+ * difference between the two is that STARTFILE_SPEC is used at the very
3277
+ * beginning of the command given to the linker.
3278
+ *
3279
+ * If this macro is not defined, a default is provided that loads the standard
3280
+ * C startup file from the usual place.  See 'gcc.c'
3281
+ */
3282
+#undef STARTFILE_SPEC
3283
+#define        STARTFILE_SPEC  ""
3284
+
3285
+/* ENDFILE_SPEC ... Another C string constant used much like LINK_SPEC.  The
3286
+ * difference between the two is that ENDFILE_SPEC is used at the very end
3287
+ * of the command given to the linker.
3288
+ *
3289
+ * Do not define this macro if it does not do anything.
3290
+ */
3291
+// #undef      ENDFILE_SPEC
3292
+// #define     ENDFILE_SPEC    ""
3293
+
3294
+// THREAD_MODEL_SPEC
3295
+// SYSROOT_SUFFIX_SPEC
3296
+// SYSROOT_HEADERS_SUFFIX_SPEC
3297
+// EXTRA_SPECS
3298
+// LINK_LIBGCC_SPECIAL_1
3299
+// LINK_GCC_C_SEQUENCE_SPEC
3300
+// LINK_COMMAND_SPEC
3301
+// TARGET_ALWAYS_STRIP_DOTDOT
3302
+// MULTILIB_DEFAULTS
3303
+// RELATIVE_PREFIX_NOT_LINKDIR
3304
+// MD_EXEC_PREFIX
3305
+// STANDARD_STARTFILE_PREFIX
3306
+// STANDARD_STARTFILE_PREFIX_1
3307
+// STANDARD_STARTFILE_PREFIX_2
3308
+// MD_STARTFILE_PREFIX
3309
+// MD_STARTFILE_PREFIX_1
3310
+// INIT_ENVIRONMENT
3311
+// LOCAL_INCLUDE_DIR
3312
+#undef LOCAL_INCLUDE_DIR
3313
+
3314
+// NATIVE_SYSTEM_HEADER_COMPONENT
3315
+// INCLUDE_DEFAULTS
3316
+
3317 102 dgisselq
+/* 17.03 Run-time Target Specification */
3318
+
3319
+/* TARGET_CPU_CPP_BUILTINS() ... This function-like macro expands to a block of
3320
+ * code that defines built-in preprocessor macros and assertions for the target
3321
+ * CPU, using the functions builtin_define, builtin_define_std, and
3322
+ * builtin_assert.  When the front end calls this macro it provides a trailing
3323
+ * semicolon, and since it has finished command line option proccessing your
3324
+ * code can use those results freely.
3325
+ *
3326
+ * ZipCPU --- We should probably capture in this macro what capabilities the
3327
+ * command line parameters we've been given indicate that our CPU has.  That
3328
+ * way, code can be adjusted depending upon the CPU's capabilities.
3329
+ */
3330
+#define        TARGET_CPU_CPP_BUILTINS()                       \
3331
+       { builtin_define("__ZIPCPU__");                 \
3332
+       if (ZIP_FPU) builtin_define("__ZIPFPU__");      \
3333
+       if (ZIP_ATOMIC) builtin_define("__ZIPATOMIC__");        \
3334
+       }
3335
+       // If (zip_param_has_fpu)  builtin_define("__ZIPFPU__");
3336
+       // If (zip_param_has_div)  builtin_define("__ZIPDIV__");
3337
+       // If (zip_param_has_mpy)  builtin_define("__ZIPMPY__");
3338
+       // If (zip_param_has_lock) builtin_define("__ZIPLOCK__");
3339
+       // If (zip_param_supervisor) builtin_define("__ZIPUREGS__");
3340
+       // If (we support int64s) builtin_define("___int64_t_defined");
3341
+
3342
+/* TARGET_OS_CPP_BUILTINS() ... Similarly to TARGET_CPU_CPP_BUILTINS but this
3343
+ * macro is optional and is used for the target operating system instead.
3344
+ */
3345
+
3346
+/* Option macros: (we need to define these eventually ... )
3347
+ *
3348
+ *     TARGET_HANDLE_OPTION
3349
+ *     TARGET_HANDLE_C_OPTION
3350
+ *     TARGET_OBJ_CONSTRUCT_STRING_OBJECT
3351
+ *     TARGET_OBJ_DECLARE_UNRESOLVED_CLASS_REFERENCE
3352
+ *     TARGET_OBJ_DECLARE_CLASS_DEFINITION
3353
+ *     TARGET_STRING_OBJECT_REF_TYPE_P
3354
+ *     TARGET_CHECK_STRING_OBJECT_FORMAT_ARG
3355
+ *     TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE(VOID)
3356
+ *     C_COMMON_OVERRIDE_OTPTIONS
3357
+ *     TARGET_OPTION_OPTIMIZATION_TABLE
3358
+ *     TARGET_OPTION_INIT_STRUCT
3359
+ *     TARGET_OPTION_DEFAULT_PARAMS
3360
+ */
3361
+
3362
+/* SWITCHABLE_TARGET
3363
+ *
3364
+ * Zip CPU doesn't need this, so it defaults to zero.  No need to change it
3365
+ * here.
3366
+ */
3367
+
3368
+/* TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(VOID) ... Returns true if the
3369
+ * target supports IEEE 754 floating-point exceptions and rounding modes, false
3370
+ * otherwise.  This is intended to relate to the float and double types, but not
3371
+ * necessarily "long double".  By default, returns true if the adddf3
3372
+ * instruction pattern is available and false otherwise, on the assumption that
3373
+ * hardware floating point supports exceptions and rounding modes but software
3374
+ * floating point does not.
3375
+ *
3376
+ * ZipCPU floating point is barely going to be functional, I doubt it will
3377
+ * support all of these bells and whistles when full functionality is even
3378
+ * achieved.  Therefore, we won't support these modes.  However, we can't just
3379
+ * set this to zero, so let's come back to this.
3380
+ */
3381
+// #warning "Wrong answer encoded to date"
3382 103 dgisselq
+// #undef      TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
3383 102 dgisselq
+// #define     TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(X) 0
3384
+
3385
+/* 17.04 Defining data structures for per-function information */
3386
+
3387
+/* INIT_EXPANDERS ... Macro called to initialize any target specific
3388
+ * information.  This macro is called once per function, before generation of
3389
+ * any RTL has begun.  The intention is to allow the initialization of the
3390
+ * function pointer init_machine_status.
3391
+ */
3392
+// #warning "I may need to define this to handle function return addresses ..."
3393
+
3394
+/* 17.05 Storage Layout */
3395
+
3396
+/* Storage Layout */
3397
+#define        BITS_BIG_ENDIAN         0        // MSB has highest number
3398
+#define        BYTES_BIG_ENDIAN        1       // 1 if MSB is lowest number
3399
+#define        WORDS_BIG_ENDIAN        1       // 1 if MSW is lowest number
3400
+#define        FLOAT_WORDS_BIG_ENDIAN  1
3401
+#define        BITS_PER_WORD           32
3402
+// #define     MAX_BITS_PER_WORD       // defaults to BITS_PER_WORD
3403
+#define        UNITS_PER_WORD          1       // Storage units in a word, pwr of 2:1-8
3404
+#define        MIN_UNITS_PER_WORD      1       // Default is UNITS_PER_WORD
3405
+/* POINTER_SIZE ... Width of a pointer in bits.  You must specify a value no
3406
+ * wider than the width of Pmode.  If it is not equal to the width of Pmode,
3407
+ * you must define POINTERS_EXTEND_UNSIGNED. If you do not specify a value the
3408
+ * default is BITS_PER_WORD.
3409
+ *
3410
+ * ZipCPU --- All of our pointers are 32-bits, the width of our address bus.
3411
+ */
3412
+#define        POINTER_SIZE            32      // Ptr width in bits
3413
+/* POINTERS_EXTEND_UNSIGNED ... A C expression that determines how pointers
3414
+ * should be extended from ptr_mode to either Pmode or word_mode.  It is greater
3415
+ * than zero if pointers should be zero-extended, zero if they should be sign
3416
+ * extended, and negative if some other conversion is needed.  In the last case,
3417
+ * the extension is done by the target's ptr_extend instruction.
3418
+ *
3419
+ * You need not define this macro if the ptr_mode, Pmode, and word_mode are all
3420
+ * the same width.
3421
+ *
3422
+ * ZipCPU --- While we shouldn't need this, QImode and HImode have the same
3423
+ * number of bits as SImode.  Therefore, one might wish to convert between the
3424
+ * two.  Hence, we specify how we would do that here.
3425
+ */
3426
+#define        POINTERS_EXTEND_UNSIGNED        0
3427
+
3428
+/* PROMOTE_MODE(m,unsignedp,type) ... A macro to update m and unsignedp when an
3429
+ * object whose type is type and which has he specified mode and signedness is
3430
+ * to be stored in a register.  This macro is only called when type is a scalar
3431
+ * type.
3432
+ *
3433
+ * On most RISC machines, which only have operations that operate on a full
3434
+ * register, define this macro to set m to word_mode if m is an integer mode
3435
+ * narrower than BITS_PER_WORD.  In most cases, only integer modes should be
3436
+ * widened because wider precision floating-point operations are usually more
3437
+ * expensive than their narrower counterparts.
3438
+ *
3439
+ * For most machines, the macro definition does not change unsigndep.  However,
3440
+ * some machines, have instructions that preferentially handle either signed or
3441
+ * unsigned quantities of certain modes.  For example, on the DEC Alpha, 32-bit
3442
+ * loads from memory and 32-bit add instructions sign-extend the result to
3443
+ * 64-bits. On such machines, set unsignedp according to which kind of extension
3444
+ * is more efficient.
3445
+ *
3446
+ * Do not define this macro if it would never modify m.
3447
+ *
3448
+ * ZipCPU --- We need to always (if possible) promote everything to SImode where
3449
+ * we can handle things.  HImode and QImode just don't make sense on this CPU.
3450
+ */
3451
+#define        PROMOTE_MODE(M,U,T)     if ((GET_MODE_CLASS(M)==MODE_INT)&&(GET_MODE_SIZE(M)<2)) (M)=SImode;
3452
+
3453
+// TARGET_PROMOTE_FUNCTION_MODE
3454
+/* PARM_BOUNDARY ... Normal alignment required for function parameters on the
3455
+ * stack, in bits.  All stack parameters receive at least this much alignment
3456
+ * regardless of data type.  On most machines, this is the same as the size of
3457
+ * an integer.
3458
+ */
3459
+#define        PARM_BOUNDARY   32
3460
+
3461
+/* STACK_BOUNDARY ... Define this macro to the minimum alignment enforced by
3462
+ * hardware for the stack pointer on this machine.  The definition is a C
3463
+ * expression for the desired alignment (measured in bits).  This value is used
3464
+ * as a default if PREFERRED_STACK_BOUNDARY is not defined.  On most machines,
3465
+ * this should be the same as PARM_BOUNDARY.
3466
+ */
3467
+#define        STACK_BOUNDARY  PARM_BOUNDARY
3468
+
3469
+/* PREFERRED_STACK_BOUNDARY ... Define this ... */
3470
+
3471
+/* INCOMING_STACK_BOUNDARY
3472
+ */
3473
+
3474
+/* FUNCTION_BOUNDARY ... Alignment required for a function entry point, in bits.
3475
+ */
3476
+#define        FUNCTION_BOUNDARY       32
3477
+
3478
+/* BIGGEST_ALIGNMENT ... Biggest alignment that any data type can require on
3479
+ * this machine, in bits.  Note that this is not the biggest alignment that is
3480
+ * supported, just the biggest alignment that, when violated, may cause a fault.
3481
+ */
3482
+#define BIGGEST_ALIGNMENT      32
3483
+
3484
+/* MINIMUM_ATOMIC_ALIGNMENT ... If defined, the smallest alignment, that can be
3485
+ * given to an object that can be referenced in one operation, without
3486
+ * disturbing any nearby object.  Normally, this is BITS_PER_UNIT, but may be
3487
+ * larger on machines that don't have byte or halfword store operations.
3488
+ */
3489
+#define        MINIMUM_ATOMIC_ALIGNMENT        BITS_PER_UNIT
3490
+
3491
+/* STRICT_ALIGNMENT ... Set this nonzero if move instructions will actually
3492
+ * fail to work when given unaligned data.  If instructions will merely go
3493
+ * slower in that case, define this macro as 0.
3494
+ */
3495
+#define        STRICT_ALIGNMENT        1
3496
+
3497
+/* MAX_FIXED_MODE_SIZE ... An integer expression for the size in bits of the
3498
+ * largest integer machine mode that should actually be used.  All integer
3499
+ * machine modes of this size or smaller can be used for structures and unions
3500
+ * with the appropriate sizes.  If this macro is undefined,
3501
+ * GET_MODE_BITSIZE(DImode) is assumed.
3502
+ *
3503
+ * ZipCPU ... Get_MOD_BITSIZE(DImode) will be 64, and this is really not the
3504
+ * size on bits of the largest integer machine mode.  However, that's the case
3505
+ * with most DI implementations: A long is two words, spliced together.  We'd
3506
+ * like to support that eventually, but we need to get there.  Hence, let's use
3507
+ * compile time flag (ZIP_HAS_DI) that we can enable when we're ready.
3508
+ */
3509
+#if (ZIP_HAS_DI != 0)
3510
+#define        MAX_FIXED_MODE_SIZE     64
3511
+#else
3512
+#define        MAX_FIXED_MODE_SIZE     32
3513
+#endif
3514
+
3515
+
3516
+/* 17.06 Layout of Source Language Data Types */
3517
+
3518
+#undef CHAR_TYPE_SIZE
3519
+#undef SHORT_TYPE_SIZE
3520
+#undef INT_TYPE_SIZE
3521
+#undef LONG_TYPE_SIZE
3522
+#undef LONG_LONG_TYPE_SIZE
3523
+//
3524
+#define        CHAR_TYPE_SIZE  32
3525
+#define        SHORT_TYPE_SIZE 32
3526
+#define        INT_TYPE_SIZE   32
3527
+#define        LONG_TYPE_SIZE  32
3528
+#define        LONG_LONG_TYPE_SIZE     64
3529
+// BOOL_TYPE_SIZE defaults to CHAR_TYPE_SIZE
3530
+#undef FLOAT_TYPE_SIZE
3531
+#undef DOUBLE_TYPE_SIZE
3532
+#undef LONG_DOUBLE_TYPE_SIZE
3533
+#define        FLOAT_TYPE_SIZE         32
3534
+#define        DOUBLE_TYPE_SIZE        FLOAT_TYPE_SIZE // Zip CPU doesn't support dbls
3535
+#define        LONG_DOUBLE_TYPE_SIZE   64      // This'll need to be done via emulation
3536
+// SHORT_FRAC_TYPE_SIZE
3537
+// LONG_FFRACT_TYPE_SIZE
3538
+// LONG_LONG_FRACT_TIME_SIZE
3539
+#undef SHORT_ACCUM_TYPE_SIZE
3540
+#undef ACCUM_TYPE_SIZE
3541
+#undef LONG_ACCUM_TYPE_SIZE
3542
+#define        SHORT_ACCUM_TYPE_SIZE   SHORT_TYPE_SIZE
3543
+#define        ACCUM_TYPE_SIZE         INT_TYPE_SIZE
3544
+#define        LONG_ACCUM_TYPE_SIZE    LONG_TYPE_SIZE
3545
+
3546
+/* LIBGCC2_GNU_PREFIX ... This macro corresponds to the TARGET_GNU_PREFIX target
3547
+ * hook and should be defined if that hook is overriden to be true.  It causes
3548
+ * function names in libgcc to be changed to use a __gnu_ prefix for their name
3549
+ * rather than the default __.  A port which uses this macro should also arrange
3550
+ * to use t-gnu-prefix in the libgcc config.host.
3551
+ *
3552
+ * ZipCPU -- I see no reason to define and therefore change this behavior.
3553
+ */
3554
+
3555
+/* TARGET_FLT_EVAL_METHOD ... A C expression for the value for FLT_EVAL_METHOD
3556
+ * in float.h,, assuming, if applicable, that the floating-point control word
3557
+ * is in its default state.  If you do not define this macro the value of
3558
+ * FLT_EVAL_METHOD will be zero.
3559
+ *
3560
+ * ZipCPU --- ???
3561
+ */
3562
+
3563
+/* WIDEST_HARDWARE_FP_SIZE ... A C expression for the size in bits of the widest
3564
+ * floating-point format supported by the hardware.  If you define this macro,
3565
+ * you must specify a value less than or equal to the value of LONG_DOUBLE_...
3566
+ * If you do not define this macro, the value of LONG_DOUBLE_TYPE_SIZE is the
3567
+ * default.
3568
+ *
3569
+ * ZipCPU supports 32-bit IEEE floats--IF THE SUPPORT IS COMPILED IN!  This
3570
+ * really needs to be determined, then, based upon a compile time parameter
3571
+ * where the one compiling the code states whether or not the H/W even has
3572
+ * floating point support.
3573
+ *
3574
+ * For now, we'll assume it does--but once we implement GCC parameters, we'll
3575
+ * need to change this.
3576
+ */
3577
+#undef WIDEST_HARDWARE_FP_SIZE
3578
+// #warning "Definition needs to change if no FPU present"
3579
+#define        WIDEST_HARDWARE_FP_SIZE FLOAT_TYPE_SIZE
3580
+
3581
+/* DEFAULT_SIGNED_CHAR ... An expression whose value is 1 or 0, according to
3582
+ * whether the type char should be signed or unsigned by default.  The user
3583
+ * can always override this default with the options -fsigned-char and
3584
+ * -funsigned-char.
3585
+ *
3586
+ * ZipCPU--let's go with the default behavior.
3587
+ */
3588
+#define        DEFAULT_SIGNED_CHAR     1
3589
+
3590
+/* TARGET_DEFAULT_SHORT_ENUMS(VOID) ... This target hook should return true if
3591 103 dgisselq
+ * the compiler should give an enum type only as many bytes as it takes to
3592 102 dgisselq
+ * represent the range of possible values of that type.  It should return
3593
+ * false if all enum types should be allocated like int.
3594
+ *
3595
+ * The default is to return false.  This is what the ZipCPU needs, so we won't
3596
+ * override it.
3597
+ */
3598
+
3599
+/* SIZE_TYPE ... A C expression for a string describing the name of the data
3600
+ * type to use for size values.  The typedef name size_t is defined using the
3601
+ * contents of the string.
3602
+ *
3603
+ * If you don't define this macro, the default is "long unsigned int".  Since
3604
+ * on the ZipCPU this is a 32-bit number, and all ZipCPU values are 32-bits,
3605
+ * the default seems perfect for us.
3606
+ */
3607
+#define        SIZE_TYPE       "unsigned int"
3608
+
3609
+/* SIZETYPE ... GCC defines internal types () for expressions dealing with size.
3610
+ * This macro is a C expression for a string describing the name of the data
3611
+ * type from which the precision of sizetype is extracted.  The string has the
3612
+ * same restrictions as SIZE_TYPE string.  If you don't define this macro, the
3613
+ * default is SIZE_TYPE --- which seems good enough for us.
3614
+ */
3615
+
3616
+/* PTRDIFF_TYPE ... A C expression for a string describing the name of the data
3617
+ * type to use fo rthe result of subtracting two pointers.  The typedef name
3618
+ * ptrdiff_t is defined using the contents of the string.  See SIZE_TYPE for
3619
+ * more information.
3620
+ *
3621
+ * The default is "long int" which for the ZipCPU is 32-bits---still good enough
3622
+ * for us.
3623
+ */
3624
+#define        PTRDIFF_TYPE    "int"
3625
+
3626
+/* WCHAR_TYPE ... A C expression for a string describing the name of the data
3627
+ * type to use for wide characters.  The typedef name wchar_t is defined using
3628
+ * the contents of  the string.  If you don't define this macro, the default is
3629
+ * 'int'--good enough for ZipCPU.
3630
+ */
3631
+
3632
+/* WCHAR_TYPE_SIZE ... A C expression for the size in bits of the data type for
3633
+ * wide characters.  This is used in cpp, which cannot make use of WCHAR_TYPE.
3634
+ */
3635
+#undef WCHAR_TYPE_SIZE
3636
+#define        WCHAR_TYPE_SIZE 32
3637
+
3638
+/* WINT_TYPE ... A C expression for a string describing the name of the data
3639
+ * type to use for wide characters passed to printf and returned from getwc.
3640
+ * The typedef name wint_t is defined using the contents of the string.  See
3641
+ *
3642 103 dgisselq
+ * ZipCPU -- If you don't define this macro, the default is "unsigned int"--also
3643
+ * best for us again.
3644 102 dgisselq
+ */
3645
+
3646
+/* INTMAX_TYPE ... A C expression for a string describing the name of the
3647
+ * data type that can represent any value of any standard or extended signed
3648
+ * integer type.  The typedef name intmax_t is defined using the contents of
3649
+ * the string.
3650
+ *
3651
+ * If you don't define this macro, the default is the first of "int", "long int"
3652
+ * or "long long int" that has as much precision as "long long int".
3653
+ */
3654
+
3655
+/* UINTMAX_TYPE ... same as INTMAX_TYPE, but for unsigned
3656
+ */
3657
+
3658
+#undef SIG_ATOMIC_TYPE
3659
+#if (ZIP_ATOMIC != 0)
3660
+#define        SIG_ATOMIC_TYPE "int"
3661
+#else
3662
+#define        SIG_ATOMIC_TYPE NULL    // We have no atomic types, but registers
3663
+#endif
3664
+#undef INT8_TYPE
3665
+#define        INT8_TYPE               NULL    // We have no 8-bit integer type
3666
+#undef INT16_TYPE
3667
+#define        INT16_TYPE              NULL
3668
+#undef INT32_TYPE
3669
+#define        INT32_TYPE              "int"
3670
+#undef UINT8_TYPE
3671
+#define        UINT8_TYPE              NULL
3672
+#undef UINT16_TYPE
3673
+#define        UINT16_TYPE             NULL
3674
+#undef UINT32_TYPE
3675
+#define        UINT32_TYPE             "unsigned int"
3676
+#undef INT_LEAST8_TYPE
3677
+#define        INT_LEAST8_TYPE         "int"
3678
+#undef INT_LEAST16_TYPE
3679
+#define        INT_LEAST16_TYPE        "int"
3680
+#undef INT_LEAST32_TYPE
3681
+#define        INT_LEAST32_TYPE        "int"
3682
+#undef UINT_LEAST8_TYPE
3683
+#define        UINT_LEAST8_TYPE        "unsigned int"
3684
+#undef UINT_LEAST16_TYPE
3685
+#define        UINT_LEAST16_TYPE       "unsigned int"
3686
+#undef UINT_LEAST32_TYPE
3687
+#define        UINT_LEAST32_TYPE       "unsigned int"
3688
+#undef INT_FAST8_TYPE
3689
+#define        INT_FAST8_TYPE          "int"
3690
+#undef INT_FAST16_TYPE
3691
+#define        INT_FAST16_TYPE         "int"
3692
+#undef INT_FAST32_TYPE
3693
+#define        INT_FAST32_TYPE         "int"
3694
+#undef UINT_FAST8_TYPE
3695
+#define        UINT_FAST8_TYPE         "unsigned int"
3696
+#undef UINT_FAST16_TYPE
3697
+#define        UINT_FAST16_TYPE        "unsigned int"
3698
+#undef UINT_FAST32_TYPE
3699
+#define        UINT_FAST32_TYPE        "unsigned int"
3700
+#undef INTPTR_TYPE
3701
+#define        INTPTR_TYPE             "unsigned int"
3702
+#undef UINTPTR_TYPE
3703
+#define        UINTPTR_TYPE            "unsigned int"
3704
+
3705
+#undef INT64_TYPE
3706
+#undef UINT64_TYPE
3707
+#undef INT_LEAST64_TYPE
3708
+#undef UINT_LEAST64_TYPE
3709
+#undef INT_FAST64_TYPE
3710
+#undef UINT_FAST64_TYPE
3711
+
3712
+#if (ZIP_HAS_DI != 0)
3713
+#define        INT64_TYPE              "long int"
3714
+#define        UINT64_TYPE             "long unsigned int"
3715
+#define        INT_LEAST64_TYPE        "long int"
3716
+#define        UINT_LEAST64_TYPE       "long unsigned int"
3717
+#define        INT_FAST64_TYPE         "long int"
3718
+#define        UINT_FAST64_TYPE        "long unsigned int"
3719
+#else
3720
+#define        INT64_TYPE              NULL
3721
+#define        UINT64_TYPE             NULL
3722
+#define        INT_LEAST64_TYPE        NULL
3723
+#define        UINT_LEAST64_TYPE       NULL
3724
+#define        INT_FAST64_TYPE         NULL
3725
+#define        UINT_FAST64_TYPE        NULL
3726
+#endif
3727
+
3728
+#define        TARGET_PTRMEMFUNC_VBI_LOCATION  ptrmemfunc_vbit_in_pfn
3729
+
3730
+
3731
+/* 17.07 Register Usage / Register definitions */
3732
+
3733
+/* FIRST_PSEUDO_REGISTER ... Number of hardware registers known to the compiler.
3734
+ * They receive numbers 0 through FIRST_PSEUDO_REGISTER-1; thus the first
3735
+ * pseudo register's numbrer really is assigned the number
3736
+ * FIRST_PSEUDO_REGISTER.
3737
+ *
3738
+ * ZipCPU---There are 16 registers in the ZipCPU, numbered 0-15 with the CC
3739
+ * and PC register being numbered 14 and 15 respectively.  Therefore, the
3740
+ * compiler can take register number 16 and above and do whatever it wants
3741
+ * with it.
3742
+ */
3743
+#ifdef DEFINE_USER_REGS
3744 103 dgisselq
+#  define      FIRST_PSEUDO_REGISTER   32
3745 102 dgisselq
+#else
3746 103 dgisselq
+#  ifdef       zip_FP_PSEUDO
3747
+#    define    FIRST_PSEUDO_REGISTER   (zip_FP_PSEUDO+1)
3748
+#  else
3749
+#    define    FIRST_PSEUDO_REGISTER   16
3750
+#  endif
3751 102 dgisselq
+#endif
3752
+
3753
+/* FIXED_REGISTERS ... An initializer that says which registers are used for
3754
+ * fixed purposes all throughout the compiled code and are therefore not
3755
+ * available for general allocation.  These would include the stack pointer, the
3756
+ * frame pointer (except on machines where that can be used as a general
3757
+ * register when no frame pointer is needed), the program counter on machines
3758
+ * where that is considered one of the addressable registers, and any other
3759
+ * numbered register with a standard use.
3760
+ *
3761
+ * This information is expressed as a sequence of numbers, separated by commas,
3762
+ * and surrounded by braces.  The nth number is 1 if register n is fixed, 0
3763
+ * otherwise.
3764
+ *
3765
+ * For the Zip CPU, we have three fixed registers that are not available for
3766
+ * general allocation:
3767
+ *
3768
+ *     SP      The stack pointer
3769
+ *     CC      The condition codes and CPU state register
3770
+ *     PC      The program counter
3771
+ *
3772
+ * Other registers, such as FP (the frame pointer) or GBL (the global offset
3773
+ * table pointer) are registers that we hope will not be so fixed.
3774
+ */
3775 103 dgisselq
+#ifdef zip_FP_PSEUDO
3776
+#  define      FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1 }
3777
+#else
3778
+#  define      FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1 }
3779
+#endif
3780 102 dgisselq
+
3781
+/* CALL_USED_REGISTERS ... like FIXED_REGISTERS but has 1 for each register
3782
+ * that is clobbered (in general) by function calls as well as for fixed
3783
+ * registers.  This macro therefore identifies the registers that are not
3784
+ * available for general allocation of values that must live across function
3785
+ * calls.
3786
+ *
3787
+ * If a register has 0 in CALL_USED_REGISTERS, the compiler automatically saves
3788
+ * it on function entry and restores it on function exit, if the register is
3789
+ * used within the function.
3790
+ *
3791
+ * On the Zip CPU, we must save R0 (the return address), and (let's pick) any
3792
+ * register above R5.
3793
+ */
3794 103 dgisselq
+#ifdef zip_FP_PSEUDO
3795
+#  define      CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1 }
3796
+#else
3797
+#  define      CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1 }
3798
+#endif
3799 102 dgisselq
+
3800
+/* CALL_REALLY_USED_REGISTERS ...  optional macro that, if not defined, defaults
3801
+ * to the value of CALL_USED_REGISTERS.
3802
+ */
3803
+
3804
+/* HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE) ... A C expression that is nonzero
3805
+ * if it is not permissible to store a value of mode MODE in hard register REGNO
3806
+ * across a call without some part of it being clobbbered.  For most machines,
3807
+ * this macro need not be defined.  It is only required for machines that do
3808 103 dgisselq
+ * not preserve the entire contents of a register across a call.
3809 102 dgisselq
+ *
3810
+ * In the Zip CPU, we clobber R0 with our return address during a call, so let's
3811
+ * make sure this gets included here.
3812
+ */
3813
+#define        HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE)      (REGNO==0)
3814
+
3815
+/* TARGET_CONDITIONAL_REGISTER_USAGE(VOID) ... This hook may conditionally
3816
+ * modify five variables fixed_regs, call_used_regs, global_regs, reg_names, and
3817
+ * reg_class_contents, to take into account any dependence of these register
3818
+ * sets on target flags.  The first three of these are of type char[]
3819
+ * (interpreted as Boolean vectors).  global_regs is a const char *[] and
3820
+ * reg_class_contents is a HARD_REG_SET.  Before the macro is called,
3821
+ * fixed_regs, call_used_regs, reg_class_contents, and reg_names have been
3822
+ * initialized from FIXED_REGISTERS, CALL_USED_REGISTERS, REG_CLASS_CONTENTS,
3823
+ * and REGISTER_NAMES, respectively.  global_regs has been cleared, and any
3824
+ * -ffixed-reg, -fcall-used-reg, and -fcall-saved-reg command options have been
3825
+ * applied.
3826
+ *
3827
+ * ZipCPU -- I may need to return and define this depending upon how FP and
3828
+ * GBL register allocation go.  But for now, we'll leave this at its default
3829
+ * value.
3830
+ */
3831
+// #warning "Revisit me after FP and GBL allocation"
3832
+
3833
+/* INCOMING_REGNO(out) ... Define this macro if the target machine has register
3834
+ * windows. ...
3835
+ *
3836
+ * Zip CPU has no register windows.
3837
+ */
3838
+
3839
+/* OUTGOING_REGNO ... same thing.
3840
+ */
3841
+
3842
+/* LOCAL_REGNO ... same thing.
3843
+ */
3844
+
3845
+/* PC_REGNUM ... If the program counter has a register number, define this as
3846
+ * that register number.  Otherwise do not define it.
3847
+ */
3848
+#define        PC_REGNUM       zip_PC
3849
+
3850
+
3851
+/* REG_ALLOC_ORDER ... If defined, an initializer for a vector of integers,
3852
+ * containing the number of hard registers in the order in which GCC should
3853
+ * prefer to use them (from most preferred to least.
3854
+ *
3855 103 dgisselq
+ * If this macro is not defined, registers are used lowest numbered first (all
3856 102 dgisselq
+ * else being equal).
3857
+ *
3858
+ * Since the default is the ZipCPU desired case, we won't define this here.
3859
+ */
3860
+
3861
+/* ADJUST_REG_ALLOC_ORDER ... on most machines it is not necessary to define
3862
+ * this macro, so we won't either.
3863
+ */
3864
+
3865
+/* HONOR_REG_ALLOC_ORDER ...
3866
+ */
3867
+
3868
+/* HONOR_REG_ALLOC_ORDER ... on most machines it is not necessary to define
3869
+ * this macro, so we won't either.
3870
+ */
3871
+
3872
+/* HARD_REGNO_NREGS(REGNO, MODE) ... A C expression for the number of
3873
+ * consecutive hard registers, starting at register number REGNO, required to
3874
+ * hold a value of mode MODE.
3875
+ *
3876
+ * On a machine where all registers are exactly one word, a suitable definition
3877
+ * is given of ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)/UNITS_PER_WORD.
3878
+ *
3879
+ * On ZipCPU, we might do
3880
+ *     ((((MODE)==DImode)||((MODE)==DFmode))?2:1)
3881
+ * but I think the default (above) code should work as well.  Hence, let's stick
3882
+ * with the default, lest someone try to create larger modes (TImode, OImode,
3883
+ * XImode) and expect us to follow them properly some how.
3884
+ *
3885
+ * Okay, now in hind sight, we know that the default doesn't work for our
3886
+ * architecture, since GET_MODE_SIZE(SImode)=4, not 1.  Thus, let's rearrange
3887
+ * this expression to work in bits rather than in bytes and we'll know more
3888
+ * of what we are doing.
3889
+ */
3890
+#undef HARD_REGNO_NREGS
3891
+#define        HARD_REGNO_NREGS(REGNO, MODE)   ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)\
3892
+               / (UNITS_PER_WORD))
3893
+
3894
+/* HARD_REGNO_NREGS_HAS_PADDING(REGNO,MODE) ... A C expression that is nonzero
3895
+ * if a value of mode MODE, stored in memory, ends with padding that causes it
3896
+ * to take up more space than in registers starting at register number REGNO
3897
+ * (as determined by multiplying GCC's notion of the size of the register when
3898
+ * containing this mode by the number of registers returned by HARD_REGNO_NREGS)
3899
+ * By default this is zero.
3900
+ *
3901
+ * Zip CPU --- The default looks good enough to me.
3902
+ */
3903
+
3904
+/* HARD_REGNO_NREGS_WITH_PADDING(REGNO, MODE)
3905
+ *
3906
+ * ZipCPU ---
3907
+ */
3908
+
3909
+/* REGMODE_NATURAL_SIZE(MODE) -- Define this macro if the natural size of
3910
+ * registers that hold values of mode mode is not the word size.  It is a C
3911
+ * expression that should give the natural size in bytes for the specified mode.
3912
+ * It is used by the register allocator to try to optimize its results.
3913
+ *
3914
+ * ZipCPU ---
3915
+ */
3916
+// #define     REGMODE_NATURAL_SIZE(MODE)      (((MODE)==DImode)?2:1)
3917
+
3918
+/* HARD_REGNO_MODE_OK ... A C expression that is nonzero if it is permissible
3919 103 dgisselq
+ * to store a value of mode MODE in a hard register number REGNO (or in several
3920 102 dgisselq
+ * registers starting with that one).  For a machine where all registers are
3921
+ * equivalent, a suitable definition is '1'.  You need not include code to check
3922
+ * for the numbers of fixed registers, because the allocation mechanism
3923
+ * considered them to be always occupied.
3924
+ *
3925
+ * ZipCPU --- As long as you are already avoiding the fixed registers, the
3926
+ * suitable default definition mentioned above should be sufficient.
3927
+ */
3928
+#undef HARD_REGNO_MODE_OK
3929 103 dgisselq
+#define        HARD_REGNO_MODE_OK(R,M) (R<zip_CC)
3930 102 dgisselq
+
3931
+/* HARD_REGNO_RENAME_OK(FROM,TO) ... A C expression that is nonzero if it is
3932
+ * okay to rename a hard register FROM to another hard register TO.  One common
3933
+ * use of this macro is to prevernt renaming of a register to another register
3934
+ * that is not saved by a prologue in an interrupt handler.  The default is
3935
+ * always nonzero.
3936
+ *
3937
+ * ZipCPU --- The default looks good enough to us.
3938
+ */
3939
+#undef HARD_REGNO_RENAME_OK
3940
+#define        HARD_REGNO_RENAME_OK(FROM,TO)   ((is_ZIP_GENERAL_REG(FROM))&&(is_ZIP_GENERAL_REG(TO)))
3941
+
3942
+
3943
+/* MODES_TIABLE_P(M1, M2) ... A C expression that is nonzero if a value of mode
3944
+ * M1 is accessible in mode M2 without copying.
3945
+ *
3946
+ * ZipCPU --- well, that's true for us (although we support scant few modes) ...
3947
+ * so lets' set to one.
3948
+ */
3949
+#define        MODES_TIEABLE_P(M1,M2)  1
3950
+
3951
+/* TARGET_HARD_REGNO_SCRATCH_OK(REGNO)
3952
+ * This target hook should return true if it is OK to use a hard register
3953
+ * REGNO has a scratch register in peephole2.  One common use of this macro is
3954
+ * to prevent using of a register that is not saved by a prologue in an
3955
+ * interrupt handler.  The default version of this hook always returns true.
3956
+ *
3957
+ * ZipCPU --- the default works for us as well.  If you are in an interrupt
3958
+ * context, you have an entirely new set of registers (the supervisor set), so
3959
+ * this is a non-issue.
3960
+ */
3961
+
3962
+/* AVOID_CCMODE_COPIES ... define this macro if the compiler should avoid
3963
+ * copies to/from CCmode register(s).  You should only define this macro if
3964
+ * support for copying to/from CCmode is incomplete.
3965
+ *
3966
+ * ZipCPU --- CCmode register copies work like any other, so we'll keep with the
3967
+ * default definition.
3968
+ */
3969
+
3970
+/* STACK_REGS ... Define this if the machine has any stack-like registers.
3971
+ *
3972
+ * Zip CPU has no stack-like registers, as their definition is different from
3973
+ * the ZipCPU stack pointer register.
3974
+ */
3975
+
3976
+#define        ZIP_REG_BYTE_SIZE       1
3977
+
3978
+/* 17.08 Register Classes */
3979
+
3980
+/* enum reg_class ... An enumerate type that must be defined with all the
3981
+ * register class names as enumerated values.  NO_REGS must be first.  ALL_REGS
3982
+ * must be the last register class, followed by one more enumerated value,
3983
+ * LIM_REG_CLASSES, which is not a register class but rather tells how many
3984
+ * classes there are.
3985
+ *
3986
+ * ZipCPU --- We'll defined register 0-13 as general registers, 14-15 in
3987
+ * all_regs, and go from there.
3988
+ */
3989
+enum   reg_class {
3990
+       NO_REGS, GENERAL_REGS,
3991
+#ifdef DEFINE_USER_REGS
3992
+       USER_REGS,
3993
+#endif
3994
+       ALL_REGS, LIM_REG_CLASSES
3995
+};
3996
+
3997
+/* N_REG_CLASSES ... the number of distinct register classes, defined as follows
3998
+ */
3999
+#define        N_REG_CLASSES   (int)LIM_REG_CLASSES
4000
+
4001
+/* REG_CLASS_NAMES ... An initializer containing the names of the register
4002
+ * classes as C string constants.  These names are used in writing some of the
4003
+ * debugging dumps.
4004
+ */
4005
+#define        REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "ALL_REGS" }
4006
+
4007
+/* REG_CLASS_CONTENTS ... An initializer containing the contents of the register
4008
+ * classes, as integerss which are bit masks.  The nth integer specifies the
4009
+ * contents of class n.  That way the integer mask is interpreted as that
4010
+ * register r is in the class if (mask&(1<<r)) is 1.
4011
+ *
4012
+ * When the machine has more than 32 registers ... that's not us.
4013
+ *
4014
+ * ZipCPU --- This is straight forward, three register classes, etc.
4015
+ */
4016 103 dgisselq
+#ifdef zip_FP_PSEUDO
4017
+#define        REG_CLASS_CONTENTS { { 0x00000}, {0x13fff}, {0x1ffff} }
4018
+#else
4019 102 dgisselq
+#define        REG_CLASS_CONTENTS { { 0x00000}, {0x03fff}, {0x0ffff} }
4020 103 dgisselq
+#endif
4021 102 dgisselq
+
4022
+#ifdef DEFINE_USER_REGS
4023
+#define        REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "USER_REGS", "ALL_REGS" }
4024
+#define        REG_CLASS_CONTENTS { { 0x00000},{0x03fff},{0x0ffff0000},{0x0ffffffff} }
4025
+#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 }
4026
+#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 }
4027
+#endif
4028
+
4029
+/* REGNO_REG_CLASS ... A C expression whose value is a register class
4030
+ * containing hard register REGNO.  In general there is more than one such
4031
+ * class;  Choose a class which is minimal, meaning that no smaller class also
4032
+ * contains the register.
4033
+ */
4034
+#undef REGNO_REG_CLASS
4035 103 dgisselq
+#ifdef zip_FP_PSEUDO
4036
+#define        REGNO_REG_CLASS(R)      (is_ZIP_REG(R)?((((R)<=13)||((R)==zip_FP_PSEUDO))?GENERAL_REGS:ALL_REGS):NO_REGS)
4037
+#else
4038 102 dgisselq
+#define        REGNO_REG_CLASS(R)      (is_ZIP_REG(R)?((R<=13)?GENERAL_REGS:ALL_REGS):NO_REGS)
4039 103 dgisselq
+#endif
4040 102 dgisselq
+
4041
+/* BASE_REG_CLASS ... A macro whose definition is the name of the class to which
4042
+ * a valid base register must belong.  A base register is one used in an address
4043
+ * which is the register value plus a displacement.
4044
+ */
4045
+#undef BASE_REG_CLASS
4046
+#define        BASE_REG_CLASS  GENERAL_REGS
4047
+
4048
+/* MODE_BASE_CLASS(MODE) ... This is a variation of the BASE_REG_CLASS macro
4049
+ * which allows the selection of a bse register in a mode dependent manner.  If
4050
+ * mode is VOIDmode then it should return the same value as BASE_REG_CLASS.
4051
+ */
4052
+#undef MODE_BASE_CLASS
4053
+#define        MODE_BASE_CLASS(MODE)   GENERAL_REGS
4054
+
4055
+/* MODE_BASE_REG_REG_CLASS(MODE) ... A C expression whose value is the register
4056
+ * class to which a valid base register must belong in order to be used in a
4057
+ * base plus index register address.  You should define this macro if base plus
4058
+ * index addresses have different requirements than other base register uses.
4059
+ *
4060
+ * Zip CPU does not support the base plus index addressing mode, thus ...
4061
+ */
4062 111 dgisselq
+// #undef      MODE_BASE_REG_REG_CLASS
4063
+// #define     MODE_BASE_REG_REG_CLASS(MODE)   NO_REGS
4064 102 dgisselq
+
4065
+/* INDEX_REG_CLASS ... A macro whose definition is the name of the class to
4066
+ * which a valid index register must belong.  An index register is one used in
4067
+ * an address where its value is either multiplied by a scale factor or added
4068
+ * to another register (as well as added to a displacement).
4069
+ *
4070
+ * ZipCPU -- Has no index registers.
4071
+ */
4072
+#undef INDEX_REG_CLASS
4073
+#define        INDEX_REG_CLASS NO_REGS
4074
+
4075
+/* REGNO_OK_FOR_BASE_P(NUM) ... A C expression which is nonzero if register
4076
+ * number num is suitable for use as a base register in operand addresses.
4077
+ */
4078
+#undef REGNO_OK_FOR_BASE_P
4079
+#ifdef DEFINE_USER_REGS
4080
+# define REGNO_OK_FOR_BASE_P(NUM)      ((NUM != zip_CC)&&(NUM < 16))
4081
+#else
4082
+# define REGNO_OK_FOR_BASE_P(NUM)      (NUM != zip_CC)
4083
+#endif
4084
+
4085
+/* REGNO_MODE_OK_FOR_BASE_P ... A C expressison that is just like
4086
+ * REGNO_OK_FOR_BASE_P, except that that expression may examine the mode of the
4087 111 dgisselq
+ * memory reference in MODE.  You should define this macro if the mode of the
4088 102 dgisselq
+ * memory reference affects whether a register may be used as a base register.
4089
+ *
4090
+ * ZipCPU --- the mode doesn't affect anything, so we don't define this.
4091
+ */
4092
+
4093
+/* REGNO_MODE_OK_FOR_REG_BASE_P(NUM, MODE) ... base plus index operand
4094
+ * addresses, accessing memory in mode mode.
4095
+ *
4096
+ * Use of this macro is deprecated.
4097
+ */
4098
+
4099 111 dgisselq
+/* REGNO_MODE_CODE_OK_FOR_BASE_P(N,M,AS,OC,IC) ... A C expression which is
4100 102 dgisselq
+ * nonzero if a register number N is suitable for use as a base register in
4101
+ * operand addresses, accessing memory in mode M in address space AS.  This is
4102
+ * similar to REGNO_MODE_OK_FOR_BASE_P, except that the expression may examine
4103
+ * the context in which the register appears in the memory reference.
4104
+ *
4105
+ * ZipCPU---We aren't specific in how we use our registers.
4106
+ */
4107
+#define        REGNO_MODE_CODE_OK_FOR_BASE_P(N,M,AS,OC,IC) REGNO_OK_FOR_BASE_P(N)
4108
+
4109
+/* REGNO_OK_FOR_INDEX_P(REGNO) ... A C expression which is nonzero if register
4110
+ * num is suitable for use as an index register in opernad addressess.  It may
4111
+ * be either a suitable hard register or a pseudo register that has been
4112 111 dgisselq
+ * allocated such as a hard register.
4113 102 dgisselq
+ *
4114
+ * ZipCPU has no index registers, therefore we declare this to be zero.
4115
+ */
4116
+#undef REGNO_OK_FOR_INDEX_P
4117
+#define        REGNO_OK_FOR_INDEX_P(REGNO)     0
4118
+
4119
+/* TARGET_PREFERRED_RENAME_CLASS(RCLASS) ... A target hook that places
4120
+ * additional preference on the register class to use when it is necessary to
4121
+ * rename a register in class RCLASS to another class, or perhaps NO_REGS, if no
4122
+ * preferred register class is found or hook preferred_rename_class is not
4123
+ * implemented.  SOmething returning a more restrictive class makes better code.
4124
+ * For example, on ARM, thumb-2 instructions using LO_REGS may be smaller than
4125
+ * instructions using GENERIC_REGS.  By returning LO_REGS from
4126
+ * preferred_rename_class, code size can be reduced.
4127
+ */
4128
+// #undef TARGET_PREFERRED_RENAME_CLASS
4129
+// #define     TARGET_PREFERRED_RENAME_CLASS(RCLASS)   RCLASS
4130
+
4131
+/* TARGET_PREFERRED_RELOAD_CLASS(X,RC) ... A target hook that places additional
4132
+ * restri tions on the register class to use when it is necessary to copy value
4133
+ * X into a register in class RC.  The value is a register class; rehaps RC, or
4134
+ * perhaps a smaller class.
4135
+ *
4136
+ * The default fversion of this hook always returns value of RC argument, which
4137
+ * sounds quite appropriate for the ZipCPU.
4138
+ */
4139
+
4140
+/* PREFERRED_RELOAD_CLASS(X,CLASS) ... A C expression that places additional
4141
+ * restrictions on the register class to use when it is necessary to copy
4142
+ * value X into a register in class CLASS.  On many machines, the following
4143
+ * definition is safe: PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
4144
+ * Sometimes returning a more restrictive class makes better code.  For example,
4145
+ * on the 68k, when x is an integer constant that is in range for a moveq
4146
+ * instruction, the value of this macro is always DATA_REGS as long as CLASS
4147 111 dgisselq
+ * includes the data registers.  Requiring a data register guarantees that a
4148 102 dgisselq
+ * 'moveq' will be used.
4149
+ *
4150
+ * ZipCPU --- you can't load certain values into all members of ALL_REGS.  For
4151
+ * example, loading (sleep and !gie) into the CC register could halt the CPU.
4152
+ * Hence, we only allow loads into the GENERAL_REG class.
4153
+ */
4154
+#define        PREFERRED_RELOAD_CLASS(X, CLASS)        GENERAL_REGS
4155
+
4156
+/* TARGET_PREFERRED_OUTPUT_RELOAD_CLASS(RTX,RCLASS) ... Like TARGET_PREFERRED_..
4157
+ * RELOAD_CLASS, but for output instead of input reloads.
4158
+ *
4159
+ * ZipCPU --- there's gotta be a valid default behaviour for this.
4160
+ */
4161
+
4162
+/* LIMIT_RELOAD_CLASS(MODE, CL) ...
4163
+ *
4164
+ * Don't define this macro unless the target machine has limitations which
4165
+ * require the macro to do something nontrivial.  ZipCPU doesn't, so we won't.
4166
+ */
4167
+
4168
+/* TARGET_SECONDARY_RELOAD
4169
+ * SECONDARY_ ...
4170
+ * Don't think we need these ...
4171
+ */
4172
+
4173
+/* CLASS_MAX_NREGS(CLASS,MODE) ... A C expression for the maximum number of
4174
+ * consecutive registers of class CLASS needed to hold a value of mode MODE.
4175
+ *
4176
+ * This is closely related to the macro HARD_REGNO_NREGS.  In fact, the value
4177
+ * of the macro CLASS_MAX_REGS(CL,M) should be the maximum value of
4178
+ * HARD_REGNO_NREGS(REGNO,MODE) for all REGNO values in the class CLASS.
4179
+ *
4180
+ * This macro helps control the handling of multiple word values in the reload
4181
+ * pass.
4182
+ *
4183
+ * ZipCPU --- We'll just use HARDNO_REGNO_NREGS, since CLASS is independent for
4184
+ * us.  We'll also choose register R0, since ... well, since it simply doesn't
4185
+ * matter.  (HARD_REGNO_NREGS ignores this anyway)
4186
+ */
4187
+#define        CLASS_MAX_NREGS(CLASS, MODE)    HARD_REGNO_NREGS(0,MODE)
4188
+
4189
+/* CANNOT_CHANGE_MODE_CLASS
4190
+ * ???
4191
+ */
4192
+
4193
+/* TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS
4194
+ */
4195
+
4196
+/* TARRGET_LRA_P
4197
+ * Default looks good.
4198
+ */
4199
+
4200
+/* TARGET_REGISTER_PRIORITY(INT) ... A target hook which returns the register
4201 111 dgisselq
+ * priority number to which the register HARD_REGNO belongs to.  The bigger the
4202 102 dgisselq
+ * number
4203
+ *
4204
+ * The default version of this target hook returns always zero---good enough for
4205
+ * the ZipCPU.
4206
+ */
4207
+
4208
+/* TARGET_REGISTER_USAGE_LEVELING_P(VOID) ... A target hook which returns true
4209
+ * if we need register usage leveling.  That means if a few hard registers are
4210
+ * equally good for the assignment, we choose the least used hard register.  The
4211
+ * register usage leveling may be profitable for some targets.  Don't use usage
4212
+ * leveling for targets with conditional execution or targets with big register
4213
+ * files as it hurts if-conversion and cross-jumping optimizations.  The default
4214
+ * version of this target hook returns always false.
4215
+ *
4216
+ * ZipCPU --- Default is the right answer.
4217
+ */
4218
+
4219
+/* TARGET_DIFFERENT_ADDR_DISPLACEMENT_P ...
4220
+ * Default looks good.
4221
+ */
4222
+
4223
+/* TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV_P ...
4224
+ * Default looks good.
4225
+ */
4226
+
4227
+/* TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT ....
4228
+ */
4229
+
4230
+/* TARGET_SPILL_CLASS
4231
+ *
4232
+ * ZipCPU --- If we were running in supervisor mode only, this might be the
4233
+ * user set of registers.  However, we're not building for that mode (now),
4234
+ * so we'll leave this at the default of NO_REGS.
4235
+ */
4236
+
4237
+/* TARGET_CSTORE_MODE(ICODE) ... Defines the machine mode to use for the
4238
+ * boolean result of conditional store patterns.  The OCIDE argument is the
4239
+ * instruction code for the cstore being performed.  Not defining this hook is
4240
+ * the same as accepting the mode encoded into operand 0 of the cstore expander
4241
+ * patterns.
4242
+ *
4243
+ * ??? ZipCPU --- I don't follow this documentation.  We'll leave this at the
4244
+ * default therefore.
4245
+ */
4246
+
4247
+/* 17.09 Stack Layout and Calling Conventions */
4248
+
4249
+
4250
+/* STACK_GROWS_DOWNWARD ... Define this macro if pushing a word onto the stack
4251
+ * moves the stack pointer to a smaller address, and false otherwise.
4252
+ *
4253
+ * ZipCPU ... well, our stack does grow downward, but it doesn't do so auto-
4254
+ * magically.  We have to move the stack pointer ourselves.  However, since this
4255
+ * is our convention, we'll define it as such.
4256
+ */
4257
+#undef STACK_GROWS_DOWNWARD
4258
+#define        STACK_GROWS_DOWNWARD    1
4259
+
4260
+/* STACK_PUSH_CODE ... This macro defines the operation used when something is
4261
+ * pushed on the stack.  In RTL, a push operation will be
4262
+ * (set (mem( STACK_PUSH_CODE(reg sp))) ...) The choiecs are PRE_DEC, POST_DEC,
4263
+ * PRE_INC, and POST_INC.  Which of these is correct depends on the stack
4264
+ * direction and on whether the stack pointer points to the last item on the
4265
+ * stack or whether it points to the space for the next item on the stack.
4266
+ * The default is PRE_DECC when STACK_GROWS_DOWNWARD is true, which is almost
4267
+ * always right, and PRE_INC otherwise, which is often wrong.
4268
+ *
4269
+ * ZipCPU --- None of these is right, so let's leave this at the default and
4270
+ * see how badly we get mangled.  In particular, ZipCPU doesn't have any of the
4271
+ * PRE_DEC, POST_DEC, PRE_INC, or POST_INC addressing modes used here.
4272
+ */
4273
+
4274
+/* FRAME_GROWS_DOWNWARD ... Define this macro to nonzero if the addresses of
4275
+ * local variable slots are at negative offsets from the frame pointer.
4276
+ *
4277
+ * ZipCPU --- If the frame pointer is defined as the stack pointer upon the
4278 103 dgisselq
+ * start of function execution, and that stack pointer grows downward, then
4279 102 dgisselq
+ * this should be the case as well.
4280
+ */
4281
+#undef FRAME_GROWS_DOWNWARD
4282
+#define        FRAME_GROWS_DOWNWARD    1
4283
+// #define     FRAME_GROWS_DOWNWARD    0        // This was ECO32's value
4284
+
4285
+
4286
+/* ARGS_GROW_DOWNWARD ... Define this macro if successive arguments to a
4287
+ * function occupy decreasing addresses on the stack.
4288
+ *
4289
+ * ZipCPU -- we can leave this up to the compiler's preferred implementation,
4290
+ * it is of no consequence to the hardware.
4291
+ */
4292
+
4293
+/* STARTING_FRAME_OFFSET ... Offset from the frame pointer to the first local
4294
+ * variable slot to be allocated.  If FRAME_GROWS_DOWNWARD, find the next slot's
4295
+ * offset by subtracting the firstt slot's length from STARTING_FRAME_OFFSET.
4296
+ * Otherwise it is found by adding the length of the first slot to the value
4297
+ * START_FRAME_OFFSET.
4298
+ *
4299
+ * ZipCPU --- I'm not certain on this, let's come back after we look at how
4300
+ * the code is getting generated.  However, the ECO32 code I am copying from
4301
+ * suggests that 0 is the right value, so we'll use that here.
4302
+ */
4303
+// #warning "Re-evaluate me"
4304
+#define        STARTING_FRAME_OFFSET   0
4305
+
4306
+/* STACK_ALIGNMENT_NEEDED ... Define to zero to disable final alignment of the
4307
+ * stack during reload.  The nonzero default for this macro is suitable for most
4308
+ * ports.
4309
+ *
4310
+ * ZipCPU --- we'll leave this at the default, although if any alignment code
4311
+ * shows up on the stack we may need to adjust it.
4312
+ */
4313
+
4314
+/* STACK_POINTER_OFFSET ... Offset from the SP register to the first location at
4315
+ * which outgoing arguments are placed.  If not specified, the default value
4316
+ * of zero is used.  This is the proper value for most machines.
4317
+ */
4318
+#define        STACK_POINTER_OFFSET    0
4319
+
4320
+/* FIRST_PARM_OFFSET ... Offset from the argument pointer register to the first
4321
+ * argument's address.  On some machines it may depend on the data type of the
4322
+ * function.
4323
+ */
4324
+#define        FIRST_PARM_OFFSET(F)    0
4325
+
4326
+/* STACK_DYNAMIC_OFFSET(F) ... Offset from the stack pointer register to an item
4327
+ * dynamically allocated on the stack, e.g., by alloca.  The default value for
4328
+ * this macro is STACK_POINTER_OFFSET plus the length of the outgoing arguments.
4329
+ * The default is correct for most machines, ...
4330
+ *
4331
+ * ZipCPU --- so we'll use it for the ZipCPU.
4332
+ */
4333
+
4334
+/* INITIAL_FRAME_ADDRESS_RTX ... A C expression whose value is RTL representing
4335
+ * the address of the initial stack frame.  This address is passed to
4336
+ * RETURN_ADDR_RTX and DYNAMIC_CHAIN_ADDRESS.  If you don't define this macro,
4337
+ * a reasonable default value will be used.  Define this macro in order to make
4338
+ * frame pointer elimination work in the presence of __builtin_frame_address(C)
4339
+ * and __builtin_return_address(C) for (C) not equal to zero.
4340
+ *
4341
+ * ZipCPU --- Let's try the reasonable default and see what happens.
4342
+ */
4343
+
4344
+/* SETUP_FRAME_ADDRESSES ... A C expression that produces the machine-specific
4345
+ * code to setup the stack so that arbitrary frames can be accessed.  For
4346
+ * example, on the SPARC, we must flush all of the register windows to the stack
4347
+ * before we can access arbitrary stack frames.  You will seldom need to define
4348
+ * this macro.  The default is to do nothing.
4349
+ *
4350
+ * ZipCPU --- which is what we shall do here.
4351
+ */
4352
+
4353
+/* TARGET_BUILTIN_SETJMP_FRAME_VALUE(VOID) ... This target hook should return
4354
+ * an RTX that is used to store the address of the current frame into the
4355
+ * builtin setjmp buffer.  The default value, virtual_stack_vars_rtx, is correct
4356
+ * for most machines.  One reason you may need to define this target hook is if
4357
+ * hard_frame_pointer_rtx is the appropriate value on your machine.
4358
+ *
4359
+ * ZipCPU --- leave this undefined, since the default value should be correct
4360
+ * for "most" machines.
4361
+ */
4362
+
4363
+/* FRAME_ADDR_RTX ... most machines do not need to define it.
4364
+ */
4365
+
4366
+/* RETURN_ADDR_RTX(COUNT,FRAMEADDR) ... A C expression whose value is RTL
4367
+ * representing the value of the return address for the frame COUNT steps up
4368
+ * from the current frame, after the prologue.  FRAMEADDR is the frame pointer
4369
+ * of the COUNT frame, or the frame pointer of the COUNT-1 frame if
4370
+ * RETURN_ADDR_IN_PREVIOUS_FRAME is nonzero.  The value of the expression must
4371
+ * always be the correct address when COUNT is nonzero, but may be NULL_RTX if
4372
+ * there is no way to determine the return address of other frames.
4373
+ *
4374
+ * ZipCPU --- I have no idea how we'd do this, so let's just return NULL_RTX.
4375
+ */
4376
+#undef RETURN_ADDR_RTX
4377
+#define        RETURN_ADDR_RTX(COUNT,FRAMEADDR)        NULL_RTX
4378
+
4379
+/* RETURN_ADDR_IN_PREVIOUS_FRAME ... Define this macro to nonzero value if the
4380
+ * return address of a particular stack frame is accessed from the frame pointer
4381
+ * of the previous stack frame.  The zero default for this macro is suitable
4382
+ * for most ports.
4383
+ *
4384
+ * ZipCPU---Default works here as well.
4385
+ */
4386
+
4387
+/* INCOMING_RETURN_ADDR_RTX ... A C expression whose value is RTL representing
4388
+ * the location of the incoming return address at the beginning of any function,
4389
+ * before the prologue.  This RTL is either a REG, indicating that the return
4390
+ * value is saved in 'REG', or a MEM representing the location in the stack.
4391
+ * If this RTL is a REG, you should define DWARF_RETURN_COLUMN to
4392
+ * DWARF_FRAME_REGNUM(REGNO).
4393
+ *
4394
+ * ZipCPU --- While our incoming return address could theoretically be in any
4395
+ * register, our machine description file is going to place it into register
4396
+ * R0, so that's what we return here.
4397
+ */
4398
+#undef INCOMING_RETURN_ADDR_RTX
4399
+#define        INCOMING_RETURN_ADDR_RTX        gen_rtx_REG(SImode, zip_R0)
4400
+
4401
+
4402
+/* DWARF_ALT_FRAME_RETURN_COLUMN
4403
+ */
4404
+
4405
+/* DWARF_ZERO_REG ... A C exrpession whose value is an integer giving a DWARF2
4406
+ * register number that is considered to always have the value zero.  This
4407
+ * should only be defined if the target has an architected zero register (ZipCPU
4408
+ * does not), and someone decided it was a good idea to use that register number
4409
+ * to terminate the stack backtrace.  New ports should avoid this (so the
4410
+ * ZipCPU port will avoid it as well).
4411
+ *
4412
+ */
4413
+
4414
+/* TARGET_DWARF_HANDLE_FRAME_UNSPEC
4415
+ */
4416
+
4417
+/* INCOMING_FRAME_SP_OFFSET
4418
+ */
4419
+#define        INCOMING_FRAME_SP_OFFSET        0
4420
+
4421
+/* ARG_POINTER_CFA_OFFSET
4422
+ */
4423
+
4424
+/* FRAME_POINTER_CFA_OFFSET
4425
+ */
4426
+
4427
+/* CFA_FRAME_BASE_OFFSET
4428
+ */
4429
+
4430
+/* 17.09.02 Exception handling support */
4431
+
4432
+/* EH_RETURN_DATA_REGNO(N) ... A C expression whose value is the Nth register
4433
+ * number used for data by exception handlers, or INVALID_REGNUM if fewer than
4434
+ * N registers are usable.  The exception handling library routines communicate
4435
+ * with the exception handlers via a set of agreed upon registers.  Ideally
4436
+ * these registers should be call clobbered; it is possible to use call-saved
4437
+ * registers, but may negatively impact code size.  The target must support at
4438
+ * least 2 data registers, but should define 4 if their are enough free
4439
+ * registers.
4440
+ *
4441
+ * You must define this macro if you want to support call frame exception
4442
+ * handling like that provided by DWARF 2.
4443
+ */
4444
+#define        EH_RETURN_DATA_REGNO(N) (((N<ZIP_FIRST_ARG_REGNO)||(N>ZIP_LAST_ARG_REGNO))?(N-1):INVALID_REGNUM)
4445
+
4446
+/* EH_RETURN_STACKADJ_RTX ... A C expression whose value is RTL representing
4447
+ * a location in which to store a stack adjustment to be applied before function
4448
+ * return.  This is used to unwind the stack to an exception handler's call
4449
+ * frame.  It will be assigned zero on code paths that return normally.
4450
+ *
4451
+ * Do not define this macro if the stack pointer is saved and restored by the
4452
+ * regular prolog and epilog code in the call frame itself (which it is for the
4453
+ * ZipCPU); in this case, the exception handling library routines will update
4454
+ * the stack location to be restored in place.  Otherwise, you must define this
4455
+ * macro if you want to support call frame exception handling like that provided
4456
+ * by DWARF 2.
4457
+ *
4458
+ */
4459
+
4460
+/* EH_RETURN_HANDLER_RTX ... A C expression whose value is RTL representing a
4461
+ * location in which to store the address of an exception handler to which we
4462
+ * should return.  It will not be assigned on code paths that return normally.
4463
+ *
4464
+ * Typcally this is the location in the call frame at which the normal return
4465
+ * address is stored.  For targets that return by popping an address of the
4466
+ * stack, this might be a memory address just below the target callf rame
4467
+ * rather than inside the current call frame.  If defined,
4468
+ * EH_RETURN_STACKADJ_RTX will have already been assigned, so it may be used
4469
+ * to calculate the location of the target call frame.
4470
+ *
4471
+ * If you want to support call frame exception handling, you must define either
4472
+ * this macro or the eh_return instruction pattern.
4473
+ */
4474
+// #warning "I don't know what to do here."
4475
+
4476
+/*
4477
+ *
4478
+ *
4479
+ *
4480
+ *   REST OF SECTION SKIPPED ...
4481
+ *
4482
+ *
4483
+ *
4484
+ */
4485
+
4486
+/* 17.09.03 Specifying how stack checking is done */
4487
+
4488
+/* STACK_CHECK_BUILTIN ... a non-zero value if stack checking is done by the
4489
+ * configuration files in a machine-dependent manner.  You should define this
4490
+ * macro if stack checking is required by the ABI of your machine or if you
4491
+ * would like to do stack checking in some more efficient way than the generic
4492
+ * appraoch.  The default value of this macro is zero.
4493
+ *
4494
+ * ZipCPU --- The default makes sense for us.
4495
+ */
4496
+// #define STACK_CHECK_BUILTIN 0
4497
+
4498
+/* STACK_CHECK_STATIC_BUILTIN ... A nonzero value if static stack checking is
4499
+ * done by the configuration files in a machine-dependent manner.  You should
4500
+ * define this macro if you would like to do static stack checking in some more
4501
+ * efficient way than the generic approach.  The default value of this macro
4502
+ * is zero.
4503
+ *
4504
+ * ZipCPU --- The default makes sense for us.
4505
+ */
4506
+
4507
+/* STACK_CHECK_PROBE_INTERVAL_EXP ...  An integer specifying the interval at
4508
+ * which GCC must generate stack probe instructions, defined as 2 raised to this
4509
+ * interval.  You will normally define this macro so that the interval is no
4510
+ * larger than the size of the "guard pages" at the end of a stack area.  The
4511
+ * default value of 12 (4096-byte interval) is suitable for most systems.
4512
+ *
4513
+ * ZipCPU --- Default.
4514
+ */
4515
+
4516
+/* STACK_CHECK_MOVING_SP ... An integer which is non-zero if GCC should move
4517
+ * the stack pointer page by page when doing probes.  This can be necessary
4518
+ * on systems where the stack pointer contains the bottom address of the memory
4519
+ * area accessible to the executing thread at any point in time.  In this
4520
+ * situation, an alternate signal stack is required in order to be able to
4521
+ * recover from a stack overflow.  The default value of this macro is zero.
4522
+ *
4523
+ * ZipCPU -- Default.
4524
+ */
4525
+
4526
+/* STACK_CHECK_PROTECT
4527
+ */
4528
+/* STACK_CHECK_MAX_FRAME_SIZE
4529
+ * ... you should normally not change the default value of this macro.
4530
+ */
4531
+/* STACK_CHECK_FIXED_FRAME_SIZE
4532
+ * ... you ... will normally use the default of four words.
4533
+ */
4534
+
4535
+/* STACK_CHECK_MAX_VAR_SIZE
4536
+ * ... you will normally not need to override that default.
4537
+ */
4538
+
4539
+/* 17.09.04 Registers that Address the Stack Frame*/
4540
+
4541
+/* STACK_POINTER_REGNUM ... The register number of the stack pointer register,
4542
+ * which must also be a fixed register according to FIXED_REGISTERS.  On most
4543
+ * machines, the hardware determines which register this is.
4544
+ */
4545
+#undef STACK_POINTER_REGNUM
4546
+#define        STACK_POINTER_REGNUM    zip_SP
4547
+
4548
+/* FRAME_POINTER_REGNUM ... The register number of the frame pointer register,
4549
+ * which is used to access certain automatic variables in the stack frame.  On
4550
+ * some machines, the hardware determines which register this is.  On other
4551
+ * machines you can choose any register you wish for this purpose.
4552
+ *
4553
+ * ZipCPU --- While I'd like to dump this pointer, since I don't really see
4554
+ * a need for it, alloca() requires it.  Therefore let's assine a register to
4555
+ * this purpose and watch what the compiler does with it.
4556
+ */
4557 103 dgisselq
+#ifdef zip_FP_PSEUDO
4558
+#define        FRAME_POINTER_REGNUM    zip_FP_PSEUDO
4559
+#else
4560 102 dgisselq
+#define        FRAME_POINTER_REGNUM    zip_FP
4561 103 dgisselq
+#endif
4562 102 dgisselq
+
4563
+/* HARD_FRAME_POINTER_REGNUM ... On some machines the offset between the frame
4564
+ * pointer and starting offset of the automatic variables is not known until
4565
+ * after register allocation has been done (for example, because the saved
4566
+ * registers are between these two locations).  On those machines, define
4567
+ * FRAME_POINTER_REGNUM the number of a special, fixed register to be used
4568
+ * internally until the offset is known, and define HARD_FRAME_POINTER_REGNUM
4569
+ * to be the actual hard register number used for the frame pointer.
4570
+ *
4571
+ * Do not define this macro if it would be the same as FRAME_POINTER_REGNUM
4572
+ *
4573
+ * ZipCPU --- we do not define this macro.
4574
+ */
4575 103 dgisselq
+#if (zip_FP == FRAME_POINTER_REGNUM)
4576
+#define HARD_FRAME_POINTER_REGNUM      zip_FP
4577
+#endif
4578 102 dgisselq
+
4579
+/* ARG_POINTER_REGNUM ... The register number of the arg pointer register, which
4580
+ * is used to access the function's argument list.  On some machines, this is
4581
+ * the same as the frame pointer register.  On some machines, the hardware
4582
+ * determines which register this is.  On other machines, you can choose any
4583
+ * register you wish for this purpose.  If this is not the same register as the
4584
+ * frame pointer register, then you must mark it as a fixed register according
4585
+ * to FIXED_REGISTERs, or arrange to be able to eliminate it.
4586
+ *
4587
+ * ZipCPU --- We really don't want to lose another register to something
4588
+ * pointless, so let's set this to be the frame pointer register.  Especially
4589
+ * given the ZipCPU's ease of accessing things via offsets of registers, this
4590
+ * should work for a rather large stack frame.
4591
+ */
4592 103 dgisselq
+#define ARG_POINTER_REGNUM     FRAME_POINTER_REGNUM
4593 102 dgisselq
+
4594
+/* HARD_FRAME_POINTER_IS_FRAME_POINTER ... define this to be a preprocessor
4595
+ * constant that is nonzero if hard_frame_pointer_rtx and frame_pointer_rtx
4596
+ * should be the same.  The default definition is sufficient for us.
4597
+ */
4598
+
4599
+/* HARD_FRAME_POINTER_IS_ARG_POINTER ...
4600
+ * ZipCPU doesn't need this macro
4601
+ */
4602
+
4603
+/* RETURN_ADDRESS_POINTER_REGNUM ... The register number of the return address
4604
+ * pointer register, which is used to access the current function's return
4605
+ * address from the stack.  On some machines, the return address is not at a
4606
+ * fixed offset from the frame pointer or stack pointer or argument pointer.
4607
+ * This register can be defined to point to the return address on the stack, and
4608
+ * then to be converted by ELIMINABLE_REGS into either the frame pointer or the
4609
+ * stack pointer.
4610
+ *
4611
+ * Do not define this macro unless there is no other way to get the return
4612
+ * address from the stack.
4613
+ *
4614
+ * ZipCPU---we need this.
4615
+ */
4616
+#define        RETURN_ADDRESS_REGNUM   zip_R0
4617
+
4618
+
4619
+/* STATIC_CHAIN_REGNUM ... Register numbers used for passing a function's
4620
+ * static chain pointer.  If register windows are used, the register number as
4621
+ * seen by the called function is STATIC_CHAIN_INCOMING_REGNUM, while the
4622
+ * register number as seen by the calling function is STATIC_CHAIN_REGNUM.  If
4623
+ * these register are the same, STATIC_CHAIN_INCOMING_REGNUM need not be
4624
+ * defined.
4625
+ *
4626
+ * ZipCPU doesn't have register windows, so we don't need to define this.
4627
+ */
4628
+// #warning "I have no reason to believe this will even work"
4629
+#define        STATIC_CHAIN_REGNUM     zip_GOT
4630
+
4631
+/* TARGET_STATIC_CHAIN ... This hook replaces the use of STATIC_CHAIN_REGNUM et
4632
+ * al for targets that may use different static chain locations for different
4633
+ * nested functions.  This may be required if the target has function attributes
4634
+ * that affect the calling conventions of the function and those calling
4635
+ * conventions use different static chain locations.
4636
+ *
4637
+ * ZipCPU --- don't need this.
4638
+ */
4639
+// #define     STATIC_CHAIN_REGNUM     zip_R11
4640
+
4641
+
4642
+/* DWARF_FRAME_REGISTERS ... This macro specifies  the maximum number of hard
4643
+ * registers that can be saved in a call frame.  This is used to size data
4644
+ * structures used in DWARF2 exception handling.
4645
+ *
4646
+ * Prior to GCC 3.0, this macro was needed in order to establish a stable
4647
+ * exception handling ABI in the face of adding new hard registers for ISA
4648
+ * extensions.  In GCC 3.0 and later, the EH ABI is insulated from changes in
4649
+ * the number of hard registers.  Nevertheless, this macro can still be used to
4650
+ * reduce the runtime memory requirements of the exception handling routines,
4651
+ * which can be substantial if the ISA contains a lot of registers that are not
4652
+ * call-saved.
4653
+ *
4654
+ * If this macro is not defined, it defaults to FIRST_PSEUDO_REGISTER.
4655
+ *
4656
+ * ZipCPU --- The default is not sufficient.  The CC and PC registers need to
4657
+ * be saved and examined as well in any debug/exception context.  Hence, we
4658
+ * define this to be all of our registers.
4659
+ */
4660
+#undef DWARF_FRAME_REGISTERS
4661
+#define        DWARF_FRAME_REGISTERS   16
4662
+
4663
+/* PRE_GCC3_DWARF_FRAME_REGISTERS ... This macro is similar to DWARF_FRAME_REG..
4664
+ * but is provided for backward compatibility in pre GCC 3.0 compiled code.
4665
+ *
4666
+ * If not defined, it defaults to DWARF_FRAME_REGISTERS---which is perfect for
4667
+ * the ZipCPU.
4668
+ */
4669
+
4670
+/* DWARF_REG_TO_UNWIND_COLUMN(REGNO) ... Define this macro if the target's
4671
+ * representation for dwarf registers is different than the internal
4672
+ * representation for unwind column.  Given a dwarf register, this macro should
4673
+ * return the unwind column number to use instead.
4674
+ *
4675
+ * ... ???
4676
+ */
4677
+
4678
+/* DWARF_FRAME_REGNUM(REGNO) ... Define this macro is the target's
4679
+ * representation for dwarf registers used in .eh_frame or .debug_frame is
4680
+ * different from that used in other debug info sections.  Given a GCC hard
4681
+ * register number, this macro should return the .eh_frame register number.
4682
+ * The default is DBX_REGISTER_NUMBER(REGNO).
4683
+ *
4684
+ * ZipCPU --- provided we define DBX_REGISTER_NUMBER(REGNO) well, this default
4685
+ * should still work for us.
4686
+ */
4687
+
4688
+/* DWARF2_FRAME_REG_OUT(REGNO, FOR_EH) ... Define this macro to map register
4689
+ * numbers held in the call frame info that GCC has collected using
4690
+ * DWARF_FRAME_REGNO to those that should be output in .debug_frame (for_eh is
4691
+ * zero) and .eh_frame (for_eh is non-zero). The default is to return REGNO.
4692
+ *
4693
+ * ZipCPU --- Default is good enough.
4694
+ */
4695
+
4696
+/* REG_VALUE_IN_UNWIND_CONTEXT ... Define this macro if the target stores
4697
+ * register values as _Unwind_Word type in unwind context.  It should be defined
4698
+ * if target register size is larger than the size of void *.  The default
4699
+ * is to store register values as void *type.
4700
+ *
4701
+ * ZipCPU --- Default is what we need.
4702
+ */
4703
+
4704
+/* ASSUME_EXTENDED_UNWIND_CONTEXT ... Define this macro to be 1 if the target
4705
+ * always uses extended unwind context with version, args_size, and by_value
4706
+ * fields.  If it is undefined, it will always be defined to 1 when REG_VALUE_IN_UNWIND_CONTEXT is defined and 0 otherwise.
4707
+ *
4708
+ */
4709
+
4710
+
4711
+/* 17.09.05 Eliminating Frame Pointer and Arg Pointer */
4712
+
4713
+/* TARGET_FRAME_POINTER_REQUIRED(VOID) ... This target hook should return true
4714
+ * if a function must have and use a frame pointer.  This target hook is
4715
+ * called in the reload pass.  If its return value is true, the function will
4716
+ * have a frame pointer.
4717
+ *
4718
+ * This target hook can in principle examine the current function and decide
4719
+ * according to the facts, but on most machines the constant false or the
4720
+ * constant true suffices.  Use false when the machine allows code to be
4721
+ * generated with no frame pointer, and doing so saves some time or space.
4722
+ * Use true when there is no possible advantage to avoiding a frame pointer.
4723
+ *
4724
+ * ZipCPU---if we add in a frame pointer, we become register starved.  Hence,
4725
+ * we'll treat this as a constant false--which is also the default value.
4726
+ */
4727
+#define        target_frame_pointer_required   zip_frame_pointer_required
4728
+
4729
+/* INITIAL_FRAME_POINTER_OFFSET ... A C statement to store in the variable
4730
+ * depth-var the difference between the frame pointer and the stack pointer
4731
+ * values immediately after the function prologue.  The value would be computed
4732
+ * from information such as the result of get_frame_size() and the tables of
4733
+ * registers regs_ever_live and call_used_regs.
4734
+ *
4735
+ * If ELIMINABLE_REGS is defined, this macro will not be used and need not be
4736
+ * defined.  Otherwise, it must be defined even if TARGET_FRAME_POINTER_REQD
4737
+ * always returns true; in that case you may set depth-var to anything.
4738
+ *
4739
+ * ZipCPU --- we intend to set ELIMINABLE_REGS, so this is not necessary.
4740
+ */
4741
+// #define     INITIAL_FRAME_POINTER_OFFSET(DEPTH)     (DEPTH) = 0
4742
+
4743
+
4744
+/* ELIMINABLE_REGS ... If defined, this macro specifies a table of register
4745
+ * pairs used to eliminate unneeded registers that point into the stack frame.
4746
+ * If it is not defined, the only elimination attempted by the compiler is to
4747
+ * replace references to the frame pointer with references to the stack pointer.
4748
+ *
4749
+ * On some machines, the position of the argument pointer is not known until
4750
+ * the compilation is completed.  In such a case, a separate hard register
4751
+ * must be used for the argument pointer.  This register can be eliminated by
4752
+ * replacing it with either the frame pointer or the argument pointer,
4753
+ * depending on whether or not the frame pointer has been eliminated.
4754
+ *
4755
+ * ZipCPU we'll take their suggestion and define this as:
4756
+ */
4757
+#undef ELIMINABLE_REGS
4758 103 dgisselq
+#ifdef zip_FP_PSEUDO
4759 102 dgisselq
+#define        ELIMINABLE_REGS \
4760 103 dgisselq
+        {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM},          \
4761
+         { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM},     \
4762
+         { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM},        \
4763
+         { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
4764
+#else
4765
+# if (ARG_POINTER_REGNUM == FRAME_POINTER_REGNUM)
4766
+#  define      ELIMINABLE_REGS \
4767
+        {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
4768
+# else
4769
+#  define      ELIMINABLE_REGS \
4770 102 dgisselq
+       {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM },  \
4771
+        { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM },  \
4772
+        { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
4773 103 dgisselq
+# endif
4774
+#endif
4775 102 dgisselq
+
4776
+/* bool TARGET_CAN_ELIMINATE(FROM,TO) ... This target function should return
4777
+ * true if the compiler is allowed to try to replace register number FROM with
4778
+ * register number TO.  This target hook need only be defined if ELIMINABLE_REGS
4779
+ * is defined, and will usually return true since most of the cases preventing
4780
+ * register elimination are things that the compiler  already knows about.
4781
+ *
4782
+ * ZipCPU ... does the compiler  know about my decision as to whether or not
4783
+ * the frame pointer was needed?  The m68k code suggests it does not ...
4784
+ */
4785
+#define TARGET_CAN_ELIMINATE   zip_can_eliminate
4786
+
4787
+/* INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) ... This macro is similar to
4788
+ * INITIAL_FRAME_POINTER_OFFSET.  It specifies the initial difference between
4789
+ * the specified pair of registers.  This macro must be defined if
4790
+ * ELIMINABLE_REGS is defined.
4791
+ *
4792
+ * ZipCPU---Is there a default we can use?
4793
+ */
4794
+#define        INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)    (OFFSET)=0
4795
+/*
4796
+#define        INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)            \
4797
+       do { (OFFSET) = zip_initial_elimination_offset((FROM), (TO)); } \
4798
+       while(0)                                        \
4799
+*/
4800
+
4801
+/* 17.09.06 Passing function arguments on the stack */
4802
+
4803
+/* TARGET_PROMOTE_PROTOTYPES ... Returns true if an argument declared in a
4804
+ * prototype as an integral type smaller than int should actually be
4805
+ * passed as an int.  In addition to avoiding errors in certain cases of
4806
+ * mismatch, it also makes for better code on certain machines.  The default is
4807
+ * to not promote prototypes.
4808
+ *
4809
+ * Since everything is an int on the ZipCPU, let's promote anything smaller
4810
+ * (which should still be an int) up to an int anyway.
4811
+ */
4812
+#undef TARGET_PROMOTE_PROTOTYPES
4813
+#define        TARGET_PROMOTE_PROTOTYPES       hook_bool_const_tree_true
4814
+
4815
+/* PUSH_ARGS ... A C expression.  If nonzero, push instructions will be used to
4816
+ * pass outgoing arguments.  If the target machine does not have a push
4817
+ * instruction, set it to zero.  That directs GCC to use an alternate strategy:
4818
+ * to allocate the entire argument block and then store the arguments into it.
4819
+ * When PUSH_ARGS is nonzero, PUSH_ROUNDING must be defined too.
4820
+ *
4821
+ * ZipCPU does not have a push instruction, so we set this to zero.
4822
+ */
4823
+#undef PUSH_ARGS
4824
+#define        PUSH_ARGS       0
4825
+
4826
+/* PUSH_ARGS_REVERSED ... A C expression.  If nonzero, function arguments will
4827
+ * be evaluated last to first, rather than first to last.  If this macro is
4828
+ * not defined, it defaults to PUSH_ARGS on targets where the stack and args
4829
+ * grow in opposite directions, and zero otherwise.
4830
+ *
4831
+ * ZipCPU---Let's evaluate our arguments first to last.
4832
+ */
4833
+#define        PUSH_ARGS_REVERSED      1
4834
+
4835
+/* PUSH_ROUNDING(NPUSHED) ... A C expression that is the number of bytes
4836
+ * actually pushed onto the stack when an instruction attempts to push
4837
+ * (NPUSHED) bytes.
4838
+ *
4839
+ * ZipCPU---We cannot push bytes.  Let's leave this undefined and see what
4840
+ * happens.
4841
+ */
4842
+// #warning "No appropriate definition seemed right."
4843
+
4844
+/* ACCUMULATE_OUTGOING_ARGS ... A C expression.  If non-zero, the maximum amount
4845
+ * of space required for outgoing arguments will be computed and placed into
4846
+ * 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
4847
+ * amount.
4848
+ *
4849
+ * ZipCPU---This is *cool* and so necessary---it saves an extra two instructions
4850
+ * each time we try to call a function/routine.  Yes, we want and *need* this
4851
+ * for good performance.  I mean, think of it, free performance increase?  Who
4852
+ * could argue with that?
4853
+ */
4854
+#undef ACCUMULATE_OUTGOING_ARGS
4855
+#define        ACCUMULATE_OUTGOING_ARGS        1
4856
+
4857
+
4858
+/* REG_PARM_STACK_SPACCE(FN) ... Define this macro if functions should assume
4859
+ * that stack space has been allocated for arguments even when their values
4860
+ * are passed in registers.  The value of this macro is the size, in bytes, of
4861
+ * the area reserved for arguments passed in registers for the function
4862
+ * represented by FN, which can be zero if GCC is calling a library function.
4863
+ * The argument FN can be the FUNCTION_DECL, or the type itself of the function.
4864
+ *
4865
+ * This space can be allocated by the caller, or be part of the machine
4866
+ * dependent stack frame: OUTGOING_REG_PARM_STACK_SPACE says which.
4867
+ *
4868
+ * ZipCPU --- Why allocate space you won't use?  Let's leave this undefined
4869
+ * therefore.
4870
+ */
4871
+// #undef      REG_PARM_STACK_SPACE
4872
+
4873
+
4874
+
4875
+/* INCOMING_REG_PARM_STACK_SPACE(FN) ... Like REG_PARM_STACK_SPACE, but for
4876
+ * incoming register arguments.  Define this macro if space guaranteed when
4877
+ * compiling a function body is different to space required when making a call,
4878
+ * a situation that can arise with K&R style function definitions.
4879
+ *
4880
+ */
4881
+
4882
+/* OUTGOING_REG_PARM_STACK_SPACE(FN) ... Define this to a nonzero value if it
4883
+ * is the responsibility of the caller to allocate the area reserved for
4884
+ * arguments passed in registers when calling a function of FN.  FN may be NULL
4885
+ * if the function called is a library function.
4886
+ *
4887
+ * ZipCPU---Why allocate space you don't need?
4888
+ */
4889
+#define        OUTGOING_REG_PARM_STACK_SPACE(FNTYPE)   0
4890
+
4891
+
4892
+/* STACK_PARMS_IN_REG_PARM_AREA ... Define this macro if REG_PARM_STACK_SPACE
4893
+ * is defined, buyt the stack parameters don't skip the area specified by it.
4894
+ *
4895
+ * ZipCPU---We didn't define REG_PARM_STACK_SPACE, so we won't define this.
4896
+ */
4897
+
4898
+/* TARGET_RETURN_POPS_ARGS(DECL,FNTYPE,SZ) ... This target hook returns the
4899
+ * number of bytes of its own arguments that a function pops on returning, or 0
4900
+ * if the function pops no arguments and the caller must therefore pop them all
4901
+ * after the function returns.
4902
+ *
4903
+ * ZipCPU --- If we define this, we'll lose our gain from
4904
+ * ACCUMULATE_OUTOING_ARGS.  Thus, we leave this undefined.
4905
+ */
4906
+
4907
+/* CALL_POPS_ARGS(CUM) ... A C expression that should indicate the number of
4908
+ * bytes a call sequence pops off of the stack.  It is added to the value of
4909
+ * RETURN_POPS_ARGS when compiling a function call.  CUM is the variable in
4910
+ * which all arguments to the function have been accumulated.
4911
+ *
4912
+ * ZipCPU---The call sequence, by itself, doesn't touch the stack.  Therefore
4913
+ * this is zero.
4914
+ */
4915
+#undef CALL_POPS_ARGS
4916
+#define        CALL_POPS_ARGS(CUM)     0
4917
+
4918
+
4919
+/* 17.09.07 Passing arguments in registers */
4920
+
4921
+/* TARGET_FUNCTION_ARG ... Return an RTX indicating whether a function argument
4922
+ * is passed in a register, and if so, which register.
4923
+ */
4924
+/*
4925
+ * This has been poisoned ... so let's not define it anymore and look for
4926
+ * a better way to do this ...
4927
+ *
4928
+ * #define     FUNCTION_ARG(CUM, MODE, TYPE, NAMED) (((NAMED) == 0) ? NULL_RTX
4929
+ *     : targetm.calls.must_pass_in_stack(MODE, TYPE)  ? NULL_RTX
4930
+ *     : (CUM) > ZIP_LAST_ARG_REGNO                    ? NULL_RTX
4931
+ *     : gen_rtx_REG(MODE, CUM))
4932
+ */
4933
+#define        TARGET_FUNCTION_ARG     zip_function_arg
4934
+
4935
+
4936
+/* TARGET_MUST_PASS_IN_STACK ...
4937
+ */
4938
+// #undef      TARGET_MUST_PASS_IN_STACK
4939
+// #define     TARGET_MUST_PASS_IN_STACK       zip_must_pass_in_stack
4940
+
4941
+/* TARGET_FUNCTION_INCOMING_ARG ... Define this hook if the target machine
4942
+ * has register windows, ... which ZipCPU does not have.
4943
+ */
4944
+
4945
+/* TARGET_USE_PSEUDO_PIC_REG(void) ... This hook should return 1 in case
4946
+ * pseudo register should be created for pic_offset_table_rtx during function
4947
+ * expand.
4948
+ *
4949
+ * This should be defined by global parameters, isn't it?
4950
+ */
4951
+
4952
+/* TARGET_INIT_PIC_REG(v) ... Perform a target dependent initialization of
4953
+ * pic_offset_table_rtx.  This hook is called at the start of register
4954
+ * allocation.
4955
+ *
4956
+ * ZipCPU---Let's revisit this.
4957
+ */
4958
+// #warning "Come back and relook at relocations"
4959
+
4960
+/* TARGET_ARG_PARTIAL_BYTES ... This target hook returns the number of bytes
4961
+ * at the beginning of an argument that must be put in registers.  The value
4962
+ * must be zero for arguments that are passed entirely in registers or that
4963
+ * are entirely pushed on the stack.
4964
+ */
4965
+// #undef      TARGET_ARG_PARTIAL_BYTES
4966
+// #define     TARGET_ARG_PARTIAL_BYTES        zip_arg_partial_bytes
4967
+
4968
+/* TARGET_PASS_BY_REFERENCE(CUM,MOD,TREE,NAMED) ... This target hook should
4969
+ * return true if an argument at the position indicated by CUM should be passed
4970
+ * by reference.  This predicate is queried after target independent reasons
4971
+ * for being pssed by reference, such as TREE_ADDRESSABLE(TREE).
4972
+ *
4973
+ */
4974
+// #undef      TARGET_PASS_BY_REFERENCE
4975
+// #define     TARGET_PASS_BY_REFERENCE        zip_pass_by_reference
4976
+
4977
+/* CUMULATIVE ARGS ...  A C type for declaring a variable that is used as the
4978
+ * first argument of 'FUNCTION_ARG' and other related values.
4979
+ *
4980
+ * ZipCPU---We're in trouble if an 'int' won't work, so let's just use that.
4981
+ */
4982
+#define        CUMULATIVE_ARGS int
4983
+
4984
+/*
4985
+ * OVERRIDE_ABI_FORMAT
4986
+ */
4987
+
4988
+/* INIT_CUMULATIVE_ARGS ... A C statement (sans semicolon) for initializing the
4989
+ * variable CUM for the state at the beginning of the argument list.
4990
+ *
4991
+ *
4992
+ * ZipCPU---The first argument is passed in register ZIP_FIRST_ARG_REGNO, or
4993
+ * R1 (unless it has been redefined above ...)
4994
+ */
4995
+#define        INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) (CUM = 0)
4996
+
4997
+/* INIT_CUMULATIVE_LIBCALL_ARGS
4998
+ * INIT_CUMULATIVE_INCOMING_ARGS
4999
+ *
5000
+ * These default to the last INIT_CUM_ARGS value above.
5001
+ */
5002
+
5003
+/* TARGET_FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) .. This hook updates
5004
+ * the summarizer variable pointed to by CUM to advance past an argument in
5005
+ * the argument list.  The values MODE, TYPE, and NAMED describe that
5006
+ * argument.  Once this is done, the variable CUM is suitable for analyzing the
5007
+ * following argument with TARGET_FUNCTION_ARG, etc.  This hook need not do
5008
+ * anything if the argument in question was passed on the stack.  The compiler
5009
+ * knows how to track the amount of stack space used for arguments without
5010
+ * any special help.
5011
+ *
5012
+ * ZipCPU---Here we simply copy from ECO32.
5013
+ */
5014
+#define        TARGET_FUNCTION_ARG_ADVANCE     zip_function_arg_advance
5015
+
5016
+/*
5017
+ * TARGET_ARG_OFFSET --- not necessary
5018
+ * FUNCTION_ARG_PADDING        --- not necessary, since we shouldn't be padding
5019
+ * PAD_VARARGS_DOWN    --- not necessary, since we shouldn't be padding
5020
+ * BLOCK_REG_PADDING
5021
+ * TARGET_FUNCTION_ARG_BOUNDARY
5022
+ * TARGET_FUNCTION_ARG_ROUND_BOUNDARY
5023
+ */
5024
+
5025
+/* FUNCTION_ARG_REGNO_P(REGNO) ... A C expression that is nonzero if REGNO is
5026
+ * the number of a hard register in which function arguments are sometimes
5027
+ * passed.  This does not include implicit arguments such as the static chain
5028
+ * and the structure-value address.  On many machines, no registers can be used
5029
+ * for this purpose since all function arguments are pushed on the stack.
5030
+ */
5031
+#define        FUNCTION_ARG_REGNO_P(r) ((r >= ZIP_FIRST_ARG_REGNO)&&(r<=ZIP_LAST_ARG_REGNO))
5032
+
5033
+/* TARGET_SPLIT_COMPLEX_ARG(TYPE) ... This hook should return true if parameter
5034
+ * of type TYPE are passed as two scalar parameters.  By default, GCC will
5035
+ * attempt to pack complex arguments into the target's word size.  Some ABI's
5036
+ * require complex arguments to be split and treated as their individual
5037
+ * components.
5038
+ *
5039
+ * The default value of this hook is NULL, which is treated as always false,
5040
+ * and which should be good enough for ZipCPU--which can go either way.
5041
+ */
5042
+
5043
+/* TARGET_BUILD_BUILTIN_VA_LIST ... This hook returns a type node for va_list
5044
+ * for the target.  The default version of the hook returns void*.
5045
+ *
5046
+ */
5047
+
5048
+/* TARGET_ENUM_VA_LIST_P
5049
+ */
5050
+
5051
+/* TARGET_FN_ABI_VA_LIST ... This hook returns the va_list type of the calling
5052
+ * convention specified by FN.  The default version of this returns va_list_type_node.
5053
+ */
5054
+
5055
+/* TARGET_FN_ABI_VA_LIST
5056
+ */
5057
+
5058
+/* TARGET_CANONICAL_VA_LIST_TYPE
5059
+ */
5060
+
5061
+/* TARGET_GIMPLIFY_VA_ARG_EXPR
5062
+ */
5063
+
5064
+/* TARGET_VALID_POINTER_MODE(MODE) ... Define this to return nonzero if the
5065
+ * port can handle pointers with machine mode MODE.  The default version of this
5066
+ * hook returns true for both ptr_mode and Pmode.
5067
+ *
5068
+ * ZipCPU---if Pmode is properly defined (above, and I think it is), then the
5069
+ * default behavior is quite appropriate.
5070
+ */
5071
+
5072
+/* TARGET_REF_MAY_ALIAS_ERRNO(REFP) ... Define this to return nonzero if the
5073
+ * memory reference REF may alias with the system C library errno location.
5074
+ * The default version of this hook assumes the system C library errno location
5075
+ * is either a declaration of type int or accessed by dereferencing a pointer
5076
+ * to int.
5077
+ *
5078
+ * ZipCPU --- Default sounds good to me.
5079
+ */
5080
+
5081
+
5082
+/* TARGET_SCALAR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if
5083
+ * the port is prepared to handl instructions involving scalar mode MODE.  For
5084
+ * a scalar mode to be considered supported, all the basic arithmetic and
5085
+ * comparisons must work.
5086
+ *
5087
+ * The default version of this hook returns true for any mode required to
5088
+ * handle the basic C types (as defined by the port).  Included here are the
5089
+ * double-word arithmetic supported by the code in optabs.c.
5090
+ */
5091
+#undef TARGET_SCALAR_MODE_SUPPORTED_P
5092
+#define        TARGET_SCALAR_MODE_SUPPORTED_P  zip_scalar_mode_supported_p
5093
+
5094
+/* TARGET_VECTOR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if the
5095
+ * port is prepared to handle instructions involving vector mode MODE.  At the
5096
+ * very least, it must have move patterns for this mode.
5097
+ *
5098
+ * ZipCPU---does not support any vector modes.
5099
+ */
5100
+#undef TARGET_VECTOR_MODE_SUPPORTED_P
5101
+#define        TARGET_VECTOR_MODE_SUPPORTED_P  hook_bool_mode_false
5102
+
5103
+/* TARGET_ARRAY_MODE_SUPPORTED_P(MODE, NELEMS) ... Return true if GCC should
5104
+ * try to use a scalar mode to store an array of NELEMS elements, given that
5105
+ * each element has mode MODE.  Returning true here overrides the usual MAX_FIXED_MODE limit and allows GCC to use any defined integer mode.
5106
+ *
5107
+ * ZipCPU---Sounds good.
5108
+ */
5109
+// #undef      TARGET_ARRAY_MODE_SUPPORTED_P
5110
+// #define     TARGET_ARRAY_MODE_SUPPORTED_P   zip_array_mode_supported_p
5111
+
5112
+/* TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P(MODE) ... Define this to return
5113
+ * nonzero if libgcc provides support for the floating-point mode MODE, which is
5114
+ * known to pass TARGET_SCALAR_MODE_SUPPORTED_P.  The default version of this
5115
+ * hook returns true for all of SFmode, DFmode, XFmode, and TFmode, if such
5116
+ * modes exist.
5117
+ *
5118
+ * ZipCPU---We only support SFmode and DFmode, but for now only in emulation
5119
+ * (if we can).  Let's allow both of those and see how far we get.
5120
+ */
5121
+#undef TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P
5122
+#define        TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P zip_libgcc_floating_mode_supported_p
5123
+
5124
+/* TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P(MODE) ... Define this to return
5125
+ * nonzero for machine modes for which the port has small register classes.  If
5126
+ * target hook returns nonzero for a given MODE, the compiler will try to
5127
+ * minimize the lifetime of registers in MODE.  The hook may be called with
5128
+ * VOIDmode as an argument.  In this case, the hook is expected to return
5129
+ * nonzero if it returns nonzero for any mode.
5130
+ *
5131
+ * The default version of this hook returns false for any mode.
5132
+ *
5133
+ * ZipCPU---Default sounds good.
5134
+ */
5135
+
5136
+/* 17.09.08 How scalar function values are returned */
5137
+
5138
+/* TARGET_FUNCTION_VALUE
5139
+ */
5140
+
5141
+/* LIBCALL_VALUE
5142
+ */
5143
+
5144
+
5145
+/* 17.09.09 How large values are returned */
5146
+
5147
+/* TARGET_RETURN_IN_MEMORY(TYP,FNTYP) ... This target hook should return a
5148
+ * nonzero value to say to return the function value in memory, just as large
5149
+ * structures are always returned.  Here type will be the data type of the value
5150
+ * and FNTYP will be the type of the function doing the returning, or NULL
5151
+ * for libcalls.
5152
+ *
5153
+ */
5154
+#undef TARGET_RETURN_IN_MEMORY
5155
+#define        TARGET_RETURN_IN_MEMORY zip_return_in_memory
5156
+
5157
+/* DEFAULT_PCC_STRUCT_RETURN
5158
+ * TARGET_STRUCT_VALUE_RTX
5159
+ * PCC_STATIC_STRUCT_RETURN
5160
+ * TARGET_GET_RAW_RESULT_MODE
5161
+ * TARGET_GET_RAW_ARG_MODE
5162
+ */
5163
+
5164
+
5165
+/* 17.09.10 Caller-Saves Register Allocation */
5166
+/* 17.09.11 Function Entry and Exit */
5167 111 dgisselq
+// TARGET_ASM_FUNCTION_PROLOGUE
5168
+// TARGET_ASM_FUNCTION_END_PROLOGUE
5169
+// TARGET_ASM_FUNCCTION_BEGIN_EPILOGUE
5170
+// TARGET_ASM_FUNCTION_EPILOGUE
5171
+/* EXIT_IGNORE_STACK ... Define this macro as a C expression that is nonzero
5172
+ * if the return instruction or the function epilogue ignores the value of the
5173
+ * stack pointer; in other words, if it is safe to delete an instruction to
5174
+ * adjust the stack pointer before a return from the function.
5175
+ *
5176
+ * The default is 0.
5177
+ *
5178
+ * Note that this macro's value is relevant only for functions for which frame
5179
+ * pointers are maintained.  It is never safe to delete a final stack adjustment
5180
+ * in a function that has no frame pointer, and the compiler knows this
5181
+ * regardless of EXIT_IGNORE_STACK.
5182
+ *
5183
+ * ZipCPU -- Thanks to the example of the m68k, and a careful selection of what
5184
+ * our options otherwise could have been, our epilogue code does not use the
5185
+ * stack register at all, but rather starts by moving the frame register into
5186
+ * the stack register.
5187
+ */
5188
+#define EXIT_IGNORE_STACK      1
5189
+// EPILOGUE_USES(regno)
5190
+// EH_USES(regno)
5191
+// TARGET_ASM_OUTPUT_MI_THUNK
5192
+// TARGET_ASM_CAN_OUTPUT_MI_THUNK
5193
+
5194 102 dgisselq
+/* 17.09.12 Generating code for profiling */
5195 111 dgisselq
+// FUNCTION_PROFILER
5196
+// PROFILE_HOOK
5197
+// NO_PROFILE_COUNTERS
5198
+// PROFILE_BEFORE_PROLOGUE
5199
+// TARGET_KEEP_LEAF_WHEN_PROFILED
5200
+
5201 102 dgisselq
+/* 17.09.13 Permitting tail calls*/
5202 111 dgisselq
+
5203
+/* TARGET_FUNCTION_OK_FOR_SIBCALL(DECL,EXP) ... True if it is OK to do sibling
5204
+ * call optimizations for the specified call expression EXP.  DECL will be the
5205
+ * called function, or NULL if this is an indirect call.
5206
+ *
5207
+ * It is not uncommon for limitations of calling conventions to prevent tail
5208
+ * calls to functions outside the current unit of translation, or during PIC
5209
+ * compilation.  The hook is used to enforce these restrictions, as the sibcall
5210
+ * md pattern can not fail, or fall over to a 'normal' call.  The criteria for
5211
+ * successful sibling call optimization may vary greatly between different
5212
+ * architectures.
5213
+ *
5214
+ * ?? What's a sibling call?
5215
+ */
5216
+
5217
+// TARGET_EXTRA_LIVE_ON_ENTRY
5218
+// TARGET_SET_UP_BY_PROLOGUE
5219
+// TARGET_WARN_FUNC_RETURN
5220
+
5221 102 dgisselq
+/* 17.09.14 Stack smashing protection */
5222 111 dgisselq
+// TARGET_STACK_PROTECT_GUARD
5223
+// TARGET_STACK_PROTECT_FAIL
5224
+// TARGET_SUPPORTS_SPLIT_STACK
5225
+
5226 102 dgisselq
+/* 17.09.15 Miscellaneous register hooks */
5227
+
5228 111 dgisselq
+// TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
5229
+
5230 102 dgisselq
+/* TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
5231
+ * ZipCPU --- default is good enough for us.
5232
+ */
5233
+
5234
+/* 17.10 Implementing VARARGS MACROS */
5235
+
5236
+/* ...
5237
+ */
5238
+
5239
+/* void TARGET_SETUP_INCOMING_VARARGS(A,M,T,I,S) ... This target hook offers an
5240
+ * alternative to using __builtin_saveregs and defining the hook TARGET_EXPAND..
5241
+ * _BUILTIN_SAVEREGS.  Use it to store the anonymous register arguments into the
5242
+ * stack so that all the arguments appear to have been passed consecutively
5243
+ * on the stack.  Once this is done, you can use the standard implementation
5244
+ * of varargs that works for machines that pass all their arguments on the
5245
+ * stack.
5246
+ */
5247
+// #undef      TARGET_SETUP_INCOMING_VARARGS
5248
+// #define     TARGET_SETUP_INCOMING_VARARGS   zip_setup_incoming_varargs
5249
+
5250
+/* ...
5251
+ */
5252
+
5253
+/* 17.11 Trampolines for Nested Functions */
5254
+
5255
+/* TARGET_ASM_TRAMPOLINE_TEMPLATE ... This hook is called by
5256
+ * assemble_trampoline_template to output, on the stream f, assembler code for
5257
+ * a block of data that contains the constant parts of a trampoline.  This code
5258
+ * should not include a label--the label is taken care of automatically.
5259
+ *
5260
+ * ZipCPU -- looks like we need to do this.
5261
+ */
5262
+#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
5263
+#define        TARGET_ASM_TRAMPOLINE_TEMPLATE  zip_asm_trampoline_template
5264
+
5265
+/* TRAMPOLINE_SECTION ... Return the section into which the trampoline template
5266
+ * is to be placed.  The default value is readonly_data_section.
5267
+ *
5268
+ * ZipCPU--default should be good enough.
5269
+ */
5270
+
5271
+/* TRAMPOLINE_SIZE ... A C expression for the size (in bytes) of the trampoline
5272
+ * as an integer.
5273
+ *
5274
+ * ZipCPU--it's three instructions, or 96 bits.  However, 32-bits is our minimal
5275
+ * addressible unit, so what size do we offer here?  We'll stick with the number
5276
+ * of bytes, but we may need to change this later.
5277
+ *
5278
+ */
5279
+// #warning "May need to redefine trampoline_size in words, not bytes"
5280
+#undef TRAMPOLINE_SIZE
5281
+#define        TRAMPOLINE_SIZE 3
5282
+
5283
+/* TRAMPOLINE_ALIGNMENT ... alignment required for trampolines, in bits.
5284
+ *
5285
+ * Well that's well known in ZipCPU --- 32-bits.
5286
+ */
5287
+#undef TRAMPOLINE_ALIGNMENT
5288
+#define        TRAMPOLINE_ALIGNMENT    32
5289
+
5290
+/* void TARGET_TRAMPOLINE_INIT(RTX,TREE,RTX CH) ... This hook is called to
5291
+ * initialize a trampoline.  m_tramp is an RTX for the memory block for the
5292
+ * trampoline; TREE is the FUNCTION_DECL for the nested fucntion;  CH is an
5293
+ * rtx for the static chain value that should be passed to the function when
5294
+ * it is called.
5295
+ *
5296
+ * ZipCPU ... Can we get by without this?
5297
+ */
5298
+#undef TARGET_TRAMPOLINE_INIT
5299
+#define        TARGET_TRAMPOLINE_INIT  zip_trampoline_init
5300
+
5301
+/* TARGET_TRAMPOLINE_ADJUST_ADDRESS(RTX) ... This hook should perform any
5302
+ * machine-specific adjustment in the address of the trampoline.  Its argument
5303
+ * contains the address of the memory block that was passed to
5304
+ * TARGET_TRAMPOLINE_INIT.  In case the address to be used for a function call
5305
+ * should be different from the address at which the template was stored, the
5306
+ * different address should be returned; otherwise addr should be returned
5307
+ * unchanged.  If the hook is not defined, RTX (addr) will be used for function
5308
+ * calls.
5309
+ *
5310
+ * ZipCPU--works for us!
5311
+ */
5312
+
5313
+/* CLEAR_INSN_CACHE(BEG,END) ... If defined, expands to a C expression clearing
5314
+ * the instruction cache in the specified interval.  The definition of this
5315
+ * macro would typically be a series of asm statements.   Both BEG and END are
5316
+ * pointer expressions.
5317
+ *
5318
+ * ZipCPU --- Ouch!  We have no way to do this (yet)!
5319
+ */
5320
+
5321
+/* TRANSFER_FROM_TRAMPOLINE ... Define this macro is trampolines need a special
5322 111 dgisselq
+ * subroutine to do their work.  The macro should expand to a series of asm
5323 102 dgisselq
+ * statements which will be compiled with GCC.  They go in a library function
5324
+ * named __transfer_from_trampoline.
5325
+ *
5326
+ * We may need to rethink trampolines on ZipCPU.
5327
+ */
5328
+
5329
+
5330
+/* 17.12 Implicit Calls to Library Routines */
5331
+
5332
+/* DECLARE_LIBRARY_RENAMES
5333
+ *
5334
+ * ZipCPU: Don't need it.
5335
+ */
5336
+
5337
+/* TARGET_INIT_LIBFUNCS(VOID) ... This hook should declare additional library
5338
+ * routines or rename existing ones, using the functions set_optab_libfunc and
5339
+ * init_one_libfunc defined in optabs.c.  init_optabs calls this macro after
5340
+ * initializing all the normal library routines.
5341
+ *
5342
+ * Most ports don't need to define this hook, so we won't either.
5343
+ */
5344
+
5345
+/* TARGET_LIBFUNC_GNU_PREFIX ... If false (the default), internal library
5346
+ * routines start with two underscores.  If set to true, these routines start
5347
+ * with __gnu_ instead.
5348
+ *
5349
+ * ZipCPU: No change necessary.
5350
+ */
5351
+
5352
+/* FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE,COMPARISON) ... This macro should return
5353
+ * true if the library routine that implements the floating point comparison
5354
+ * operator comparison in mode mode will return a boolean and false if it will
5355
+ * return a tristate.
5356
+ *
5357
+ * Most ports don't need to define this macro, so Zip CPU won't either.
5358
+ */
5359
+
5360
+/* TARGET_HAS_NO_HW_DIVIDE ... This macro should be defined if the target has no
5361
+ * hardware divide instructions.  If this macro is defined, GCC will use an
5362
+ * algorithm which makes use of simple logical and arithmetic operations for
5363
+ * 64-bit division.  If the macro is not defined, GCC will use an algorithm
5364
+ * which makes use of a 64-bit by 32-bit divide primitive.
5365
+ *
5366
+ * Zip CPU, though, doesn't have the 64-bit by 32-bit divide primitive, thus
5367
+ * we have no HW DIVIDE (for now).
5368
+ */
5369
+#define        TARGET_HAS_NO_HW_DIVIDE
5370
+
5371
+/* TARGET_EDOM ... The value of EDOM on the target machine, as a C integer
5372
+ * expression.  If you don't define this macro, GCC does not attempt to deposit
5373
+ * the value of EDOM into errno directly.  Look in /usr/include/errno.h to find
5374
+ * the value of EDOM on your system.
5375
+ *
5376
+ * EDOM is the error created when a math argument is out of the domain of the
5377
+ * function.
5378
+ *
5379
+ * ZipCPU: Don't need it---I don't think.
5380
+ */
5381
+
5382
+/* GEN_ERRNO_RTX ... Define this macro as a C exrpession to create an rtl
5383
+ * expression that refers to the global "variable" errno.  (On certain
5384
+ * systems, errno may not actually be a variable.)  If you don't define this
5385
+ * macro, a reasonable default is used.
5386
+ *
5387
+ * ZipCPU --- if a reasonable default is used, we'll use that--especially since
5388
+ * I doubt we'll be using errno for a while.
5389
+ */
5390
+
5391
+/* NEXT_OBJC_RUNTIME ... Set this macro to 1 to use the "NeXT" Objective-C
5392
+ * message sending conventions by default.  This calling convention involves
5393
+ * passing the object, the selector and the method arguments all at once to the
5394
+ * method-lookup library function.  This is the usual setting when targetting
5395
+ * Darwin/Mac OS X systems, which have the NeXT runtime installed.
5396
+ *
5397
+ * If the macro is set to 0, ...
5398
+ *
5399
+ * Doesn't look relevant (yet) for the Zip CPU--especially since we don't have
5400
+ * an O/S yet.
5401
+ */
5402
+
5403
+
5404
+
5405
+/* 17.13 Addressing Modes */
5406
+
5407
+/* C expressions that are nonzero if the machine supports pre-increment,
5408
+ * pre-decrement, post-increment, or post-decrement addressing respectively.
5409
+ */
5410
+#define        HAVE_PRE_INCREMENT      (0)
5411
+#define        HAVE_PRE_DECREMENT      (0)
5412
+#define        HAVE_POST_INCREMENT     (0)
5413
+#define        HAVE_POST_DECREMENT     (0)
5414
+
5415
+/* C expression that is nonzero if the machine supports pre- or post- address
5416
+ * side-effect generation involving constants other than the size of the memory
5417
+ * operand.
5418
+ */
5419
+#define        HAVE_PRE_MODIFY_DISP    (0)
5420
+#define        HAVE_POST_MODIFY_DISP   (0)
5421
+
5422
+/* C expression that is non-zero if the machine supports pre- or post-address
5423
+ * side-effect generation involving a register displacement.
5424
+ */
5425
+#define        HAVE_PRE_MODIFY_REG     (0)
5426
+#define        HAVE_POST_MODIFY_REG    (0)
5427
+
5428
+/* CONSTANT_ADDRESS_P(X) ... A C expression that is 1 if the RTX X is a constant
5429
+ * which is a valid address.  On most machines the default definition ... is
5430
+ * acceptable, but a few machines are more restrictive as to which constant
5431
+ * addresses are supported.
5432
+ *
5433
+ * Zip CPU is designed for offset addresses, not constant addresses.  Although
5434
+ * the CPU will support 18-bit signed constant addresses, the assembler and
5435
+ * general programming model do not.  Further, without knowing where the final
5436
+ * address will be located, this is an unusable model.  Therefore we will
5437
+ * define this as not supported.
5438
+ *
5439
+ * In hindsight, this isn't true--labels and symbols are valid addresses, and
5440
+ * they are also constant addresses.  Hence, we leave this at its default.
5441
+ */
5442
+// #undef      CONSTANT_ADDRESS_P
5443
+// #define     CONSTANT_ADDRESS_P(X)   (0)
5444
+
5445 111 dgisselq
+/* CONSTANT_P(X) ... CONSTANT_P, which is defined by target-independent code,
5446
+ * accepts integer values expressions whose values are not explicitly known,
5447
+ * such as symbol_ref, label_ref, and high expressions and const arithmetic
5448
+ * expressions, in addition to const_int and const_double expressions.
5449 102 dgisselq
+ *
5450
+ * Huh???
5451
+ */
5452
+// #define CONSTANT_P(X) ???
5453
+
5454 111 dgisselq
+/* MAX_REGS_PER_ADDRESS ... A number, the maximum number of registers that can
5455
+ * appear in a valid memory address.  Note that it is up to you to specify a
5456
+ * value equal to the maximum number that TARGET_LEGITIMATE_ADDRESS_P would
5457
+ * ever accept.
5458 102 dgisselq
+ */
5459
+#define        MAX_REGS_PER_ADDRESS    1
5460
+
5461
+/* TARGET_LEGITIMATE_ADDRESS_P(MODE,RTX,STRICT) ... A function that returns
5462
+ * whether RTX is a legitimate memory address on the target machine for a
5463
+ * memory operation of mode MODE.
5464
+ */
5465
+#undef TARGET_LEGITIMATE_ADDRESS_P
5466
+#define TARGET_LEGITIMATE_ADDRESS_P    zip_legitimate_address_p
5467
+
5468
+/* TARGET_MEM_CONSTRAINT ... A single character to be used instead of the
5469
+ * default 'm' character for general memory addresses.  This defines the
5470
+ * constraint letter which matches the memory addresses accepted by
5471
+ * TARGET_LEGITIMATE_ADDRESS_P.  Define this macro if you want to support new
5472
+ * address format in your back end without changing the semantics of the 'm'
5473
+ * constraint.  This is necessary in order to preserve functionality of inline
5474
+ * assembly constructs using the 'm' constraint.
5475
+ *
5476
+ * ZipCPU--doesn't look like we need to define this at all.
5477
+ */
5478
+
5479
+/* FIND_BASE_TERM(X) ... A C expression to determine the base term of address
5480
+ * X or to provide a simplified version of X from which alias.c can easily find
5481
+ * the base term.  This macro is used in only two places: find_base_value and
5482
+ * find_base_term in alias.c.
5483
+ *
5484
+ * It is always safe for this macro  to not be defined.  It exists so that
5485
+ * alias analysis can understand machine-dependent addresses.
5486
+ *
5487
+ * ZipCPU: We'll skip this then.
5488
+ */
5489
+
5490
+/* TARGET_LEGITIMIZE_ADDRESS(RTX,OLD,MODE) ... This hook is given an invalid
5491
+ * memory address RTX for an operand of mode MODE and should try to return a
5492
+ * valid memory address.  RTX will always be the result of a call to
5493
+ * break_out_memory_refs, and OLD will be the operand that was given to that
5494
+ * function to produce RTX.
5495
+ *
5496 111 dgisselq
+ * ZipCPU --
5497 102 dgisselq
+ */
5498 111 dgisselq
+#undef TARGET_LEGITIMIZE_ADDRESS
5499
+#define        TARGET_LEGITIMIZE_ADDRESS       zip_legitimize_address
5500 102 dgisselq
+
5501
+/* LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OP,TYPE,IND,WIN) ... A C compound statement
5502
+ * that attempts to replace X, which is an address that needs reloading, with
5503
+ * a valid memory address for an operand of mode MODE.  WIN will be a C
5504
+ * statement label elsewhere in the code.  It is not necessary to define this
5505
+ * macro, but it might be useful for performance reasons.
5506
+ *
5507
+ * ZipCPU: This is worth coming back to, according to the notes page, but it
5508
+ * may also be a difficult macro to use.  Look at other implementations before
5509
+ * we dive into this.
5510
+ */
5511
+// #undef LEGITIMIZE_RELOAD_ADDRESS
5512
+// #define LEGITIMIZE_RELOAD_ADDRESS
5513
+
5514
+/* TARGET_MODE_DEPENDENT_ADDRESS_P(ADDR,SPACE) ... This hook returns true
5515
+ * if memory address addr in address space addrspace can have different meanings
5516
+ * depending on the machine mode of the memory reference it is used for or if
5517
+ * the address is valid for some modes but not others.
5518
+ */
5519
+#undef TARGET_MODE_DEPENDENT_ADDRESS_P
5520
+#define        TARGET_MODE_DEPENDENT_ADDRESS_P         zip_mode_dependent_address_p
5521
+
5522 111 dgisselq
+/* TARGET_LEGITIMATE_CONSTANT_P(MODE,RTX) ... This hook returns true if x is a
5523
+ * legitimate constant for a MODE-mode immediate operand on the target machine.
5524
+ * You can assume the RTX satisfies CONSTANT_P, so you need not check this.
5525
+ *
5526
+ * The default definition returns true.
5527 102 dgisselq
+ */
5528
+
5529
+/* TARGET_DELIGITIMIZE_ADDRESS(RTX)
5530
+ */
5531
+
5532
+/* TARGET_CONST_NOT_OK_FOR_DEBUG_P(RTX) ... This hook should return true if RTX
5533
+ * should not be emitted into debug sections.
5534
+ */
5535
+
5536
+/* TARGET_CANNOT_FORCE_CONST_MEM(MODE,RTX) ... This hook should return true if
5537
+ * RTX is a form that cannot (or should not) be spilled to the constant pool.
5538
+ * MODE is the mode of X.  The default version returns false.
5539
+ */
5540 111 dgisselq
+// #define     TARGET_CANNOT_FORCE_CONST_MEM   hook_bool_mode_rtx_false
5541 102 dgisselq
+
5542
+/* TARGET_USE_BLOCKS_FOR_CONSTANT_P(MODE,RTX) ... This hook should return true
5543
+ * if pool entries for constant RTX can be placed in an object_block structure.
5544
+ * MODE is the mode of X.  The default version returns false for all constants.
5545
+ *
5546
+ *????
5547
+ */
5548
+// #warning "Huh?"
5549
+
5550
+/* TARGET_USE_BLOCKS_FOR_DECL_P(DECL) ... This hook should return true if pool
5551
+ * entries for DECL should be placed in an object_block structure.  The default
5552
+ * version returns true for all DECL's.
5553
+ *
5554
+ * Sounds good.
5555
+ */
5556
+
5557
+/* TARGET_BUILTIN_RECIPROCAL(TREE) ... This hook should return the DECL of a
5558
+ * function that implements the reciprocal of the machine specific builtin
5559
+ * function fndecl, or NULL_TREE if such a function is not available.
5560
+ */
5561
+
5562
+/* TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD(VOID) ... This hook should return the
5563
+ * DECL of a function f that given an address addr as an argument returns a mask
5564
+ * m that can be used to extrract from two vectors the relevant data that
5565
+ * resides in addr in case addr is not properly aligned.
5566
+ *
5567
+ * Zip CPU does not support vectorization.
5568
+ */
5569
+
5570
+/* Other vector, SIMD, and GOACC macros skipped as Zip CPU doesn't support
5571
+ * such data accesses and manipulation.
5572
+ */
5573
+
5574
+/* 17.14 Anchored Addresses */
5575
+
5576
+/* TARGET_MIN_ANCHOR_OFFSET ... The minimum offset that should be applied to
5577
+ * a section anchor.  On most targets, it should be the smallest offset that
5578
+ * can be applied to a base register while still giving a legitimate address for
5579
+ * every mode.  The default value is 0.
5580
+ *
5581
+ * On the Zip CPU, this is the minimum operand B offset to a LOD or STO
5582
+ * operation, which would be a signed 14 bit number.
5583
+ */
5584
+#undef TARGET_MIN_ANCHOR_OFFSET
5585
+#define TARGET_MIN_ANCHOR_OFFSET       zip_min_anchor_offset
5586
+
5587
+/* TARGET_MAX_ANCHOR_OFFSET ... Like TARGET_MIN_ANCHOR_OFFSET, but the maximum
5588
+ * (inclusive) offset that should be applied to section anchors.  The default
5589
+ * value is 0.
5590
+ */
5591
+#undef TARGET_MAX_ANCHOR_OFFSET
5592
+#define TARGET_MAX_ANCHOR_OFFSET       zip_max_anchor_offset
5593
+
5594
+/* TARGET_ASM_OUTPUT_ANCHOR(RTX) ... Write the assembly code to define section
5595
+ * anchor RTX, which is a SYMBOL_REF for which 'SYMBOL_REF_ANCHOR_P(RTL) is
5596
+ * true.  The hook is called with the assembly output position set to the
5597
+ * beginning of SYMBOL_REF_BLOCK(X).
5598
+ *
5599
+ * If ASM_OUTPUT_DEF is available, the hook's default definition uses it to
5600
+ * define the symbol as '. + SYMBOL_REF_BLOCK_OFFSET(RTL)'.  If ASM_OUTPUT_DEF
5601
+ * is not available, the hook's default definition is NULL, which disables the
5602
+ * use of section anchors altogether.
5603
+ *
5604
+ * Section anchors will be very valuable in Zip CPU assembly, therefore we
5605
+ * must define this hook.
5606
+ */
5607
+// #undef      TARGET_ASM_OUTPUT_ANCHOR
5608
+// #define     TARGET_ASM_OUTPUT_ANCHOR        zip_asm_output_anchor
5609
+
5610
+/* TARGET_USE_ANCHORS_FOR_SYMBOL_P(RTX) ... Return true if GCC should attempt
5611
+ * to use anchors to access SYMBOL_REF X.  You can assume SYMBOL_REF_HAS_BLOCK_INFO_P(X) and !SYMBOL_REF_ANCHOR_P(X).
5612
+ *
5613
+ * 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.
5614
+ *
5615
+ * Not knowing anything more, we'll leave the default as is for the Zip CPU.
5616
+ */
5617
+// #undef TARGET_USE_ANCHORS_FOR_SYMBOL_P
5618
+// #define TARGET_USE_ANCHORS_FOR_SYMBOL_P     zip_use_anchors_for_symbol_p
5619
+
5620
+/* 17.15 Condition Code Status */
5621
+
5622
+/* 17.15.1 Representation of condition codes using (cc0) --- that's us */
5623
+
5624
+/* CC_STATUS_MDEP ... C code for a data type which is used for declaring
5625
+ * the mdep component of cc_status.  It defaults to int.
5626
+ *
5627
+ * ZipCPU---Int is good for us.
5628
+ */
5629
+
5630
+/* CC_STATUS_MDEP_INIT ... A C expression to initialize the mdep field to
5631
+ * "empty".  The default definition does nothing, since most machines don't
5632
+ * use the field anyway.  If you want to use the field, you should probably
5633
+ * define  this macro to initialize it.
5634
+ */
5635
+
5636
+/* NOTICE_UPDATE_CC(EXP, INSN) ... A C compound statement to set the components
5637
+ * of cc_status appropriately for an insn insn whose body is exp.  It is this
5638
+ * macro's responsibility to recognize insns that set the condition code as
5639
+ * a byproduct of other activity as well as those that explicitly set (cc0).
5640
+ *
5641
+ * ZipCPU --- We need this, as not all expressions set (cc0).
5642
+ *
5643
+ */
5644
+#define        NOTICE_UPDATE_CC(EXP, INSN)     zip_update_cc_notice(EXP, INSN)
5645
+
5646
+
5647
+/* 17.15.2 Representation of condition codes using registers */
5648
+/* ... which the ZipCPU doesn't have.  The ZipCPU has a CC0 register, and hence
5649
+ * this section isn't supposed to apply.
5650
+ */
5651
+
5652
+/* SELECT_CC_MODE(op, x, y)
5653
+ */
5654
+
5655
+/* TARGET_CANONICALIZE_COMPARISON(int,rtx *, rtx *, bool) ... On some machines
5656
+ * (such as the ZipCPU) not all possible comparisons are defined, but you can
5657
+ * convert an invalid comparison into a valid one.  For example, the Alpha
5658
+ * does not have a GT comparison, but you can use an LT comparison instead and
5659
+ * swap the order of the operands.
5660
+ *
5661
+ * On such machines, implement this hook to do any required conversions:  code
5662
+ * is the initial comparison code and op0 and op1 are the left and right
5663
+ * operands of the comparison, respectively.  If op0_preserve_value is true the
5664
+ * implementation is not allowed to change the value of op0 since the value
5665
+ * might be used in RTXs which aren't comparisons.  E.g. the implementation is
5666
+ * not allowed to swap operands in that case.
5667
+ *
5668
+ * GCC will not assume that the comparison resulting from this macro is valid
5669
+ * but will see if the resulting insn matches a pattern in the 'md' file.
5670
+ *
5671
+ * You need not implement this hook if it would never change the comparison
5672
+ * code or operands.
5673
+ *
5674
+ * In the case of the ZipCPU, the ZipCPU only keeps track of 8 possible
5675
+ * comparisons, and bastardizing other comparisons into those 8 is extremely
5676
+ * painful.  Therefore, we *need* this capability to make certain we can use
5677
+ * our comparisons successfully.
5678
+ *
5679
+ * The only problem is ... this hook appears to only be called on non-CC0
5680
+ * machines.  Hence, defining it hasn't done anything for us.
5681
+ */
5682
+// #define     TARGET_CANONICALIZE_COMPARISON  zip_canonicalize_comparison
5683
+
5684
+/* 17.16 Relative costs of operations */
5685
+
5686
+
5687
+// #define     REGISTER_MOVE_COST(MODE,FROM,TO)        ((MODE==DImode)||(MODE==DFmode))?4:2
5688
+// #define     TARGET_REGISTER_MOVE_COST
5689
+// #define     MEMORY_MOVE_COST(MODE, CLASS, IN)       ((MODE==DImode)||(MODE==DFmode))?8:7
5690
+/* TARGET_REGISTER_MOVE_COST(M,FRM,TO) ... This target hook should return the
5691
+ * cost of moving data of mode M from a register in class FRM to one in class
5692
+ * TO.  The classes are expressed using the enumeration values such as
5693
+ * GENERAL_REGS.  A value of 2 is the default; other values are interpreted
5694
+ * relative to that.
5695
+ *
5696
+ * It is not required that the cost always equal 2 when FROM is the same as TO;
5697
+ * on some machines it is expensive to move between registers if they are not
5698
+ * general registers.
5699
+ *
5700
+ * If reload sees ...
5701
+ *
5702
+ * ZipCPU ... We can leave this at its default value of 2.
5703
+ */
5704
+
5705
+/* TARGET_MEMORY_MOVE_COST(MOD,CL,IN) ... This target hook should return the
5706
+ * cost of moving data of mode MOD between a register of class CL and memory.
5707
+ * IN is false if the value is to be written to memory, true if it is to be
5708
+ * read in.  This cost is relative to those in TARGET_REGISTER_MOVE_COST.
5709
+ * If moving between registers and memory is more expensive that between two
5710
+ * registers, you should add this target hook to express the relative cost.
5711
+ *
5712
+ * If you do not add this target hook, GCC uses a default cost of 4 plus the
5713
+ * cost of copying via a secondary reload register, if one is needed.  If your
5714
+ * machine requires a secondary reload register to copy between memory and a
5715
+ * register of CL but the reload mechanism is more complex than copying via
5716
+ * an intermediate, use this target hook to reflect the actual cost of the
5717
+ * move.
5718
+ *
5719
+ * ZipCPU --- Memory moves are more expensive than twice the cost of register
5720
+ * moves, so let's make certain this is defined.
5721
+ */
5722
+#define        TARGET_MEMORY_MOVE_COST zip_memory_move_cost
5723
+
5724
+// #warning "This needs to be double checked, and annotated"
5725 111 dgisselq
+#define        BRANCH_COST(SPEED,PREDICTABLE)          ((PREDICTABLE)?2:5)
5726 102 dgisselq
+
5727
+/* Define this macro as a C expression which is nonzero if accessing less than
5728
+ * a word of memory (i.e. a 'char' or a 'short') is no faster than accessing
5729
+ * a word of memory.
5730
+ */
5731
+#define        SLOW_BYTE_ACCESS        1
5732
+
5733
+/* MOVE_RATIO(SPD) ... The threshold of number of scalar memory-to-memory move
5734
+ * instructions, below which a sequence of instructions should be generated
5735
+ * instead of a string move instruction or a library call.  Increasing the
5736
+ * value will always make code faster, but eventually incurs high cost in
5737
+ * increased code size.
5738
+ */
5739
+#define        MOVE_RATIO(SPD) 5
5740
+
5741
+/* TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(SZ,ALGN,OP,SPD) ...
5742
+ */
5743
+// #undef      TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)
5744
+// #define     TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)// needs hook
5745
+
5746
+/* CLEAR_RATIO(SPD) ... The threshold number of scalar move instructions, below
5747
+ * which a sequence of instructions should be generated to clear memory instead
5748
+ * of a string clear instruction or a library call.  Increasing the value will
5749
+ * always make the code faster, but eventually incurs high cost in increased
5750
+ * code size.
5751
+ */
5752
+#define        CLEAR_RATIO(SPD)        MOVE_RATIO(SPD)
5753
+
5754
+/* NO_FUNCTION_CSE ... Define this macro to be true if it is as good or better
5755
+ * to call a constant function address than to call an address kept in a
5756
+ * register.
5757
+ *
5758
+ * On the Zip CPU, constant function addresses--especially relative ones,
5759
+ * can be optimized into a single cycle delay.  Register jumps will always
5760
+ * stall the whole (5-stage) pipeline.
5761
+ */
5762
+#define        NO_FUNCTION_CSE
5763
+
5764 111 dgisselq
+/* TARGET_RTX_COSTS(X,CODE,OUTER,OPNO,TOTAL,SPD) ... This target hook describes
5765
+ * the relative costs of RTL expressions.
5766
+ *
5767
+ * The cost may depend on the precise form of the expression, which is avaialble
5768
+ * for examination in X, and the fact that X appears as operand OPNO of an
5769
+ * expression with rtx code OUTER.  That is, the hook can assume that there is
5770
+ * some RTX Y such that GET_CODE(Y)==OUTER and such that either (a) XEXP(Y,OPNO)
5771
+ * == X or (b) XVEC(Y,OPNO) contains X.
5772
+ *
5773
+ * ...
5774
+ * The hook returns true when all subexpressions of x have been processed and
5775
+ * false when rtx_cost should recurse.
5776 102 dgisselq
+ */
5777 111 dgisselq
+
5778 102 dgisselq
+/* TARGET_ADDRESS_COST(ADDR,MODE,AS, SPD) ... This hook computes the cost of an
5779
+ * addressing mode that contains ADDR.  If not defined, the cost is computed
5780
+ * from the ADDR expression and the TARGET_RTX_COST hook.  In cases where more
5781
+ * than one form of an address is known, the form with the lowest cost will be
5782
+ * used.  If multiple forms have the same, lowest, cost, the one that is the
5783
+ * most complex will be used.
5784
+ *
5785
+ * ZipCPU really has only one address cost, the only type of address it
5786
+ * supports.  Sure, index addressing would cost us more, but we don't support
5787
+ * that so ... I think we're okay defining this as a constant.  Indeed, the
5788
+ * docs state that, "On RISC amchines, all instructions normally have the same
5789
+ * length and execution time.  Hence all addresses will have equal costs."
5790
+ */
5791
+#undef TARGET_ADDRESS_COST
5792
+#define        TARGET_ADDRESS_COST     zip_address_cost
5793
+
5794
+
5795
+/* TARGET_NO_SPECULATION_IN_DELAY_SLOTS_P ... This predicate controls the use
5796
+ * of the eager delay slot filler to disallow speculatively executed
5797
+ * instructions being placed in delay slots.  Targets such as certain MIPS
5798
+ * architectures posess both branches with and without delay slots.  As the
5799
+ * eager delay slot filler can decrease performance, disabling it is beneficial
5800
+ * when ordinary branches are available.  Use of delay slot branches filled
5801
+ * using basic filler is often still desirable as the delay slot can hide a
5802
+ * pipeline bubble.
5803
+ */
5804
+// How should Zip CPU define this--we have no delay slots.
5805
+
5806
+
5807
+/* 17.17 Instruction Scheduler */
5808
+
5809
+#define        TARGET_SCHED_ISSUE_RATE zip_sched_issue_rate
5810
+
5811
+/* 17.18 Dividing the Output into Sections */
5812
+
5813
+/* Switch to the text or data segment. */
5814
+#define        TEXT_SECTION_ASM_OP     "\t.text"
5815
+#define        DATA_SECTION_ASM_OP     "\t.data"
5816
+
5817
+// #undef      TARGET_LIBGCC_SDATA_SECTION
5818
+// #define     TARGET_LIBGCC_SDATA_SECTION     ".sdata"
5819
+
5820
+
5821
+/* 17.19 Position Independent Code */
5822
+
5823
+#define        PIC_OFFSET_TABLE_REGNUM                 zip_GOT
5824
+#define        PIC_OFFSET_TABLE_REG_CALL_CLOBBERED     0
5825
+// #define LEGITIMATE_PIC_OPERAND_P(X) should evaluate to X(GOT) only
5826
+
5827
+/* 17.20 Defining the Output Assembler Language */
5828
+
5829
+/* 17.20.4 Output and Generation of Labels */
5830
+
5831
+/* ASM_OUTPUT_LABEL
5832
+ * ... A default definition of this macro is provided which is correct for
5833
+ * most systems.
5834
+ */
5835
+
5836
+/* ASM_OUTPUT_FUNCTION_LABEL
5837
+ * ... if not defined, then the function name is defined in the usual manner
5838
+ * as a label.
5839
+ */
5840
+
5841
+/* ASM_OUTPUT_INTERNAL_LABEL ... Identical to ASM_OUTPUT_LABEL, except that name
5842
+ * is known to refer to a compiler-generated label.  The default definition
5843
+ * uses assemble_name_raw, which is like assemble_name except that it is more
5844
+ * efficient.
5845
+ */
5846
+
5847
+/* SIZE_ASM_OP ... A C string containing the appropriate assembler directive
5848
+ * to specify the size of a symbol, without any arguments.  ON systems that
5849
+ * use ELF, the dfault is "\t.size\t"; on other systems, the default is not to
5850
+ * define this macro.
5851
+ *
5852
+ * Define this amcro only if it is correct to use the default definitions of
5853
+ * ASM_OUTPUT_SIZE_DERECTIVE and ASM_OUTPUT_MEASURED_SIZE for your system.
5854
+ * If you need your own custom definitions of those macros, or if you do not
5855
+ * need explicit symbol sizes at all, do not define this macro.
5856
+ */
5857
+
5858
+/* ASM_OUTPUT_SIZE_DIRECTIVE
5859
+ * ASM_OUTPUT_MEASURED_SIZE
5860
+ */
5861
+
5862
+/* NO_DOLLAR_IN_LABEL ... Define this macro if the assembler does not accept
5863
+ * the character '$' in label names.  By default constructors and destructors
5864
+ * in G++ have "$" in the identifiers.  If this label is defined, '.' is
5865
+ * used instead.
5866
+ */
5867
+
5868
+/* NO_DOT_IN_LABEL ... Define this macro if the assembler does not accept the
5869
+ * character '.' in label names.  By default constructors and destructors in
5870
+ * G++ have names that use '.'.  If this macro is defined, these names are
5871
+ * rewritten to avoid '.'.
5872
+ */
5873
+
5874
+/* TYPE_ASM_OP ... A C string containing the appropriate assembler directive to
5875
+ * specify the type of a symbol, without any arguments.  On systems that use
5876
+ * ELF the default in config/elfos.h is "\t.type\t"; on other systems, the default is not to define this macro.
5877
+ *
5878
+ * Define this macro only if it is correct to use the default definition of
5879
+ * ASM_OUTPUT_TYPE_DIRECTIVE forr your system.  If you need your own custom
5880
+ * definition of this macr, or if you do not need explicit symbol types at all,
5881
+ * do not define this macro.
5882
+ */
5883
+
5884
+/* TYPE OPERAND_FMD ... A
5885
+ */
5886
+
5887
+/* ASM_OUTPUT_TYPE_DIRECTIVE
5888
+ */
5889
+
5890
+/* ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) ...
5891
+ * if this macro is not defined, then the function name is defined in the usual
5892
+ * manner as a label (by means of ASM_OUTPUT_FUNCTION_LABEL).
5893
+ */
5894
+
5895
+/* ASM_DECLARE_FUNCTION_SIZE
5896
+ * ASM_DECLARE_COLD_FUNCTION_NAME
5897
+ * ASM_DECLARE_COLD_FUNCTION_SIZE
5898
+ * ASM_DECLARE_OBJECT_NAME
5899
+ * TARGET_ASM_DECLARE_CONSTANT_NAME
5900
+ */
5901
+/* ASM_DECLARE_REGISTER_GLOBAL(STREAM, DECL, REGNO, NAME) ... A C statement
5902
+ * (sans semicolon) to output to the stdio stream STREAM any text necessary for
5903
+ * claiming a register REGNO for a global variable DECL with name NAME.
5904
+ *
5905
+ * If you don't defin this macro, that is equivalent to dfining it to do
5906
+ * nothing.
5907
+ */
5908
+
5909
+/* ASM_FINISH_DECLARE_OBJECT
5910
+ * TARGET_ASM_GLOBALIZE_LABEL
5911
+ * TARGET_ASM_GLOBALIZE_DECL_NAME
5912
+ * TARGET_ASM_ASSEMBLE_UNDEFINED_DECL
5913
+ * ASM_WEAKEN_LABEL
5914
+ * ASM_WEAKEN_DECL
5915
+ * ASM_OUTPUT_WEAKREF
5916
+ * SUPPORTS_WEAK
5917
+ * TARGET_SUPPORTS_WEAK
5918
+ * MAKE_DECL_ONE_ONLY
5919
+ * SUPPORTS_ONE_ONLY
5920
+ * TARGTE_ASM_ASSEMBLE_VISIBILITY
5921
+ * TARGET_WEAK_NOT_IN_ARCHIVE_TOC
5922
+ * ASM_OUTPUT_EXTERNAL
5923
+ * TARGET_ASM_EXTERNAL_LIBCALL
5924
+ * TARGET_ASM_MARK_DECLPRESERVED
5925
+ * ASM_OUTPUT_LABELREF
5926
+ * TARGET_MANGLE_ASSEMBLER_NAME
5927
+ * ASM_OUTPUT_SYMBOL_REF
5928
+ * ASM_OUTPUT_LABEL_REF
5929
+ * TARGET_ASM_INTERNAL_LABEL
5930
+ * ASM_OUTPUT_DEBUG_LABEL
5931
+ * ASM_GENERATE_INTERNAL_LABEL
5932
+ * ASM_FORMAT_PRIVATE_NAME
5933
+ */
5934
+
5935
+/* ASM_OUTPUT_DEF ... A C statement to output to the stdio stream STREAM
5936
+ * assembler code which defines (equates) the symbol NAME to have the value
5937
+ * VALUE.
5938
+ *
5939
+ * ZipCPU---So many other things that we need depend upon this, that we need
5940
+ * to implement a non-default version.
5941
+ */
5942
+#define        ASM_OUTPUT_DEF  zip_asm_output_def
5943
+
5944
+/* ASM_OUTPUT_DEF_FROM_DECLS
5945
+ * TARGET_DEFERRED_OUTPUT_DEFS
5946
+ * ASM_OUTPUT_WEAK_ALIAS
5947
+ * OBJ_GEN_METHOD_LABEL
5948
+ */
5949
+
5950
+
5951
+/* 17.20.7 Output of Assembler Instructions */
5952
+
5953
+#define        REGISTER_NAMES { "R0","R1","R2","R3","R4","R5","R6","R7","R8","R9", \
5954
+       "R10","R11","R12","SP","CC","PC" }
5955
+
5956
+/* REGISTER_PREFIX     (Undefined by default)
5957
+ * LOCAL_LABEL_PREFIX  (Undefined by default)
5958
+ * USER_LABEL_PREFIX   defaults to "*"
5959
+ * IMMEDIATE_PREFIX    (Undefined by default)
5960
+ *
5961
+ * If defined, C string expressions to be used for the '%R', '%L', '%U', and
5962
+ * '%I' options of asm_fprintf (see 'final.c').  These are useful when a single
5963
+ * 'md' file must support multiple assembler formats.  In that case, the various
5964
+ * 'tm.h' files can define these macros differently.
5965
+ */
5966
+// #define     USER_LABEL_PREFIX       "*"
5967
+
5968
+/* Defining memory operand address formats is in this section. */
5969
+
5970
+/* 17.20.10 Assembler Commands for Alignment */
5971
+
5972
+/* JUMP_ALIGN(label) ... The alignment (log base 2) to put in front of label,
5973
+ * which is a common destination of jumps and has no fallthru incoming
5974
+ * edge.  This macro need not be defined if you don't want any special alignment
5975
+ * to be done at such a time.  Most machine descriptions do not currently define
5976
+ * this macro.
5977
+ *
5978
+ * ZipCPU---The assembler should automatically deal with label alignment, so
5979
+ * let's not do anything about it here.
5980
+ */
5981
+
5982
+/* TARGET_ASM_JUMP_ALIGN_MAX_SKIP
5983
+ */
5984
+
5985
+/* LABEL_ALIGN_AFTER_BARRIER
5986
+ * TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
5987
+ */
5988
+
5989
+/* LOOP_ALIGN(label)
5990
+ * TARGET_ASM_LOOP_ALIGN_MAX_SKIP
5991
+ * LABEL_ALIGN
5992
+ * TARGET_ASM_LABEL_ALIGN_MAX_SKIP
5993
+ */
5994
+
5995
+/* ASM_OUTPUT_SKIP(STREAM, NBYTES) A C statement to output to the stdio
5996
+ * stream an assembler instruction to advance the location counter by nbytes
5997
+ * bytes.
5998
+ */
5999
+
6000
+/* TARGET_ASM_LABEL_ALIGN */
6001
+/* Assembler Commands for Alignment */
6002
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
6003
+               { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
6004
+
6005
+
6006
+
6007
+/* 17.21 Controlling Debugging Information Format */
6008
+/* 17.22 Cross Compilation and Floating Point */
6009 111 dgisselq
+
6010
+// REAL_VALUE_TYPE
6011
+// REAL_VALUES_EQUAL
6012
+// REAL_VALUES_LESS ... Tess whether x is less than y
6013
+/* REAL_VALUE_FIX ... Truncates x to an unsigned integer, rouding toward zero.
6014
+ * If x is negative, returns zero.
6015
+ */
6016
+// REAL_VALUE_ATOF
6017
+// REAL_VALUE_NEGATIVE
6018
+// REAL_VALUE_ISINF
6019
+// REAL_VALUE_ISNAN
6020
+/* REAL_ARITHMETIC(OUT,CODE,X,Y) ... (Macro) Calculates an arithmetic operation
6021
+ * on two floating point values X and Y, storing the result in OUT (which must
6022
+ * be a variable).
6023
+ *
6024
+ * The operation to be performed is specified by CODE.  Only the following
6025
+ * codes are supported: PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, MAX_EXPR,
6026
+ * MIN_EXPR.
6027
+ *
6028
+ * If REAL_ARITHMETIC is asked to evaluate division by zero and the target's
6029
+ * floating point format cannot represent infinity, it will call abort().
6030
+ * Callers shoudl check for this situation first, using MODE_HAS_INFINITIES.
6031
+ */
6032
+/* REAL_VALUE_NEGATE(X) ... [Macro] Returns the negative of the floating point
6033
+ * value X.
6034
+ */
6035
+/* REAL_VALUE_ABS(X) ... [Macro] Returns the absolute value of X.
6036
+ */
6037 102 dgisselq
+/* 17.23 Mode switching instructions */
6038
+/* 17.24 Defining target-specific uses of __attribute__ */
6039
+#undef TARGET_OPTION_OVERRIDE
6040
+#define        TARGET_OPTION_OVERRIDE  zip_override_options
6041
+
6042
+/* 17.25 Emulating TLS */
6043
+/* 17.26 Defining coprocessor specifics for MIPS targets*/
6044
+
6045
+ // ZipCPU isn't MIPS.
6046
+
6047
+/* 17.27 Parameters for Precompiled Header Validity Checking */
6048
+/* 17.28 C++ ABI parameters */
6049
+/* 17.29 Adding support for named address spaces */
6050
+/* 17.30 Miscellaneous Parameters */
6051
+
6052
+/* HAS_LONG_COND_BRANCH ... Define this boolean macro to indicate whether or
6053
+ * not your architecture has conditional branches that can span all of memory.
6054
+ * It is used in conjunction with an optimization that partitions hot and
6055
+ * cold basic blocks into separate sections of the executable.  If this macro
6056
+ * is set to false, gcc will convert any conditional branches that attempt to
6057
+ * cross between sections into unconditional branches or indirect jumps.
6058
+ *
6059
+ * ZipCPU --- The assembler renders long unconditional branch code without
6060
+ * problems, so we can pretend that such long branches exist.
6061
+ */
6062
+#define        HAS_LONG_COND_BRANCH true
6063
+
6064
+/* HAS_LONG_UNCOND_BRANCH ... Define this boolean macro to indicate whether
6065
+ * or not your architecture has unconditional branches that can span all of
6066
+ * memory.  (ZipCPU does ... via the LOD (PC),PC instruction.)  It is used in
6067
+ * conjunction with an optimization that partitions hot and cold basic blocks
6068
+ * into separate sections of the executable.  If this macro is set to false,
6069
+ * gcc will convert any unconditional branches that attempt to cross between
6070
+ * sections into indirect jumps.
6071
+ *
6072
+ * ZipCPU has the LOD (PC),PC instruction which can be used to implement a long
6073
+ * jump.
6074
+ */
6075
+#define        HAS_LONG_UNCOND_BRANCH  true
6076
+
6077
+/* CASE_VECTOR_MODE ... An alias for a machine mode name.  This is the machine
6078
+ * mode that eleemnts of a jump-table should have.
6079
+ *
6080
+ */
6081
+#define        CASE_VECTOR_MODE        SImode
6082
+
6083
+/* CASE_VECTOR_SHORTEN_MODE(MIN,MAX,BODY) ... Optional: return the preferred
6084
+ * mode for an addr_diff_vec when the minimum and maximum offset are known.
6085
+ * If you define this, it enables extra code in branch shortening to deal with
6086
+ * addr_diff_vec.  To make this work, you also have to define INSN_ALIGN and
6087
+ * make the alignment for addr_diff_vec explicit.  The body argument is provided so that the offset_unsigned and scale flags can be updated.
6088
+ *
6089
+ * ZipCPU---No advantage here.
6090
+ */
6091
+
6092
+/* CASE_VECTOR_PC_RELATIVE ... Define this exrpession to indicate when
6093
+ * jump-tables should contain relative addresses.  You need not define this
6094
+ * macro if jump-tables never contain relative addresses, or jump-tables
6095
+ * should contain relative addresses only when -fPIC or -FPIC is in effect.
6096
+ *
6097
+ * ZipCPU---No advantage in PC-Relative jump tables--except in PIC relative
6098
+ * code.
6099
+ */
6100
+
6101
+/* TARGET_CASE_VALUES_THRESHOLD(VOID) ... This function returns the smallest
6102
+ * number of different values for which it is best to use a jump-table instead
6103
+ * of a tree of conditional branches.  The default is four for machines with a
6104
+ * casesi instruction and five otherwise.  This is best for most machines.
6105
+ *
6106
+ * ZipCPU---Leave at the default.
6107
+ */
6108
+
6109
+/* WORD_REGISTER_OPERATIONS ... Define this macro to 1 if operations between
6110
+ * registers with integral mode smaller than a word are always performed on the
6111
+ * entire register.  Most RISC machines have this property and most CISC
6112
+ * machines do not.
6113
+ *
6114
+ * ZipCPU---We have the property, 'cause we're fairly risk.
6115
+ */
6116
+#undef WORD_REGISTER_OPERATIONS
6117
+#define        WORD_REGISTER_OPERATIONS        1
6118
+
6119
+/* LOAD_EXTEND_OP(MEMODE) ... Define this macro to be a C expression indicating
6120
+ * when insns that read memory in MEMMODE, an integral mode narrower than a
6121
+ * word, set the bits outside of MEMMODE to be either the sign extension or
6122
+ * zero-extension of the data read.  Return SIGN_EXTEND for values of MEMMODE
6123
+ * for which the insn sign-extends, ZERO_EXTEND for which it zero-extends, and
6124
+ * UNKNOWN for other modes.
6125
+ *
6126
+ * Do not define this macro if it would always return UNKNOWN.
6127
+ *
6128
+ * ZipCPU---This should be irrelevant, so we leave it undefined.
6129
+ */
6130
+#undef LOAD_EXTEND_OP
6131
+#define        LOAD_EXTEND_OP(MEM)     SIGN_EXTEND
6132
+
6133
+/* SHORT_IMMEDIATES_SIGN_EXTEND ... Define this macro to 1 if loading short immediate values into registers sign extends.
6134
+ *
6135
+ * ZipCPU---All immediates are sign extended, so yes.
6136
+ */
6137
+#undef SHORT_IMMEDIATES_SIGN_EXTEND
6138
+#define        SHORT_IMMEDIATES_SIGN_EXTEND    1
6139
+
6140
+/* TARGET_MIN_DIVISIONS_FOR_RECIP_MUL
6141
+ */
6142
+
6143
+/* MOVE_MAX ... The maximum number of bytes that a single instruction can move
6144
+ * quickly between memory and registers or between two memory locations.
6145
+ *
6146
+ * ZipCPU --- Although we can move 32-bits at a time, and most people would call
6147
+ * this 4-bytes, the compiler defines a byte as the minimum addressable unit.
6148
+ * Therefore, this is defined to be one.
6149
+ */
6150
+#define        MOVE_MAX        1
6151
+
6152
+/* MAX_MOVE_MAX ... The maximum number of bytes that a single instruction can
6153
+ * move quickly between memory and registers or between two memory ...
6154
+ *
6155
+ * ZipCPU --- this sounds just the same as MOVE_MAX, which is the default
6156
+ * definition of this.
6157
+ */
6158
+
6159
+/* SHIFT_COUNT_TRUNCATED ... A C expression that is nonzero if on this machine
6160
+ * the number of bits actually used for the count of a shift operation is equal
6161
+ * to the number of bits needed to represent the size of the object being
6162
+ * shifted.
6163
+ *
6164
+ * You need not define this macro if it would have the value of zero.
6165
+ *
6166
+ * ZipCPU---A shift of 33 (or more) in either direction will wipe out the
6167
+ * value in the register, therefore this value should be zero, the default.
6168
+ */
6169
+
6170
+/* TARGET_SHIFT_TRUNCATION_MASK(MODE) ... This function describes how the
6171
+ * standard shift patterns for MODE deal with shifts by negative amounts or by
6172
+ * more than the width of the mode.
6173
+ *
6174
+ * ZipCPU---The default is zero, since we didn't define SHIFT_COUNT_TRUNCATED.
6175
+ * This is the case for the ZipCPU as well.
6176
+ */
6177
+
6178
+/* TRULY_NOOP_TRUNCATION(OUTPREC,INPREC) ... A C expression which is nonzero
6179
+ * if on this machine it is safe to "convert" an integer of INPREC bits to one
6180
+ * of OUTPREC bits (where OUTPREC is smaller than INPREC) by merely operating on
6181
+ * it as if it had OUTPREC bist.  On many machines, this expression can be 1.
6182
+ *
6183
+ * ZiPCPU ... If both values are 32-bit, what conversion takes place?  If one is
6184
+ * 64-bit and the other 32-bit ... I suppose it would then be safe.
6185
+ */
6186
+#undef TRULY_NOOP_TRUNCATION
6187
+#define TRULY_NOOP_TRUNCATION(O,I)     1
6188
+
6189
+/* TARGET_MODE_REP_EXTENDED(MODE,REPMODE) ... The representation of an integral
6190
+ * mode can be such that the values are always extended to a wider integral
6191
+ * mode.  Return SIGN_EXTEND if values of MODE are represented in sign-extended
6192
+ * form to REPMODE.  Return UNKNOWN otherwise.  (Currently none of the targets
6193
+ * use zero-extended.
6194
+ *
6195
+ */
6196
+// #undef      TARGET_MODE_REP_EXTENDED
6197
+// #define     TARGET_MODE_REP_EXTENDED(R,M)   SIGN_EXTEND
6198
+
6199
+/* STORE_FLAG_VALUE ... A C expression describing the value returned by a
6200
+ * comparison operator with an integral mode and stored by a store-flag
6201
+ * instruction (cstoremode4) when the condition is true.  This description
6202
+ * must apply to all the cstoremode4 patterns and all the comparison operators
6203
+ * whose results have MODE_INT mode.
6204
+ *
6205
+ * ZipCPU---Doesn't really have a STORE_FLAG_VALUE instruction ...
6206
+ */
6207
+
6208
+/* FLOAT_STORE_FLAG_VALUE
6209
+ *
6210
+ * ZipCPU
6211
+ */
6212
+
6213
+/* VECTOR_STORE_FLAG_VALUE ... define this macro on machines that have vector
6214
+ * comparison operations that return a vector result ...
6215
+ *
6216
+ * ZipCPU---Doesn't support vector operations.
6217
+ */
6218
+
6219
+/* CLZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
6220
+ * CTZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
6221
+ *
6222
+ * A C expression that indicates whetther the architecture defines a value for
6223
+ * clz or ctz with a zero operand.  A result of 0 indicates the value is
6224
+ * 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
6225
+ * entry, then the macro should evaluate to 2.  In cases where the value is
6226
+ * defined, value should be set to this value.
6227
+ * If this macro is not defined, the value of clz or ctz at zero is assumed to
6228
+ * be undefined.
6229
+ *
6230
+ * ZipCPU---Has neither clz nor ctz instructions, so we don't need this.
6231
+ */
6232
+
6233
+/* Pmode ... An alias for the machine mode for pointers.  On most machines,
6234
+ * define this to be the integer mode corresponding to the width of a
6235
+ * hardware pointer.  SImode on 32-bits machines, or DImode on 64-bit machines.
6236
+ * On some machines you must define this to be one of the partial
6237
+ * integer modes, such as PSImode.
6238
+ */
6239
+#undef Pmode
6240
+#define        Pmode   SImode
6241
+
6242
+/* FUNCTION_MODE ... An alais for the machine mode used for memory references to
6243
+ * function being called, in call RTL expressions.  On most CISC machines, where
6244
+ * an instruction can begin at any byte address, this should be QImode.  On most
6245
+ * RISC machines, where all instructions have fixed size and alignment, this
6246
+ * should be a mode with the same size and alignment as the machine instruction
6247
+ * words--typically SImode or HImode.
6248
+ *
6249
+ * ZipCPU---Definitely SImode, as with Pmode.  (All words are 32-bits, including
6250
+ * addresses on the ZipCPU.
6251
+ */
6252
+#undef FUNCTION_MODE
6253
+#define        FUNCTION_MODE   SImode
6254
+
6255
+/* STDC_0_IN_SYSTEM_HEADERS
6256
+ */
6257
+
6258
+/* TARGET_C_PREINCLUDE(V) ... Define this hook to return the name of  a header
6259
+ * file to be included at the start of all compilations, as if it had been
6260
+ * included with #include <file>.  If this hook returns NULL, or is not defined,
6261
+ * or if the header is not found, or if the user specifies -ffreestanding or
6262
+ * -nostdinc, no header is included.
6263
+ *
6264
+ * ZipCPU --- We don't have a standard library defined yet, so we'll leave this
6265
+ * as NULL.
6266
+ */
6267
+#undef TARGET_C_PREINCLUDE
6268
+#define        TARGET_C_PREINCLUDE     NULL
6269
+
6270
+/* TARGET_CXX_IMPLICIT_EXTERN_C(CONST CHAR *) ... Define this hook to add target
6271
+ * specific C++ implicit extern C functions.  If this function returns true
6272
+ * for the name of a file-scope function, that function implicitly gets extern
6273
+ * "C" linkage rather than whatever linkage the declaration would normally have.
6274
+ * An example of such function is WinMain on Win32 targets.
6275
+ *
6276
+ * ZipCPU---Not ready to deal with this yet.
6277
+ */
6278
+
6279
+/* NO_IMPLICIT_EXTERN_C ... Define this macro if the system header files
6280
+ * support C++ as well as C.  This macro inhibits the usual method of using
6281
+ * system header files in C++, which is to pretend that the file's contents
6282
+ * are enclosed in 'extern "C" {...}'.
6283
+ *
6284
+ *
6285
+ * ZipCPU --- Don't have either C or C++ headers, so let's skip this for now.
6286
+ * Eventually, though, I think ZipCPU and C++ would go very well together.
6287
+ */
6288
+
6289
+/* REGISTER_TARGET_PRAGMAS ... Define this macro if you want to implement any
6290
+ * target specific pragmas.
6291
+ *
6292
+ * ZipCPU --- let's not.
6293
+ */
6294
+
6295
+/* HANDLE_PRAGMA_PACK_WITH_EXPANSION ... Define this macro if macros should be
6296
+ * expanded in the arguments of #pragma pack().
6297
+ *
6298
+ * ZipCPU ... why?
6299
+ */
6300
+
6301
+/* TARGET_DEFAULT_PACK_STRUCT ... If your target requires a struct packing
6302
+ * default other than 0 (meaning the machine default), define this macro to
6303
+ * the necessary value (in bytes).  This must be a value that would also be
6304
+ * valid to use with #pragma pack() (that is a small power of two.
6305
+ */
6306
+
6307
+/* DOLLARS_IN_IDENTIFIERS
6308
+ * ZipCPU --- Default (not changing C)
6309
+ */
6310
+
6311
+/* INSN_SETS_ARE_DELAYED(INSN) ... Define this macro as a C expression that
6312
+ * is nonzero if it is safe for the delay slot schedule to place instructions
6313
+ * in the delay slot of INSN, even if they appear to use a resource set or
6314
+ * clobbered in INSN.  INSN is always a ...
6315
+ *
6316
+ * ZipCPU --- You need not define this macro if it would always return zero.
6317
+ */
6318
+
6319
+/* INSN_REFERENCES_ARE_DELAYED(INSN) ... Define this macro as a C expression
6320
+ * that is nonzero if it is safe for the delay slot schedule to place
6321
+ * instructions in the delay slot of INSN, even if they appear to set or clobber
6322
+ * a resource referenced in INSN.  INSN is always a jump_insn or an insn.  On
6323
+ * machines where some insn or jump_insn is really a function call and ...
6324
+ *
6325
+ * ZipCPU --- You need not define this macro if it would always return zero.
6326
+ */
6327
+
6328
+/* MULTIPLE_SYMBOL_SPACES ... Define this macro as a C expression that is
6329
+ * nonzero if, in some cases, global symbols from one translation unit may not
6330
+ * be bound to undefined symbols in another translation unit without user
6331
+ * intervention.  For instance, under Microsoft Windows symbols must be
6332
+ * explicitly imported from shared libraries (DLLs).
6333
+ *
6334
+ * ZipCPU---You need not define this macro if it would always evaluate to zero,
6335
+ * so we won't.
6336
+ */
6337
+
6338
+/* TARGET_MD_ASM_ADJUST
6339
+ */
6340
+/* MATH_LIBRARY ... Define this macro as a C constant ... you only need to
6341
+ * define this macro if the default of "m" is wrong.
6342
+ *
6343
+ * ZipCPU --- as we don't have a math library yet, building one such that "m"
6344
+ * works doesn't sound like a problem.  Let's not define this.
6345
+ */
6346
+
6347
+/* LIBRARY_PATH_ENV ... Define this as a C string constant for the environment
6348
+ * variable that specifies where the linker should look for libraries.
6349
+ *
6350
+ * Just in case we want to add libraries for ZipCPU, let's place them in
6351
+ * /usr/local/zip/lib, so as not to confuse them with our local systems
6352
+ * libraries.
6353
+ */
6354
+#define        LIBRARY_PATH_ENV        "/usr/local/zip/lib"
6355
+
6356
+/* TARGET_POSIX_IO ... Define this macro if the target supports the following
6357
+ * POSIX file fucntions: access, mkdir, and file locking with fcntl/F_SETLKW.
6358
+ *
6359
+ * ZipCPU does not.
6360
+ */
6361
+
6362
+/* MAX_CONDITIONAL_EXECUTE ... A C expression for the maximum number of
6363
+ * instructions to execute via conditional execution instructions instead of a
6364
+ * branch.  A value of BRANCH_COST+1 is the default if the machine does not use
6365
+ * cc0 and 1 if it does use cc0.
6366
+ *
6367
+ * ZipCPU---This sounds good enough for the ZipCPU as well--as long as we have
6368
+ * BRANCH_COST defined.  However, BRANCH_COST is defined as conditionally to
6369
+ * something else, so let's keep looking into this.
6370
+ */
6371
+
6372
+/* IFCVT_MODIFY_TESTS(CEINFO,TRUE,FALSE) ... Used if the target needs to
6373 103 dgisselq
+ * perform machine-dependent modifications on the conditionals used for turning
6374 102 dgisselq
+ * basic blocks into conditionally executed code.  CEINFO points to a data
6375
+ * structure, struct ce_if_block, which contains information about the currently
6376
+ * processed blocks.  TRUE and FALSE are the tests that are used for
6377
+ * converting the then-block and the else-block, respectively.  Set either TRUE
6378
+ * or FALSE to a null pointer if the tests cannot be converted.
6379
+ *
6380
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6381
+ * execution and conditional testing capabilities.
6382
+ */
6383
+// #warning "Need to come back to this."
6384
+
6385
+/* IFCVT_MODIFY_MULTIPLE_TESTS(CEINFO, BB, TRUE, FALSE) ... Like
6386
+ * IFCVT_MODIFY_TESTS, but used when converting more complicated if-statements
6387
+ * into conditions combined by and and or operations.  BB contains the basic
6388
+ * block that contains the test that is currently being processed and about to
6389
+ * be turned into a condition.
6390
+ *
6391
+ *
6392
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6393
+ * execution and conditional testing capabilities.
6394
+ */
6395
+// #warning "Need to come back to this."
6396
+
6397
+
6398
+/* IFCVT_MODIFY_INSN(CEINFO, PATTERN, INSN) ... A C expression to modify the
6399
+ * PATTERN of an INSN that is to be converted to conditional execution format.
6400
+ * CEINFO points to a data structure, struct ce_if_block, which contains
6401
+ * information about the currently processed blocks.
6402
+ *
6403
+ *
6404
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6405
+ * execution and conditional testing capabilities.
6406
+ */
6407
+// #warning "Need to come back to this."
6408
+
6409
+
6410
+/* IFCVT_MODIFY_FINAL(CEINFO) ... A C expression to perform any final
6411
+ * machine dependent modifications in converting code to conditional
6412
+ * execution.  The involved basic blocks can be found in struct ce_if_block
6413
+ * structure pointed to be CEINFO.
6414
+ *
6415
+ *
6416
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6417
+ * execution and conditional testing capabilities.
6418
+ */
6419
+// #warning "Need to come back to this."
6420
+
6421
+
6422
+/* IFCVT_MODIFY_CANCEL(CEINFO) ... A C expression to cancel any machine
6423
+ * dependent modifications in converting code to conditional execution.  The
6424
+ * involved basic blocks can be found in the struct ce_if_block structure that
6425
+ * is pointed to by CEINFO.
6426
+ *
6427
+ *
6428
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6429
+ * execution and conditional testing capabilities.
6430
+ */
6431
+// #warning "Need to come back to this."
6432
+
6433
+
6434
+/* IFCVT_MACHDEP_INIT(CEINFO) ... A C expression to initialize any machine
6435
+ * specific data for if-conversion of the if-block in the CEINFO block structure
6436
+ * that is pointed by CEINFO.
6437
+ *
6438
+ *
6439
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6440
+ * execution and conditional testing capabilities.
6441
+ */
6442
+// #warning "Need to come back to this."
6443
+
6444
+
6445
+/* TARGET_MACHINE_DEPENDENT_REORG(VOID) ... If non-null, this hook performs a
6446
+ * target specific pass over the instruction stream.  The compiler will run it
6447
+ * at all optimization levels, just before the point at which it normally does
6448
+ * delayed branch scheduling.
6449
+ *
6450
+ * You need not implement the hook if it has nothing to do.
6451
+ *
6452
+ * ZipCPU---This may be part of a later upgrade, but shouldn't be needed to
6453
+ * just get us started.
6454
+ */
6455
+
6456
+
6457
+/* TARGET_INIT_BUILTINS(VOID) ... Define this hook if you ahve any machine
6458
+ * specific builtin functions that need to be defined.  It should be a function
6459
+ * that performs the necessary setup.  Machine specific builtin functions can be
6460
+ * useful to expand special machine instructions that would otherwise not
6461
+ * normally be generated because they have no equivalent in the source language.
6462
+ *
6463
+ * To create a built in function, call the function lang_hooks.builtin_function
6464
+ * which is defined by the language front end.  You can use any type nodes
6465
+ * set up by build_common_tree_nodes; only language front ends that use those
6466
+ * two functions will call "TARGET_INIT_BUILTINS".
6467
+ *
6468
+ * ZipCPU---We need to come back to this.  We should have several built-ins
6469
+ * defined: rtu(), wait(), halt(), save_context(cstackregno), and
6470
+ * restore_context(cstackregno).
6471
+ *
6472
+ */
6473
+#undef TARGET_INIT_BUILTINS
6474
+#define        TARGET_INIT_BUILTINS    zip_init_builtins
6475
+
6476
+/* TARGET_BUILTIN_DECL(CODE,INITP) ... Define this hook if you have any
6477
+ * machine specific builtin functions that need to be defined.  It should be a
6478
+ * function that returns the builtin function declaration for the builtin
6479
+ * function code code.  If there is no such builtin and it cannot be initialized
6480
+ * at this time if INITP is true the function should return NULL_TREE.  If
6481
+ * CODE is out of range the fucntion should return error-mark_node.
6482
+ *
6483
+ * ZipCPU ... needs to be done, don't know how to do it yet.
6484
+ */
6485
+#undef TARGET_BUILTIN_DECL
6486
+#define        TARGET_BUILTIN_DECL     zip_builtin_decl
6487
+
6488
+
6489
+/* TARGET_EXPAND_BUILTIN(TREE,TGT,SUB,MODE,IGNORE) ... Expand a call to a
6490
+ * machine specific built-in function that was set up by TARGET_INIT_BUILTINS.
6491
+ * TREE is the expression for the function call; the result should go to
6492
+ * TGT if that is convenient, and have mode MODE if that is convenient.  SUB
6493
+ * may be used as the target for computing one of EXP's operands.  IGNORE is
6494
+ * non-zero if the value is to be ignored.  This function should return the
6495
+ * result of the call to the built-in function.
6496
+ *
6497
+ * ZipCPU ... needs to do it, just to get our special intrinsic functions
6498
+ */
6499
+#define        TARGET_EXPAND_BUILTIN   zip_expand_builtin
6500
+
6501
+
6502
+/* TARGET_BUILTIN_CHKP_FUNCTION(FCODE) ... Allows the target to redefine
6503
+ * builtin functions used by Pointer Bounds Checker for code instrumentation.
6504
+ *
6505
+ * ZipCPU --- not interested.
6506
+ */
6507
+/* TARGET_CHKP_BOUND_TYPE
6508
+ * TARGET_CHKP_MAKE_BOUNDS_CONSTANT
6509
+ * TARGET_CHKP_INITIALIZE_BOUNDS
6510
+ *
6511
+ * ZipCPU --- Same as last one.
6512
+ */
6513
+
6514
+
6515
+/* TARGET_RESOLVE_OVERLOADED_BUILTIN(LOC, FN, ARGS) ... Select a replacement
6516
+ * for a machine specific built-in function that was set up by
6517
+ * TARGET_INIT_BUILTINS.
6518
+ *
6519
+ * ZipCPU --- If I go to the trouble to create a builtin, why would I want
6520
+ * to then overload it?
6521
+ */
6522
+
6523
+/* TARGET_FOLD_BUILTIN(FN,NARGS,ARGP,IGNORE) ... Fold a call to a machine
6524
+ * specific built-in function that was set up by 'TARGET_INIT_BUILTINS'  FN
6525
+ * is the declaration of the built-in function.  NARGS is the number of
6526
+ * arguments passed to the function; the arguments themselves are pointed to by
6527
+ * ARGP.  The result is another tree, valid for both GIMPLE and GENERIC,
6528
+ * containing as simplified expression for the call's result.  If IGNORE is
6529
+ * true the value will be ignored.
6530
+ *
6531
+ * ZipCPU --- You know, this and the previous couple sound like something
6532
+ * whereby I might be able replace bit-reversal code with my bit reverse
6533
+ * instruction.  That would be very useful, but not necessary to get me
6534
+ * started.
6535
+ */
6536
+
6537
+/* TARGET_GIMPLE_FOLD_BUILTIN
6538
+ * TARGET_COMPARE_VERSION_PRIORITY
6539
+ * TARGET_GET_FUNCTION_VERSIONS_DISPATCHER
6540
+ * TARGET_GENERATE_VERSION_DISPATCHER_BODY
6541
+ * TARGET_CAN_USE_DOLOOP_P
6542
+ * TARGET_INVALID_WITHIN_DOOLOOP
6543
+ * TARGET_LEGITIMATE_COMBINED_INSN
6544
+ * TARGET_CAN_FOLLOW_JUMP
6545
+ * TARGET_COMMUTATIVE_P
6546
+ */
6547
+
6548
+/* TARGET_ALLOCATE_INITIAL_VALUE(REGNO)  ... When the initial value of a hard
6549
+ * register has been copied in a pseudo register, it is often not necessary
6550
+ * ...
6551
+ */
6552
+/* TARGET_UNSPEC_MAY_TRAP_P(RTX,FLAGS)  ... This target hook returns nonzero in
6553
+ * RTX, un unspec or unspec_volatile operation, might cause a trap.  Targets
6554
+ * can use this hook to enhance precision of analysis for unspec and
6555
+ * unspec_volatile operations.  You may call may_trap_p_1 to analyze inner
6556
+ * elements of RTX in which case flags should be passed along.
6557
+ */
6558
+
6559
+/* TARGET_SET_CURRENT_FUNCTION(TREE)  The compiler invokes this hook whenever
6560
+ * it changes its current function context (CFUN).  You can define this
6561
+ * function if the back end needs to perform any initialization or reset
6562
+ * actions on a per-function basis.  For example, it may be used to implement
6563
+ * function attributes that affect register usage or code generation patterns.
6564
+ */
6565
+
6566
+/* TARGET_OBJECT_SUFFIX ... Define this macro to be a C string representing the
6567
+ * suffix for object files on your target machine.  If you do not define this
6568
+ * macro, GCC will use ".o" as the suffix for object files.
6569
+ */
6570
+#define        TARGET_OBJECT_SUFFIX    ".o"
6571
+
6572
+/* TARGET_EXECUTABLE_SUFFIX
6573
+ */
6574
+#define        TARGET_EXECUTABLE_SUFFIX        ""
6575
+
6576
+/* COLLECT_EXPORT_LIST ... If defined, collect2 will scan the individual object
6577
+ * files specified on its command line and create an export list for the linker.
6578
+ * Define this macro for systems like AIX, where the linker discards object
6579
+ * files that are not referenced from main and uses export lists.
6580
+ *
6581
+ * ZipCPU --- shoudln't need this.
6582
+ */
6583
+
6584
+/* MODIFY_JNI_METHOD_CALL(MDECL)  ... Define this macro to a C expression
6585
+ * representing a variant of the method call mdecl, if Java Native Interface
6586
+ * (JNI) methods must be invoked differently from other methods on your
6587
+ * target.  For example, on 32-bit MSWindows, JNI methods must be invoked
6588
+ * using the stdcall calling convention and this macro is then ...
6589
+ *
6590
+ * ZipCPU----Don't need this.  (yet)
6591
+ */
6592
+
6593
+
6594
+/* TARGET_CANNOT_MODIFY_JUMPS_P ... This target hook returns true past the
6595
+ * point in which a new jump instructions could be created.  On machines that
6596
+ * require a register for every jump such as the SHmedia ISA of SH5, this point
6597
+ * would typically be reload, so thiss target hook should be defined to a
6598
+ * function such as:
6599
+ *
6600
+ * ZipCPU --- I don't get what this is for.
6601
+ */
6602
+
6603
+/* TARGET_BRANCH_TARGET_REGISTER_CLASS ... This target hook returns a register
6604
+ * class for which branch target register optimizations should be applied.  All
6605
+ * registers in this class should be usable interchangably.  After reload,
6606
+ * registers in this class will be re-allocated and loads will be hoisted out of
6607
+ * loops and be subjected to inter-block scheduling.
6608
+ *
6609
+ * ZipCPU---GENERAL_REGS, but this should be a default already ...
6610
+ */
6611
+
6612
+
6613
+/* TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED ...  Branch target register
6614
+ * optimization will by default exclude callee-saved registers that are not
6615
+ * already live during the current function.  If this target hook returns true,
6616
+ * they will be included.  The target code must then make sure that all target
6617
+ * registers in the class returned by TARGET_BRANCH_REGISTER_CLASS that might
6618
+ * be saved are saaved.
6619
+ *
6620
+ * ZipCPU---
6621
+ */
6622
+
6623
+
6624
+/* TARGET_HAVE_CONDITIONAL_EXECUTION(VOID) ... This target hook returns true
6625
+ * if the target supports conditional execution.  This target hook is required
6626
+ * only when the target has several different modes and they have different
6627
+ * conditional execution capability, such as ARM.
6628
+ *
6629
+ * ZipCPU---Yes!  All instructions may be conditionally executed (except the
6630
+ * long version load immediate ...)
6631
+ */
6632
+#define        TARGET_HAVE_CONDITIONAL_EXECUTION       hook_bool_void_true
6633
+
6634
+/* TARGET_GEN_CCMP_FIRST(PREP,GEN,CODE,OP0,OP1) .. This function prepares to
6635
+ * emit a comparison instruction for the first compare in a sequence of
6636
+ * conditional comparisons.  It returns an appropriate comparison with CC for
6637
+ * passing to gen_ccmp_next or cbranch_optab.  The instructions to prepare the
6638
+ * compare are saved in prep_seq and the compare instructions are saved in
6639
+ * gen_seq.  They will be emitted when all the compares in the conditional
6640
+ * comparison are generated without error.  CODE is the rtx_code of the compare
6641
+ * for op0 and op1.
6642
+ *
6643
+ *
6644
+ * ZipCPU---???
6645
+ */
6646
+
6647
+/* TARGET_GEN_CCMP_NEXT(PREP,GEN,PREV,CMP,OP0,OP1,BITCODE) ... This function
6648
+ * prepares to emit a conditional comparison within a sequence of conditional
6649
+ * comparisons.  It returns an appropriate comparison with CC for passing to
6650
+ * gen_ccmp_next or cbranch_optab.  The insn to prepare the compare are saved
6651
+ * in prep_seq and the compare instructions are saved in gen_seq.  They will be
6652
+ * emitted when all the compares in the conditional comparison are generated
6653
+ * without error.  The pPREV expression is the result of a prior call to either
6654
+ * gen_ccmp_first or gen_ccmp_next.  It may return NULL if the combination of
6655
+ * PREV and this comparison is not supported, otherwise the result must be the
6656
+ * appropriate for passing to gen_ccmp_next or cbranch_optab.  CODE is the RTX
6657
+ * code of the compare for op0 and op1.  BITCODE is AND or IOR, which is the op
6658
+ * on the compares.
6659
+ *
6660
+ *
6661
+ * ZipCPU --- ???
6662
+ */
6663
+
6664
+/* TARGET_LOOP_UNROLL_ADJUST(NUNROLL, LOOP) ... This target hook returns a new
6665
+ * value for the number of times loop should be unrolled.  The parameter NUNROLL
6666
+ * is the number of times the loop is to be unrolled.  The parameter loop is a
6667
+ * pointer to the loop, which is going to be checked for unrolling.  The target
6668
+ * hook is required only when the target has special constraints like maximum number of memory accesses.
6669
+ *
6670
+ *
6671
+ * ZipCPU -- ???
6672
+ */
6673
+
6674
+
6675
+/* POWI_MAX_MULTS ... If defined, this macro is interpreted as a signed integer
6676
+ * C expression that specifies the maximum number of floating point
6677
+ * multiplications that should be emitted when expanding exponentiation by an
6678
+ * integer constant inline.  When this value is defined, exponentiation
6679
+ * requiring more than this number of multiplications is implemented by calling
6680
+ * the system library's pow, powf, or powl routines.  The default value
6681
+ places no upper bound on the multiplication count.
6682
+ *
6683
+ * ZipCPU---As we have no system library pow() routine (yet) ... we're not
6684
+ * ready for this macro.
6685
+ */
6686
+
6687
+
6688
+/* TARGET_EXTRA_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6689
+ * register any extra include files for the target.  The parameter stdinc
6690
+ * indicates if normal include files are present.  The parameter SYSROOT is the
6691
+ * system root directory.  The parameter PFX is the prefix for the GCC
6692
+ * directoiry.
6693
+ *
6694
+ *
6695
+ * ZipCPU---None yet.
6696
+ */
6697
+
6698
+/* TARGET_EXTRA_PRE_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6699
+ * register any extrra include files for the target before any standard headers.
6700
+ * The parameter stdinc indicates if normal include files are present.
6701
+ *
6702
+ * ZipCPU --- None.
6703
+ */
6704
+
6705
+/* TARGET_OPTF(PATH) ... This target hook should register special include paths
6706
+ * for the target.  The parameter path is the integer to register.  On Darwin
6707
+ * systems, this is used for Framework includes, which have semantics that are
6708
+ * different from -I.
6709
+ *
6710
+ *
6711
+ * ZipCPU --- None.
6712
+ */
6713
+
6714
+/* TARGET_USE_LOCAL_THUNK_ALIAS_P(FN) ... This target macro returns if it is
6715
+ * safe to use a local alias for a virtual function FN when constructing
6716
+ * thunks, false otherwise.  By default, the macro returns true for all
6717
+ * functions, if a target supports aliases (i.e. defines ASM_OUTPUT_DEF),
6718
+ * false otherwise.
6719
+ *
6720
+ *
6721
+ * ZipCPU --- ???
6722
+ */
6723
+// #warning "ASM_OUTPUT_DEF's definition has not been considered"
6724
+
6725
+
6726
+/* TARGET_FORMAT_TYPES ... If defined, this macro is the name of a global
6727
+ * variable containing target-specific format checking information for the
6728
+ * -Wformat option.  The default is to have no target-specific format checks.
6729
+ *
6730
+ * ZipCPU --- Default
6731
+ */
6732
+
6733
+/* TARGET_N_FORMAT_TYPES
6734
+ *
6735
+ * ZipCPU --- Default
6736
+ */
6737
+
6738
+/* TARGET_OVERRIDES_FORMAT_ATTRIBUTES ... If defined, this macro is the name of
6739
+ * a global variable containing target-specific format overrides for the
6740
+ * -Wformat option.  The default is to have no target specific format overrides.
6741
+ *
6742
+ * ZipCPU --- Default
6743
+ */
6744
+
6745
+/* TARGET_OVERRIDEES_FORMAT_ATTRIBUTES
6746
+ * TARGET_OVERRIDEES_FORMAT_ATTRIBUTES_COUNT
6747
+ *
6748
+ * If defined, the (first) macro is the name of a global variable containing
6749
+ * target-specific format overrides for the -Wformat option.
6750
+ */
6751
+/* TARGET_OVERRIDES_FORMAT_INIT ... If defined, this macro specifies the
6752
+ * optional initialization routine for target specific customizations of the
6753
+* system printf and scanf formatter settings.
6754
+ */
6755
+
6756
+/* TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN(TLIST,FN,VAL) ... If defined, this
6757
+ * macro returns the diagnostic message when it is illegal to pass an argument
6758
+ * VAL to function FN with prototype TLIST.
6759
+ *
6760
+ * ZipCPU---Default.
6761
+ */
6762
+
6763
+/* TARGET_INVALID_CONVERSION
6764
+ * TARGET_INVALID_UNARY_OP
6765
+ * TARGET_INVALID_BINARY_OP
6766
+ * TARGET_INVALID_PARAMETER_TYPE
6767
+ * TARGET_INVALID_RETURN_TYPE
6768
+ * TARGET_PROMOTED_TYPE
6769
+ * TARGET_CONVERT_TO_TYPE
6770
+ * TARGET_USE_JCR_SECTION_TYPE
6771
+ * OBJC_JBLEN
6772
+ * LIBGCC2_UNWIND_ATTRIBUTE
6773
+ * TARGET_UPDATE_STACK_BOUNDARY
6774
+ * TARGET_GET_DRAP_RTX
6775
+ * TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS
6776
+ */
6777
+/* TARGET_CONST_ANCHOR ... On some architectures it can take multiple
6778
+ * instructions to synthesize a constant. If there is another constant already
6779
+ * in a register that is close enough in value then it is preferable that the
6780
+ * new constant is computed from the register using immediate addition or
6781
+ * subtraction.  We accomplish this through CSE.  Besides the value of the
6782
+ * constant we also add a lower and an upper constant anchor to the available
6783
+ * expressions.  These are then queried when encountering new constants.  The
6784
+ * anchors are computed by rounding the constant up and down to a multiple of
6785
+ * the value of TARGET_CONST_ANCHOR.  TARGET_CONST_ANCHOR should be the maximum
6786
+ * positive value accepted by immediate-add plus one.  We currently assume that
6787
+ * the value of TARGET_CONST_ANCHOR is a poewr of 2.  For example, on MIPS,
6788
+ * where add-immediate takes a 16-bit signed value, TARGET_CONST_ANCHOR is set
6789
+ * to 0x8000.  The default value is zero, which disables this optimization.
6790
+ *
6791
+ * ZipCPU---One of the great strengths of the ZipCPU ISA is its ability to
6792
+ * access registers plus immediates.  To use this, we *need* this capability.
6793
+ * So, we define it here. (to 0x20000, or 2^17 because we can handle 18-bits of
6794
+ * signed immediate offsets)
6795
+ *
6796
+ * On ZipCPU---2^17
6797
+ */
6798
+#define        TARGET_CONST_ANCHOR     zip_const_anchor
6799
+
6800
+/* TARGET_ASAN_SHADOW_OFFSET ... Return the offset bitwise ored into shifted
6801
+ * address to get corresponding Address Sanitizer shadow memory address.  NULL
6802
+ * if address Sanitizer is not supported by the target.
6803
+ */
6804
+#define        TARGET_ASAN_SHADOW_OFFSET       NULL
6805
+
6806
+/* TARGET_MEMMODEL_CHECK
6807
+ */
6808
+/* TARGET_ATOMIC_TEST_AND_SET_TRUEVAL ... This value should be set if the result
6809
+ * written by atomic test and set is not exactly 1, i.e. the bool true.
6810
+ */
6811
+/* TARGET_HAS_IFUNC_P ... It returns true if the target supports GNU indirect
6812
+ * functions.  The support includes the assembler, linker, and dynamic linker.
6813
+ * The default value of this hook is based on target's libc.
6814
+ */
6815
+#define        TARGET_HAS_IFUNC_P      hook_bool_void_true
6816
+
6817
+/* TARGET_ATOMIC_ALIGN_FOR_MODE(MODE) ... If defined, this function returns
6818
+ * an appropriate alignment in bits for an atomic object of machine mode
6819
+ * MODE.  If 0 is returned then the default alignment for the specified mode
6820
+ * is used.
6821
+ *
6822
+ * ZipCPU---Both default and 2 would be valid.  We'll stick to the default.
6823
+ */
6824
+
6825
+/* TARGET_ATOMIC_ASSIGN_EXPAND_FENV --- ISO C11 requires atomic compound
6826
+ * assignments that may raise floating-point exceptions to raise exceptions
6827
+ * corresponding to the arithmetic operation whose result was successfully
6828
+ * stored in a compare-and-exchange sequence.  This requires code equivalent to
6829
+ * calls to feholdexcept, feclearexcept and feupdateenv to be generated at
6830
+ * appropriate points in the compare-and-exchange sequence.  This hook should
6831
+ * set *hold to an expression equivalent
6832
+ *
6833
+ * ZipCPU --- ???
6834
+ */
6835
+
6836
+/* TARGET_RECORD_OFFLOAD_SYMBOL ... Used when offloaded functions are seen in
6837
+ * the compilation unit and no named sections are available.  It is called once
6838
+ * for each symbol that must be recorded in the offload function and variable
6839
+ * table.
6840
+ *
6841
+ * ZipCPU --- Offloaded functions?
6842
+ */
6843
+
6844
+/* TARGET_OFFLOAD_OPTIONS
6845
+ *
6846
+ * ZipCPU---none defined
6847
+ */
6848
+
6849
+/* TARGET_SUPPORTS_WIDE_INT ... On older ports, large integers are stored
6850
+ * in CONST_DOUBLE rtl objects.  Newer ports define TARGET_SUPPORTS_WIDE_INT
6851
+ * to be nonzero to indicate that large integers are stored in CONST_WIDE_INT
6852
+ * rtl objects.  The CONST_WIDE_INT allows very large integer constants to be
6853
+ * represented.  CONST_DOUBLE is limited to twice the size of the hosts
6854
+ * HOST_WIDE_INT representation.
6855
+ *
6856
+ * ZipCPU---We don't need these yet, so this isn't yet relevant.  (These ints
6857
+ * are wider than DImode ...)
6858
+ */
6859
+#define        TARGET_SUPPORTS_WIDE_INT        0
6860
+
6861
+
6862
+/* Now, for the prototype functions ...*/
6863
+// These have been moved to zip-protos.h
6864
+
6865
+// extern void zip_init_builtins(void);
6866
+// extern void zip_asm_output_anchor(rtx x);
6867
+// extern bool zip_legitimate_address_p(enum machine_mode mode, rtx x, bool string);
6868
+// extern void zip_asm_trampoline_template(FILE *);
6869
+// extern void zip_initial_elimination_offset(int from, int to);
6870
+// extern void zip_print_operand(FILE *stream, rtx *x, int code);
6871
+// extern void zip_print_operand_address(FILE *stream, rtx *x);
6872
+// extern void zip_asm_output_def(FILE *s, const char *n, const char *v);
6873
+// extern void zip_update_cc_notice(rtx exp, rtx_insn *insn);
6874
+// extern      int zip_address_operand(rtx op);
6875
+// extern      int zip_const_address_operand(rtx op);
6876
+// extern void zip_expand_prologue(void);
6877
+// extern void zip_expand_epilogue(void);
6878
+// extern bool zip_gen_move_rtl(rtx, rtx);
6879
+// extern bool zip_load_address_lod(rtx, rtx);
6880
+// extern bool zip_load_address_sto(rtx, rtx);
6881
+// extern void zip_print_operand(FILE *fp, rtx x, int code);
6882
+// extern void zip_print_operand_address(FILE *fp, rtx x);
6883
+// extern bool zip_use_return_insn(void);
6884
+
6885 111 dgisselq
+#define        UQQmode USQmode
6886
+#define        UHQmode USQmode
6887
+#define        UHAmode USAmode
6888
+#define        QQmode  SQmode
6889
+#define        HQmode  SQmode
6890 102 dgisselq
+#define        QImode  SImode
6891
+#define        HImode  SImode
6892 111 dgisselq
+#define        QAmode  SAmode
6893
+#define        HAmode  SAmode
6894 102 dgisselq
+
6895
+#include "insn-modes.h"
6896
+#include "zip-protos.h"
6897
+
6898
+#endif /* GCC_ZIP_H */
6899
+
6900
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.md gcc-5.3.0-zip/gcc/config/zip/zip.md
6901
--- gcc-5.3.0-original/gcc/config/zip/zip.md    1969-12-31 19:00:00.000000000 -0500
6902 111 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.md 2016-03-24 21:23:15.776993706 -0400
6903
@@ -0,0 +1,1963 @@
6904 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6905
+;;
6906
+;; Filename:   zip.md
6907
+;;
6908
+;; Project:    Zip CPU -- a small, lightweight, RISC CPU soft core
6909
+;;
6910
+;; Purpose:    This is the machine description of the Zip CPU as needed by the
6911
+;;             GNU compiler collection (GCC).
6912
+;;
6913
+;;
6914
+;; Creator:    Dan Gisselquist, Ph.D.
6915
+;;             Gisselquist Technology, LLC
6916
+;;
6917
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6918
+;;
6919
+;; Copyright (C) 2015, Gisselquist Technology, LLC
6920
+;;
6921
+;; This program is free software (firmware): you can redistribute it and/or
6922
+;; modify it under the terms of  the GNU General Public License as published
6923
+;; by the Free Software Foundation, either version 3 of the License, or (at
6924
+;; your option) any later version.
6925
+;;
6926
+;; This program is distributed in the hope that it will be useful, but WITHOUT
6927
+;; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
6928
+;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6929
+;; for more details.
6930
+;;
6931
+;; License:    GPL, v3, as defined and found on www.gnu.org,
6932
+;;             http://www.gnu.org/licenses/gpl.html
6933
+;;
6934
+;;
6935
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6936
+;;
6937
+;;
6938
+;; - Immediate integer operand constraints
6939
+;;     'I'     -2^22 ... 2^22-1, or -4194304 .. 4194303        (LDI insn)
6940
+;;     'M'     -2^12 ... 2^12-1, or -4096 ... 4095             (MOV offset)
6941
+;;     'N'     -2^14 ... 2^14-1, or -16384 ... 16383           (OpB offset)
6942
+;;     'O'     -2^17 ... 2^17-1, or -131072 ... 131071         (OpB Immediate)
6943
+;;     'R'     0...31                                          (Shift value)
6944
+;; - Memory constraints
6945 111 dgisselq
+;;     "Q"     Op-B capable references to memory
6946
+;;     "S"     References to constant memory
6947 102 dgisselq
+;; - Address constraints
6948 111 dgisselq
+;;     "U"     Op-B capable address that references to memory
6949
+;;     "T"     Constant memory addresses
6950 102 dgisselq
+(define_constraint "M"
6951
+  "An 13-bit signed immediate such as a MOV instruction can handle"
6952
+  (and (match_code "const_int")
6953
+       (match_test "(ival < 0x1000) && (ival >= -0x1000)")))
6954
+(define_constraint "N"
6955
+  "An 14-bit signed immediate offset such as an Op-B register offset"
6956
+  (and (match_code "const_int")
6957
+       (match_test "(ival < 0x2000) && (ival >= -0x2000)")))
6958
+(define_constraint "O"
6959
+  "An 18-bit signed immediate such as an Op-B Immediate can handle"
6960
+  (and (match_code "const_int")
6961
+       (match_test "(ival < 0x20000) && (ival >= -0x20000)")))
6962
+(define_constraint "R"
6963
+  "Bits that a value may be shifted"
6964
+  (and (match_code "const_int")
6965
+       (match_test "(ival < 32) && (ival >= 0)")))
6966
+;;
6967
+;
6968
+;
6969
+; Our builtin functions, by identifier
6970
+;
6971
+(define_constants
6972
+       [(UNSPEC_RTU            1)
6973
+       (UNSPEC_HALT            2)
6974
+       (UNSPEC_IDLE            3)
6975
+       (UNSPEC_SYSCALL         4)
6976
+       (UNSPEC_SAVE_CONTEXT    5)
6977
+       (UNSPEC_RESTORE_CONTEXT 6)
6978
+       (UNSPEC_BITREV          7)
6979
+       (UNSPEC_GETCC           8)
6980
+       (UNSPEC_LDILO           9)
6981
+       ])
6982
+;
6983
+;
6984
+; Registers by name
6985
+(define_constants
6986
+  [(RTN_REG            0)      ; Return address register
6987
+   (RTNV_REG           1)      ; Subroutine return value register
6988
+   (AP_REG             10)     ; Hopefully never used
6989
+   (GBL_REG            11)     ; Hopefully never used, but just in case ...
6990
+   (FP_REG             12)
6991
+   (SP_REG             13)
6992
+   (CC_REG             14)
6993
+   (PC_REG             15)
6994
+  ])
6995
+;
6996
+;
6997
+;
6998
+
6999
+;; Predicates
7000
+(define_predicate "zip_const_address_operand_p"
7001
+       (match_code "symbol_ref,const,label_ref,code_label")
7002
+{
7003
+       return zip_const_address_operand(op);
7004
+})
7005
+
7006
+(define_predicate "zip_address_operand_p"
7007
+       (match_code "reg,plus")
7008
+{
7009 111 dgisselq
+       return zip_pd_opb_operand(op);
7010 102 dgisselq
+})
7011
+
7012 111 dgisselq
+(define_predicate "zip_opb_operand_p"
7013
+       (match_code "reg,plus,const_int")
7014
+{
7015
+       return zip_pd_opb_operand(op);
7016
+})
7017
+
7018
+(define_predicate "zip_opb_single_operand_p"
7019
+       (match_code "reg,const_int")
7020
+{
7021
+       return zip_pd_opb_operand(op);
7022
+})
7023
+
7024 102 dgisselq
+(define_predicate "zip_mov_operand_p"
7025
+       (match_code "reg,plus")
7026
+{
7027
+       return zip_pd_mov_operand(op);
7028
+})
7029
+
7030
+(define_predicate "zip_memory_operand_p"
7031
+       (match_code "mem")
7032
+{
7033 111 dgisselq
+       return zip_pd_opb_operand(XEXP(op,0));
7034 102 dgisselq
+})
7035
+
7036 111 dgisselq
+(define_predicate "zip_imm_operand_p"
7037
+       (match_code "const_int")
7038
+{
7039
+       return zip_pd_imm_operand(op);
7040
+})
7041
+
7042
+(define_predicate "zip_mvimm_operand_p"
7043
+       (match_code "const_int")
7044
+{
7045
+       return zip_pd_mvimm_operand(op);
7046
+})
7047
+
7048
+(define_predicate "zip_movdst_operand_p"
7049
+       (match_code "mem,reg,subreg")
7050
+{
7051
+       if (MEM_P(op)) // Check for valid store address
7052
+               return zip_pd_opb_operand(XEXP(op,0));
7053
+       return 1;
7054
+})
7055
+
7056
+(define_predicate "zip_movsrc_operand_p"
7057
+       (match_code "mem,reg,subreg,const_int,const,symbol_ref,label_ref,code_label")
7058
+{
7059
+       if (MEM_P(op))
7060
+               return zip_pd_opb_operand(XEXP(op,0));
7061
+       else if (GET_CODE(op)==PLUS)
7062
+               return zip_pd_opb_operand(op);
7063
+       return 1;
7064
+})
7065
+
7066 102 dgisselq
+;; Constraints
7067
+;
7068
+(define_memory_constraint "S"
7069
+       "Any memory referenced by a constant address, possibly unknown at compile time"
7070
+       (and (match_code "mem")
7071
+               (match_test "zip_ct_const_address_operand(XEXP(op,0))")))
7072
+(define_memory_constraint "Q"
7073
+       "Any memory addressed suitably for a load or store instruction"
7074
+       (and (match_code "mem")
7075
+               (match_test "zip_ct_address_operand(XEXP(op,0))")))
7076
+(define_address_constraint "U"
7077
+       "An address suitable for a load or store instruction"
7078
+       (and (match_code "reg,plus")
7079
+               (match_test "zip_ct_address_operand(op)")))
7080
+(define_address_constraint "T"
7081
+       "Any constant address, to include those made by symbols unknown at compile time"
7082
+       (and (match_code "label_ref,code_label,symbol_ref,const")
7083
+               (match_test "zip_ct_const_address_operand(op)")))
7084
+;
7085
+;
7086
+;; Attributes
7087
+;
7088
+(define_attr "predicable"  "no,yes" (const_string "yes"))
7089
+(define_attr "conditional" "no,yes" (const_string "no"))
7090
+(define_attr "ccresult" "set,unknown,unchanged,validzn" (const_string "set"))
7091
+;
7092
+; Mode attributes
7093
+; (define_mode_iterator ZI [QI HI SI])
7094
+; (define_mode_attr zipa [(QI "") (HI "") (SI "")])
7095
+(define_mode_iterator ZI [SI])
7096
+(define_mode_attr zipa [(SI "")])
7097
+;
7098
+;
7099
+;
7100
+;; Instructions
7101
+;
7102
+; (define_insn
7103
+;      optional name
7104
+;      RTL template -- a vector of incomplete RTL expressions describing the
7105
+;              semantics of the instruction.  It is incomplete because it may
7106
+;              contain match_operand, match_operator, and match_dup expressions
7107
+;      The condition --- contains a C expression, may be an empty string
7108
+;      output template or output statement--fragment of C code returning a str
7109
+;      Attributes --
7110
+;      )
7111
+;
7112
+; (match_operand:m n predicate constraint)
7113
+;      Placeholder for operand #n of the instruction
7114
+;      Predicate       string that is the name of a fucntion w/ 2 arguments:
7115
+;                              (expression, machine mode)
7116
+;              we can build functions:
7117
+;                      "isregister"    to describe a register
7118
+;                      "isimmediate"   to describe an immediate
7119
+;                      "offsetreg"     to describe a register plus offset
7120
+;                      "anyregister"   to describe *ANY* register (uRx or Rx)
7121
+;              But ... functions "address_operand", "immediate_operand",
7122
+;                      "register_operand", "indirect_operand"
7123
+;              "comparison_operatot" and "ordered_comparison_operator"
7124
+;              are also available--be aware, they include more comparisons
7125
+;              than Zip CPU can do.
7126
+;
7127
+;
7128
+;
7129
+;
7130
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7131
+;;
7132
+;; Move instructions: both
7133
+;      (arbitrary) from variables to variables, but this gets
7134
+;              expanded into:
7135
+;      from registers to registers
7136
+;      from immediates to registers
7137
+;;
7138
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7139
+;
7140
+;
7141
+;
7142
+(define_expand "mov<mode>"
7143 111 dgisselq
+       [(set (match_operand:ZI 0 "nonimmediate_operand" "")
7144
+               (match_operand:ZI 1 "general_operand" ""))]
7145 102 dgisselq
+       ""
7146 111 dgisselq
+       {//; Everything except mem=const or mem=mem can be done easily
7147
+       //; extern void zip_debug_rtx_pfx(const char *, const_rtx);
7148
+       //; fprintf(stderr, "ZIP-GEN-MOVE\n");
7149
+       //; zip_debug_rtx_pfx("FROM: ", operands[1]);
7150
+       //; zip_debug_rtx_pfx("TO  : ", operands[0]);
7151
+
7152
+       //; Need to load into a register between memory slots
7153
+       if ((MEM_P(operands[0]))&&(MEM_P(operands[1]))) {
7154
+               //; fprintf(stderr, "GEN-MOVSI: MEM -> MEM\n");
7155
+               if (can_create_pseudo_p()) {
7156
+                       rtx tmp = gen_reg_rtx(GET_MODE(operands[1]));
7157
+                       emit_insn(gen_movsi(tmp,operands[1]));
7158
+                       operands[1] = tmp;
7159
+               }
7160 102 dgisselq
+       }
7161 111 dgisselq
+
7162
+       //; Op[0] has a bad address, need to legitimize it
7163
+       if ((MEM_P(operands[0]))&&
7164
+               ((zip_const_address_operand(XEXP(operands[0],0)))
7165
+               ||(!zip_pd_opb_operand(XEXP(operands[0],0))))
7166
+               )
7167
+               {
7168
+               //; fprintf(stderr, "GEN-MOVSI: Not to a MEM(REG)\n");
7169
+               if (can_create_pseudo_p()) {
7170
+                       rtx tmp = gen_reg_rtx(Pmode);
7171
+                       //; Load the address into a register
7172
+                       emit_insn(gen_movsi(tmp,XEXP(operands[0],0)));
7173
+                       XEXP(operands[0],0) = tmp;
7174
+                       mark_reg_pointer(tmp,1);
7175
+               }
7176
+       }
7177
+       //; Op[1] is a constant.  Need to load into a register before we can
7178
+       //; place it into memory.
7179
+       if ((MEM_P(operands[0]))&&
7180
+               ((CONSTANT_P(operands[1]))
7181
+               ||(CONST_INT_P(operands[1])))) {
7182
+               //; fprintf(stderr, "GEN-MOVSI: CONST -> MEM\n");
7183
+               //; zip_debug_rtx_pfx("MEM  : ", operands[0]);
7184
+               //; zip_debug_rtx_pfx("CONST: ", operands[1]);
7185
+               if (can_create_pseudo_p()) {
7186
+                       rtx tmp = gen_reg_rtx(GET_MODE(operands[0]));
7187
+                       emit_insn(gen_movsi(tmp,operands[1]));
7188
+                       operands[1] = tmp;
7189
+               }
7190
+       }
7191
+       //; Op[1] has a bad address, need to legitimize it
7192
+       if ((MEM_P(operands[1]))&&
7193
+               //; (!REG_P(XEXP(operands[1],0)))
7194
+               ((zip_const_address_operand(XEXP(operands[1],0)))
7195
+               ||(!zip_pd_opb_operand(XEXP(operands[1],0))))
7196
+               )
7197
+               {
7198
+               //; fprintf(stderr, "GEN-MOVSI: Not from a MEM(REG)\n");
7199
+               if (can_create_pseudo_p()) {
7200
+                       rtx tmp = gen_reg_rtx(Pmode);
7201
+                       emit_insn(gen_movsi(tmp,XEXP(operands[1],0)));
7202
+                       XEXP(operands[1],0) = tmp;
7203
+               } else if (REG_P(operands[0])) { //; Can we steal Op[0]'s reg?
7204
+                       rtx tmp = operands[0];
7205
+                       emit_insn(gen_movsi(tmp,XEXP(operands[1],0)));
7206
+                       XEXP(operands[1],0) = tmp;
7207
+               }
7208
+       }
7209
+       }
7210 102 dgisselq
+       [(set_attr "ccresult" "unchanged")])
7211 111 dgisselq
+(define_insn "movsi_raw"
7212
+       [(set (match_operand:SI 0 "zip_movdst_operand_p" "=r,Q,r,r")
7213
+               (match_operand:SI 1 "zip_movsrc_operand_p" "r,r,Q,i"))]
7214
+       "(REG_P(operands[0]))||(REG_P(operands[1]))"
7215
+       "@
7216
+       MOV\t%1,%0
7217
+       STO\t%1,%0
7218
+       LOD\t%1,%0
7219
+       LDI\t%1,%0"
7220
+       [(set_attr "ccresult" "unchanged")])
7221 102 dgisselq
+(define_insn "mov<mode>_reg"   ; Register to register move
7222
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7223
+               (match_operand:ZI 1 "register_operand" "r"))]
7224
+       ""
7225
+       "MOV    %1,%0"
7226
+       [(set_attr "ccresult" "unchanged")])
7227
+(define_insn "mov<mode>_reg_off"       ; Register to register move
7228
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7229
+               (plus:ZI (match_operand:ZI 1 "register_operand" "r")
7230 111 dgisselq
+                       (match_operand:ZI 2 "zip_mvimm_operand_p" "M")))
7231
+               ]
7232 102 dgisselq
+       ""
7233
+       "MOV    %2(%1),%0"
7234
+       [(set_attr "ccresult" "unchanged")])
7235 103 dgisselq
+;(define_insn "mov<mode>_lod"  ; Load from memory
7236
+;      [(set (match_operand:ZI 0 "register_operand" "=r")
7237
+;              (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
7238
+;      ""
7239
+;      "LOD    %1,%0"
7240
+;      [(set_attr "ccresult" "unchanged")])
7241
+;(define_insn "mov<mode>_sto"  ; Store into memory
7242
+;      [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
7243
+;              (match_operand:ZI 1 "register_operand" "r"))]
7244
+;      ""
7245
+;      "STO    %1,%0"
7246
+;      [(set_attr "ccresult" "unchanged")])
7247
+(define_expand "mov<mode>_lod" ; Load from memory
7248 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7249
+               (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
7250 103 dgisselq
+       "")
7251
+(define_insn "*movsi_lod"
7252
+       [(set (match_operand:SI 0 "register_operand" "=r")
7253 111 dgisselq
+               (match_operand:SI 1 "zip_memory_operand_p" ""))]
7254 102 dgisselq
+       ""
7255 103 dgisselq
+       "LOD\t%1,%0"
7256
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7257 111 dgisselq
+;(define_insn "*movsi_lod_off"
7258
+       ;[(set (match_operand:SI 0 "register_operand" "=r")
7259
+               ;(mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
7260
+                       ;(match_operand:SI 2 "const_int_operand" "N"))))]
7261
+       ;""
7262
+       ;"LOD\t%2(%1),%0"
7263
+       ;[(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7264 103 dgisselq
+(define_expand "mov<mode>_sto" ; Store into memory
7265 102 dgisselq
+       [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
7266
+               (match_operand:ZI 1 "register_operand" "r"))]
7267 103 dgisselq
+       "")
7268
+(define_insn "*movsi_sto"
7269 111 dgisselq
+       [(set (match_operand:SI 0 "zip_memory_operand_p" "=Q")
7270 103 dgisselq
+               (match_operand:SI 1 "register_operand" "r"))]
7271 102 dgisselq
+       ""
7272 111 dgisselq
+       "STO\t%1,%0"
7273 103 dgisselq
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7274 111 dgisselq
+;(define_insn "*movsi_sto_off"
7275
+       ;[(set (mem:SI (plus:SI
7276
+                       ;(match_operand:SI 0 "register_operand" "r")
7277
+                       ;(match_operand:SI 1 "const_int_operand" "N")))
7278
+               ;(match_operand:SI 2 "register_operand" "r"))]
7279
+       ;""
7280
+       ;"STO\t%2,%1(%0)"
7281
+       ;[(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7282 102 dgisselq
+(define_insn "mov<mode>_ldi"   ; Load immediate
7283
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7284
+               (match_operand:ZI 1 "immediate_operand" "ipU"))]
7285
+       ""
7286
+       "LDI    %1,%0"
7287
+       [(set_attr "ccresult" "unchanged")])
7288
+;
7289
+;
7290
+;
7291
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7292
+;;
7293
+;; Load and store multiple values
7294
+;;
7295
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7296
+;
7297
+; So far, from the code I've seen from GCC's output,
7298
+; these instructions do not appear to be necessary.
7299
+;
7300
+;(define_insn "load_multiple"
7301
+;      for(a=0; a<%2; a++)
7302
+;              LOD a(%1),%0+a
7303
+;(define_insn "store_multiple"
7304
+;      for(a=0; a<%2; a++)
7305
+;              STO %0+a,a(%1)
7306
+; pushsi -- Do not define, compiler will work around it nicely w/o our help
7307
+;
7308
+;
7309
+;
7310
+;
7311
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7312
+;;
7313
+;; General arithmetic instructions
7314
+;;
7315
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7316
+;
7317
+;
7318
+;
7319
+;
7320 111 dgisselq
+(define_expand "add<mode>3" ; Fastest/best instruction always goes first
7321 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7322 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7323 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
7324
+(define_insn "*addsi3_reg" ; Fastest/best instruction always goes first
7325
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7326
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7327
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7328 102 dgisselq
+       ]
7329
+       ""
7330
+       "ADD    %2,%0"
7331
+       [(set_attr "ccresult" "set")])
7332
+(define_insn "add<mode>3_off" ; Fastest/best instruction always goes first
7333
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7334 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7335
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7336 111 dgisselq
+                               (match_operand:ZI 3 "const_int_operand" "N"))))]
7337 102 dgisselq
+       ""
7338
+       "ADD    %3+%2,%0"
7339
+       [(set_attr "ccresult" "set")])
7340
+;
7341
+;
7342
+;
7343 103 dgisselq
+(define_expand "sub<mode>3"
7344 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7345 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7346 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7347 103 dgisselq
+       ])
7348 111 dgisselq
+(define_insn "sub<mode>3_reg"
7349 103 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7350
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7351 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7352 102 dgisselq
+       ]
7353
+       ""
7354
+       "SUB    %2,%0"
7355
+       [(set_attr "ccresult" "set")])
7356
+(define_insn "sub<mode>3_off"
7357
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7358 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7359
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "%r")
7360 102 dgisselq
+                               (match_operand:ZI 3 "const_int_operand" "N"))))
7361
+       ]
7362
+       ""
7363
+       "SUB    %3+%2,%0"
7364
+       [(set_attr "ccresult" "set")])
7365
+(define_insn "mul<mode>3"
7366
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7367
+               (mult:ZI (match_operand:ZI 1 "register_operand" "%r")
7368
+                       (match_operand:ZI 2 "register_operand" "r")))
7369
+       (clobber (match_scratch:ZI 3 "=r"))]
7370
+       ; "(R0 != R1)&&(R0 != R2)&&(R0!=R3)&&(R1!=R2)&&(R1=R3)&&(R2!=R3)"
7371
+       ""
7372
+       "MOV    %1,%0
7373
+       MPYS    %2,%0
7374
+       MOV     %1,%3
7375
+       ROL     16,%3
7376
+       MPYS    %2,%3
7377
+       ROL     16,%3
7378
+       AND     0x0ffff,%3
7379
+       ADD     %3,%0
7380
+       MOV     %2,%3
7381
+       ROL     16,%3
7382
+       MPYS    %1,%3
7383
+       ROL     16,%3
7384
+       AND     0x0ffff,%3
7385
+       ADD     %3,%0"
7386
+       [(set_attr "ccresult" "unknown")])
7387
+
7388 111 dgisselq
+(define_expand "div<mode>3"
7389 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7390 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7391 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))]
7392
+       "(ZIP_DIVIDE)")
7393
+(define_insn "div<mode>3_reg"
7394
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7395
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7396 103 dgisselq
+                       (match_operand:ZI 2 "nonmemory_operand" "rO")))]
7397 111 dgisselq
+       "(ZIP_DIVIDE)"
7398 102 dgisselq
+       "DIVS   %2,%0"
7399
+       [(set_attr "ccresult" "set")])
7400
+(define_insn "div<mode>3_off"
7401
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7402 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7403
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7404 102 dgisselq
+                               (match_operand:ZI 3 "const_int_operand" "N"))))]
7405 111 dgisselq
+       "(ZIP_DIVIDE)"
7406 102 dgisselq
+       "DIVS   %3+%2,%0"
7407
+       [(set_attr "ccresult" "set")])
7408 111 dgisselq
+(define_expand "udiv<mode>3"
7409 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7410 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7411 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))]
7412
+       "(ZIP_DIVIDE)")
7413
+(define_insn "udiv<mode>3_reg"
7414
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7415
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7416 103 dgisselq
+                       (match_operand:ZI 2 "nonmemory_operand" "rO")))]
7417 111 dgisselq
+       "(ZIP_DIVIDE)"
7418 102 dgisselq
+       "DIVU   %2,%0"
7419
+       [(set_attr "ccresult" "set")])
7420
+(define_insn "udiv<mode>3_off"
7421
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7422 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7423
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7424 102 dgisselq
+                               (match_operand:ZI 3 "const_int_operand" "N"))))]
7425 111 dgisselq
+       "(ZIP_DIVIDE)"
7426 102 dgisselq
+       "DIVU   %3+%2,%0"
7427
+       [(set_attr "ccresult" "set")])
7428
+;;
7429
+;; modsi3
7430
+;; umodsi3
7431
+;;
7432
+(define_insn "umin<mode>3"
7433
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7434
+               (umin:ZI (match_operand:ZI 1 "register_operand" "%0")
7435
+                       (match_operand:ZI 2 "register_operand" "r")))
7436
+       ]
7437
+       ""
7438
+       "CMP    %0,%2
7439
+       MOV.C   %2,%0"
7440
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7441
+(define_insn "umax<mode>3"
7442
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7443
+               (umax:ZI (match_operand:ZI 1 "register_operand" "%0")
7444
+                       (match_operand:ZI 2 "register_operand" "r")))
7445
+       ]
7446
+       ""
7447
+       "CMP    %2,%0
7448
+       MOV.C   %2,%0"
7449
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7450
+(define_insn "smin<mode>3"
7451
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7452
+               (smin:ZI (match_operand:ZI 1 "register_operand" "%0")
7453
+                       (match_operand:ZI 2 "register_operand" "r")))
7454
+       ]
7455
+       ""
7456
+       "CMP    %2,%0
7457
+       MOV.GT  %2,%0"
7458
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7459
+(define_insn "smax<mode>3"
7460
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7461
+               (smax:ZI (match_operand:ZI 1 "register_operand" "%0")
7462
+                       (match_operand:ZI 2 "register_operand" "r")))
7463
+       ]
7464
+       ""
7465
+       "CMP    %0,%2
7466
+       MOV.LT  %2,%0"
7467
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7468 111 dgisselq
+(define_expand "and<mode>3"
7469 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7470
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
7471 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
7472
+(define_insn "and<mode>3_reg"
7473
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7474
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
7475
+                       (match_operand:ZI 2 "zip_opb_operand_p" "rO")))]
7476 102 dgisselq
+       ""
7477
+       "AND    %2,%0"
7478
+       [(set_attr "ccresult" "set")])
7479
+(define_insn "and<mode>3_off"
7480
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7481
+               (and:ZI (match_operand:ZI 1 "register_operand" "0")
7482
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7483
+                               (match_operand:ZI 3 "const_int_operand" "N"))))
7484
+       ]
7485
+       ""
7486
+       "AND    %3+%2,%0"
7487
+       [(set_attr "ccresult" "set")])
7488 111 dgisselq
+(define_expand "ior<mode>3"
7489 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7490
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
7491 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
7492
+(define_insn "ior<mode>3_reg"
7493
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7494
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
7495 103 dgisselq
+                       (match_operand:ZI 2 "nonmemory_operand" "rO")))
7496 102 dgisselq
+       ]
7497
+       ""
7498
+       "OR     %2,%0"
7499
+       [(set_attr "ccresult" "set")])
7500
+(define_insn "ior<mode>3_off"
7501
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7502
+               (ior:ZI (match_operand:ZI 1 "register_operand" "0")
7503
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7504 103 dgisselq
+                               (match_operand:ZI 3 "nonmemory_operand" "N"))))
7505 102 dgisselq
+       ]
7506
+       ""
7507
+       "OR     %3+%2,%0"
7508
+       [(set_attr "ccresult" "set")])
7509 111 dgisselq
+(define_expand "xor<mode>3"
7510 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7511
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
7512 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
7513
+(define_insn "xor<mode>3_reg"
7514
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7515
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
7516 103 dgisselq
+                       (match_operand:ZI 2 "nonmemory_operand" "rO")))
7517 102 dgisselq
+       ]
7518
+       ""
7519
+       "XOR    %2,%0"
7520
+       [(set_attr "ccresult" "set")])
7521
+(define_insn "xor<mode>3_off"
7522
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7523
+               (xor:ZI (match_operand:ZI 1 "register_operand" "0")
7524
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7525 103 dgisselq
+                               (match_operand:ZI 3 "nonmemory_operand" "N"))))
7526 102 dgisselq
+       ]
7527
+       ""
7528
+       "XOR    %3+%2,%0"
7529
+       [(set_attr "ccresult" "set")])
7530
+;(define_insn "addv<mode>4"
7531
+       ;[(set (match_operand:ZI 0 "register_operand" "=r")
7532
+               ;(plus:ZI (match_operand:ZI 1 "register_operand" "%r")
7533
+                       ;(match_operand:ZI 2 "general_operand" "rO")))
7534
+       ;(set (pc) (if_then_else (eq (cc0) (const_int 0))
7535
+                       ;(label_ref (match_operand 3))
7536
+                       ;(pc)))]
7537
+       ;""
7538
+       ;"MOV   %1,%0
7539
+       ;ADD    %2,%0
7540
+       ;BV     %3"
7541
+       ;[(set_attr "predicable" "no") (set_attr "ccresult" "set")])
7542
+;;(define_insn "subvsi4"
7543
+;;     MOV     %1,%0
7544
+;;     SUB     %2,%0
7545
+;;     BV      %3
7546
+;;(mulvsi4)
7547
+;;(define_insn "uaddvsi4"
7548
+;;     ADD     %2,%0
7549
+;;     BC      %3
7550
+;;(define_insn "usubvsi4"
7551
+;;     MOV     %1,%0
7552
+;;     SUB     %2,%0
7553
+;;     BC      %3
7554
+;;
7555
+;; (define_insn "umulvsi4"
7556
+;;     ... ???)
7557
+;;
7558
+(define_insn "ashr<mode>3"
7559
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7560
+               (ashiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
7561 103 dgisselq
+                       (match_operand:ZI 2 "nonmemory_operand" "rR")))]
7562 102 dgisselq
+       ""
7563
+       "ASR    %2,%0"
7564
+       [(set_attr "ccresult" "set")])
7565 111 dgisselq
+(define_insn "ashl<mode>3"
7566
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7567
+               (ashift:ZI (match_operand:ZI 1 "register_operand" "0")
7568
+                       (match_operand:ZI 2 "nonmemory_operand" "rR")))]
7569
+       ""
7570
+       "ASR    %2,%0"
7571
+       [(set_attr "ccresult" "set")])
7572 102 dgisselq
+(define_insn "lshr<mode>3"
7573
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7574
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
7575
+                       (match_operand:ZI 2 "register_operand" "rR")))]
7576
+       ""
7577
+       "LSR    %2,%0"
7578
+       [(set_attr "ccresult" "set")])
7579
+(define_insn "rotl<mode>3"
7580
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7581
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
7582 103 dgisselq
+                       (match_operand:ZI 2 "nonmemory_operand" "rR")))]
7583 102 dgisselq
+       ""
7584
+       "ROL    %2,%0"
7585
+       [(set_attr "ccresult" "set")])
7586
+;
7587
+(define_insn "neg<mode>2"
7588
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7589
+               (neg:ZI (match_operand:ZI 1 "register_operand" "r")))
7590
+       ]
7591
+       ""
7592
+       "NEG    %1,%0"
7593
+       [(set_attr "ccresult" "validzn")])
7594
+(define_insn "abs<mode>2"
7595
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7596
+               (abs:ZI (match_operand:ZI 1 "register_operand" "0")))
7597
+       ]
7598
+       ""
7599
+       "TEST   %0
7600
+       NEG.LT  %0"
7601
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7602
+(define_insn "popcount<mode>2"
7603
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7604
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
7605
+       ]
7606
+       ""
7607
+       "POPC   %1,%0"
7608
+       [(set_attr "ccresult" "set")])
7609
+(define_expand "parity<mode>2"
7610
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7611
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
7612
+       (set (match_dup:ZI 0) (and:ZI (match_dup:ZI 0) (const_int -2)))
7613
+       ])
7614
+(define_insn "one_cmpl<mode>2"
7615
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7616
+               (not:ZI (match_operand:ZI 1 "register_operand" "0")))
7617
+       ]
7618
+       ""
7619
+       "XOR    -1,%0"
7620
+       [(set_attr "ccresult" "set")])
7621
+;
7622
+;
7623
+;
7624
+;
7625
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7626
+;;
7627
+;; General arithmetic instructions -- double words
7628
+;;
7629
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7630
+;
7631
+;
7632
+;
7633 111 dgisselq
+(define_expand "movdi3"
7634
+       [(set (match_operand:DI 0 "nonimmediate_operand" "")
7635
+               (match_operand:DI 1 "general_operand" ""))])
7636
+(define_insn "movdi_lod"
7637
+       [(set (match_operand:DI 0 "register_operand" "=r")
7638
+               (mem:DI (match_operand:SI 1 "zip_opb_operand_p" "r")))]
7639
+       ""
7640
+       {
7641
+               if (REG_P(operands[0]))
7642
+                       return "LOD\t(%1),%H0\n\tLOD\t1(%1),%L0";
7643
+               else if (GET_CODE(operands[0])==PLUS) {
7644
+                       if ((REG_P(XEXP(operands[0],0)))
7645
+                               &&(CONST_INT_P(XEXP(operands[0],1)))) {
7646
+                               static  char    buf[64];
7647
+                               sprintf(buf,
7648
+                                       "LOD\t%ld(%%1),%%H0\n\tLOD\t%ld(%%1),%%L0",
7649
+                                       INTVAL(XEXP(operands[0],1)),
7650
+                                       INTVAL(XEXP(operands[0],1)+1));
7651
+                               return buf;
7652
+                       }
7653
+               } else return "BREAK";
7654
+       }
7655
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7656
+(define_insn "movdi_sto"
7657
+       [(set (mem:DI (match_operand:SI 0 "zip_opb_operand_p" ""))
7658
+               (match_operand:DI 1 "register_operand" "r"))]
7659
+       ""
7660
+       {
7661
+               if (REG_P(operands[0]))
7662
+                       return "STO\t%H0,(%1)\n\tSTO\t%L0,1(%1)";
7663
+               else if (GET_CODE(operands[0])==PLUS) {
7664
+                       if ((REG_P(XEXP(operands[0],0)))
7665
+                               &&(CONST_INT_P(XEXP(operands[0],1)))) {
7666
+                               static  char    buf[64];
7667
+                               sprintf(buf,
7668
+                                       "STO\t%%H0,%ld(%%1)\n\tSTO\t%%L0,%ld(%%1)",
7669
+                                       INTVAL(XEXP(operands[0],1)),
7670
+                                       INTVAL(XEXP(operands[0],1)+1));
7671
+                               return buf;
7672
+                       }
7673
+               } else return "BREAK";
7674
+       }
7675
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7676
+(define_insn "movdi_ldi"
7677
+       [(set (match_operand:DI 0 "register_operand" "=r")
7678
+               (match_operand:DI 1 "immediate_operand" "i"))]
7679
+       ""
7680
+       "LDI\t%H1,%H0\n\tLDI\t%L1,%L0"
7681
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7682 102 dgisselq
+(define_insn "adddi3" ; Fastest/best instruction always goes first
7683
+       [(set (match_operand:DI 0 "register_operand" "=r")
7684 103 dgisselq
+               (plus:DI (match_operand:DI 1 "register_operand" "0")
7685 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
7686
+       ]
7687
+       ""
7688
+       "ADD    %L2,%L0\n\tADD.C\t1,%H0\n\tADD\t%H2,%H0"
7689
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7690
+;
7691
+(define_insn "subdi3"
7692
+       [(set (match_operand:DI 0 "register_operand" "=r")
7693 103 dgisselq
+               (minus:DI (match_operand:DI 1 "register_operand" "0")
7694 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
7695
+       ]
7696
+       ""
7697
+       "SUB    %L2,%L0\n\tSUB.C\t1,%H0\n\tSUB\t%H2,%H0"
7698
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7699
+;
7700
+(define_insn "anddi3"
7701
+       [(set (match_operand:DI 0 "register_operand" "=r")
7702
+               (and:DI (match_operand:DI 1 "register_operand" "%0")
7703
+                       (match_operand:DI 2 "register_operand" "r")))
7704
+       ]
7705
+       ""
7706
+       "AND    %L2,%L0\n\tAND\t%H2,%H0"
7707
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7708
+;
7709
+(define_insn "iordi3"
7710
+       [(set (match_operand:DI 0 "register_operand" "=r")
7711
+               (ior:DI (match_operand:DI 1 "register_operand" "%0")
7712
+                       (match_operand:DI 2 "register_operand" "r")))
7713
+       ]
7714
+       ""
7715
+       "OR     %2,%0\n\tOR\t%H2,%H0"
7716
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7717
+;
7718
+(define_insn "xordi3"
7719
+       [(set (match_operand:DI 0 "register_operand" "=r")
7720
+               (xor:DI (match_operand:DI 1 "register_operand" "%0")
7721
+                       (match_operand:DI 2 "register_operand" "r")))
7722
+       ]
7723
+       ""
7724
+       "XOR    %2,%0\n\tXOR\t%H2,%H0"
7725
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7726
+;
7727
+(define_insn "negdi2"
7728
+       [(set (match_operand:DI 0 "register_operand" "=r")
7729
+               (neg:DI (match_operand:DI 1 "register_operand" "0")))]
7730
+       ""
7731
+       "XOR    -1,%L0\n\tXOR\t-1,%H0\n\tADD\t1,%L0\n\tADD.C\t1,%H0"
7732
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7733
+;
7734
+(define_insn "absdi2"
7735
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7736
+               (abs:ZI (match_operand:ZI 1 "register_operand" "0")))
7737
+       (clobber (match_scratch:SI 2 "=r"))]
7738
+       ""
7739
+       "CLR    %2
7740
+       TEST    %H0             ; Problem, we can't tell conditions
7741
+       LDILO.LT        1,%2
7742
+       XOR.LT  -1,%L0
7743
+       XOR.LT  -1,%H0
7744
+       ADD     %2,%L0
7745
+       ADD.C   %1,%HI"
7746
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7747
+(define_insn "one_cmpldi2"
7748
+       [(set (match_operand:DI 0 "register_operand" "=r")
7749
+               (not:DI (match_operand:DI 1 "register_operand" "0")))
7750
+       ]
7751
+       ""
7752
+       "XOR    -1,%L0\n\tXOR\t-1,%H0"
7753
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7754
+(define_insn "umindi3"
7755
+       [(set (match_operand:DI 0 "register_operand" "=r")
7756
+               (umin:DI (match_operand:DI 1 "register_operand" "%0")
7757
+                       (match_operand:DI 2 "register_operand" "r")))
7758
+       ]
7759
+       ""
7760
+       "CMP    %H0,%H2
7761
+       CMP.Z   %L0,%L2
7762
+       MOV.C   %H2,%H0
7763
+       MOV.C   %L2,%L0"
7764
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7765
+(define_insn "umaxdi3"
7766
+       [(set (match_operand:DI 0 "register_operand" "=r")
7767
+               (umax:DI (match_operand:DI 1 "register_operand" "%0")
7768
+                       (match_operand:DI 2 "register_operand" "r")))
7769
+       ]
7770
+       ""
7771
+       "CMP    %H2,%H0
7772
+       CMP.Z   %L2,%L0
7773
+       MOV.C   %H2,%H0
7774
+       MOV.C   %L2,%L0"
7775
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7776
+(define_insn "popcountdi2"
7777
+       [(set (match_operand:SI 0 "register_operand" "=r")
7778
+               (popcount (match_operand:DI 1 "register_operand" "r")))
7779
+       (clobber (match_scratch:SI 2 "=r"))
7780
+       ]
7781
+       ""
7782
+       "POPC   %L1,%0
7783
+       POPC    %H1,%2
7784
+       ADD     %2,%0"
7785
+       [(set_attr "predicable" "no") (set_attr "ccresult" "set")])
7786
+(define_expand "paritydi2"
7787
+       [(set (match_operand:SI 0 "register_operand" "=r")
7788
+               (popcount (match_operand:DI 1 "register_operand" "r")))
7789
+       (set (match_dup 0) (and:SI (match_dup 0) (const_int -2)))
7790
+       ])
7791
+;
7792
+; Still missing DI instructions for smin:DI, smax:DI, movdicc, adddicc,
7793
+;      mult:di, div:di, divu:di
7794
+;
7795
+;
7796
+;
7797
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7798
+;;
7799
+;; Conditional arithmetic instructions
7800
+;;
7801
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7802
+;
7803
+;
7804
+;
7805
+;
7806
+(define_expand "cstore<mode>4" ; Store 0 or 1 in %0 based on cmp between %2&%3
7807
+       [(set (cc0) (compare (match_operand:ZI 2 "register_operand" "r")
7808
+               (match_operand:ZI 3 "nonmemory_operand" "rO")))
7809
+       (set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
7810
+                       (match_operator 1 "ordered_comparison_operator"
7811
+                                       [(cc0) (const_int 0)])
7812
+                       (const_int 1) (const_int 0)))]
7813
+       ""
7814
+       )
7815
+(define_insn "cstoredi4" ; Store 0 or 1 in %0 based on cmp between %2&%3
7816
+       [(set (match_operand:SI 0 "register_operand" "=r")
7817
+               (if_then_else:SI (match_operator 1 "ordered_comparison_operator"
7818
+                       [(compare (match_operand:DI 2 "register_operand" "r")
7819
+                               (match_operand:DI 3 "register_operand" "r"))])
7820
+                       (const_int 1) (const_int 0)))]
7821
+       ""
7822
+       {
7823
+               switch(GET_CODE(operands[1])) {
7824
+               case EQ:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.Z\t1,%0\n";
7825
+               case NE:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.NZ\t%L3,%L2\n\tLDILO.NZ\t1,%0\n";
7826
+               case LTU:       return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.C\t1,%0\n";
7827
+               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";
7828
+               case GTU:       return "CLR\t%0\n\tCMP\t%H2,%H3\n\tCMP.Z\t%L2,%L3\n\tLDILO.C\t1,%0\n";
7829
+               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";
7830
+               default:
7831
+                       gcc_unreachable();
7832
+               }
7833
+       }
7834
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7835
+;
7836
+;
7837
+;
7838
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7839
+;;
7840
+;; Comparison instructions, both compare and test
7841
+;;
7842
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7843
+;
7844
+;
7845
+;
7846
+;; This will only work so well, since the direction of the compare is
7847
+;; important in unsigned compares.
7848
+;;
7849
+(define_insn "cmp<mode>"
7850
+       [(set (cc0) (compare (match_operand:ZI 0 "register_operand" "r")
7851
+               (match_operand:ZI 1 "nonmemory_operand" "rO")))]
7852
+       ""
7853
+       "CMP\t%1,%0"
7854
+       [(set_attr "ccresult" "set")])
7855
+(define_insn "cmp<mode>_off"
7856
+       [(set (cc0) (compare (match_operand:ZI 0 "register_operand" "r")
7857
+               (plus:ZI (match_operand:ZI 1 "register_operand" "r")
7858
+                       (match_operand:ZI 2 "const_int_operand" "N"))))]
7859
+       ""
7860
+       "CMP\t%2+%1,%0"
7861
+       [(set_attr "ccresult" "set")])
7862
+(define_insn "test<mode>"
7863
+       [(set (cc0) (compare (and:ZI (match_operand:ZI 0 "register_operand" "r")
7864
+                               (match_operand:ZI 1 "nonmemory_operand" "rO"))
7865
+                       (const_int 0)))]
7866
+       ""
7867
+       "TEST   %1,%0"
7868
+       [(set_attr "ccresult" "set")])
7869
+(define_insn "test<mode>_off"
7870
+       [(set (cc0) (compare (and:ZI (match_operand:ZI 0 "register_operand" "r")
7871
+                               (plus:ZI
7872
+                                 (match_operand:ZI 1 "register_operand" "r")
7873
+                                 (match_operand:ZI 2 "const_int_operand" "N")))
7874
+                       (const_int 0)))]
7875
+       ""
7876
+       "TEST   %2+%1,%0"
7877
+       [(set_attr "ccresult" "set")])
7878
+(define_insn "nop"
7879
+       [(const_int 0)]
7880
+       ""
7881
+       "NOOP"
7882
+       [(set_attr "ccresult" "unchanged")])
7883
+;
7884
+;
7885
+;
7886
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7887
+;;
7888
+;; Conditional execution predicates
7889
+;;
7890
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7891
+;
7892
+; Sadly, these aren't complete like they should be.  Although these are all of
7893
+; the conditional execution prefixes that the Zip CPU supports, GCC looks for
7894
+; other conditions then these.  That is, (cond_exec ...) is not as well
7895
+; recognized as (if_then_else ...).  So we have to duplicate things to support
7896
+; both methods.
7897
+;
7898
+(define_cond_exec
7899
+       [(ne (cc0) (const_int 0))]
7900
+       ""
7901
+       "(NZ)"
7902
+       [(set_attr "conditional" "yes")])
7903
+(define_cond_exec
7904
+       [(lt (cc0) (const_int 0))]
7905
+       ""
7906
+       "(LT)"
7907
+       [(set_attr "conditional" "yes")])
7908
+(define_cond_exec
7909
+       [(eq (cc0) (const_int 0))]
7910
+       ""
7911
+       "(Z)"
7912
+       [(set_attr "conditional" "yes")])
7913
+(define_cond_exec
7914
+       [(gt (cc0) (const_int 0))]
7915
+       ""
7916
+       "(GT)"
7917
+       [(set_attr "conditional" "yes")])
7918
+(define_cond_exec
7919
+       [(ge (cc0) (const_int 0))]
7920
+       ""
7921
+       "(GE)"
7922
+       [(set_attr "conditional" "yes")])
7923
+(define_cond_exec
7924
+       [(ltu (cc0) (const_int 0))]
7925
+       ""
7926
+       "(C)"
7927
+       [(set_attr "conditional" "yes")])
7928
+;
7929
+;
7930
+;
7931
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7932
+;;
7933
+;; Conditional move instructions, since these won't accept conditional
7934
+;;     execution RTL
7935
+;;
7936
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7937
+;
7938
+; // Look for #define HAVE_conditional_move to understand how these might be
7939
+; // used.
7940
+;
7941
+(define_insn "set_zero_or_one<mode>"
7942
+       [(set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
7943
+                       (match_operator 1 "ordered_comparison_operator"
7944
+                                       [(cc0) (const_int 0)])
7945
+                       (const_int 1) (const_int 0)))]
7946
+       ""
7947
+       { return (zip_set_zero_or_one(operands[1], operands[0]));
7948
+       }
7949
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7950
+(define_insn "mov<mode>cc"
7951
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7952
+               (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
7953
+                       [(cc0) (const_int 0)])
7954
+                       (match_operand:ZI 2 "general_operand" "rio")
7955
+                       (match_operand:ZI 3 "nonmemory_operand" "rio")))]
7956
+       ""
7957
+       {
7958
+       return zip_movsicc(operands[0], operands[1], operands[2], operands[3]);
7959
+       }
7960
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7961
+(define_insn "add<mode>cc"
7962
+       [(set (match_operand:ZI 0 "register_operand" "=r,r")
7963
+               (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
7964
+                       [(cc0) (const_int 0)])
7965
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "0,r")
7966
+                               (match_operand:ZI 3 "nonmemory_operand" "rO,M"))
7967
+                       (match_dup 0)))]
7968
+       ""
7969
+       {
7970
+       return zip_addsicc(operands[0], operands[1], operands[2], operands[3]);
7971
+       }
7972
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7973
+;
7974
+;
7975
+;(define_expand "mov<mode>cc"
7976
+;      [(set (match_operand:ZI 0 "general_operand" "=rm,rm,r,r,r"
7977
+;              (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
7978
+;                      [(cc0) (const_int 0)])
7979
+;                      (match_operand:ZI 2 "general_operand" "0,r,0,m,rm")
7980
+;                      (match_operand:ZI 3 "general_operand" "r,0,m,0,rm"))))]
7981
+;      )
7982
+;
7983
+;
7984
+;
7985
+; While an interesting approach, the following suffers from problems when the
7986
+; move amount is constant.  At anything less than four, moves should not require
7987
+; the movmemSI instruction.  At anything greater, if constant, the initial tests
7988
+; are not required and should result in a hardcoded result.  Practically,
7989
+; though, this should really be a define_expand instruction, calling on the
7990
+; RTX's of all the respective subinstructions found below.
7991
+;
7992
+;(define_insn "movmemSI"
7993
+;      [(parallel [(set (mem:BLK (match_operand 0 "register_operand" "+r"));Dst
7994
+;                      (mem:BLK (match_operand 1 "register_operand" "+r")));Src
7995
+;              (use (match_operand:SI 2 "register_operand" "+r"))]); Length
7996
+;              (match_operand 3 "" "")                 ;Alignment
7997
+;              (clobber (match_scratch:SI 4 "=r"))
7998
+;              (clobber (match_scratch:SI 5 "=r"))
7999
+;              (clobber (match_scratch:SI 6 "=r"))
8000
+;              (clobber (match_scratch:SI 7 "=r"))]
8001
+;      ""
8002
+;      "TEST\t1,%2
8003
+;      LOD.NZ\t%1,%4
8004
+;      STO.NZ\t%4,%0
8005
+;      ADD.NZ\t1,%0
8006
+;      ADD.NZ\t1,%1
8007
+;      TEST\t2,%2
8008
+;      LOD.NZ\t%1,%4
8009
+;      LOD.NZ\t1(%1),%5
8010
+;      STO.NZ\t%4,(%0)
8011
+;      STO.NZ\t%4,1(%0)
8012
+;      ADD.NZ\t2,%0
8013
+;      ADD.NZ\t2,%1
8014
+;      AND\t-4,%2
8015
+;      BZ\t.Lskp%=\n.Ltop%=:
8016
+;      LOD\t(%1),%4
8017
+;      LOD\t1(%1),%5
8018
+;      LOD\t2(%1,%6
8019
+;      LOD\t3(%1),%7
8020
+;      STO\t%4,(%1)
8021
+;      STO\t%5,1(%1)
8022
+;      STO\t%6,2(%1)
8023
+;      STO\t%7,3(%1)
8024
+;      SUB\t4,%2
8025
+;      BZ\t%.Lskp%=
8026
+;      BRA\t.Ltop%=\n.Lskp%=:"
8027
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8028
+;(define_insn "setmemsi"
8029
+;      [(parallel
8030
+;              [(set (mem:BLK
8031
+;                      (match_operand 0 "register_operand" "+r")); Destination
8032
+;                      (match_operand:SI 2 "register_operand" "r")) ; Source
8033
+;              (use (match_operand:SI 1 "register_operand" "+r"))])  ; Length
8034
+;              (match_operand 3 "" "")]
8035
+;      ""
8036
+;      "TEST\t1,%1
8037
+;      STO.NZ\t%2,(%0)
8038
+;      ADD.NZ\t1,%0
8039
+;      TEST\t2,%1
8040
+;      STO.NZ\t%2,(%0)
8041
+;      STO.NZ\t%2,1(%0)
8042
+;      ADD.NZ\t2,%0
8043
+;      AND\t-4,%1
8044
+;      BZ\t.Lskp%=\n.Ltop%=:\n
8045
+;      STO\t%2,(%0)
8046
+;      STO\t%2,1(%0)
8047
+;      STO\t%2,2(%0)
8048
+;      STO\t%2,3(%0)
8049
+;      SUB\t%4,%0
8050
+;      BZ\t.Lskp%=
8051
+;      BRA\t.Ltop%=\n.Lskp%=:"
8052
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8053
+;;
8054
+;
8055
+;
8056
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8057
+;;
8058
+;; Control flow instructions
8059
+;;
8060
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8061
+;
8062
+;
8063
+;
8064
+(define_expand "jump"
8065
+       [(set (pc)
8066
+               (label_ref (match_operand 0 "" "")))]); // Was general-op, "mro"
8067
+(define_insn "jump_const"      ; Must be modeless, VOIDmode, not SI or any othr
8068
+       [(set (pc)      ; Otherwise it won't accept jumps to labels
8069
+               (match_operand:SI 0 "zip_const_address_operand_p" ""))]
8070
+       ""
8071
+       "BRA    %0"
8072
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8073
+(define_insn "jump_label"      ; Must be modeless, VOIDmode, not SI or any othr
8074
+       [(set (pc)      ; Otherwise it won't accept jumps to labels
8075
+               (label_ref (match_operand 0 "" "")))]
8076
+       ""
8077
+       "BRA    %0"
8078
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8079
+;
8080
+; This is really the same thing as an indirect jump ... the big difference
8081
+; is that the zip_address_operand_p checks for an "N" type condition, not an
8082
+; "M" type condition ... a bug, but one that works for now.  (The assembler
8083
+; should be able to catch and except on it ...)
8084
+;
8085
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
8086
+(define_insn "jump_variable"
8087
+       [(set (pc)
8088
+               (match_operand:SI 0 "zip_address_operand_p" ""))]
8089
+       ""
8090
+       "JMP    %0"
8091
+       [(set_attr "ccresult" "unchanged")])
8092
+;
8093
+; Indirect jumps ... both to registers, and registers plus offsets
8094
+;
8095
+(define_insn "indirect_jump"
8096
+       [(set (pc)
8097
+               (match_operand:SI 0 "register_operand" "r"))]
8098
+       ""
8099
+       "JMP    %0"
8100
+       [(set_attr "ccresult" "unchanged")])
8101
+(define_insn "indirect_jump_mem"
8102
+       [(set (pc) (match_operand:SI 0 "zip_memory_operand_p" "o"))]
8103
+       ""
8104
+       "LOD    %0,PC"
8105
+       [(set_attr "ccresult" "unchanged")])
8106
+(define_insn "indirect_jump_off"
8107
+       [(set (pc)
8108
+               (plus:SI (match_operand:SI 0 "register_operand" "r")
8109
+                       (match_operand:SI 1 "const_int_operand" "M")))]
8110
+       ""
8111
+       "JMP    %1(%0)"
8112
+       [(set_attr "ccresult" "unchanged")])
8113
+;;
8114
+; cbranchsi4
8115
+;;     Op 0 = the comparison operator (le,lt,eq,ne,gt,ge,and usgn ltu,geu,etc.)
8116
+;;     Op 1&2 the operands of the compare instruction
8117
+;;     Op 3 is the jump label
8118
+;;
8119
+;;
8120
+;; #warning Need to adjust this so that the "LT" code doesnt get generated ...
8121
+;;
8122
+(define_expand "cbranch<mode>4"
8123
+       [(set (cc0) (compare (match_operand:ZI 1 "register_operand" "r")
8124
+               (match_operand:ZI 2 "nonmemory_operand" "rO")))
8125
+       (set (pc) (if_then_else (match_operator 0 "ordered_comparison_operator"
8126
+                       [(cc0) (const_int 0)])
8127
+                       (label_ref (match_operand 3 "" ""))
8128
+                       (pc)))]
8129
+       ""
8130
+       {
8131
+               // extern void zip_debug_rtx(const_rtx);
8132
+               //; Two branches give us no end of difficulty when implementing.
8133
+               //; Let's check for these two branch codes, and swap the
8134
+               //; comparison to simplify them.
8135
+               // fprintf(stderr, "CBRANCH\n");
8136
+               // zip_debug_rtx(operands[0]);
8137
+               // zip_debug_rtx(operands[1]);
8138
+               // zip_debug_rtx(operands[2]);
8139
+               // zip_debug_rtx(operands[3]);
8140
+               if ((GET_CODE(operands[0])==GTU)&&(REG_P(operands[2]))) {
8141
+                       // fprintf(stderr, "CBRANCH:(GTU,?,REG,?)\n");
8142
+                       emit_insn(gen_rtx_SET(VOIDmode, cc0_rtx,
8143
+                               gen_rtx_COMPARE(VOIDmode, operands[2], operands[1])));
8144
+                       emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8145
+                       DONE;
8146
+               } else if((GET_CODE(operands[0])==GEU)&&(REG_P(operands[2]))) {
8147 103 dgisselq
+                       // fprintf(stderr, "CBRANCH:(GEU,?,REG,?)\n");
8148 102 dgisselq
+                       emit_insn(gen_rtx_SET(VOIDmode, cc0_rtx,
8149
+                               gen_rtx_COMPARE(VOIDmode, operands[2], operands[1])));
8150
+                       emit_jump_insn(gen_cbranch_jmp_leu(operands[3]));
8151
+                       DONE;
8152
+               } // ; Otherwise ... just handle the branch normally
8153
+
8154
+               //; Except ... we can do better for some instructions, such as
8155
+               //; LE.  While we could exchange CMP Rx,Ry into -1(Rx),Ry, it
8156
+               //; would be difficult to explain to users why MIN_INT didn't
8157
+               //; compare properly.  Hence we only adjust constant integers.
8158
+               //;
8159
+               if ((GET_CODE(operands[0])==LE)
8160
+                               &&(CONST_INT_P(operands[2]))
8161
+                               &&(INTVAL(operands[2])>(1<<17)-2)) {
8162
+                       // fprintf(stderr, "CBRANCH:(LE,?,#,?)\n");
8163
+                       emit_insn(gen_rtx_SET(VOIDmode, cc0_rtx,
8164
+                               gen_rtx_COMPARE(VOIDmode, operands[1],
8165
+                                       GEN_INT(INTVAL(operands[2])+1))));
8166 111 dgisselq
+                       emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
8167 102 dgisselq
+                       DONE;
8168
+               } else if ((GET_CODE(operands[0])==LEU)
8169
+                               &&(CONST_INT_P(operands[2]))
8170
+                               &&(INTVAL(operands[2])<(1<<17)-2)) {
8171
+                       // fprintf(stderr, "CBRANCH:(LEU,?,#,?)\n");
8172
+                       emit_insn(gen_rtx_SET(VOIDmode, cc0_rtx,
8173
+                               gen_rtx_COMPARE(VOIDmode, operands[1],
8174
+                                       GEN_INT(INTVAL(operands[2])+1))));
8175 111 dgisselq
+                       emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8176 102 dgisselq
+                       DONE;
8177
+               }
8178
+       })
8179
+(define_insn "cbranch_jmp_eq"
8180
+       [(set (pc) (if_then_else (eq (cc0) (const_int 0))
8181
+                (label_ref (match_operand 0 "" ""))
8182
+                (pc)))]
8183
+       ""
8184
+       "BZ\t%0"
8185
+       [(set_attr "predicable" "no")
8186
+               (set_attr "conditional" "yes")
8187
+               (set_attr "ccresult" "unchanged")])
8188
+(define_insn "cbranch_jmp_neq"
8189
+       [(set (pc) (if_then_else (ne (cc0) (const_int 0))
8190
+                (label_ref (match_operand 0 "" ""))
8191
+                (pc)))]
8192
+       ""
8193
+       "BNZ\t%0"
8194
+       [(set_attr "predicable" "no")
8195
+               (set_attr "conditional" "yes")
8196
+               (set_attr "ccresult" "unchanged")])
8197
+(define_insn "cbranch_jmp_lt"
8198
+       [(set (pc) (if_then_else (lt (cc0) (const_int 0))
8199
+                (label_ref (match_operand 0 "" ""))
8200
+                (pc)))]
8201
+       ""
8202
+       "BLT\t%0"
8203
+       [(set_attr "predicable" "no")
8204
+               (set_attr "conditional" "yes")
8205
+               (set_attr "ccresult" "unchanged")])
8206
+(define_insn "cbranch_jmp_le"
8207
+       [(set (pc) (if_then_else (le (cc0) (const_int 0))
8208
+                (label_ref (match_operand 0 "" ""))
8209
+                (pc)))]
8210
+       ""
8211
+       "BLT\t%0
8212
+       BZ\t%0"
8213
+       [(set_attr "predicable" "no")
8214
+               (set_attr "conditional" "yes")
8215
+               (set_attr "ccresult" "unchanged")])
8216
+(define_insn "cbranch_jmp_gt"
8217
+       [(set (pc) (if_then_else (gt (cc0) (const_int 0))
8218
+                (label_ref (match_operand 0 "" ""))
8219
+                (pc)))]
8220
+       ""
8221
+       "BGT\t%0"
8222
+       [(set_attr "predicable" "no")
8223
+               (set_attr "conditional" "yes")
8224
+               (set_attr "ccresult" "unchanged")])
8225
+(define_insn "cbranch_jmp_ge"
8226
+       [(set (pc) (if_then_else (ge (cc0) (const_int 0))
8227
+                (label_ref (match_operand 0 "" ""))
8228
+                (pc)))]
8229
+       ""
8230
+       "BGE\t%0"
8231
+       [(set_attr "predicable" "no")
8232
+               (set_attr "conditional" "yes")
8233
+               (set_attr "ccresult" "unchanged")])
8234
+(define_insn "cbranch_jmp_ltu"
8235
+       [(set (pc) (if_then_else (ltu (cc0) (const_int 0))
8236
+                (label_ref (match_operand 0 "" ""))
8237
+                (pc)))]
8238
+       ""
8239
+       "BC\t%0"
8240
+       [(set_attr "predicable" "no")
8241
+               (set_attr "conditional" "yes")
8242
+               (set_attr "ccresult" "unchanged")])
8243
+(define_insn "cbranch_jmp_gtu"
8244
+       [(set (pc) (if_then_else (gtu (cc0) (const_int 0))
8245
+                (label_ref (match_operand 0 "" ""))
8246
+                (pc)))]
8247
+       ""      ; Flip the condition, and then we can jump
8248
+       "XOR\t2,CC
8249
+       BC\t%0"
8250
+       [(set_attr "predicable" "no")
8251
+               (set_attr "conditional" "yes")
8252
+               (set_attr "ccresult" "unknown")])
8253
+(define_insn "cbranch_jmp_leu"
8254
+       [(set (pc) (if_then_else (leu (cc0) (const_int 0))
8255
+                (label_ref (match_operand 0 "" ""))
8256
+                (pc)))]
8257
+       ""      ; Need to check for both LTU (i.e. C) and Z
8258
+       "BC\t%0
8259
+       BZ\t%0"
8260
+       [(set_attr "predicable" "no")
8261
+               (set_attr "conditional" "yes")
8262
+               (set_attr "ccresult" "unchanged")])
8263
+(define_insn "cbranch_jmp_geu"
8264
+       [(set (pc) (if_then_else (geu (cc0) (const_int 0))
8265
+                (label_ref (match_operand 0 "" ""))
8266
+                (pc)))]
8267
+       ""      ; Flip the comparison, then check for GEU (once flipped)a
8268
+               ; Z is naturally checked for, as C would've never been set on Z
8269
+               ; so by flipping it, it is tantamount to saying Z or GTU.
8270
+       "BZ\t%0
8271
+       XOR\t2,CC
8272
+       BC\t%0"
8273
+       [(set_attr "predicable" "no")
8274
+               (set_attr "conditional" "yes")
8275
+               (set_attr "ccresult" "unknown")])
8276
+(define_insn "cbranchdi4"
8277
+       [(set (pc) (if_then_else
8278
+               (match_operator 0 "ordered_comparison_operator"
8279
+                       [(match_operand:DI 1 "register_operand" "r")
8280
+                               (match_operand:DI 2 "nonmemory_operand" "rO")])
8281
+                       (label_ref (match_operand 3 "" ""))
8282
+                       (pc)))
8283
+       (clobber (cc0))]
8284
+       ""
8285
+       {
8286
+               switch(GET_CODE(operands[0])) {
8287
+               case EQ:
8288
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBZ\t%3";
8289
+               case NE:
8290
+                       return "CMP\t%H2,%H1\n\tCMP.NZ\t%L2,%L1\n\tBNZ\t%3";
8291
+               case LE:
8292
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
8293
+               case GT:
8294
+                       return "CMP\t%H1,%H2\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L1,%L2\n\tBC\t%3\n.Ldi%=:";
8295
+               case LT:
8296
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L2,%L1\n\tBC\t%3\n.Ldi%=:";
8297
+               case GE:
8298
+                       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%=:";
8299
+               case LTU:
8300
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n";
8301
+               case LEU:
8302
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
8303
+               case GTU:
8304
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\n";
8305
+               case GEU:
8306
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\nBZ\t%3";
8307
+               default:
8308
+                       gcc_unreachable();
8309
+               }
8310
+       }
8311
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8312
+;
8313
+;
8314
+;
8315
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8316
+;;
8317
+;; Subroutine call
8318
+;;
8319
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8320
+;
8321
+;
8322
+; There are two types of calls: "call" and "call_value".
8323
+;
8324
+; Each of these types of calls are then expanded into one of:
8325
+;
8326
+;      _const          - A call to a constant address, such as a symbol
8327
+;                      reference or a fixed location
8328
+;
8329
+;      _label          - This should be the same as _const, except that for
8330
+;                      some reason the RTL and matching rules are separate.
8331
+;                      Hence we have a separate rule for this.
8332
+;
8333
+;      _mem            - The memory address we wish to jump to is stored in
8334
+;                      memory somewhere, and we have only a pointer.  In this
8335
+;                      case, we load that pointer straight to the PC and go.
8336
+;
8337
+;      _var            - The address to jump to is given as an offset to a
8338
+;                      register, such as X+R3.  This is an indirect jump.
8339
+;                      Although we support it, it does require different RTL
8340
+;                      code.
8341
+;
8342
+(define_expand "call"
8343
+       [(call (match_operand 0 "" "")
8344
+               (match_operand 1 "" ""))]
8345
+       ""
8346
+       {
8347
+               if (MEM_P(operands[0])) {
8348
+                       // This should always be the case
8349
+                       rtx addr = XEXP(operands[0],0);
8350
+                       if (zip_const_address_operand_p(addr, SImode)) {
8351
+                               // fprintf(stderr, "Generating gen_void_call_const()\n");
8352
+                               emit_call_insn(gen_void_call_const(addr,
8353
+                                               operands[1]));
8354
+                       } else if ((MEM_P(addr))&&(zip_address_operand(
8355
+                                                       XEXP(addr,0)))) {
8356
+                               emit_call_insn(gen_void_call_mem(XEXP(addr,0),
8357
+                                                                operands[1]));
8358
+                       } else {
8359
+                               emit_call_insn(gen_void_call_var(addr,
8360
+                                                                operands[1]));
8361
+                       }
8362
+                       DONE;
8363
+               }
8364
+       })
8365
+;
8366
+;
8367
+;
8368
+; How do we want to do this better?
8369
+;      Replace the RTL w/
8370
+;              return_label= gen_label_rtx();
8371
+;              emit_movsi(gen_rtx_REG(zip_R0),plus_constant(
8372
+;                      gen_rtx_REG(zip_PC),return_label));
8373
+;              emit_jump(label_rtx(
8374
+;
8375
+;              emit_label(return_label);
8376
+;
8377
+; The problem is: we can't!  GCC distinguishes between jumps and calls when
8378
+; optimizing, and it doesn't see the need to keep the label around.  Thus, the
8379
+; label gets removed and the call gets lost.  Hence we do it this way (below).
8380
+; I'll probably bastardize a means of getting a new codelabel that GCC doesn't
8381
+; recognize as such, but for now we'll use .Lcall# as our label.
8382
+;
8383
+(define_insn "void_call_const"
8384
+       [(parallel [(call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
8385 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
8386 102 dgisselq
+               (clobber (reg:SI RTN_REG))])]
8387
+       ""
8388
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
8389
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8390
+(define_insn "void_call_mem"
8391 111 dgisselq
+       [(parallel [(call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
8392
+                       (match_operand 1 "const_int_operand" "n"))
8393 102 dgisselq
+               (clobber (reg:SI RTN_REG))])]
8394
+       ""
8395
+       "MOV    .Lcall%=(PC),R0\;LOD\t%0,PC\n.Lcall%=:"
8396
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8397
+;
8398
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
8399
+(define_insn "void_call_var"
8400
+       [(parallel [(call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
8401 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
8402 102 dgisselq
+               (clobber (reg:SI RTN_REG))])]
8403
+       ""
8404
+       "MOV    .Lcall%=(PC),R0\;JMP\t%0\n.Lcall%=:"
8405
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8406
+(define_expand "call_value"
8407
+       [(set (reg:SI RTNV_REG)
8408
+               (call (match_operand:SI 1 "" "")
8409 111 dgisselq
+                       (match_operand 2 "const_int_operand" "n")))
8410 102 dgisselq
+       (set (match_operand:SI 0 "register_operand" "=r") (reg:SI RTNV_REG))]
8411
+       ""
8412
+       {
8413
+               // extern void zip_debug_rtx(const_rtx);
8414
+               // fprintf(stderr, "ZIP.MD::CALL-VALUE()\n");
8415
+               // zip_debug_rtx(operands[1]);
8416
+               if (MEM_P(operands[1])) {
8417
+                       // fprintf(stderr, "ZIP.MD::CALL-VALUE() MEM_P\n");
8418
+                       // zip_debug_rtx(operands[1]);
8419
+                       // This should always be the case
8420
+                       rtx addr = XEXP(operands[1],0);
8421
+                       if (zip_const_address_operand_p(addr, SImode)) {
8422
+                               // fprintf(stderr, "Generating gen_reg_call_const()\n");
8423
+                               emit_call_insn(gen_reg_call_const(addr, operands[2]));
8424
+                       } else if ((MEM_P(addr))&&(zip_address_operand(XEXP(addr,0)))) {
8425
+                               // fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
8426
+                               emit_call_insn(gen_reg_call_mem(XEXP(addr,0), operands[2]));
8427
+                       } else {
8428
+                               // fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
8429
+                               emit_call_insn(gen_reg_call_var(addr, operands[2]));
8430
+                       }
8431
+                       DONE;
8432
+               }
8433
+       })
8434
+(define_insn "reg_call_const"
8435
+       [(parallel [(set (reg:SI RTNV_REG)
8436
+               (call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
8437 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n")))
8438 102 dgisselq
+               (clobber (reg:SI RTN_REG))])]
8439
+       ""
8440
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
8441
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8442
+(define_insn "reg_call_mem"
8443
+       [(set (reg:SI RTNV_REG)
8444 111 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
8445
+                       (match_operand 1 "const_int_operand" "n")))
8446 102 dgisselq
+               (clobber (reg:SI RTN_REG))]
8447
+       ""
8448 111 dgisselq
+       "MOV    .Lcall%=(PC),R0\n\tLOD\t%0,PC\n.Lcall%=:"
8449 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8450 111 dgisselq
+;
8451 102 dgisselq
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
8452
+(define_insn "reg_call_var"
8453
+       [(parallel [(set (reg:SI RTNV_REG)
8454
+               (call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
8455 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n")))
8456 102 dgisselq
+               (clobber (reg:SI RTN_REG))])]
8457
+       ""
8458 111 dgisselq
+       "MOV    .Lcall%=(PC),R0\n\tJMP\t%0\n.Lcall%=:"
8459 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8460
+;
8461
+;
8462
+;
8463
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8464
+;;
8465
+;; Frame manipulation RTX
8466
+;;
8467
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8468
+;
8469
+;
8470
+;
8471
+(define_expand "prologue"
8472
+       [(const_int 0)]
8473
+       ""
8474
+       "{ zip_expand_prologue(); DONE; }")
8475
+(define_expand "epilogue"
8476
+       [(return)]
8477
+       ""
8478
+       "{ zip_expand_epilogue(); DONE; }")
8479
+(define_expand "return" ; In order to use the function predicate, this *must*
8480
+       [(return)]      ; be a define_expand
8481
+       "zip_use_return_insn()")
8482
+       ; "JMP  R0"
8483
+       ; [(set_attr "ccresult" "unchanged")])
8484
+(define_insn "*return" ; A "*" -- means it cannot be called from C
8485
+       [(return)]
8486
+       ""
8487
+       "JMP    R0"
8488
+       [(set_attr "ccresult" "unchanged")])
8489
+(define_insn "simple_return"   ; A "*" -- means it cannot be called from C
8490
+       [(simple_return)]
8491
+       ""
8492
+       "JMP    R0"
8493
+       [(set_attr "ccresult" "unchanged")])
8494
+;
8495
+;
8496
+;
8497
+;;;;;;;;;;;;;;;;;;;;;;;;;;
8498
+;;
8499
+;; Zip Builtin Functions
8500
+;;
8501
+;;;;;;;;;;;;;;;;;;;;;;;;;;
8502
+;
8503
+;
8504
+;
8505
+(define_insn "zip_rtu"
8506
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_RTU)
8507
+       (clobber (cc0))]
8508
+       "(!ZIP_USER)"
8509
+       "RTU"
8510
+       [(set_attr "ccresult" "unknown")])
8511
+(define_insn "zip_halt" ; Needs to be unspec_volatile, or optimizer will opt out
8512
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_HALT)
8513
+       (clobber (cc0))]
8514
+       "(!ZIP_USER)"
8515
+       "HALT"
8516
+       [(set_attr "ccresult" "unknown")])
8517
+(define_insn "zip_idle"
8518
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_IDLE)
8519
+       (clobber (cc0))]
8520
+       ""
8521
+       "WAIT"
8522
+       [(set_attr "ccresult" "unknown")])
8523
+(define_insn "zip_syscall"
8524
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_SYSCALL)]
8525
+       ""
8526
+       "CLR\tCC"
8527
+       [(set_attr "ccresult" "unknown")])
8528
+;
8529
+;
8530
+; Operator "save_context"
8531
+;
8532
+;      operand 0 missing output reload ... ?
8533
+;
8534
+(define_insn "zip_save_context"
8535
+       [(parallel [
8536
+               (unspec_volatile
8537
+                       [ (match_operand:SI 0 "register_operand" "r") ]
8538
+                       UNSPEC_SAVE_CONTEXT)
8539
+               (clobber (match_scratch:SI 1 "=r"))
8540
+               (clobber (match_scratch:SI 2 "=r"))
8541
+               (clobber (match_scratch:SI 3 "=r"))
8542
+               (clobber (match_scratch:SI 4 "=r"))
8543
+               (use (match_dup 0))])]
8544
+       "(!ZIP_USER)"
8545
+       "MOV\tuR0,%1
8546
+       MOV\tuR1,%2
8547
+       MOV\tuR2,%3
8548
+       MOV\tuR3,%4
8549
+       STO\t%1,%0
8550
+       STO\t%2,1(%0)
8551
+       STO\t%3,2(%0)
8552
+       STO\t%4,3(%0)
8553
+       MOV\tuR4,%1
8554
+       MOV\tuR5,%2
8555
+       MOV\tuR6,%3
8556
+       MOV\tuR7,%4
8557
+       STO\t%1,4(%0)
8558
+       STO\t%2,5(%0)
8559
+       STO\t%3,6(%0)
8560
+       STO\t%4,7(%0)
8561
+       MOV\tuR8,%1
8562
+       MOV\tuR9,%2
8563
+       MOV\tuR10,%3
8564
+       MOV\tuR11,%4
8565
+       STO\t%1,8(%0)
8566
+       STO\t%2,9(%0)
8567
+       STO\t%3,10(%0)
8568
+       STO\t%4,11(%0)
8569
+       MOV\tuR12,%1
8570
+       MOV\tuSP,%2
8571
+       MOV\tuCC,%3
8572
+       MOV\tuPC,%4
8573
+       STO\t%1,12(%0)
8574
+       STO\t%2,13(%0)
8575
+       STO\t%3,14(%0)
8576
+       STO\t%4,15(%0)"
8577
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8578
+(define_insn "zip_restore_context"
8579
+       [(unspec_volatile [
8580
+               (match_operand:SI 0 "register_operand" "r")] UNSPEC_RESTORE_CONTEXT)
8581
+               ; (match_scratch:SI 1 "r")
8582
+               ; (match_scratch:SI 2 "r")
8583
+               ; (match_scratch:SI 3 "r")
8584
+               ; (match_scratch:SI 4 "r")] 6)
8585
+       (clobber (match_scratch:SI 1 "=r"))
8586
+       (clobber (match_scratch:SI 2 "=r"))
8587
+       (clobber (match_scratch:SI 3 "=r"))
8588
+       (clobber (match_scratch:SI 4 "=r"))
8589
+       (use (match_dup 0))]
8590
+       "(!ZIP_USER)"
8591
+       "LOD\t0(%0),%1
8592
+       LOD\t1(%0),%2
8593
+       LOD\t2(%0),%3
8594
+       LOD\t3(%0),%4
8595
+       MOV\t%1,uR0
8596
+       MOV\t%2,uR1
8597
+       MOV\t%3,uR2
8598
+       MOV\t%4,uR3
8599
+       LOD\t4(%0),%1
8600
+       LOD\t5(%0),%2
8601
+       LOD\t6(%0),%3
8602
+       LOD\t7(%0),%4
8603
+       MOV\t%1,uR4
8604
+       MOV\t%2,uR5
8605
+       MOV\t%3,uR6
8606
+       MOV\t%4,uR7
8607
+       LOD\t8(%0),%1
8608
+       LOD\t9(%0),%2
8609
+       LOD\t10(%0),%3
8610
+       LOD\t11(%0),%4
8611
+       MOV\t%1,uR8
8612
+       MOV\t%2,uR9
8613
+       MOV\t%3,uR10
8614
+       MOV\t%4,uR11
8615
+       LOD\t12(%0),%1
8616
+       LOD\t13(%0),%2
8617
+       LOD\t14(%0),%3
8618
+       LOD\t15(%0),%4
8619
+       MOV\t%1,uR12
8620
+       MOV\t%2,uSP
8621
+       MOV\t%3,uCC
8622
+       MOV\t%4,uPC"
8623
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8624
+(define_insn "zip_bitrev"
8625
+       [(set (match_operand:SI 0 "register_operand" "=r")
8626
+               (unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_BITREV))
8627
+       ]
8628
+       ""
8629
+       "BREV\t%1,%0"
8630
+       [(set_attr "ccresult" "set")])
8631
+(define_insn "zip_cc"
8632
+       [(set (match_operand:SI 0 "register_operand" "=r")
8633
+               (unspec:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
8634
+       ""
8635
+       "MOV\tCC,%0"
8636
+       [(set_attr "ccresult" "unchanged")])
8637 111 dgisselq
+(define_insn "zip_cc_sto"
8638
+       [(set (mem:SI (match_operand:SI 0 "register_operand" "r"))
8639
+               (unspec:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
8640
+       ""
8641
+       "STO\tCC,(%0)"
8642
+       [(set_attr "ccresult" "unchanged")])
8643
+(define_insn "zip_cc_sto_off"
8644
+       [(set (mem:SI (plus:SI
8645
+                       (match_operand:SI 0 "register_operand" "r")
8646
+                       (match_operand:SI 1 "const_int_operand" "N")))
8647
+               (unspec:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
8648
+       ""
8649
+       "STO\tCC,%1(%0)"
8650
+       [(set_attr "ccresult" "unchanged")])
8651 102 dgisselq
+(define_insn "ldilo"
8652
+       [(set (match_operand:SI 0 "register_operand" "=r")
8653
+               (unspec:SI [(match_operand:SI 1 "immediate_operand" "")] UNSPEC_LDILO))]
8654
+       ""
8655
+       "LDILO  %1,%0"
8656
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
8657
+
8658
+;
8659
+;
8660
+;
8661
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8662
+;;
8663
+;; Floating point Op-codes
8664
+;;
8665
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8666
+;
8667
+;
8668
+;
8669
+(define_insn "addsf3"
8670
+       [(set (match_operand:SF 0 "register_operand" "=r")
8671
+               (plus:SF (match_operand:SF 1 "register_operand" "0")
8672
+                       (match_operand:SF 2 "register_operand" "r")))]
8673
+       "(ZIP_FPU)"
8674
+       "FPADD  %2,%0"
8675
+       [(set_attr "ccresult" "unknown")])
8676
+(define_insn "subsf3"
8677
+       [(set (match_operand:SF 0 "register_operand" "=r")
8678
+               (minus:SF (match_operand:SF 1 "register_operand" "0")
8679
+                       (match_operand:SF 2 "register_operand" "r")))]
8680
+       "(ZIP_FPU)"
8681
+       "FPSUB  %2,%0"
8682
+       [(set_attr "ccresult" "unknown")])
8683
+(define_insn "mulsf3"
8684
+       [(set (match_operand:SF 0 "register_operand" "=r")
8685
+               (mult:SF (match_operand:SF 1 "register_operand" "0")
8686
+                       (match_operand:SF 2 "register_operand" "r")))]
8687
+       "(ZIP_FPU)"
8688
+       "FPMUL  %2,%0"
8689
+       [(set_attr "ccresult" "unknown")])
8690
+(define_insn "divsf3"
8691
+       [(set (match_operand:SF 0 "register_operand" "=r")
8692
+               (div:SF (match_operand:SF 1 "register_operand" "0")
8693
+                       (match_operand:SF 2 "register_operand" "r")))]
8694
+       "(ZIP_FPU)"
8695
+       "FPDIV  %2,%0"
8696
+       [(set_attr "ccresult" "unknown")])
8697 111 dgisselq
+(define_expand "negsf2"
8698
+       [(set (match_operand:SF 0 "register_operand" "=r")
8699
+               (neg:SF (match_operand:SF 1 "register_operand" "0")))
8700
+       ]
8701
+       ""
8702
+       {
8703
+               operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
8704
+               if (can_create_pseudo_p()) {
8705
+                       rtx tmp = gen_reg_rtx(SImode);
8706
+                       emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x80000000,SImode)));
8707
+                       emit_insn(gen_rtx_SET(SImode, operands[0], gen_rtx_XOR(SImode, operands[0], tmp)));
8708
+                       DONE;
8709
+               } else {
8710
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
8711
+                       emit_insn(gen_rtx_SET(SImode, operands[0], gen_rtx_IOR(SImode, operands[0],gen_int_mode(1,SImode))));
8712
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
8713
+                       DONE;
8714
+               }
8715
+       })
8716
+(define_expand "abssf2"
8717
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8718
+               (abs:ZI (match_operand:ZI 1 "register_operand" "0")))
8719
+       ]
8720
+       ""
8721
+       {
8722
+               operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
8723
+               if (can_create_pseudo_p()) {
8724
+                       rtx tmp = gen_reg_rtx(SImode);
8725
+                       emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x7fffffff,SImode)));
8726
+                       emit_insn(gen_rtx_SET(SImode, operands[0], gen_rtx_AND(SImode, operands[0], tmp)));
8727
+                       DONE;
8728
+               } else {
8729
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
8730
+                       emit_insn(gen_rtx_SET(SImode, operands[0],
8731
+                               gen_rtx_AND(SImode, operands[0],
8732
+                               gen_int_mode(-2,SImode))));
8733
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
8734
+                       DONE;
8735
+               }
8736
+       })
8737 102 dgisselq
+;
8738
+;
8739
+;
8740
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8741
+;;
8742
+;; Trap Instruction
8743
+;;
8744
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8745
+;
8746
+;
8747
+; The ZipCPU doesn't really have a "trap" instruction per se.  The goal is that
8748
+; *nothing* should ever trap, and so we should never get here.  However, the
8749
+; compiler seems to want a trap instruction for some reason.  (It keeps us
8750
+; from calling the abort() function, if we don't define these ...)  So let's
8751
+; just grab onto the break instruction and declare it to be a trap instruction
8752
+; for our purposes.  Alternatively, we might've used a syscall, but ... this
8753
+; will work for both user and system instructions.
8754
+;
8755
+(define_insn "trap"
8756
+       [(trap_if (const_int 1) (const_int 0))]
8757
+       ""
8758
+       "BREAK"
8759
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
8760
+;
8761
+(define_expand "ctrap<mode>4"
8762
+       [(set (cc0) (compare (match_operand:ZI 1 "register_operand" "r")
8763
+               (match_operand:ZI 2 "nonmemory_operand" "rO")))
8764
+       (trap_if (match_operator 0 "ordered_comparison_operator"
8765
+                       [(cc0) (const_int 0)])
8766
+                       (match_operand 3 "const_int_operand" "O"))]
8767
+       ""
8768
+       )
8769
+(define_insn "trapif"
8770
+       [(trap_if (match_operator 0 "ordered_comparison_operator"
8771
+                       [(cc0) (const_int 0)])
8772
+                       (match_operand 1 "const_int_operand" "O"))]
8773
+       ""
8774
+       "BREAK\t%1"
8775
+       [(set_attr "predicable" "no")])
8776
+;
8777
+;
8778
+;
8779
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8780
+;;
8781
+;; Unimplemented (or not yet implemented) RTL Codes
8782
+;;
8783
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8784
+;
8785
+;
8786
+;
8787
+; The book says that add<mode>3 is used if addptr<mode>3 is undefined.
8788
+; Hence we leave this as unimplemented.
8789
+;
8790
+;(define_insn "addptrsi3"
8791
+;      [(set (match_operand:SI 0 "register_operand" "=r")
8792
+;              (plus:SI (match_operand:SI 1 "register_operand" "r")
8793
+;                      (match_operand:SI 2 "general_operand" "M")))]
8794
+;      ; Addptr is not allowed to clobber condition codes, thus we *must*
8795
+;      ; use the mov (A+B),C form of the add.
8796
+;      ""
8797
+;      "MOV    %2(%1),%0"
8798
+;      [(set_attr "ccresult" "unchanged")])
8799
+;
8800
+; (define_insn "casesi"
8801
+;      "LDI    %4,R0
8802
+;      SUB     %2,%1
8803
+;      BLT     %5
8804
+;      CMP     %3,%1
8805
+;      BGT     %5
8806
+;      ADD     %1,R0
8807
+;      LOD     (R0),pc"
8808
+;      "")
8809
+; (define_insn "decrement_and_branch_until_zero"
8810
+       ; [(parallel [
8811
+               ; (set (match_operand:SI 0 "regiser_operand" "r")
8812
+                       ; (minus:SI (match_dup 0) (const_int 1)))
8813
+               ; (set (pc) (if_then_else
8814
+                               ; (ge (minus:SI (match_dup 0) (const_int 1)))
8815
+                               ; (label_ref (match_operand 1 "" ""))
8816
+                               ; (pc)))])]
8817
+       ; ""
8818
+; ;    SUB     1,%0
8819
+; ;    BNZ     %1
8820
+; ;     .vice the faster (optimize for speed)
8821
+       ; "SUB  1,%0
8822
+       ; BZ    %=
8823
+       ; BRA   %1
8824
+       ; %=:"
8825
+       ; [(set_attr "predicable" "no") (set_attr "ccresult" "set")])
8826
+; doloop_end - do not define--would require cost of an unopt register to use
8827
+; allocate_stack       - do not define ...
8828
+; nonlocal_goto - do not define
8829
+;(define_insn "ctrapmm4"
8830
+;      CMP     %1,%2
8831
+;      MOV.%0  %3,R0
8832
+;      LDILO.%0 0,(CC)
8833
+;
8834
+;(define_insn "sync_compare_and_swapsi"
8835
+;      [(set ...
8836
+;              )]
8837
+;      "(ZIP_ATMOC)"
8838
+;      LOCK            (alu)           // Hmmm ... need to modify if I will
8839
+;      LOD     %1,%0   OP-VALID        // operate on the value before the store
8840
+;      CMP     %0,%2   DCD-valid
8841
+;      STO.Z   %2,%1   PF-valid
8842
+;
8843
+;(define_insn "sync_lock_test_and_setsi"
8844
+;      LOCK
8845
+;      LOD     %1,%0
8846
+;      STO     %0,%1
8847
+;
8848
+;(define_insn "sync_lock_releasesi"
8849
+;      STO     %1,%0
8850
+;
8851
+;
8852
+;(define_insn "negvsi3"
8853
+;      "MOV    %1,%0
8854
+;      XOR     -1,%0
8855
+;      ADD     1,%0
8856
+;      BV      %2"
8857
+;      "")
8858
+
8859
+;
8860
+; STILL MISSING:
8861
+;      SYSCALL(ID)
8862
+;              MOV %ID,R0
8863
+;              CLR     CC
8864
+;      cmove   ... the conditional move, created from a
8865
+;      (set (match_op 0 "" "r") (if_then_else (condition) (a) (reg X))))
8866
+;      pattern
8867
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
8868
--- gcc-5.3.0-original/gcc/config/zip/zip-modes.def     1969-12-31 19:00:00.000000000 -0500
8869 111 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip-modes.def  2016-03-08 12:10:21.982586940 -0500
8870
@@ -0,0 +1,23 @@
8871 102 dgisselq
+/*
8872
+ * Commends in C-long comment form
8873
+ * class
8874
+ *     Mode = "SI"
8875
+ *     PRECISION, BYTESIZE, COUNT ??
8876
+ *     FORMAT
8877
+ *     EXPR
8878 111 dgisselq
+ *
8879
+ * The manual says I need to define BITS_PER_UNIT here.
8880 102 dgisselq
+ */
8881
+// INT_MODE(QI, 1);
8882
+// INT_MODE(HI, 1);
8883
+// INT_MODE(SI, 1);
8884
+// INT_MODE(DI, 2);
8885
+
8886
+// FLOAT_MODE(SF, 1, ieee_single_format);
8887
+// FLOAT_MODE(DF, 2, ieee_single_format);
8888
+
8889
+// We cannot override machmodes.def from here.  Thus, even though our QI,
8890
+// HI, and SI modes are all 1-byte, we cant set them that way here.  The
8891
+// change needed to be made in machmodes.def.  Hence, here is a target
8892
+// configuration change--in machmodes.def--that properly belonged in the
8893
+// config directory.
8894
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
8895
--- gcc-5.3.0-original/gcc/config/zip/zip-protos.h      1969-12-31 19:00:00.000000000 -0500
8896 111 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip-protos.h   2016-03-12 17:39:02.331344108 -0500
8897
@@ -0,0 +1,70 @@
8898 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
8899
+//
8900
+// Filename:   zip-protos.h
8901
+//
8902
+// Project:    Zip CPU backend for the GNU Compiler Collection
8903
+//
8904
+// Purpose:
8905
+//
8906
+// Creator:    Dan Gisselquist, Ph.D.
8907
+//             Gisselquist Technology, LLC
8908
+//
8909
+////////////////////////////////////////////////////////////////////////////////
8910
+//
8911
+// Copyright (C) 2016, Gisselquist Technology, LLC
8912
+//
8913
+// This program is free software (firmware): you can redistribute it and/or
8914
+// modify it under the terms of  the GNU General Public License as published
8915
+// by the Free Software Foundation, either version 3 of the License, or (at
8916
+// your option) any later version.
8917
+//
8918
+// This program is distributed in the hope that it will be useful, but WITHOUT
8919
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
8920
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8921
+// for more details.
8922
+//
8923
+// You should have received a copy of the GNU General Public License along
8924
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
8925
+// target there if the PDF file isn't present.)  If not, see
8926
+// <http://www.gnu.org/licenses/> for a copy.
8927
+//
8928
+// License:    GPL, v3, as defined and found on www.gnu.org,
8929
+//             http://www.gnu.org/licenses/gpl.html
8930
+//
8931
+//
8932
+////////////////////////////////////////////////////////////////////////////////
8933
+#ifndef        ZIP_PROTOS_H
8934
+#define        ZIP_PROTOS_H
8935
+
8936
+extern void    zip_expand_prologue(void);
8937
+extern void    zip_expand_epilogue(void);
8938
+extern int     zip_initial_elimination_offset(int, int);
8939
+extern void    zip_print_operand(FILE *, rtx, int);
8940
+extern void    zip_print_operand_address(FILE *, rtx);
8941
+extern enum    reg_class       zip_reg_class(int);
8942
+extern rtx     zip_return_addr_rtx(int, rtx);
8943
+extern int     zip_num_arg_regs(enum machine_mode, tree);
8944
+
8945
+extern void    zip_asm_output_def(FILE *s, const char *n, const char *v);
8946
+extern void    zip_update_cc_notice(rtx exp, rtx_insn *insn);
8947
+extern int     zip_address_operand(rtx op);
8948
+extern int     zip_const_address_operand(rtx op);
8949
+extern bool    zip_gen_move_rtl(rtx, rtx);
8950
+// extern      bool    zip_load_address_lod(rtx, rtx);
8951
+// extern      bool    zip_load_address_sto(rtx, rtx);
8952
+extern bool    zip_use_return_insn(void);
8953
+extern const char *zip_set_zero_or_one(rtx, rtx);
8954
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
8955
+
8956
+extern int     zip_ct_address_operand(rtx op);
8957 111 dgisselq
+extern int     zip_pd_opb_operand(rtx op);
8958 102 dgisselq
+extern int     zip_pd_mov_operand(rtx op);
8959 111 dgisselq
+extern int     zip_pd_imm_operand(rtx op);
8960
+extern int     zip_pd_mvimm_operand(rtx op);
8961 102 dgisselq
+extern int     zip_ct_const_address_operand(rtx op);
8962
+extern int     zip_pd_const_address_operand(rtx op);
8963
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
8964
+extern const char *zip_addsicc(rtx, rtx, rtx, rtx);
8965
+
8966
+#endif
8967
+
8968
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config.gcc gcc-5.3.0-zip/gcc/config.gcc
8969
--- gcc-5.3.0-original/gcc/config.gcc   2015-09-10 10:17:53.000000000 -0400
8970
+++ gcc-5.3.0-zip/gcc/config.gcc        2016-02-14 00:53:37.389411987 -0500
8971
@@ -479,6 +479,10 @@
8972
 tilepro*-*-*)
8973
        cpu_type=tilepro
8974
        ;;
8975
+zip*)
8976
+       cpu_type=zip
8977
+       tmake_file=zip/t-zip
8978
+       ;;
8979
 esac
8980
 
8981
 tm_file=${cpu_type}/${cpu_type}.h
8982
@@ -2972,6 +2976,15 @@
8983
        c_target_objs="m32c-pragma.o"
8984
        cxx_target_objs="m32c-pragma.o"
8985
        ;;
8986
+zip-*-netbsd*)
8987
+       tm_file="${tm_file} elfos.h netbsd.h netbsd-elf.h zip/netbsd.h"
8988
+       tmake_file="${tmake_file} zip/t-zip"
8989
+       ;;
8990
+zip*)
8991
+       target_has_targetm_common=yes
8992
+       tm_file="elfos.h newlib-stdint.h ${tm_file}"
8993
+       tmake_file="${tmake_file} zip/t-zip"
8994
+       ;;
8995
 *)
8996
        echo "*** Configuration ${target} not supported" 1>&2
8997
        exit 1
8998
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/cse.c gcc-5.3.0-zip/gcc/cse.c
8999
--- gcc-5.3.0-original/gcc/cse.c        2015-02-03 15:41:38.000000000 -0500
9000 111 dgisselq
+++ gcc-5.3.0-zip/gcc/cse.c     2016-03-19 12:28:45.584701098 -0400
9001
@@ -634,6 +634,15 @@
9002 102 dgisselq
 
9003
 /* Nonzero if X has the form (PLUS frame-pointer integer).  */
9004
 
9005 111 dgisselq
+// #define     DO_ZIP_DEBUGS
9006 102 dgisselq
+#ifdef DO_ZIP_DEBUGS
9007
+#include <stdio.h>
9008
+extern void zip_debug_rtx(const_rtx);
9009
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s\n", STR); zip_debug_rtx(RTX); } while(0)
9010
+#else
9011
+#define        ZIP_DEBUG_LINE(STR,RTX)
9012
+#endif
9013
+
9014
 static bool
9015
 fixed_base_plus_p (rtx x)
9016
 {
9017
@@ -2898,6 +2907,7 @@
9018
          validate_canon_reg (&XVECEXP (x, i, j), insn);
9019
     }
9020
 
9021
+       ZIP_DEBUG_LINE("CANON-REG-RTN", x);
9022
   return x;
9023
 }
9024
 
9025
@@ -3144,14 +3154,16 @@
9026
   if (x == 0)
9027
     return x;
9028
 
9029
+       ZIP_DEBUG_LINE("FOLD-RTX", x);
9030
   /* Try to perform some initial simplifications on X.  */
9031
   code = GET_CODE (x);
9032
   switch (code)
9033
     {
9034
     case MEM:
9035
     case SUBREG:
9036
-      if ((new_rtx = equiv_constant (x)) != NULL_RTX)
9037
-        return new_rtx;
9038
+      if ((new_rtx = equiv_constant (x)) != NULL_RTX) {
9039
+       ZIP_DEBUG_LINE("FOLD-RTX-NEW", new_rtx);
9040
+        return new_rtx; }
9041
       return x;
9042
 
9043
     case CONST:
9044
@@ -3208,6 +3220,8 @@
9045
        rtx folded_arg = XEXP (x, i), const_arg;
9046
        machine_mode mode_arg = GET_MODE (folded_arg);
9047
 
9048
+       ZIP_DEBUG_LINE("FOLD-RTX-ARG = ", folded_arg);
9049
+
9050
        switch (GET_CODE (folded_arg))
9051
          {
9052
          case MEM:
9053
@@ -3317,6 +3331,7 @@
9054
        }
9055
 
9056
       apply_change_group ();
9057
+       ZIP_DEBUG_LINE("FOLD-RTX-CANONICALIZED = ", insn);
9058
     }
9059
 
9060
   /* If X is an arithmetic operation, see if we can simplify it.  */
9061
@@ -4203,6 +4218,7 @@
9062
 {
9063
   rtx dest = SET_DEST (set);
9064
   rtx src = SET_SRC (set);
9065
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG", insn);
9066
 
9067
   if (REG_P (dest)
9068
       && REG_P (src) && ! HARD_REGISTER_P (src)
9069
@@ -4258,6 +4274,7 @@
9070
            }
9071
        }
9072
     }
9073
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG, done", insn);
9074
 }
9075
 
9076
 /* Record all the SETs in this instruction into SETS_PTR,
9077
@@ -4351,6 +4368,7 @@
9078
   rtx tem;
9079
   rtx x = PATTERN (insn);
9080
   int i;
9081
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN", insn);
9082
 
9083
   if (CALL_P (insn))
9084
     {
9085
@@ -4364,6 +4382,7 @@
9086
       canon_reg (SET_SRC (x), insn);
9087
       apply_change_group ();
9088
       fold_rtx (SET_SRC (x), insn);
9089
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN, was set:", insn);
9090
     }
9091
   else if (GET_CODE (x) == CLOBBER)
9092
     {
9093
@@ -4400,6 +4419,7 @@
9094
     canon_reg (PATTERN (insn), insn);
9095
   else if (GET_CODE (x) == PARALLEL)
9096
     {
9097
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/parallel", insn);
9098
       for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
9099
        {
9100
          rtx y = XVECEXP (x, 0, i);
9101
@@ -4491,6 +4511,7 @@
9102
 
9103
      The result of apply_change_group can be ignored; see canon_reg.  */
9104
 
9105
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/done", insn);
9106
   apply_change_group ();
9107
 }
9108
 
9109
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/defaults.h gcc-5.3.0-zip/gcc/defaults.h
9110
--- gcc-5.3.0-original/gcc/defaults.h   2015-03-03 10:04:02.000000000 -0500
9111
+++ gcc-5.3.0-zip/gcc/defaults.h        2016-02-06 16:57:53.939410173 -0500
9112
@@ -480,6 +480,8 @@
9113
 #define LOG2_BITS_PER_UNIT 3
9114
 #elif BITS_PER_UNIT == 16
9115
 #define LOG2_BITS_PER_UNIT 4
9116
+#elif BITS_PER_UNIT == 32
9117
+#define LOG2_BITS_PER_UNIT 5
9118
 #else
9119
 #error Unknown BITS_PER_UNIT
9120
 #endif
9121
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/doc/gcc.log gcc-5.3.0-zip/gcc/doc/gcc.log
9122
--- gcc-5.3.0-original/gcc/doc/gcc.log  1969-12-31 19:00:00.000000000 -0500
9123
+++ gcc-5.3.0-zip/gcc/doc/gcc.log       2016-01-30 15:18:43.262724969 -0500
9124
@@ -0,0 +1,214 @@
9125
+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
9126
+entering extended mode
9127
+ restricted \write18 enabled.
9128
+ file:line:error style messages enabled.
9129
+ %&-line parsing enabled.
9130
+**\catcode126=12 \def\normaltilde{~}\catcode126=13 \let~\normaltilde  \input ./
9131
+gcc.texi
9132
+(./gcc.texi (/usr/share/texmf/tex/texinfo/texinfo.tex
9133
+Loading texinfo [version 2013-09-11.11]:
9134
+\bindingoffset=\dimen16
9135
+\normaloffset=\dimen17
9136
+\pagewidth=\dimen18
9137
+\pageheight=\dimen19
9138
+\outerhsize=\dimen20
9139
+\outervsize=\dimen21
9140
+\cornerlong=\dimen22
9141
+\cornerthick=\dimen23
9142
+\topandbottommargin=\dimen24
9143
+\headlinebox=\box16
9144
+\footlinebox=\box17
9145
+\margin=\insert252
9146
+\EMsimple=\toks13
9147
+\groupbox=\box18
9148
+\groupinvalidhelp=\toks14
9149
+\mil=\dimen25
9150
+\exdentamount=\skip18
9151
+\inmarginspacing=\skip19
9152
+\centerpenalty=\count27
9153
+ pdf,
9154
+\tempnum=\count28
9155
+\lnkcount=\count29
9156
+\filename=\toks15
9157
+\filenamelength=\count30
9158
+\pgn=\count31
9159
+\toksA=\toks16
9160
+\toksB=\toks17
9161
+\toksC=\toks18
9162
+\toksD=\toks19
9163
+\boxA=\box19
9164
+\countA=\count32
9165
+\nopdfimagehelp=\toks20
9166
+ fonts,
9167
+\sffam=\fam8
9168
+\textleading=\dimen26
9169
+ markup,
9170
+\fontdepth=\count33
9171
+ glyphs,
9172
+\errorbox=\box20
9173
+
9174
+page headings,
9175
+\titlepagetopglue=\skip20
9176
+\titlepagebottomglue=\skip21
9177
+\evenheadline=\toks21
9178
+\oddheadline=\toks22
9179
+\evenfootline=\toks23
9180
+\oddfootline=\toks24
9181
+ tables,
9182
+\tableindent=\dimen27
9183
+\itemindent=\dimen28
9184
+\itemmargin=\dimen29
9185
+\itemmax=\dimen30
9186
+\itemno=\count34
9187
+\multitableparskip=\skip22
9188
+\multitableparindent=\skip23
9189
+\multitablecolspace=\dimen31
9190
+\multitablelinespace=\skip24
9191
+\colcount=\count35
9192
+\everytab=\toks25
9193
+ conditionals,
9194
+\doignorecount=\count36
9195
+ indexing,
9196
+\whatsitskip=\skip25
9197
+\whatsitpenalty=\count37
9198
+\secondaryindent=\skip26
9199
+\partialpage=\box21
9200
+\doublecolumnhsize=\dimen32
9201
+ sectioning,
9202
+\unnumberedno=\count38
9203
+\chapno=\count39
9204
+\secno=\count40
9205
+\subsecno=\count41
9206
+\subsubsecno=\count42
9207
+\appendixno=\count43
9208
+\absseclevel=\count44
9209
+\secbase=\count45
9210
+\chapheadingskip=\skip27
9211
+\secheadingskip=\skip28
9212
+\subsecheadingskip=\skip29
9213
+ toc,
9214
+\tocfile=\write0
9215
+\contentsrightmargin=\skip30
9216
+\savepageno=\count46
9217
+\lastnegativepageno=\count47
9218
+\tocindent=\dimen33
9219
+ environments,
9220
+\lispnarrowing=\skip31
9221
+\envskipamount=\skip32
9222
+\circthick=\dimen34
9223
+\cartouter=\dimen35
9224
+\cartinner=\dimen36
9225
+\normbskip=\skip33
9226
+\normpskip=\skip34
9227
+\normlskip=\skip35
9228
+\lskip=\skip36
9229
+\rskip=\skip37
9230
+\nonfillparindent=\dimen37
9231
+\tabw=\dimen38
9232
+\verbbox=\box22
9233
+
9234
+defuns,
9235
+\defbodyindent=\skip38
9236
+\defargsindent=\skip39
9237
+\deflastargmargin=\skip40
9238
+\defunpenalty=\count48
9239
+\parencount=\count49
9240
+\brackcount=\count50
9241
+ macros,
9242
+\paramno=\count51
9243
+\macname=\toks26
9244
+ cross references,
9245
+\auxfile=\write1
9246
+\savesfregister=\count52
9247
+\toprefbox=\box23
9248
+\printedrefnamebox=\box24
9249
+\infofilenamebox=\box25
9250
+\printedmanualbox=\box26
9251
+ insertions,
9252
+\footnoteno=\count53
9253
+\SAVEfootins=\box27
9254
+\SAVEmargin=\box28
9255
+
9256
+(/usr/share/texlive/texmf-dist/tex/generic/epsf/epsf.tex
9257
+This is `epsf.tex' v2.7.4 <14 February 2011>
9258
+\epsffilein=\read1
9259
+\epsfframemargin=\dimen39
9260
+\epsfframethickness=\dimen40
9261
+\epsfrsize=\dimen41
9262
+\epsftmp=\dimen42
9263
+\epsftsize=\dimen43
9264
+\epsfxsize=\dimen44
9265
+\epsfysize=\dimen45
9266
+\pspoints=\dimen46
9267
+)
9268
+\noepsfhelp=\toks27
9269
+ localization,
9270
+\nolanghelp=\toks28
9271
+\countUTFx=\count54
9272
+\countUTFy=\count55
9273
+\countUTFz=\count56
9274
+ formatting,
9275
+\defaultparindent=\dimen47
9276
+ and turning on texinfo input format.)
9277
+\openout1 = `gcc.aux'.
9278
+
9279
+@cpindfile=@write2
9280
+@fnindfile=@write3
9281
+@vrindfile=@write4
9282
+@tpindfile=@write5
9283
+@kyindfile=@write6
9284
+@pgindfile=@write7
9285
+texinfo.tex: doing @include of gcc-common.texi
9286
+
9287
+
9288
+./gcc.texi:25: I can't find file `gcc-common.texi'.
9289
+@temp ->@input gcc-common.texi
9290
+
9291
+@includezzz ...and @input #1 }@expandafter }@temp
9292
+                                                  @popthisfilestack
9293
+l.25 @include gcc-common.texi
9294
+
9295
+(Press Enter to retry, or Control-D to exit)
9296
+Please type another input file name: include/gcc-common.texi
9297
+(./include/gcc-common.texi
9298
+texinfo.tex: doing @include of gcc-vers.texi
9299
+
9300
+
9301
+./include/gcc-common.texi:11: I can't find file `gcc-vers.texi'.
9302
+@temp ->@input gcc-vers.texi
9303
+
9304
+@includezzz ...and @input #1 }@expandafter }@temp
9305
+                                                  @popthisfilestack
9306
+l.11 @include gcc-vers.texi
9307
+
9308
+(Press Enter to retry, or Control-D to exit)
9309
+Please type another input file name: include/gcc-vers.texi
9310
+./include/gcc-common.texi:11: I can't find file `include/gcc-vers.texi'.
9311
+@temp ->@input gcc-vers.texi
9312
+
9313
+@includezzz ...and @input #1 }@expandafter }@temp
9314
+                                                  @popthisfilestack
9315
+l.11 @include gcc-vers.texi
9316
+
9317
+(Press Enter to retry, or Control-D to exit)
9318
+Please type another input file name:
9319
+./include/gcc-common.texi:11: I can't find file `include/gcc-vers.texi'.
9320
+@temp ->@input gcc-vers.texi
9321
+
9322
+@includezzz ...and @input #1 }@expandafter }@temp
9323
+                                                  @popthisfilestack
9324
+l.11 @include gcc-vers.texi
9325
+
9326
+(Press Enter to retry, or Control-D to exit)
9327
+Please type another input file name:
9328
+./include/gcc-common.texi:11: Emergency stop.
9329
+@temp ->@input gcc-vers.texi
9330
+
9331
+@includezzz ...and @input #1 }@expandafter }@temp
9332
+                                                  @popthisfilestack
9333
+l.11 @include gcc-vers.texi
9334
+
9335
+End of file on the terminal!
9336
+
9337
+./include/gcc-common.texi:11:  ==> Fatal error occurred, no output PDF file pro
9338
+duced!
9339
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/expr.c gcc-5.3.0-zip/gcc/expr.c
9340
--- gcc-5.3.0-original/gcc/expr.c       2015-04-07 10:34:06.000000000 -0400
9341 103 dgisselq
+++ gcc-5.3.0-zip/gcc/expr.c    2016-03-08 04:07:01.426335724 -0500
9342 102 dgisselq
@@ -7999,6 +7999,8 @@
9343
    the back of the caller.
9344
    The normal operating mode is to pass FALSE for this parameter.  */
9345
 
9346
+#include "print-tree.h"
9347
+
9348
 rtx
9349
 expand_expr_real (tree exp, rtx target, machine_mode tmode,
9350
                  enum expand_modifier modifier, rtx *alt_rtl,
9351 111 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/final.c gcc-5.3.0-zip/gcc/final.c
9352
--- gcc-5.3.0-original/gcc/final.c      2015-01-15 08:28:42.000000000 -0500
9353
+++ gcc-5.3.0-zip/gcc/final.c   2016-03-24 22:12:00.263845620 -0400
9354
@@ -109,6 +109,14 @@
9355
 #include "wide-int-print.h"
9356
 #include "rtl-iter.h"
9357
 
9358
+
9359
+#ifdef DO_ZIP_DEBUGS
9360
+extern void zip_debug_rtx(const_rtx);
9361
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
9362
+#else
9363
+#define        ZIP_DEBUG_LINE(STR,RTX)
9364
+#endif
9365
+
9366
 #ifdef XCOFF_DEBUGGING_INFO
9367
 #include "xcoffout.h"          /* Needed for external data
9368
                                   declarations for e.g. AIX 4.x.  */
9369
@@ -2071,6 +2079,8 @@
9370
   /* Output the insns.  */
9371
   for (insn = first; insn;)
9372
     {
9373
+       ZIP_DEBUG_LINE("final()\n", insn);
9374
+
9375
       if (HAVE_ATTR_length)
9376
        {
9377
          if ((unsigned) INSN_UID (insn) >= INSN_ADDRESSES_SIZE ())
9378 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/genmodes.c gcc-5.3.0-zip/gcc/genmodes.c
9379
--- gcc-5.3.0-original/gcc/genmodes.c   2015-01-05 07:33:28.000000000 -0500
9380
+++ gcc-5.3.0-zip/gcc/genmodes.c        2016-03-04 21:27:49.669147699 -0500
9381
@@ -330,7 +330,8 @@
9382
         the size of a CC mode is four units.  */
9383
       validate_mode (m, UNSET, UNSET, UNSET, UNSET, UNSET);
9384
 
9385
-      m->bytesize = 4;
9386
+       /* For the ZipCPU, however, it is only one unit */
9387
+      m->bytesize = 1;
9388
       m->ncomponents = 1;
9389
       m->component = 0;
9390
       break;
9391
@@ -766,11 +767,12 @@
9392
 
9393
   /* So put the default value unless the target needs a non standard
9394
      value. */
9395
-#ifdef BITS_PER_UNIT
9396
-  bits_per_unit = BITS_PER_UNIT;
9397
-#else
9398
-  bits_per_unit = 8;
9399
-#endif
9400
+// #ifdef BITS_PER_UNIT
9401
+  // bits_per_unit = BITS_PER_UNIT;
9402
+// #else
9403
+  bits_per_unit = 32;
9404
+#warning "Is there a more automated way to set bits per unit?"
9405
+// #endif
9406
 
9407
 #ifdef MAX_BITSIZE_MODE_ANY_INT
9408
   max_bitsize_mode_any_int = MAX_BITSIZE_MODE_ANY_INT;
9409
@@ -1083,7 +1085,7 @@
9410
       first = modes[c];
9411
       last = 0;
9412
       for (m = first; m; last = m, m = m->next)
9413
-       ;
9414
+       if ((m->next)&&(m->next->bytesize == m->bytesize)) first = m;
9415
 
9416
       /* Don't use BImode for MIN_MODE_INT, since otherwise the middle
9417
         end will try to use it for bitfields in structures and the
9418
@@ -1268,7 +1270,7 @@
9419
            continue;
9420
          if (m->precision != (unsigned int) -1)
9421
            {
9422
-             if (m2->precision != 2 * m->precision)
9423
+             if (m2->precision < 2 * m->precision)
9424
                continue;
9425
            }
9426
          else
9427
@@ -1323,7 +1325,6 @@
9428
       tagged_printf ("MODE_MASK (%u)", m->precision, m->name);
9429
     else
9430
       tagged_printf ("MODE_MASK (%u*BITS_PER_UNIT)", m->bytesize, m->name);
9431
-
9432
   puts ("#undef MODE_MASK");
9433
   print_closer ();
9434
 }
9435
@@ -1351,12 +1352,23 @@
9436
   int c;
9437
   struct mode_data *m;
9438
 
9439
+  puts(
9440
+"\n\n/* This is a rather strange conundrum.  Alignment is used by the host in\n"
9441
+" * the assembly file, whereas the size is used by the target.  Thus, for\n"
9442
+" * now, to align to a single target word means to align to 4 8-bit bytes in\n"
9443
+" * assembly.  If you get it wrong, the assembler will try to help.  Thus,\n"
9444
+" * aligning to anything less than 4 (1 target word) will cause an alignment\n"
9445
+" * of the target word in size.  However, this tries to do a little something\n"
9446
+" * teach our compiler what we are doing.\n"
9447
+" */\n");
9448
   print_maybe_const_decl ("%sunsigned char",
9449
                          "mode_base_align", "NUM_MACHINE_MODES",
9450
                          alignment);
9451
 
9452
   for_all_modes (c, m)
9453
-    tagged_printf ("%u", m->alignment, m->name);
9454
+    tagged_printf ("%u", 4*m->bytesize,
9455
+               // m->alignment,
9456
+               m->name);
9457
 
9458
   print_closer ();
9459
 }
9460
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.def gcc-5.3.0-zip/gcc/machmode.def
9461
--- gcc-5.3.0-original/gcc/machmode.def 2015-01-05 07:33:28.000000000 -0500
9462 111 dgisselq
+++ gcc-5.3.0-zip/gcc/machmode.def      2016-03-08 11:56:45.375491523 -0500
9463 102 dgisselq
@@ -184,11 +184,11 @@
9464
    larger types, then corresponding modes must be added here.  The
9465
    name OI is reserved for a 256-bit type (needed by some back ends).
9466
     */
9467
-INT_MODE (QI, 1);
9468
-INT_MODE (HI, 2);
9469
-INT_MODE (SI, 4);
9470
-INT_MODE (DI, 8);
9471
-INT_MODE (TI, 16);
9472
+// INT_MODE (QI, 1);
9473
+// INT_MODE (HI, 1);
9474
+INT_MODE (SI, 1);
9475
+INT_MODE (DI, 2);
9476
+INT_MODE (TI, 4);
9477
 
9478
 /* No partial integer modes are defined by default.  */
9479
 
9480 111 dgisselq
@@ -206,35 +206,35 @@
9481 102 dgisselq
    These are the IEEE mappings.  They can be overridden with
9482
    RESET_FLOAT_FORMAT or at runtime (in TARGET_OPTION_OVERRIDE).  */
9483
 
9484
-FLOAT_MODE (SF, 4, ieee_single_format);
9485
-FLOAT_MODE (DF, 8, ieee_double_format);
9486
+FLOAT_MODE (SF, 1, ieee_single_format);
9487
+FLOAT_MODE (DF, 2, ieee_double_format);
9488
 
9489
 /* Basic CC modes.
9490
    FIXME define this only for targets that need it.  */
9491 111 dgisselq
 CC_MODE (CC);
9492 102 dgisselq
 
9493
 /* Fixed-point modes.  */
9494 111 dgisselq
-FRACT_MODE (QQ, 1, 7); /* s.7 */
9495 102 dgisselq
-FRACT_MODE (HQ, 2, 15); /* s.15 */
9496
-FRACT_MODE (SQ, 4, 31); /* s.31 */
9497
-FRACT_MODE (DQ, 8, 63); /* s.63 */
9498
-FRACT_MODE (TQ, 16, 127); /* s.127 */
9499 111 dgisselq
-
9500
-UFRACT_MODE (UQQ, 1, 8); /* .8 */
9501 102 dgisselq
-UFRACT_MODE (UHQ, 2, 16); /* .16 */
9502
-UFRACT_MODE (USQ, 4, 32); /* .32 */
9503
-UFRACT_MODE (UDQ, 8, 64); /* .64 */
9504
-UFRACT_MODE (UTQ, 16, 128); /* .128 */
9505 111 dgisselq
-
9506
-ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
9507
-ACCUM_MODE (SA, 4, 16, 15); /* s16.15 */
9508
-ACCUM_MODE (DA, 8, 32, 31); /* s32.31 */
9509
-ACCUM_MODE (TA, 16, 64, 63); /* s64.63 */
9510
-
9511
-UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
9512
-UACCUM_MODE (USA, 4, 16, 16); /* 16.16 */
9513
-UACCUM_MODE (UDA, 8, 32, 32); /* 32.32 */
9514
-UACCUM_MODE (UTA, 16, 64, 64); /* 64.64 */
9515
+/* FRACT_MODE (QQ, 1, 7); /* s.7 */
9516
+/* FRACT_MODE (HQ, 1, 15); /* s.15 */
9517
+FRACT_MODE (SQ, 1, 31); /* s.31 */
9518
+FRACT_MODE (DQ, 2, 63); /* s.63 */
9519
+FRACT_MODE (TQ, 4, 127); /* s.127 */
9520
+
9521
+/* UFRACT_MODE (UQQ, 1, 8); /* .8 */
9522
+/* UFRACT_MODE (UHQ, 1, 16); /* .16 */
9523 102 dgisselq
+UFRACT_MODE (USQ, 1, 32); /* .32 */
9524
+UFRACT_MODE (UDQ, 2, 64); /* .64 */
9525
+UFRACT_MODE (UTQ, 4, 128); /* .128 */
9526 111 dgisselq
+
9527
+/* ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
9528
+ACCUM_MODE (SA, 1, 16, 15); /* s16.15 */
9529
+ACCUM_MODE (DA, 2, 32, 31); /* s32.31 */
9530
+ACCUM_MODE (TA, 4, 64, 63); /* s64.63 */
9531
+
9532
+/* UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
9533
+UACCUM_MODE (USA, 1, 16, 16); /* 16.16 */
9534
+UACCUM_MODE (UDA, 2, 32, 32); /* 32.32 */
9535
+UACCUM_MODE (UTA, 4, 64, 64); /* 64.64 */
9536 102 dgisselq
 
9537 111 dgisselq
 /* Allow the target to specify additional modes of various kinds.  */
9538
 #if HAVE_EXTRA_MODES
9539 102 dgisselq
@@ -246,9 +246,9 @@
9540
 COMPLEX_MODES (FLOAT);
9541
 
9542
 /* Decimal floating point modes.  */
9543
-DECIMAL_FLOAT_MODE (SD, 4, decimal_single_format);
9544
-DECIMAL_FLOAT_MODE (DD, 8, decimal_double_format);
9545
-DECIMAL_FLOAT_MODE (TD, 16, decimal_quad_format);
9546
+DECIMAL_FLOAT_MODE (SD, 1, decimal_single_format);
9547
+DECIMAL_FLOAT_MODE (DD, 2, decimal_double_format);
9548
+DECIMAL_FLOAT_MODE (TD, 4, decimal_quad_format);
9549
 
9550
 /* The symbol Pmode stands for one of the above machine modes (usually SImode).
9551
    The tm.h file specifies which one.  It is not a distinct mode.  */
9552
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.h gcc-5.3.0-zip/gcc/machmode.h
9553
--- gcc-5.3.0-original/gcc/machmode.h   2015-01-05 07:33:28.000000000 -0500
9554
+++ gcc-5.3.0-zip/gcc/machmode.h        2016-02-06 17:21:49.592924065 -0500
9555
@@ -180,13 +180,7 @@
9556
 /* Get the size in bytes and bits of an object of mode MODE.  */
9557
 
9558
 extern CONST_MODE_SIZE unsigned char mode_size[NUM_MACHINE_MODES];
9559
-#if GCC_VERSION >= 4001
9560
-#define GET_MODE_SIZE(MODE) \
9561
-  ((unsigned short) (__builtin_constant_p (MODE) \
9562
-                    ? mode_size_inline (MODE) : mode_size[MODE]))
9563
-#else
9564
 #define GET_MODE_SIZE(MODE)    ((unsigned short) mode_size[MODE])
9565
-#endif
9566
 #define GET_MODE_BITSIZE(MODE) \
9567
   ((unsigned short) (GET_MODE_SIZE (MODE) * BITS_PER_UNIT))
9568
 
9569
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/objc/objc-encoding.c gcc-5.3.0-zip/gcc/objc/objc-encoding.c
9570
--- gcc-5.3.0-original/gcc/objc/objc-encoding.c 2015-01-09 15:18:42.000000000 -0500
9571
+++ gcc-5.3.0-zip/gcc/objc/objc-encoding.c      2016-03-04 22:53:40.431902505 -0500
9572
@@ -765,10 +765,14 @@
9573
        {
9574
          switch (TYPE_MODE (type))
9575
            {
9576
+#ifdef HAVE_QImode
9577
            case QImode:
9578
              charType = 'C'; break;
9579
+#endif
9580
+#ifdef HAVE_HImode
9581
            case HImode:
9582
              charType = 'S'; break;
9583
+#endif
9584
            case SImode:
9585
              {
9586
                if (type == long_unsigned_type_node)
9587
@@ -788,10 +792,14 @@
9588
        {
9589
          switch (TYPE_MODE (type))
9590
            {
9591
+#ifdef HAVE_QImode
9592
            case QImode:
9593
              charType = 'c'; break;
9594
+#endif
9595
+#ifdef HAVE_HImode
9596
            case HImode:
9597
              charType = 's'; break;
9598
+#endif
9599
            case SImode:
9600
              {
9601
                if (type == long_integer_type_node)
9602
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/postreload.c gcc-5.3.0-zip/gcc/postreload.c
9603
--- gcc-5.3.0-original/gcc/postreload.c 2015-07-17 09:50:38.000000000 -0400
9604 111 dgisselq
+++ gcc-5.3.0-zip/gcc/postreload.c      2016-03-24 21:30:23.402590035 -0400
9605
@@ -71,6 +71,14 @@
9606 102 dgisselq
 #include "df.h"
9607
 #include "dbgcnt.h"
9608
 
9609 111 dgisselq
+// #define     DO_ZIP_DEBUGS
9610 102 dgisselq
+#ifdef DO_ZIP_DEBUGS
9611
+extern void zip_debug_rtx(const_rtx);
9612
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
9613
+#else
9614
+#define        ZIP_DEBUG_LINE(STR,RTX)
9615
+#endif
9616
+
9617
 static int reload_cse_noop_set_p (rtx);
9618
 static bool reload_cse_simplify (rtx_insn *, rtx);
9619
 static void reload_cse_regs_1 (void);
9620 111 dgisselq
@@ -120,6 +128,8 @@
9621 102 dgisselq
   basic_block insn_bb = BLOCK_FOR_INSN (insn);
9622
   unsigned insn_bb_succs = EDGE_COUNT (insn_bb->succs);
9623
 
9624
+       ZIP_DEBUG_LINE("RELOAD-CSE-SIMPLIFY:",insn);
9625
+
9626
   if (GET_CODE (body) == SET)
9627
     {
9628
       int count = 0;
9629 111 dgisselq
@@ -147,6 +157,7 @@
9630 102 dgisselq
        apply_change_group ();
9631
       else
9632
        reload_cse_simplify_operands (insn, testreg);
9633
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
9634
     }
9635
   else if (GET_CODE (body) == PARALLEL)
9636
     {
9637 111 dgisselq
@@ -205,6 +216,7 @@
9638 102 dgisselq
        apply_change_group ();
9639
       else
9640
        reload_cse_simplify_operands (insn, testreg);
9641
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
9642
     }
9643
 
9644
 done:
9645 111 dgisselq
@@ -246,6 +258,7 @@
9646 102 dgisselq
          cfg_changed |= reload_cse_simplify (insn, testreg);
9647
 
9648
        cselib_process_insn (insn);
9649
+       ZIP_DEBUG_LINE("End-CSE-REGS-1:",insn);
9650
       }
9651
 
9652
   /* Clean up.  */
9653 111 dgisselq
@@ -276,6 +289,8 @@
9654 102 dgisselq
 #endif
9655
   bool speed = optimize_bb_for_speed_p (BLOCK_FOR_INSN (insn));
9656
 
9657
+
9658
+       ZIP_DEBUG_LINE("RELOAD:Attempting to simplify set",set);
9659
   dreg = true_regnum (SET_DEST (set));
9660
   if (dreg < 0)
9661
     return 0;
9662 111 dgisselq
@@ -427,6 +442,7 @@
9663 102 dgisselq
   /* Array of alternatives, sorted in order of decreasing desirability.  */
9664
   int *alternative_order;
9665
 
9666
+       ZIP_DEBUG_LINE("Simplify-Operands", insn);
9667
   extract_constrain_insn (insn);
9668
 
9669
   if (recog_data.n_alternatives == 0 || recog_data.n_operands == 0)
9670 111 dgisselq
@@ -519,6 +535,7 @@
9671 102 dgisselq
          SET_HARD_REG_BIT (equiv_regs[i], REGNO (l->loc));
9672
     }
9673
 
9674
+       ZIP_DEBUG_LINE("Simplify-Operands - A", insn);
9675
   alternative_mask preferred = get_preferred_alternatives (insn);
9676
   for (i = 0; i < recog_data.n_operands; i++)
9677
     {
9678 111 dgisselq
@@ -617,6 +634,7 @@
9679 102 dgisselq
            }
9680
        }
9681
     }
9682
+       ZIP_DEBUG_LINE("Simplify-Operands - B", insn);
9683
 
9684
   /* Record all alternatives which are better or equal to the currently
9685
      matching one in the alternative_order array.  */
9686 111 dgisselq
@@ -666,6 +684,7 @@
9687 102 dgisselq
       validate_change (insn, recog_data.operand_loc[i],
9688
                       gen_rtx_REG (mode, op_alt_regno[i][j]), 1);
9689
     }
9690
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
9691
 
9692
   for (i = recog_data.n_dups - 1; i >= 0; i--)
9693
     {
9694 111 dgisselq
@@ -679,6 +698,7 @@
9695 102 dgisselq
                       gen_rtx_REG (mode, op_alt_regno[op][j]), 1);
9696
     }
9697
 
9698
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
9699
   return apply_change_group ();
9700
 }
9701
 
9702 103 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload1.c gcc-5.3.0-zip/gcc/reload1.c
9703
--- gcc-5.3.0-original/gcc/reload1.c    2015-01-15 08:28:42.000000000 -0500
9704 111 dgisselq
+++ gcc-5.3.0-zip/gcc/reload1.c 2016-03-19 12:27:20.657324554 -0400
9705
@@ -785,6 +785,7 @@
9706
    stream and a DCE pass should be run to elimiante them.  Else the
9707
    return value is FALSE.  */
9708
 
9709
+extern void zip_debug_rtx(const_rtx);
9710
 bool
9711
 reload (rtx_insn *first, int global)
9712
 {
9713
@@ -2271,11 +2272,11 @@
9714 103 dgisselq
               && spill_stack_slot_width[from_reg] >= total_size
9715
               && (GET_MODE_SIZE (GET_MODE (spill_stack_slot[from_reg]))
9716
                   >= inherent_size)
9717
-              && MEM_ALIGN (spill_stack_slot[from_reg]) >= min_align)
9718
+              && MEM_ALIGN (spill_stack_slot[from_reg]) >= min_align) {
9719
        x = spill_stack_slot[from_reg];
9720
 
9721
       /* Allocate a bigger slot.  */
9722
-      else
9723
+      } else
9724
        {
9725
          /* Compute maximum size needed, both for inherent size
9726
             and for total size.  */
9727 111 dgisselq
@@ -3477,11 +3478,14 @@
9728 103 dgisselq
   /* Eliminate all eliminable registers occurring in operands that
9729
      can be handled by reload.  */
9730
   extract_insn (insn);
9731
+
9732
   for (i = 0; i < recog_data.n_operands; i++)
9733
     {
9734
       orig_operand[i] = recog_data.operand[i];
9735
       substed_operand[i] = recog_data.operand[i];
9736
 
9737
+       if (insn_data[icode].operand[i].eliminable)
9738
+
9739
       /* For an asm statement, every operand is eliminable.  */
9740
       if (insn_is_asm || insn_data[icode].operand[i].eliminable)
9741
        {
9742 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload.c gcc-5.3.0-zip/gcc/reload.c
9743
--- gcc-5.3.0-original/gcc/reload.c     2015-01-15 08:28:42.000000000 -0500
9744 111 dgisselq
+++ gcc-5.3.0-zip/gcc/reload.c  2016-03-19 12:28:30.592811127 -0400
9745 102 dgisselq
@@ -2707,8 +2707,17 @@
9746
     no_output_reloads = 1;
9747
 
9748
 #ifdef HAVE_cc0
9749
+  // If the instruction depends upon cc0, such as a branch, if_then_else, or
9750
+  // cond_exec instruction, we cannot change the input so that the instruction
9751
+  // relies on another register--cc0 is specific.  This requries that the
9752
+  // references be only cc0 and (const_int 0), rather than allowing other
9753
+  // registers here as well.
9754
   if (reg_referenced_p (cc0_rtx, PATTERN (insn)))
9755
     no_input_reloads = 1;
9756
+  // If the result of an instruction is the cc0 register, that cannot
9757
+  // be changed, therefore no output reloading is allowed.  This only
9758
+  // works if instructions *only* set the cc0 register, and not multiple
9759
+  // registers.
9760
   if (reg_set_p (cc0_rtx, PATTERN (insn)))
9761
     no_output_reloads = 1;
9762
 #endif
9763
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
9764
--- gcc-5.3.0-original/gcc/testsuite/lib/target-supports.exp    2015-11-26 05:10:58.000000000 -0500
9765
+++ gcc-5.3.0-zip/gcc/testsuite/lib/target-supports.exp 2016-01-30 15:14:21.620586694 -0500
9766
@@ -503,6 +503,11 @@
9767
        return 0
9768
     }
9769
 
9770
+    # Zip CPU doesn't support profiling (yet)
9771
+    if { [istarget zip*] }
9772
+        return 0
9773
+    }
9774
+
9775
     # MinGW does not support -p.
9776
     if { [istarget *-*-mingw*] && $test_what == "-p" } {
9777
        return 0
9778
@@ -986,6 +991,12 @@
9779
        }]
9780
     }
9781
 
9782
+    # No real hardware FPU support for ZipCPU yet--even though the instruction
9783
+    # set supports it, the CPU just isn't ready yet.
9784
+    if { [istarget zip*-*-*] } {
9785
+        return 0
9786
+    }
9787
+
9788
     # This proc is actually checking the availabilty of FPU
9789
     # support for doubles, so on the RX we must fail if the
9790
     # 64-bit double multilib has been selected.
9791
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
9792
--- gcc-5.3.0-original/gcc/tree-ssa-math-opts.c 2015-08-11 03:58:07.000000000 -0400
9793
+++ gcc-5.3.0-zip/gcc/tree-ssa-math-opts.c      2016-02-12 11:21:11.309149239 -0500
9794
@@ -972,7 +972,7 @@
9795
     {
9796
       if (val & 1)
9797
        {
9798
-         digit = val & ((1 << POWI_WINDOW_SIZE) - 1);
9799
+         digit = val & ((1l << POWI_WINDOW_SIZE) - 1);
9800
          result += powi_lookup_cost (digit, cache)
9801
                    + POWI_WINDOW_SIZE + 1;
9802
          val >>= POWI_WINDOW_SIZE;
9803
@@ -1012,7 +1012,7 @@
9804
     }
9805
   else if (n & 1)
9806
     {
9807
-      digit = n & ((1 << POWI_WINDOW_SIZE) - 1);
9808
+      digit = n & ((1l << POWI_WINDOW_SIZE) - 1);
9809
       op0 = powi_as_mults_1 (gsi, loc, type, n - digit, cache);
9810
       op1 = powi_as_mults_1 (gsi, loc, type, digit, cache);
9811
     }
9812
@@ -1651,7 +1651,7 @@
9813
 };
9814
 
9815
 #define BITS_PER_MARKER 8
9816
-#define MARKER_MASK ((1 << BITS_PER_MARKER) - 1)
9817
+#define MARKER_MASK ((1l << BITS_PER_MARKER) - 1)
9818
 #define MARKER_BYTE_UNKNOWN MARKER_MASK
9819
 #define HEAD_MARKER(n, size) \
9820
   ((n) & ((uint64_t) MARKER_MASK << (((size) - 1) * BITS_PER_MARKER)))
9821
@@ -1687,7 +1687,7 @@
9822
   /* Zero out the extra bits of N in order to avoid them being shifted
9823
      into the significant bits.  */
9824
   if (size < 64 / BITS_PER_MARKER)
9825
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
9826
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
9827
 
9828
   switch (code)
9829
     {
9830
@@ -1714,7 +1714,7 @@
9831
     }
9832
   /* Zero unused bits for size.  */
9833
   if (size < 64 / BITS_PER_MARKER)
9834
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
9835
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
9836
   return true;
9837
 }
9838
 
9839
@@ -1761,7 +1761,7 @@
9840
   n->n = CMPNOP;
9841
 
9842
   if (size < 64 / BITS_PER_MARKER)
9843
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
9844
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
9845
 
9846
   return true;
9847
 }
9848
@@ -2020,7 +2020,7 @@
9849
          {
9850
            int i, size = TYPE_PRECISION (n->type) / BITS_PER_UNIT;
9851
            uint64_t val = int_cst_value (rhs2), mask = 0;
9852
-           uint64_t tmp = (1 << BITS_PER_UNIT) - 1;
9853
+           uint64_t tmp = (1l << BITS_PER_UNIT) - 1;
9854
 
9855
            /* Only constants masking full bytes are allowed.  */
9856
            for (i = 0; i < size; i++, tmp <<= BITS_PER_UNIT)
9857
@@ -2064,7 +2064,7 @@
9858
              {
9859
                /* If STMT casts to a smaller type mask out the bits not
9860
                   belonging to the target type.  */
9861
-               n->n &= ((uint64_t) 1 << (type_size * BITS_PER_MARKER)) - 1;
9862
+               n->n &= ((uint64_t) 1l << (type_size * BITS_PER_MARKER)) - 1;
9863
              }
9864
            n->type = type;
9865
            if (!n->base_addr)
9866
@@ -2177,7 +2177,7 @@
9867
     {
9868
       uint64_t mask;
9869
 
9870
-      mask = ((uint64_t) 1 << (n->range * BITS_PER_MARKER)) - 1;
9871
+      mask = ((uint64_t) 1l << (n->range * BITS_PER_MARKER)) - 1;
9872
       cmpxchg >>= (64 / BITS_PER_MARKER - n->range) * BITS_PER_MARKER;
9873
       cmpnop &= mask;
9874
     }
9875
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/var-tracking.c gcc-5.3.0-zip/gcc/var-tracking.c
9876
--- gcc-5.3.0-original/gcc/var-tracking.c       2015-03-26 09:19:00.000000000 -0400
9877 111 dgisselq
+++ gcc-5.3.0-zip/gcc/var-tracking.c    2016-03-19 09:31:12.636242911 -0400
9878 102 dgisselq
@@ -143,6 +143,13 @@
9879
 #include "rtl-iter.h"
9880
 #include "fibonacci_heap.h"
9881
 
9882
+#ifdef DO_ZIP_DEBUG
9883
+#include <stdio.h>
9884
+extern void zip_debug_rtx(const_rtx);
9885
+#define ZIP_DEBUG_LINE(STR,RTX) do {fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
9886
+#else
9887
+#define ZIP_DEBUG_LINE(STR,RTX)
9888
+#endif
9889
 typedef fibonacci_heap <long, basic_block_def> bb_heap_t;
9890
 typedef fibonacci_node <long, basic_block_def> bb_heap_node_t;
9891
 
9892
@@ -6356,6 +6363,7 @@
9893
                machine_mode indmode
9894
                  = TYPE_MODE (TREE_TYPE (argtype));
9895
                rtx mem = gen_rtx_MEM (indmode, x);
9896
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref", mem);
9897
                cselib_val *val = cselib_lookup (mem, indmode, 0, VOIDmode);
9898
                if (val && cselib_preserved_value_p (val))
9899
                  {
9900
@@ -6462,12 +6470,14 @@
9901
       machine_mode mode
9902
        = TYPE_MODE (TREE_TYPE (OBJ_TYPE_REF_EXPR (obj_type_ref)));
9903
       rtx clobbered = gen_rtx_MEM (mode, this_arg);
9904
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered", clobbered);
9905
       HOST_WIDE_INT token
9906
        = tree_to_shwi (OBJ_TYPE_REF_TOKEN (obj_type_ref));
9907
       if (token)
9908
        clobbered = plus_constant (mode, clobbered,
9909
                                   token * GET_MODE_SIZE (mode));
9910
       clobbered = gen_rtx_MEM (mode, clobbered);
9911
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered-2", clobbered);
9912
       x = gen_rtx_CONCAT (mode, gen_rtx_CLOBBER (VOIDmode, pc_rtx), clobbered);
9913
       call_arguments
9914
        = gen_rtx_EXPR_LIST (VOIDmode, x, call_arguments);
9915
@@ -9790,6 +9800,7 @@
9916
              machine_mode indmode
9917
                = TYPE_MODE (TREE_TYPE (TREE_TYPE (parm)));
9918
              rtx mem = gen_rtx_MEM (indmode, incoming);
9919
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/incoming", incoming);
9920
              cselib_val *val = cselib_lookup_from_insn (mem, indmode, true,
9921
                                                         VOIDmode,
9922
                                                         get_insns ());
9923
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgcc/config.host gcc-5.3.0-zip/libgcc/config.host
9924
--- gcc-5.3.0-original/libgcc/config.host       2015-10-01 08:01:18.000000000 -0400
9925
+++ gcc-5.3.0-zip/libgcc/config.host    2016-01-30 15:16:00.459883558 -0500
9926
@@ -195,6 +195,9 @@
9927
 tic6x-*-*)
9928
        cpu_type=c6x
9929
        ;;
9930
+zip*)
9931
+       cpu_type=zip
9932
+       ;;
9933
 esac
9934
 
9935
 # Common parts for widely ported systems.
9936
@@ -1300,6 +1303,9 @@
9937
        echo "*** Configuration ${host} not supported" 1>&2
9938
        exit 1
9939
        ;;
9940
+zip*)
9941
+       tmake_file="${tmake_file} t-softfp-sfdf t-softfp"
9942
+       ;;
9943
 esac
9944
 
9945
 case ${host} in
9946
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgomp/configure.tgt gcc-5.3.0-zip/libgomp/configure.tgt
9947
--- gcc-5.3.0-original/libgomp/configure.tgt    2015-03-13 06:57:07.000000000 -0400
9948
+++ gcc-5.3.0-zip/libgomp/configure.tgt 2016-01-30 15:16:51.323521641 -0500
9949
@@ -150,6 +150,9 @@
9950
        # Need to link with -lpthread so libgomp.so is self-contained.
9951
        XLDFLAGS="${XLDFLAGS} -lpthread"
9952
        ;;
9953
+  zip*)
9954
+        config_path="bsd posix"
9955
+        ;;
9956
 
9957
   *)
9958
        ;;

powered by: WebSVN 2.1.0

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