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

Subversion Repositories zipcpu

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

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 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/cfgexpand.c gcc-5.3.0-zip/gcc/cfgexpand.c
50
--- gcc-5.3.0-original/gcc/cfgexpand.c  2015-07-23 06:39:26.000000000 -0400
51
+++ gcc-5.3.0-zip/gcc/cfgexpand.c       2016-04-01 06:40:17.288326711 -0400
52
@@ -108,6 +108,14 @@
53
 #include "tree-chkp.h"
54
 #include "rtl-chkp.h"
55
 
56
+#ifdef DO_ZIP_DEBUGS
57
+#include <stdio.h>
58
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX);} while(0)
59
+extern void    zip_debug_rtx(const_rtx);
60
+#else
61
+#define        ZIP_DEBUG_LINE(STR,RTX)
62
+#endif
63
+
64
 /* Some systems use __main in a way incompatible with its use in gcc, in these
65
    cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
66
    give the same symbol without quotes for an alternative entry point.  You
67 111 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/cgraphbuild.c gcc-5.3.0-zip/gcc/cgraphbuild.c
68
--- gcc-5.3.0-original/gcc/cgraphbuild.c        2015-01-09 15:18:42.000000000 -0500
69
+++ gcc-5.3.0-zip/gcc/cgraphbuild.c     2016-03-24 22:13:24.815287808 -0400
70
@@ -62,6 +62,13 @@
71
 #include "ipa-prop.h"
72
 #include "ipa-inline.h"
73
 
74
+#ifdef DO_ZIP_DEBUGS
75
+extern void zip_debug_rtx(const_rtx);
76
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
77
+#else
78
+#define        ZIP_DEBUG_LINE(STR,RTX)
79
+#endif
80
+
81
 /* Context of record_reference.  */
82
 struct record_reference_ctx
83
 {
84 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
85
--- gcc-5.3.0-original/gcc/common/config/zip/zip-common.c       1969-12-31 19:00:00.000000000 -0500
86
+++ gcc-5.3.0-zip/gcc/common/config/zip/zip-common.c    2016-02-14 00:54:31.821055716 -0500
87
@@ -0,0 +1,52 @@
88
+////////////////////////////////////////////////////////////////////////////////
89
+//
90
+// Filename:   common/config/zip/zip-common.c
91
+//
92
+// Project:    Zip CPU backend for the GNU Compiler Collection
93
+//
94
+// Purpose:    To eliminate the frame register automatically.
95
+//
96
+// Creator:    Dan Gisselquist, Ph.D.
97
+//             Gisselquist Technology, LLC
98
+//
99
+////////////////////////////////////////////////////////////////////////////////
100
+//
101
+// Copyright (C) 2016, Gisselquist Technology, LLC
102
+//
103
+// This program is free software (firmware): you can redistribute it and/or
104
+// modify it under the terms of  the GNU General Public License as published
105
+// by the Free Software Foundation, either version 3 of the License, or (at
106
+// your option) any later version.
107
+//
108
+// This program is distributed in the hope that it will be useful, but WITHOUT
109
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
110
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
111
+// for more details.
112
+//
113
+// You should have received a copy of the GNU General Public License along
114
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
115
+// target there if the PDF file isn't present.)  If not, see
116
+// <http://www.gnu.org/licenses/> for a copy.
117
+//
118
+// License:    GPL, v3, as defined and found on www.gnu.org,
119
+//             http://www.gnu.org/licenses/gpl.html
120
+//
121
+//
122
+////////////////////////////////////////////////////////////////////////////////
123
+#include "config.h"
124
+#include "system.h"
125
+#include "coretypes.h"
126
+#include "tm.h"
127
+#include "common/common-target.h"
128
+#include "common/common-target-def.h"
129
+
130
+static const struct default_options zip_option_optimization_table[] =
131
+  {
132
+    { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 },
133
+    { OPT_LEVELS_NONE, 0, NULL, 0 }
134
+  };
135
+
136
+#undef TARGET_OPTION_OPTIMIZATION_TABLE
137
+#define        TARGET_OPTION_OPTIMIZATION_TABLE        zip_option_optimization_table
138
+
139
+struct gcc_targetm_common      targetm_common = TARGETM_COMMON_INITIALIZER;
140
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
141 124 dgisselq
--- gcc-5.3.0-original/gcc/config/aarch64/aarch64-linux.h       2016-04-11 22:20:22.139907680 -0400
142 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/aarch64/aarch64-linux.h    2015-07-24 12:00:26.000000000 -0400
143
@@ -21,7 +21,7 @@
144
 #ifndef GCC_AARCH64_LINUX_H
145
 #define GCC_AARCH64_LINUX_H
146
 
147
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
148
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
149
 
150
 #undef  ASAN_CC1_SPEC
151
 #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
152
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
153 124 dgisselq
--- gcc-5.3.0-original/gcc/config/alpha/linux-elf.h     2016-04-11 22:20:22.143907624 -0400
154 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/alpha/linux-elf.h  2015-01-05 07:33:28.000000000 -0500
155
@@ -23,8 +23,8 @@
156
 #define EXTRA_SPECS \
157
 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
158
 
159
-#define GLIBC_DYNAMIC_LINKER   "/tools/lib/ld-linux.so.2"
160
-#define UCLIBC_DYNAMIC_LINKER "/tools/lib/ld-uClibc.so.0"
161
+#define GLIBC_DYNAMIC_LINKER   "/lib/ld-linux.so.2"
162
+#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
163
 #if DEFAULT_LIBC == LIBC_UCLIBC
164
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
165
 #elif DEFAULT_LIBC == LIBC_GLIBC
166
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
167 124 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-eabi.h      2016-04-11 22:20:22.143907624 -0400
168 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/arm/linux-eabi.h   2015-01-05 07:33:28.000000000 -0500
169
@@ -68,8 +68,8 @@
170
    GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI.  */
171
 
172
 #undef  GLIBC_DYNAMIC_LINKER
173
-#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/tools/lib/ld-linux.so.3"
174
-#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/tools/lib/ld-linux-armhf.so.3"
175
+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
176
+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
177
 #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
178
 
179
 #define GLIBC_DYNAMIC_LINKER \
180
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
181 124 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-elf.h       2016-04-11 22:20:22.143907624 -0400
182 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/arm/linux-elf.h    2015-06-23 05:26:54.000000000 -0400
183
@@ -62,7 +62,7 @@
184
 
185
 #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
186
 
187
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
188
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
189
 
190
 #define LINUX_TARGET_LINK_SPEC  "%{h*} \
191
    %{static:-Bstatic} \
192
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/bfin/linux.h gcc-5.3.0-zip/gcc/config/bfin/linux.h
193 124 dgisselq
--- gcc-5.3.0-original/gcc/config/bfin/linux.h  2016-04-11 22:20:22.143907624 -0400
194 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/bfin/linux.h       2015-01-05 07:33:28.000000000 -0500
195
@@ -45,7 +45,7 @@
196
   %{shared:-G -Bdynamic} \
197
   %{!shared: %{!static: \
198
    %{rdynamic:-export-dynamic} \
199
-   -dynamic-linker /tools/lib/ld-uClibc.so.0} \
200
+   -dynamic-linker /lib/ld-uClibc.so.0} \
201
    %{static}} -init __init -fini __fini"
202
 
203
 #undef TARGET_SUPPORTS_SYNC_CALLS
204
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/cris/linux.h gcc-5.3.0-zip/gcc/config/cris/linux.h
205 124 dgisselq
--- gcc-5.3.0-original/gcc/config/cris/linux.h  2016-04-11 22:20:22.143907624 -0400
206 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/cris/linux.h       2015-01-05 07:33:28.000000000 -0500
207
@@ -102,7 +102,7 @@
208
 #undef CRIS_DEFAULT_CPU_VERSION
209
 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
210
 
211
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
212
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
213
 
214
 #undef CRIS_LINK_SUBTARGET_SPEC
215
 #define CRIS_LINK_SUBTARGET_SPEC \
216
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/freebsd-spec.h gcc-5.3.0-zip/gcc/config/freebsd-spec.h
217 124 dgisselq
--- gcc-5.3.0-original/gcc/config/freebsd-spec.h        2016-04-11 22:20:22.143907624 -0400
218 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/freebsd-spec.h     2015-06-25 13:53:14.000000000 -0400
219
@@ -129,9 +129,9 @@
220
 #endif
221
 
222
 #if FBSD_MAJOR < 6
223
-#define FBSD_DYNAMIC_LINKER "/tools/libexec/ld-elf.so.1"
224
+#define FBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.1"
225
 #else
226
-#define FBSD_DYNAMIC_LINKER "/tools/libexec/ld-elf.so.1"
227
+#define FBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
228
 #endif
229
 
230
 /* NOTE: The freebsd-spec.h header is included also for various
231
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/frv/linux.h gcc-5.3.0-zip/gcc/config/frv/linux.h
232 124 dgisselq
--- gcc-5.3.0-original/gcc/config/frv/linux.h   2016-04-11 22:20:22.143907624 -0400
233 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/frv/linux.h        2015-01-05 07:33:28.000000000 -0500
234
@@ -34,7 +34,7 @@
235
 #define ENDFILE_SPEC \
236
   "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
237
 
238
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
239
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
240
 
241
 #undef LINK_SPEC
242
 #define LINK_SPEC "\
243
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/gnu.h gcc-5.3.0-zip/gcc/config/i386/gnu.h
244 124 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/gnu.h    2016-04-11 22:20:22.143907624 -0400
245 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/gnu.h 2015-01-05 07:33:28.000000000 -0500
246
@@ -22,7 +22,7 @@
247
 #define GNU_USER_LINK_EMULATION "elf_i386"
248
 
249
 #undef GNU_USER_DYNAMIC_LINKER
250
-#define GNU_USER_DYNAMIC_LINKER "/tools/lib/ld.so"
251
+#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so"
252
 
253
 #undef STARTFILE_SPEC
254
 #if defined HAVE_LD_PIE
255
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
256 124 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu64.h 2016-04-11 22:20:22.143907624 -0400
257 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu64.h      2015-01-05 07:33:28.000000000 -0500
258
@@ -22,6 +22,6 @@
259
 #define GNU_USER_LINK_EMULATION64 "elf_x86_64_fbsd"
260
 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64_fbsd"
261
 
262
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld.so.1"
263
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib/ld-kfreebsd-x86-64.so.1"
264
-#define GLIBC_DYNAMIC_LINKERX32 "/tools/lib/ld-kfreebsd-x32.so.1"
265
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
266
+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-kfreebsd-x86-64.so.1"
267
+#define GLIBC_DYNAMIC_LINKERX32 "/lib/ld-kfreebsd-x32.so.1"
268
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
269 124 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu.h   2016-04-11 22:20:22.143907624 -0400
270 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu.h        2015-01-05 07:33:28.000000000 -0500
271
@@ -19,4 +19,4 @@
272
 <http://www.gnu.org/licenses/>.  */
273
 
274
 #define GNU_USER_LINK_EMULATION "elf_i386_fbsd"
275
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
276
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
277
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/linux64.h gcc-5.3.0-zip/gcc/config/i386/linux64.h
278 124 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux64.h        2016-04-11 22:20:22.143907624 -0400
279 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/linux64.h     2015-01-05 07:33:28.000000000 -0500
280
@@ -27,6 +27,6 @@
281
 #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
282
 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
283
 
284
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-linux.so.2"
285
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib64/ld-linux-x86-64.so.2"
286
-#define GLIBC_DYNAMIC_LINKERX32 "/tools/libx32/ld-linux-x32.so.2"
287
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
288
+#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
289
+#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
290
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/linux.h gcc-5.3.0-zip/gcc/config/i386/linux.h
291 124 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux.h  2016-04-11 22:20:22.143907624 -0400
292 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/linux.h       2015-01-05 07:33:28.000000000 -0500
293
@@ -20,4 +20,4 @@
294
 <http://www.gnu.org/licenses/>.  */
295
 
296
 #define GNU_USER_LINK_EMULATION "elf_i386"
297
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
298
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
299
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/ia64/linux.h gcc-5.3.0-zip/gcc/config/ia64/linux.h
300 124 dgisselq
--- gcc-5.3.0-original/gcc/config/ia64/linux.h  2016-04-11 22:20:22.143907624 -0400
301 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/ia64/linux.h       2015-01-05 07:33:28.000000000 -0500
302
@@ -55,7 +55,7 @@
303
 /* Define this for shared library support because it isn't in the main
304
    linux.h file.  */
305
 
306
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux-ia64.so.2"
307
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
308
 
309
 #undef LINK_SPEC
310
 #define LINK_SPEC "\
311
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/knetbsd-gnu.h gcc-5.3.0-zip/gcc/config/knetbsd-gnu.h
312 124 dgisselq
--- gcc-5.3.0-original/gcc/config/knetbsd-gnu.h 2016-04-11 22:20:22.143907624 -0400
313 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/knetbsd-gnu.h      2015-01-05 07:33:28.000000000 -0500
314
@@ -32,4 +32,4 @@
315
 
316
 
317
 #undef GNU_USER_DYNAMIC_LINKER
318
-#define GNU_USER_DYNAMIC_LINKER "/tools/lib/ld.so.1"
319
+#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
320
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h gcc-5.3.0-zip/gcc/config/kopensolaris-gnu.h
321 124 dgisselq
--- gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h    2016-04-11 22:20:22.143907624 -0400
322 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/kopensolaris-gnu.h 2015-01-05 07:33:28.000000000 -0500
323
@@ -31,5 +31,4 @@
324
   while (0)
325
 
326
 #undef GNU_USER_DYNAMIC_LINKER
327
-#define GNU_USER_DYNAMIC_LINKER "/tools/lib/ld.so.1"
328
-
329
+#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
330
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/linux.h gcc-5.3.0-zip/gcc/config/linux.h
331 124 dgisselq
--- gcc-5.3.0-original/gcc/config/linux.h       2016-04-11 22:20:22.143907624 -0400
332 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/linux.h    2015-01-05 07:33:28.000000000 -0500
333
@@ -73,10 +73,10 @@
334
    GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
335
    GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
336
    supporting both 32-bit and 64-bit compilation.  */
337
-#define UCLIBC_DYNAMIC_LINKER "/tools/lib/ld-uClibc.so.0"
338
-#define UCLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-uClibc.so.0"
339
-#define UCLIBC_DYNAMIC_LINKER64 "/tools/lib/ld64-uClibc.so.0"
340
-#define UCLIBC_DYNAMIC_LINKERX32 "/tools/lib/ldx32-uClibc.so.0"
341
+#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
342
+#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
343
+#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
344
+#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
345
 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
346
 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
347
 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
348
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
349 124 dgisselq
--- gcc-5.3.0-original/gcc/config/lm32/uclinux-elf.h    2016-04-11 22:20:22.143907624 -0400
350 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/lm32/uclinux-elf.h 2015-01-05 07:33:28.000000000 -0500
351
@@ -67,7 +67,7 @@
352
    %{shared:-shared} \
353
    %{symbolic:-Bsymbolic} \
354
    %{rdynamic:-export-dynamic} \
355
-   -dynamic-linker /tools/lib/ld-linux.so.2"
356
+   -dynamic-linker /lib/ld-linux.so.2"
357
 
358
 #define TARGET_OS_CPP_BUILTINS() GNU_USER_TARGET_OS_CPP_BUILTINS()
359
 
360
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/m68k/linux.h gcc-5.3.0-zip/gcc/config/m68k/linux.h
361 124 dgisselq
--- gcc-5.3.0-original/gcc/config/m68k/linux.h  2016-04-11 22:20:22.143907624 -0400
362 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/m68k/linux.h       2015-01-05 07:33:28.000000000 -0500
363
@@ -71,7 +71,7 @@
364
    When the -shared link option is used a final link is not being
365
    done.  */
366
 
367
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
368
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
369
 
370
 #undef LINK_SPEC
371
 #define LINK_SPEC "-m m68kelf %{shared} \
372
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/microblaze/linux.h gcc-5.3.0-zip/gcc/config/microblaze/linux.h
373 124 dgisselq
--- gcc-5.3.0-original/gcc/config/microblaze/linux.h    2016-04-11 22:20:22.143907624 -0400
374 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/microblaze/linux.h 2015-05-28 10:08:19.000000000 -0400
375
@@ -28,7 +28,7 @@
376
 #undef TLS_NEEDS_GOT
377
 #define TLS_NEEDS_GOT 1
378
 
379
-#define DYNAMIC_LINKER "/tools/lib/ld.so.1"
380
+#define DYNAMIC_LINKER "/lib/ld.so.1"
381
 #undef  SUBTARGET_EXTRA_SPECS
382
 #define SUBTARGET_EXTRA_SPECS \
383
   { "dynamic_linker", DYNAMIC_LINKER }
384
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/mips/linux.h gcc-5.3.0-zip/gcc/config/mips/linux.h
385 124 dgisselq
--- gcc-5.3.0-original/gcc/config/mips/linux.h  2016-04-11 22:20:22.143907624 -0400
386 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/mips/linux.h       2015-01-05 07:33:28.000000000 -0500
387
@@ -22,20 +22,20 @@
388
 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
389
 
390
 #define GLIBC_DYNAMIC_LINKER32 \
391
-  "%{mnan=2008:/tools/lib/ld-linux-mipsn8.so.1;:/tools/lib/ld.so.1}"
392
+  "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
393
 #define GLIBC_DYNAMIC_LINKER64 \
394
-  "%{mnan=2008:/tools/lib64/ld-linux-mipsn8.so.1;:/tools/lib64/ld.so.1}"
395
+  "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}"
396
 #define GLIBC_DYNAMIC_LINKERN32 \
397
-  "%{mnan=2008:/tools/lib32/ld-linux-mipsn8.so.1;:/tools/lib32/ld.so.1}"
398
+  "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}"
399
 
400
 #undef UCLIBC_DYNAMIC_LINKER32
401
 #define UCLIBC_DYNAMIC_LINKER32 \
402
-  "%{mnan=2008:/tools/lib/ld-uClibc-mipsn8.so.0;:/tools/lib/ld-uClibc.so.0}"
403
+  "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
404
 #undef UCLIBC_DYNAMIC_LINKER64
405
 #define UCLIBC_DYNAMIC_LINKER64 \
406
-  "%{mnan=2008:/tools/lib/ld64-uClibc-mipsn8.so.0;:/tools/lib/ld64-uClibc.so.0}"
407
+  "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
408
 #define UCLIBC_DYNAMIC_LINKERN32 \
409
-  "%{mnan=2008:/tools/lib32/ld-uClibc-mipsn8.so.0;:/tools/lib32/ld-uClibc.so.0}"
410
+  "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
411
 
412
 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
413
 #define GNU_USER_DYNAMIC_LINKERN32 \
414
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/mn10300/linux.h gcc-5.3.0-zip/gcc/config/mn10300/linux.h
415 124 dgisselq
--- gcc-5.3.0-original/gcc/config/mn10300/linux.h       2016-04-11 22:20:22.143907624 -0400
416 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/mn10300/linux.h    2015-01-05 07:33:28.000000000 -0500
417
@@ -32,7 +32,7 @@
418
 #undef  ASM_SPEC
419
 #define ASM_SPEC ""
420
 
421
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
422
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
423
 
424
 #undef  LINK_SPEC
425
 #define LINK_SPEC "%{mrelax:--relax} %{shared:-shared} \
426
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
427 124 dgisselq
--- gcc-5.3.0-original/gcc/config/pa/pa-linux.h 2016-04-11 22:20:22.143907624 -0400
428 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/pa/pa-linux.h      2015-09-24 20:04:26.000000000 -0400
429
@@ -37,7 +37,7 @@
430
 /* Define this for shared library support because it isn't in the main
431
    linux.h file.  */
432
 
433
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
434
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
435
 
436
 #undef LINK_SPEC
437
 #define LINK_SPEC "\
438
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/rs6000/linux64.h gcc-5.3.0-zip/gcc/config/rs6000/linux64.h
439 124 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/linux64.h      2016-04-11 22:20:22.143907624 -0400
440 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/rs6000/linux64.h   2015-03-09 19:18:57.000000000 -0400
441
@@ -357,14 +357,14 @@
442
 #undef LINK_OS_DEFAULT_SPEC
443
 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
444
 
445
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld.so.1"
446
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
447
 #ifdef LINUX64_DEFAULT_ABI_ELFv2
448
-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/tools/lib64/ld64.so.1;:/tools/lib64/ld64.so.2}"
449
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
450
 #else
451
-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/tools/lib64/ld64.so.2;:/tools/lib64/ld64.so.1}"
452
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
453
 #endif
454
-#define UCLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-uClibc.so.0"
455
-#define UCLIBC_DYNAMIC_LINKER64 "/tools/lib/ld64-uClibc.so.0"
456
+#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
457
+#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
458
 #if DEFAULT_LIBC == LIBC_UCLIBC
459
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
460
 #elif DEFAULT_LIBC == LIBC_GLIBC
461
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/rs6000/sysv4.h gcc-5.3.0-zip/gcc/config/rs6000/sysv4.h
462 124 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/sysv4.h        2016-04-11 22:20:22.143907624 -0400
463 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/rs6000/sysv4.h     2015-09-24 09:46:45.000000000 -0400
464
@@ -757,8 +757,8 @@
465
 
466
 #define LINK_START_LINUX_SPEC ""
467
 
468
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
469
-#define UCLIBC_DYNAMIC_LINKER "/tools/lib/ld-uClibc.so.0"
470
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
471
+#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
472
 #if DEFAULT_LIBC == LIBC_UCLIBC
473
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
474
 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
475
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/s390/linux.h gcc-5.3.0-zip/gcc/config/s390/linux.h
476 124 dgisselq
--- gcc-5.3.0-original/gcc/config/s390/linux.h  2016-04-11 22:20:22.143907624 -0400
477 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/s390/linux.h       2015-05-11 03:14:10.000000000 -0400
478
@@ -60,8 +60,8 @@
479
 #define MULTILIB_DEFAULTS { "m31" }
480
 #endif
481
 
482
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld.so.1"
483
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib/ld64.so.1"
484
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
485
+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
486
 
487
 #undef  LINK_SPEC
488
 #define LINK_SPEC \
489
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sh/linux.h gcc-5.3.0-zip/gcc/config/sh/linux.h
490 124 dgisselq
--- gcc-5.3.0-original/gcc/config/sh/linux.h    2016-04-11 22:20:22.143907624 -0400
491 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/sh/linux.h 2015-01-05 07:33:28.000000000 -0500
492
@@ -43,7 +43,7 @@
493
 
494
 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
495
 
496
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
497
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
498
 
499
 #undef SUBTARGET_LINK_EMUL_SUFFIX
500
 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
501
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sparc/linux64.h gcc-5.3.0-zip/gcc/config/sparc/linux64.h
502 124 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux64.h       2016-04-11 22:20:22.143907624 -0400
503 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/sparc/linux64.h    2015-01-05 07:33:28.000000000 -0500
504
@@ -84,8 +84,8 @@
505
    When the -shared link option is used a final link is not being
506
    done.  */
507
 
508
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-linux.so.2"
509
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib64/ld-linux.so.2"
510
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
511
+#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
512
 
513
 #ifdef SPARC_BI_ARCH
514
 
515
@@ -193,7 +193,7 @@
516
 #else /* !SPARC_BI_ARCH */
517
 
518
 #undef LINK_SPEC
519
-#define LINK_SPEC "-m elf64_sparc -Y P,%R/tools/lib64 %{shared:-shared} \
520
+#define LINK_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
521
   %{!shared: \
522
     %{!static: \
523
       %{rdynamic:-export-dynamic} \
524
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sparc/linux.h gcc-5.3.0-zip/gcc/config/sparc/linux.h
525 124 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux.h 2016-04-11 22:20:22.143907624 -0400
526 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/sparc/linux.h      2015-01-05 07:33:28.000000000 -0500
527
@@ -83,7 +83,7 @@
528
    When the -shared link option is used a final link is not being
529
    done.  */
530
 
531
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
532
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
533
 
534
 #undef  LINK_SPEC
535
 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
536
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/vax/linux.h gcc-5.3.0-zip/gcc/config/vax/linux.h
537 124 dgisselq
--- gcc-5.3.0-original/gcc/config/vax/linux.h   2016-04-11 22:20:22.147907567 -0400
538 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/vax/linux.h        2015-01-05 07:33:28.000000000 -0500
539
@@ -41,7 +41,7 @@
540
   %{!shared: \
541
     %{!static: \
542
       %{rdynamic:-export-dynamic} \
543
-      -dynamic-linker /tools/lib/ld.so.1} \
544
+      -dynamic-linker /lib/ld.so.1} \
545
     %{static:-static}}"
546
 
547
 #undef  WCHAR_TYPE
548
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/xtensa/linux.h gcc-5.3.0-zip/gcc/config/xtensa/linux.h
549 124 dgisselq
--- gcc-5.3.0-original/gcc/config/xtensa/linux.h        2016-04-11 22:20:22.147907567 -0400
550 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/xtensa/linux.h     2015-01-05 07:33:28.000000000 -0500
551
@@ -44,7 +44,7 @@
552
   %{mlongcalls:--longcalls} \
553
   %{mno-longcalls:--no-longcalls}"
554
 
555
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
556
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
557
 
558
 #undef LINK_SPEC
559
 #define LINK_SPEC \
560
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/netbsd.h gcc-5.3.0-zip/gcc/config/zip/netbsd.h
561
--- gcc-5.3.0-original/gcc/config/zip/netbsd.h  1969-12-31 19:00:00.000000000 -0500
562
+++ gcc-5.3.0-zip/gcc/config/zip/netbsd.h       2016-01-30 15:04:14.796899050 -0500
563
@@ -0,0 +1,82 @@
564
+////////////////////////////////////////////////////////////////////////////////
565
+//
566
+// Filename:   netbsd.h
567
+//
568
+// Project:    Zip CPU backend for the GNU Compiler Collection
569
+//
570
+// Purpose:
571
+//
572
+// Creator:    Dan Gisselquist, Ph.D.
573
+//             Gisselquist Technology, LLC
574
+//
575
+////////////////////////////////////////////////////////////////////////////////
576
+//
577
+// Copyright (C) 2016, Gisselquist Technology, LLC
578
+//
579
+// This program is free software (firmware): you can redistribute it and/or
580
+// modify it under the terms of  the GNU General Public License as published
581
+// by the Free Software Foundation, either version 3 of the License, or (at
582
+// your option) any later version.
583
+//
584
+// This program is distributed in the hope that it will be useful, but WITHOUT
585
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
586
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
587
+// for more details.
588
+//
589
+// You should have received a copy of the GNU General Public License along
590
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
591
+// target there if the PDF file isn't present.)  If not, see
592
+// <http://www.gnu.org/licenses/> for a copy.
593
+//
594
+// License:    GPL, v3, as defined and found on www.gnu.org,
595
+//             http://www.gnu.org/licenses/gpl.html
596
+//
597
+//
598
+////////////////////////////////////////////////////////////////////////////////
599
+#ifndef        ZIP_NETBSD_H
600
+#define        ZIP_NETBSD_H
601
+
602
+/* Define default target values. */
603
+
604
+#undef MACHINE_TYPE
605
+#define        MACHINE_TYPE    "NetBSD/Zip ELF"
606
+
607
+#undef TARGET_OS_CPP_BUILTINS
608
+#define        TARGET_OS_CPP_BUILTINS()        \
609
+       do { NETBSD_OS_CPP_BUILTINS_ELF();              \
610
+       builtin_define("__ZIPCPU__");                   \
611
+       builtin_assert("cpu=zip");                      \
612
+       builtin_assert("machine=zip");                  \
613
+       } while(0);
614
+
615
+#undef CPP_SPEC
616
+#define        CPP_SPEC        NETBSD_CPP_SPEC
617
+
618
+#undef STARTFILE_SPEC
619
+#define        STARTFILE_SPEC  NETBSD_STARTFILE_SPEC
620
+
621
+#undef ENDFILE_SPEC
622
+#define        ENDFILE_SPEC    NETBSD_ENDFILE_SPEC
623
+
624
+#undef LIB_SPEC
625
+#define        LIB_SPEC        NETBSD_LIB_SPEC
626
+
627
+#undef TARGET_VERSION
628
+#define        TARGET_VERSION  fprintf(stderr, " (%s)", MACHINE_TYPE);
629
+
630
+/* Make gcc agree with <machine/ansi.h> */
631
+
632
+#undef WCHAR_TYPE
633
+#define        WCHAR_TYPE      "int"
634
+
635
+#undef WCHAR_TYPE_SIZE
636
+#define        WCHAR_TYPE_SIZE 32
637
+
638
+#undef WINT_TYPE
639
+#define        WINT_TYPE       "int"
640
+
641
+/* Clean up after the generic Zip/ELF configuration. */
642
+#undef MD_EXEC_PREFIX
643
+#undef MD_STARTFILE_PREFIX
644
+
645
+#endif /* ZIP_NETBSD_H */
646
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/t-zip gcc-5.3.0-zip/gcc/config/zip/t-zip
647
--- gcc-5.3.0-original/gcc/config/zip/t-zip     1969-12-31 19:00:00.000000000 -0500
648
+++ gcc-5.3.0-zip/gcc/config/zip/t-zip  2016-02-04 19:00:59.939652587 -0500
649
@@ -0,0 +1,47 @@
650
+################################################################################
651
+##
652
+## Filename:   t-zip
653
+##
654
+## Project:    Zip CPU backend for the GNU Compiler Collection
655
+##
656
+## Purpose:
657
+##
658
+## Creator:    Dan Gisselquist, Ph.D.
659
+##             Gisselquist Technology, LLC
660
+##
661
+################################################################################
662
+##
663
+## Copyright (C) 2016, Gisselquist Technology, LLC
664
+##
665
+## This program is free software (firmware): you can redistribute it and/or
666
+## modify it under the terms of  the GNU General Public License as published
667
+## by the Free Software Foundation, either version 3 of the License, or (at
668
+## your option) any later version.
669
+##
670
+## This program is distributed in the hope that it will be useful, but WITHOUT
671
+## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
672
+## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
673
+## for more details.
674
+##
675
+## You should have received a copy of the GNU General Public License along
676
+## with this program.  (It's in the $(ROOT)/doc directory, run make with no
677
+## target there if the PDF file isn't present.)  If not, see
678
+## <http://www.gnu.org/licenses/> for a copy.
679
+##
680
+## License:    GPL, v3, as defined and found on www.gnu.org,
681
+##             http://www.gnu.org/licenses/gpl.html
682
+##
683
+##
684
+################################################################################
685
+
686
+FPBIT = fp-bit.c
687
+DPBIT = dp-bit.c
688
+
689
+# dp-bit.c: $(srcdir)/config/fp-bit.c
690
+       # cat $(srcdir)/config/fp-bit.c > dp-bit.c
691
+#
692
+# fp-bit.c: $(srcdir)/config/fp-bit.c
693
+       # echo '#define FLOAT" > fp-bit.c
694
+       # cat $(srcdir)/config/fp-bit.c >> fp-bit.c
695
+
696
+
697
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.c gcc-5.3.0-zip/gcc/config/zip/zip.c
698
--- gcc-5.3.0-original/gcc/config/zip/zip.c     1969-12-31 19:00:00.000000000 -0500
699 124 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.c  2016-04-07 16:23:35.651592937 -0400
700
@@ -0,0 +1,2126 @@
701 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
702
+//
703
+// Filename:   zip.c
704
+//
705
+// Project:    Zip CPU backend for the GNU Compiler Collection
706
+//
707
+// Purpose:
708
+//
709
+// Creator:    Dan Gisselquist, Ph.D.
710
+//             Gisselquist Technology, LLC
711
+//
712
+////////////////////////////////////////////////////////////////////////////////
713
+//
714
+// Copyright (C) 2016, Gisselquist Technology, LLC
715
+//
716
+// This program is free software (firmware): you can redistribute it and/or
717
+// modify it under the terms of  the GNU General Public License as published
718
+// by the Free Software Foundation, either version 3 of the License, or (at
719
+// your option) any later version.
720
+//
721
+// This program is distributed in the hope that it will be useful, but WITHOUT
722
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
723
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
724
+// for more details.
725
+//
726
+// You should have received a copy of the GNU General Public License along
727
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
728
+// target there if the PDF file isn't present.)  If not, see
729
+// <http://www.gnu.org/licenses/> for a copy.
730
+//
731
+// License:    GPL, v3, as defined and found on www.gnu.org,
732
+//             http://www.gnu.org/licenses/gpl.html
733
+//
734
+//
735
+////////////////////////////////////////////////////////////////////////////////
736
+#include "config.h"
737
+#include "system.h"
738
+#include "coretypes.h"
739
+#include "tm.h"
740
+#include "rtl.h"
741
+#include "dominance.h"
742
+#include "cfg.h"
743
+#include "cfgrtl.h"
744
+#include "cfganal.h"
745
+#include "lcm.h"
746
+#include "cfgbuild.h"
747
+#include "cfgcleanup.h"
748
+#include "predict.h"
749
+#include "basic-block.h"
750
+#include "df.h"
751
+#include "hashtab.h"
752
+#include "hash-set.h"
753
+#include "machmode.h"
754
+#include "symtab.h"
755
+#include "rtlhash.h"
756
+#include "tree.h"
757
+#include "regs.h"
758
+#include "hard-reg-set.h"
759
+#include "real.h"
760
+#include "insn-config.h"
761
+#include "conditions.h"
762
+#include "output.h"
763
+#include "insn-attr.h"
764
+#include "flags.h"
765
+#include "expr.h"
766
+#include "function.h"
767
+#include "recog.h"
768
+#include "toplev.h"
769
+#include "ggc.h"
770
+#include "builtins.h"
771
+#include "calls.h"
772
+#include "langhooks.h"
773
+#include "optabs.h"
774
+#include "explow.h"
775
+#include "emit-rtl.h"
776 122 dgisselq
+#include "ifcvt.h"
777 102 dgisselq
+
778
+// #include "tmp_p.h"
779
+#include "target.h"
780
+#include "target-def.h"
781
+// #include "tm-constrs.h"
782 122 dgisselq
+#include "tm-preds.h"
783 102 dgisselq
+
784
+#include "diagnostic.h"
785
+// #include "integrate.h"
786
+
787
+// static int  zip_arg_partial_bytes(CUMULATIVE_ARGS *, enum machine_mode, tree, bool);
788
+// static      bool    zip_pass_by_reference(CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool);
789
+static bool    zip_return_in_memory(const_tree, const_tree);
790
+static bool    zip_frame_pointer_required(void);
791
+
792
+static void zip_function_arg_advance(cumulative_args_t ca, enum machine_mode mode,
793
+               const_tree type, bool named);
794
+static rtx zip_function_arg(cumulative_args_t ca, enum machine_mode mode, const_tree type, bool named);
795
+
796
+static void    zip_asm_trampoline_template(FILE *);
797
+static void    zip_trampoline_init(rtx, tree, rtx);
798
+static void    zip_init_builtins(void);
799
+static tree zip_builtin_decl(unsigned, bool);
800
+// static void zip_asm_output_anchor(rtx x);
801
+       void    zip_asm_output_def(FILE *s, const char *n, const char *v);
802
+static rtx     zip_expand_builtin(tree exp, rtx target, rtx subtarget,
803
+                       enum machine_mode tmode, int    ignore);
804
+static bool    zip_scalar_mode_supported_p(enum machine_mode mode);
805
+static bool    zip_libgcc_floating_mode_supported_p(enum machine_mode mode);
806
+static int     zip_address_cost(rtx addr, enum machine_mode mode, addr_space_t as, bool spd);
807
+static bool    zip_mode_dependent_address_p(const_rtx addr, addr_space_t);
808
+static unsigned HOST_WIDE_INT  zip_const_anchor = 0x20000;
809 122 dgisselq
+static          HOST_WIDE_INT  zip_min_opb_imm = -0x20000;
810
+static          HOST_WIDE_INT  zip_max_opb_imm =  0x1ffff;
811 102 dgisselq
+static          HOST_WIDE_INT  zip_min_anchor_offset = -0x20000;
812
+static          HOST_WIDE_INT  zip_max_anchor_offset =  0x1ffff;
813
+static          HOST_WIDE_INT  zip_min_mov_offset = -0x1000;
814
+static          HOST_WIDE_INT  zip_max_mov_offset =  0x0fff;
815
+static int     zip_sched_issue_rate(void) { return 1; }
816
+static bool    zip_legitimate_address_p(machine_mode, rtx, bool);
817
+static bool    zip_legitimate_move_operand_p(machine_mode, rtx, bool);
818
+       void    zip_debug_rtx_pfx(const char *, const_rtx x);
819
+       void    zip_debug_rtx(const_rtx x);
820
+static void    zip_override_options(void);
821
+static bool    zip_can_eliminate(int from ATTRIBUTE_UNUSED, int to);
822
+static int     zip_memory_move_cost(machine_mode, reg_class_t, bool);
823 111 dgisselq
+static rtx     zip_legitimize_address(rtx x, rtx oldx, machine_mode mode);
824 117 dgisselq
+static bool    zip_cannot_modify_jumps_p(void);
825 122 dgisselq
+#ifdef HAVE_cc0
826
+       void    zip_update_cc_notice(rtx exp, rtx_insn *insn);
827
+#error "We're not supposed to have CC0 anymore"
828
+#else
829
+static bool    zip_fixed_condition_code_regs(unsigned int *a, unsigned int *b);
830
+#endif
831 102 dgisselq
+
832
+
833 103 dgisselq
+#define        ALL_DEBUG_OFF   false
834 102 dgisselq
+#define        ALL_DEBUG_ON    false
835
+
836
+enum ZIP_BUILTIN_ID_CODE {
837
+       ZIP_BUILTIN_RTU,
838
+       ZIP_BUILTIN_HALT,
839
+       ZIP_BUILTIN_IDLE,
840
+       ZIP_BUILTIN_SYSCALL,
841
+       ZIP_BUILTIN_SAVE_CONTEXT,
842
+       ZIP_BUILTIN_RESTORE_CONTEXT,
843
+       ZIP_BUILTIN_BITREV,
844
+       ZIP_BUILTIN_CC,
845 117 dgisselq
+       ZIP_BUILTIN_UCC,
846 102 dgisselq
+       ZIP_BUILTIN_MAX
847
+};
848
+
849
+static GTY (()) tree   zip_builtins[(int)ZIP_BUILTIN_MAX];
850
+static enum insn_code  zip_builtins_icode[(int)ZIP_BUILTIN_MAX];
851
+
852
+
853
+#include "gt-zip.h"
854
+
855
+/* The Global 'targetm' Variable. */
856
+struct gcc_target      targetm = TARGET_INITIALIZER;
857
+
858
+
859
+enum   reg_class zip_reg_class(int);
860
+
861
+#define        LOSE_AND_RETURN(msgid, x)               \
862
+       do {                                    \
863
+               zip_operand_lossage(msgid, x);  \
864
+               return;                         \
865
+       } while(0)
866
+
867
+/* Per-function machine data. */
868
+struct GTY(()) machine_function
869
+{
870
+       /* number of pretented arguments for varargs */
871
+       int     pretend_size;
872
+
873
+       /* Number of bytes saved on the stack for local variables. */
874
+       int     local_vars_size;
875
+
876
+       /* Number of bytes saved on stack for register save area */
877
+       int     saved_reg_size;
878
+       int     save_ret;
879
+
880
+       int     sp_fp_offset;
881
+       bool    fp_needed;
882
+       int     size_for_adjusting_sp;
883
+};
884
+
885
+/* Allocate a chunk of memory for per-function machine-dependent data. */
886
+
887
+static struct machine_function *
888
+zip_init_machine_status(void) {
889
+       return ggc_cleared_alloc<machine_function>();
890
+}
891
+
892
+static void
893
+zip_override_options(void)
894
+{
895
+       init_machine_status = zip_init_machine_status;
896
+}
897
+
898
+enum   reg_class
899
+zip_reg_class(int regno)
900
+{
901
+       if (is_ZIP_GENERAL_REG(regno)) {
902
+               return GENERAL_REGS;
903
+       } else if (is_ZIP_REG(regno)) {
904
+               return ALL_REGS;
905
+       } return NO_REGS;
906
+}
907
+
908
+/* Worker function for TARGET_RETURN_IN_MEMORY. */
909
+static bool
910
+zip_return_in_memory(const_tree type, const_tree fntype ATTRIBUTE_UNUSED) {
911
+       const   HOST_WIDE_INT size = int_size_in_bytes(type);
912
+       return (size == -1)||(size > UNITS_PER_WORD);
913
+}
914
+
915
+/* Emit an error emssage when we're in an asm, and a fatal error for "normal"
916
+ * insn.  Formatted output isn't easily implemented, since we use output operand
917
+ * lossage to output the actual message and handle the categorization of the
918
+ * error.  */
919
+
920
+static void
921
+zip_operand_lossage(const char *msgid, rtx op) {
922
+       fprintf(stderr, "Operand lossage??\n");
923
+       debug_rtx(op);
924
+       zip_debug_rtx(op);
925
+       output_operand_lossage("%s", msgid);
926
+}
927
+
928
+/* The PRINT_OPERAND_ADDRESS worker.   */
929
+void
930
+zip_print_operand_address(FILE *file, rtx x) {
931
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
932
+
933
+       if (dbg) zip_debug_rtx(x);
934
+       switch(GET_CODE(x)) {
935
+               case REG:
936
+                       fprintf(file, "(%s)", reg_names[REGNO(x)]);
937
+                       break;
938
+               case SYMBOL_REF:
939
+                       fprintf(file, "%s", XSTR(x,0));
940
+                       break;
941
+               case LABEL_REF:
942
+                       x = LABEL_REF_LABEL(x);
943
+               case CODE_LABEL:
944
+                       { char buf[256];
945
+                       ASM_GENERATE_INTERNAL_LABEL(buf, "L", CODE_LABEL_NUMBER(x));
946
+#ifdef ASM_OUTPUT_LABEL_REF
947
+                       ASM_OUTPUT_LABEL_REF(file, buf);
948
+#else
949
+                       assemble_name(file, buf);
950
+#endif
951
+                       }
952
+                       break;
953
+               case PLUS:
954 111 dgisselq
+                       if (!REG_P(XEXP(x, 0))) {
955
+                               fprintf(stderr, "Unsupported address construct\n");
956
+                               zip_debug_rtx(x);
957 102 dgisselq
+                               abort();
958 111 dgisselq
+                       } if (CONST_INT_P(XEXP(x, 1))) {
959 102 dgisselq
+                               if (INTVAL(XEXP(x,1))!=0) {
960
+                                       fprintf(file, "%ld(%s)",
961
+                                       INTVAL(XEXP(x, 1)),
962
+                                       reg_names[REGNO(XEXP(x, 0))]);
963
+                               } else {
964
+                                       fprintf(file, "(%s)",
965
+                                       reg_names[REGNO(XEXP(x, 0))]);
966
+                               }
967
+                       } else if (GET_CODE(XEXP(x,1)) == SYMBOL_REF) {
968
+                               fprintf(file, "%s(%s)", XSTR(x,0),
969
+                                       reg_names[REGNO(XEXP(x, 0))]);
970
+                       } else if ((GET_CODE(XEXP(x, 1)) == MINUS)
971
+                               && (GET_CODE(XEXP(XEXP(x, 1), 0))==SYMBOL_REF)
972
+                               && (GET_CODE(XEXP(XEXP(x, 1), 1))==SYMBOL_REF)) {
973
+                               fprintf(file, "%s-%s(%s)",
974
+                                       XSTR(XEXP(XEXP(x, 1),0),0),
975
+                                       XSTR(XEXP(XEXP(x, 1),1),0),
976
+                                       reg_names[REGNO(XEXP(x, 0))]);
977
+                       } else
978
+                               fprintf(file, "#INVALID(%s)",
979
+                                       reg_names[REGNO(XEXP(x, 0))]);
980
+                       /*
981
+                       else if (GET_CODE(XEXP(addr, 1)) == LABEL)
982
+                               fprintf(file, "%s(%s)",
983
+                                       GET_CODE(XEXP(addr, 1)),
984
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
985
+                       else if ((GET_CODE(XEXP(addr, 1)) == MINUS)
986
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 0))==LABEL)
987
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 1))==LABEL)) {
988
+                               fprintf(file, "%s-%s(%s)",
989
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
990
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
991
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
992
+                       }
993
+                       */
994
+                       break;
995
+               // We don't support direct memory addressing within our
996
+               // instruction set, even though the instructions themselves
997
+               // would support direct memory addressing of the lower 18 bits
998
+               // of memory space.
999
+               case MEM:
1000
+                       if (dbg) zip_debug_rtx(x);
1001
+                       zip_print_operand_address(file, XEXP(x, 0));
1002
+                       break;
1003 111 dgisselq
+               case CONST_INT:
1004
+                       fprintf(file, "%ld",INTVAL(x));
1005
+                       break;
1006 102 dgisselq
+               default:
1007 111 dgisselq
+                       fprintf(stderr, "Unknown address format\n");
1008
+                       zip_debug_rtx(x);
1009 102 dgisselq
+                       abort(); break;
1010
+                       // output_addr_const(file, x);
1011
+               break;
1012
+       }
1013
+}
1014
+
1015
+/* The PRINT_OPERAND worker. */
1016
+
1017
+void
1018
+zip_print_operand(FILE *file, rtx x, int code)
1019
+{
1020
+       rtx operand = x;
1021
+       int     rgoff = 0;
1022
+
1023
+       // fprintf(file, "Print Operand!\n");
1024
+
1025
+       /* New code entries should just be added to the switch below.  If
1026
+        * handling is finished, just return.  If handling was just a
1027
+        * modification of the operand, the modified operand should be put in
1028
+        * "operand", and then do a break to let default handling
1029
+        * (zero-modifier) output the operand.
1030
+        */
1031
+       switch(code) {
1032
+               case 0:
1033
+                       /* No code, print as usual. */
1034
+                       break;
1035
+               case 'L':
1036
+                       /* Lower of two registers, print one up */
1037
+                       rgoff = 1;
1038
+                       break;
1039
+               case 'R':
1040
+               case 'H':
1041
+                       /* Higher of a register pair, print normal */
1042
+                       break;
1043
+
1044
+               default:
1045
+                       LOSE_AND_RETURN("invalid operand modifier letter", x);
1046
+       }
1047
+
1048
+       /* Print an operand as without a modifier letter. */
1049
+       switch (GET_CODE(operand)) {
1050
+       case REG:
1051
+               if (REGNO(operand)+rgoff >= FIRST_PSEUDO_REGISTER)
1052
+                       internal_error("internal error: bad register: %d", REGNO(operand));
1053
+               fprintf(file, "%s", reg_names[REGNO(operand)+rgoff]);
1054
+               return;
1055
+       case SCRATCH:
1056
+               LOSE_AND_RETURN("Need a scratch register", x);
1057
+               return;
1058
+
1059
+       case CODE_LABEL:
1060
+       case LABEL_REF:
1061
+       case SYMBOL_REF:
1062
+       case PLUS:
1063
+               PRINT_OPERAND_ADDRESS(file, operand);
1064
+               return;
1065
+       case MEM:
1066
+               PRINT_OPERAND_ADDRESS(file, XEXP(operand, 0));
1067
+               return;
1068
+
1069
+       default:
1070
+               /* No need to handle all strange variants, let
1071
+                * output_addr_const do it for us.
1072
+                */
1073
+               if (CONSTANT_P(operand)) {
1074
+                       output_addr_const(file, operand);
1075
+                       return;
1076
+               }
1077
+
1078
+               LOSE_AND_RETURN("unexpected operand", x);
1079
+       }
1080
+}
1081
+
1082
+static bool
1083
+zip_frame_pointer_required(void)
1084
+{
1085
+       // This should really depend upon whether we have variable sized
1086
+       // arguments in our frame or not.  Once this fails, let's look
1087
+       // at what the problem was and then whether or not we can detect
1088
+       // it.
1089
+       //
1090
+       // Use a GCC global to determine our answer
1091 103 dgisselq
+       if (cfun->calls_alloca)
1092
+               return true;
1093 102 dgisselq
+       return (frame_pointer_needed);
1094
+/*
1095
+*/
1096
+}
1097
+
1098
+/* Determine whether or not a register needs to be saved on the stack or not.
1099
+ */
1100
+static bool
1101
+zip_save_reg(int regno) {
1102
+       if (regno == 0)
1103
+               return ((!crtl->is_leaf)
1104
+                       ||((df_regs_ever_live_p(0))&&(!call_used_regs[0])));
1105
+       else if ((regno == zip_GOT)&&(!ZIP_PIC))
1106
+               return  ((df_regs_ever_live_p(regno))
1107
+                               &&(!call_used_regs[regno]));
1108
+       else if (regno == zip_FP)
1109
+               return((zip_frame_pointer_required())||((df_regs_ever_live_p(regno))
1110
+                               &&(!call_used_regs[regno])));
1111
+       else if (regno < zip_FP)
1112
+               return  ((df_regs_ever_live_p(regno))
1113
+                               &&(!call_used_regs[regno]));
1114
+       return false;
1115
+}
1116
+
1117
+/* Compute the size of the local area and the size to be adjusted by the
1118
+ * prologue and epilogue.
1119
+ *
1120
+ * Here's what we are looking at (top is the current, bottom is the last ...)
1121
+ *
1122
+ *     Stack Pointer ->
1123 124 dgisselq
+ *                     Outgoing arguments
1124 102 dgisselq
+ *                     Local variables (could be variable size)
1125
+ *     Frame Pointer ->        (= Stack Pointer + sp_fp_offset)
1126
+ *                     Saved return address, if saved
1127
+ *                     Other Saved registers
1128
+ *                     Saved frame pointer (if used)
1129
+ *                     Saved R12, if used
1130
+ *                     (Stack pointer is not saved)
1131
+ *     Original stack pointer ->       (= Stack_Pointer +size_for_adjusting_sp)
1132
+ *                     Called arguments (not passed in registers)
1133
+ *                     Return arguments (not R1, args.pretend_args_size)
1134
+ *             (Prior function's stack frame ... )
1135
+ *
1136
+ */
1137
+static void
1138
+zip_compute_frame(void) {
1139
+       int     regno;
1140
+       int     args_size;
1141 124 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1142 102 dgisselq
+
1143 124 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-COMPUTE-FRAME\n");
1144 102 dgisselq
+       // gcc_assert(crtl);
1145
+       gcc_assert(cfun);
1146
+       gcc_assert(cfun->machine);
1147
+
1148
+       args_size=(ACCUMULATE_OUTGOING_ARGS ? crtl->outgoing_args_size : 0);
1149
+
1150
+       if(crtl->args.pretend_args_size > 0) {
1151
+               args_size += crtl->args.pretend_args_size;
1152
+               // printf("%s pretend_args_size : %d\n", current_function_name(),
1153
+                       // crtl->args.pretend_args_size);
1154
+               cfun->machine->pretend_size = crtl->args.pretend_args_size;
1155
+       }
1156
+
1157
+       cfun->machine->local_vars_size = get_frame_size();
1158
+
1159
+       // Save callee-saved registers.
1160
+       cfun->machine->saved_reg_size = 0;
1161
+       for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1162
+               if (zip_save_reg(regno))
1163
+                       cfun->machine->saved_reg_size ++;
1164
+       }
1165
+
1166
+       cfun->machine->fp_needed = (zip_frame_pointer_required());
1167
+
1168
+       if ((cfun->machine->fp_needed)&&
1169
+                       (!df_regs_ever_live_p(zip_FP))) {
1170
+               cfun->machine->saved_reg_size ++;
1171
+       }
1172
+
1173
+       cfun->machine->sp_fp_offset = args_size + cfun->machine->local_vars_size;
1174
+       cfun->machine->size_for_adjusting_sp = cfun->machine->local_vars_size
1175
+                       + cfun->machine->saved_reg_size
1176
+                       + args_size;
1177 124 dgisselq
+       if(dbg) {
1178
+               fprintf(stderr, "\tFRAME-POINTR: %s\n",
1179
+                       cfun->machine->fp_needed?"Yes":"No");
1180
+               fprintf(stderr, "\tARGS-SIZE   : %d\n",
1181
+                       args_size);
1182
+               fprintf(stderr, "\tLOCALS-SIZE : %d\n",
1183
+                       cfun->machine->local_vars_size);
1184
+               fprintf(stderr, "\tREGISTERS   : %d\n",
1185
+                       cfun->machine->saved_reg_size);
1186
+               fprintf(stderr, "\tSP_FP_OFFSET: %d\n",
1187
+                       cfun->machine->sp_fp_offset);
1188
+               fprintf(stderr, "\tSP-ADJUSTMNT: %d\n",
1189
+                       cfun->machine->size_for_adjusting_sp);
1190
+       }
1191 102 dgisselq
+}
1192
+
1193
+void
1194
+zip_expand_prologue(void) {
1195
+       rtx     insn;
1196
+
1197
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1198
+       zip_compute_frame();
1199
+
1200 124 dgisselq
+       if (dbg)  fprintf(stderr, "PROLOGUE: Computing Prologue instructions\n");
1201 102 dgisselq
+       if (cfun->machine->size_for_adjusting_sp != 0) {
1202
+               insn = emit_insn(gen_subsi3(stack_pointer_rtx,
1203
+                               stack_pointer_rtx,
1204
+                       gen_int_mode(cfun->machine->size_for_adjusting_sp,
1205
+                               SImode)));
1206
+                       // cfun->machine->sp_fp_offset
1207
+
1208
+               RTX_FRAME_RELATED_P(insn) = 1;
1209
+       }
1210
+
1211
+       {
1212
+               int offset = 0, regno;
1213
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1214
+                       if (zip_save_reg(regno)) {
1215 124 dgisselq
+                               insn=emit_insn(gen_movsi_sto_off(
1216
+                                       stack_pointer_rtx,
1217
+                                       GEN_INT(cfun->machine->sp_fp_offset
1218
+                                               +offset++),
1219 102 dgisselq
+                                       gen_rtx_REG(SImode, regno)));
1220
+                               RTX_FRAME_RELATED_P(insn) = 1;
1221
+                       }
1222
+               }
1223 103 dgisselq
+               if (dbg)  fprintf(stderr, "%d registers saved%s\n", offset,
1224
+                       (crtl->saves_all_registers)?", should be all of them":", less than all");
1225 102 dgisselq
+       }
1226
+
1227
+       if (cfun->machine->fp_needed) {
1228
+               if (dbg) zip_debug_rtx(stack_pointer_rtx);
1229
+               if (dbg) zip_debug_rtx(frame_pointer_rtx);
1230
+               insn = emit_insn(gen_movsi_reg_off(frame_pointer_rtx,
1231 124 dgisselq
+                               stack_pointer_rtx,
1232
+                               GEN_INT(cfun->machine->sp_fp_offset)));
1233 102 dgisselq
+               RTX_FRAME_RELATED_P(insn) = 1;
1234 103 dgisselq
+               if (dbg)  fprintf(stderr, "sp_fp_offset is %d\n", cfun->machine->sp_fp_offset);
1235 102 dgisselq
+       }
1236
+}
1237
+
1238
+bool
1239
+zip_use_return_insn(void)
1240
+{
1241
+       if ((!reload_completed)||(cfun->machine->fp_needed)
1242
+                       ||(get_frame_size()!=0)) {
1243
+               // If R0 ever gets pushed to the stack, then we cannot
1244
+               // use a master return from anywhere.  We need to clean up the
1245
+               // stack first.
1246
+               if ((!crtl->is_leaf)||((df_regs_ever_live_p(0))
1247
+                                               &&(!call_used_regs[0]))) {
1248
+                       return false;
1249
+               }
1250
+       }
1251
+       zip_compute_frame();
1252
+       return (cfun->machine->size_for_adjusting_sp == 0);
1253
+}
1254
+
1255
+/* As per the notes in M68k.c, quote the function epilogue should not depend
1256
+ * upon the current stack pointer.  It should use the frame poitner only,
1257
+ * if there is a frame pointer.  This is mandatory because of alloca; we also
1258
+ * take advantage of it to omit stack adjustments before returning ...
1259
+ *
1260
+ * Let's see if we can use their approach here.
1261
+ *
1262
+ * We can't.  Consider our choices:
1263
+ *     LOD (FP),R0
1264
+ *     LOD 1(FP),R4
1265
+ *     LOD 2(FP),R5
1266
+ *     LOD 3(FP),R6
1267
+ *     LOD 4(FP),FP
1268
+ *     ... Then what is the stack pointer?
1269
+ * or
1270
+ *     LOD (FP),R0
1271
+ *     LOD 1(FP),R4
1272
+ *     LOD 2(FP),R5
1273
+ *     LOD 3(FP),R6
1274
+ *     MOV FP,SP
1275
+ *     LOD 4(SP),FP
1276
+ *     ... Which suffers unnecessary pipeline stalls, and certainly doesn't
1277
+ *     exploit our pipeline memory function
1278
+ * or
1279
+ *     MOV FP,SP
1280
+ *     LOD (SP),R0
1281
+ *     LOD 1(SP),R4
1282
+ *     LOD 2(SP),R5
1283
+ *     LOD 3(SP),R6
1284
+ *     LOD 4(SP),FP
1285
+ * Which will be our choice.  Note that we do use the stack pointer, eventually.
1286
+ *
1287
+ */
1288
+void
1289
+zip_expand_epilogue(void) {
1290
+       int     regno, offset;
1291
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1292
+
1293
+       zip_compute_frame();
1294
+
1295
+       if (dbg) fprintf(stderr, "EPILOG::\n");
1296
+       if (cfun->machine->fp_needed) {
1297 124 dgisselq
+               // This is done special--if you can't trust the stack pointer
1298
+               // enough so that you must have a frame pointer, then you can't
1299
+               // trust its offset enough to restore from it.  Hence, we start
1300
+               // by moving the frame pointer to the stack pointer to recover
1301
+               // the stack pointer back to a usable value.
1302 102 dgisselq
+               if (dbg) fprintf(stderr, "EPILOG::Moving frame pointer to stack register\n");
1303
+               emit_insn(gen_movsi_reg(stack_pointer_rtx, frame_pointer_rtx));
1304
+       }
1305
+
1306
+       if (cfun->machine->saved_reg_size != 0) {
1307 124 dgisselq
+               if (cfun->machine->fp_needed)
1308
+                       offset = 0;
1309
+               else
1310
+                       offset = cfun->machine->sp_fp_offset;
1311 102 dgisselq
+               if (dbg) fprintf(stderr, "EPILOG::Saved_REG_Size = %d\n", cfun->machine->saved_reg_size);
1312
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1313
+                       if (zip_save_reg(regno)) {
1314
+                               if (dbg) fprintf(stderr, "EPILOG::RESTORING R%d\n", regno);
1315 124 dgisselq
+                               emit_insn(gen_movsi_lod_off(
1316 102 dgisselq
+                                               gen_rtx_REG(SImode, regno),
1317 124 dgisselq
+                                               stack_pointer_rtx,
1318
+                                               GEN_INT(offset++)));
1319 102 dgisselq
+                       }
1320
+               }
1321
+       }
1322
+
1323 124 dgisselq
+       if (cfun->machine->fp_needed) {
1324
+               // Restore the stack pointer back to the original, the
1325
+               // difference being the difference from the frame pointer
1326
+               // to the original stack
1327
+               emit_insn(gen_addsi3(stack_pointer_rtx, stack_pointer_rtx,
1328
+                       GEN_INT(cfun->machine->size_for_adjusting_sp
1329
+                               -cfun->machine->sp_fp_offset)));
1330
+       } else {
1331
+               // else now the difference is between the stack pointer and
1332
+               // the original stack pointer.
1333 102 dgisselq
+               if (dbg) fprintf(stderr, "EPILOG::ADDSI3(StackPtr, %d)\n",
1334
+                               cfun->machine->size_for_adjusting_sp);
1335
+               emit_insn(gen_addsi3(stack_pointer_rtx, stack_pointer_rtx,
1336 124 dgisselq
+                       GEN_INT(cfun->machine->size_for_adjusting_sp)));
1337 102 dgisselq
+       }
1338
+       if (dbg) fprintf(stderr, "EPILOG::EMITTING-RETURN\n");
1339
+
1340
+       emit_jump_insn(ret_rtx);
1341
+}
1342
+
1343
+/* Implement RETURN_ADDR_RTX(COUNT, FRAMEADDR).
1344
+ *
1345
+ * We currently only support calculating the return address for the current
1346
+ * frame.
1347
+ */
1348
+
1349
+/*
1350
+rtx
1351
+zip_return_addr_rtx(int count, rtx frame ATTRIBUTE_UNUSED)
1352
+{
1353
+       if (count)
1354
+               return NULL_RTX;
1355
+
1356
+       zip_compute_frame();
1357
+
1358
+       // saved return address for current function is at fp - 1
1359
+       if (cfun->machine->save_ret)
1360
+               return gen_rtx_MEM(Pmode, plus_constant(frame_pointer_rtx,
1361
+                               -UNITS_PER_WORD));
1362
+       return get_hard_reg_initial_val(Pmode, RETURN_ADDRESS_REGNUM);
1363
+}
1364
+*/
1365
+
1366
+/* Implements the macro INITIAL_ELIMINATION_OFFSET,
1367
+ * return the OFFSET.
1368
+ */
1369
+int
1370
+zip_initial_elimination_offset(int from, int to) {
1371
+       int     ret = 0;
1372
+       zip_compute_frame();
1373
+
1374
+       if (((from) == FRAME_POINTER_REGNUM)&&((to) == STACK_POINTER_REGNUM)) {
1375
+               ret = cfun->machine->sp_fp_offset;
1376 117 dgisselq
+       } else if (((from)=ARG_POINTER_REGNUM)&&((to)==STACK_POINTER_REGNUM)) {
1377
+               ret = cfun->machine->sp_fp_offset;
1378 102 dgisselq
+       } else if (((from)=ARG_POINTER_REGNUM)&&((to)==FRAME_POINTER_REGNUM)) {
1379 117 dgisselq
+               // ret = cfun->machine->local_vars_size;
1380
+               ret = 0;
1381 102 dgisselq
+       } else {
1382
+               abort();
1383
+       }
1384
+
1385
+       return ret;
1386
+}
1387
+
1388
+/*
1389
+ * Code taken from m68k ...
1390
+ */
1391
+static bool
1392
+zip_can_eliminate(int from, int to)
1393
+{
1394
+       // fprintf(stderr, "CAN_ELIMINATE::QUERYING(%d,%d)\n", from, to);
1395
+       if ((from == zip_FP)&&(to == zip_SP))
1396
+               return !cfun->machine->fp_needed;
1397
+       return true;
1398
+}
1399
+
1400
+/*
1401
+static void
1402
+zip_basic_check(void)
1403
+{
1404
+       gcc_assert(mode_base_align[SImode]==4);
1405
+       if ((BITS_PER_UNIT != 32)
1406
+                       ||(GET_MODE_SIZE(SImode)!=1)
1407
+                       ||(GET_MODE_SIZE(DImode)!=1)
1408
+                       ||(HARD_REGNO_NREGS(0,SImode)!=1)) {
1409
+               printf("SIZEOF(SIMode) == %d\n", GET_MODE_SIZE(SImode));
1410
+               printf("BITS_PER_UNIT  == %d\n", BITS_PER_UNIT);
1411
+               gcc_assert(BITS_PER_UNIT==32);
1412
+               gcc_assert(GET_MODE_SIZE(SImode)==1);
1413
+               gcc_assert(HARD_REGNO_NREGS(0,SImode)==1);
1414
+       }
1415
+}
1416
+*/
1417
+
1418
+#define        zip_basic_check()
1419
+
1420
+/* Compute the number of word sized regiters needed to hold a function
1421
+ * argument of mode INT_MODE and tree type TYPE.
1422
+ */
1423
+int
1424
+zip_num_arg_regs(enum machine_mode mode, const_tree type) {
1425
+       int     size;
1426
+
1427
+       zip_basic_check();
1428
+
1429
+       if (targetm.calls.must_pass_in_stack(mode, type))
1430
+               return 0;
1431
+
1432
+       if ((type)&&(mode == BLKmode))
1433
+               size = int_size_in_bytes(type);
1434
+       else
1435
+               size = GET_MODE_SIZE(mode);
1436
+
1437
+       return (size + UNITS_PER_WORD - 1)/UNITS_PER_WORD;
1438
+}
1439
+
1440
+/* pushed in function prologue */
1441
+/*
1442
+static int
1443
+zip_arg_partial_bytes(CUMULATIVE_ARGS *cum, enum machine_mode mode,
1444
+               tree type, bool name ATTRIBUTE_UNUSED) {
1445
+       int     words;
1446
+       unsigned int    regs = zip_num_arg_regs(mode, type);
1447
+
1448
+       if (*cum >= ZIP_LAST_ARG_REGNO + 1)
1449
+               words = 0;
1450
+       else if ((*cum + regs) > ZIP_LAST_ARG_REGNO + 1)
1451
+               words = (*cum + regs) - ZIP_LAST_ARG_REGNO + 1;
1452
+       else
1453
+               words = 0;
1454
+
1455
+       return words * UNITS_PER_WORD;
1456
+}
1457
+*/
1458
+
1459
+static void
1460
+zip_function_arg_advance(cumulative_args_t ca, machine_mode mode,
1461
+               const_tree type, bool named ATTRIBUTE_UNUSED) {
1462
+       CUMULATIVE_ARGS *cum;
1463
+       int     nreg;
1464
+
1465
+       zip_basic_check();
1466
+
1467
+       cum = get_cumulative_args(ca);
1468
+       nreg = zip_num_arg_regs(mode, type);
1469
+       if (((*cum)+nreg) > NUM_ARG_REGS)
1470
+               (*cum) = NUM_ARG_REGS;
1471
+       else
1472
+               (*cum) += nreg;
1473
+}
1474
+
1475
+static rtx
1476
+zip_function_arg(cumulative_args_t ca, machine_mode mode,
1477
+               const_tree type ATTRIBUTE_UNUSED, bool named) {
1478
+       CUMULATIVE_ARGS *cum;
1479
+
1480
+       zip_basic_check();
1481
+
1482
+
1483
+       if (!named)
1484
+               return NULL_RTX;
1485
+       //if (targetm.calls.must_pass_in_stack(mode, type))
1486
+               //return NULL_RTX;
1487
+       cum = get_cumulative_args(ca);
1488
+
1489
+       if ((*cum) >= NUM_ARG_REGS)
1490
+               return NULL_RTX;
1491
+       return
1492
+               gen_rtx_REG(mode, (*cum)+1);
1493
+}
1494
+
1495 122 dgisselq
+#ifdef HAVE_cc0
1496 102 dgisselq
+/* NOTICE_UPDATE_CC sends us here
1497
+ */
1498
+void
1499
+zip_update_cc_notice(rtx exp, rtx_insn *insn)
1500
+{
1501 122 dgisselq
+#error "The CC0 code was supposed to be removed"
1502 102 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1503
+       enum    attr_ccresult  ccr;
1504
+       enum    attr_conditional  conditionally_executed;
1505
+
1506
+       // The default is that nothing has changed.
1507
+       // cc_status = cc_status_prev;
1508
+       rtx     src, dest;
1509
+
1510
+       if (dbg) fprintf(stderr, "CC-NOTICE ...\n");
1511
+       if (dbg) zip_debug_rtx_pfx("CC :", exp);
1512
+       if (dbg) debug_rtx(exp);
1513
+
1514
+       ccr = get_attr_ccresult(insn);
1515
+       if (ccr == CCRESULT_UNKNOWN) {
1516
+               CC_STATUS_INIT;
1517
+               if (dbg) fprintf(stderr, "\tINIT-CC\n");
1518
+               return;
1519
+       }
1520
+
1521
+       if ((GET_CODE(exp) == PARALLEL)&&(GET_CODE(XVECEXP(exp, 0, 0))==SET)) {
1522
+               // This works up and until we add cc0 parallel instructions
1523
+               // to our instruction set.
1524
+               dest = SET_DEST(XVECEXP(exp, 0, 0));
1525
+               src  = SET_SRC (XVECEXP(exp, 0, 0));
1526
+       } else if (GET_CODE(exp) == SET) {
1527
+               dest = SET_DEST(exp);
1528
+               src  = SET_SRC (exp);
1529
+       } else {
1530
+               // First, do nothing if we haven't touched the condition codes.
1531
+               // Condition codes can only be changed as a result of a set
1532
+               // expression ...?
1533
+               if (dbg) fprintf(stderr, "Non-set expression, doesn\'t touch condition codes\n");
1534
+               return;
1535
+       }
1536
+
1537 111 dgisselq
+
1538
+       if (ccr == CCRESULT_UNCHANGED) {
1539
+               if (dbg) fprintf(stderr, "\tUnchanged CC\n");
1540
+
1541
+               // We can't just run away here ... even though the CC result
1542
+               // hasn't changed, GCC's ability to recognize it as a valid
1543
+               // result has changed.  In other words, if we just 'set' a
1544
+               // value contained within either value1 or value2, then we'll
1545
+               // need to update those values so that they are no longer looked
1546
+               // upon as potentially containing the current CC values.
1547
+
1548
+               if (dest) {
1549
+                       if (dest == cc0_rtx)
1550
+                               CC_STATUS_INIT;
1551
+                       else if ((REG_P(dest))&&(dest != pc_rtx)) {
1552
+                               // An example here might be a load instruction
1553
+                               if (reg_mentioned_p(dest, cc_status.value1))
1554
+                                       cc_status.value1 = NULL_RTX;
1555
+                               if (reg_mentioned_p(dest, cc_status.value2))
1556
+                                       cc_status.value2 = NULL_RTX;
1557
+                       }
1558
+               }
1559
+               return;
1560
+       }
1561
+
1562 102 dgisselq
+       // Gotta wait on this test, until we know whether or not the
1563
+       // conditionally executed instruction was designed to set the
1564
+       // CC0 register.
1565
+       conditionally_executed = get_attr_conditional(insn);
1566
+       if ((conditionally_executed == CONDITIONAL_YES)&&(dest != cc0_rtx)) {
1567
+               // cc_status is unchanged
1568 111 dgisselq
+               // However, GCC's vision of it may have changed
1569
+               //
1570
+               // Initialize CC_STATUS
1571 102 dgisselq
+               if (dbg) fprintf(stderr, "\tCC -- unchanged (conditional exec)\n");
1572 111 dgisselq
+               CC_STATUS_INIT;
1573 102 dgisselq
+               return;
1574 111 dgisselq
+       } else if (GET_CODE(src)==IF_THEN_ELSE) {
1575
+               // Same thing as above
1576
+               CC_STATUS_INIT;
1577
+               return;
1578 102 dgisselq
+       }
1579
+
1580
+       if (ccr == CCRESULT_VALIDZN)
1581
+               cc_status.flags = CC_NO_OVERFLOW;
1582
+       else
1583
+               cc_status.flags = 0;
1584
+       cc_status.value1 = dest;
1585
+       if (dest == cc0_rtx)
1586
+               cc_status.value2 = src;
1587
+       else if((REG_P(dest))&&(!reg_mentioned_p(dest, src)))
1588
+               cc_status.value2 = src;
1589
+       else if((SUBREG_P(dest))&&(!reg_mentioned_p(XEXP(dest,0), src)))
1590
+               cc_status.value2 = src;
1591
+       else
1592
+               cc_status.value2 = 0;
1593
+       if (dbg) fprintf(stderr, "\tCC -- Set flags for\n");
1594
+       if (dbg) zip_debug_rtx_pfx("V1: ", dest);
1595
+       if ((dbg)&&(cc_status.value2)) zip_debug_rtx_pfx("V2: ", src);
1596
+       else if (dbg)   fprintf(stderr, "V2: (No SRC)\n");
1597
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "src refers to dest ?? %s\n",
1598
+               refers_to_regno_p(REGNO(dest),REGNO(dest),src,NULL)?"Yes":"No");
1599
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "Occurrs %d times\n",
1600
+               count_occurrences(dest,src,0));
1601
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "%s mentioned\n",
1602
+               reg_mentioned_p(dest,src)?"Is":"Is not");
1603
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "%s referenced\n",
1604
+               reg_referenced_p(dest,src)?"Is":"Is not");
1605
+
1606
+//
1607
+// These results are only used in final.c, where they are used to remove
1608
+// compare instructions if the optimizer is on.  If I produce nothing, no
1609
+// compare instructions will be removed.  If I produce something, a smart
1610
+// decision may be made to remove compare instructions.
1611
+//
1612
+// cc_status will be compared  with subsequent
1613
+//     (set (cc0) (something)) (i.e. compare only) instructions
1614
+//
1615
+//     (set (cc0) (compare (x) (y)))
1616
+//     dst = cc0 -- the destination of the set is ignored, save that it must be
1617
+//             cc0
1618
+//     src1 = (compare (x) (y))
1619
+//     if (src1 == compare)&&(y == (const_int 0))
1620
+//             src2 = (x)
1621
+//     else
1622
+//             src2 = null
1623
+//
1624
+//     Four conditions:
1625
+//     1. if (val1)&&(src1 == val1)
1626
+//             This would be true if I had seen a (set (val1) (src1)) insn
1627
+//             If I have seen a (set (val1) (src1))
1628
+//                     or equivalently a (set (val1) (compare (x) (y)))
1629
+//     or
1630
+//     2. if (val2)&&(src1 == val2)
1631
+//             This would be true if I had seen a (set (val1) (src1)) insn,
1632
+//             and only if val2 was still valid.
1633
+//     or
1634
+//     3. if (src2)&&(value1)&&(src2 == value1)
1635
+//             This would be true if we are comparing against zero, and the
1636
+//             number we are comparing against zero is value 1
1637
+//     or
1638
+//     4. if (src2)&&(value2)&&(src2 == value2)
1639
+//             ... or value2.  This is the common ZipCPU case.
1640
+//
1641
+//             then delete the compare.
1642
+//
1643
+}
1644 122 dgisselq
+#else
1645 102 dgisselq
+
1646 122 dgisselq
+void   zip_canonicalize_comparison(int *code, rtx *op0, rtx *op1,
1647
+               bool preserve_op0)
1648
+{
1649
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1650 102 dgisselq
+
1651 122 dgisselq
+       if (dbg) fprintf(stderr, "CANONICALIZE ...%s\n", (preserve_op0)?"(Preserve Op0)":"");
1652
+       if (dbg) zip_debug_rtx_pfx("CODE", gen_rtx_fmt_ee((rtx_code)*code, VOIDmode, gen_rtx_REG(CCmode,zip_CC), const0_rtx));
1653
+       if (dbg) zip_debug_rtx_pfx("OP0 ", *op0);
1654
+       if (dbg) zip_debug_rtx_pfx("OP1 ", *op1);
1655
+
1656
+       if ((!preserve_op0)&&((*code == LE)||(*code == GTU)||(*code == GEU))) {
1657
+               rtx tem = *op0;
1658
+               *op0 = *op1;
1659
+               *op1 = tem;
1660
+               *code = (int)swap_condition((enum rtx_code)*code);
1661
+       }
1662
+
1663
+       if ((*code == LE)||(*code == LEU)||(*code == GTU)) {
1664
+               int offset = 1; // (*code == GTU) ? 1 : -1;
1665
+               bool    swap = false;
1666
+
1667
+               if (CONST_INT_P(*op1)) {
1668
+                       *op1 = GEN_INT(INTVAL(*op1)+offset);
1669
+                       swap = true;
1670
+               } else if (REG_P(*op1)) {
1671
+                       *op1 = plus_constant(SImode, *op1, offset, true);
1672
+                       swap = true;
1673
+               } else if ((GET_CODE(*op1)==PLUS)&&(CONST_INT_P(XEXP(*op1,1)))){
1674
+                       *op1 = plus_constant(GET_MODE(*op1),XEXP(*op1,0),
1675
+                               INTVAL(XEXP(*op1,1))+offset);
1676
+                       swap = true;
1677
+               } if (swap) {
1678
+                       if (*code == LE)
1679
+                               (*code)= LT;
1680
+                       else if (*code == LEU)
1681
+                               (*code)= LTU;
1682
+                       else // (*code == GTU)
1683
+                               (*code) = GEU;
1684
+               }
1685
+       }
1686
+}
1687
+
1688
+static bool
1689
+zip_fixed_condition_code_regs(unsigned int *a, unsigned int *b) {
1690
+       *a = zip_CC;
1691
+       *b = INVALID_REGNUM;
1692
+       return true;
1693
+}
1694
+
1695
+#endif
1696
+
1697
+
1698 102 dgisselq
+/* totally buggy - we can't return pointers to nested functions */
1699
+static void
1700
+zip_asm_trampoline_template(FILE *f) {
1701
+       // Whereas at one time I thought I wouldn't need it, now I know I
1702
+       // need this trampoline function, although it is for a completely
1703
+       // different purpose than the one I was familiar with.
1704
+       fprintf(f, "\tldihi 0,r1\n");
1705
+       fprintf(f, "\tldilo 0,r1\n");
1706
+       fprintf(f, "\tjmp r1\n");
1707
+}
1708
+
1709
+/* Worker function for TARGET_TRAMPOLINE_INIT. */
1710
+static void
1711
+zip_trampoline_init(rtx m_tramp ATTRIBUTE_UNUSED,
1712
+       tree fndecl ATTRIBUTE_UNUSED,
1713
+       rtx chain_value ATTRIBUTE_UNUSED) {
1714
+// #warning "This needs to be filled out"
1715
+       abort();
1716
+}
1717
+
1718
+static tree
1719
+def_builtin(const char *name, enum insn_code icode, enum ZIP_BUILTIN_ID_CODE code,
1720
+       tree type)
1721
+{
1722
+       tree t = add_builtin_function(name,type,code,BUILT_IN_MD, NULL, NULL_TREE);
1723
+       zip_basic_check();
1724
+
1725
+       if(t) {
1726
+               zip_builtins[code] = t;
1727
+               zip_builtins_icode[code] = icode;
1728
+       }
1729
+
1730
+       return t;
1731
+
1732
+}
1733
+
1734
+void   zip_init_builtins(void) {
1735
+       zip_basic_check();
1736
+
1737
+  tree void_ftype_void = build_function_type_list(void_type_node, NULL_TREE);
1738
+#ifdef HAVE_zip_rtu
1739
+  def_builtin("zip_rtu", CODE_FOR_zip_rtu, ZIP_BUILTIN_RTU, void_ftype_void);
1740
+#endif
1741
+#ifdef HAVE_zip_halt
1742
+  def_builtin("zip_halt",  CODE_FOR_zip_halt,  ZIP_BUILTIN_HALT, void_ftype_void);
1743
+#endif
1744
+#ifdef HAVE_zip_idle
1745
+  def_builtin("zip_idle", CODE_FOR_zip_idle, ZIP_BUILTIN_IDLE, void_ftype_void);
1746
+#endif
1747
+
1748
+#ifdef HAVE_zip_syscall
1749
+// Support int SYSCALL(callID, int a, int b, int c);
1750
+  def_builtin("zip_syscall", CODE_FOR_zip_syscall, ZIP_BUILTIN_SYSCALL,
1751
+                       build_function_type_list(void_type_node, NULL_TREE));
1752
+#endif
1753
+
1754
+#ifdef HAVE_zip_save_context
1755
+  def_builtin("zip_save_context", CODE_FOR_zip_save_context, ZIP_BUILTIN_SAVE_CONTEXT,
1756
+               build_function_type_list(void_type_node, ptr_type_node, 0));
1757
+#endif
1758
+
1759
+#ifdef HAVE_zip_restore_context
1760
+  def_builtin("zip_restore_context", CODE_FOR_zip_restore_context, ZIP_BUILTIN_RESTORE_CONTEXT,
1761
+       build_function_type_list(void_type_node, ptr_type_node, 0));
1762
+#endif
1763
+
1764
+#ifdef HAVE_zip_bitrev
1765
+  def_builtin("zip_bitrev", CODE_FOR_zip_bitrev, ZIP_BUILTIN_BITREV,
1766
+       build_function_type_list(unsigned_type_node, unsigned_type_node,
1767
+               NULL_TREE));
1768
+#endif
1769
+
1770
+#ifdef HAVE_zip_cc
1771
+  def_builtin("zip_cc", CODE_FOR_zip_cc, ZIP_BUILTIN_CC,
1772
+       build_function_type_list(unsigned_type_node, NULL_TREE));
1773
+#endif
1774
+
1775 117 dgisselq
+#ifdef HAVE_zip_ucc
1776
+  def_builtin("zip_ucc", CODE_FOR_zip_ucc, ZIP_BUILTIN_UCC,
1777
+       build_function_type_list(unsigned_type_node, NULL_TREE));
1778
+#endif
1779
+
1780 102 dgisselq
+}
1781
+
1782
+static tree
1783
+zip_builtin_decl(unsigned zip_builtin_code, bool initialize_p ATTRIBUTE_UNUSED)
1784
+{
1785
+  if (zip_builtin_code >= ZIP_BUILTIN_MAX)
1786
+    return error_mark_node;
1787
+
1788
+  return zip_builtins[zip_builtin_code];
1789
+}
1790
+
1791
+static rtx
1792
+zip_expand_builtin(tree exp, rtx target,
1793
+               rtx subtarget ATTRIBUTE_UNUSED,
1794
+               machine_mode tmode ATTRIBUTE_UNUSED,
1795
+               int     ignore ATTRIBUTE_UNUSED) {
1796
+
1797
+       tree    fndecl = TREE_OPERAND(CALL_EXPR_FN(exp), 0);
1798
+       bool    nonvoid = (TREE_TYPE(TREE_TYPE(fndecl)) != void_type_node);
1799
+       enum    ZIP_BUILTIN_ID_CODE code=(enum ZIP_BUILTIN_ID_CODE)DECL_FUNCTION_CODE(fndecl);
1800
+       enum    insn_code icode = zip_builtins_icode[code];
1801
+       rtx     pat, op[5];
1802
+       call_expr_arg_iterator  iter;
1803
+       tree    arg;
1804
+
1805
+       if ((code == ZIP_BUILTIN_SAVE_CONTEXT)
1806
+                       ||(code == ZIP_BUILTIN_RESTORE_CONTEXT)) {
1807
+               arg = first_call_expr_arg(exp, &iter);
1808
+               if (arg == error_mark_node)
1809
+                       return NULL_RTX;
1810
+               op[0] = expand_normal(arg);
1811
+               if (GET_CODE(op[0]) != REG)
1812
+                       op[0] = force_reg(Pmode, op[0]);
1813
+               pat = GEN_FCN(icode)(op[0]);
1814
+       } else if (code == ZIP_BUILTIN_BITREV) {
1815
+               arg = first_call_expr_arg(exp, &iter);
1816
+               if (arg == error_mark_node) {
1817
+                       return NULL_RTX;
1818
+               }
1819
+               op[0] = expand_normal(arg);
1820
+               if (!target)
1821
+                       target = gen_reg_rtx(SImode);
1822
+               pat = GEN_FCN(icode)(target, op[0]);
1823 117 dgisselq
+       } else if ((code == ZIP_BUILTIN_CC)||(code == ZIP_BUILTIN_UCC)) {
1824 102 dgisselq
+               if (!target)
1825
+                       target = gen_reg_rtx(SImode);
1826
+               pat = GEN_FCN(icode)(target);
1827
+       } else // RTU, HALT, IDLE
1828
+               pat = GEN_FCN(icode)();
1829
+       if (!pat)
1830
+               return NULL_RTX;
1831
+       emit_insn(pat);
1832
+       return (nonvoid ? target : const0_rtx);
1833
+}
1834
+
1835
+static bool
1836
+zip_scalar_mode_supported_p(enum machine_mode mode) {
1837
+       zip_basic_check();
1838
+
1839
+       return ((mode)==SImode)||((mode)==DImode); // ||((mode)==SFmode);
1840
+}
1841
+
1842
+static bool
1843
+zip_libgcc_floating_mode_supported_p(enum machine_mode mode) {
1844
+       return ((mode)==SFmode)||((mode)==DFmode);
1845
+}
1846
+
1847
+static int
1848
+zip_address_cost(rtx addr ATTRIBUTE_UNUSED,
1849
+       enum machine_mode mode ATTRIBUTE_UNUSED,
1850
+       addr_space_t as ATTRIBUTE_UNUSED, bool spd ATTRIBUTE_UNUSED) {
1851
+       return 1;
1852
+}
1853
+
1854
+static bool
1855
+zip_mode_dependent_address_p(const_rtx addr ATTRIBUTE_UNUSED,
1856
+       addr_space_t as ATTRIBUTE_UNUSED) {
1857
+       return false;
1858
+}
1859
+
1860
+/*
1861
+static void
1862
+zip_asm_output_anchor(rtx x) {
1863
+       printf("ANCHOR: OP(%d)\n", GET_CODE(x));
1864
+}
1865
+*/
1866
+
1867
+static void
1868
+zip_debug_print(const char *pfx, int lvl, const char *str) {
1869
+       int     i;
1870
+       i = lvl;
1871
+       if ((true)||(lvl == 0))
1872
+               fprintf(stderr, "%s", pfx);
1873
+       else
1874
+               i += strlen(pfx);
1875
+       while(i-->0)
1876
+               fprintf(stderr, "  ");
1877
+       fprintf(stderr, "%s\n", str);
1878
+}
1879
+
1880
+static void
1881
+zip_debug_print_m(const char *pfx, int lvl, const char *str, enum machine_mode m) {
1882
+       int     i;
1883
+
1884
+       i = lvl;
1885
+       if ((true)||(lvl == 0))
1886
+               fprintf(stderr, "%s", pfx);
1887
+       else
1888
+               i = lvl+strlen(pfx);
1889
+       while(i-->0)
1890
+               fprintf(stderr, "  ");
1891
+       switch(m) {
1892
+               case VOIDmode:
1893
+                       fprintf(stderr, "%s:V\n", str);
1894
+                       break;
1895
+               case BLKmode:
1896
+                       fprintf(stderr, "%s:BLK\n", str);
1897
+                       break;
1898
+               case BImode:
1899
+                       fprintf(stderr, "%s:BI\n", str);
1900
+                       break;
1901
+#ifdef HAVE_QImode
1902
+               case QImode:
1903
+                       fprintf(stderr, "%s:QI\n", str);
1904
+                       break;
1905
+#endif
1906
+#ifdef HAVE_HImode
1907
+               case HImode:
1908
+                       fprintf(stderr, "%s:HI\n", str);
1909
+                       break;
1910
+#endif
1911
+               case SImode:
1912
+                       fprintf(stderr, "%s:SI\n", str);
1913
+                       break;
1914 122 dgisselq
+               case CCmode:
1915
+                       fprintf(stderr, "%s:CC\n", str);
1916
+                       break;
1917 102 dgisselq
+               case DImode:
1918
+                       fprintf(stderr, "%s:DI\n", str);
1919
+                       break;
1920
+               default:
1921
+                       fprintf(stderr, "%s:?\n", str);
1922
+       }
1923
+}
1924
+
1925
+static void
1926
+zip_debug_rtx_1(const char *pfx, const_rtx x, int lvl) {
1927
+       if (x == NULL_RTX) {
1928
+               zip_debug_print(pfx, lvl, "(NULL-RTX)");
1929
+               return;
1930
+       } else if (GET_CODE(x) > NUM_RTX_CODE) {
1931
+               char    buf[64];
1932
+               sprintf(buf, "(BAD-RTX-CODE %d)", GET_CODE(x));
1933
+               zip_debug_print(pfx, lvl, buf);
1934 117 dgisselq
+               gcc_assert(0 && "Bad RTX Code");
1935 102 dgisselq
+               return;
1936
+       } switch(GET_CODE(x)) { // rtl.def
1937 122 dgisselq
+       case PARALLEL:
1938
+               zip_debug_print(pfx, lvl, "(PARALLEL");
1939
+               for(int j=0; j<XVECLEN(x,0);j++)
1940
+                       zip_debug_rtx_1(pfx, XVECEXP(x,0,j), lvl+1);
1941
+               zip_debug_print(pfx, lvl, ")");
1942
+               debug_rtx(x);
1943
+               break;
1944 102 dgisselq
+       case INT_LIST: zip_debug_print(pfx, lvl, "(INT-LIST"); break;
1945 122 dgisselq
+       case SEQUENCE:
1946
+               zip_debug_print(pfx, lvl, "(SEQUENCE");
1947
+               for(int j=0; j<XVECLEN(x,0);j++)
1948
+                       zip_debug_rtx_1(pfx, XVECEXP(x,0,j), lvl+1);
1949
+               zip_debug_print(pfx, lvl, ")");
1950
+               debug_rtx(x);
1951
+               break;
1952 102 dgisselq
+       case ADDRESS: zip_debug_print(pfx, lvl, "(ADDRESS"); break;
1953
+       case DEBUG_INSN: zip_debug_print(pfx, lvl, "(DEBUG-INSN"); break;
1954
+       case INSN:
1955
+               zip_debug_print(pfx, lvl, "(INSN");
1956
+               /*
1957
+               { const rtx_insn *tmp_rtx;
1958
+               for(tmp_rtx = as_a <const rtx_insn *>(x); tmp_rtx != 0; tmp_rtx = NEXT_INSN(tmp_rtx)) {
1959
+                       zip_debug_rtx_1(tmp_rtx, lvl+1);
1960
+               }}
1961
+               */
1962
+               zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
1963
+               zip_debug_print(pfx, lvl, ")");
1964 117 dgisselq
+               debug_rtx(x);
1965 102 dgisselq
+               break;
1966
+       case JUMP_INSN: zip_debug_print(pfx, lvl, "(JUMP-INSN");
1967 111 dgisselq
+               zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
1968
+               zip_debug_print(pfx, lvl, ")");
1969
+               /*
1970 102 dgisselq
+               if (JUMP_LABEL(x)) {
1971 111 dgisselq
+                       if (GET_CODE(JUMP_LABEL(x)) == LABEL_REF) {
1972
+                               char    buf[64];
1973
+                               sprintf(buf, "(LABEL *.L%d))", CODE_LABEL_NUMBER(LABEL_REF_LABEL(JUMP_LABEL(x))));
1974
+                               zip_debug_print(pfx, lvl+1, buf);
1975
+                       } else if (GET_CODE(JUMP_LABEL(x))==CODE_LABEL) {
1976
+                               char    buf[64];
1977
+                               sprintf(buf, "(CODE_LABEL *.L%d))", CODE_LABEL_NUMBER(JUMP_LABEL(x)));
1978
+                               zip_debug_print(pfx, lvl+1, buf);
1979
+                       } else
1980
+                       zip_debug_print(pfx, lvl+1, "(w/Label))");
1981 102 dgisselq
+               } else
1982 111 dgisselq
+                       zip_debug_print(pfx, lvl+1, "(NO label))");
1983
+               debug_rtx(x);
1984
+               */
1985 102 dgisselq
+               break;
1986
+       case CALL:
1987
+               zip_debug_print(pfx, lvl, "(CALL (Adr) (Args)");
1988
+               zip_debug_rtx_1(pfx, XEXP(x,0), lvl+1);
1989
+               zip_debug_rtx_1(pfx, XEXP(x,1), lvl+1);
1990
+               zip_debug_print(pfx, lvl, ")");
1991
+               break;
1992
+       case CALL_INSN: zip_debug_print(pfx, lvl, "(CALL-INSN");
1993
+               debug_rtx(x);
1994
+               break;
1995
+       case BARRIER: zip_debug_print(pfx, lvl, "(BARRIER)"); break;
1996
+       case RETURN: zip_debug_print(pfx, lvl, "(RETURN)"); break;
1997
+       case NOTE:
1998
+               {       char buf[128];
1999
+                       sprintf(buf, "(NOTE %s)", GET_REG_NOTE_NAME(GET_MODE(x)));
2000
+                       zip_debug_print(pfx, lvl, buf);
2001
+               }break;
2002
+       case COND_EXEC: zip_debug_print(pfx, lvl, "(COND_EXEC)");
2003
+               debug_rtx(x);
2004
+               break;
2005
+       case ASM_INPUT: zip_debug_print(pfx, lvl, "(ASM INPUT)"); break;
2006
+       case ASM_OPERANDS: zip_debug_print(pfx, lvl, "(ASM OPERANDS)"); break;
2007
+       case UNSPEC: zip_debug_print(pfx, lvl, "(UNSPEC)"); break;
2008
+       case UNSPEC_VOLATILE: zip_debug_print(pfx, lvl, "(UNSPEC_VOLATILE)"); break;
2009
+       case CODE_LABEL:
2010
+               {
2011
+                       char    buf[64];
2012 111 dgisselq
+                       sprintf(buf, "(CODE_LABEL *.L%d)", CODE_LABEL_NUMBER(x));
2013 102 dgisselq
+                       zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
2014
+               } break;
2015
+       case SET:
2016
+               zip_debug_print_m(pfx, lvl, "(SET", GET_MODE(x));
2017 117 dgisselq
+               zip_debug_rtx_1(pfx, SET_DEST(x),lvl+1);
2018
+               zip_debug_rtx_1(pfx, SET_SRC(x),lvl+1);
2019 102 dgisselq
+               zip_debug_print(pfx, lvl, ")");
2020 117 dgisselq
+               debug_rtx(x);
2021 102 dgisselq
+               break;
2022 122 dgisselq
+       case REG: {
2023
+               char buf[25];
2024 102 dgisselq
+               if (REGNO(x) == zip_PC)
2025 122 dgisselq
+                       sprintf(buf, "(PC)");
2026 102 dgisselq
+               else if (REGNO(x) == zip_CC)
2027 122 dgisselq
+                       sprintf(buf, "(CC)");
2028 102 dgisselq
+               else if (REGNO(x) == zip_SP)
2029 122 dgisselq
+                       sprintf(buf, "(SP)");
2030 102 dgisselq
+               else if (REGNO(x) == zip_FP)
2031 122 dgisselq
+                       sprintf(buf, "(REG FP)");
2032 102 dgisselq
+               else if (REGNO(x) == zip_GOT)
2033 122 dgisselq
+                       sprintf(buf, "(REG GBL)");
2034 102 dgisselq
+               else if (FUNCTION_VALUE_REGNO_P(REGNO(x)))
2035 122 dgisselq
+                       sprintf(buf, "(REG RTN-VL)");
2036 102 dgisselq
+               else if (REGNO(x) == RETURN_ADDRESS_REGNUM)
2037 122 dgisselq
+                       sprintf(buf, "(REG RTN-AD)");
2038
+               else
2039
+                       sprintf(buf, "(REG %d)", REGNO(x));
2040 102 dgisselq
+               zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
2041
+               } break;
2042
+       case IF_THEN_ELSE: // 51
2043
+               zip_debug_print(pfx, lvl, "(IF-THEN-ELSE");
2044
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2045
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2046
+               zip_debug_rtx_1(pfx, XEXP(x,2),lvl+1);
2047
+               zip_debug_print(pfx, lvl, ")");
2048
+               break;
2049
+       case PC:
2050
+               zip_debug_print(pfx, lvl, "(PC)");
2051
+               break;
2052
+       case CC0:
2053
+               zip_debug_print(pfx, lvl, "(CC0)");
2054
+               break;
2055
+       case COMPARE:
2056
+               zip_debug_print(pfx, lvl, "(COMPARE");
2057
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2058
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2059
+               zip_debug_print(pfx, lvl, ")");
2060
+               break;
2061 111 dgisselq
+       case CONST:
2062
+               zip_debug_print_m(pfx, lvl, "(CONST", GET_MODE(x));
2063
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2064
+               zip_debug_print(pfx, lvl, ")");
2065
+               break;
2066 102 dgisselq
+       case CONST_INT:
2067
+               { char buf[25];
2068
+               if (GET_MODE(x)==SImode)
2069 111 dgisselq
+                       sprintf(buf, "(CONST_INT:SI %ld)", INTVAL(x));
2070 102 dgisselq
+               else if (GET_MODE(x)==VOIDmode)
2071 111 dgisselq
+                       sprintf(buf, "(CONST_INT:V %ld)", INTVAL(x));
2072 102 dgisselq
+               else
2073 111 dgisselq
+                       sprintf(buf, "(CONST_INT:? %ld)", INTVAL(x));
2074 102 dgisselq
+               zip_debug_print(pfx, lvl, buf);
2075
+               } break;
2076
+       case LABEL_REF:
2077 122 dgisselq
+               { char buf[256];
2078 111 dgisselq
+               sprintf(buf, "(LABEL *.L%d)", CODE_LABEL_NUMBER(LABEL_REF_LABEL(x)));
2079
+               zip_debug_print(pfx, lvl, buf);
2080
+               }
2081 102 dgisselq
+               break;
2082
+       case SYMBOL_REF:
2083
+               {
2084
+                       char buf[64];
2085
+                       sprintf(buf, "(SYMBOL: %s)", XSTR(x,0));
2086
+                       // fprintf(file, "%s", XSTR(x,0));
2087
+                       zip_debug_print(pfx, lvl, buf);
2088
+               }
2089
+               break;
2090
+       case MEM:
2091
+               zip_debug_print_m(pfx, lvl, "(MEM", GET_MODE(x));
2092
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2093
+               zip_debug_print(pfx, lvl, ")");
2094
+               break;
2095
+       /*
2096
+       case VALUE:
2097
+               {
2098
+                       char buf[64];
2099
+                       sprintf(buf, "(VALUE: %d)", INTVAL(XEXP,0));
2100
+                       zip_debug_print_m(pfx, lvl, "buf", GET_MODE(x));
2101
+               }
2102
+               break;
2103
+       */
2104
+       case PLUS:
2105
+               zip_debug_print_m(pfx, lvl, "(PLUS", 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 MINUS:
2111
+               zip_debug_print_m(pfx, lvl, "(MINUS", 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 AND:
2117
+               zip_debug_print_m(pfx, lvl, "(AND", 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 IOR:
2123
+               zip_debug_print_m(pfx, lvl, "(OR", 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 XOR:
2129
+               zip_debug_print_m(pfx, lvl, "(XOR", 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 MULT:
2135
+               zip_debug_print_m(pfx, lvl, "(MULT", 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 EQ:        //
2141
+               zip_debug_print_m(pfx, lvl, "(EQ", 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 NE:        //
2147
+               zip_debug_print_m(pfx, lvl, "(NE", 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 GE:        //
2153
+               zip_debug_print_m(pfx, lvl, "(GE", 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 GT:        //
2159
+               zip_debug_print_m(pfx, lvl, "(GT", GET_MODE(x));
2160
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2161
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2162
+               zip_debug_print(pfx, lvl, ")");
2163
+               break;
2164
+       case LE:        //
2165
+               zip_debug_print_m(pfx, lvl, "(LE", GET_MODE(x));
2166
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2167
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2168
+               zip_debug_print(pfx, lvl, ")");
2169
+               break;
2170
+       case LT:        //
2171
+               zip_debug_print_m(pfx, lvl, "(LT", GET_MODE(x));
2172
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2173
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2174
+               zip_debug_print(pfx, lvl, ")");
2175
+               break;
2176
+       case GEU:       //
2177
+               zip_debug_print_m(pfx, lvl, "(GEU", GET_MODE(x));
2178
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2179
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2180
+               zip_debug_print(pfx, lvl, ")");
2181
+               break;
2182
+       case GTU:       //
2183
+               zip_debug_print_m(pfx, lvl, "(GTU", GET_MODE(x));
2184
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2185
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2186
+               zip_debug_print(pfx, lvl, ")");
2187
+               break;
2188
+       case LEU:       //
2189
+               zip_debug_print_m(pfx, lvl, "(LEU", GET_MODE(x));
2190
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2191
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2192
+               zip_debug_print(pfx, lvl, ")");
2193
+               break;
2194
+       case LTU:       //
2195
+               zip_debug_print_m(pfx, lvl, "(LTU", GET_MODE(x));
2196
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2197
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2198
+               zip_debug_print(pfx, lvl, ")");
2199
+               break;
2200
+       case SCRATCH:   //
2201
+               zip_debug_print_m(pfx, lvl, "(SCRATCH)", GET_MODE(x));
2202
+               break;
2203
+       case SUBREG:
2204
+               { char buf[25];
2205 111 dgisselq
+               if (REG_P(XEXP(x,0))) {
2206
+                       sprintf(buf, "(SUBREG %d/%d)", REGNO(XEXP(x,0)),
2207
+                               SUBREG_BYTE(x));
2208
+                       zip_debug_print(pfx, lvl, buf);
2209
+               } else if (MEM_P(XEXP(x,0))) {
2210
+                       sprintf(buf, "(SUBREG /%d", SUBREG_BYTE(x));
2211
+                       zip_debug_print(pfx, lvl, buf);
2212
+                       zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2213
+                       zip_debug_print(pfx, lvl, ")");
2214
+               } else {
2215
+                       sprintf(buf, "(SUBREG UNK /%d", SUBREG_BYTE(x));
2216
+                       zip_debug_print(pfx, lvl, buf);
2217
+                       zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2218
+                       zip_debug_print(pfx, lvl, ")");
2219
+               }}
2220
+               break;
2221 102 dgisselq
+       default:
2222 111 dgisselq
+               { char buf[128];
2223 102 dgisselq
+               sprintf(buf, "(? = %d) -- calling DEBUG-RTX", GET_CODE(x));
2224
+               zip_debug_print(pfx, lvl, buf);
2225
+               debug_rtx(x);
2226
+               } break;
2227
+       }
2228
+}
2229
+
2230
+void
2231
+zip_debug_rtx_pfx(const char *pfx, const_rtx x) {
2232
+       zip_debug_rtx_1(pfx, x, 0);
2233
+}
2234
+
2235
+void
2236
+zip_debug_rtx(const_rtx x) {
2237
+       zip_debug_rtx_pfx("", x);
2238
+}
2239
+
2240
+void
2241
+zip_debug_insn(rtx_insn *insn ATTRIBUTE_UNUSED) {
2242
+}
2243
+
2244
+void
2245
+zip_debug_bb(basic_block bb) {
2246
+       rtx_insn        *insn;
2247
+
2248
+       fprintf(stderr, "************ BASIC-BLOCK ***************\n");
2249
+       FOR_BB_INSNS(bb, insn)
2250
+       {
2251
+               zip_debug_rtx(insn);
2252
+       }
2253
+}
2254
+
2255
+
2256
+static bool
2257 122 dgisselq
+zip_legitimate_opb(rtx x, bool strict)
2258 102 dgisselq
+{
2259 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2260 102 dgisselq
+
2261 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB\n");
2262 102 dgisselq
+       if (dbg) zip_debug_rtx_pfx("Test: ", x);
2263
+
2264
+       if (NULL_RTX == x)
2265
+               return false;
2266 122 dgisselq
+       else if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode)) {
2267
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> Mode failure\n");
2268 102 dgisselq
+               return false;
2269 122 dgisselq
+       } else if ((strict)&&(REG_P(x))) {
2270
+               if (REGNO(x)<zip_CC) {
2271
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> (Reg)\n");
2272
+                       return true;
2273
+               } else return false;
2274
+       } else if (register_operand(x, GET_MODE(x))) {
2275
+               // This also handles subregs
2276
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> (Reg)\n");
2277
+               return true;
2278 111 dgisselq
+       } else if ((CONST_INT_P(x))
2279
+               &&(INTVAL(x) >= zip_min_opb_imm)
2280
+               &&(INTVAL(x) <= zip_max_opb_imm)) {
2281 122 dgisselq
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> YES! (Const) %ld <= %ld <= %ld\n", zip_min_opb_imm, INTVAL(x), zip_max_opb_imm);
2282 111 dgisselq
+               return true;
2283 122 dgisselq
+       // } else if ((GET_CODE(x) == LABEL_REF)||(GET_CODE(x)==CODE_LABEL)) {
2284
+               // return true;
2285 102 dgisselq
+       } else if (GET_CODE(x) == PLUS) {
2286
+               // Is it a valid register?
2287 122 dgisselq
+               if ((!strict)&&(!register_operand((rtx)XEXP((rtx)x,0), GET_MODE(x)))) {
2288 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No (No reg in +%s)\n",
2289 102 dgisselq
+                       (GET_CODE(XEXP(x,1))==REG)?", reg in op[1]":"");
2290
+                       return false;
2291 122 dgisselq
+               } else if ((strict)&&((!REG_P(XEXP(x,0)))||(REGNO(XEXP(x,0))>=zip_CC))) {
2292 102 dgisselq
+                       return false;
2293
+               } if ((GET_CODE(XEXP(x, 1)) == CONST_INT)
2294
+                       &&(INTVAL(XEXP(x, 1)) <= zip_max_anchor_offset)
2295
+                       &&(INTVAL(XEXP(x, 1)) >= zip_min_anchor_offset)) {
2296 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> YES! (reg+int)\n");
2297 103 dgisselq
+                       // if((INTVAL(XEXP(x,1))<0)&&(REGNO(XEXP(x,0))==zip_SP))
2298
+                               // gcc_unreachable();
2299 102 dgisselq
+                       return true;
2300
+               } if ((GET_CODE(XEXP(x, 1)) == LABEL_REF)
2301 122 dgisselq
+                       ||(GET_CODE(XEXP(x, 1)) == CODE_LABEL)
2302 102 dgisselq
+                       ||(GET_CODE(XEXP(x, 1)) == SYMBOL_REF)) {
2303
+                       // While we can technically support this, the problem
2304
+                       // is that the symbol address could be anywhere, and we
2305
+                       // have no way of recovering if it's outside of our
2306
+                       // 14 allowable bits.
2307 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No. (reg+lbl)\n");
2308 102 dgisselq
+                       return false;
2309
+               }
2310
+       }
2311
+
2312 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No\n");
2313 102 dgisselq
+       if (dbg) zip_debug_rtx(x);
2314
+       return false;
2315
+}
2316
+
2317
+static bool
2318
+zip_legitimate_move_operand_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict) {
2319
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2320
+
2321
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND\n");
2322
+       if (dbg) zip_debug_rtx_pfx("VMov?: ", x);
2323
+
2324 122 dgisselq
+       if (!zip_legitimate_opb(x, strict))
2325 102 dgisselq
+               return false;
2326 122 dgisselq
+       else if ((GET_CODE(x)==PLUS)&&(CONST_INT_P(XEXP(x,1)))) {
2327
+               if ((INTVAL(XEXP(x, 1)) > zip_max_mov_offset)
2328
+                       ||(INTVAL(XEXP(x, 1)) < zip_min_mov_offset)) {
2329 124 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> NO! (reg+int), int out of bounds: %ld\n", INTVAL(XEXP(x,1)));
2330 102 dgisselq
+                       return false;
2331
+               }
2332
+       }
2333
+
2334 122 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> Yes\n");
2335 102 dgisselq
+       if (dbg) zip_debug_rtx(x);
2336 122 dgisselq
+       return true;
2337 102 dgisselq
+}
2338
+
2339
+int
2340
+zip_pd_mov_operand(rtx op)
2341
+{
2342
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2343
+
2344
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOV(predicate) for OPERAND\n");
2345
+       return zip_legitimate_move_operand_p(VOIDmode, op, !can_create_pseudo_p());
2346
+}
2347
+
2348
+int
2349 111 dgisselq
+zip_pd_mvimm_operand(rtx op)
2350
+{
2351
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2352
+
2353
+       if (dbg) fprintf(stderr, "ZIP-VALID-MVIMM(predicate) for OPERAND\n");
2354
+       if (!CONST_INT_P(op))
2355
+               return false;
2356
+       if (INTVAL(op) > zip_max_mov_offset)
2357
+               return false;
2358
+       if (INTVAL(op) < zip_min_mov_offset)
2359
+               return false;
2360
+       return true;
2361
+}
2362
+
2363
+int
2364
+zip_pd_imm_operand(rtx op)
2365
+{
2366
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2367
+
2368
+       if (dbg) fprintf(stderr, "ZIP-VALID-IMM(predicate) for OPERAND\n");
2369
+       if (!CONST_INT_P(op))
2370
+               return false;
2371
+       if (INTVAL(op) > zip_max_anchor_offset)
2372
+               return false;
2373
+       if (INTVAL(op) < zip_min_anchor_offset)
2374
+               return false;
2375
+       return true;
2376
+}
2377
+
2378
+int
2379 102 dgisselq
+zip_address_operand(rtx op)
2380
+{
2381
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2382
+
2383
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS for OPERAND\n");
2384 111 dgisselq
+       if ((REG_P(op))&&(REGNO(op)==zip_CC))
2385
+               return false;
2386
+       else if ((GET_CODE(op) == PLUS)&&(REG_P(XEXP(op,0)))
2387
+                       &&(REGNO(XEXP(op,0))==zip_CC))
2388
+               return false;
2389
+       else
2390
+               return zip_legitimate_opb(op, !can_create_pseudo_p());
2391 102 dgisselq
+}
2392
+
2393
+int
2394 111 dgisselq
+zip_pd_opb_operand(rtx op)
2395 102 dgisselq
+{
2396
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2397
+
2398 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-OPB(predicate) for OPERAND\n");
2399 122 dgisselq
+       return zip_legitimate_opb(op, false); //, !can_create_pseudo_p());
2400 102 dgisselq
+}
2401
+
2402
+int
2403
+zip_ct_address_operand(rtx op)
2404
+{
2405
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2406
+
2407
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS(constraint) for OPERAND\n");
2408 111 dgisselq
+       return zip_legitimate_opb(op, !can_create_pseudo_p());
2409 102 dgisselq
+}
2410
+
2411
+int
2412
+zip_const_address_operand(rtx x) {
2413
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2414
+
2415
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS?\n");
2416
+       if (dbg) zip_debug_rtx(x);
2417
+       if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode))
2418
+               return false;
2419
+       if ((GET_CODE(x) == LABEL_REF)
2420
+                       ||(GET_CODE(x) == CODE_LABEL)
2421
+                       ||(GET_CODE(x) == SYMBOL_REF)) {
2422
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES!\n");
2423
+               return true;
2424
+       } else if (CONST_INT_P(x)) {
2425
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES!\n");
2426
+               return true;
2427
+       } else if (GET_CODE(x) == PLUS) {
2428
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(PLUS)\n");
2429
+               return ((zip_const_address_operand(XEXP(x,0)))
2430
+                       &&(CONST_INT_P(XEXP(x,1))));
2431
+       } else if (GET_CODE(x) == MINUS) {
2432
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(MINUS)\n");
2433
+               return ((zip_const_address_operand(XEXP(x,0)))
2434
+                       &&(zip_const_address_operand(XEXP(x,1))));
2435
+       }
2436
+
2437
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> No\n");
2438
+       if (dbg) zip_debug_rtx(x);
2439
+       return false;
2440
+}
2441
+
2442
+int
2443
+zip_ct_const_address_operand(rtx x) {
2444
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2445
+
2446
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(constraint)\n");
2447
+       return zip_const_address_operand(x);
2448
+}
2449
+
2450
+int
2451
+zip_pd_const_address_operand(rtx x) {
2452
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2453
+
2454
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(predicate)\n");
2455
+       return zip_const_address_operand(x);
2456
+}
2457
+
2458
+
2459
+static bool
2460
+zip_legitimate_address_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict)
2461
+{
2462
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2463
+
2464
+       if (dbg) fprintf(stderr, "Zip-LEGITIMATE-ADDRESS-P\n");
2465
+       if (dbg) zip_debug_rtx(x);
2466
+
2467
+       // Only insist the register be a valid register if strict is true
2468 111 dgisselq
+       if (zip_legitimate_opb(x, strict))
2469 102 dgisselq
+               return true;
2470 111 dgisselq
+       // else if (zip_const_address_operand(x))
2471
+               // return true;
2472 102 dgisselq
+
2473
+       return false;
2474
+}
2475
+
2476 111 dgisselq
+static rtx
2477
+zip_legitimize_address(rtx x, rtx oldx ATTRIBUTE_UNUSED, machine_mode mode ATTRIBUTE_UNUSED) {
2478
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2479
+
2480
+       if (dbg) zip_debug_rtx_pfx("LEGITIMIZE: ", x);
2481
+       if (zip_legitimate_address_p(mode, x, !can_create_pseudo_p()))
2482
+               return x;
2483
+
2484
+       if (GET_CODE(x)==PLUS) {
2485
+               if (!REG_P(XEXP(x,0)))
2486
+                       XEXP(x,0) = force_reg(GET_MODE(x),XEXP(x,0));
2487
+               if ((!zip_legitimate_address_p(mode, x, !can_create_pseudo_p()))
2488
+                       &&(!CONST_INT_P(XEXP(x,1))))
2489
+                       x = force_reg(GET_MODE(x),x);
2490
+       } else if (MEM_P(x))
2491
+               x = force_reg(GET_MODE(x),x);
2492
+
2493
+       if (dbg) zip_debug_rtx_pfx("LEGITIMATE: ", x);
2494
+       return x;
2495
+}
2496
+
2497 102 dgisselq
+void
2498
+zip_asm_output_def(FILE *stream, const char *name, const char *value)
2499
+{
2500
+       assemble_name(stream, name);
2501
+       fprintf(stream, "\t.equ ");
2502
+       assemble_name(stream, value);
2503
+       fputc('\n', stream);
2504
+}
2505
+
2506 111 dgisselq
+#define        USE_SUBREG
2507
+#ifdef USE_SUBREG
2508
+#define        SREG_P(RTX) ((SUBREG_P(RTX))&&(REG_P(XEXP(RTX,0))))
2509
+#define        SMEM_P(RTX) ((SUBREG_P(RTX))&&(MEM_P(XEXP(RTX,0))))
2510
+#else
2511
+#define        SREG_P(RTX)     false
2512
+#define        SMEM_P(RTX)     false
2513
+#endif
2514 102 dgisselq
+
2515
+const char *zip_set_zero_or_one(rtx condition, rtx dst) {
2516 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2517 102 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::SET-ZERO-OR-ONE\n");
2518
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
2519
+       if (dbg) zip_debug_rtx_pfx("REG", dst);
2520
+       switch(GET_CODE(condition)) {
2521
+       case EQ:        return "LDI\t0,%0\n\tLDILO.Z\t1,%0";
2522
+       case NE:        return "LDI\t0,%0\n\tLDILO.NZ\t1,%0";
2523
+       case LT:        return "LDI\t0,%0\n\tLDILO.LT\t1,%0";
2524
+       case GT:        return "LDI\t0,%0\n\tLDILO.GT\t1,%0";
2525
+       case LE:        return "LDI\t1,%0\n\tLDILO.GT\t0,%0";
2526
+       case GE:        return "LDI\t0,%0\n\tLDILO.GE\t1,%0";
2527
+       case LTU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0";
2528
+       case GTU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0\n\tLDILO.Z\t0,%0";
2529
+       case LEU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0\n\tLDILO.Z\t1,%0";
2530
+       case GEU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0";
2531
+       default:
2532
+               zip_debug_rtx(condition);
2533
+               internal_error("CSTORE Unsupported condition");
2534
+               return NULL;
2535
+       }
2536
+}
2537
+
2538
+const char *zip_binary_movsicc(rtx_code condition, const char *op, const int opno) {
2539
+       static char     result[64] = "";
2540
+       switch(condition) {
2541
+               //
2542
+               // Result already exists in the iffalse register
2543
+               // Can't change it.  Therefore, on the
2544
+               // condition ... move true register to the
2545
+               // destination
2546
+               //
2547
+               case EQ:        sprintf(result, "%s.Z\t%%%d,%%0", op, opno); break;
2548
+               case NE:        sprintf(result, "%s.NZ\t%%%d,%%0", op, opno); break;
2549
+               case LT:        sprintf(result, "%s.LT\t%%%d,%%0", op, opno); break;
2550
+               case GT:        sprintf(result, "%s.GT\t%%%d,%%0", op, opno); break;
2551
+               // .LE doesn't exist on Zip CPU--turn this into two instructions
2552
+               case LE:        sprintf(result, "%s.LT\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
2553
+               case GE:        sprintf(result, "%s.GE\t%%%d,%%0", op, opno); break;
2554
+               case LTU:       sprintf(result, "%s.C\t%%%d,%%0", op, opno); break;
2555
+               //
2556
+               // .GTU doesn't exist on the Zip CPU either. We also note that
2557
+               // .C will never be set on an equal condition.  Therefore, we
2558
+               // turn this into a XOR.NZ 2,CC, which will set the .C condition
2559
+               // as long as .Z wasn't true.  We then undo this when we're
2560
+               // done.  This is possible since none of these instructions
2561
+               // (LDI/MOV/Lod conditional, nor Xor conditional) will ever set
2562
+               // the condition codes.
2563
+               //
2564
+               // This is obviously not very optimal.  Avoid this by all means
2565
+               // if you can
2566
+               case GTU:       sprintf(result, "XOR.NZ\t2,CC\n%s.C\t%%%d,%%0\n\tXOR.NZ\t2,CC", op, opno); break;
2567
+               // .LEU doesn't exist on Zip CPU either--turn this into another
2568
+               // two instructions
2569
+               case LEU:       sprintf(result, "%s.C\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
2570
+               //
2571
+               // .GEU doesn't exist on Zip CPU.  Implementing it her is
2572
+               // painful.  We can change the condition codes to make it so,
2573
+               // but the instruction requires the condition codes not be
2574
+               // changed.  Hence, we must change them back if we do so.
2575
+               //
2576
+               // .C will be set on less than but not equal.  Hence !.C will
2577
+               // be true on greater than or equal.
2578
+               case GEU:       sprintf(result, "XOR\t2,CC\n%s.C\t%%%d,%%0\n\tXOR\t2,CC", op, opno); break;
2579
+               default:
2580
+                       internal_error("MOVSICC(BINARY) Unsupported condition");
2581
+                       return NULL;
2582
+       } return result;
2583
+}
2584
+
2585
+const char *zip_tertiary_movsicc(rtx condition, const char *optrue, const char *opfalse) {
2586
+       static  char    result[64] = "";
2587
+       switch(GET_CODE(condition)) {
2588
+               case EQ:        sprintf(result,"%s\t%%3,%%0\n\t%s.Z\t%%2,%%0", opfalse, optrue); break;
2589
+               case NE:        sprintf(result,"%s\t%%3,%%0\n\t%s.NZ\t%%2,%%0", opfalse, optrue); break;
2590
+               case LT:        sprintf(result,"%s\t%%3,%%0\n\t%s.LT\t%%2,%%0", opfalse, optrue); break;
2591
+               case GT:        sprintf(result,"%s\t%%3,%%0\n\t%s.GT\t%%2,%%0", opfalse, optrue); break;
2592
+               // LE doesn't exist on a Zip CPU.  Accomplish this by
2593
+               // reversing the condition: i.e., load the false value into
2594
+               // the register, and the on condition load the true value.
2595
+               case LE:        sprintf(result,"%s\t%%2,%%0\n\t%s.GT\t%%3,%%0", optrue, opfalse); break;
2596
+               case GE:        sprintf(result,"%s\t%%3,%%0\n\t%s.GE\t%%2,%%0", opfalse, optrue); break;
2597
+               case LTU:       sprintf(result,"%s\t%%3,%%0\n\t%s.C\t%%2,%%0", opfalse, optrue); break;
2598
+               //
2599
+               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;
2600
+               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;
2601
+               case GEU:       sprintf(result,"%s\t%%2,%%0\n\t%s.C\t%%3,%%0\n", optrue, opfalse); break;
2602
+               default:
2603
+                       internal_error("MOVSICC Unsupported condition");
2604
+                       return NULL;
2605
+       } return result;
2606
+}
2607
+
2608
+const char *zip_movsicc(rtx dst, rtx condition, rtx iftrue, rtx iffalse) {
2609 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2610 102 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::MOVSICC\n");
2611
+       if (dbg) zip_debug_rtx_pfx("DST", dst);
2612
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
2613
+       if (dbg) zip_debug_rtx_pfx("TRU", iftrue);
2614
+       if (dbg) zip_debug_rtx_pfx("FAL", iffalse);
2615
+       if ((REG_P(iftrue))&&(REGNO(dst)==REGNO(iftrue))) {
2616
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- CASE if(X) -> R\n");
2617
+               if (zip_legitimate_move_operand_p(SImode, iffalse, true))
2618
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "MOV", 3);
2619
+               else if (zip_const_address_operand(iffalse))
2620
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LDI", 3);
2621
+               else if (zip_const_address_operand(iffalse))
2622
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LDI", 3);
2623 111 dgisselq
+               else if ((MEM_P(iffalse))&&(zip_legitimate_opb(XEXP(iffalse,0), true)))
2624 102 dgisselq
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LOD", 3);
2625
+               else {
2626
+                       internal_error("MOVSICC Unsupported mode");
2627
+                       return NULL;
2628
+               }
2629
+       } if ((REG_P(iftrue))&&(REGNO(dst)==REGNO(iftrue))) {
2630
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- CASE if(!X) -> R\n");
2631
+               if (zip_legitimate_move_operand_p(SImode, iftrue, true))
2632
+                       return zip_binary_movsicc(GET_CODE(condition), "MOV",2);
2633
+               else if (zip_const_address_operand(iffalse))
2634
+                       return zip_binary_movsicc(GET_CODE(condition), "LDI",2);
2635
+               else if (zip_const_address_operand(iffalse))
2636
+                       return zip_binary_movsicc(GET_CODE(condition), "LDI",2);
2637 111 dgisselq
+               else if ((MEM_P(iffalse))&&(zip_legitimate_opb(XEXP(iffalse,0), true)))
2638 102 dgisselq
+                       return zip_binary_movsicc(GET_CODE(condition), "LOD",2);
2639
+               else {
2640
+                       internal_error("MOVSICC Unsupported mode");
2641
+                       return NULL;
2642
+               }
2643
+       } if ((zip_const_address_operand(iftrue))&&(zip_const_address_operand(iffalse))) {
2644
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) #1 ELSE #2\n");
2645
+               return zip_tertiary_movsicc(condition, "LDI", "LDI");
2646
+       } if ((zip_const_address_operand(iftrue))&&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
2647
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) #1 ELSE A+B\n");
2648
+               return zip_tertiary_movsicc(condition, "LDI", "MOV");
2649
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))&&(zip_const_address_operand(iffalse))) {
2650
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE #x\n");
2651
+               return zip_tertiary_movsicc(condition, "MOV", "LDI");
2652
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))
2653
+                       &&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
2654
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE C+D\n");
2655
+               return zip_tertiary_movsicc(condition, "MOV", "MOV");
2656
+       }
2657
+       if ((MEM_P(iftrue))
2658 111 dgisselq
+               &&(zip_legitimate_opb(XEXP(iftrue,0), true))
2659 102 dgisselq
+               &&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
2660
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A[B] ELSE C+D\n");
2661
+               return zip_tertiary_movsicc(condition, "LOD", "MOV");
2662
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))
2663 111 dgisselq
+               &&(MEM_P(iffalse))&&(zip_legitimate_opb(XEXP(iffalse,0), true))) {
2664 102 dgisselq
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE C[D]\n");
2665
+               return zip_tertiary_movsicc(condition, "MOV", "LOD");
2666 111 dgisselq
+       } if ((MEM_P(iftrue))&&(zip_legitimate_opb(XEXP(iftrue,0), true))
2667
+               &&(MEM_P(iffalse))&&(zip_legitimate_opb(XEXP(iffalse,0), true))) {
2668 102 dgisselq
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A[B] ELSE C[D]\n");
2669
+               return zip_tertiary_movsicc(condition, "LOD", "LOD");
2670 111 dgisselq
+       } if ((MEM_P(iftrue))
2671
+               &&(zip_legitimate_opb(XEXP(iftrue,0),true))
2672
+               &&(zip_const_address_operand(iffalse))) {
2673
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A[B] ELSE #x\n");
2674
+               return zip_tertiary_movsicc(condition, "LOD", "LDI");
2675
+       } if ((MEM_P(iffalse))
2676
+               &&(zip_legitimate_opb(XEXP(iffalse,0),true))
2677
+               &&(zip_const_address_operand(iftrue))) {
2678
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) #x ELSE A[B]\n");
2679
+               return zip_tertiary_movsicc(condition, "LDI", "LOD");
2680 102 dgisselq
+       }
2681
+
2682
+       internal_error("MOVSICC Operands not supported");
2683
+}
2684
+
2685
+const char *zip_addsicc(rtx dst, rtx condition, rtx ifsrc, rtx addv ATTRIBUTE_UNUSED) {
2686
+       // We know upon entry that REG_P(dst) must be true
2687
+       if (!REG_P(dst))
2688
+               internal_error("%s","ADDSICC into something other than register");
2689
+       if ((REG_P(ifsrc))&&(REGNO(dst)==REGNO(ifsrc))) {
2690
+               switch (GET_CODE(condition)) {
2691
+               case EQ: return "ADD.Z\t%3,%0";
2692
+               case NE: return "ADD.NZ\t%3,%0";
2693
+               case LT: return "ADD.LT\t%3,%0";
2694
+               case GT: return "ADD.GT\t%3,%0";
2695
+               case LE: return "ADD.LT\t%3,%0\n\tADD.Z\t%3,%0";
2696
+               case GE: return "ADD.GE\t%3,%0";
2697
+               case LTU: return "ADD.C\t%3,%0";
2698
+               case LEU: return "ADD.C\t%3,%0\n\tADD.Z\t%3,%0";
2699
+               case GEU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tXOR\t2,CC";
2700
+               // Can do a GEU comparison, and then undo on the Zero condition
2701
+               case GTU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tSUB.Z\t%3,%0\n\tXOR\t2,CC";
2702
+               default:
2703
+                       internal_error("%s", "Zip/No usable addsi expansion");
2704
+                       break;
2705
+               }
2706
+       } else {
2707
+               // MOV A+REG,REG
2708
+               switch (GET_CODE(condition)) {
2709
+               case EQ: return "MOV.Z\t%3+%2,%0";
2710
+               case NE: return "MOV.NZ\t%3+%2,%0";
2711
+               case LT: return "MOV.LT\t%3+%2,%0";
2712
+               case GT: return "MOV.GT\t%3+%2,%0";
2713
+               case LE: return "MOV.LT\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
2714
+               case GE: return "MOV.GE\t%3+%2,%0";
2715
+               case LTU: return "MOV.C\t%3+%2,%0";
2716
+               case LEU: return "MOV.C\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
2717
+               case GEU: return "XOR\t2,CC\n\tMOV.C\t%3+%2,%0\n\tXOR\t2,CC";
2718
+               // Can do a GEU comparison, and then undo on the Zero condition
2719
+               // EXCEPT: with a move instruction, what's there to undo?  We
2720
+               // just clobbered our register!
2721
+               // case GTU: return "XOR\t2,CC\n\tMOV.C\t%3,%0\n\tSUB.Z\t%3,%0XOR\t2,CC";
2722
+               default:
2723
+                       internal_error("%s", "Zip/No usable addsi(reg,reg) expansion");
2724
+                       break;
2725
+               }
2726
+       }
2727
+
2728
+       return "BREAK";
2729
+}
2730
+
2731 103 dgisselq
+static int     zip_memory_move_cost(machine_mode mode, reg_class_t ATTRIBUTE_UNUSED, bool in ATTRIBUTE_UNUSED) {
2732 102 dgisselq
+       int     rv = 14;
2733
+       if ((mode == DImode)||(mode == DFmode))
2734
+               rv += 2;
2735
+       return rv;
2736
+}
2737
+
2738 103 dgisselq
+// #warning "How do we tell the compiler LDI label is expensive as 2 ops"?
2739 117 dgisselq
+static bool    zip_cannot_modify_jumps_p(void) {
2740
+       // Let's try their suggested approach, keeping us from modifying jumps
2741
+       // after reload.  This should also allow our peephole2 optimizations
2742
+       // to adjust things back to what they need to be if necessary.
2743
+       return (reload_completed || reload_in_progress);
2744
+}
2745 122 dgisselq
+
2746
+rtx_insn       *zip_ifcvt_info;
2747
+
2748
+void
2749
+zip_ifcvt_modify_tests(ce_if_block *ce_info ATTRIBUTE_UNUSED, rtx *true_expr, rtx *false_expr) {
2750
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2751
+       if (dbg) fprintf(stderr, "IFCVT-MODIFY-TESTS\n");
2752
+       if (*true_expr) switch(GET_CODE(*true_expr)) {
2753
+               case LE:
2754
+               case GTU:
2755
+               case GEU:
2756
+               case LEU:
2757
+                       if (dbg) fprintf(stderr, "TRUE, missing expr\n");
2758
+                       if (dbg) zip_debug_rtx(*true_expr);
2759
+                       *true_expr = NULL_RTX;
2760
+                       break;
2761
+               default: // LT, GT, GTE, LTU, NE, EQ
2762
+                       break;
2763
+       }
2764
+
2765
+       if (*false_expr) switch(GET_CODE(*false_expr)) {
2766
+               case LE:
2767
+               case GTU:
2768
+               case GEU:
2769
+               case LEU:
2770
+                       if (dbg) fprintf(stderr, "FALSE, missing expr\n");
2771
+                       if (dbg) zip_debug_rtx(*false_expr);
2772
+                       *false_expr = NULL_RTX;
2773
+               default:
2774
+                       break;
2775
+       }
2776
+       if ((dbg)&&((!*true_expr)||(!*false_expr)))
2777
+               fprintf(stderr, "IFCVT-MODIFY-TESTS -- FAIL\n");
2778
+}
2779
+
2780
+void
2781
+zip_ifcvt_modify_cancel(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
2782
+/*
2783
+       fprintf(stderr, "IFCVT -- CANCEL\n");
2784
+       zip_ifcvt_info = NULL;
2785
+*/
2786
+}
2787
+
2788
+void
2789
+zip_ifcvt_modify_final(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
2790
+/*
2791
+rtx_insn *insn;
2792
+FOR_BB_INSNS(ceinfo->test_bb, insn)
2793
+       fprintf(stderr, "IFCVT -- FINAL\n");
2794
+       zip_debug_rtx_pfx("FINAL-TEST-BB", insn);
2795
+       zip_ifcvt_info = NULL;
2796
+*/
2797
+}
2798
+
2799
+void
2800
+zip_ifcvt_machdep_init(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
2801
+/*
2802
+       zip_ifcvt_info = NULL;
2803
+       rtx_insn *insn, *ifinsn = NULL;
2804
+       FOR_BB_INSNS(ceinfo->test_bb, insn) {
2805
+               rtx     p;
2806
+               p = single_set(insn);
2807
+               if (!p) continue;
2808
+               if (SET_DEST(p)==pc_rtx) {
2809
+                       ifinsn = insn;
2810
+               }
2811
+               if (!REG_P(SET_DEST(p)))
2812
+                       continue;
2813
+               if (GET_MODE(SET_DEST(p))!=CCmode)
2814
+                       continue;
2815
+               if (REGNO(SET_DEST(p))!=zip_CC)
2816
+                       continue;
2817
+               zip_ifcvt_info = insn;
2818
+       }
2819
+
2820
+       if (zip_ifcvt_info)
2821
+               zip_debug_rtx_pfx("PUTATIVE-CMP",zip_ifcvt_info);
2822
+       if (ifinsn)
2823
+               zip_debug_rtx_pfx("PRIOR-JMP",ifinsn);
2824
+*/
2825
+}
2826
+
2827 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.h gcc-5.3.0-zip/gcc/config/zip/zip.h
2828
--- gcc-5.3.0-original/gcc/config/zip/zip.h     1969-12-31 19:00:00.000000000 -0500
2829 122 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.h  2016-04-04 18:41:58.074920257 -0400
2830
@@ -0,0 +1,3983 @@
2831 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
2832
+//
2833
+// Filename:   gcc/config/zip/zip.h
2834
+//
2835
+// Project:    Zip CPU backend for the GNU Compiler Collection
2836
+//
2837
+// Purpose:
2838
+//
2839
+// Creator:    Dan Gisselquist, Ph.D.
2840
+//             Gisselquist Technology, LLC
2841
+//
2842
+////////////////////////////////////////////////////////////////////////////////
2843
+//
2844
+// Copyright (C) 2016, Gisselquist Technology, LLC
2845
+//
2846
+// This program is free software (firmware): you can redistribute it and/or
2847
+// modify it under the terms of  the GNU General Public License as published
2848
+// by the Free Software Foundation, either version 3 of the License, or (at
2849
+// your option) any later version.
2850
+//
2851
+// This program is distributed in the hope that it will be useful, but WITHOUT
2852
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
2853
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2854
+// for more details.
2855
+//
2856
+// You should have received a copy of the GNU General Public License along
2857
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
2858
+// target there if the PDF file isn't present.)  If not, see
2859
+// <http://www.gnu.org/licenses/> for a copy.
2860
+//
2861
+// License:    GPL, v3, as defined and found on www.gnu.org,
2862
+//             http://www.gnu.org/licenses/gpl.html
2863
+//
2864
+//
2865
+////////////////////////////////////////////////////////////////////////////////
2866
+#ifndef        GCC_ZIP_H
2867
+#define        GCC_ZIP_H
2868
+
2869
+
2870
+//
2871
+//
2872
+// Zip CPU configuration registers
2873
+//
2874
+//
2875
+#define        ZIP_USER        0        // Assume we are in supervisor mode
2876
+#define        ZIP_MULTIPLY    1       // Assume we have multiply instructions
2877
+#define        ZIP_DIVIDE      1       // Assume we have divide instructions
2878
+#define        ZIP_FPU         0        // Assume we have no floating point instructions
2879
+#define        ZIP_PIPELINED   1       // Assume our instructions are pipelined
2880
+#define        ZIP_VLIW        1       // Assume we have the VLIW feature
2881
+#define        ZIP_ATOMIC      ((ZIP_PIPELINED)&&(ZIP_VLIW))
2882
+#define        ZIP_PIC         0        // Attempting to produce PIC code, with GOT
2883
+#define        ZIP_HAS_DI      1
2884
+
2885
+// Zip has 16 registers in each user mode.
2886
+//     Register 15 is the program counter (PC)
2887
+//     Register 14 is the condition codes (CC)
2888
+//     Register 13 is the stack pointer   (SP)
2889
+//     Register 12 (may be) the Global Offset Table pointer (GOT)
2890
+//     Register  0 (may be) the return address pointer
2891
+// Registers 16-31 may only be used in supervisor mode.
2892
+#define        is_ZIP_GENERAL_REG(REGNO)       ((REGNO)<13)
2893
+#define        is_ZIP_REG(REGNO)               ((REGNO)<16)
2894
+
2895 103 dgisselq
+// #define     zip_FP_PSEUDO   16
2896
+#define        zip_PC          15
2897
+#define        zip_CC          14
2898
+#define        zip_SP          13
2899
+#define        zip_FP          12
2900
+#define        zip_GOT         11
2901
+#define        zip_AP          10
2902
+#define        zip_R1          1
2903
+#define        zip_R0          0
2904 102 dgisselq
+
2905
+#define        ZIP_FIRST_ARG_REGNO     1
2906
+#define        ZIP_LAST_ARG_REGNO      5
2907 111 dgisselq
+#define        NUM_ARG_REGS            (ZIP_LAST_ARG_REGNO-ZIP_FIRST_ARG_REGNO+1)
2908
+#define        MAX_PARM_REGS           (ZIP_LAST_ARG_REGNO-ZIP_FIRST_ARG_REGNO+1)
2909 102 dgisselq
+
2910
+/* The overall framework of an assembler file */
2911
+
2912
+#define        ASM_COMMENT_START       ";"
2913
+#define        ASM_APP_ON              ""
2914
+#define        ASM_APP_OFF             ""
2915
+
2916
+#define        FILE_ASM_OP             "\t.file\n"
2917
+
2918
+/* Output and Generation of Labels */
2919
+#define        GLOBAL_ASM_OP           "\t.global\t"
2920
+
2921
+#undef BITS_PER_UNIT
2922
+#define        BITS_PER_UNIT   (32)
2923
+
2924
+/* Assembler Commands for Alignment */
2925
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
2926
+               { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
2927
+
2928
+
2929
+/* A C compound statement to output to stdio stream STREAM the assembler syntax
2930
+ * for an instruction operand X. */
2931
+#define        PRINT_OPERAND(STREAM, X, CODE)  zip_print_operand(STREAM, X, CODE)
2932
+#define        PRINT_OPERAND_ADDRESS(STREAM, X) zip_print_operand_address(STREAM, X)
2933
+
2934
+/* Passing arguments in registers */
2935
+#define        FUNCTION_VALUE_REGNO_P(REGNO)   ((REGNO)==zip_R1)
2936
+
2937
+/* Define how to find the value returned by a function.  VALTYPE is the data
2938
+ * type of the value (as a tree).  If the precise function being called is known
2939
+ * FUNC is its FUNCTION_DECL; otherwise, FUNC is 0. */
2940
+#define        FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx_REG(TYPE_MODE(VALTYPE), zip_R1)
2941
+
2942
+/* Define how to find the value returned by a library function assuming the
2943
+ * value has mode MODE.
2944
+ */
2945
+#define        LIBCALL_VALUE(MODE)     gen_rtx_REG(MODE, zip_R1)
2946
+
2947
+
2948
+/* STACK AND CALLING */
2949
+
2950
+
2951
+/* Define this macro as a C expression that is nonzero for registers that are
2952
+ * used by the epilogue or the return pattern.  The stack and frame pointer
2953
+ * registers are already assumed to be used as needed.
2954
+ */
2955
+#define        EPILOGUE_USES(R)        (R == RETURN_ADDRESS_REGNUM)
2956
+
2957
+
2958
+/* Normal alignment required for function parameters on the stack, in bits.  All
2959
+ * stack parameters receive at leaswt this much alignment regardless of data
2960
+ * type. */
2961
+#define        PARM_BOUNDARY   32
2962
+
2963
+/* Alignment of field after 'int : 0' in a structure. */
2964
+#define        EMPTY_FIELD_BOUNDARY    32
2965
+
2966
+/* No data type wants to be aligned rounder than this. */
2967
+#define        BIGGEST_ALIGNMENT       32
2968
+
2969
+/* The best alignment to use in cases where we have a choice. */
2970
+#define        FASTEST_ALIGNMENT       32
2971
+
2972
+/* Every structures size must be a multiple of 32-bits. */
2973
+#define        STRUCTURE_SIZE_BOUNDARY 32
2974
+
2975
+/* PCC_BITFIELD_TYPE_MATTERS -- define this if you wish to imitate the the way
2976
+ * other C compilers handle alignment of bit-fields and the structures that
2977
+ * contain them.
2978
+ *
2979
+ * The behavior is that the type written for a named bit-field (int, short, or
2980
+ * other integer type) imposes an alignment for the entire structure, as if the
2981
+ * structure really did contain an ordinary field of that type.  In addition,
2982
+ * the bit-field is placed within the structure so that it would fit within
2983
+ * such a field, not crossing a boundary for it.
2984
+ *
2985
+ * Thus, no most machines, a named bit-field whose type is written as int would
2986
+ * not cross a four-byte boundary, and would force four-byte alignment for the
2987
+ * whole structure.  (The alignment used may not be four bytes; it is controlled
2988
+ * by other alignment parameters.)
2989
+ *
2990
+ * An unnamed bit-field will not affect the alignment of the containing
2991
+ * structure.
2992
+ *
2993
+ * If thhe macro is defined, its definition should be a C expression, a non
2994
+ * zero value for the expression enables this behavior.
2995
+ * Look at the fundamental type that is used for a bit-field and use that to
2996
+ * impose alignment on the enclosing structure.  struct s{int a:8}; should
2997
+ * have the same alignment as 'int', not 'char'.
2998
+ */
2999
+#undef PCC_BITFIELD_TYPE_MATTERS
3000
+#define        PCC_BITFIELD_TYPE_MATTERS       0
3001
+
3002
+/* MAX_FIXED_MODE_SIZE -- An integer expression for the size in bits of the
3003
+ * largest integer machine mode that should actually be used.  All integer
3004
+ * machine modes of this size and smaller can be used for structures and unions
3005
+ * with the appropriate sizes.  If this macro is undefined,
3006
+ * GET_MODE_BITSIZE(DImode) is assumed.
3007
+ *
3008
+ * ZipCPU -- The default looks good enough for us.
3009
+ */
3010
+
3011
+/* Make strings word-aligned so strcpy from constants will be faster. */
3012
+#define        CONSTANT_ALIGNMENT(EXP, ALIGN)  (((TREE_CODE(EXP)==STRING_CST)  \
3013
+       && ((ALIGN) < FASTEST_ALIGNMENT)) ? FASTEST_ALIGNMENT : (ALIGN))
3014
+
3015
+/* Make arrays of chars word-aligned for the same reasons. */
3016
+#define        DATA_ALIGNMENT(TYPE, ALIGN)     ((TREE_CODE(TYPE) == ARRAY_TYPE) \
3017
+       && (TYPE_MODE(TREE_TYPE(TYPE)) == QImode)               \
3018
+       && ((ALIGN < FASTEST_ALIGNMENT) ? FASTEST_ALIGNMENT : (ALIGN)))
3019
+
3020
+/* Generate Code for Profiling
3021
+ */
3022
+#define        FUNCTION_PROFILER(FILE,LABELNO)         (abort(), 0)
3023
+
3024
+
3025
+/* A C expression which is nonzero if register number NUM is suitable for use
3026
+ * as an index register in operand addresses.
3027
+ */
3028
+#define        REGNO_OK_FOR_INDEX_P(NUM)       0
3029
+
3030
+
3031
+/* A C compound statement with a conditional 'goto LABEL;' executed if X
3032
+ * (an RTX) is a legitimate memory address on the target machine for a memory
3033
+ * operand of mode MODE.
3034
+ */
3035 111 dgisselq
+/* 17.03 Controlling the Compilation Driver, 'gcc' */
3036
+// DRIVER_SELF_SPECS
3037
+// OPTION_DEFAULT_SPECS
3038
+// CPP_SPEC
3039
+// CPLUSPLUS_CPP_SPEC
3040
+// CC1_SPEC
3041
+// CC1PLUS_SPEC
3042
+/* ASM_SPEC ... A C string constant that tells the GCC driver program options
3043
+ * to pass to the assembler.  It can also specify how to translate options you
3044
+ * give to GCC into options for GCC to pass to the assembler.  See the file
3045
+ * 'sun3.h' for an example of this.
3046
+ *
3047
+ * Do not define thismacro if it does not need to do anything.
3048
+ */
3049
+// #undef      ASM_SPEC
3050
+// ASM_FINAL_SPEC
3051
+// ASM_NEEDS_DASH_FOR_PIPED_INPUT
3052
+
3053
+/* LINK_SPEC ... A C string constant that tells the GCC driver program options
3054
+ * to pass to the linker.  It can also specify how to translate options you give
3055
+ * to GCC into options for GCC to pass to the linker.
3056
+ *
3057
+ * Do not define this macro if it does not need to do anything.
3058
+ */
3059
+
3060
+/* LIB_SPEC ... Another C string constant very much like LINK_SPEC.  The
3061
+ * difference between the two is that LIB_SPEC is used at the end of the
3062
+ * command given to the linker.
3063
+ *
3064
+ * If this macro is not defined, a default is provided that loads the standard
3065
+ * C library from the usual place.  See 'gcc.c'.
3066
+ */
3067
+#undef LIB_SPEC
3068
+// #define     LIB_SPEC        "%{!g:-lc} %{g:-lg} -lzip"
3069
+#define        LIB_SPEC        ""
3070
+
3071
+/* LIBGCC_SPEC ... Another C string constant that tells the GCC driver program
3072
+ * hoow and when to place a reference to 'libgcc.a' into the linker command
3073
+ * line.  This constant is placed both before and after the value of LIB_SPEC.
3074
+ *
3075
+ * If this macro is not defined, the GCC driver provides a default that passes
3076
+ * the string '-lgcc' to the linker.
3077
+ */
3078
+#undef LIBGCC_SPEC
3079
+#define        LIBGCC_SPEC     ""
3080
+
3081
+/* REAL_LIBGCC_SPEC ... By default, if ENABLE_SHARED_LIBGCC is defined, the
3082
+ * LIBGCC_SPEC is not directly used by the driver program but is instead
3083
+ * modified to refer to different versions of 'libgcc.a' depending on the
3084
+ * values of the command line flags '-static', '-shared', '-static-libgcc',
3085
+ * and '-shared-libgcc'.  On targets where these modifications are
3086
+ * inappropriate, define REAL_LIBGCC_SPEC instead.  REAL_LIBGCC_SPEC tells the
3087
+ * driver how to place a reference to 'libgcc' on the link command line, but
3088
+ * unlike LIBGCC_SPEC, it is used unmodified.
3089
+ */
3090
+#define        REAL_LIBGCC_SPEC        ""
3091
+
3092
+// USE_LD_AS_NEEDED
3093
+// LINK_EH_SPEC
3094
+
3095
+/* STARTFILE_SPEC ... Another C string constant used much like LINK_SPEC.  The
3096
+ * difference between the two is that STARTFILE_SPEC is used at the very
3097
+ * beginning of the command given to the linker.
3098
+ *
3099
+ * If this macro is not defined, a default is provided that loads the standard
3100
+ * C startup file from the usual place.  See 'gcc.c'
3101
+ */
3102
+#undef STARTFILE_SPEC
3103
+#define        STARTFILE_SPEC  ""
3104
+
3105
+/* ENDFILE_SPEC ... Another C string constant used much like LINK_SPEC.  The
3106
+ * difference between the two is that ENDFILE_SPEC is used at the very end
3107
+ * of the command given to the linker.
3108
+ *
3109
+ * Do not define this macro if it does not do anything.
3110
+ */
3111
+// #undef      ENDFILE_SPEC
3112
+// #define     ENDFILE_SPEC    ""
3113
+
3114
+// THREAD_MODEL_SPEC
3115
+// SYSROOT_SUFFIX_SPEC
3116
+// SYSROOT_HEADERS_SUFFIX_SPEC
3117
+// EXTRA_SPECS
3118
+// LINK_LIBGCC_SPECIAL_1
3119
+// LINK_GCC_C_SEQUENCE_SPEC
3120
+// LINK_COMMAND_SPEC
3121
+// TARGET_ALWAYS_STRIP_DOTDOT
3122
+// MULTILIB_DEFAULTS
3123
+// RELATIVE_PREFIX_NOT_LINKDIR
3124
+// MD_EXEC_PREFIX
3125
+// STANDARD_STARTFILE_PREFIX
3126
+// STANDARD_STARTFILE_PREFIX_1
3127
+// STANDARD_STARTFILE_PREFIX_2
3128
+// MD_STARTFILE_PREFIX
3129
+// MD_STARTFILE_PREFIX_1
3130
+// INIT_ENVIRONMENT
3131
+// LOCAL_INCLUDE_DIR
3132
+#undef LOCAL_INCLUDE_DIR
3133
+
3134
+// NATIVE_SYSTEM_HEADER_COMPONENT
3135
+// INCLUDE_DEFAULTS
3136
+
3137 102 dgisselq
+/* 17.03 Run-time Target Specification */
3138
+
3139
+/* TARGET_CPU_CPP_BUILTINS() ... This function-like macro expands to a block of
3140
+ * code that defines built-in preprocessor macros and assertions for the target
3141
+ * CPU, using the functions builtin_define, builtin_define_std, and
3142
+ * builtin_assert.  When the front end calls this macro it provides a trailing
3143
+ * semicolon, and since it has finished command line option proccessing your
3144
+ * code can use those results freely.
3145
+ *
3146
+ * ZipCPU --- We should probably capture in this macro what capabilities the
3147
+ * command line parameters we've been given indicate that our CPU has.  That
3148
+ * way, code can be adjusted depending upon the CPU's capabilities.
3149
+ */
3150
+#define        TARGET_CPU_CPP_BUILTINS()                       \
3151
+       { builtin_define("__ZIPCPU__");                 \
3152
+       if (ZIP_FPU) builtin_define("__ZIPFPU__");      \
3153
+       if (ZIP_ATOMIC) builtin_define("__ZIPATOMIC__");        \
3154
+       }
3155
+       // If (zip_param_has_fpu)  builtin_define("__ZIPFPU__");
3156
+       // If (zip_param_has_div)  builtin_define("__ZIPDIV__");
3157
+       // If (zip_param_has_mpy)  builtin_define("__ZIPMPY__");
3158
+       // If (zip_param_has_lock) builtin_define("__ZIPLOCK__");
3159
+       // If (zip_param_supervisor) builtin_define("__ZIPUREGS__");
3160
+       // If (we support int64s) builtin_define("___int64_t_defined");
3161
+
3162
+/* TARGET_OS_CPP_BUILTINS() ... Similarly to TARGET_CPU_CPP_BUILTINS but this
3163
+ * macro is optional and is used for the target operating system instead.
3164
+ */
3165
+
3166
+/* Option macros: (we need to define these eventually ... )
3167
+ *
3168
+ *     TARGET_HANDLE_OPTION
3169
+ *     TARGET_HANDLE_C_OPTION
3170
+ *     TARGET_OBJ_CONSTRUCT_STRING_OBJECT
3171
+ *     TARGET_OBJ_DECLARE_UNRESOLVED_CLASS_REFERENCE
3172
+ *     TARGET_OBJ_DECLARE_CLASS_DEFINITION
3173
+ *     TARGET_STRING_OBJECT_REF_TYPE_P
3174
+ *     TARGET_CHECK_STRING_OBJECT_FORMAT_ARG
3175
+ *     TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE(VOID)
3176
+ *     C_COMMON_OVERRIDE_OTPTIONS
3177
+ *     TARGET_OPTION_OPTIMIZATION_TABLE
3178
+ *     TARGET_OPTION_INIT_STRUCT
3179
+ *     TARGET_OPTION_DEFAULT_PARAMS
3180
+ */
3181
+
3182
+/* SWITCHABLE_TARGET
3183
+ *
3184
+ * Zip CPU doesn't need this, so it defaults to zero.  No need to change it
3185
+ * here.
3186
+ */
3187
+
3188
+/* TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(VOID) ... Returns true if the
3189
+ * target supports IEEE 754 floating-point exceptions and rounding modes, false
3190
+ * otherwise.  This is intended to relate to the float and double types, but not
3191
+ * necessarily "long double".  By default, returns true if the adddf3
3192
+ * instruction pattern is available and false otherwise, on the assumption that
3193
+ * hardware floating point supports exceptions and rounding modes but software
3194
+ * floating point does not.
3195
+ *
3196
+ * ZipCPU floating point is barely going to be functional, I doubt it will
3197
+ * support all of these bells and whistles when full functionality is even
3198
+ * achieved.  Therefore, we won't support these modes.  However, we can't just
3199
+ * set this to zero, so let's come back to this.
3200
+ */
3201
+// #warning "Wrong answer encoded to date"
3202 103 dgisselq
+// #undef      TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
3203 102 dgisselq
+// #define     TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(X) 0
3204
+
3205
+/* 17.04 Defining data structures for per-function information */
3206
+
3207
+/* INIT_EXPANDERS ... Macro called to initialize any target specific
3208
+ * information.  This macro is called once per function, before generation of
3209
+ * any RTL has begun.  The intention is to allow the initialization of the
3210
+ * function pointer init_machine_status.
3211
+ */
3212
+// #warning "I may need to define this to handle function return addresses ..."
3213
+
3214
+/* 17.05 Storage Layout */
3215
+
3216
+/* Storage Layout */
3217
+#define        BITS_BIG_ENDIAN         0        // MSB has highest number
3218
+#define        BYTES_BIG_ENDIAN        1       // 1 if MSB is lowest number
3219
+#define        WORDS_BIG_ENDIAN        1       // 1 if MSW is lowest number
3220
+#define        FLOAT_WORDS_BIG_ENDIAN  1
3221
+#define        BITS_PER_WORD           32
3222
+// #define     MAX_BITS_PER_WORD       // defaults to BITS_PER_WORD
3223
+#define        UNITS_PER_WORD          1       // Storage units in a word, pwr of 2:1-8
3224
+#define        MIN_UNITS_PER_WORD      1       // Default is UNITS_PER_WORD
3225
+/* POINTER_SIZE ... Width of a pointer in bits.  You must specify a value no
3226
+ * wider than the width of Pmode.  If it is not equal to the width of Pmode,
3227
+ * you must define POINTERS_EXTEND_UNSIGNED. If you do not specify a value the
3228
+ * default is BITS_PER_WORD.
3229
+ *
3230
+ * ZipCPU --- All of our pointers are 32-bits, the width of our address bus.
3231
+ */
3232
+#define        POINTER_SIZE            32      // Ptr width in bits
3233
+/* POINTERS_EXTEND_UNSIGNED ... A C expression that determines how pointers
3234
+ * should be extended from ptr_mode to either Pmode or word_mode.  It is greater
3235
+ * than zero if pointers should be zero-extended, zero if they should be sign
3236
+ * extended, and negative if some other conversion is needed.  In the last case,
3237
+ * the extension is done by the target's ptr_extend instruction.
3238
+ *
3239
+ * You need not define this macro if the ptr_mode, Pmode, and word_mode are all
3240
+ * the same width.
3241
+ *
3242
+ * ZipCPU --- While we shouldn't need this, QImode and HImode have the same
3243
+ * number of bits as SImode.  Therefore, one might wish to convert between the
3244
+ * two.  Hence, we specify how we would do that here.
3245
+ */
3246
+#define        POINTERS_EXTEND_UNSIGNED        0
3247
+
3248
+/* PROMOTE_MODE(m,unsignedp,type) ... A macro to update m and unsignedp when an
3249
+ * object whose type is type and which has he specified mode and signedness is
3250
+ * to be stored in a register.  This macro is only called when type is a scalar
3251
+ * type.
3252
+ *
3253
+ * On most RISC machines, which only have operations that operate on a full
3254
+ * register, define this macro to set m to word_mode if m is an integer mode
3255
+ * narrower than BITS_PER_WORD.  In most cases, only integer modes should be
3256
+ * widened because wider precision floating-point operations are usually more
3257
+ * expensive than their narrower counterparts.
3258
+ *
3259
+ * For most machines, the macro definition does not change unsigndep.  However,
3260
+ * some machines, have instructions that preferentially handle either signed or
3261
+ * unsigned quantities of certain modes.  For example, on the DEC Alpha, 32-bit
3262
+ * loads from memory and 32-bit add instructions sign-extend the result to
3263
+ * 64-bits. On such machines, set unsignedp according to which kind of extension
3264
+ * is more efficient.
3265
+ *
3266
+ * Do not define this macro if it would never modify m.
3267
+ *
3268
+ * ZipCPU --- We need to always (if possible) promote everything to SImode where
3269
+ * we can handle things.  HImode and QImode just don't make sense on this CPU.
3270
+ */
3271
+#define        PROMOTE_MODE(M,U,T)     if ((GET_MODE_CLASS(M)==MODE_INT)&&(GET_MODE_SIZE(M)<2)) (M)=SImode;
3272
+
3273
+// TARGET_PROMOTE_FUNCTION_MODE
3274
+/* PARM_BOUNDARY ... Normal alignment required for function parameters on the
3275
+ * stack, in bits.  All stack parameters receive at least this much alignment
3276
+ * regardless of data type.  On most machines, this is the same as the size of
3277
+ * an integer.
3278
+ */
3279
+#define        PARM_BOUNDARY   32
3280
+
3281
+/* STACK_BOUNDARY ... Define this macro to the minimum alignment enforced by
3282
+ * hardware for the stack pointer on this machine.  The definition is a C
3283
+ * expression for the desired alignment (measured in bits).  This value is used
3284
+ * as a default if PREFERRED_STACK_BOUNDARY is not defined.  On most machines,
3285
+ * this should be the same as PARM_BOUNDARY.
3286
+ */
3287
+#define        STACK_BOUNDARY  PARM_BOUNDARY
3288
+
3289
+/* PREFERRED_STACK_BOUNDARY ... Define this ... */
3290
+
3291
+/* INCOMING_STACK_BOUNDARY
3292
+ */
3293
+
3294
+/* FUNCTION_BOUNDARY ... Alignment required for a function entry point, in bits.
3295
+ */
3296
+#define        FUNCTION_BOUNDARY       32
3297
+
3298
+/* BIGGEST_ALIGNMENT ... Biggest alignment that any data type can require on
3299
+ * this machine, in bits.  Note that this is not the biggest alignment that is
3300
+ * supported, just the biggest alignment that, when violated, may cause a fault.
3301
+ */
3302
+#define BIGGEST_ALIGNMENT      32
3303
+
3304
+/* MINIMUM_ATOMIC_ALIGNMENT ... If defined, the smallest alignment, that can be
3305
+ * given to an object that can be referenced in one operation, without
3306
+ * disturbing any nearby object.  Normally, this is BITS_PER_UNIT, but may be
3307
+ * larger on machines that don't have byte or halfword store operations.
3308
+ */
3309
+#define        MINIMUM_ATOMIC_ALIGNMENT        BITS_PER_UNIT
3310
+
3311
+/* STRICT_ALIGNMENT ... Set this nonzero if move instructions will actually
3312
+ * fail to work when given unaligned data.  If instructions will merely go
3313
+ * slower in that case, define this macro as 0.
3314
+ */
3315
+#define        STRICT_ALIGNMENT        1
3316
+
3317
+/* MAX_FIXED_MODE_SIZE ... An integer expression for the size in bits of the
3318
+ * largest integer machine mode that should actually be used.  All integer
3319
+ * machine modes of this size or smaller can be used for structures and unions
3320
+ * with the appropriate sizes.  If this macro is undefined,
3321
+ * GET_MODE_BITSIZE(DImode) is assumed.
3322
+ *
3323
+ * ZipCPU ... Get_MOD_BITSIZE(DImode) will be 64, and this is really not the
3324
+ * size on bits of the largest integer machine mode.  However, that's the case
3325
+ * with most DI implementations: A long is two words, spliced together.  We'd
3326
+ * like to support that eventually, but we need to get there.  Hence, let's use
3327
+ * compile time flag (ZIP_HAS_DI) that we can enable when we're ready.
3328
+ */
3329
+#if (ZIP_HAS_DI != 0)
3330
+#define        MAX_FIXED_MODE_SIZE     64
3331
+#else
3332
+#define        MAX_FIXED_MODE_SIZE     32
3333
+#endif
3334
+
3335
+
3336
+/* 17.06 Layout of Source Language Data Types */
3337
+
3338
+#undef CHAR_TYPE_SIZE
3339
+#undef SHORT_TYPE_SIZE
3340
+#undef INT_TYPE_SIZE
3341
+#undef LONG_TYPE_SIZE
3342
+#undef LONG_LONG_TYPE_SIZE
3343
+//
3344
+#define        CHAR_TYPE_SIZE  32
3345
+#define        SHORT_TYPE_SIZE 32
3346
+#define        INT_TYPE_SIZE   32
3347
+#define        LONG_TYPE_SIZE  32
3348
+#define        LONG_LONG_TYPE_SIZE     64
3349
+// BOOL_TYPE_SIZE defaults to CHAR_TYPE_SIZE
3350
+#undef FLOAT_TYPE_SIZE
3351
+#undef DOUBLE_TYPE_SIZE
3352
+#undef LONG_DOUBLE_TYPE_SIZE
3353
+#define        FLOAT_TYPE_SIZE         32
3354
+#define        DOUBLE_TYPE_SIZE        FLOAT_TYPE_SIZE // Zip CPU doesn't support dbls
3355
+#define        LONG_DOUBLE_TYPE_SIZE   64      // This'll need to be done via emulation
3356
+// SHORT_FRAC_TYPE_SIZE
3357
+// LONG_FFRACT_TYPE_SIZE
3358
+// LONG_LONG_FRACT_TIME_SIZE
3359
+#undef SHORT_ACCUM_TYPE_SIZE
3360
+#undef ACCUM_TYPE_SIZE
3361
+#undef LONG_ACCUM_TYPE_SIZE
3362
+#define        SHORT_ACCUM_TYPE_SIZE   SHORT_TYPE_SIZE
3363
+#define        ACCUM_TYPE_SIZE         INT_TYPE_SIZE
3364
+#define        LONG_ACCUM_TYPE_SIZE    LONG_TYPE_SIZE
3365
+
3366
+/* LIBGCC2_GNU_PREFIX ... This macro corresponds to the TARGET_GNU_PREFIX target
3367
+ * hook and should be defined if that hook is overriden to be true.  It causes
3368
+ * function names in libgcc to be changed to use a __gnu_ prefix for their name
3369
+ * rather than the default __.  A port which uses this macro should also arrange
3370
+ * to use t-gnu-prefix in the libgcc config.host.
3371
+ *
3372
+ * ZipCPU -- I see no reason to define and therefore change this behavior.
3373
+ */
3374
+
3375
+/* TARGET_FLT_EVAL_METHOD ... A C expression for the value for FLT_EVAL_METHOD
3376
+ * in float.h,, assuming, if applicable, that the floating-point control word
3377
+ * is in its default state.  If you do not define this macro the value of
3378
+ * FLT_EVAL_METHOD will be zero.
3379
+ *
3380
+ * ZipCPU --- ???
3381
+ */
3382
+
3383
+/* WIDEST_HARDWARE_FP_SIZE ... A C expression for the size in bits of the widest
3384
+ * floating-point format supported by the hardware.  If you define this macro,
3385
+ * you must specify a value less than or equal to the value of LONG_DOUBLE_...
3386
+ * If you do not define this macro, the value of LONG_DOUBLE_TYPE_SIZE is the
3387
+ * default.
3388
+ *
3389
+ * ZipCPU supports 32-bit IEEE floats--IF THE SUPPORT IS COMPILED IN!  This
3390
+ * really needs to be determined, then, based upon a compile time parameter
3391
+ * where the one compiling the code states whether or not the H/W even has
3392
+ * floating point support.
3393
+ *
3394
+ * For now, we'll assume it does--but once we implement GCC parameters, we'll
3395
+ * need to change this.
3396
+ */
3397
+#undef WIDEST_HARDWARE_FP_SIZE
3398
+// #warning "Definition needs to change if no FPU present"
3399
+#define        WIDEST_HARDWARE_FP_SIZE FLOAT_TYPE_SIZE
3400
+
3401
+/* DEFAULT_SIGNED_CHAR ... An expression whose value is 1 or 0, according to
3402
+ * whether the type char should be signed or unsigned by default.  The user
3403
+ * can always override this default with the options -fsigned-char and
3404
+ * -funsigned-char.
3405
+ *
3406
+ * ZipCPU--let's go with the default behavior.
3407
+ */
3408
+#define        DEFAULT_SIGNED_CHAR     1
3409
+
3410
+/* TARGET_DEFAULT_SHORT_ENUMS(VOID) ... This target hook should return true if
3411 103 dgisselq
+ * the compiler should give an enum type only as many bytes as it takes to
3412 102 dgisselq
+ * represent the range of possible values of that type.  It should return
3413
+ * false if all enum types should be allocated like int.
3414
+ *
3415
+ * The default is to return false.  This is what the ZipCPU needs, so we won't
3416
+ * override it.
3417
+ */
3418
+
3419
+/* SIZE_TYPE ... A C expression for a string describing the name of the data
3420
+ * type to use for size values.  The typedef name size_t is defined using the
3421
+ * contents of the string.
3422
+ *
3423
+ * If you don't define this macro, the default is "long unsigned int".  Since
3424
+ * on the ZipCPU this is a 32-bit number, and all ZipCPU values are 32-bits,
3425
+ * the default seems perfect for us.
3426
+ */
3427
+#define        SIZE_TYPE       "unsigned int"
3428
+
3429
+/* SIZETYPE ... GCC defines internal types () for expressions dealing with size.
3430
+ * This macro is a C expression for a string describing the name of the data
3431
+ * type from which the precision of sizetype is extracted.  The string has the
3432
+ * same restrictions as SIZE_TYPE string.  If you don't define this macro, the
3433
+ * default is SIZE_TYPE --- which seems good enough for us.
3434
+ */
3435
+
3436
+/* PTRDIFF_TYPE ... A C expression for a string describing the name of the data
3437
+ * type to use fo rthe result of subtracting two pointers.  The typedef name
3438
+ * ptrdiff_t is defined using the contents of the string.  See SIZE_TYPE for
3439
+ * more information.
3440
+ *
3441
+ * The default is "long int" which for the ZipCPU is 32-bits---still good enough
3442
+ * for us.
3443
+ */
3444
+#define        PTRDIFF_TYPE    "int"
3445
+
3446
+/* WCHAR_TYPE ... A C expression for a string describing the name of the data
3447
+ * type to use for wide characters.  The typedef name wchar_t is defined using
3448
+ * the contents of  the string.  If you don't define this macro, the default is
3449
+ * 'int'--good enough for ZipCPU.
3450
+ */
3451
+
3452
+/* WCHAR_TYPE_SIZE ... A C expression for the size in bits of the data type for
3453
+ * wide characters.  This is used in cpp, which cannot make use of WCHAR_TYPE.
3454
+ */
3455
+#undef WCHAR_TYPE_SIZE
3456
+#define        WCHAR_TYPE_SIZE 32
3457
+
3458
+/* WINT_TYPE ... A C expression for a string describing the name of the data
3459
+ * type to use for wide characters passed to printf and returned from getwc.
3460
+ * The typedef name wint_t is defined using the contents of the string.  See
3461
+ *
3462 103 dgisselq
+ * ZipCPU -- If you don't define this macro, the default is "unsigned int"--also
3463
+ * best for us again.
3464 102 dgisselq
+ */
3465
+
3466
+/* INTMAX_TYPE ... A C expression for a string describing the name of the
3467
+ * data type that can represent any value of any standard or extended signed
3468
+ * integer type.  The typedef name intmax_t is defined using the contents of
3469
+ * the string.
3470
+ *
3471
+ * If you don't define this macro, the default is the first of "int", "long int"
3472
+ * or "long long int" that has as much precision as "long long int".
3473
+ */
3474
+
3475
+/* UINTMAX_TYPE ... same as INTMAX_TYPE, but for unsigned
3476
+ */
3477
+
3478
+#undef SIG_ATOMIC_TYPE
3479
+#if (ZIP_ATOMIC != 0)
3480
+#define        SIG_ATOMIC_TYPE "int"
3481
+#else
3482
+#define        SIG_ATOMIC_TYPE NULL    // We have no atomic types, but registers
3483
+#endif
3484
+#undef INT8_TYPE
3485
+#define        INT8_TYPE               NULL    // We have no 8-bit integer type
3486
+#undef INT16_TYPE
3487
+#define        INT16_TYPE              NULL
3488
+#undef INT32_TYPE
3489
+#define        INT32_TYPE              "int"
3490
+#undef UINT8_TYPE
3491
+#define        UINT8_TYPE              NULL
3492
+#undef UINT16_TYPE
3493
+#define        UINT16_TYPE             NULL
3494
+#undef UINT32_TYPE
3495
+#define        UINT32_TYPE             "unsigned int"
3496
+#undef INT_LEAST8_TYPE
3497
+#define        INT_LEAST8_TYPE         "int"
3498
+#undef INT_LEAST16_TYPE
3499
+#define        INT_LEAST16_TYPE        "int"
3500
+#undef INT_LEAST32_TYPE
3501
+#define        INT_LEAST32_TYPE        "int"
3502
+#undef UINT_LEAST8_TYPE
3503
+#define        UINT_LEAST8_TYPE        "unsigned int"
3504
+#undef UINT_LEAST16_TYPE
3505
+#define        UINT_LEAST16_TYPE       "unsigned int"
3506
+#undef UINT_LEAST32_TYPE
3507
+#define        UINT_LEAST32_TYPE       "unsigned int"
3508
+#undef INT_FAST8_TYPE
3509
+#define        INT_FAST8_TYPE          "int"
3510
+#undef INT_FAST16_TYPE
3511
+#define        INT_FAST16_TYPE         "int"
3512
+#undef INT_FAST32_TYPE
3513
+#define        INT_FAST32_TYPE         "int"
3514
+#undef UINT_FAST8_TYPE
3515
+#define        UINT_FAST8_TYPE         "unsigned int"
3516
+#undef UINT_FAST16_TYPE
3517
+#define        UINT_FAST16_TYPE        "unsigned int"
3518
+#undef UINT_FAST32_TYPE
3519
+#define        UINT_FAST32_TYPE        "unsigned int"
3520
+#undef INTPTR_TYPE
3521
+#define        INTPTR_TYPE             "unsigned int"
3522
+#undef UINTPTR_TYPE
3523
+#define        UINTPTR_TYPE            "unsigned int"
3524
+
3525
+#undef INT64_TYPE
3526
+#undef UINT64_TYPE
3527
+#undef INT_LEAST64_TYPE
3528
+#undef UINT_LEAST64_TYPE
3529
+#undef INT_FAST64_TYPE
3530
+#undef UINT_FAST64_TYPE
3531
+
3532
+#if (ZIP_HAS_DI != 0)
3533
+#define        INT64_TYPE              "long int"
3534
+#define        UINT64_TYPE             "long unsigned int"
3535
+#define        INT_LEAST64_TYPE        "long int"
3536
+#define        UINT_LEAST64_TYPE       "long unsigned int"
3537
+#define        INT_FAST64_TYPE         "long int"
3538
+#define        UINT_FAST64_TYPE        "long unsigned int"
3539
+#else
3540
+#define        INT64_TYPE              NULL
3541
+#define        UINT64_TYPE             NULL
3542
+#define        INT_LEAST64_TYPE        NULL
3543
+#define        UINT_LEAST64_TYPE       NULL
3544
+#define        INT_FAST64_TYPE         NULL
3545
+#define        UINT_FAST64_TYPE        NULL
3546
+#endif
3547
+
3548
+#define        TARGET_PTRMEMFUNC_VBI_LOCATION  ptrmemfunc_vbit_in_pfn
3549
+
3550
+
3551
+/* 17.07 Register Usage / Register definitions */
3552
+
3553
+/* FIRST_PSEUDO_REGISTER ... Number of hardware registers known to the compiler.
3554
+ * They receive numbers 0 through FIRST_PSEUDO_REGISTER-1; thus the first
3555
+ * pseudo register's numbrer really is assigned the number
3556
+ * FIRST_PSEUDO_REGISTER.
3557
+ *
3558
+ * ZipCPU---There are 16 registers in the ZipCPU, numbered 0-15 with the CC
3559
+ * and PC register being numbered 14 and 15 respectively.  Therefore, the
3560
+ * compiler can take register number 16 and above and do whatever it wants
3561
+ * with it.
3562
+ */
3563
+#ifdef DEFINE_USER_REGS
3564 103 dgisselq
+#  define      FIRST_PSEUDO_REGISTER   32
3565 102 dgisselq
+#else
3566 103 dgisselq
+#  ifdef       zip_FP_PSEUDO
3567
+#    define    FIRST_PSEUDO_REGISTER   (zip_FP_PSEUDO+1)
3568
+#  else
3569
+#    define    FIRST_PSEUDO_REGISTER   16
3570
+#  endif
3571 102 dgisselq
+#endif
3572
+
3573
+/* FIXED_REGISTERS ... An initializer that says which registers are used for
3574
+ * fixed purposes all throughout the compiled code and are therefore not
3575
+ * available for general allocation.  These would include the stack pointer, the
3576
+ * frame pointer (except on machines where that can be used as a general
3577
+ * register when no frame pointer is needed), the program counter on machines
3578
+ * where that is considered one of the addressable registers, and any other
3579
+ * numbered register with a standard use.
3580
+ *
3581
+ * This information is expressed as a sequence of numbers, separated by commas,
3582
+ * and surrounded by braces.  The nth number is 1 if register n is fixed, 0
3583
+ * otherwise.
3584
+ *
3585
+ * For the Zip CPU, we have three fixed registers that are not available for
3586
+ * general allocation:
3587
+ *
3588
+ *     SP      The stack pointer
3589
+ *     CC      The condition codes and CPU state register
3590
+ *     PC      The program counter
3591
+ *
3592
+ * Other registers, such as FP (the frame pointer) or GBL (the global offset
3593
+ * table pointer) are registers that we hope will not be so fixed.
3594
+ */
3595 103 dgisselq
+#ifdef zip_FP_PSEUDO
3596
+#  define      FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1 }
3597
+#else
3598
+#  define      FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1 }
3599
+#endif
3600 102 dgisselq
+
3601
+/* CALL_USED_REGISTERS ... like FIXED_REGISTERS but has 1 for each register
3602
+ * that is clobbered (in general) by function calls as well as for fixed
3603
+ * registers.  This macro therefore identifies the registers that are not
3604
+ * available for general allocation of values that must live across function
3605
+ * calls.
3606
+ *
3607
+ * If a register has 0 in CALL_USED_REGISTERS, the compiler automatically saves
3608
+ * it on function entry and restores it on function exit, if the register is
3609
+ * used within the function.
3610
+ *
3611
+ * On the Zip CPU, we must save R0 (the return address), and (let's pick) any
3612
+ * register above R5.
3613
+ */
3614 103 dgisselq
+#ifdef zip_FP_PSEUDO
3615
+#  define      CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1 }
3616
+#else
3617
+#  define      CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1 }
3618
+#endif
3619 102 dgisselq
+
3620
+/* CALL_REALLY_USED_REGISTERS ...  optional macro that, if not defined, defaults
3621
+ * to the value of CALL_USED_REGISTERS.
3622
+ */
3623
+
3624
+/* HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE) ... A C expression that is nonzero
3625
+ * if it is not permissible to store a value of mode MODE in hard register REGNO
3626
+ * across a call without some part of it being clobbbered.  For most machines,
3627
+ * this macro need not be defined.  It is only required for machines that do
3628 103 dgisselq
+ * not preserve the entire contents of a register across a call.
3629 102 dgisselq
+ *
3630
+ * In the Zip CPU, we clobber R0 with our return address during a call, so let's
3631
+ * make sure this gets included here.
3632
+ */
3633
+#define        HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE)      (REGNO==0)
3634
+
3635
+/* TARGET_CONDITIONAL_REGISTER_USAGE(VOID) ... This hook may conditionally
3636
+ * modify five variables fixed_regs, call_used_regs, global_regs, reg_names, and
3637
+ * reg_class_contents, to take into account any dependence of these register
3638
+ * sets on target flags.  The first three of these are of type char[]
3639
+ * (interpreted as Boolean vectors).  global_regs is a const char *[] and
3640
+ * reg_class_contents is a HARD_REG_SET.  Before the macro is called,
3641
+ * fixed_regs, call_used_regs, reg_class_contents, and reg_names have been
3642
+ * initialized from FIXED_REGISTERS, CALL_USED_REGISTERS, REG_CLASS_CONTENTS,
3643
+ * and REGISTER_NAMES, respectively.  global_regs has been cleared, and any
3644
+ * -ffixed-reg, -fcall-used-reg, and -fcall-saved-reg command options have been
3645
+ * applied.
3646
+ *
3647
+ * ZipCPU -- I may need to return and define this depending upon how FP and
3648
+ * GBL register allocation go.  But for now, we'll leave this at its default
3649
+ * value.
3650
+ */
3651
+// #warning "Revisit me after FP and GBL allocation"
3652
+
3653
+/* INCOMING_REGNO(out) ... Define this macro if the target machine has register
3654
+ * windows. ...
3655
+ *
3656
+ * Zip CPU has no register windows.
3657
+ */
3658
+
3659
+/* OUTGOING_REGNO ... same thing.
3660
+ */
3661
+
3662
+/* LOCAL_REGNO ... same thing.
3663
+ */
3664
+
3665
+/* PC_REGNUM ... If the program counter has a register number, define this as
3666
+ * that register number.  Otherwise do not define it.
3667
+ */
3668
+#define        PC_REGNUM       zip_PC
3669
+
3670
+
3671
+/* REG_ALLOC_ORDER ... If defined, an initializer for a vector of integers,
3672
+ * containing the number of hard registers in the order in which GCC should
3673
+ * prefer to use them (from most preferred to least.
3674
+ *
3675 103 dgisselq
+ * If this macro is not defined, registers are used lowest numbered first (all
3676 102 dgisselq
+ * else being equal).
3677
+ *
3678
+ * Since the default is the ZipCPU desired case, we won't define this here.
3679
+ */
3680
+
3681
+/* ADJUST_REG_ALLOC_ORDER ... on most machines it is not necessary to define
3682
+ * this macro, so we won't either.
3683
+ */
3684
+
3685
+/* HONOR_REG_ALLOC_ORDER ...
3686
+ */
3687
+
3688
+/* HONOR_REG_ALLOC_ORDER ... on most machines it is not necessary to define
3689
+ * this macro, so we won't either.
3690
+ */
3691
+
3692
+/* HARD_REGNO_NREGS(REGNO, MODE) ... A C expression for the number of
3693
+ * consecutive hard registers, starting at register number REGNO, required to
3694
+ * hold a value of mode MODE.
3695
+ *
3696
+ * On a machine where all registers are exactly one word, a suitable definition
3697
+ * is given of ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)/UNITS_PER_WORD.
3698
+ *
3699
+ * On ZipCPU, we might do
3700
+ *     ((((MODE)==DImode)||((MODE)==DFmode))?2:1)
3701
+ * but I think the default (above) code should work as well.  Hence, let's stick
3702
+ * with the default, lest someone try to create larger modes (TImode, OImode,
3703
+ * XImode) and expect us to follow them properly some how.
3704
+ *
3705
+ * Okay, now in hind sight, we know that the default doesn't work for our
3706
+ * architecture, since GET_MODE_SIZE(SImode)=4, not 1.  Thus, let's rearrange
3707
+ * this expression to work in bits rather than in bytes and we'll know more
3708
+ * of what we are doing.
3709
+ */
3710
+#undef HARD_REGNO_NREGS
3711
+#define        HARD_REGNO_NREGS(REGNO, MODE)   ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)\
3712
+               / (UNITS_PER_WORD))
3713
+
3714
+/* HARD_REGNO_NREGS_HAS_PADDING(REGNO,MODE) ... A C expression that is nonzero
3715
+ * if a value of mode MODE, stored in memory, ends with padding that causes it
3716
+ * to take up more space than in registers starting at register number REGNO
3717
+ * (as determined by multiplying GCC's notion of the size of the register when
3718
+ * containing this mode by the number of registers returned by HARD_REGNO_NREGS)
3719
+ * By default this is zero.
3720
+ *
3721
+ * Zip CPU --- The default looks good enough to me.
3722
+ */
3723
+
3724
+/* HARD_REGNO_NREGS_WITH_PADDING(REGNO, MODE)
3725
+ *
3726
+ * ZipCPU ---
3727
+ */
3728
+
3729
+/* REGMODE_NATURAL_SIZE(MODE) -- Define this macro if the natural size of
3730
+ * registers that hold values of mode mode is not the word size.  It is a C
3731
+ * expression that should give the natural size in bytes for the specified mode.
3732
+ * It is used by the register allocator to try to optimize its results.
3733
+ *
3734
+ * ZipCPU ---
3735
+ */
3736
+// #define     REGMODE_NATURAL_SIZE(MODE)      (((MODE)==DImode)?2:1)
3737
+
3738
+/* HARD_REGNO_MODE_OK ... A C expression that is nonzero if it is permissible
3739 103 dgisselq
+ * to store a value of mode MODE in a hard register number REGNO (or in several
3740 102 dgisselq
+ * registers starting with that one).  For a machine where all registers are
3741
+ * equivalent, a suitable definition is '1'.  You need not include code to check
3742
+ * for the numbers of fixed registers, because the allocation mechanism
3743
+ * considered them to be always occupied.
3744
+ *
3745
+ * ZipCPU --- As long as you are already avoiding the fixed registers, the
3746
+ * suitable default definition mentioned above should be sufficient.
3747
+ */
3748
+#undef HARD_REGNO_MODE_OK
3749 103 dgisselq
+#define        HARD_REGNO_MODE_OK(R,M) (R<zip_CC)
3750 102 dgisselq
+
3751
+/* HARD_REGNO_RENAME_OK(FROM,TO) ... A C expression that is nonzero if it is
3752
+ * okay to rename a hard register FROM to another hard register TO.  One common
3753
+ * use of this macro is to prevernt renaming of a register to another register
3754
+ * that is not saved by a prologue in an interrupt handler.  The default is
3755
+ * always nonzero.
3756
+ *
3757
+ * ZipCPU --- The default looks good enough to us.
3758
+ */
3759
+#undef HARD_REGNO_RENAME_OK
3760
+#define        HARD_REGNO_RENAME_OK(FROM,TO)   ((is_ZIP_GENERAL_REG(FROM))&&(is_ZIP_GENERAL_REG(TO)))
3761
+
3762
+
3763
+/* MODES_TIABLE_P(M1, M2) ... A C expression that is nonzero if a value of mode
3764
+ * M1 is accessible in mode M2 without copying.
3765
+ *
3766
+ * ZipCPU --- well, that's true for us (although we support scant few modes) ...
3767
+ * so lets' set to one.
3768
+ */
3769
+#define        MODES_TIEABLE_P(M1,M2)  1
3770
+
3771
+/* TARGET_HARD_REGNO_SCRATCH_OK(REGNO)
3772
+ * This target hook should return true if it is OK to use a hard register
3773
+ * REGNO has a scratch register in peephole2.  One common use of this macro is
3774
+ * to prevent using of a register that is not saved by a prologue in an
3775
+ * interrupt handler.  The default version of this hook always returns true.
3776
+ *
3777
+ * ZipCPU --- the default works for us as well.  If you are in an interrupt
3778
+ * context, you have an entirely new set of registers (the supervisor set), so
3779
+ * this is a non-issue.
3780
+ */
3781
+
3782
+/* AVOID_CCMODE_COPIES ... define this macro if the compiler should avoid
3783
+ * copies to/from CCmode register(s).  You should only define this macro if
3784
+ * support for copying to/from CCmode is incomplete.
3785
+ *
3786
+ * ZipCPU --- CCmode register copies work like any other, so we'll keep with the
3787
+ * default definition.
3788
+ */
3789
+
3790
+/* STACK_REGS ... Define this if the machine has any stack-like registers.
3791
+ *
3792
+ * Zip CPU has no stack-like registers, as their definition is different from
3793
+ * the ZipCPU stack pointer register.
3794
+ */
3795
+
3796
+#define        ZIP_REG_BYTE_SIZE       1
3797
+
3798
+/* 17.08 Register Classes */
3799
+
3800
+/* enum reg_class ... An enumerate type that must be defined with all the
3801
+ * register class names as enumerated values.  NO_REGS must be first.  ALL_REGS
3802
+ * must be the last register class, followed by one more enumerated value,
3803
+ * LIM_REG_CLASSES, which is not a register class but rather tells how many
3804
+ * classes there are.
3805
+ *
3806
+ * ZipCPU --- We'll defined register 0-13 as general registers, 14-15 in
3807
+ * all_regs, and go from there.
3808
+ */
3809
+enum   reg_class {
3810
+       NO_REGS, GENERAL_REGS,
3811
+#ifdef DEFINE_USER_REGS
3812
+       USER_REGS,
3813
+#endif
3814
+       ALL_REGS, LIM_REG_CLASSES
3815
+};
3816
+
3817
+/* N_REG_CLASSES ... the number of distinct register classes, defined as follows
3818
+ */
3819
+#define        N_REG_CLASSES   (int)LIM_REG_CLASSES
3820
+
3821
+/* REG_CLASS_NAMES ... An initializer containing the names of the register
3822
+ * classes as C string constants.  These names are used in writing some of the
3823
+ * debugging dumps.
3824
+ */
3825
+#define        REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "ALL_REGS" }
3826
+
3827
+/* REG_CLASS_CONTENTS ... An initializer containing the contents of the register
3828
+ * classes, as integerss which are bit masks.  The nth integer specifies the
3829
+ * contents of class n.  That way the integer mask is interpreted as that
3830
+ * register r is in the class if (mask&(1<<r)) is 1.
3831
+ *
3832
+ * When the machine has more than 32 registers ... that's not us.
3833
+ *
3834
+ * ZipCPU --- This is straight forward, three register classes, etc.
3835
+ */
3836 103 dgisselq
+#ifdef zip_FP_PSEUDO
3837
+#define        REG_CLASS_CONTENTS { { 0x00000}, {0x13fff}, {0x1ffff} }
3838
+#else
3839 102 dgisselq
+#define        REG_CLASS_CONTENTS { { 0x00000}, {0x03fff}, {0x0ffff} }
3840 103 dgisselq
+#endif
3841 102 dgisselq
+
3842
+#ifdef DEFINE_USER_REGS
3843
+#define        REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "USER_REGS", "ALL_REGS" }
3844
+#define        REG_CLASS_CONTENTS { { 0x00000},{0x03fff},{0x0ffff0000},{0x0ffffffff} }
3845
+#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 }
3846
+#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 }
3847
+#endif
3848
+
3849
+/* REGNO_REG_CLASS ... A C expression whose value is a register class
3850
+ * containing hard register REGNO.  In general there is more than one such
3851
+ * class;  Choose a class which is minimal, meaning that no smaller class also
3852
+ * contains the register.
3853
+ */
3854
+#undef REGNO_REG_CLASS
3855 103 dgisselq
+#ifdef zip_FP_PSEUDO
3856
+#define        REGNO_REG_CLASS(R)      (is_ZIP_REG(R)?((((R)<=13)||((R)==zip_FP_PSEUDO))?GENERAL_REGS:ALL_REGS):NO_REGS)
3857
+#else
3858 102 dgisselq
+#define        REGNO_REG_CLASS(R)      (is_ZIP_REG(R)?((R<=13)?GENERAL_REGS:ALL_REGS):NO_REGS)
3859 103 dgisselq
+#endif
3860 102 dgisselq
+
3861
+/* BASE_REG_CLASS ... A macro whose definition is the name of the class to which
3862
+ * a valid base register must belong.  A base register is one used in an address
3863
+ * which is the register value plus a displacement.
3864
+ */
3865
+#undef BASE_REG_CLASS
3866
+#define        BASE_REG_CLASS  GENERAL_REGS
3867
+
3868
+/* MODE_BASE_CLASS(MODE) ... This is a variation of the BASE_REG_CLASS macro
3869
+ * which allows the selection of a bse register in a mode dependent manner.  If
3870
+ * mode is VOIDmode then it should return the same value as BASE_REG_CLASS.
3871
+ */
3872
+#undef MODE_BASE_CLASS
3873
+#define        MODE_BASE_CLASS(MODE)   GENERAL_REGS
3874
+
3875
+/* MODE_BASE_REG_REG_CLASS(MODE) ... A C expression whose value is the register
3876
+ * class to which a valid base register must belong in order to be used in a
3877
+ * base plus index register address.  You should define this macro if base plus
3878
+ * index addresses have different requirements than other base register uses.
3879
+ *
3880
+ * Zip CPU does not support the base plus index addressing mode, thus ...
3881
+ */
3882 111 dgisselq
+// #undef      MODE_BASE_REG_REG_CLASS
3883
+// #define     MODE_BASE_REG_REG_CLASS(MODE)   NO_REGS
3884 102 dgisselq
+
3885
+/* INDEX_REG_CLASS ... A macro whose definition is the name of the class to
3886
+ * which a valid index register must belong.  An index register is one used in
3887
+ * an address where its value is either multiplied by a scale factor or added
3888
+ * to another register (as well as added to a displacement).
3889
+ *
3890
+ * ZipCPU -- Has no index registers.
3891
+ */
3892
+#undef INDEX_REG_CLASS
3893
+#define        INDEX_REG_CLASS NO_REGS
3894
+
3895
+/* REGNO_OK_FOR_BASE_P(NUM) ... A C expression which is nonzero if register
3896
+ * number num is suitable for use as a base register in operand addresses.
3897
+ */
3898
+#undef REGNO_OK_FOR_BASE_P
3899
+#ifdef DEFINE_USER_REGS
3900
+# define REGNO_OK_FOR_BASE_P(NUM)      ((NUM != zip_CC)&&(NUM < 16))
3901
+#else
3902
+# define REGNO_OK_FOR_BASE_P(NUM)      (NUM != zip_CC)
3903
+#endif
3904
+
3905
+/* REGNO_MODE_OK_FOR_BASE_P ... A C expressison that is just like
3906
+ * REGNO_OK_FOR_BASE_P, except that that expression may examine the mode of the
3907 111 dgisselq
+ * memory reference in MODE.  You should define this macro if the mode of the
3908 102 dgisselq
+ * memory reference affects whether a register may be used as a base register.
3909
+ *
3910
+ * ZipCPU --- the mode doesn't affect anything, so we don't define this.
3911
+ */
3912
+
3913
+/* REGNO_MODE_OK_FOR_REG_BASE_P(NUM, MODE) ... base plus index operand
3914
+ * addresses, accessing memory in mode mode.
3915
+ *
3916
+ * Use of this macro is deprecated.
3917
+ */
3918
+
3919 111 dgisselq
+/* REGNO_MODE_CODE_OK_FOR_BASE_P(N,M,AS,OC,IC) ... A C expression which is
3920 102 dgisselq
+ * nonzero if a register number N is suitable for use as a base register in
3921
+ * operand addresses, accessing memory in mode M in address space AS.  This is
3922
+ * similar to REGNO_MODE_OK_FOR_BASE_P, except that the expression may examine
3923
+ * the context in which the register appears in the memory reference.
3924
+ *
3925
+ * ZipCPU---We aren't specific in how we use our registers.
3926
+ */
3927
+#define        REGNO_MODE_CODE_OK_FOR_BASE_P(N,M,AS,OC,IC) REGNO_OK_FOR_BASE_P(N)
3928
+
3929
+/* REGNO_OK_FOR_INDEX_P(REGNO) ... A C expression which is nonzero if register
3930
+ * num is suitable for use as an index register in opernad addressess.  It may
3931
+ * be either a suitable hard register or a pseudo register that has been
3932 111 dgisselq
+ * allocated such as a hard register.
3933 102 dgisselq
+ *
3934
+ * ZipCPU has no index registers, therefore we declare this to be zero.
3935
+ */
3936
+#undef REGNO_OK_FOR_INDEX_P
3937
+#define        REGNO_OK_FOR_INDEX_P(REGNO)     0
3938
+
3939
+/* TARGET_PREFERRED_RENAME_CLASS(RCLASS) ... A target hook that places
3940
+ * additional preference on the register class to use when it is necessary to
3941
+ * rename a register in class RCLASS to another class, or perhaps NO_REGS, if no
3942
+ * preferred register class is found or hook preferred_rename_class is not
3943
+ * implemented.  SOmething returning a more restrictive class makes better code.
3944
+ * For example, on ARM, thumb-2 instructions using LO_REGS may be smaller than
3945
+ * instructions using GENERIC_REGS.  By returning LO_REGS from
3946
+ * preferred_rename_class, code size can be reduced.
3947
+ */
3948
+// #undef TARGET_PREFERRED_RENAME_CLASS
3949
+// #define     TARGET_PREFERRED_RENAME_CLASS(RCLASS)   RCLASS
3950
+
3951
+/* TARGET_PREFERRED_RELOAD_CLASS(X,RC) ... A target hook that places additional
3952
+ * restri tions on the register class to use when it is necessary to copy value
3953
+ * X into a register in class RC.  The value is a register class; rehaps RC, or
3954
+ * perhaps a smaller class.
3955
+ *
3956
+ * The default fversion of this hook always returns value of RC argument, which
3957
+ * sounds quite appropriate for the ZipCPU.
3958
+ */
3959
+
3960
+/* PREFERRED_RELOAD_CLASS(X,CLASS) ... A C expression that places additional
3961
+ * restrictions on the register class to use when it is necessary to copy
3962
+ * value X into a register in class CLASS.  On many machines, the following
3963
+ * definition is safe: PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
3964
+ * Sometimes returning a more restrictive class makes better code.  For example,
3965
+ * on the 68k, when x is an integer constant that is in range for a moveq
3966
+ * instruction, the value of this macro is always DATA_REGS as long as CLASS
3967 111 dgisselq
+ * includes the data registers.  Requiring a data register guarantees that a
3968 102 dgisselq
+ * 'moveq' will be used.
3969
+ *
3970
+ * ZipCPU --- you can't load certain values into all members of ALL_REGS.  For
3971
+ * example, loading (sleep and !gie) into the CC register could halt the CPU.
3972
+ * Hence, we only allow loads into the GENERAL_REG class.
3973
+ */
3974
+#define        PREFERRED_RELOAD_CLASS(X, CLASS)        GENERAL_REGS
3975
+
3976
+/* TARGET_PREFERRED_OUTPUT_RELOAD_CLASS(RTX,RCLASS) ... Like TARGET_PREFERRED_..
3977
+ * RELOAD_CLASS, but for output instead of input reloads.
3978
+ *
3979
+ * ZipCPU --- there's gotta be a valid default behaviour for this.
3980
+ */
3981
+
3982
+/* LIMIT_RELOAD_CLASS(MODE, CL) ...
3983
+ *
3984
+ * Don't define this macro unless the target machine has limitations which
3985
+ * require the macro to do something nontrivial.  ZipCPU doesn't, so we won't.
3986
+ */
3987
+
3988
+/* TARGET_SECONDARY_RELOAD
3989
+ * SECONDARY_ ...
3990
+ * Don't think we need these ...
3991
+ */
3992
+
3993
+/* CLASS_MAX_NREGS(CLASS,MODE) ... A C expression for the maximum number of
3994
+ * consecutive registers of class CLASS needed to hold a value of mode MODE.
3995
+ *
3996
+ * This is closely related to the macro HARD_REGNO_NREGS.  In fact, the value
3997
+ * of the macro CLASS_MAX_REGS(CL,M) should be the maximum value of
3998
+ * HARD_REGNO_NREGS(REGNO,MODE) for all REGNO values in the class CLASS.
3999
+ *
4000
+ * This macro helps control the handling of multiple word values in the reload
4001
+ * pass.
4002
+ *
4003
+ * ZipCPU --- We'll just use HARDNO_REGNO_NREGS, since CLASS is independent for
4004
+ * us.  We'll also choose register R0, since ... well, since it simply doesn't
4005
+ * matter.  (HARD_REGNO_NREGS ignores this anyway)
4006
+ */
4007
+#define        CLASS_MAX_NREGS(CLASS, MODE)    HARD_REGNO_NREGS(0,MODE)
4008
+
4009
+/* CANNOT_CHANGE_MODE_CLASS
4010
+ * ???
4011
+ */
4012
+
4013
+/* TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS
4014
+ */
4015
+
4016
+/* TARRGET_LRA_P
4017
+ * Default looks good.
4018
+ */
4019
+
4020
+/* TARGET_REGISTER_PRIORITY(INT) ... A target hook which returns the register
4021 111 dgisselq
+ * priority number to which the register HARD_REGNO belongs to.  The bigger the
4022 102 dgisselq
+ * number
4023
+ *
4024
+ * The default version of this target hook returns always zero---good enough for
4025
+ * the ZipCPU.
4026
+ */
4027
+
4028
+/* TARGET_REGISTER_USAGE_LEVELING_P(VOID) ... A target hook which returns true
4029
+ * if we need register usage leveling.  That means if a few hard registers are
4030
+ * equally good for the assignment, we choose the least used hard register.  The
4031
+ * register usage leveling may be profitable for some targets.  Don't use usage
4032
+ * leveling for targets with conditional execution or targets with big register
4033
+ * files as it hurts if-conversion and cross-jumping optimizations.  The default
4034
+ * version of this target hook returns always false.
4035
+ *
4036
+ * ZipCPU --- Default is the right answer.
4037
+ */
4038
+
4039
+/* TARGET_DIFFERENT_ADDR_DISPLACEMENT_P ...
4040
+ * Default looks good.
4041
+ */
4042
+
4043
+/* TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV_P ...
4044
+ * Default looks good.
4045
+ */
4046
+
4047
+/* TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT ....
4048
+ */
4049
+
4050
+/* TARGET_SPILL_CLASS
4051
+ *
4052
+ * ZipCPU --- If we were running in supervisor mode only, this might be the
4053
+ * user set of registers.  However, we're not building for that mode (now),
4054
+ * so we'll leave this at the default of NO_REGS.
4055
+ */
4056
+
4057
+/* TARGET_CSTORE_MODE(ICODE) ... Defines the machine mode to use for the
4058
+ * boolean result of conditional store patterns.  The OCIDE argument is the
4059
+ * instruction code for the cstore being performed.  Not defining this hook is
4060
+ * the same as accepting the mode encoded into operand 0 of the cstore expander
4061
+ * patterns.
4062
+ *
4063
+ * ??? ZipCPU --- I don't follow this documentation.  We'll leave this at the
4064
+ * default therefore.
4065
+ */
4066
+
4067
+/* 17.09 Stack Layout and Calling Conventions */
4068
+
4069
+
4070
+/* STACK_GROWS_DOWNWARD ... Define this macro if pushing a word onto the stack
4071
+ * moves the stack pointer to a smaller address, and false otherwise.
4072
+ *
4073
+ * ZipCPU ... well, our stack does grow downward, but it doesn't do so auto-
4074
+ * magically.  We have to move the stack pointer ourselves.  However, since this
4075
+ * is our convention, we'll define it as such.
4076
+ */
4077
+#undef STACK_GROWS_DOWNWARD
4078
+#define        STACK_GROWS_DOWNWARD    1
4079
+
4080
+/* STACK_PUSH_CODE ... This macro defines the operation used when something is
4081
+ * pushed on the stack.  In RTL, a push operation will be
4082
+ * (set (mem( STACK_PUSH_CODE(reg sp))) ...) The choiecs are PRE_DEC, POST_DEC,
4083
+ * PRE_INC, and POST_INC.  Which of these is correct depends on the stack
4084
+ * direction and on whether the stack pointer points to the last item on the
4085
+ * stack or whether it points to the space for the next item on the stack.
4086
+ * The default is PRE_DECC when STACK_GROWS_DOWNWARD is true, which is almost
4087
+ * always right, and PRE_INC otherwise, which is often wrong.
4088
+ *
4089
+ * ZipCPU --- None of these is right, so let's leave this at the default and
4090
+ * see how badly we get mangled.  In particular, ZipCPU doesn't have any of the
4091
+ * PRE_DEC, POST_DEC, PRE_INC, or POST_INC addressing modes used here.
4092
+ */
4093
+
4094
+/* FRAME_GROWS_DOWNWARD ... Define this macro to nonzero if the addresses of
4095
+ * local variable slots are at negative offsets from the frame pointer.
4096
+ *
4097
+ * ZipCPU --- If the frame pointer is defined as the stack pointer upon the
4098 103 dgisselq
+ * start of function execution, and that stack pointer grows downward, then
4099 102 dgisselq
+ * this should be the case as well.
4100
+ */
4101
+#undef FRAME_GROWS_DOWNWARD
4102
+#define        FRAME_GROWS_DOWNWARD    1
4103
+// #define     FRAME_GROWS_DOWNWARD    0        // This was ECO32's value
4104
+
4105
+
4106
+/* ARGS_GROW_DOWNWARD ... Define this macro if successive arguments to a
4107
+ * function occupy decreasing addresses on the stack.
4108
+ *
4109
+ * ZipCPU -- we can leave this up to the compiler's preferred implementation,
4110
+ * it is of no consequence to the hardware.
4111
+ */
4112
+
4113
+/* STARTING_FRAME_OFFSET ... Offset from the frame pointer to the first local
4114
+ * variable slot to be allocated.  If FRAME_GROWS_DOWNWARD, find the next slot's
4115
+ * offset by subtracting the firstt slot's length from STARTING_FRAME_OFFSET.
4116
+ * Otherwise it is found by adding the length of the first slot to the value
4117
+ * START_FRAME_OFFSET.
4118
+ *
4119
+ * ZipCPU --- I'm not certain on this, let's come back after we look at how
4120
+ * the code is getting generated.  However, the ECO32 code I am copying from
4121
+ * suggests that 0 is the right value, so we'll use that here.
4122
+ */
4123
+// #warning "Re-evaluate me"
4124
+#define        STARTING_FRAME_OFFSET   0
4125
+
4126
+/* STACK_ALIGNMENT_NEEDED ... Define to zero to disable final alignment of the
4127
+ * stack during reload.  The nonzero default for this macro is suitable for most
4128
+ * ports.
4129
+ *
4130
+ * ZipCPU --- we'll leave this at the default, although if any alignment code
4131
+ * shows up on the stack we may need to adjust it.
4132
+ */
4133
+
4134
+/* STACK_POINTER_OFFSET ... Offset from the SP register to the first location at
4135
+ * which outgoing arguments are placed.  If not specified, the default value
4136
+ * of zero is used.  This is the proper value for most machines.
4137
+ */
4138
+#define        STACK_POINTER_OFFSET    0
4139
+
4140
+/* FIRST_PARM_OFFSET ... Offset from the argument pointer register to the first
4141
+ * argument's address.  On some machines it may depend on the data type of the
4142
+ * function.
4143
+ */
4144
+#define        FIRST_PARM_OFFSET(F)    0
4145
+
4146
+/* STACK_DYNAMIC_OFFSET(F) ... Offset from the stack pointer register to an item
4147
+ * dynamically allocated on the stack, e.g., by alloca.  The default value for
4148
+ * this macro is STACK_POINTER_OFFSET plus the length of the outgoing arguments.
4149
+ * The default is correct for most machines, ...
4150
+ *
4151
+ * ZipCPU --- so we'll use it for the ZipCPU.
4152
+ */
4153
+
4154
+/* INITIAL_FRAME_ADDRESS_RTX ... A C expression whose value is RTL representing
4155
+ * the address of the initial stack frame.  This address is passed to
4156
+ * RETURN_ADDR_RTX and DYNAMIC_CHAIN_ADDRESS.  If you don't define this macro,
4157
+ * a reasonable default value will be used.  Define this macro in order to make
4158
+ * frame pointer elimination work in the presence of __builtin_frame_address(C)
4159
+ * and __builtin_return_address(C) for (C) not equal to zero.
4160
+ *
4161
+ * ZipCPU --- Let's try the reasonable default and see what happens.
4162
+ */
4163
+
4164
+/* SETUP_FRAME_ADDRESSES ... A C expression that produces the machine-specific
4165
+ * code to setup the stack so that arbitrary frames can be accessed.  For
4166
+ * example, on the SPARC, we must flush all of the register windows to the stack
4167
+ * before we can access arbitrary stack frames.  You will seldom need to define
4168
+ * this macro.  The default is to do nothing.
4169
+ *
4170
+ * ZipCPU --- which is what we shall do here.
4171
+ */
4172
+
4173
+/* TARGET_BUILTIN_SETJMP_FRAME_VALUE(VOID) ... This target hook should return
4174
+ * an RTX that is used to store the address of the current frame into the
4175
+ * builtin setjmp buffer.  The default value, virtual_stack_vars_rtx, is correct
4176
+ * for most machines.  One reason you may need to define this target hook is if
4177
+ * hard_frame_pointer_rtx is the appropriate value on your machine.
4178
+ *
4179
+ * ZipCPU --- leave this undefined, since the default value should be correct
4180
+ * for "most" machines.
4181
+ */
4182
+
4183
+/* FRAME_ADDR_RTX ... most machines do not need to define it.
4184
+ */
4185
+
4186
+/* RETURN_ADDR_RTX(COUNT,FRAMEADDR) ... A C expression whose value is RTL
4187
+ * representing the value of the return address for the frame COUNT steps up
4188
+ * from the current frame, after the prologue.  FRAMEADDR is the frame pointer
4189
+ * of the COUNT frame, or the frame pointer of the COUNT-1 frame if
4190
+ * RETURN_ADDR_IN_PREVIOUS_FRAME is nonzero.  The value of the expression must
4191
+ * always be the correct address when COUNT is nonzero, but may be NULL_RTX if
4192
+ * there is no way to determine the return address of other frames.
4193
+ *
4194
+ * ZipCPU --- I have no idea how we'd do this, so let's just return NULL_RTX.
4195
+ */
4196
+#undef RETURN_ADDR_RTX
4197
+#define        RETURN_ADDR_RTX(COUNT,FRAMEADDR)        NULL_RTX
4198
+
4199
+/* RETURN_ADDR_IN_PREVIOUS_FRAME ... Define this macro to nonzero value if the
4200
+ * return address of a particular stack frame is accessed from the frame pointer
4201
+ * of the previous stack frame.  The zero default for this macro is suitable
4202
+ * for most ports.
4203
+ *
4204
+ * ZipCPU---Default works here as well.
4205
+ */
4206
+
4207
+/* INCOMING_RETURN_ADDR_RTX ... A C expression whose value is RTL representing
4208
+ * the location of the incoming return address at the beginning of any function,
4209
+ * before the prologue.  This RTL is either a REG, indicating that the return
4210
+ * value is saved in 'REG', or a MEM representing the location in the stack.
4211
+ * If this RTL is a REG, you should define DWARF_RETURN_COLUMN to
4212
+ * DWARF_FRAME_REGNUM(REGNO).
4213
+ *
4214
+ * ZipCPU --- While our incoming return address could theoretically be in any
4215
+ * register, our machine description file is going to place it into register
4216
+ * R0, so that's what we return here.
4217
+ */
4218
+#undef INCOMING_RETURN_ADDR_RTX
4219
+#define        INCOMING_RETURN_ADDR_RTX        gen_rtx_REG(SImode, zip_R0)
4220
+
4221
+
4222
+/* DWARF_ALT_FRAME_RETURN_COLUMN
4223
+ */
4224
+
4225
+/* DWARF_ZERO_REG ... A C exrpession whose value is an integer giving a DWARF2
4226
+ * register number that is considered to always have the value zero.  This
4227
+ * should only be defined if the target has an architected zero register (ZipCPU
4228
+ * does not), and someone decided it was a good idea to use that register number
4229
+ * to terminate the stack backtrace.  New ports should avoid this (so the
4230
+ * ZipCPU port will avoid it as well).
4231
+ *
4232
+ */
4233
+
4234
+/* TARGET_DWARF_HANDLE_FRAME_UNSPEC
4235
+ */
4236
+
4237
+/* INCOMING_FRAME_SP_OFFSET
4238
+ */
4239
+#define        INCOMING_FRAME_SP_OFFSET        0
4240
+
4241
+/* ARG_POINTER_CFA_OFFSET
4242
+ */
4243
+
4244
+/* FRAME_POINTER_CFA_OFFSET
4245
+ */
4246
+
4247
+/* CFA_FRAME_BASE_OFFSET
4248
+ */
4249
+
4250
+/* 17.09.02 Exception handling support */
4251
+
4252
+/* EH_RETURN_DATA_REGNO(N) ... A C expression whose value is the Nth register
4253
+ * number used for data by exception handlers, or INVALID_REGNUM if fewer than
4254
+ * N registers are usable.  The exception handling library routines communicate
4255
+ * with the exception handlers via a set of agreed upon registers.  Ideally
4256
+ * these registers should be call clobbered; it is possible to use call-saved
4257
+ * registers, but may negatively impact code size.  The target must support at
4258
+ * least 2 data registers, but should define 4 if their are enough free
4259
+ * registers.
4260
+ *
4261
+ * You must define this macro if you want to support call frame exception
4262
+ * handling like that provided by DWARF 2.
4263
+ */
4264
+#define        EH_RETURN_DATA_REGNO(N) (((N<ZIP_FIRST_ARG_REGNO)||(N>ZIP_LAST_ARG_REGNO))?(N-1):INVALID_REGNUM)
4265
+
4266
+/* EH_RETURN_STACKADJ_RTX ... A C expression whose value is RTL representing
4267
+ * a location in which to store a stack adjustment to be applied before function
4268
+ * return.  This is used to unwind the stack to an exception handler's call
4269
+ * frame.  It will be assigned zero on code paths that return normally.
4270
+ *
4271
+ * Do not define this macro if the stack pointer is saved and restored by the
4272
+ * regular prolog and epilog code in the call frame itself (which it is for the
4273
+ * ZipCPU); in this case, the exception handling library routines will update
4274
+ * the stack location to be restored in place.  Otherwise, you must define this
4275
+ * macro if you want to support call frame exception handling like that provided
4276
+ * by DWARF 2.
4277
+ *
4278
+ */
4279
+
4280
+/* EH_RETURN_HANDLER_RTX ... A C expression whose value is RTL representing a
4281
+ * location in which to store the address of an exception handler to which we
4282
+ * should return.  It will not be assigned on code paths that return normally.
4283
+ *
4284
+ * Typcally this is the location in the call frame at which the normal return
4285
+ * address is stored.  For targets that return by popping an address of the
4286
+ * stack, this might be a memory address just below the target callf rame
4287
+ * rather than inside the current call frame.  If defined,
4288
+ * EH_RETURN_STACKADJ_RTX will have already been assigned, so it may be used
4289
+ * to calculate the location of the target call frame.
4290
+ *
4291
+ * If you want to support call frame exception handling, you must define either
4292
+ * this macro or the eh_return instruction pattern.
4293
+ */
4294
+// #warning "I don't know what to do here."
4295
+
4296
+/*
4297
+ *
4298
+ *
4299
+ *
4300
+ *   REST OF SECTION SKIPPED ...
4301
+ *
4302
+ *
4303
+ *
4304
+ */
4305
+
4306
+/* 17.09.03 Specifying how stack checking is done */
4307
+
4308
+/* STACK_CHECK_BUILTIN ... a non-zero value if stack checking is done by the
4309
+ * configuration files in a machine-dependent manner.  You should define this
4310
+ * macro if stack checking is required by the ABI of your machine or if you
4311
+ * would like to do stack checking in some more efficient way than the generic
4312
+ * appraoch.  The default value of this macro is zero.
4313
+ *
4314
+ * ZipCPU --- The default makes sense for us.
4315
+ */
4316
+// #define STACK_CHECK_BUILTIN 0
4317
+
4318
+/* STACK_CHECK_STATIC_BUILTIN ... A nonzero value if static stack checking is
4319
+ * done by the configuration files in a machine-dependent manner.  You should
4320
+ * define this macro if you would like to do static stack checking in some more
4321
+ * efficient way than the generic approach.  The default value of this macro
4322
+ * is zero.
4323
+ *
4324
+ * ZipCPU --- The default makes sense for us.
4325
+ */
4326
+
4327
+/* STACK_CHECK_PROBE_INTERVAL_EXP ...  An integer specifying the interval at
4328
+ * which GCC must generate stack probe instructions, defined as 2 raised to this
4329
+ * interval.  You will normally define this macro so that the interval is no
4330
+ * larger than the size of the "guard pages" at the end of a stack area.  The
4331
+ * default value of 12 (4096-byte interval) is suitable for most systems.
4332
+ *
4333
+ * ZipCPU --- Default.
4334
+ */
4335
+
4336
+/* STACK_CHECK_MOVING_SP ... An integer which is non-zero if GCC should move
4337
+ * the stack pointer page by page when doing probes.  This can be necessary
4338
+ * on systems where the stack pointer contains the bottom address of the memory
4339
+ * area accessible to the executing thread at any point in time.  In this
4340
+ * situation, an alternate signal stack is required in order to be able to
4341
+ * recover from a stack overflow.  The default value of this macro is zero.
4342
+ *
4343
+ * ZipCPU -- Default.
4344
+ */
4345
+
4346
+/* STACK_CHECK_PROTECT
4347
+ */
4348
+/* STACK_CHECK_MAX_FRAME_SIZE
4349
+ * ... you should normally not change the default value of this macro.
4350
+ */
4351
+/* STACK_CHECK_FIXED_FRAME_SIZE
4352
+ * ... you ... will normally use the default of four words.
4353
+ */
4354
+
4355
+/* STACK_CHECK_MAX_VAR_SIZE
4356
+ * ... you will normally not need to override that default.
4357
+ */
4358
+
4359
+/* 17.09.04 Registers that Address the Stack Frame*/
4360
+
4361
+/* STACK_POINTER_REGNUM ... The register number of the stack pointer register,
4362
+ * which must also be a fixed register according to FIXED_REGISTERS.  On most
4363
+ * machines, the hardware determines which register this is.
4364
+ */
4365
+#undef STACK_POINTER_REGNUM
4366
+#define        STACK_POINTER_REGNUM    zip_SP
4367
+
4368
+/* FRAME_POINTER_REGNUM ... The register number of the frame pointer register,
4369
+ * which is used to access certain automatic variables in the stack frame.  On
4370
+ * some machines, the hardware determines which register this is.  On other
4371
+ * machines you can choose any register you wish for this purpose.
4372
+ *
4373
+ * ZipCPU --- While I'd like to dump this pointer, since I don't really see
4374
+ * a need for it, alloca() requires it.  Therefore let's assine a register to
4375
+ * this purpose and watch what the compiler does with it.
4376
+ */
4377 103 dgisselq
+#ifdef zip_FP_PSEUDO
4378
+#define        FRAME_POINTER_REGNUM    zip_FP_PSEUDO
4379
+#else
4380 102 dgisselq
+#define        FRAME_POINTER_REGNUM    zip_FP
4381 103 dgisselq
+#endif
4382 102 dgisselq
+
4383
+/* HARD_FRAME_POINTER_REGNUM ... On some machines the offset between the frame
4384
+ * pointer and starting offset of the automatic variables is not known until
4385
+ * after register allocation has been done (for example, because the saved
4386
+ * registers are between these two locations).  On those machines, define
4387
+ * FRAME_POINTER_REGNUM the number of a special, fixed register to be used
4388
+ * internally until the offset is known, and define HARD_FRAME_POINTER_REGNUM
4389
+ * to be the actual hard register number used for the frame pointer.
4390
+ *
4391
+ * Do not define this macro if it would be the same as FRAME_POINTER_REGNUM
4392
+ *
4393
+ * ZipCPU --- we do not define this macro.
4394
+ */
4395 103 dgisselq
+#if (zip_FP == FRAME_POINTER_REGNUM)
4396
+#define HARD_FRAME_POINTER_REGNUM      zip_FP
4397
+#endif
4398 102 dgisselq
+
4399
+/* ARG_POINTER_REGNUM ... The register number of the arg pointer register, which
4400
+ * is used to access the function's argument list.  On some machines, this is
4401
+ * the same as the frame pointer register.  On some machines, the hardware
4402
+ * determines which register this is.  On other machines, you can choose any
4403
+ * register you wish for this purpose.  If this is not the same register as the
4404
+ * frame pointer register, then you must mark it as a fixed register according
4405
+ * to FIXED_REGISTERs, or arrange to be able to eliminate it.
4406
+ *
4407
+ * ZipCPU --- We really don't want to lose another register to something
4408
+ * pointless, so let's set this to be the frame pointer register.  Especially
4409
+ * given the ZipCPU's ease of accessing things via offsets of registers, this
4410
+ * should work for a rather large stack frame.
4411
+ */
4412 103 dgisselq
+#define ARG_POINTER_REGNUM     FRAME_POINTER_REGNUM
4413 102 dgisselq
+
4414
+/* HARD_FRAME_POINTER_IS_FRAME_POINTER ... define this to be a preprocessor
4415
+ * constant that is nonzero if hard_frame_pointer_rtx and frame_pointer_rtx
4416
+ * should be the same.  The default definition is sufficient for us.
4417
+ */
4418
+
4419
+/* HARD_FRAME_POINTER_IS_ARG_POINTER ...
4420
+ * ZipCPU doesn't need this macro
4421
+ */
4422
+
4423
+/* RETURN_ADDRESS_POINTER_REGNUM ... The register number of the return address
4424
+ * pointer register, which is used to access the current function's return
4425
+ * address from the stack.  On some machines, the return address is not at a
4426
+ * fixed offset from the frame pointer or stack pointer or argument pointer.
4427
+ * This register can be defined to point to the return address on the stack, and
4428
+ * then to be converted by ELIMINABLE_REGS into either the frame pointer or the
4429
+ * stack pointer.
4430
+ *
4431
+ * Do not define this macro unless there is no other way to get the return
4432
+ * address from the stack.
4433
+ *
4434
+ * ZipCPU---we need this.
4435
+ */
4436
+#define        RETURN_ADDRESS_REGNUM   zip_R0
4437
+
4438
+
4439
+/* STATIC_CHAIN_REGNUM ... Register numbers used for passing a function's
4440
+ * static chain pointer.  If register windows are used, the register number as
4441
+ * seen by the called function is STATIC_CHAIN_INCOMING_REGNUM, while the
4442
+ * register number as seen by the calling function is STATIC_CHAIN_REGNUM.  If
4443
+ * these register are the same, STATIC_CHAIN_INCOMING_REGNUM need not be
4444
+ * defined.
4445
+ *
4446
+ * ZipCPU doesn't have register windows, so we don't need to define this.
4447
+ */
4448
+// #warning "I have no reason to believe this will even work"
4449
+#define        STATIC_CHAIN_REGNUM     zip_GOT
4450
+
4451
+/* TARGET_STATIC_CHAIN ... This hook replaces the use of STATIC_CHAIN_REGNUM et
4452
+ * al for targets that may use different static chain locations for different
4453
+ * nested functions.  This may be required if the target has function attributes
4454
+ * that affect the calling conventions of the function and those calling
4455
+ * conventions use different static chain locations.
4456
+ *
4457
+ * ZipCPU --- don't need this.
4458
+ */
4459
+// #define     STATIC_CHAIN_REGNUM     zip_R11
4460
+
4461
+
4462
+/* DWARF_FRAME_REGISTERS ... This macro specifies  the maximum number of hard
4463
+ * registers that can be saved in a call frame.  This is used to size data
4464
+ * structures used in DWARF2 exception handling.
4465
+ *
4466
+ * Prior to GCC 3.0, this macro was needed in order to establish a stable
4467
+ * exception handling ABI in the face of adding new hard registers for ISA
4468
+ * extensions.  In GCC 3.0 and later, the EH ABI is insulated from changes in
4469
+ * the number of hard registers.  Nevertheless, this macro can still be used to
4470
+ * reduce the runtime memory requirements of the exception handling routines,
4471
+ * which can be substantial if the ISA contains a lot of registers that are not
4472
+ * call-saved.
4473
+ *
4474
+ * If this macro is not defined, it defaults to FIRST_PSEUDO_REGISTER.
4475
+ *
4476
+ * ZipCPU --- The default is not sufficient.  The CC and PC registers need to
4477
+ * be saved and examined as well in any debug/exception context.  Hence, we
4478
+ * define this to be all of our registers.
4479
+ */
4480
+#undef DWARF_FRAME_REGISTERS
4481
+#define        DWARF_FRAME_REGISTERS   16
4482
+
4483
+/* PRE_GCC3_DWARF_FRAME_REGISTERS ... This macro is similar to DWARF_FRAME_REG..
4484
+ * but is provided for backward compatibility in pre GCC 3.0 compiled code.
4485
+ *
4486
+ * If not defined, it defaults to DWARF_FRAME_REGISTERS---which is perfect for
4487
+ * the ZipCPU.
4488
+ */
4489
+
4490
+/* DWARF_REG_TO_UNWIND_COLUMN(REGNO) ... Define this macro if the target's
4491
+ * representation for dwarf registers is different than the internal
4492
+ * representation for unwind column.  Given a dwarf register, this macro should
4493
+ * return the unwind column number to use instead.
4494
+ *
4495
+ * ... ???
4496
+ */
4497
+
4498
+/* DWARF_FRAME_REGNUM(REGNO) ... Define this macro is the target's
4499
+ * representation for dwarf registers used in .eh_frame or .debug_frame is
4500
+ * different from that used in other debug info sections.  Given a GCC hard
4501
+ * register number, this macro should return the .eh_frame register number.
4502
+ * The default is DBX_REGISTER_NUMBER(REGNO).
4503
+ *
4504
+ * ZipCPU --- provided we define DBX_REGISTER_NUMBER(REGNO) well, this default
4505
+ * should still work for us.
4506
+ */
4507
+
4508
+/* DWARF2_FRAME_REG_OUT(REGNO, FOR_EH) ... Define this macro to map register
4509
+ * numbers held in the call frame info that GCC has collected using
4510
+ * DWARF_FRAME_REGNO to those that should be output in .debug_frame (for_eh is
4511
+ * zero) and .eh_frame (for_eh is non-zero). The default is to return REGNO.
4512
+ *
4513
+ * ZipCPU --- Default is good enough.
4514
+ */
4515
+
4516
+/* REG_VALUE_IN_UNWIND_CONTEXT ... Define this macro if the target stores
4517
+ * register values as _Unwind_Word type in unwind context.  It should be defined
4518
+ * if target register size is larger than the size of void *.  The default
4519
+ * is to store register values as void *type.
4520
+ *
4521
+ * ZipCPU --- Default is what we need.
4522
+ */
4523
+
4524
+/* ASSUME_EXTENDED_UNWIND_CONTEXT ... Define this macro to be 1 if the target
4525
+ * always uses extended unwind context with version, args_size, and by_value
4526
+ * fields.  If it is undefined, it will always be defined to 1 when REG_VALUE_IN_UNWIND_CONTEXT is defined and 0 otherwise.
4527
+ *
4528
+ */
4529
+
4530
+
4531
+/* 17.09.05 Eliminating Frame Pointer and Arg Pointer */
4532
+
4533
+/* TARGET_FRAME_POINTER_REQUIRED(VOID) ... This target hook should return true
4534
+ * if a function must have and use a frame pointer.  This target hook is
4535
+ * called in the reload pass.  If its return value is true, the function will
4536
+ * have a frame pointer.
4537
+ *
4538
+ * This target hook can in principle examine the current function and decide
4539
+ * according to the facts, but on most machines the constant false or the
4540
+ * constant true suffices.  Use false when the machine allows code to be
4541
+ * generated with no frame pointer, and doing so saves some time or space.
4542
+ * Use true when there is no possible advantage to avoiding a frame pointer.
4543
+ *
4544
+ * ZipCPU---if we add in a frame pointer, we become register starved.  Hence,
4545
+ * we'll treat this as a constant false--which is also the default value.
4546
+ */
4547
+#define        target_frame_pointer_required   zip_frame_pointer_required
4548
+
4549
+/* INITIAL_FRAME_POINTER_OFFSET ... A C statement to store in the variable
4550
+ * depth-var the difference between the frame pointer and the stack pointer
4551
+ * values immediately after the function prologue.  The value would be computed
4552
+ * from information such as the result of get_frame_size() and the tables of
4553
+ * registers regs_ever_live and call_used_regs.
4554
+ *
4555
+ * If ELIMINABLE_REGS is defined, this macro will not be used and need not be
4556
+ * defined.  Otherwise, it must be defined even if TARGET_FRAME_POINTER_REQD
4557
+ * always returns true; in that case you may set depth-var to anything.
4558
+ *
4559
+ * ZipCPU --- we intend to set ELIMINABLE_REGS, so this is not necessary.
4560
+ */
4561
+// #define     INITIAL_FRAME_POINTER_OFFSET(DEPTH)     (DEPTH) = 0
4562
+
4563
+
4564
+/* ELIMINABLE_REGS ... If defined, this macro specifies a table of register
4565
+ * pairs used to eliminate unneeded registers that point into the stack frame.
4566
+ * If it is not defined, the only elimination attempted by the compiler is to
4567
+ * replace references to the frame pointer with references to the stack pointer.
4568
+ *
4569
+ * On some machines, the position of the argument pointer is not known until
4570
+ * the compilation is completed.  In such a case, a separate hard register
4571
+ * must be used for the argument pointer.  This register can be eliminated by
4572
+ * replacing it with either the frame pointer or the argument pointer,
4573
+ * depending on whether or not the frame pointer has been eliminated.
4574
+ *
4575
+ * ZipCPU we'll take their suggestion and define this as:
4576
+ */
4577
+#undef ELIMINABLE_REGS
4578 103 dgisselq
+#ifdef zip_FP_PSEUDO
4579 102 dgisselq
+#define        ELIMINABLE_REGS \
4580 103 dgisselq
+        {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM},          \
4581
+         { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM},     \
4582
+         { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM},        \
4583
+         { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
4584
+#else
4585
+# if (ARG_POINTER_REGNUM == FRAME_POINTER_REGNUM)
4586
+#  define      ELIMINABLE_REGS \
4587
+        {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
4588
+# else
4589
+#  define      ELIMINABLE_REGS \
4590 102 dgisselq
+       {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM },  \
4591
+        { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM },  \
4592
+        { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
4593 103 dgisselq
+# endif
4594
+#endif
4595 102 dgisselq
+
4596
+/* bool TARGET_CAN_ELIMINATE(FROM,TO) ... This target function should return
4597
+ * true if the compiler is allowed to try to replace register number FROM with
4598
+ * register number TO.  This target hook need only be defined if ELIMINABLE_REGS
4599
+ * is defined, and will usually return true since most of the cases preventing
4600
+ * register elimination are things that the compiler  already knows about.
4601
+ *
4602
+ * ZipCPU ... does the compiler  know about my decision as to whether or not
4603 117 dgisselq
+ * the frame pointer was needed?  Yes it does, but it's kept separately.  We'll
4604
+ * just say everything can be eliminated.
4605 102 dgisselq
+ */
4606
+#define TARGET_CAN_ELIMINATE   zip_can_eliminate
4607
+
4608
+/* INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) ... This macro is similar to
4609
+ * INITIAL_FRAME_POINTER_OFFSET.  It specifies the initial difference between
4610
+ * the specified pair of registers.  This macro must be defined if
4611
+ * ELIMINABLE_REGS is defined.
4612
+ *
4613 117 dgisselq
+ * ZipCPU---We had at one time set this to a default offset of 0.  This didn't
4614
+ * work.  It turns out that this is not only the *initial* elimination offset,
4615
+ * but also the offset along the way.  Hence, when a variable needs to be
4616
+ * spilled to the stack, this offset must change.  Reload goes and checks for
4617
+ * this, and adjusts registers if the offset has changed.  Hence, without this,
4618
+ * we get negative (i.e. illegal) stack offsets.
4619 102 dgisselq
+ */
4620
+#define        INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)            \
4621
+       do { (OFFSET) = zip_initial_elimination_offset((FROM), (TO)); } \
4622
+       while(0)                                        \
4623
+
4624
+/* 17.09.06 Passing function arguments on the stack */
4625
+
4626
+/* TARGET_PROMOTE_PROTOTYPES ... Returns true if an argument declared in a
4627
+ * prototype as an integral type smaller than int should actually be
4628
+ * passed as an int.  In addition to avoiding errors in certain cases of
4629
+ * mismatch, it also makes for better code on certain machines.  The default is
4630
+ * to not promote prototypes.
4631
+ *
4632
+ * Since everything is an int on the ZipCPU, let's promote anything smaller
4633
+ * (which should still be an int) up to an int anyway.
4634
+ */
4635
+#undef TARGET_PROMOTE_PROTOTYPES
4636
+#define        TARGET_PROMOTE_PROTOTYPES       hook_bool_const_tree_true
4637
+
4638
+/* PUSH_ARGS ... A C expression.  If nonzero, push instructions will be used to
4639
+ * pass outgoing arguments.  If the target machine does not have a push
4640
+ * instruction, set it to zero.  That directs GCC to use an alternate strategy:
4641
+ * to allocate the entire argument block and then store the arguments into it.
4642
+ * When PUSH_ARGS is nonzero, PUSH_ROUNDING must be defined too.
4643
+ *
4644
+ * ZipCPU does not have a push instruction, so we set this to zero.
4645
+ */
4646
+#undef PUSH_ARGS
4647
+#define        PUSH_ARGS       0
4648
+
4649
+/* PUSH_ARGS_REVERSED ... A C expression.  If nonzero, function arguments will
4650
+ * be evaluated last to first, rather than first to last.  If this macro is
4651
+ * not defined, it defaults to PUSH_ARGS on targets where the stack and args
4652
+ * grow in opposite directions, and zero otherwise.
4653
+ *
4654
+ * ZipCPU---Let's evaluate our arguments first to last.
4655
+ */
4656
+#define        PUSH_ARGS_REVERSED      1
4657
+
4658
+/* PUSH_ROUNDING(NPUSHED) ... A C expression that is the number of bytes
4659
+ * actually pushed onto the stack when an instruction attempts to push
4660
+ * (NPUSHED) bytes.
4661
+ *
4662
+ * ZipCPU---We cannot push bytes.  Let's leave this undefined and see what
4663
+ * happens.
4664
+ */
4665
+// #warning "No appropriate definition seemed right."
4666
+
4667
+/* ACCUMULATE_OUTGOING_ARGS ... A C expression.  If non-zero, the maximum amount
4668
+ * of space required for outgoing arguments will be computed and placed into
4669
+ * 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
4670
+ * amount.
4671
+ *
4672
+ * ZipCPU---This is *cool* and so necessary---it saves an extra two instructions
4673
+ * each time we try to call a function/routine.  Yes, we want and *need* this
4674
+ * for good performance.  I mean, think of it, free performance increase?  Who
4675
+ * could argue with that?
4676
+ */
4677
+#undef ACCUMULATE_OUTGOING_ARGS
4678
+#define        ACCUMULATE_OUTGOING_ARGS        1
4679
+
4680
+
4681
+/* REG_PARM_STACK_SPACCE(FN) ... Define this macro if functions should assume
4682
+ * that stack space has been allocated for arguments even when their values
4683
+ * are passed in registers.  The value of this macro is the size, in bytes, of
4684
+ * the area reserved for arguments passed in registers for the function
4685
+ * represented by FN, which can be zero if GCC is calling a library function.
4686
+ * The argument FN can be the FUNCTION_DECL, or the type itself of the function.
4687
+ *
4688
+ * This space can be allocated by the caller, or be part of the machine
4689
+ * dependent stack frame: OUTGOING_REG_PARM_STACK_SPACE says which.
4690
+ *
4691
+ * ZipCPU --- Why allocate space you won't use?  Let's leave this undefined
4692
+ * therefore.
4693
+ */
4694
+// #undef      REG_PARM_STACK_SPACE
4695
+
4696
+
4697
+
4698
+/* INCOMING_REG_PARM_STACK_SPACE(FN) ... Like REG_PARM_STACK_SPACE, but for
4699
+ * incoming register arguments.  Define this macro if space guaranteed when
4700
+ * compiling a function body is different to space required when making a call,
4701
+ * a situation that can arise with K&R style function definitions.
4702
+ *
4703
+ */
4704
+
4705
+/* OUTGOING_REG_PARM_STACK_SPACE(FN) ... Define this to a nonzero value if it
4706
+ * is the responsibility of the caller to allocate the area reserved for
4707
+ * arguments passed in registers when calling a function of FN.  FN may be NULL
4708
+ * if the function called is a library function.
4709
+ *
4710
+ * ZipCPU---Why allocate space you don't need?
4711
+ */
4712
+#define        OUTGOING_REG_PARM_STACK_SPACE(FNTYPE)   0
4713
+
4714
+
4715
+/* STACK_PARMS_IN_REG_PARM_AREA ... Define this macro if REG_PARM_STACK_SPACE
4716
+ * is defined, buyt the stack parameters don't skip the area specified by it.
4717
+ *
4718
+ * ZipCPU---We didn't define REG_PARM_STACK_SPACE, so we won't define this.
4719
+ */
4720
+
4721
+/* TARGET_RETURN_POPS_ARGS(DECL,FNTYPE,SZ) ... This target hook returns the
4722
+ * number of bytes of its own arguments that a function pops on returning, or 0
4723
+ * if the function pops no arguments and the caller must therefore pop them all
4724
+ * after the function returns.
4725
+ *
4726
+ * ZipCPU --- If we define this, we'll lose our gain from
4727
+ * ACCUMULATE_OUTOING_ARGS.  Thus, we leave this undefined.
4728
+ */
4729
+
4730
+/* CALL_POPS_ARGS(CUM) ... A C expression that should indicate the number of
4731
+ * bytes a call sequence pops off of the stack.  It is added to the value of
4732
+ * RETURN_POPS_ARGS when compiling a function call.  CUM is the variable in
4733
+ * which all arguments to the function have been accumulated.
4734
+ *
4735
+ * ZipCPU---The call sequence, by itself, doesn't touch the stack.  Therefore
4736
+ * this is zero.
4737
+ */
4738
+#undef CALL_POPS_ARGS
4739
+#define        CALL_POPS_ARGS(CUM)     0
4740
+
4741
+
4742
+/* 17.09.07 Passing arguments in registers */
4743
+
4744
+/* TARGET_FUNCTION_ARG ... Return an RTX indicating whether a function argument
4745
+ * is passed in a register, and if so, which register.
4746
+ */
4747
+/*
4748
+ * This has been poisoned ... so let's not define it anymore and look for
4749
+ * a better way to do this ...
4750
+ *
4751
+ * #define     FUNCTION_ARG(CUM, MODE, TYPE, NAMED) (((NAMED) == 0) ? NULL_RTX
4752
+ *     : targetm.calls.must_pass_in_stack(MODE, TYPE)  ? NULL_RTX
4753
+ *     : (CUM) > ZIP_LAST_ARG_REGNO                    ? NULL_RTX
4754
+ *     : gen_rtx_REG(MODE, CUM))
4755
+ */
4756
+#define        TARGET_FUNCTION_ARG     zip_function_arg
4757
+
4758
+
4759
+/* TARGET_MUST_PASS_IN_STACK ...
4760
+ */
4761
+// #undef      TARGET_MUST_PASS_IN_STACK
4762
+// #define     TARGET_MUST_PASS_IN_STACK       zip_must_pass_in_stack
4763
+
4764
+/* TARGET_FUNCTION_INCOMING_ARG ... Define this hook if the target machine
4765
+ * has register windows, ... which ZipCPU does not have.
4766
+ */
4767
+
4768
+/* TARGET_USE_PSEUDO_PIC_REG(void) ... This hook should return 1 in case
4769
+ * pseudo register should be created for pic_offset_table_rtx during function
4770
+ * expand.
4771
+ *
4772
+ * This should be defined by global parameters, isn't it?
4773
+ */
4774
+
4775
+/* TARGET_INIT_PIC_REG(v) ... Perform a target dependent initialization of
4776
+ * pic_offset_table_rtx.  This hook is called at the start of register
4777
+ * allocation.
4778
+ *
4779
+ * ZipCPU---Let's revisit this.
4780
+ */
4781
+// #warning "Come back and relook at relocations"
4782
+
4783
+/* TARGET_ARG_PARTIAL_BYTES ... This target hook returns the number of bytes
4784
+ * at the beginning of an argument that must be put in registers.  The value
4785
+ * must be zero for arguments that are passed entirely in registers or that
4786
+ * are entirely pushed on the stack.
4787
+ */
4788
+// #undef      TARGET_ARG_PARTIAL_BYTES
4789
+// #define     TARGET_ARG_PARTIAL_BYTES        zip_arg_partial_bytes
4790
+
4791
+/* TARGET_PASS_BY_REFERENCE(CUM,MOD,TREE,NAMED) ... This target hook should
4792
+ * return true if an argument at the position indicated by CUM should be passed
4793
+ * by reference.  This predicate is queried after target independent reasons
4794
+ * for being pssed by reference, such as TREE_ADDRESSABLE(TREE).
4795
+ *
4796
+ */
4797
+// #undef      TARGET_PASS_BY_REFERENCE
4798
+// #define     TARGET_PASS_BY_REFERENCE        zip_pass_by_reference
4799
+
4800
+/* CUMULATIVE ARGS ...  A C type for declaring a variable that is used as the
4801
+ * first argument of 'FUNCTION_ARG' and other related values.
4802
+ *
4803
+ * ZipCPU---We're in trouble if an 'int' won't work, so let's just use that.
4804
+ */
4805
+#define        CUMULATIVE_ARGS int
4806
+
4807
+/*
4808
+ * OVERRIDE_ABI_FORMAT
4809
+ */
4810
+
4811
+/* INIT_CUMULATIVE_ARGS ... A C statement (sans semicolon) for initializing the
4812
+ * variable CUM for the state at the beginning of the argument list.
4813
+ *
4814
+ *
4815
+ * ZipCPU---The first argument is passed in register ZIP_FIRST_ARG_REGNO, or
4816
+ * R1 (unless it has been redefined above ...)
4817
+ */
4818
+#define        INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) (CUM = 0)
4819
+
4820
+/* INIT_CUMULATIVE_LIBCALL_ARGS
4821
+ * INIT_CUMULATIVE_INCOMING_ARGS
4822
+ *
4823
+ * These default to the last INIT_CUM_ARGS value above.
4824
+ */
4825
+
4826
+/* TARGET_FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) .. This hook updates
4827
+ * the summarizer variable pointed to by CUM to advance past an argument in
4828
+ * the argument list.  The values MODE, TYPE, and NAMED describe that
4829
+ * argument.  Once this is done, the variable CUM is suitable for analyzing the
4830
+ * following argument with TARGET_FUNCTION_ARG, etc.  This hook need not do
4831
+ * anything if the argument in question was passed on the stack.  The compiler
4832
+ * knows how to track the amount of stack space used for arguments without
4833
+ * any special help.
4834
+ *
4835
+ * ZipCPU---Here we simply copy from ECO32.
4836
+ */
4837
+#define        TARGET_FUNCTION_ARG_ADVANCE     zip_function_arg_advance
4838
+
4839
+/*
4840
+ * TARGET_ARG_OFFSET --- not necessary
4841
+ * FUNCTION_ARG_PADDING        --- not necessary, since we shouldn't be padding
4842
+ * PAD_VARARGS_DOWN    --- not necessary, since we shouldn't be padding
4843
+ * BLOCK_REG_PADDING
4844
+ * TARGET_FUNCTION_ARG_BOUNDARY
4845
+ * TARGET_FUNCTION_ARG_ROUND_BOUNDARY
4846
+ */
4847
+
4848
+/* FUNCTION_ARG_REGNO_P(REGNO) ... A C expression that is nonzero if REGNO is
4849
+ * the number of a hard register in which function arguments are sometimes
4850
+ * passed.  This does not include implicit arguments such as the static chain
4851
+ * and the structure-value address.  On many machines, no registers can be used
4852
+ * for this purpose since all function arguments are pushed on the stack.
4853
+ */
4854
+#define        FUNCTION_ARG_REGNO_P(r) ((r >= ZIP_FIRST_ARG_REGNO)&&(r<=ZIP_LAST_ARG_REGNO))
4855
+
4856
+/* TARGET_SPLIT_COMPLEX_ARG(TYPE) ... This hook should return true if parameter
4857
+ * of type TYPE are passed as two scalar parameters.  By default, GCC will
4858
+ * attempt to pack complex arguments into the target's word size.  Some ABI's
4859
+ * require complex arguments to be split and treated as their individual
4860
+ * components.
4861
+ *
4862
+ * The default value of this hook is NULL, which is treated as always false,
4863
+ * and which should be good enough for ZipCPU--which can go either way.
4864
+ */
4865
+
4866
+/* TARGET_BUILD_BUILTIN_VA_LIST ... This hook returns a type node for va_list
4867
+ * for the target.  The default version of the hook returns void*.
4868
+ *
4869
+ */
4870
+
4871
+/* TARGET_ENUM_VA_LIST_P
4872
+ */
4873
+
4874
+/* TARGET_FN_ABI_VA_LIST ... This hook returns the va_list type of the calling
4875
+ * convention specified by FN.  The default version of this returns va_list_type_node.
4876
+ */
4877
+
4878
+/* TARGET_FN_ABI_VA_LIST
4879
+ */
4880
+
4881
+/* TARGET_CANONICAL_VA_LIST_TYPE
4882
+ */
4883
+
4884
+/* TARGET_GIMPLIFY_VA_ARG_EXPR
4885
+ */
4886
+
4887
+/* TARGET_VALID_POINTER_MODE(MODE) ... Define this to return nonzero if the
4888
+ * port can handle pointers with machine mode MODE.  The default version of this
4889
+ * hook returns true for both ptr_mode and Pmode.
4890
+ *
4891
+ * ZipCPU---if Pmode is properly defined (above, and I think it is), then the
4892
+ * default behavior is quite appropriate.
4893
+ */
4894
+
4895
+/* TARGET_REF_MAY_ALIAS_ERRNO(REFP) ... Define this to return nonzero if the
4896
+ * memory reference REF may alias with the system C library errno location.
4897
+ * The default version of this hook assumes the system C library errno location
4898
+ * is either a declaration of type int or accessed by dereferencing a pointer
4899
+ * to int.
4900
+ *
4901
+ * ZipCPU --- Default sounds good to me.
4902
+ */
4903
+
4904
+
4905
+/* TARGET_SCALAR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if
4906
+ * the port is prepared to handl instructions involving scalar mode MODE.  For
4907
+ * a scalar mode to be considered supported, all the basic arithmetic and
4908
+ * comparisons must work.
4909
+ *
4910
+ * The default version of this hook returns true for any mode required to
4911
+ * handle the basic C types (as defined by the port).  Included here are the
4912
+ * double-word arithmetic supported by the code in optabs.c.
4913
+ */
4914
+#undef TARGET_SCALAR_MODE_SUPPORTED_P
4915
+#define        TARGET_SCALAR_MODE_SUPPORTED_P  zip_scalar_mode_supported_p
4916
+
4917
+/* TARGET_VECTOR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if the
4918
+ * port is prepared to handle instructions involving vector mode MODE.  At the
4919
+ * very least, it must have move patterns for this mode.
4920
+ *
4921
+ * ZipCPU---does not support any vector modes.
4922
+ */
4923
+#undef TARGET_VECTOR_MODE_SUPPORTED_P
4924
+#define        TARGET_VECTOR_MODE_SUPPORTED_P  hook_bool_mode_false
4925
+
4926
+/* TARGET_ARRAY_MODE_SUPPORTED_P(MODE, NELEMS) ... Return true if GCC should
4927
+ * try to use a scalar mode to store an array of NELEMS elements, given that
4928
+ * each element has mode MODE.  Returning true here overrides the usual MAX_FIXED_MODE limit and allows GCC to use any defined integer mode.
4929
+ *
4930
+ * ZipCPU---Sounds good.
4931
+ */
4932
+// #undef      TARGET_ARRAY_MODE_SUPPORTED_P
4933
+// #define     TARGET_ARRAY_MODE_SUPPORTED_P   zip_array_mode_supported_p
4934
+
4935
+/* TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P(MODE) ... Define this to return
4936
+ * nonzero if libgcc provides support for the floating-point mode MODE, which is
4937
+ * known to pass TARGET_SCALAR_MODE_SUPPORTED_P.  The default version of this
4938
+ * hook returns true for all of SFmode, DFmode, XFmode, and TFmode, if such
4939
+ * modes exist.
4940
+ *
4941
+ * ZipCPU---We only support SFmode and DFmode, but for now only in emulation
4942
+ * (if we can).  Let's allow both of those and see how far we get.
4943
+ */
4944
+#undef TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P
4945
+#define        TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P zip_libgcc_floating_mode_supported_p
4946
+
4947
+/* TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P(MODE) ... Define this to return
4948
+ * nonzero for machine modes for which the port has small register classes.  If
4949
+ * target hook returns nonzero for a given MODE, the compiler will try to
4950
+ * minimize the lifetime of registers in MODE.  The hook may be called with
4951
+ * VOIDmode as an argument.  In this case, the hook is expected to return
4952
+ * nonzero if it returns nonzero for any mode.
4953
+ *
4954
+ * The default version of this hook returns false for any mode.
4955
+ *
4956
+ * ZipCPU---Default sounds good.
4957
+ */
4958
+
4959
+/* 17.09.08 How scalar function values are returned */
4960
+
4961
+/* TARGET_FUNCTION_VALUE
4962
+ */
4963
+
4964
+/* LIBCALL_VALUE
4965
+ */
4966
+
4967
+
4968
+/* 17.09.09 How large values are returned */
4969
+
4970
+/* TARGET_RETURN_IN_MEMORY(TYP,FNTYP) ... This target hook should return a
4971
+ * nonzero value to say to return the function value in memory, just as large
4972
+ * structures are always returned.  Here type will be the data type of the value
4973
+ * and FNTYP will be the type of the function doing the returning, or NULL
4974
+ * for libcalls.
4975
+ *
4976
+ */
4977
+#undef TARGET_RETURN_IN_MEMORY
4978
+#define        TARGET_RETURN_IN_MEMORY zip_return_in_memory
4979
+
4980
+/* DEFAULT_PCC_STRUCT_RETURN
4981
+ * TARGET_STRUCT_VALUE_RTX
4982
+ * PCC_STATIC_STRUCT_RETURN
4983
+ * TARGET_GET_RAW_RESULT_MODE
4984
+ * TARGET_GET_RAW_ARG_MODE
4985
+ */
4986
+
4987
+
4988
+/* 17.09.10 Caller-Saves Register Allocation */
4989
+/* 17.09.11 Function Entry and Exit */
4990 111 dgisselq
+// TARGET_ASM_FUNCTION_PROLOGUE
4991
+// TARGET_ASM_FUNCTION_END_PROLOGUE
4992
+// TARGET_ASM_FUNCCTION_BEGIN_EPILOGUE
4993
+// TARGET_ASM_FUNCTION_EPILOGUE
4994
+/* EXIT_IGNORE_STACK ... Define this macro as a C expression that is nonzero
4995
+ * if the return instruction or the function epilogue ignores the value of the
4996
+ * stack pointer; in other words, if it is safe to delete an instruction to
4997
+ * adjust the stack pointer before a return from the function.
4998
+ *
4999
+ * The default is 0.
5000
+ *
5001
+ * Note that this macro's value is relevant only for functions for which frame
5002
+ * pointers are maintained.  It is never safe to delete a final stack adjustment
5003
+ * in a function that has no frame pointer, and the compiler knows this
5004
+ * regardless of EXIT_IGNORE_STACK.
5005
+ *
5006
+ * ZipCPU -- Thanks to the example of the m68k, and a careful selection of what
5007
+ * our options otherwise could have been, our epilogue code does not use the
5008
+ * stack register at all, but rather starts by moving the frame register into
5009
+ * the stack register.
5010
+ */
5011
+#define EXIT_IGNORE_STACK      1
5012
+// EPILOGUE_USES(regno)
5013
+// EH_USES(regno)
5014
+// TARGET_ASM_OUTPUT_MI_THUNK
5015
+// TARGET_ASM_CAN_OUTPUT_MI_THUNK
5016
+
5017 102 dgisselq
+/* 17.09.12 Generating code for profiling */
5018 111 dgisselq
+// FUNCTION_PROFILER
5019
+// PROFILE_HOOK
5020
+// NO_PROFILE_COUNTERS
5021
+// PROFILE_BEFORE_PROLOGUE
5022
+// TARGET_KEEP_LEAF_WHEN_PROFILED
5023
+
5024 102 dgisselq
+/* 17.09.13 Permitting tail calls*/
5025 111 dgisselq
+
5026
+/* TARGET_FUNCTION_OK_FOR_SIBCALL(DECL,EXP) ... True if it is OK to do sibling
5027
+ * call optimizations for the specified call expression EXP.  DECL will be the
5028
+ * called function, or NULL if this is an indirect call.
5029
+ *
5030
+ * It is not uncommon for limitations of calling conventions to prevent tail
5031
+ * calls to functions outside the current unit of translation, or during PIC
5032
+ * compilation.  The hook is used to enforce these restrictions, as the sibcall
5033
+ * md pattern can not fail, or fall over to a 'normal' call.  The criteria for
5034
+ * successful sibling call optimization may vary greatly between different
5035
+ * architectures.
5036
+ *
5037
+ * ?? What's a sibling call?
5038
+ */
5039
+
5040
+// TARGET_EXTRA_LIVE_ON_ENTRY
5041
+// TARGET_SET_UP_BY_PROLOGUE
5042
+// TARGET_WARN_FUNC_RETURN
5043
+
5044 102 dgisselq
+/* 17.09.14 Stack smashing protection */
5045 111 dgisselq
+// TARGET_STACK_PROTECT_GUARD
5046
+// TARGET_STACK_PROTECT_FAIL
5047
+// TARGET_SUPPORTS_SPLIT_STACK
5048
+
5049 102 dgisselq
+/* 17.09.15 Miscellaneous register hooks */
5050
+
5051 111 dgisselq
+// TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
5052
+
5053 102 dgisselq
+/* TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
5054
+ * ZipCPU --- default is good enough for us.
5055
+ */
5056
+
5057
+/* 17.10 Implementing VARARGS MACROS */
5058
+
5059
+/* ...
5060
+ */
5061
+
5062
+/* void TARGET_SETUP_INCOMING_VARARGS(A,M,T,I,S) ... This target hook offers an
5063
+ * alternative to using __builtin_saveregs and defining the hook TARGET_EXPAND..
5064
+ * _BUILTIN_SAVEREGS.  Use it to store the anonymous register arguments into the
5065
+ * stack so that all the arguments appear to have been passed consecutively
5066
+ * on the stack.  Once this is done, you can use the standard implementation
5067
+ * of varargs that works for machines that pass all their arguments on the
5068
+ * stack.
5069
+ */
5070
+// #undef      TARGET_SETUP_INCOMING_VARARGS
5071
+// #define     TARGET_SETUP_INCOMING_VARARGS   zip_setup_incoming_varargs
5072
+
5073
+/* ...
5074
+ */
5075
+
5076
+/* 17.11 Trampolines for Nested Functions */
5077
+
5078
+/* TARGET_ASM_TRAMPOLINE_TEMPLATE ... This hook is called by
5079
+ * assemble_trampoline_template to output, on the stream f, assembler code for
5080
+ * a block of data that contains the constant parts of a trampoline.  This code
5081
+ * should not include a label--the label is taken care of automatically.
5082
+ *
5083
+ * ZipCPU -- looks like we need to do this.
5084
+ */
5085
+#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
5086
+#define        TARGET_ASM_TRAMPOLINE_TEMPLATE  zip_asm_trampoline_template
5087
+
5088
+/* TRAMPOLINE_SECTION ... Return the section into which the trampoline template
5089
+ * is to be placed.  The default value is readonly_data_section.
5090
+ *
5091
+ * ZipCPU--default should be good enough.
5092
+ */
5093
+
5094
+/* TRAMPOLINE_SIZE ... A C expression for the size (in bytes) of the trampoline
5095
+ * as an integer.
5096
+ *
5097
+ * ZipCPU--it's three instructions, or 96 bits.  However, 32-bits is our minimal
5098
+ * addressible unit, so what size do we offer here?  We'll stick with the number
5099
+ * of bytes, but we may need to change this later.
5100
+ *
5101
+ */
5102
+// #warning "May need to redefine trampoline_size in words, not bytes"
5103
+#undef TRAMPOLINE_SIZE
5104
+#define        TRAMPOLINE_SIZE 3
5105
+
5106
+/* TRAMPOLINE_ALIGNMENT ... alignment required for trampolines, in bits.
5107
+ *
5108
+ * Well that's well known in ZipCPU --- 32-bits.
5109
+ */
5110
+#undef TRAMPOLINE_ALIGNMENT
5111
+#define        TRAMPOLINE_ALIGNMENT    32
5112
+
5113
+/* void TARGET_TRAMPOLINE_INIT(RTX,TREE,RTX CH) ... This hook is called to
5114
+ * initialize a trampoline.  m_tramp is an RTX for the memory block for the
5115
+ * trampoline; TREE is the FUNCTION_DECL for the nested fucntion;  CH is an
5116
+ * rtx for the static chain value that should be passed to the function when
5117
+ * it is called.
5118
+ *
5119
+ * ZipCPU ... Can we get by without this?
5120
+ */
5121
+#undef TARGET_TRAMPOLINE_INIT
5122
+#define        TARGET_TRAMPOLINE_INIT  zip_trampoline_init
5123
+
5124
+/* TARGET_TRAMPOLINE_ADJUST_ADDRESS(RTX) ... This hook should perform any
5125
+ * machine-specific adjustment in the address of the trampoline.  Its argument
5126
+ * contains the address of the memory block that was passed to
5127
+ * TARGET_TRAMPOLINE_INIT.  In case the address to be used for a function call
5128
+ * should be different from the address at which the template was stored, the
5129
+ * different address should be returned; otherwise addr should be returned
5130
+ * unchanged.  If the hook is not defined, RTX (addr) will be used for function
5131
+ * calls.
5132
+ *
5133
+ * ZipCPU--works for us!
5134
+ */
5135
+
5136
+/* CLEAR_INSN_CACHE(BEG,END) ... If defined, expands to a C expression clearing
5137
+ * the instruction cache in the specified interval.  The definition of this
5138
+ * macro would typically be a series of asm statements.   Both BEG and END are
5139
+ * pointer expressions.
5140
+ *
5141
+ * ZipCPU --- Ouch!  We have no way to do this (yet)!
5142
+ */
5143
+
5144
+/* TRANSFER_FROM_TRAMPOLINE ... Define this macro is trampolines need a special
5145 111 dgisselq
+ * subroutine to do their work.  The macro should expand to a series of asm
5146 102 dgisselq
+ * statements which will be compiled with GCC.  They go in a library function
5147
+ * named __transfer_from_trampoline.
5148
+ *
5149
+ * We may need to rethink trampolines on ZipCPU.
5150
+ */
5151
+
5152
+
5153
+/* 17.12 Implicit Calls to Library Routines */
5154
+
5155
+/* DECLARE_LIBRARY_RENAMES
5156
+ *
5157
+ * ZipCPU: Don't need it.
5158
+ */
5159
+
5160
+/* TARGET_INIT_LIBFUNCS(VOID) ... This hook should declare additional library
5161
+ * routines or rename existing ones, using the functions set_optab_libfunc and
5162
+ * init_one_libfunc defined in optabs.c.  init_optabs calls this macro after
5163
+ * initializing all the normal library routines.
5164
+ *
5165
+ * Most ports don't need to define this hook, so we won't either.
5166
+ */
5167
+
5168
+/* TARGET_LIBFUNC_GNU_PREFIX ... If false (the default), internal library
5169
+ * routines start with two underscores.  If set to true, these routines start
5170
+ * with __gnu_ instead.
5171
+ *
5172
+ * ZipCPU: No change necessary.
5173
+ */
5174
+
5175
+/* FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE,COMPARISON) ... This macro should return
5176
+ * true if the library routine that implements the floating point comparison
5177
+ * operator comparison in mode mode will return a boolean and false if it will
5178
+ * return a tristate.
5179
+ *
5180
+ * Most ports don't need to define this macro, so Zip CPU won't either.
5181
+ */
5182
+
5183
+/* TARGET_HAS_NO_HW_DIVIDE ... This macro should be defined if the target has no
5184
+ * hardware divide instructions.  If this macro is defined, GCC will use an
5185
+ * algorithm which makes use of simple logical and arithmetic operations for
5186
+ * 64-bit division.  If the macro is not defined, GCC will use an algorithm
5187
+ * which makes use of a 64-bit by 32-bit divide primitive.
5188
+ *
5189
+ * Zip CPU, though, doesn't have the 64-bit by 32-bit divide primitive, thus
5190
+ * we have no HW DIVIDE (for now).
5191
+ */
5192
+#define        TARGET_HAS_NO_HW_DIVIDE
5193
+
5194
+/* TARGET_EDOM ... The value of EDOM on the target machine, as a C integer
5195
+ * expression.  If you don't define this macro, GCC does not attempt to deposit
5196
+ * the value of EDOM into errno directly.  Look in /usr/include/errno.h to find
5197
+ * the value of EDOM on your system.
5198
+ *
5199
+ * EDOM is the error created when a math argument is out of the domain of the
5200
+ * function.
5201
+ *
5202
+ * ZipCPU: Don't need it---I don't think.
5203
+ */
5204
+
5205
+/* GEN_ERRNO_RTX ... Define this macro as a C exrpession to create an rtl
5206
+ * expression that refers to the global "variable" errno.  (On certain
5207
+ * systems, errno may not actually be a variable.)  If you don't define this
5208
+ * macro, a reasonable default is used.
5209
+ *
5210
+ * ZipCPU --- if a reasonable default is used, we'll use that--especially since
5211
+ * I doubt we'll be using errno for a while.
5212
+ */
5213
+
5214
+/* NEXT_OBJC_RUNTIME ... Set this macro to 1 to use the "NeXT" Objective-C
5215
+ * message sending conventions by default.  This calling convention involves
5216
+ * passing the object, the selector and the method arguments all at once to the
5217
+ * method-lookup library function.  This is the usual setting when targetting
5218
+ * Darwin/Mac OS X systems, which have the NeXT runtime installed.
5219
+ *
5220
+ * If the macro is set to 0, ...
5221
+ *
5222
+ * Doesn't look relevant (yet) for the Zip CPU--especially since we don't have
5223
+ * an O/S yet.
5224
+ */
5225
+
5226
+
5227
+
5228
+/* 17.13 Addressing Modes */
5229
+
5230
+/* C expressions that are nonzero if the machine supports pre-increment,
5231
+ * pre-decrement, post-increment, or post-decrement addressing respectively.
5232
+ */
5233
+#define        HAVE_PRE_INCREMENT      (0)
5234
+#define        HAVE_PRE_DECREMENT      (0)
5235
+#define        HAVE_POST_INCREMENT     (0)
5236
+#define        HAVE_POST_DECREMENT     (0)
5237
+
5238
+/* C expression that is nonzero if the machine supports pre- or post- address
5239
+ * side-effect generation involving constants other than the size of the memory
5240
+ * operand.
5241
+ */
5242
+#define        HAVE_PRE_MODIFY_DISP    (0)
5243
+#define        HAVE_POST_MODIFY_DISP   (0)
5244
+
5245
+/* C expression that is non-zero if the machine supports pre- or post-address
5246
+ * side-effect generation involving a register displacement.
5247
+ */
5248
+#define        HAVE_PRE_MODIFY_REG     (0)
5249
+#define        HAVE_POST_MODIFY_REG    (0)
5250
+
5251
+/* CONSTANT_ADDRESS_P(X) ... A C expression that is 1 if the RTX X is a constant
5252
+ * which is a valid address.  On most machines the default definition ... is
5253
+ * acceptable, but a few machines are more restrictive as to which constant
5254
+ * addresses are supported.
5255
+ *
5256
+ * Zip CPU is designed for offset addresses, not constant addresses.  Although
5257
+ * the CPU will support 18-bit signed constant addresses, the assembler and
5258
+ * general programming model do not.  Further, without knowing where the final
5259
+ * address will be located, this is an unusable model.  Therefore we will
5260
+ * define this as not supported.
5261
+ *
5262
+ * In hindsight, this isn't true--labels and symbols are valid addresses, and
5263
+ * they are also constant addresses.  Hence, we leave this at its default.
5264
+ */
5265
+// #undef      CONSTANT_ADDRESS_P
5266
+// #define     CONSTANT_ADDRESS_P(X)   (0)
5267
+
5268 111 dgisselq
+/* CONSTANT_P(X) ... CONSTANT_P, which is defined by target-independent code,
5269
+ * accepts integer values expressions whose values are not explicitly known,
5270
+ * such as symbol_ref, label_ref, and high expressions and const arithmetic
5271
+ * expressions, in addition to const_int and const_double expressions.
5272 102 dgisselq
+ *
5273
+ * Huh???
5274
+ */
5275
+// #define CONSTANT_P(X) ???
5276
+
5277 111 dgisselq
+/* MAX_REGS_PER_ADDRESS ... A number, the maximum number of registers that can
5278
+ * appear in a valid memory address.  Note that it is up to you to specify a
5279
+ * value equal to the maximum number that TARGET_LEGITIMATE_ADDRESS_P would
5280
+ * ever accept.
5281 102 dgisselq
+ */
5282
+#define        MAX_REGS_PER_ADDRESS    1
5283
+
5284
+/* TARGET_LEGITIMATE_ADDRESS_P(MODE,RTX,STRICT) ... A function that returns
5285
+ * whether RTX is a legitimate memory address on the target machine for a
5286
+ * memory operation of mode MODE.
5287
+ */
5288
+#undef TARGET_LEGITIMATE_ADDRESS_P
5289
+#define TARGET_LEGITIMATE_ADDRESS_P    zip_legitimate_address_p
5290
+
5291
+/* TARGET_MEM_CONSTRAINT ... A single character to be used instead of the
5292
+ * default 'm' character for general memory addresses.  This defines the
5293
+ * constraint letter which matches the memory addresses accepted by
5294
+ * TARGET_LEGITIMATE_ADDRESS_P.  Define this macro if you want to support new
5295
+ * address format in your back end without changing the semantics of the 'm'
5296
+ * constraint.  This is necessary in order to preserve functionality of inline
5297
+ * assembly constructs using the 'm' constraint.
5298
+ *
5299
+ * ZipCPU--doesn't look like we need to define this at all.
5300
+ */
5301
+
5302
+/* FIND_BASE_TERM(X) ... A C expression to determine the base term of address
5303
+ * X or to provide a simplified version of X from which alias.c can easily find
5304
+ * the base term.  This macro is used in only two places: find_base_value and
5305
+ * find_base_term in alias.c.
5306
+ *
5307
+ * It is always safe for this macro  to not be defined.  It exists so that
5308
+ * alias analysis can understand machine-dependent addresses.
5309
+ *
5310
+ * ZipCPU: We'll skip this then.
5311
+ */
5312
+
5313
+/* TARGET_LEGITIMIZE_ADDRESS(RTX,OLD,MODE) ... This hook is given an invalid
5314
+ * memory address RTX for an operand of mode MODE and should try to return a
5315
+ * valid memory address.  RTX will always be the result of a call to
5316
+ * break_out_memory_refs, and OLD will be the operand that was given to that
5317
+ * function to produce RTX.
5318
+ *
5319 111 dgisselq
+ * ZipCPU --
5320 102 dgisselq
+ */
5321 111 dgisselq
+#undef TARGET_LEGITIMIZE_ADDRESS
5322
+#define        TARGET_LEGITIMIZE_ADDRESS       zip_legitimize_address
5323 102 dgisselq
+
5324
+/* LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OP,TYPE,IND,WIN) ... A C compound statement
5325
+ * that attempts to replace X, which is an address that needs reloading, with
5326
+ * a valid memory address for an operand of mode MODE.  WIN will be a C
5327
+ * statement label elsewhere in the code.  It is not necessary to define this
5328
+ * macro, but it might be useful for performance reasons.
5329
+ *
5330
+ * ZipCPU: This is worth coming back to, according to the notes page, but it
5331
+ * may also be a difficult macro to use.  Look at other implementations before
5332
+ * we dive into this.
5333
+ */
5334
+// #undef LEGITIMIZE_RELOAD_ADDRESS
5335
+// #define LEGITIMIZE_RELOAD_ADDRESS
5336
+
5337
+/* TARGET_MODE_DEPENDENT_ADDRESS_P(ADDR,SPACE) ... This hook returns true
5338
+ * if memory address addr in address space addrspace can have different meanings
5339
+ * depending on the machine mode of the memory reference it is used for or if
5340
+ * the address is valid for some modes but not others.
5341
+ */
5342
+#undef TARGET_MODE_DEPENDENT_ADDRESS_P
5343
+#define        TARGET_MODE_DEPENDENT_ADDRESS_P         zip_mode_dependent_address_p
5344
+
5345 111 dgisselq
+/* TARGET_LEGITIMATE_CONSTANT_P(MODE,RTX) ... This hook returns true if x is a
5346
+ * legitimate constant for a MODE-mode immediate operand on the target machine.
5347
+ * You can assume the RTX satisfies CONSTANT_P, so you need not check this.
5348
+ *
5349
+ * The default definition returns true.
5350 102 dgisselq
+ */
5351
+
5352
+/* TARGET_DELIGITIMIZE_ADDRESS(RTX)
5353
+ */
5354
+
5355
+/* TARGET_CONST_NOT_OK_FOR_DEBUG_P(RTX) ... This hook should return true if RTX
5356
+ * should not be emitted into debug sections.
5357
+ */
5358
+
5359
+/* TARGET_CANNOT_FORCE_CONST_MEM(MODE,RTX) ... This hook should return true if
5360
+ * RTX is a form that cannot (or should not) be spilled to the constant pool.
5361
+ * MODE is the mode of X.  The default version returns false.
5362
+ */
5363 111 dgisselq
+// #define     TARGET_CANNOT_FORCE_CONST_MEM   hook_bool_mode_rtx_false
5364 102 dgisselq
+
5365
+/* TARGET_USE_BLOCKS_FOR_CONSTANT_P(MODE,RTX) ... This hook should return true
5366
+ * if pool entries for constant RTX can be placed in an object_block structure.
5367
+ * MODE is the mode of X.  The default version returns false for all constants.
5368
+ *
5369
+ *????
5370
+ */
5371
+// #warning "Huh?"
5372
+
5373
+/* TARGET_USE_BLOCKS_FOR_DECL_P(DECL) ... This hook should return true if pool
5374
+ * entries for DECL should be placed in an object_block structure.  The default
5375
+ * version returns true for all DECL's.
5376
+ *
5377
+ * Sounds good.
5378
+ */
5379
+
5380
+/* TARGET_BUILTIN_RECIPROCAL(TREE) ... This hook should return the DECL of a
5381
+ * function that implements the reciprocal of the machine specific builtin
5382
+ * function fndecl, or NULL_TREE if such a function is not available.
5383
+ */
5384
+
5385
+/* TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD(VOID) ... This hook should return the
5386
+ * DECL of a function f that given an address addr as an argument returns a mask
5387
+ * m that can be used to extrract from two vectors the relevant data that
5388
+ * resides in addr in case addr is not properly aligned.
5389
+ *
5390
+ * Zip CPU does not support vectorization.
5391
+ */
5392
+
5393
+/* Other vector, SIMD, and GOACC macros skipped as Zip CPU doesn't support
5394
+ * such data accesses and manipulation.
5395
+ */
5396
+
5397
+/* 17.14 Anchored Addresses */
5398
+
5399
+/* TARGET_MIN_ANCHOR_OFFSET ... The minimum offset that should be applied to
5400
+ * a section anchor.  On most targets, it should be the smallest offset that
5401
+ * can be applied to a base register while still giving a legitimate address for
5402
+ * every mode.  The default value is 0.
5403
+ *
5404
+ * On the Zip CPU, this is the minimum operand B offset to a LOD or STO
5405
+ * operation, which would be a signed 14 bit number.
5406
+ */
5407
+#undef TARGET_MIN_ANCHOR_OFFSET
5408
+#define TARGET_MIN_ANCHOR_OFFSET       zip_min_anchor_offset
5409
+
5410
+/* TARGET_MAX_ANCHOR_OFFSET ... Like TARGET_MIN_ANCHOR_OFFSET, but the maximum
5411
+ * (inclusive) offset that should be applied to section anchors.  The default
5412
+ * value is 0.
5413
+ */
5414
+#undef TARGET_MAX_ANCHOR_OFFSET
5415
+#define TARGET_MAX_ANCHOR_OFFSET       zip_max_anchor_offset
5416
+
5417
+/* TARGET_ASM_OUTPUT_ANCHOR(RTX) ... Write the assembly code to define section
5418
+ * anchor RTX, which is a SYMBOL_REF for which 'SYMBOL_REF_ANCHOR_P(RTL) is
5419
+ * true.  The hook is called with the assembly output position set to the
5420
+ * beginning of SYMBOL_REF_BLOCK(X).
5421
+ *
5422
+ * If ASM_OUTPUT_DEF is available, the hook's default definition uses it to
5423
+ * define the symbol as '. + SYMBOL_REF_BLOCK_OFFSET(RTL)'.  If ASM_OUTPUT_DEF
5424
+ * is not available, the hook's default definition is NULL, which disables the
5425
+ * use of section anchors altogether.
5426
+ *
5427
+ * Section anchors will be very valuable in Zip CPU assembly, therefore we
5428
+ * must define this hook.
5429
+ */
5430
+// #undef      TARGET_ASM_OUTPUT_ANCHOR
5431
+// #define     TARGET_ASM_OUTPUT_ANCHOR        zip_asm_output_anchor
5432
+
5433
+/* TARGET_USE_ANCHORS_FOR_SYMBOL_P(RTX) ... Return true if GCC should attempt
5434
+ * to use anchors to access SYMBOL_REF X.  You can assume SYMBOL_REF_HAS_BLOCK_INFO_P(X) and !SYMBOL_REF_ANCHOR_P(X).
5435
+ *
5436
+ * 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.
5437
+ *
5438
+ * Not knowing anything more, we'll leave the default as is for the Zip CPU.
5439
+ */
5440
+// #undef TARGET_USE_ANCHORS_FOR_SYMBOL_P
5441
+// #define TARGET_USE_ANCHORS_FOR_SYMBOL_P     zip_use_anchors_for_symbol_p
5442
+
5443
+/* 17.15 Condition Code Status */
5444
+
5445
+/* 17.15.1 Representation of condition codes using (cc0) --- that's us */
5446
+
5447
+/* CC_STATUS_MDEP ... C code for a data type which is used for declaring
5448
+ * the mdep component of cc_status.  It defaults to int.
5449
+ *
5450
+ * ZipCPU---Int is good for us.
5451
+ */
5452
+
5453
+/* CC_STATUS_MDEP_INIT ... A C expression to initialize the mdep field to
5454
+ * "empty".  The default definition does nothing, since most machines don't
5455
+ * use the field anyway.  If you want to use the field, you should probably
5456
+ * define  this macro to initialize it.
5457
+ */
5458
+
5459
+/* NOTICE_UPDATE_CC(EXP, INSN) ... A C compound statement to set the components
5460
+ * of cc_status appropriately for an insn insn whose body is exp.  It is this
5461
+ * macro's responsibility to recognize insns that set the condition code as
5462
+ * a byproduct of other activity as well as those that explicitly set (cc0).
5463
+ *
5464
+ * ZipCPU --- We need this, as not all expressions set (cc0).
5465
+ *
5466
+ */
5467 122 dgisselq
+#ifdef HAVE_cc0
5468 102 dgisselq
+#define        NOTICE_UPDATE_CC(EXP, INSN)     zip_update_cc_notice(EXP, INSN)
5469 122 dgisselq
+#endif
5470 102 dgisselq
+
5471
+
5472
+/* 17.15.2 Representation of condition codes using registers */
5473
+/* ... which the ZipCPU doesn't have.  The ZipCPU has a CC0 register, and hence
5474
+ * this section isn't supposed to apply.
5475
+ */
5476
+
5477 122 dgisselq
+/* SELECT_CC_MODE(op, x, y) ... On many machines, the condition code may be
5478
+ * produced by other instructions than compares, for example the branch can use
5479
+ * directyl the condition code set by a subtract instruction.  However, on some
5480
+ * machines when the condition code is set this way some bits (such as the
5481
+ * overflow bit) are not set in the same way as a test instruction, so that a
5482
+ * different branch instruction must be used for some conditional branches.
5483
+ * When this happens, use the machinemode of the condition code register to
5484
+ * record different formats of the condition code register.  Modes can also be
5485
+ * used to reccord which compare instruction (e.g. a signed or an unsigned
5486
+ * comparison) produced the condition codes.
5487
+ *
5488
+ * If other modes than CCmode are required, add them to 'machine-modes.def' and
5489
+ * define SELECT_CC_MODE to choose a mode given an operand of a compare.  This
5490
+ * is needed because the modes have to be chosen not only during RTL generation
5491
+ * but also, for example, by instruction combination.  The result of
5492
+ * SELECT_CC_MODE should be consistent with the mode used in the patterns; ...
5493
+ *
5494
+ * ZipCPU ... We have only one CC Mode, so we'll use the CCmode defined in
5495
+ * machine-modes.def and should be fine with it.  Hence, this doesn't need
5496
+ * to be defined.
5497 102 dgisselq
+ */
5498
+
5499
+/* TARGET_CANONICALIZE_COMPARISON(int,rtx *, rtx *, bool) ... On some machines
5500
+ * (such as the ZipCPU) not all possible comparisons are defined, but you can
5501
+ * convert an invalid comparison into a valid one.  For example, the Alpha
5502
+ * does not have a GT comparison, but you can use an LT comparison instead and
5503
+ * swap the order of the operands.
5504
+ *
5505
+ * On such machines, implement this hook to do any required conversions:  code
5506
+ * is the initial comparison code and op0 and op1 are the left and right
5507
+ * operands of the comparison, respectively.  If op0_preserve_value is true the
5508
+ * implementation is not allowed to change the value of op0 since the value
5509
+ * might be used in RTXs which aren't comparisons.  E.g. the implementation is
5510
+ * not allowed to swap operands in that case.
5511
+ *
5512
+ * GCC will not assume that the comparison resulting from this macro is valid
5513
+ * but will see if the resulting insn matches a pattern in the 'md' file.
5514
+ *
5515
+ * You need not implement this hook if it would never change the comparison
5516
+ * code or operands.
5517
+ *
5518
+ * In the case of the ZipCPU, the ZipCPU only keeps track of 8 possible
5519
+ * comparisons, and bastardizing other comparisons into those 8 is extremely
5520
+ * painful.  Therefore, we *need* this capability to make certain we can use
5521
+ * our comparisons successfully.
5522
+ *
5523
+ * The only problem is ... this hook appears to only be called on non-CC0
5524
+ * machines.  Hence, defining it hasn't done anything for us.
5525
+ */
5526 122 dgisselq
+#define        TARGET_CANONICALIZE_COMPARISON  zip_canonicalize_comparison
5527 102 dgisselq
+
5528 122 dgisselq
+/* REVERSIBLE_CC_MODE(MODE) ... A C expression whose value is one if it is
5529
+ * always safe to reverse a comparison whose mode is MODE.  If SELECT_CC_MODE
5530
+ * can ever return MODE for a floating-point inequality comparison, than
5531
+ * REVERSIBLE_CC_MODE(MODE) must be zero.
5532
+ *
5533
+ * You need not define this macro if it would always return zero or if the
5534
+ * floating-point format is anything other than IEEE_FLOAT_FORMAT.  For example,
5535
+ * here ...
5536
+ *
5537
+ * ZipCPU -- We'll always return zero, so this need not be defined.
5538
+ */
5539
+
5540
+/* REVERSE_CONDITION(CODE,MODE) ... A C expression whose value is reversed
5541
+ * condition code of thecode for comparison done in CC_MODE MODE.  This macro
5542
+ * is used only in case REVERSIBLE_CC_MODE(MODE) is nonzero. ...
5543
+ *
5544
+ * ZipCPU ... Since REVERSIBLE_CC_MODE(MODE) will always be zero, we'll leave
5545
+ * this undefined.
5546
+ */
5547
+
5548
+/* bool TARGET_FIXED_CONDITION_CODE_REGS(int *, int *) ... On targets which do
5549
+ * not use (cc0), and which use a hard register rather than a pseudo-register
5550
+ * to hold condition codes, the regular CSE passes are often not able to
5551
+ * identify cases in which the hard register is set to a common value.  Use this
5552
+ * hook to enable a small pass which optimizes such cases.  This hook should
5553
+ * return true to enable this pass, and it should set the integers to which its
5554
+ * arguments point to the hard register numbers used for condition codes.  When
5555
+ * there is only one such register, as is true on most systems, the integer
5556
+ * pointed to by p2 should  be set to INVALID_REGNUM.
5557
+ *
5558
+ * The default version of this hook returns false.
5559
+ *
5560
+ * ZipCPU --- I like the idea of enabling optimizations.  Let's return
5561
+ * something other than false.
5562
+ */
5563
+#define        TARGET_FIXED_CONDITION_CODE_REGS        zip_fixed_condition_code_regs
5564
+
5565
+/* machine_mode TARGET_CC_MODES_COMPATIBLE(M1,M2) .. On targets which use
5566
+ * multiple condition code modes in class MODE_CC, it is sometimes the case
5567
+ * that a comparison can be validly done in more than one mode.  On such a
5568
+ * system, define this target hook to take two mode arguments and to return a
5569
+ * mode in which both comparisons may be validly done.  If there is no such
5570
+ * mode, return VOIDmode.
5571
+ *
5572
+ * The default version of this hook checks whether the modes are the same.  If
5573
+ * they are, it returns that mode.  If they are different, it returns VOIDmode.
5574
+ *
5575
+ * ZipCPU--Given that we only have the one CCmode, the default definition works
5576
+ * well enough for us.
5577
+ */
5578
+
5579
+/* unsigned int TARGET_FLAGS_REGNUM ... If the target has a dedicated flags
5580
+ * register, and it needs to use the post-reload comparison elimination pass,
5581
+ * then this value should be set appropriately.
5582
+ *
5583
+ * ZipCPU---Looks like we can set this easily enough without any problems.
5584
+ */
5585
+#undef TARGET_FLAGS_REGNUM
5586
+#define        TARGET_FLAGS_REGNUM     zip_CC
5587
+
5588 102 dgisselq
+/* 17.16 Relative costs of operations */
5589
+
5590
+
5591
+// #define     REGISTER_MOVE_COST(MODE,FROM,TO)        ((MODE==DImode)||(MODE==DFmode))?4:2
5592
+// #define     TARGET_REGISTER_MOVE_COST
5593
+// #define     MEMORY_MOVE_COST(MODE, CLASS, IN)       ((MODE==DImode)||(MODE==DFmode))?8:7
5594
+/* TARGET_REGISTER_MOVE_COST(M,FRM,TO) ... This target hook should return the
5595
+ * cost of moving data of mode M from a register in class FRM to one in class
5596
+ * TO.  The classes are expressed using the enumeration values such as
5597
+ * GENERAL_REGS.  A value of 2 is the default; other values are interpreted
5598
+ * relative to that.
5599
+ *
5600
+ * It is not required that the cost always equal 2 when FROM is the same as TO;
5601
+ * on some machines it is expensive to move between registers if they are not
5602
+ * general registers.
5603
+ *
5604
+ * If reload sees ...
5605
+ *
5606
+ * ZipCPU ... We can leave this at its default value of 2.
5607
+ */
5608
+
5609
+/* TARGET_MEMORY_MOVE_COST(MOD,CL,IN) ... This target hook should return the
5610
+ * cost of moving data of mode MOD between a register of class CL and memory.
5611
+ * IN is false if the value is to be written to memory, true if it is to be
5612
+ * read in.  This cost is relative to those in TARGET_REGISTER_MOVE_COST.
5613
+ * If moving between registers and memory is more expensive that between two
5614
+ * registers, you should add this target hook to express the relative cost.
5615
+ *
5616
+ * If you do not add this target hook, GCC uses a default cost of 4 plus the
5617
+ * cost of copying via a secondary reload register, if one is needed.  If your
5618
+ * machine requires a secondary reload register to copy between memory and a
5619
+ * register of CL but the reload mechanism is more complex than copying via
5620
+ * an intermediate, use this target hook to reflect the actual cost of the
5621
+ * move.
5622
+ *
5623
+ * ZipCPU --- Memory moves are more expensive than twice the cost of register
5624
+ * moves, so let's make certain this is defined.
5625
+ */
5626
+#define        TARGET_MEMORY_MOVE_COST zip_memory_move_cost
5627
+
5628
+// #warning "This needs to be double checked, and annotated"
5629 111 dgisselq
+#define        BRANCH_COST(SPEED,PREDICTABLE)          ((PREDICTABLE)?2:5)
5630 102 dgisselq
+
5631
+/* Define this macro as a C expression which is nonzero if accessing less than
5632
+ * a word of memory (i.e. a 'char' or a 'short') is no faster than accessing
5633
+ * a word of memory.
5634
+ */
5635
+#define        SLOW_BYTE_ACCESS        1
5636
+
5637
+/* MOVE_RATIO(SPD) ... The threshold of number of scalar memory-to-memory move
5638
+ * instructions, below which a sequence of instructions should be generated
5639
+ * instead of a string move instruction or a library call.  Increasing the
5640
+ * value will always make code faster, but eventually incurs high cost in
5641
+ * increased code size.
5642
+ */
5643
+#define        MOVE_RATIO(SPD) 5
5644
+
5645
+/* TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(SZ,ALGN,OP,SPD) ...
5646
+ */
5647
+// #undef      TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)
5648
+// #define     TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)// needs hook
5649
+
5650
+/* CLEAR_RATIO(SPD) ... The threshold number of scalar move instructions, below
5651
+ * which a sequence of instructions should be generated to clear memory instead
5652
+ * of a string clear instruction or a library call.  Increasing the value will
5653
+ * always make the code faster, but eventually incurs high cost in increased
5654
+ * code size.
5655
+ */
5656
+#define        CLEAR_RATIO(SPD)        MOVE_RATIO(SPD)
5657
+
5658
+/* NO_FUNCTION_CSE ... Define this macro to be true if it is as good or better
5659
+ * to call a constant function address than to call an address kept in a
5660
+ * register.
5661
+ *
5662
+ * On the Zip CPU, constant function addresses--especially relative ones,
5663
+ * can be optimized into a single cycle delay.  Register jumps will always
5664
+ * stall the whole (5-stage) pipeline.
5665
+ */
5666
+#define        NO_FUNCTION_CSE
5667
+
5668 111 dgisselq
+/* TARGET_RTX_COSTS(X,CODE,OUTER,OPNO,TOTAL,SPD) ... This target hook describes
5669
+ * the relative costs of RTL expressions.
5670
+ *
5671
+ * The cost may depend on the precise form of the expression, which is avaialble
5672
+ * for examination in X, and the fact that X appears as operand OPNO of an
5673
+ * expression with rtx code OUTER.  That is, the hook can assume that there is
5674
+ * some RTX Y such that GET_CODE(Y)==OUTER and such that either (a) XEXP(Y,OPNO)
5675
+ * == X or (b) XVEC(Y,OPNO) contains X.
5676
+ *
5677
+ * ...
5678
+ * The hook returns true when all subexpressions of x have been processed and
5679
+ * false when rtx_cost should recurse.
5680 102 dgisselq
+ */
5681 111 dgisselq
+
5682 102 dgisselq
+/* TARGET_ADDRESS_COST(ADDR,MODE,AS, SPD) ... This hook computes the cost of an
5683
+ * addressing mode that contains ADDR.  If not defined, the cost is computed
5684
+ * from the ADDR expression and the TARGET_RTX_COST hook.  In cases where more
5685
+ * than one form of an address is known, the form with the lowest cost will be
5686
+ * used.  If multiple forms have the same, lowest, cost, the one that is the
5687
+ * most complex will be used.
5688
+ *
5689
+ * ZipCPU really has only one address cost, the only type of address it
5690
+ * supports.  Sure, index addressing would cost us more, but we don't support
5691
+ * that so ... I think we're okay defining this as a constant.  Indeed, the
5692
+ * docs state that, "On RISC amchines, all instructions normally have the same
5693
+ * length and execution time.  Hence all addresses will have equal costs."
5694
+ */
5695
+#undef TARGET_ADDRESS_COST
5696
+#define        TARGET_ADDRESS_COST     zip_address_cost
5697
+
5698
+
5699
+/* TARGET_NO_SPECULATION_IN_DELAY_SLOTS_P ... This predicate controls the use
5700
+ * of the eager delay slot filler to disallow speculatively executed
5701
+ * instructions being placed in delay slots.  Targets such as certain MIPS
5702
+ * architectures posess both branches with and without delay slots.  As the
5703
+ * eager delay slot filler can decrease performance, disabling it is beneficial
5704
+ * when ordinary branches are available.  Use of delay slot branches filled
5705
+ * using basic filler is often still desirable as the delay slot can hide a
5706
+ * pipeline bubble.
5707
+ */
5708
+// How should Zip CPU define this--we have no delay slots.
5709
+
5710
+
5711
+/* 17.17 Instruction Scheduler */
5712
+
5713
+#define        TARGET_SCHED_ISSUE_RATE zip_sched_issue_rate
5714
+
5715
+/* 17.18 Dividing the Output into Sections */
5716
+
5717
+/* Switch to the text or data segment. */
5718
+#define        TEXT_SECTION_ASM_OP     "\t.text"
5719
+#define        DATA_SECTION_ASM_OP     "\t.data"
5720
+
5721
+// #undef      TARGET_LIBGCC_SDATA_SECTION
5722
+// #define     TARGET_LIBGCC_SDATA_SECTION     ".sdata"
5723
+
5724
+
5725
+/* 17.19 Position Independent Code */
5726
+
5727
+#define        PIC_OFFSET_TABLE_REGNUM                 zip_GOT
5728
+#define        PIC_OFFSET_TABLE_REG_CALL_CLOBBERED     0
5729
+// #define LEGITIMATE_PIC_OPERAND_P(X) should evaluate to X(GOT) only
5730
+
5731
+/* 17.20 Defining the Output Assembler Language */
5732
+
5733
+/* 17.20.4 Output and Generation of Labels */
5734
+
5735
+/* ASM_OUTPUT_LABEL
5736
+ * ... A default definition of this macro is provided which is correct for
5737
+ * most systems.
5738
+ */
5739
+
5740
+/* ASM_OUTPUT_FUNCTION_LABEL
5741
+ * ... if not defined, then the function name is defined in the usual manner
5742
+ * as a label.
5743
+ */
5744
+
5745
+/* ASM_OUTPUT_INTERNAL_LABEL ... Identical to ASM_OUTPUT_LABEL, except that name
5746
+ * is known to refer to a compiler-generated label.  The default definition
5747
+ * uses assemble_name_raw, which is like assemble_name except that it is more
5748
+ * efficient.
5749
+ */
5750
+
5751
+/* SIZE_ASM_OP ... A C string containing the appropriate assembler directive
5752
+ * to specify the size of a symbol, without any arguments.  ON systems that
5753
+ * use ELF, the dfault is "\t.size\t"; on other systems, the default is not to
5754
+ * define this macro.
5755
+ *
5756
+ * Define this amcro only if it is correct to use the default definitions of
5757
+ * ASM_OUTPUT_SIZE_DERECTIVE and ASM_OUTPUT_MEASURED_SIZE for your system.
5758
+ * If you need your own custom definitions of those macros, or if you do not
5759
+ * need explicit symbol sizes at all, do not define this macro.
5760
+ */
5761
+
5762
+/* ASM_OUTPUT_SIZE_DIRECTIVE
5763
+ * ASM_OUTPUT_MEASURED_SIZE
5764
+ */
5765
+
5766
+/* NO_DOLLAR_IN_LABEL ... Define this macro if the assembler does not accept
5767
+ * the character '$' in label names.  By default constructors and destructors
5768
+ * in G++ have "$" in the identifiers.  If this label is defined, '.' is
5769
+ * used instead.
5770
+ */
5771
+
5772
+/* NO_DOT_IN_LABEL ... Define this macro if the assembler does not accept the
5773
+ * character '.' in label names.  By default constructors and destructors in
5774
+ * G++ have names that use '.'.  If this macro is defined, these names are
5775
+ * rewritten to avoid '.'.
5776
+ */
5777
+
5778
+/* TYPE_ASM_OP ... A C string containing the appropriate assembler directive to
5779
+ * specify the type of a symbol, without any arguments.  On systems that use
5780
+ * ELF the default in config/elfos.h is "\t.type\t"; on other systems, the default is not to define this macro.
5781
+ *
5782
+ * Define this macro only if it is correct to use the default definition of
5783
+ * ASM_OUTPUT_TYPE_DIRECTIVE forr your system.  If you need your own custom
5784
+ * definition of this macr, or if you do not need explicit symbol types at all,
5785
+ * do not define this macro.
5786
+ */
5787
+
5788
+/* TYPE OPERAND_FMD ... A
5789
+ */
5790
+
5791
+/* ASM_OUTPUT_TYPE_DIRECTIVE
5792
+ */
5793
+
5794
+/* ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) ...
5795
+ * if this macro is not defined, then the function name is defined in the usual
5796
+ * manner as a label (by means of ASM_OUTPUT_FUNCTION_LABEL).
5797
+ */
5798
+
5799
+/* ASM_DECLARE_FUNCTION_SIZE
5800
+ * ASM_DECLARE_COLD_FUNCTION_NAME
5801
+ * ASM_DECLARE_COLD_FUNCTION_SIZE
5802
+ * ASM_DECLARE_OBJECT_NAME
5803
+ * TARGET_ASM_DECLARE_CONSTANT_NAME
5804
+ */
5805
+/* ASM_DECLARE_REGISTER_GLOBAL(STREAM, DECL, REGNO, NAME) ... A C statement
5806
+ * (sans semicolon) to output to the stdio stream STREAM any text necessary for
5807
+ * claiming a register REGNO for a global variable DECL with name NAME.
5808
+ *
5809
+ * If you don't defin this macro, that is equivalent to dfining it to do
5810
+ * nothing.
5811
+ */
5812
+
5813
+/* ASM_FINISH_DECLARE_OBJECT
5814
+ * TARGET_ASM_GLOBALIZE_LABEL
5815
+ * TARGET_ASM_GLOBALIZE_DECL_NAME
5816
+ * TARGET_ASM_ASSEMBLE_UNDEFINED_DECL
5817
+ * ASM_WEAKEN_LABEL
5818
+ * ASM_WEAKEN_DECL
5819
+ * ASM_OUTPUT_WEAKREF
5820
+ * SUPPORTS_WEAK
5821
+ * TARGET_SUPPORTS_WEAK
5822
+ * MAKE_DECL_ONE_ONLY
5823
+ * SUPPORTS_ONE_ONLY
5824
+ * TARGTE_ASM_ASSEMBLE_VISIBILITY
5825
+ * TARGET_WEAK_NOT_IN_ARCHIVE_TOC
5826
+ * ASM_OUTPUT_EXTERNAL
5827
+ * TARGET_ASM_EXTERNAL_LIBCALL
5828
+ * TARGET_ASM_MARK_DECLPRESERVED
5829
+ * ASM_OUTPUT_LABELREF
5830
+ * TARGET_MANGLE_ASSEMBLER_NAME
5831
+ * ASM_OUTPUT_SYMBOL_REF
5832
+ * ASM_OUTPUT_LABEL_REF
5833
+ * TARGET_ASM_INTERNAL_LABEL
5834
+ * ASM_OUTPUT_DEBUG_LABEL
5835
+ * ASM_GENERATE_INTERNAL_LABEL
5836
+ * ASM_FORMAT_PRIVATE_NAME
5837
+ */
5838
+
5839
+/* ASM_OUTPUT_DEF ... A C statement to output to the stdio stream STREAM
5840
+ * assembler code which defines (equates) the symbol NAME to have the value
5841
+ * VALUE.
5842
+ *
5843
+ * ZipCPU---So many other things that we need depend upon this, that we need
5844
+ * to implement a non-default version.
5845
+ */
5846
+#define        ASM_OUTPUT_DEF  zip_asm_output_def
5847
+
5848
+/* ASM_OUTPUT_DEF_FROM_DECLS
5849
+ * TARGET_DEFERRED_OUTPUT_DEFS
5850
+ * ASM_OUTPUT_WEAK_ALIAS
5851
+ * OBJ_GEN_METHOD_LABEL
5852
+ */
5853
+
5854
+
5855
+/* 17.20.7 Output of Assembler Instructions */
5856
+
5857
+#define        REGISTER_NAMES { "R0","R1","R2","R3","R4","R5","R6","R7","R8","R9", \
5858
+       "R10","R11","R12","SP","CC","PC" }
5859
+
5860
+/* REGISTER_PREFIX     (Undefined by default)
5861
+ * LOCAL_LABEL_PREFIX  (Undefined by default)
5862
+ * USER_LABEL_PREFIX   defaults to "*"
5863
+ * IMMEDIATE_PREFIX    (Undefined by default)
5864
+ *
5865
+ * If defined, C string expressions to be used for the '%R', '%L', '%U', and
5866
+ * '%I' options of asm_fprintf (see 'final.c').  These are useful when a single
5867
+ * 'md' file must support multiple assembler formats.  In that case, the various
5868
+ * 'tm.h' files can define these macros differently.
5869
+ */
5870
+// #define     USER_LABEL_PREFIX       "*"
5871
+
5872
+/* Defining memory operand address formats is in this section. */
5873
+
5874
+/* 17.20.10 Assembler Commands for Alignment */
5875
+
5876
+/* JUMP_ALIGN(label) ... The alignment (log base 2) to put in front of label,
5877
+ * which is a common destination of jumps and has no fallthru incoming
5878
+ * edge.  This macro need not be defined if you don't want any special alignment
5879
+ * to be done at such a time.  Most machine descriptions do not currently define
5880
+ * this macro.
5881
+ *
5882
+ * ZipCPU---The assembler should automatically deal with label alignment, so
5883
+ * let's not do anything about it here.
5884
+ */
5885
+
5886
+/* TARGET_ASM_JUMP_ALIGN_MAX_SKIP
5887
+ */
5888
+
5889
+/* LABEL_ALIGN_AFTER_BARRIER
5890
+ * TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
5891
+ */
5892
+
5893
+/* LOOP_ALIGN(label)
5894
+ * TARGET_ASM_LOOP_ALIGN_MAX_SKIP
5895
+ * LABEL_ALIGN
5896
+ * TARGET_ASM_LABEL_ALIGN_MAX_SKIP
5897
+ */
5898
+
5899
+/* ASM_OUTPUT_SKIP(STREAM, NBYTES) A C statement to output to the stdio
5900
+ * stream an assembler instruction to advance the location counter by nbytes
5901
+ * bytes.
5902
+ */
5903
+
5904
+/* TARGET_ASM_LABEL_ALIGN */
5905
+/* Assembler Commands for Alignment */
5906
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
5907
+               { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
5908
+
5909
+
5910
+
5911
+/* 17.21 Controlling Debugging Information Format */
5912
+/* 17.22 Cross Compilation and Floating Point */
5913 111 dgisselq
+
5914
+// REAL_VALUE_TYPE
5915
+// REAL_VALUES_EQUAL
5916
+// REAL_VALUES_LESS ... Tess whether x is less than y
5917
+/* REAL_VALUE_FIX ... Truncates x to an unsigned integer, rouding toward zero.
5918
+ * If x is negative, returns zero.
5919
+ */
5920
+// REAL_VALUE_ATOF
5921
+// REAL_VALUE_NEGATIVE
5922
+// REAL_VALUE_ISINF
5923
+// REAL_VALUE_ISNAN
5924
+/* REAL_ARITHMETIC(OUT,CODE,X,Y) ... (Macro) Calculates an arithmetic operation
5925
+ * on two floating point values X and Y, storing the result in OUT (which must
5926
+ * be a variable).
5927
+ *
5928
+ * The operation to be performed is specified by CODE.  Only the following
5929
+ * codes are supported: PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, MAX_EXPR,
5930
+ * MIN_EXPR.
5931
+ *
5932
+ * If REAL_ARITHMETIC is asked to evaluate division by zero and the target's
5933
+ * floating point format cannot represent infinity, it will call abort().
5934
+ * Callers shoudl check for this situation first, using MODE_HAS_INFINITIES.
5935
+ */
5936
+/* REAL_VALUE_NEGATE(X) ... [Macro] Returns the negative of the floating point
5937
+ * value X.
5938
+ */
5939
+/* REAL_VALUE_ABS(X) ... [Macro] Returns the absolute value of X.
5940
+ */
5941 102 dgisselq
+/* 17.23 Mode switching instructions */
5942
+/* 17.24 Defining target-specific uses of __attribute__ */
5943
+#undef TARGET_OPTION_OVERRIDE
5944
+#define        TARGET_OPTION_OVERRIDE  zip_override_options
5945
+
5946
+/* 17.25 Emulating TLS */
5947
+/* 17.26 Defining coprocessor specifics for MIPS targets*/
5948
+
5949
+ // ZipCPU isn't MIPS.
5950
+
5951
+/* 17.27 Parameters for Precompiled Header Validity Checking */
5952
+/* 17.28 C++ ABI parameters */
5953
+/* 17.29 Adding support for named address spaces */
5954
+/* 17.30 Miscellaneous Parameters */
5955
+
5956
+/* HAS_LONG_COND_BRANCH ... Define this boolean macro to indicate whether or
5957
+ * not your architecture has conditional branches that can span all of memory.
5958
+ * It is used in conjunction with an optimization that partitions hot and
5959
+ * cold basic blocks into separate sections of the executable.  If this macro
5960
+ * is set to false, gcc will convert any conditional branches that attempt to
5961
+ * cross between sections into unconditional branches or indirect jumps.
5962
+ *
5963
+ * ZipCPU --- The assembler renders long unconditional branch code without
5964
+ * problems, so we can pretend that such long branches exist.
5965
+ */
5966
+#define        HAS_LONG_COND_BRANCH true
5967
+
5968
+/* HAS_LONG_UNCOND_BRANCH ... Define this boolean macro to indicate whether
5969
+ * or not your architecture has unconditional branches that can span all of
5970
+ * memory.  (ZipCPU does ... via the LOD (PC),PC instruction.)  It is used in
5971
+ * conjunction with an optimization that partitions hot and cold basic blocks
5972
+ * into separate sections of the executable.  If this macro is set to false,
5973
+ * gcc will convert any unconditional branches that attempt to cross between
5974
+ * sections into indirect jumps.
5975
+ *
5976
+ * ZipCPU has the LOD (PC),PC instruction which can be used to implement a long
5977
+ * jump.
5978
+ */
5979
+#define        HAS_LONG_UNCOND_BRANCH  true
5980
+
5981
+/* CASE_VECTOR_MODE ... An alias for a machine mode name.  This is the machine
5982
+ * mode that eleemnts of a jump-table should have.
5983
+ *
5984
+ */
5985
+#define        CASE_VECTOR_MODE        SImode
5986
+
5987
+/* CASE_VECTOR_SHORTEN_MODE(MIN,MAX,BODY) ... Optional: return the preferred
5988
+ * mode for an addr_diff_vec when the minimum and maximum offset are known.
5989
+ * If you define this, it enables extra code in branch shortening to deal with
5990
+ * addr_diff_vec.  To make this work, you also have to define INSN_ALIGN and
5991
+ * make the alignment for addr_diff_vec explicit.  The body argument is provided so that the offset_unsigned and scale flags can be updated.
5992
+ *
5993
+ * ZipCPU---No advantage here.
5994
+ */
5995
+
5996
+/* CASE_VECTOR_PC_RELATIVE ... Define this exrpession to indicate when
5997
+ * jump-tables should contain relative addresses.  You need not define this
5998
+ * macro if jump-tables never contain relative addresses, or jump-tables
5999
+ * should contain relative addresses only when -fPIC or -FPIC is in effect.
6000
+ *
6001
+ * ZipCPU---No advantage in PC-Relative jump tables--except in PIC relative
6002
+ * code.
6003
+ */
6004
+
6005
+/* TARGET_CASE_VALUES_THRESHOLD(VOID) ... This function returns the smallest
6006
+ * number of different values for which it is best to use a jump-table instead
6007
+ * of a tree of conditional branches.  The default is four for machines with a
6008
+ * casesi instruction and five otherwise.  This is best for most machines.
6009
+ *
6010
+ * ZipCPU---Leave at the default.
6011
+ */
6012
+
6013
+/* WORD_REGISTER_OPERATIONS ... Define this macro to 1 if operations between
6014
+ * registers with integral mode smaller than a word are always performed on the
6015
+ * entire register.  Most RISC machines have this property and most CISC
6016
+ * machines do not.
6017
+ *
6018
+ * ZipCPU---We have the property, 'cause we're fairly risk.
6019
+ */
6020
+#undef WORD_REGISTER_OPERATIONS
6021
+#define        WORD_REGISTER_OPERATIONS        1
6022
+
6023
+/* LOAD_EXTEND_OP(MEMODE) ... Define this macro to be a C expression indicating
6024
+ * when insns that read memory in MEMMODE, an integral mode narrower than a
6025
+ * word, set the bits outside of MEMMODE to be either the sign extension or
6026
+ * zero-extension of the data read.  Return SIGN_EXTEND for values of MEMMODE
6027
+ * for which the insn sign-extends, ZERO_EXTEND for which it zero-extends, and
6028
+ * UNKNOWN for other modes.
6029
+ *
6030
+ * Do not define this macro if it would always return UNKNOWN.
6031
+ *
6032
+ * ZipCPU---This should be irrelevant, so we leave it undefined.
6033
+ */
6034
+#undef LOAD_EXTEND_OP
6035
+#define        LOAD_EXTEND_OP(MEM)     SIGN_EXTEND
6036
+
6037
+/* SHORT_IMMEDIATES_SIGN_EXTEND ... Define this macro to 1 if loading short immediate values into registers sign extends.
6038
+ *
6039
+ * ZipCPU---All immediates are sign extended, so yes.
6040
+ */
6041
+#undef SHORT_IMMEDIATES_SIGN_EXTEND
6042
+#define        SHORT_IMMEDIATES_SIGN_EXTEND    1
6043
+
6044
+/* TARGET_MIN_DIVISIONS_FOR_RECIP_MUL
6045
+ */
6046
+
6047
+/* MOVE_MAX ... The maximum number of bytes that a single instruction can move
6048
+ * quickly between memory and registers or between two memory locations.
6049
+ *
6050
+ * ZipCPU --- Although we can move 32-bits at a time, and most people would call
6051
+ * this 4-bytes, the compiler defines a byte as the minimum addressable unit.
6052
+ * Therefore, this is defined to be one.
6053
+ */
6054
+#define        MOVE_MAX        1
6055
+
6056
+/* MAX_MOVE_MAX ... The maximum number of bytes that a single instruction can
6057
+ * move quickly between memory and registers or between two memory ...
6058
+ *
6059
+ * ZipCPU --- this sounds just the same as MOVE_MAX, which is the default
6060
+ * definition of this.
6061
+ */
6062
+
6063
+/* SHIFT_COUNT_TRUNCATED ... A C expression that is nonzero if on this machine
6064
+ * the number of bits actually used for the count of a shift operation is equal
6065
+ * to the number of bits needed to represent the size of the object being
6066
+ * shifted.
6067
+ *
6068
+ * You need not define this macro if it would have the value of zero.
6069
+ *
6070
+ * ZipCPU---A shift of 33 (or more) in either direction will wipe out the
6071
+ * value in the register, therefore this value should be zero, the default.
6072
+ */
6073
+
6074
+/* TARGET_SHIFT_TRUNCATION_MASK(MODE) ... This function describes how the
6075
+ * standard shift patterns for MODE deal with shifts by negative amounts or by
6076
+ * more than the width of the mode.
6077
+ *
6078
+ * ZipCPU---The default is zero, since we didn't define SHIFT_COUNT_TRUNCATED.
6079
+ * This is the case for the ZipCPU as well.
6080
+ */
6081
+
6082
+/* TRULY_NOOP_TRUNCATION(OUTPREC,INPREC) ... A C expression which is nonzero
6083
+ * if on this machine it is safe to "convert" an integer of INPREC bits to one
6084
+ * of OUTPREC bits (where OUTPREC is smaller than INPREC) by merely operating on
6085
+ * it as if it had OUTPREC bist.  On many machines, this expression can be 1.
6086
+ *
6087
+ * ZiPCPU ... If both values are 32-bit, what conversion takes place?  If one is
6088
+ * 64-bit and the other 32-bit ... I suppose it would then be safe.
6089
+ */
6090
+#undef TRULY_NOOP_TRUNCATION
6091
+#define TRULY_NOOP_TRUNCATION(O,I)     1
6092
+
6093
+/* TARGET_MODE_REP_EXTENDED(MODE,REPMODE) ... The representation of an integral
6094
+ * mode can be such that the values are always extended to a wider integral
6095
+ * mode.  Return SIGN_EXTEND if values of MODE are represented in sign-extended
6096
+ * form to REPMODE.  Return UNKNOWN otherwise.  (Currently none of the targets
6097
+ * use zero-extended.
6098
+ *
6099
+ */
6100
+// #undef      TARGET_MODE_REP_EXTENDED
6101
+// #define     TARGET_MODE_REP_EXTENDED(R,M)   SIGN_EXTEND
6102
+
6103
+/* STORE_FLAG_VALUE ... A C expression describing the value returned by a
6104
+ * comparison operator with an integral mode and stored by a store-flag
6105
+ * instruction (cstoremode4) when the condition is true.  This description
6106
+ * must apply to all the cstoremode4 patterns and all the comparison operators
6107
+ * whose results have MODE_INT mode.
6108
+ *
6109
+ * ZipCPU---Doesn't really have a STORE_FLAG_VALUE instruction ...
6110
+ */
6111
+
6112
+/* FLOAT_STORE_FLAG_VALUE
6113
+ *
6114
+ * ZipCPU
6115
+ */
6116
+
6117
+/* VECTOR_STORE_FLAG_VALUE ... define this macro on machines that have vector
6118
+ * comparison operations that return a vector result ...
6119
+ *
6120
+ * ZipCPU---Doesn't support vector operations.
6121
+ */
6122
+
6123
+/* CLZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
6124
+ * CTZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
6125
+ *
6126
+ * A C expression that indicates whetther the architecture defines a value for
6127
+ * clz or ctz with a zero operand.  A result of 0 indicates the value is
6128
+ * 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
6129
+ * entry, then the macro should evaluate to 2.  In cases where the value is
6130
+ * defined, value should be set to this value.
6131
+ * If this macro is not defined, the value of clz or ctz at zero is assumed to
6132
+ * be undefined.
6133
+ *
6134
+ * ZipCPU---Has neither clz nor ctz instructions, so we don't need this.
6135
+ */
6136
+
6137
+/* Pmode ... An alias for the machine mode for pointers.  On most machines,
6138
+ * define this to be the integer mode corresponding to the width of a
6139
+ * hardware pointer.  SImode on 32-bits machines, or DImode on 64-bit machines.
6140
+ * On some machines you must define this to be one of the partial
6141
+ * integer modes, such as PSImode.
6142
+ */
6143
+#undef Pmode
6144
+#define        Pmode   SImode
6145
+
6146
+/* FUNCTION_MODE ... An alais for the machine mode used for memory references to
6147
+ * function being called, in call RTL expressions.  On most CISC machines, where
6148
+ * an instruction can begin at any byte address, this should be QImode.  On most
6149
+ * RISC machines, where all instructions have fixed size and alignment, this
6150
+ * should be a mode with the same size and alignment as the machine instruction
6151
+ * words--typically SImode or HImode.
6152
+ *
6153
+ * ZipCPU---Definitely SImode, as with Pmode.  (All words are 32-bits, including
6154
+ * addresses on the ZipCPU.
6155
+ */
6156
+#undef FUNCTION_MODE
6157
+#define        FUNCTION_MODE   SImode
6158
+
6159
+/* STDC_0_IN_SYSTEM_HEADERS
6160
+ */
6161
+
6162
+/* TARGET_C_PREINCLUDE(V) ... Define this hook to return the name of  a header
6163
+ * file to be included at the start of all compilations, as if it had been
6164
+ * included with #include <file>.  If this hook returns NULL, or is not defined,
6165
+ * or if the header is not found, or if the user specifies -ffreestanding or
6166
+ * -nostdinc, no header is included.
6167
+ *
6168
+ * ZipCPU --- We don't have a standard library defined yet, so we'll leave this
6169
+ * as NULL.
6170
+ */
6171
+#undef TARGET_C_PREINCLUDE
6172
+#define        TARGET_C_PREINCLUDE     NULL
6173
+
6174
+/* TARGET_CXX_IMPLICIT_EXTERN_C(CONST CHAR *) ... Define this hook to add target
6175
+ * specific C++ implicit extern C functions.  If this function returns true
6176
+ * for the name of a file-scope function, that function implicitly gets extern
6177
+ * "C" linkage rather than whatever linkage the declaration would normally have.
6178
+ * An example of such function is WinMain on Win32 targets.
6179
+ *
6180
+ * ZipCPU---Not ready to deal with this yet.
6181
+ */
6182
+
6183
+/* NO_IMPLICIT_EXTERN_C ... Define this macro if the system header files
6184
+ * support C++ as well as C.  This macro inhibits the usual method of using
6185
+ * system header files in C++, which is to pretend that the file's contents
6186
+ * are enclosed in 'extern "C" {...}'.
6187
+ *
6188
+ *
6189
+ * ZipCPU --- Don't have either C or C++ headers, so let's skip this for now.
6190
+ * Eventually, though, I think ZipCPU and C++ would go very well together.
6191
+ */
6192
+
6193
+/* REGISTER_TARGET_PRAGMAS ... Define this macro if you want to implement any
6194
+ * target specific pragmas.
6195
+ *
6196
+ * ZipCPU --- let's not.
6197
+ */
6198
+
6199
+/* HANDLE_PRAGMA_PACK_WITH_EXPANSION ... Define this macro if macros should be
6200
+ * expanded in the arguments of #pragma pack().
6201
+ *
6202
+ * ZipCPU ... why?
6203
+ */
6204
+
6205
+/* TARGET_DEFAULT_PACK_STRUCT ... If your target requires a struct packing
6206
+ * default other than 0 (meaning the machine default), define this macro to
6207
+ * the necessary value (in bytes).  This must be a value that would also be
6208
+ * valid to use with #pragma pack() (that is a small power of two.
6209
+ */
6210
+
6211
+/* DOLLARS_IN_IDENTIFIERS
6212
+ * ZipCPU --- Default (not changing C)
6213
+ */
6214
+
6215
+/* INSN_SETS_ARE_DELAYED(INSN) ... Define this macro as a C expression that
6216
+ * is nonzero if it is safe for the delay slot schedule to place instructions
6217
+ * in the delay slot of INSN, even if they appear to use a resource set or
6218
+ * clobbered in INSN.  INSN is always a ...
6219
+ *
6220
+ * ZipCPU --- You need not define this macro if it would always return zero.
6221
+ */
6222
+
6223
+/* INSN_REFERENCES_ARE_DELAYED(INSN) ... Define this macro as a C expression
6224
+ * that is nonzero if it is safe for the delay slot schedule to place
6225
+ * instructions in the delay slot of INSN, even if they appear to set or clobber
6226
+ * a resource referenced in INSN.  INSN is always a jump_insn or an insn.  On
6227
+ * machines where some insn or jump_insn is really a function call and ...
6228
+ *
6229
+ * ZipCPU --- You need not define this macro if it would always return zero.
6230
+ */
6231
+
6232
+/* MULTIPLE_SYMBOL_SPACES ... Define this macro as a C expression that is
6233
+ * nonzero if, in some cases, global symbols from one translation unit may not
6234
+ * be bound to undefined symbols in another translation unit without user
6235
+ * intervention.  For instance, under Microsoft Windows symbols must be
6236
+ * explicitly imported from shared libraries (DLLs).
6237
+ *
6238
+ * ZipCPU---You need not define this macro if it would always evaluate to zero,
6239
+ * so we won't.
6240
+ */
6241
+
6242
+/* TARGET_MD_ASM_ADJUST
6243
+ */
6244
+/* MATH_LIBRARY ... Define this macro as a C constant ... you only need to
6245
+ * define this macro if the default of "m" is wrong.
6246
+ *
6247
+ * ZipCPU --- as we don't have a math library yet, building one such that "m"
6248
+ * works doesn't sound like a problem.  Let's not define this.
6249
+ */
6250
+
6251
+/* LIBRARY_PATH_ENV ... Define this as a C string constant for the environment
6252
+ * variable that specifies where the linker should look for libraries.
6253
+ *
6254
+ * Just in case we want to add libraries for ZipCPU, let's place them in
6255
+ * /usr/local/zip/lib, so as not to confuse them with our local systems
6256
+ * libraries.
6257
+ */
6258
+#define        LIBRARY_PATH_ENV        "/usr/local/zip/lib"
6259
+
6260
+/* TARGET_POSIX_IO ... Define this macro if the target supports the following
6261
+ * POSIX file fucntions: access, mkdir, and file locking with fcntl/F_SETLKW.
6262
+ *
6263
+ * ZipCPU does not.
6264
+ */
6265
+
6266
+/* MAX_CONDITIONAL_EXECUTE ... A C expression for the maximum number of
6267
+ * instructions to execute via conditional execution instructions instead of a
6268
+ * branch.  A value of BRANCH_COST+1 is the default if the machine does not use
6269
+ * cc0 and 1 if it does use cc0.
6270
+ *
6271
+ * ZipCPU---This sounds good enough for the ZipCPU as well--as long as we have
6272
+ * BRANCH_COST defined.  However, BRANCH_COST is defined as conditionally to
6273
+ * something else, so let's keep looking into this.
6274
+ */
6275
+
6276
+/* IFCVT_MODIFY_TESTS(CEINFO,TRUE,FALSE) ... Used if the target needs to
6277 103 dgisselq
+ * perform machine-dependent modifications on the conditionals used for turning
6278 102 dgisselq
+ * basic blocks into conditionally executed code.  CEINFO points to a data
6279
+ * structure, struct ce_if_block, which contains information about the currently
6280
+ * processed blocks.  TRUE and FALSE are the tests that are used for
6281
+ * converting the then-block and the else-block, respectively.  Set either TRUE
6282
+ * or FALSE to a null pointer if the tests cannot be converted.
6283
+ *
6284
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6285
+ * execution and conditional testing capabilities.
6286
+ */
6287 122 dgisselq
+#define        IFCVT_MODIFY_TESTS(CI,TR,FL)    zip_ifcvt_modify_tests(CI,&TR,&FL)
6288 102 dgisselq
+
6289
+/* IFCVT_MODIFY_MULTIPLE_TESTS(CEINFO, BB, TRUE, FALSE) ... Like
6290
+ * IFCVT_MODIFY_TESTS, but used when converting more complicated if-statements
6291
+ * into conditions combined by and and or operations.  BB contains the basic
6292
+ * block that contains the test that is currently being processed and about to
6293
+ * be turned into a condition.
6294
+ *
6295
+ *
6296
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6297
+ * execution and conditional testing capabilities.
6298
+ */
6299
+// #warning "Need to come back to this."
6300 122 dgisselq
+#define        IFCVT_MODIFY_MULTIPLE_TESTS(CI,BB,TR,FL) TR=NULL_RTX
6301 102 dgisselq
+
6302
+
6303
+/* IFCVT_MODIFY_INSN(CEINFO, PATTERN, INSN) ... A C expression to modify the
6304
+ * PATTERN of an INSN that is to be converted to conditional execution format.
6305
+ * CEINFO points to a data structure, struct ce_if_block, which contains
6306
+ * information about the currently processed blocks.
6307
+ *
6308
+ *
6309
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6310
+ * execution and conditional testing capabilities.
6311
+ */
6312
+// #warning "Need to come back to this."
6313
+
6314
+
6315
+/* IFCVT_MODIFY_FINAL(CEINFO) ... A C expression to perform any final
6316
+ * machine dependent modifications in converting code to conditional
6317
+ * execution.  The involved basic blocks can be found in struct ce_if_block
6318
+ * structure pointed to be CEINFO.
6319
+ *
6320
+ *
6321
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6322
+ * execution and conditional testing capabilities.
6323
+ */
6324
+// #warning "Need to come back to this."
6325 122 dgisselq
+#define        IFCVT_MODIFY_FINAL(CEINFO)      zip_ifcvt_modify_final(CEINFO)
6326 102 dgisselq
+
6327
+
6328
+/* IFCVT_MODIFY_CANCEL(CEINFO) ... A C expression to cancel any machine
6329
+ * dependent modifications in converting code to conditional execution.  The
6330
+ * involved basic blocks can be found in the struct ce_if_block structure that
6331
+ * is pointed to by CEINFO.
6332
+ *
6333
+ *
6334
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6335
+ * execution and conditional testing capabilities.
6336
+ */
6337
+// #warning "Need to come back to this."
6338 122 dgisselq
+#define        IFCVT_MODIFY_CANCEL(CEINFO)     zip_ifcvt_modify_cancel(CEINFO)
6339 102 dgisselq
+
6340
+
6341
+/* IFCVT_MACHDEP_INIT(CEINFO) ... A C expression to initialize any machine
6342
+ * specific data for if-conversion of the if-block in the CEINFO block structure
6343
+ * that is pointed by CEINFO.
6344
+ *
6345
+ *
6346
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6347
+ * execution and conditional testing capabilities.
6348
+ */
6349
+// #warning "Need to come back to this."
6350 122 dgisselq
+#define        IFCVT_MACHDEP_INIT(CEINFO)      zip_ifcvt_machdep_init(CEINFO)
6351 102 dgisselq
+
6352
+
6353
+/* TARGET_MACHINE_DEPENDENT_REORG(VOID) ... If non-null, this hook performs a
6354
+ * target specific pass over the instruction stream.  The compiler will run it
6355
+ * at all optimization levels, just before the point at which it normally does
6356
+ * delayed branch scheduling.
6357
+ *
6358
+ * You need not implement the hook if it has nothing to do.
6359
+ *
6360
+ * ZipCPU---This may be part of a later upgrade, but shouldn't be needed to
6361
+ * just get us started.
6362
+ */
6363
+
6364
+
6365
+/* TARGET_INIT_BUILTINS(VOID) ... Define this hook if you ahve any machine
6366
+ * specific builtin functions that need to be defined.  It should be a function
6367
+ * that performs the necessary setup.  Machine specific builtin functions can be
6368
+ * useful to expand special machine instructions that would otherwise not
6369
+ * normally be generated because they have no equivalent in the source language.
6370
+ *
6371
+ * To create a built in function, call the function lang_hooks.builtin_function
6372
+ * which is defined by the language front end.  You can use any type nodes
6373
+ * set up by build_common_tree_nodes; only language front ends that use those
6374
+ * two functions will call "TARGET_INIT_BUILTINS".
6375
+ *
6376
+ * ZipCPU---We need to come back to this.  We should have several built-ins
6377
+ * defined: rtu(), wait(), halt(), save_context(cstackregno), and
6378
+ * restore_context(cstackregno).
6379
+ *
6380
+ */
6381
+#undef TARGET_INIT_BUILTINS
6382
+#define        TARGET_INIT_BUILTINS    zip_init_builtins
6383
+
6384
+/* TARGET_BUILTIN_DECL(CODE,INITP) ... Define this hook if you have any
6385
+ * machine specific builtin functions that need to be defined.  It should be a
6386
+ * function that returns the builtin function declaration for the builtin
6387
+ * function code code.  If there is no such builtin and it cannot be initialized
6388
+ * at this time if INITP is true the function should return NULL_TREE.  If
6389
+ * CODE is out of range the fucntion should return error-mark_node.
6390
+ *
6391
+ * ZipCPU ... needs to be done, don't know how to do it yet.
6392
+ */
6393
+#undef TARGET_BUILTIN_DECL
6394
+#define        TARGET_BUILTIN_DECL     zip_builtin_decl
6395
+
6396
+
6397
+/* TARGET_EXPAND_BUILTIN(TREE,TGT,SUB,MODE,IGNORE) ... Expand a call to a
6398
+ * machine specific built-in function that was set up by TARGET_INIT_BUILTINS.
6399
+ * TREE is the expression for the function call; the result should go to
6400
+ * TGT if that is convenient, and have mode MODE if that is convenient.  SUB
6401
+ * may be used as the target for computing one of EXP's operands.  IGNORE is
6402
+ * non-zero if the value is to be ignored.  This function should return the
6403
+ * result of the call to the built-in function.
6404
+ *
6405
+ * ZipCPU ... needs to do it, just to get our special intrinsic functions
6406
+ */
6407
+#define        TARGET_EXPAND_BUILTIN   zip_expand_builtin
6408
+
6409
+
6410
+/* TARGET_BUILTIN_CHKP_FUNCTION(FCODE) ... Allows the target to redefine
6411
+ * builtin functions used by Pointer Bounds Checker for code instrumentation.
6412
+ *
6413
+ * ZipCPU --- not interested.
6414
+ */
6415
+/* TARGET_CHKP_BOUND_TYPE
6416
+ * TARGET_CHKP_MAKE_BOUNDS_CONSTANT
6417
+ * TARGET_CHKP_INITIALIZE_BOUNDS
6418
+ *
6419
+ * ZipCPU --- Same as last one.
6420
+ */
6421
+
6422
+
6423
+/* TARGET_RESOLVE_OVERLOADED_BUILTIN(LOC, FN, ARGS) ... Select a replacement
6424
+ * for a machine specific built-in function that was set up by
6425
+ * TARGET_INIT_BUILTINS.
6426
+ *
6427
+ * ZipCPU --- If I go to the trouble to create a builtin, why would I want
6428
+ * to then overload it?
6429
+ */
6430
+
6431
+/* TARGET_FOLD_BUILTIN(FN,NARGS,ARGP,IGNORE) ... Fold a call to a machine
6432
+ * specific built-in function that was set up by 'TARGET_INIT_BUILTINS'  FN
6433
+ * is the declaration of the built-in function.  NARGS is the number of
6434
+ * arguments passed to the function; the arguments themselves are pointed to by
6435
+ * ARGP.  The result is another tree, valid for both GIMPLE and GENERIC,
6436
+ * containing as simplified expression for the call's result.  If IGNORE is
6437
+ * true the value will be ignored.
6438
+ *
6439
+ * ZipCPU --- You know, this and the previous couple sound like something
6440
+ * whereby I might be able replace bit-reversal code with my bit reverse
6441
+ * instruction.  That would be very useful, but not necessary to get me
6442
+ * started.
6443
+ */
6444
+
6445
+/* TARGET_GIMPLE_FOLD_BUILTIN
6446
+ * TARGET_COMPARE_VERSION_PRIORITY
6447
+ * TARGET_GET_FUNCTION_VERSIONS_DISPATCHER
6448
+ * TARGET_GENERATE_VERSION_DISPATCHER_BODY
6449
+ * TARGET_CAN_USE_DOLOOP_P
6450
+ * TARGET_INVALID_WITHIN_DOOLOOP
6451
+ * TARGET_LEGITIMATE_COMBINED_INSN
6452
+ * TARGET_CAN_FOLLOW_JUMP
6453
+ * TARGET_COMMUTATIVE_P
6454
+ */
6455
+
6456
+/* TARGET_ALLOCATE_INITIAL_VALUE(REGNO)  ... When the initial value of a hard
6457
+ * register has been copied in a pseudo register, it is often not necessary
6458
+ * ...
6459
+ */
6460
+/* TARGET_UNSPEC_MAY_TRAP_P(RTX,FLAGS)  ... This target hook returns nonzero in
6461
+ * RTX, un unspec or unspec_volatile operation, might cause a trap.  Targets
6462
+ * can use this hook to enhance precision of analysis for unspec and
6463
+ * unspec_volatile operations.  You may call may_trap_p_1 to analyze inner
6464
+ * elements of RTX in which case flags should be passed along.
6465
+ */
6466
+
6467
+/* TARGET_SET_CURRENT_FUNCTION(TREE)  The compiler invokes this hook whenever
6468
+ * it changes its current function context (CFUN).  You can define this
6469
+ * function if the back end needs to perform any initialization or reset
6470
+ * actions on a per-function basis.  For example, it may be used to implement
6471
+ * function attributes that affect register usage or code generation patterns.
6472
+ */
6473
+
6474
+/* TARGET_OBJECT_SUFFIX ... Define this macro to be a C string representing the
6475
+ * suffix for object files on your target machine.  If you do not define this
6476
+ * macro, GCC will use ".o" as the suffix for object files.
6477
+ */
6478
+#define        TARGET_OBJECT_SUFFIX    ".o"
6479
+
6480
+/* TARGET_EXECUTABLE_SUFFIX
6481
+ */
6482
+#define        TARGET_EXECUTABLE_SUFFIX        ""
6483
+
6484
+/* COLLECT_EXPORT_LIST ... If defined, collect2 will scan the individual object
6485
+ * files specified on its command line and create an export list for the linker.
6486
+ * Define this macro for systems like AIX, where the linker discards object
6487
+ * files that are not referenced from main and uses export lists.
6488
+ *
6489
+ * ZipCPU --- shoudln't need this.
6490
+ */
6491
+
6492
+/* MODIFY_JNI_METHOD_CALL(MDECL)  ... Define this macro to a C expression
6493
+ * representing a variant of the method call mdecl, if Java Native Interface
6494
+ * (JNI) methods must be invoked differently from other methods on your
6495
+ * target.  For example, on 32-bit MSWindows, JNI methods must be invoked
6496
+ * using the stdcall calling convention and this macro is then ...
6497
+ *
6498
+ * ZipCPU----Don't need this.  (yet)
6499
+ */
6500
+
6501
+
6502
+/* TARGET_CANNOT_MODIFY_JUMPS_P ... This target hook returns true past the
6503
+ * point in which a new jump instructions could be created.  On machines that
6504
+ * require a register for every jump such as the SHmedia ISA of SH5, this point
6505
+ * would typically be reload, so thiss target hook should be defined to a
6506
+ * function such as:
6507
+ *
6508 117 dgisselq
+ * ZipCPU --- I don't get what this is for.
6509
+ *     Actually, in hind sight, ZipCPU needs this.  Without this, the
6510
+ * compiler will try to reorder basic blocks, shuffling logic around and so
6511
+ * fortch, preventing our comparison optimizations from being used.  By setting
6512
+ * this function appropriately, we can prevent it from reversing conditions into
6513
+ * conditions we don't support.
6514 102 dgisselq
+ */
6515 117 dgisselq
+#define        TARGET_CANNOT_MODIFY_JUMPS_P    zip_cannot_modify_jumps_p
6516 102 dgisselq
+
6517
+/* TARGET_BRANCH_TARGET_REGISTER_CLASS ... This target hook returns a register
6518
+ * class for which branch target register optimizations should be applied.  All
6519
+ * registers in this class should be usable interchangably.  After reload,
6520
+ * registers in this class will be re-allocated and loads will be hoisted out of
6521
+ * loops and be subjected to inter-block scheduling.
6522
+ *
6523
+ * ZipCPU---GENERAL_REGS, but this should be a default already ...
6524
+ */
6525
+
6526
+
6527
+/* TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED ...  Branch target register
6528
+ * optimization will by default exclude callee-saved registers that are not
6529
+ * already live during the current function.  If this target hook returns true,
6530
+ * they will be included.  The target code must then make sure that all target
6531
+ * registers in the class returned by TARGET_BRANCH_REGISTER_CLASS that might
6532
+ * be saved are saaved.
6533
+ *
6534
+ * ZipCPU---
6535
+ */
6536
+
6537
+
6538
+/* TARGET_HAVE_CONDITIONAL_EXECUTION(VOID) ... This target hook returns true
6539
+ * if the target supports conditional execution.  This target hook is required
6540
+ * only when the target has several different modes and they have different
6541
+ * conditional execution capability, such as ARM.
6542
+ *
6543
+ * ZipCPU---Yes!  All instructions may be conditionally executed (except the
6544
+ * long version load immediate ...)
6545
+ */
6546
+#define        TARGET_HAVE_CONDITIONAL_EXECUTION       hook_bool_void_true
6547
+
6548
+/* TARGET_GEN_CCMP_FIRST(PREP,GEN,CODE,OP0,OP1) .. This function prepares to
6549
+ * emit a comparison instruction for the first compare in a sequence of
6550
+ * conditional comparisons.  It returns an appropriate comparison with CC for
6551
+ * passing to gen_ccmp_next or cbranch_optab.  The instructions to prepare the
6552
+ * compare are saved in prep_seq and the compare instructions are saved in
6553
+ * gen_seq.  They will be emitted when all the compares in the conditional
6554
+ * comparison are generated without error.  CODE is the rtx_code of the compare
6555
+ * for op0 and op1.
6556
+ *
6557
+ *
6558
+ * ZipCPU---???
6559
+ */
6560
+
6561
+/* TARGET_GEN_CCMP_NEXT(PREP,GEN,PREV,CMP,OP0,OP1,BITCODE) ... This function
6562
+ * prepares to emit a conditional comparison within a sequence of conditional
6563
+ * comparisons.  It returns an appropriate comparison with CC for passing to
6564
+ * gen_ccmp_next or cbranch_optab.  The insn to prepare the compare are saved
6565
+ * in prep_seq and the compare instructions are saved in gen_seq.  They will be
6566
+ * emitted when all the compares in the conditional comparison are generated
6567
+ * without error.  The pPREV expression is the result of a prior call to either
6568
+ * gen_ccmp_first or gen_ccmp_next.  It may return NULL if the combination of
6569
+ * PREV and this comparison is not supported, otherwise the result must be the
6570
+ * appropriate for passing to gen_ccmp_next or cbranch_optab.  CODE is the RTX
6571
+ * code of the compare for op0 and op1.  BITCODE is AND or IOR, which is the op
6572
+ * on the compares.
6573
+ *
6574
+ *
6575
+ * ZipCPU --- ???
6576
+ */
6577
+
6578
+/* TARGET_LOOP_UNROLL_ADJUST(NUNROLL, LOOP) ... This target hook returns a new
6579
+ * value for the number of times loop should be unrolled.  The parameter NUNROLL
6580
+ * is the number of times the loop is to be unrolled.  The parameter loop is a
6581
+ * pointer to the loop, which is going to be checked for unrolling.  The target
6582
+ * hook is required only when the target has special constraints like maximum number of memory accesses.
6583
+ *
6584
+ *
6585
+ * ZipCPU -- ???
6586
+ */
6587
+
6588
+
6589
+/* POWI_MAX_MULTS ... If defined, this macro is interpreted as a signed integer
6590
+ * C expression that specifies the maximum number of floating point
6591
+ * multiplications that should be emitted when expanding exponentiation by an
6592
+ * integer constant inline.  When this value is defined, exponentiation
6593
+ * requiring more than this number of multiplications is implemented by calling
6594
+ * the system library's pow, powf, or powl routines.  The default value
6595
+ places no upper bound on the multiplication count.
6596
+ *
6597
+ * ZipCPU---As we have no system library pow() routine (yet) ... we're not
6598
+ * ready for this macro.
6599
+ */
6600
+
6601
+
6602
+/* TARGET_EXTRA_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6603
+ * register any extra include files for the target.  The parameter stdinc
6604
+ * indicates if normal include files are present.  The parameter SYSROOT is the
6605
+ * system root directory.  The parameter PFX is the prefix for the GCC
6606
+ * directoiry.
6607
+ *
6608
+ *
6609
+ * ZipCPU---None yet.
6610
+ */
6611
+
6612
+/* TARGET_EXTRA_PRE_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6613
+ * register any extrra include files for the target before any standard headers.
6614
+ * The parameter stdinc indicates if normal include files are present.
6615
+ *
6616
+ * ZipCPU --- None.
6617
+ */
6618
+
6619
+/* TARGET_OPTF(PATH) ... This target hook should register special include paths
6620
+ * for the target.  The parameter path is the integer to register.  On Darwin
6621
+ * systems, this is used for Framework includes, which have semantics that are
6622
+ * different from -I.
6623
+ *
6624
+ *
6625
+ * ZipCPU --- None.
6626
+ */
6627
+
6628
+/* TARGET_USE_LOCAL_THUNK_ALIAS_P(FN) ... This target macro returns if it is
6629
+ * safe to use a local alias for a virtual function FN when constructing
6630
+ * thunks, false otherwise.  By default, the macro returns true for all
6631
+ * functions, if a target supports aliases (i.e. defines ASM_OUTPUT_DEF),
6632
+ * false otherwise.
6633
+ *
6634
+ *
6635
+ * ZipCPU --- ???
6636
+ */
6637
+// #warning "ASM_OUTPUT_DEF's definition has not been considered"
6638
+
6639
+
6640
+/* TARGET_FORMAT_TYPES ... If defined, this macro is the name of a global
6641
+ * variable containing target-specific format checking information for the
6642
+ * -Wformat option.  The default is to have no target-specific format checks.
6643
+ *
6644
+ * ZipCPU --- Default
6645
+ */
6646
+
6647
+/* TARGET_N_FORMAT_TYPES
6648
+ *
6649
+ * ZipCPU --- Default
6650
+ */
6651
+
6652
+/* TARGET_OVERRIDES_FORMAT_ATTRIBUTES ... If defined, this macro is the name of
6653
+ * a global variable containing target-specific format overrides for the
6654
+ * -Wformat option.  The default is to have no target specific format overrides.
6655
+ *
6656
+ * ZipCPU --- Default
6657
+ */
6658
+
6659
+/* TARGET_OVERRIDEES_FORMAT_ATTRIBUTES
6660
+ * TARGET_OVERRIDEES_FORMAT_ATTRIBUTES_COUNT
6661
+ *
6662
+ * If defined, the (first) macro is the name of a global variable containing
6663
+ * target-specific format overrides for the -Wformat option.
6664
+ */
6665
+/* TARGET_OVERRIDES_FORMAT_INIT ... If defined, this macro specifies the
6666
+ * optional initialization routine for target specific customizations of the
6667
+* system printf and scanf formatter settings.
6668
+ */
6669
+
6670
+/* TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN(TLIST,FN,VAL) ... If defined, this
6671
+ * macro returns the diagnostic message when it is illegal to pass an argument
6672
+ * VAL to function FN with prototype TLIST.
6673
+ *
6674
+ * ZipCPU---Default.
6675
+ */
6676
+
6677
+/* TARGET_INVALID_CONVERSION
6678
+ * TARGET_INVALID_UNARY_OP
6679
+ * TARGET_INVALID_BINARY_OP
6680
+ * TARGET_INVALID_PARAMETER_TYPE
6681
+ * TARGET_INVALID_RETURN_TYPE
6682
+ * TARGET_PROMOTED_TYPE
6683
+ * TARGET_CONVERT_TO_TYPE
6684
+ * TARGET_USE_JCR_SECTION_TYPE
6685
+ * OBJC_JBLEN
6686
+ * LIBGCC2_UNWIND_ATTRIBUTE
6687
+ * TARGET_UPDATE_STACK_BOUNDARY
6688
+ * TARGET_GET_DRAP_RTX
6689
+ * TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS
6690
+ */
6691
+/* TARGET_CONST_ANCHOR ... On some architectures it can take multiple
6692
+ * instructions to synthesize a constant. If there is another constant already
6693
+ * in a register that is close enough in value then it is preferable that the
6694
+ * new constant is computed from the register using immediate addition or
6695
+ * subtraction.  We accomplish this through CSE.  Besides the value of the
6696
+ * constant we also add a lower and an upper constant anchor to the available
6697
+ * expressions.  These are then queried when encountering new constants.  The
6698
+ * anchors are computed by rounding the constant up and down to a multiple of
6699
+ * the value of TARGET_CONST_ANCHOR.  TARGET_CONST_ANCHOR should be the maximum
6700
+ * positive value accepted by immediate-add plus one.  We currently assume that
6701
+ * the value of TARGET_CONST_ANCHOR is a poewr of 2.  For example, on MIPS,
6702
+ * where add-immediate takes a 16-bit signed value, TARGET_CONST_ANCHOR is set
6703
+ * to 0x8000.  The default value is zero, which disables this optimization.
6704
+ *
6705
+ * ZipCPU---One of the great strengths of the ZipCPU ISA is its ability to
6706
+ * access registers plus immediates.  To use this, we *need* this capability.
6707
+ * So, we define it here. (to 0x20000, or 2^17 because we can handle 18-bits of
6708
+ * signed immediate offsets)
6709
+ *
6710
+ * On ZipCPU---2^17
6711
+ */
6712
+#define        TARGET_CONST_ANCHOR     zip_const_anchor
6713
+
6714
+/* TARGET_ASAN_SHADOW_OFFSET ... Return the offset bitwise ored into shifted
6715
+ * address to get corresponding Address Sanitizer shadow memory address.  NULL
6716
+ * if address Sanitizer is not supported by the target.
6717
+ */
6718
+#define        TARGET_ASAN_SHADOW_OFFSET       NULL
6719
+
6720
+/* TARGET_MEMMODEL_CHECK
6721
+ */
6722
+/* TARGET_ATOMIC_TEST_AND_SET_TRUEVAL ... This value should be set if the result
6723
+ * written by atomic test and set is not exactly 1, i.e. the bool true.
6724
+ */
6725
+/* TARGET_HAS_IFUNC_P ... It returns true if the target supports GNU indirect
6726
+ * functions.  The support includes the assembler, linker, and dynamic linker.
6727
+ * The default value of this hook is based on target's libc.
6728
+ */
6729
+#define        TARGET_HAS_IFUNC_P      hook_bool_void_true
6730
+
6731
+/* TARGET_ATOMIC_ALIGN_FOR_MODE(MODE) ... If defined, this function returns
6732
+ * an appropriate alignment in bits for an atomic object of machine mode
6733
+ * MODE.  If 0 is returned then the default alignment for the specified mode
6734
+ * is used.
6735
+ *
6736
+ * ZipCPU---Both default and 2 would be valid.  We'll stick to the default.
6737
+ */
6738
+
6739
+/* TARGET_ATOMIC_ASSIGN_EXPAND_FENV --- ISO C11 requires atomic compound
6740
+ * assignments that may raise floating-point exceptions to raise exceptions
6741
+ * corresponding to the arithmetic operation whose result was successfully
6742
+ * stored in a compare-and-exchange sequence.  This requires code equivalent to
6743
+ * calls to feholdexcept, feclearexcept and feupdateenv to be generated at
6744
+ * appropriate points in the compare-and-exchange sequence.  This hook should
6745
+ * set *hold to an expression equivalent
6746
+ *
6747
+ * ZipCPU --- ???
6748
+ */
6749
+
6750
+/* TARGET_RECORD_OFFLOAD_SYMBOL ... Used when offloaded functions are seen in
6751
+ * the compilation unit and no named sections are available.  It is called once
6752
+ * for each symbol that must be recorded in the offload function and variable
6753
+ * table.
6754
+ *
6755
+ * ZipCPU --- Offloaded functions?
6756
+ */
6757
+
6758
+/* TARGET_OFFLOAD_OPTIONS
6759
+ *
6760
+ * ZipCPU---none defined
6761
+ */
6762
+
6763
+/* TARGET_SUPPORTS_WIDE_INT ... On older ports, large integers are stored
6764
+ * in CONST_DOUBLE rtl objects.  Newer ports define TARGET_SUPPORTS_WIDE_INT
6765
+ * to be nonzero to indicate that large integers are stored in CONST_WIDE_INT
6766
+ * rtl objects.  The CONST_WIDE_INT allows very large integer constants to be
6767
+ * represented.  CONST_DOUBLE is limited to twice the size of the hosts
6768
+ * HOST_WIDE_INT representation.
6769
+ *
6770
+ * ZipCPU---We don't need these yet, so this isn't yet relevant.  (These ints
6771
+ * are wider than DImode ...)
6772
+ */
6773
+#define        TARGET_SUPPORTS_WIDE_INT        0
6774
+
6775
+
6776
+/* Now, for the prototype functions ...*/
6777
+// These have been moved to zip-protos.h
6778
+
6779
+// extern void zip_init_builtins(void);
6780
+// extern void zip_asm_output_anchor(rtx x);
6781
+// extern bool zip_legitimate_address_p(enum machine_mode mode, rtx x, bool string);
6782
+// extern void zip_asm_trampoline_template(FILE *);
6783
+// extern void zip_initial_elimination_offset(int from, int to);
6784
+// extern void zip_print_operand(FILE *stream, rtx *x, int code);
6785
+// extern void zip_print_operand_address(FILE *stream, rtx *x);
6786
+// extern void zip_asm_output_def(FILE *s, const char *n, const char *v);
6787
+// extern void zip_update_cc_notice(rtx exp, rtx_insn *insn);
6788
+// extern      int zip_address_operand(rtx op);
6789
+// extern      int zip_const_address_operand(rtx op);
6790
+// extern void zip_expand_prologue(void);
6791
+// extern void zip_expand_epilogue(void);
6792
+// extern bool zip_gen_move_rtl(rtx, rtx);
6793
+// extern bool zip_load_address_lod(rtx, rtx);
6794
+// extern bool zip_load_address_sto(rtx, rtx);
6795
+// extern void zip_print_operand(FILE *fp, rtx x, int code);
6796
+// extern void zip_print_operand_address(FILE *fp, rtx x);
6797
+// extern bool zip_use_return_insn(void);
6798
+
6799 111 dgisselq
+#define        UQQmode USQmode
6800
+#define        UHQmode USQmode
6801
+#define        UHAmode USAmode
6802
+#define        QQmode  SQmode
6803
+#define        HQmode  SQmode
6804 102 dgisselq
+#define        QImode  SImode
6805
+#define        HImode  SImode
6806 111 dgisselq
+#define        QAmode  SAmode
6807
+#define        HAmode  SAmode
6808 102 dgisselq
+
6809
+#include "insn-modes.h"
6810
+#include "zip-protos.h"
6811
+
6812
+#endif /* GCC_ZIP_H */
6813
+
6814
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.md gcc-5.3.0-zip/gcc/config/zip/zip.md
6815
--- gcc-5.3.0-original/gcc/config/zip/zip.md    1969-12-31 19:00:00.000000000 -0500
6816 124 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.md 2016-04-08 15:26:57.622343817 -0400
6817
@@ -0,0 +1,2422 @@
6818 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6819
+;;
6820
+;; Filename:   zip.md
6821
+;;
6822
+;; Project:    Zip CPU -- a small, lightweight, RISC CPU soft core
6823
+;;
6824
+;; Purpose:    This is the machine description of the Zip CPU as needed by the
6825
+;;             GNU compiler collection (GCC).
6826
+;;
6827
+;;
6828
+;; Creator:    Dan Gisselquist, Ph.D.
6829
+;;             Gisselquist Technology, LLC
6830
+;;
6831
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6832
+;;
6833
+;; Copyright (C) 2015, Gisselquist Technology, LLC
6834
+;;
6835
+;; This program is free software (firmware): you can redistribute it and/or
6836
+;; modify it under the terms of  the GNU General Public License as published
6837
+;; by the Free Software Foundation, either version 3 of the License, or (at
6838
+;; your option) any later version.
6839
+;;
6840
+;; This program is distributed in the hope that it will be useful, but WITHOUT
6841
+;; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
6842
+;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6843
+;; for more details.
6844
+;;
6845
+;; License:    GPL, v3, as defined and found on www.gnu.org,
6846
+;;             http://www.gnu.org/licenses/gpl.html
6847
+;;
6848
+;;
6849
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6850
+;;
6851
+;;
6852
+;; - Immediate integer operand constraints
6853
+;;     'I'     -2^22 ... 2^22-1, or -4194304 .. 4194303        (LDI insn)
6854
+;;     'M'     -2^12 ... 2^12-1, or -4096 ... 4095             (MOV offset)
6855
+;;     'N'     -2^14 ... 2^14-1, or -16384 ... 16383           (OpB offset)
6856
+;;     'O'     -2^17 ... 2^17-1, or -131072 ... 131071         (OpB Immediate)
6857
+;;     'R'     0...31                                          (Shift value)
6858
+;; - Memory constraints
6859 111 dgisselq
+;;     "Q"     Op-B capable references to memory
6860
+;;     "S"     References to constant memory
6861 102 dgisselq
+;; - Address constraints
6862 111 dgisselq
+;;     "U"     Op-B capable address that references to memory
6863
+;;     "T"     Constant memory addresses
6864 102 dgisselq
+(define_constraint "M"
6865
+  "An 13-bit signed immediate such as a MOV instruction can handle"
6866
+  (and (match_code "const_int")
6867
+       (match_test "(ival < 0x1000) && (ival >= -0x1000)")))
6868
+(define_constraint "N"
6869
+  "An 14-bit signed immediate offset such as an Op-B register offset"
6870
+  (and (match_code "const_int")
6871
+       (match_test "(ival < 0x2000) && (ival >= -0x2000)")))
6872
+(define_constraint "O"
6873
+  "An 18-bit signed immediate such as an Op-B Immediate can handle"
6874
+  (and (match_code "const_int")
6875
+       (match_test "(ival < 0x20000) && (ival >= -0x20000)")))
6876
+(define_constraint "R"
6877
+  "Bits that a value may be shifted"
6878
+  (and (match_code "const_int")
6879
+       (match_test "(ival < 32) && (ival >= 0)")))
6880
+;;
6881
+;
6882
+;
6883
+; Our builtin functions, by identifier
6884
+;
6885
+(define_constants
6886 117 dgisselq
+       [(UNSPEC_RTU             1)
6887
+       (UNSPEC_HALT             2)
6888
+       (UNSPEC_IDLE             3)
6889
+       (UNSPEC_SYSCALL          4)
6890
+       (UNSPEC_SAVE_CONTEXT     5)
6891
+       (UNSPEC_RESTORE_CONTEXT  6)
6892
+       (UNSPEC_BITREV           7)
6893
+       (UNSPEC_GETUCC           8)
6894
+       (UNSPEC_GETCC            9)
6895
+       (UNSPEC_LDILO           10)
6896 102 dgisselq
+       ])
6897
+;
6898
+;
6899
+; Registers by name
6900
+(define_constants
6901
+  [(RTN_REG            0)      ; Return address register
6902
+   (RTNV_REG           1)      ; Subroutine return value register
6903
+   (AP_REG             10)     ; Hopefully never used
6904
+   (GBL_REG            11)     ; Hopefully never used, but just in case ...
6905
+   (FP_REG             12)
6906
+   (SP_REG             13)
6907
+   (CC_REG             14)
6908
+   (PC_REG             15)
6909
+  ])
6910
+;
6911
+;
6912
+;
6913
+
6914
+;; Predicates
6915
+(define_predicate "zip_const_address_operand_p"
6916
+       (match_code "symbol_ref,const,label_ref,code_label")
6917
+{
6918
+       return zip_const_address_operand(op);
6919
+})
6920
+
6921
+(define_predicate "zip_address_operand_p"
6922
+       (match_code "reg,plus")
6923
+{
6924 111 dgisselq
+       return zip_pd_opb_operand(op);
6925 102 dgisselq
+})
6926
+
6927 111 dgisselq
+(define_predicate "zip_opb_operand_p"
6928 122 dgisselq
+       (match_code "reg,plus,const_int,subreg")
6929 111 dgisselq
+{
6930
+       return zip_pd_opb_operand(op);
6931
+})
6932
+
6933 122 dgisselq
+(define_predicate "zip_opb_immv_p"
6934
+       (match_code "const_int")
6935
+{
6936
+       return (INTVAL(op)<((1<<13)-1))&&(INTVAL(op)>=-((1<<13)));
6937
+})
6938
+
6939 111 dgisselq
+(define_predicate "zip_opb_single_operand_p"
6940 122 dgisselq
+       (match_code "reg,subreg,const_int")
6941 111 dgisselq
+{
6942
+       return zip_pd_opb_operand(op);
6943
+})
6944
+
6945 102 dgisselq
+(define_predicate "zip_mov_operand_p"
6946
+       (match_code "reg,plus")
6947
+{
6948
+       return zip_pd_mov_operand(op);
6949
+})
6950
+
6951
+(define_predicate "zip_memory_operand_p"
6952
+       (match_code "mem")
6953
+{
6954 111 dgisselq
+       return zip_pd_opb_operand(XEXP(op,0));
6955 102 dgisselq
+})
6956
+
6957 111 dgisselq
+(define_predicate "zip_imm_operand_p"
6958
+       (match_code "const_int")
6959
+{
6960
+       return zip_pd_imm_operand(op);
6961
+})
6962
+
6963
+(define_predicate "zip_mvimm_operand_p"
6964
+       (match_code "const_int")
6965
+{
6966
+       return zip_pd_mvimm_operand(op);
6967
+})
6968
+
6969
+(define_predicate "zip_movdst_operand_p"
6970
+       (match_code "mem,reg,subreg")
6971
+{
6972
+       if (MEM_P(op)) // Check for valid store address
6973
+               return zip_pd_opb_operand(XEXP(op,0));
6974 122 dgisselq
+       else if (SUBREG_P(op))
6975
+               return 1;
6976
+       else if ((REG_P(op))||(SUBREG_P(op)))
6977
+               return register_operand(op, GET_MODE(op));
6978 111 dgisselq
+       return 1;
6979
+})
6980
+
6981
+(define_predicate "zip_movsrc_operand_p"
6982
+       (match_code "mem,reg,subreg,const_int,const,symbol_ref,label_ref,code_label")
6983
+{
6984
+       if (MEM_P(op))
6985
+               return zip_pd_opb_operand(XEXP(op,0));
6986
+       else if (GET_CODE(op)==PLUS)
6987
+               return zip_pd_opb_operand(op);
6988 122 dgisselq
+       else if (SUBREG_P(op)) {
6989
+               //; As far as predicates are concerned, subregs must be valid.
6990
+               //; The details of them are settled within the constraints.
6991
+               return 1;
6992
+       } else if ((REG_P(op))||(SUBREG_P(op)))
6993
+               return register_operand(op,SImode);
6994
+       else if (CONST_INT_P(op))
6995
+               return 1;
6996 111 dgisselq
+       return 1;
6997
+})
6998
+
6999 102 dgisselq
+;; Constraints
7000
+;
7001
+(define_memory_constraint "S"
7002
+       "Any memory referenced by a constant address, possibly unknown at compile time"
7003
+       (and (match_code "mem")
7004
+               (match_test "zip_ct_const_address_operand(XEXP(op,0))")))
7005
+(define_memory_constraint "Q"
7006
+       "Any memory addressed suitably for a load or store instruction"
7007
+       (and (match_code "mem")
7008
+               (match_test "zip_ct_address_operand(XEXP(op,0))")))
7009
+(define_address_constraint "U"
7010
+       "An address suitable for a load or store instruction"
7011
+       (and (match_code "reg,plus")
7012
+               (match_test "zip_ct_address_operand(op)")))
7013
+(define_address_constraint "T"
7014
+       "Any constant address, to include those made by symbols unknown at compile time"
7015
+       (and (match_code "label_ref,code_label,symbol_ref,const")
7016
+               (match_test "zip_ct_const_address_operand(op)")))
7017
+;
7018
+;
7019
+;; Attributes
7020
+;
7021
+(define_attr "predicable"  "no,yes" (const_string "yes"))
7022
+(define_attr "conditional" "no,yes" (const_string "no"))
7023
+(define_attr "ccresult" "set,unknown,unchanged,validzn" (const_string "set"))
7024
+;
7025
+; Mode attributes
7026
+; (define_mode_iterator ZI [QI HI SI])
7027
+; (define_mode_attr zipa [(QI "") (HI "") (SI "")])
7028
+(define_mode_iterator ZI [SI])
7029
+(define_mode_attr zipa [(SI "")])
7030
+;
7031
+;
7032
+;
7033
+;; Instructions
7034
+;
7035
+; (define_insn
7036
+;      optional name
7037
+;      RTL template -- a vector of incomplete RTL expressions describing the
7038
+;              semantics of the instruction.  It is incomplete because it may
7039
+;              contain match_operand, match_operator, and match_dup expressions
7040
+;      The condition --- contains a C expression, may be an empty string
7041
+;      output template or output statement--fragment of C code returning a str
7042
+;      Attributes --
7043
+;      )
7044
+;
7045
+; (match_operand:m n predicate constraint)
7046
+;      Placeholder for operand #n of the instruction
7047
+;      Predicate       string that is the name of a fucntion w/ 2 arguments:
7048
+;                              (expression, machine mode)
7049
+;              we can build functions:
7050
+;                      "isregister"    to describe a register
7051
+;                      "isimmediate"   to describe an immediate
7052
+;                      "offsetreg"     to describe a register plus offset
7053
+;                      "anyregister"   to describe *ANY* register (uRx or Rx)
7054
+;              But ... functions "address_operand", "immediate_operand",
7055
+;                      "register_operand", "indirect_operand"
7056
+;              "comparison_operatot" and "ordered_comparison_operator"
7057
+;              are also available--be aware, they include more comparisons
7058
+;              than Zip CPU can do.
7059
+;
7060
+;
7061
+;
7062
+;
7063
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7064
+;;
7065
+;; Move instructions: both
7066
+;      (arbitrary) from variables to variables, but this gets
7067
+;              expanded into:
7068
+;      from registers to registers
7069
+;      from immediates to registers
7070
+;;
7071
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7072
+;
7073
+;
7074
+;
7075
+(define_expand "mov<mode>"
7076 111 dgisselq
+       [(set (match_operand:ZI 0 "nonimmediate_operand" "")
7077
+               (match_operand:ZI 1 "general_operand" ""))]
7078 102 dgisselq
+       ""
7079 111 dgisselq
+       {//; Everything except mem=const or mem=mem can be done easily
7080
+       //; extern void zip_debug_rtx_pfx(const char *, const_rtx);
7081
+       //; fprintf(stderr, "ZIP-GEN-MOVE\n");
7082
+       //; zip_debug_rtx_pfx("FROM: ", operands[1]);
7083
+       //; zip_debug_rtx_pfx("TO  : ", operands[0]);
7084
+
7085
+       //; Need to load into a register between memory slots
7086
+       if ((MEM_P(operands[0]))&&(MEM_P(operands[1]))) {
7087
+               //; fprintf(stderr, "GEN-MOVSI: MEM -> MEM\n");
7088
+               if (can_create_pseudo_p()) {
7089
+                       rtx tmp = gen_reg_rtx(GET_MODE(operands[1]));
7090
+                       emit_insn(gen_movsi(tmp,operands[1]));
7091
+                       operands[1] = tmp;
7092
+               }
7093 102 dgisselq
+       }
7094 111 dgisselq
+
7095
+       //; Op[0] has a bad address, need to legitimize it
7096
+       if ((MEM_P(operands[0]))&&
7097
+               ((zip_const_address_operand(XEXP(operands[0],0)))
7098
+               ||(!zip_pd_opb_operand(XEXP(operands[0],0))))
7099
+               )
7100
+               {
7101
+               //; fprintf(stderr, "GEN-MOVSI: Not to a MEM(REG)\n");
7102
+               if (can_create_pseudo_p()) {
7103
+                       rtx tmp = gen_reg_rtx(Pmode);
7104
+                       //; Load the address into a register
7105
+                       emit_insn(gen_movsi(tmp,XEXP(operands[0],0)));
7106
+                       XEXP(operands[0],0) = tmp;
7107
+                       mark_reg_pointer(tmp,1);
7108
+               }
7109
+       }
7110
+       //; Op[1] is a constant.  Need to load into a register before we can
7111
+       //; place it into memory.
7112
+       if ((MEM_P(operands[0]))&&
7113
+               ((CONSTANT_P(operands[1]))
7114
+               ||(CONST_INT_P(operands[1])))) {
7115
+               //; fprintf(stderr, "GEN-MOVSI: CONST -> MEM\n");
7116
+               //; zip_debug_rtx_pfx("MEM  : ", operands[0]);
7117
+               //; zip_debug_rtx_pfx("CONST: ", operands[1]);
7118
+               if (can_create_pseudo_p()) {
7119
+                       rtx tmp = gen_reg_rtx(GET_MODE(operands[0]));
7120
+                       emit_insn(gen_movsi(tmp,operands[1]));
7121
+                       operands[1] = tmp;
7122
+               }
7123
+       }
7124
+       //; Op[1] has a bad address, need to legitimize it
7125
+       if ((MEM_P(operands[1]))&&
7126
+               //; (!REG_P(XEXP(operands[1],0)))
7127
+               ((zip_const_address_operand(XEXP(operands[1],0)))
7128 122 dgisselq
+               ||(!zip_pd_opb_operand(XEXP(operands[1],0))))) {
7129 111 dgisselq
+               //; fprintf(stderr, "GEN-MOVSI: Not from a MEM(REG)\n");
7130
+               if (can_create_pseudo_p()) {
7131
+                       rtx tmp = gen_reg_rtx(Pmode);
7132
+                       emit_insn(gen_movsi(tmp,XEXP(operands[1],0)));
7133
+                       XEXP(operands[1],0) = tmp;
7134
+               } else if (REG_P(operands[0])) { //; Can we steal Op[0]'s reg?
7135
+                       rtx tmp = operands[0];
7136
+                       emit_insn(gen_movsi(tmp,XEXP(operands[1],0)));
7137
+                       XEXP(operands[1],0) = tmp;
7138
+               }
7139
+       }
7140
+       }
7141 102 dgisselq
+       [(set_attr "ccresult" "unchanged")])
7142 111 dgisselq
+(define_insn "movsi_raw"
7143
+       [(set (match_operand:SI 0 "zip_movdst_operand_p" "=r,Q,r,r")
7144
+               (match_operand:SI 1 "zip_movsrc_operand_p" "r,r,Q,i"))]
7145 122 dgisselq
+       "(register_operand(operands[0],SImode))||(register_operand(operands[1],SImode))"
7146 111 dgisselq
+       "@
7147
+       MOV\t%1,%0
7148
+       STO\t%1,%0
7149
+       LOD\t%1,%0
7150
+       LDI\t%1,%0"
7151
+       [(set_attr "ccresult" "unchanged")])
7152 102 dgisselq
+(define_insn "mov<mode>_reg"   ; Register to register move
7153
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7154
+               (match_operand:ZI 1 "register_operand" "r"))]
7155
+       ""
7156
+       "MOV    %1,%0"
7157
+       [(set_attr "ccresult" "unchanged")])
7158 124 dgisselq
+(define_insn "mov<mode>_reg_off" ; Register to register move, used by prologue
7159 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7160
+               (plus:ZI (match_operand:ZI 1 "register_operand" "r")
7161 111 dgisselq
+                       (match_operand:ZI 2 "zip_mvimm_operand_p" "M")))
7162
+               ]
7163 102 dgisselq
+       ""
7164
+       "MOV    %2(%1),%0"
7165
+       [(set_attr "ccresult" "unchanged")])
7166 103 dgisselq
+;(define_insn "mov<mode>_lod"  ; Load from memory
7167
+;      [(set (match_operand:ZI 0 "register_operand" "=r")
7168
+;              (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
7169
+;      ""
7170
+;      "LOD    %1,%0"
7171
+;      [(set_attr "ccresult" "unchanged")])
7172
+;(define_insn "mov<mode>_sto"  ; Store into memory
7173
+;      [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
7174
+;              (match_operand:ZI 1 "register_operand" "r"))]
7175
+;      ""
7176
+;      "STO    %1,%0"
7177
+;      [(set_attr "ccresult" "unchanged")])
7178
+(define_expand "mov<mode>_lod" ; Load from memory
7179 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7180
+               (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
7181 103 dgisselq
+       "")
7182
+(define_insn "*movsi_lod"
7183
+       [(set (match_operand:SI 0 "register_operand" "=r")
7184 111 dgisselq
+               (match_operand:SI 1 "zip_memory_operand_p" ""))]
7185 102 dgisselq
+       ""
7186 103 dgisselq
+       "LOD\t%1,%0"
7187
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7188 124 dgisselq
+(define_insn "movsi_lod_off" ; used by epilogue code
7189
+       [(set (match_operand:SI 0 "register_operand" "=r")
7190
+               (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
7191
+                       (match_operand:SI 2 "const_int_operand" "N"))))]
7192
+       ""
7193
+       "LOD\t%2(%1),%0"
7194
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7195 103 dgisselq
+(define_expand "mov<mode>_sto" ; Store into memory
7196 102 dgisselq
+       [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
7197
+               (match_operand:ZI 1 "register_operand" "r"))]
7198 103 dgisselq
+       "")
7199
+(define_insn "*movsi_sto"
7200 111 dgisselq
+       [(set (match_operand:SI 0 "zip_memory_operand_p" "=Q")
7201 103 dgisselq
+               (match_operand:SI 1 "register_operand" "r"))]
7202 102 dgisselq
+       ""
7203 111 dgisselq
+       "STO\t%1,%0"
7204 103 dgisselq
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7205 124 dgisselq
+(define_insn "movsi_sto_off" ; used by prologue code
7206
+       [(set (mem:SI (plus:SI
7207
+                       (match_operand:SI 0 "register_operand" "r")
7208
+                       (match_operand:SI 1 "const_int_operand" "N")))
7209
+               (match_operand:SI 2 "register_operand" "r"))]
7210
+       ""
7211
+       "STO\t%2,%1(%0)"
7212
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7213 102 dgisselq
+(define_insn "mov<mode>_ldi"   ; Load immediate
7214
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7215
+               (match_operand:ZI 1 "immediate_operand" "ipU"))]
7216
+       ""
7217
+       "LDI    %1,%0"
7218
+       [(set_attr "ccresult" "unchanged")])
7219
+;
7220
+;
7221
+;
7222
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7223
+;;
7224
+;; Load and store multiple values
7225
+;;
7226
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7227
+;
7228
+; So far, from the code I've seen from GCC's output,
7229
+; these instructions do not appear to be necessary.
7230
+;
7231
+;(define_insn "load_multiple"
7232
+;      for(a=0; a<%2; a++)
7233
+;              LOD a(%1),%0+a
7234
+;(define_insn "store_multiple"
7235
+;      for(a=0; a<%2; a++)
7236
+;              STO %0+a,a(%1)
7237
+; pushsi -- Do not define, compiler will work around it nicely w/o our help
7238
+;
7239
+;
7240
+;
7241
+;
7242
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7243
+;;
7244
+;; General arithmetic instructions
7245
+;;
7246
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7247
+;
7248
+;
7249
+;
7250
+;
7251 111 dgisselq
+(define_expand "add<mode>3" ; Fastest/best instruction always goes first
7252 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7253 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7254 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7255
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))
7256
+               ]) ])
7257 111 dgisselq
+(define_insn "*addsi3_reg" ; Fastest/best instruction always goes first
7258 122 dgisselq
+       [(set (match_operand:SI 0 "register_operand" "=r")
7259
+               (plus:SI (match_operand:SI 1 "register_operand" "0")
7260
+                       (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7261
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7262 102 dgisselq
+       ""
7263
+       "ADD    %2,%0"
7264
+       [(set_attr "ccresult" "set")])
7265
+(define_insn "add<mode>3_off" ; Fastest/best instruction always goes first
7266
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7267 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7268
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7269 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7270
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7271 102 dgisselq
+       ""
7272
+       "ADD    %3+%2,%0"
7273
+       [(set_attr "ccresult" "set")])
7274
+;
7275
+;
7276
+;
7277 103 dgisselq
+(define_expand "sub<mode>3"
7278 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7279 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7280 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7281 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])])
7282 111 dgisselq
+(define_insn "sub<mode>3_reg"
7283 103 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7284
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7285 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7286 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7287 102 dgisselq
+       ""
7288
+       "SUB    %2,%0"
7289
+       [(set_attr "ccresult" "set")])
7290
+(define_insn "sub<mode>3_off"
7291
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7292 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7293
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "%r")
7294 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7295
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7296 102 dgisselq
+       ""
7297
+       "SUB    %3+%2,%0"
7298
+       [(set_attr "ccresult" "set")])
7299
+(define_insn "mul<mode>3"
7300
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7301
+               (mult:ZI (match_operand:ZI 1 "register_operand" "%r")
7302
+                       (match_operand:ZI 2 "register_operand" "r")))
7303 122 dgisselq
+       (clobber (match_scratch:ZI 3 "=r"))
7304
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7305 102 dgisselq
+       ; "(R0 != R1)&&(R0 != R2)&&(R0!=R3)&&(R1!=R2)&&(R1=R3)&&(R2!=R3)"
7306
+       ""
7307
+       "MOV    %1,%0
7308
+       MPYS    %2,%0
7309
+       MOV     %1,%3
7310
+       ROL     16,%3
7311
+       MPYS    %2,%3
7312
+       ROL     16,%3
7313
+       AND     0x0ffff,%3
7314
+       ADD     %3,%0
7315
+       MOV     %2,%3
7316
+       ROL     16,%3
7317
+       MPYS    %1,%3
7318
+       ROL     16,%3
7319
+       AND     0x0ffff,%3
7320
+       ADD     %3,%0"
7321
+       [(set_attr "ccresult" "unknown")])
7322
+
7323 111 dgisselq
+(define_expand "div<mode>3"
7324 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7325 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7326 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7327
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
7328 111 dgisselq
+       "(ZIP_DIVIDE)")
7329
+(define_insn "div<mode>3_reg"
7330
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7331
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7332 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7333
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7334 111 dgisselq
+       "(ZIP_DIVIDE)"
7335 102 dgisselq
+       "DIVS   %2,%0"
7336
+       [(set_attr "ccresult" "set")])
7337
+(define_insn "div<mode>3_off"
7338
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7339 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7340
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7341 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7342
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7343 111 dgisselq
+       "(ZIP_DIVIDE)"
7344 102 dgisselq
+       "DIVS   %3+%2,%0"
7345
+       [(set_attr "ccresult" "set")])
7346 111 dgisselq
+(define_expand "udiv<mode>3"
7347 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7348 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7349 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7350
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
7351 111 dgisselq
+       "(ZIP_DIVIDE)")
7352
+(define_insn "udiv<mode>3_reg"
7353
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7354
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7355 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7356
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7357 111 dgisselq
+       "(ZIP_DIVIDE)"
7358 102 dgisselq
+       "DIVU   %2,%0"
7359
+       [(set_attr "ccresult" "set")])
7360
+(define_insn "udiv<mode>3_off"
7361
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7362 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7363
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7364 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7365
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7366 111 dgisselq
+       "(ZIP_DIVIDE)"
7367 102 dgisselq
+       "DIVU   %3+%2,%0"
7368
+       [(set_attr "ccresult" "set")])
7369
+;;
7370
+;; modsi3
7371
+;; umodsi3
7372
+;;
7373
+(define_insn "umin<mode>3"
7374
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7375
+               (umin:ZI (match_operand:ZI 1 "register_operand" "%0")
7376
+                       (match_operand:ZI 2 "register_operand" "r")))
7377 122 dgisselq
+       (clobber (reg:CC CC_REG))
7378 102 dgisselq
+       ]
7379
+       ""
7380
+       "CMP    %0,%2
7381
+       MOV.C   %2,%0"
7382
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7383
+(define_insn "umax<mode>3"
7384
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7385
+               (umax:ZI (match_operand:ZI 1 "register_operand" "%0")
7386
+                       (match_operand:ZI 2 "register_operand" "r")))
7387 122 dgisselq
+       (clobber (reg:CC CC_REG))
7388 102 dgisselq
+       ]
7389
+       ""
7390
+       "CMP    %2,%0
7391
+       MOV.C   %2,%0"
7392
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7393
+(define_insn "smin<mode>3"
7394
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7395
+               (smin:ZI (match_operand:ZI 1 "register_operand" "%0")
7396
+                       (match_operand:ZI 2 "register_operand" "r")))
7397 122 dgisselq
+       (clobber (reg:CC CC_REG))
7398 102 dgisselq
+       ]
7399
+       ""
7400
+       "CMP    %2,%0
7401
+       MOV.GT  %2,%0"
7402
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7403
+(define_insn "smax<mode>3"
7404
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7405
+               (smax:ZI (match_operand:ZI 1 "register_operand" "%0")
7406
+                       (match_operand:ZI 2 "register_operand" "r")))
7407 122 dgisselq
+       (clobber (reg:CC CC_REG))
7408 102 dgisselq
+       ]
7409
+       ""
7410
+       "CMP    %0,%2
7411
+       MOV.LT  %2,%0"
7412
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7413 111 dgisselq
+(define_expand "and<mode>3"
7414 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7415 102 dgisselq
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
7416 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7417
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])])
7418 111 dgisselq
+(define_insn "and<mode>3_reg"
7419
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7420
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
7421 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7422
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7423 102 dgisselq
+       ""
7424
+       "AND    %2,%0"
7425
+       [(set_attr "ccresult" "set")])
7426
+(define_insn "and<mode>3_off"
7427
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7428
+               (and:ZI (match_operand:ZI 1 "register_operand" "0")
7429
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7430 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7431
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7432 102 dgisselq
+       ""
7433
+       "AND    %3+%2,%0"
7434
+       [(set_attr "ccresult" "set")])
7435 111 dgisselq
+(define_expand "ior<mode>3"
7436 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7437 102 dgisselq
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
7438 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7439
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])])
7440 111 dgisselq
+(define_insn "ior<mode>3_reg"
7441
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7442
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
7443 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7444
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7445 102 dgisselq
+       ""
7446
+       "OR     %2,%0"
7447
+       [(set_attr "ccresult" "set")])
7448
+(define_insn "ior<mode>3_off"
7449
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7450
+               (ior:ZI (match_operand:ZI 1 "register_operand" "0")
7451
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7452 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7453
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7454 102 dgisselq
+       ""
7455
+       "OR     %3+%2,%0"
7456
+       [(set_attr "ccresult" "set")])
7457 111 dgisselq
+(define_expand "xor<mode>3"
7458 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7459 102 dgisselq
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
7460 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7461
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
7462
+       "")
7463 111 dgisselq
+(define_insn "xor<mode>3_reg"
7464
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7465
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
7466 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7467
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7468 102 dgisselq
+       ""
7469
+       "XOR    %2,%0"
7470
+       [(set_attr "ccresult" "set")])
7471
+(define_insn "xor<mode>3_off"
7472
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7473
+               (xor:ZI (match_operand:ZI 1 "register_operand" "0")
7474
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7475 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7476
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7477 102 dgisselq
+       ""
7478
+       "XOR    %3+%2,%0"
7479
+       [(set_attr "ccresult" "set")])
7480
+;(define_insn "addv<mode>4"
7481
+       ;[(set (match_operand:ZI 0 "register_operand" "=r")
7482
+               ;(plus:ZI (match_operand:ZI 1 "register_operand" "%r")
7483
+                       ;(match_operand:ZI 2 "general_operand" "rO")))
7484 122 dgisselq
+       ;(set (pc) (if_then_else (eq (reg:CC CC_REG) (const_int 0))
7485 102 dgisselq
+                       ;(label_ref (match_operand 3))
7486
+                       ;(pc)))]
7487
+       ;""
7488
+       ;"MOV   %1,%0
7489
+       ;ADD    %2,%0
7490
+       ;BV     %3"
7491
+       ;[(set_attr "predicable" "no") (set_attr "ccresult" "set")])
7492
+;;(define_insn "subvsi4"
7493
+;;     MOV     %1,%0
7494
+;;     SUB     %2,%0
7495
+;;     BV      %3
7496
+;;(mulvsi4)
7497
+;;(define_insn "uaddvsi4"
7498
+;;     ADD     %2,%0
7499
+;;     BC      %3
7500
+;;(define_insn "usubvsi4"
7501
+;;     MOV     %1,%0
7502
+;;     SUB     %2,%0
7503
+;;     BC      %3
7504
+;;
7505
+;; (define_insn "umulvsi4"
7506
+;;     ... ???)
7507
+;;
7508
+(define_insn "ashr<mode>3"
7509
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7510
+               (ashiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
7511 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
7512
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7513 102 dgisselq
+       ""
7514
+       "ASR    %2,%0"
7515
+       [(set_attr "ccresult" "set")])
7516 111 dgisselq
+(define_insn "ashl<mode>3"
7517
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7518
+               (ashift:ZI (match_operand:ZI 1 "register_operand" "0")
7519 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
7520
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7521 111 dgisselq
+       ""
7522 122 dgisselq
+       "LSL    %2,%0"
7523 111 dgisselq
+       [(set_attr "ccresult" "set")])
7524 102 dgisselq
+(define_insn "lshr<mode>3"
7525
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7526
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
7527 122 dgisselq
+                       (match_operand:ZI 2 "register_operand" "rR")))
7528
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7529 102 dgisselq
+       ""
7530
+       "LSR    %2,%0"
7531
+       [(set_attr "ccresult" "set")])
7532
+(define_insn "rotl<mode>3"
7533
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7534
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
7535 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
7536
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7537 102 dgisselq
+       ""
7538
+       "ROL    %2,%0"
7539
+       [(set_attr "ccresult" "set")])
7540
+;
7541
+(define_insn "neg<mode>2"
7542
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7543
+               (neg:ZI (match_operand:ZI 1 "register_operand" "r")))
7544 122 dgisselq
+       (clobber (reg:CC CC_REG))]
7545 102 dgisselq
+       ""
7546
+       "NEG    %1,%0"
7547
+       [(set_attr "ccresult" "validzn")])
7548
+(define_insn "abs<mode>2"
7549
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7550
+               (abs:ZI (match_operand:ZI 1 "register_operand" "0")))
7551 122 dgisselq
+       (clobber (reg:CC CC_REG))]
7552 102 dgisselq
+       ""
7553
+       "TEST   %0
7554
+       NEG.LT  %0"
7555
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7556
+(define_insn "popcount<mode>2"
7557
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7558
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
7559 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7560 102 dgisselq
+       ""
7561
+       "POPC   %1,%0"
7562
+       [(set_attr "ccresult" "set")])
7563
+(define_expand "parity<mode>2"
7564 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7565 102 dgisselq
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
7566 122 dgisselq
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
7567
+       (parallel [
7568
+               (set (match_dup 0) (and:ZI (match_dup 0) (const_int -2)))
7569
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
7570 102 dgisselq
+       ])
7571
+(define_insn "one_cmpl<mode>2"
7572
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7573
+               (not:ZI (match_operand:ZI 1 "register_operand" "0")))
7574 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7575 102 dgisselq
+       ""
7576
+       "XOR    -1,%0"
7577
+       [(set_attr "ccresult" "set")])
7578
+;
7579
+;
7580
+;
7581
+;
7582 117 dgisselq
+;
7583 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7584
+;;
7585
+;; General arithmetic instructions -- double words
7586
+;;
7587
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7588
+;
7589
+;
7590
+;
7591 111 dgisselq
+(define_expand "movdi3"
7592
+       [(set (match_operand:DI 0 "nonimmediate_operand" "")
7593
+               (match_operand:DI 1 "general_operand" ""))])
7594
+(define_insn "movdi_lod"
7595
+       [(set (match_operand:DI 0 "register_operand" "=r")
7596 122 dgisselq
+               (mem:DI (match_operand:SI 1 "zip_opb_operand_p" "")))]
7597 111 dgisselq
+       ""
7598
+       {
7599 122 dgisselq
+               if (REG_P(operands[1]))
7600 111 dgisselq
+                       return "LOD\t(%1),%H0\n\tLOD\t1(%1),%L0";
7601 122 dgisselq
+               else if (GET_CODE(operands[1])==PLUS) {
7602
+                       if ((REG_P(XEXP(operands[1],0)))
7603
+                               &&(CONST_INT_P(XEXP(operands[1],1)))) {
7604 111 dgisselq
+                               static  char    buf[64];
7605
+                               sprintf(buf,
7606
+                                       "LOD\t%ld(%%1),%%H0\n\tLOD\t%ld(%%1),%%L0",
7607 122 dgisselq
+                                       INTVAL(XEXP(operands[1],1)),
7608
+                                       INTVAL(XEXP(operands[1],1)+1));
7609 111 dgisselq
+                               return buf;
7610
+                       }
7611 122 dgisselq
+               } return "BREAK";
7612 111 dgisselq
+       }
7613
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7614
+(define_insn "movdi_sto"
7615
+       [(set (mem:DI (match_operand:SI 0 "zip_opb_operand_p" ""))
7616
+               (match_operand:DI 1 "register_operand" "r"))]
7617
+       ""
7618
+       {
7619
+               if (REG_P(operands[0]))
7620
+                       return "STO\t%H0,(%1)\n\tSTO\t%L0,1(%1)";
7621
+               else if (GET_CODE(operands[0])==PLUS) {
7622
+                       if ((REG_P(XEXP(operands[0],0)))
7623
+                               &&(CONST_INT_P(XEXP(operands[0],1)))) {
7624
+                               static  char    buf[64];
7625
+                               sprintf(buf,
7626
+                                       "STO\t%%H0,%ld(%%1)\n\tSTO\t%%L0,%ld(%%1)",
7627
+                                       INTVAL(XEXP(operands[0],1)),
7628
+                                       INTVAL(XEXP(operands[0],1)+1));
7629
+                               return buf;
7630
+                       }
7631
+               } else return "BREAK";
7632
+       }
7633
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7634
+(define_insn "movdi_ldi"
7635
+       [(set (match_operand:DI 0 "register_operand" "=r")
7636
+               (match_operand:DI 1 "immediate_operand" "i"))]
7637
+       ""
7638
+       "LDI\t%H1,%H0\n\tLDI\t%L1,%L0"
7639
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7640 102 dgisselq
+(define_insn "adddi3" ; Fastest/best instruction always goes first
7641
+       [(set (match_operand:DI 0 "register_operand" "=r")
7642 103 dgisselq
+               (plus:DI (match_operand:DI 1 "register_operand" "0")
7643 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
7644 122 dgisselq
+       (clobber (reg:CC CC_REG))
7645 102 dgisselq
+       ]
7646
+       ""
7647
+       "ADD    %L2,%L0\n\tADD.C\t1,%H0\n\tADD\t%H2,%H0"
7648
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7649
+;
7650
+(define_insn "subdi3"
7651
+       [(set (match_operand:DI 0 "register_operand" "=r")
7652 103 dgisselq
+               (minus:DI (match_operand:DI 1 "register_operand" "0")
7653 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
7654 122 dgisselq
+       (clobber (reg:CC CC_REG))
7655 102 dgisselq
+       ]
7656
+       ""
7657
+       "SUB    %L2,%L0\n\tSUB.C\t1,%H0\n\tSUB\t%H2,%H0"
7658
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7659
+;
7660
+(define_insn "anddi3"
7661
+       [(set (match_operand:DI 0 "register_operand" "=r")
7662
+               (and:DI (match_operand:DI 1 "register_operand" "%0")
7663
+                       (match_operand:DI 2 "register_operand" "r")))
7664 122 dgisselq
+       (clobber (reg:CC CC_REG))
7665 102 dgisselq
+       ]
7666
+       ""
7667
+       "AND    %L2,%L0\n\tAND\t%H2,%H0"
7668
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7669
+;
7670
+(define_insn "iordi3"
7671
+       [(set (match_operand:DI 0 "register_operand" "=r")
7672
+               (ior:DI (match_operand:DI 1 "register_operand" "%0")
7673
+                       (match_operand:DI 2 "register_operand" "r")))
7674 122 dgisselq
+       (clobber (reg:CC CC_REG))
7675 102 dgisselq
+       ]
7676
+       ""
7677
+       "OR     %2,%0\n\tOR\t%H2,%H0"
7678
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7679
+;
7680
+(define_insn "xordi3"
7681
+       [(set (match_operand:DI 0 "register_operand" "=r")
7682
+               (xor:DI (match_operand:DI 1 "register_operand" "%0")
7683
+                       (match_operand:DI 2 "register_operand" "r")))
7684 122 dgisselq
+       (clobber (reg:CC CC_REG))
7685 102 dgisselq
+       ]
7686
+       ""
7687
+       "XOR    %2,%0\n\tXOR\t%H2,%H0"
7688
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7689
+;
7690
+(define_insn "negdi2"
7691
+       [(set (match_operand:DI 0 "register_operand" "=r")
7692 122 dgisselq
+               (neg:DI (match_operand:DI 1 "register_operand" "0")))
7693
+       (clobber (reg:CC CC_REG))
7694
+       ]
7695 102 dgisselq
+       ""
7696
+       "XOR    -1,%L0\n\tXOR\t-1,%H0\n\tADD\t1,%L0\n\tADD.C\t1,%H0"
7697
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7698
+;
7699
+(define_insn "absdi2"
7700 122 dgisselq
+       [(set (match_operand:DI 0 "register_operand" "=r")
7701
+               (abs:DI (match_operand:DI 1 "register_operand" "0")))
7702
+       (clobber (match_scratch:SI 2 "=r"))
7703
+       (clobber (reg:CC CC_REG))
7704
+       ]
7705 102 dgisselq
+       ""
7706
+       "CLR    %2
7707
+       TEST    %H0             ; Problem, we can't tell conditions
7708
+       LDILO.LT        1,%2
7709
+       XOR.LT  -1,%L0
7710
+       XOR.LT  -1,%H0
7711
+       ADD     %2,%L0
7712 122 dgisselq
+       ADD.C   1,%H0"
7713 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7714
+(define_insn "one_cmpldi2"
7715
+       [(set (match_operand:DI 0 "register_operand" "=r")
7716
+               (not:DI (match_operand:DI 1 "register_operand" "0")))
7717 122 dgisselq
+       (clobber (reg:CC CC_REG))
7718 102 dgisselq
+       ]
7719
+       ""
7720
+       "XOR    -1,%L0\n\tXOR\t-1,%H0"
7721
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7722
+(define_insn "umindi3"
7723
+       [(set (match_operand:DI 0 "register_operand" "=r")
7724
+               (umin:DI (match_operand:DI 1 "register_operand" "%0")
7725
+                       (match_operand:DI 2 "register_operand" "r")))
7726 122 dgisselq
+       (clobber (reg:CC CC_REG))
7727 102 dgisselq
+       ]
7728
+       ""
7729
+       "CMP    %H0,%H2
7730
+       CMP.Z   %L0,%L2
7731
+       MOV.C   %H2,%H0
7732
+       MOV.C   %L2,%L0"
7733
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7734
+(define_insn "umaxdi3"
7735
+       [(set (match_operand:DI 0 "register_operand" "=r")
7736
+               (umax:DI (match_operand:DI 1 "register_operand" "%0")
7737
+                       (match_operand:DI 2 "register_operand" "r")))
7738 122 dgisselq
+       (clobber (reg:CC CC_REG))
7739 102 dgisselq
+       ]
7740
+       ""
7741
+       "CMP    %H2,%H0
7742
+       CMP.Z   %L2,%L0
7743
+       MOV.C   %H2,%H0
7744
+       MOV.C   %L2,%L0"
7745
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7746
+(define_insn "popcountdi2"
7747
+       [(set (match_operand:SI 0 "register_operand" "=r")
7748 122 dgisselq
+               (popcount:SI (match_operand:DI 1 "register_operand" "r")))
7749 102 dgisselq
+       (clobber (match_scratch:SI 2 "=r"))
7750 122 dgisselq
+       (clobber (reg:CC CC_REG))
7751 102 dgisselq
+       ]
7752
+       ""
7753
+       "POPC   %L1,%0
7754
+       POPC    %H1,%2
7755
+       ADD     %2,%0"
7756
+       [(set_attr "predicable" "no") (set_attr "ccresult" "set")])
7757
+(define_expand "paritydi2"
7758
+       [(set (match_operand:SI 0 "register_operand" "=r")
7759
+               (popcount (match_operand:DI 1 "register_operand" "r")))
7760
+       (set (match_dup 0) (and:SI (match_dup 0) (const_int -2)))
7761
+       ])
7762 117 dgisselq
+;(define_insn "extendsidi2"
7763
+;      [(set (match_operand:DI 0 "register_operand" "=r")
7764
+;              (sign_extend:DI (match_operand:SI 0 "register_operand" "r")))]
7765
+;      ""
7766
+;      "TEST\t%1\nMOV\t%1,%L0\nCLR\t%L1\nLDI.LT\t-1,%L1"
7767
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7768
+;(define_insn "mulsidi3"
7769
+;      [(set (match_operand:DI 0 "register_operand" "=r")
7770
+;              (mult:SI (match_operand:SI 1 "register_operand" "%r")
7771
+;                      (match_operand:SI 2 "register_operand" "r")))
7772
+;      (clobber (match_scratch:SI 3 "=r"))]
7773
+;      ; "(R0 != R1)&&(R0 != R2)&&(R0!=R3)&&(R1!=R2)&&(R1=R3)&&(R2!=R3)"
7774
+;      ""
7775
+;      "MOV    %1,%L0
7776
+;      MPYS    %2,%L0                  ; L0 = R2 * R1
7777
+;      MOV     %1,%3                   ; R3 = R1
7778
+;      ROL     16,%3                   ; R3 = (R1 <<< 16)
7779
+;      MPYS    %2,%3                   ; R3 = (R1 <<< 16) * R2
7780
+;      ROL     16,%3                   ; R3 = upper bits of (R1<<<16)*R2
7781
+;      AND     0x0ffff,%3
7782
+;      ADD     %3,%L0                  ; L0 = L0 + R3 = L0  + (R1>>16)*R2
7783
+;      MOV     %2,%3
7784
+;      ROL     16,%3
7785
+;      MPYS    %1,%3
7786
+;      ROL     16,%3
7787
+;      AND     0x0ffff,%3
7788
+;      ADD     %3,%0"
7789
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7790
+
7791 102 dgisselq
+;
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 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_operand:ZI 2 "register_operand" "r")
7808
+               (match_operand:ZI 3 "zip_opb_operand_p" "rO")))
7809 102 dgisselq
+       (set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
7810
+                       (match_operator 1 "ordered_comparison_operator"
7811 122 dgisselq
+                                       [(reg:CC CC_REG) (const_int 0)])
7812 102 dgisselq
+                       (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 122 dgisselq
+                       [(match_operand:DI 2 "register_operand" "r")
7819
+                               (match_operand:DI 3 "register_operand" "r")])
7820
+                       (const_int 1) (const_int 0)))
7821
+       (clobber (reg:CC CC_REG))]
7822 102 dgisselq
+       ""
7823
+       {
7824
+               switch(GET_CODE(operands[1])) {
7825
+               case EQ:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.Z\t1,%0\n";
7826
+               case NE:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.NZ\t%L3,%L2\n\tLDILO.NZ\t1,%0\n";
7827
+               case LTU:       return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.C\t1,%0\n";
7828
+               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";
7829
+               case GTU:       return "CLR\t%0\n\tCMP\t%H2,%H3\n\tCMP.Z\t%L2,%L3\n\tLDILO.C\t1,%0\n";
7830
+               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";
7831
+               default:
7832
+                       gcc_unreachable();
7833
+               }
7834
+       }
7835
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7836
+;
7837
+;
7838
+;
7839
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7840
+;;
7841
+;; Comparison instructions, both compare and test
7842
+;;
7843
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7844
+;
7845
+;
7846
+;
7847
+;; This will only work so well, since the direction of the compare is
7848
+;; important in unsigned compares.
7849
+;;
7850 122 dgisselq
+(define_expand "cmp<mode>"
7851
+       [(set (reg:CC CC_REG) (compare:CC
7852
+               (match_operand:ZI 0 "register_operand" "r")
7853
+               (match_operand:ZI 1 "nonmemory_operand" "")))]
7854 102 dgisselq
+       ""
7855 122 dgisselq
+       {
7856
+               if (!zip_opb_operand_p(operands[1],SImode)) {
7857
+                       if (can_create_pseudo_p()) {
7858
+                               //; fprintf(stderr, "Generating pseudo register for compare\n");
7859
+                               rtx tmp = gen_reg_rtx(SImode);
7860
+                               emit_insn(gen_movsi(tmp,operands[1]));
7861
+                               operands[1] = tmp;
7862
+                       } else FAIL;
7863
+               }
7864
+       })
7865
+(define_insn "cmp<mode>_reg"
7866
+       [(set (reg:CC CC_REG) (compare:CC
7867
+               (match_operand:ZI 0 "register_operand" "r")
7868
+               (match_operand:ZI 1 "zip_opb_single_operand_p" "rO")))]
7869
+       ""
7870 102 dgisselq
+       "CMP\t%1,%0"
7871
+       [(set_attr "ccresult" "set")])
7872
+(define_insn "cmp<mode>_off"
7873 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
7874
+               (match_operand:ZI 0 "register_operand" "r")
7875 117 dgisselq
+               (plus (match_operand:ZI 1 "register_operand" "r")
7876 122 dgisselq
+                       (match_operand 2 "zip_opb_immv_p" "N"))))]
7877 102 dgisselq
+       ""
7878
+       "CMP\t%2+%1,%0"
7879
+       [(set_attr "ccresult" "set")])
7880
+(define_insn "test<mode>"
7881 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (and:ZI (match_operand:ZI 0 "register_operand" "r")
7882
+                               (match_operand:ZI 1 "zip_opb_single_operand_p" "rO"))
7883 102 dgisselq
+                       (const_int 0)))]
7884
+       ""
7885
+       "TEST   %1,%0"
7886
+       [(set_attr "ccresult" "set")])
7887
+(define_insn "test<mode>_off"
7888 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
7889
+               (and:ZI (match_operand:ZI 0 "register_operand" "r")
7890
+                       (plus:ZI
7891
+                               (match_operand:ZI 1 "register_operand" "r")
7892
+                               (match_operand:ZI 2 "zip_opb_immv_p" "N")))
7893
+               (const_int 0)))]
7894 102 dgisselq
+       ""
7895
+       "TEST   %2+%1,%0"
7896
+       [(set_attr "ccresult" "set")])
7897
+(define_insn "nop"
7898
+       [(const_int 0)]
7899
+       ""
7900
+       "NOOP"
7901
+       [(set_attr "ccresult" "unchanged")])
7902
+;
7903
+;
7904
+;
7905
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7906
+;;
7907
+;; Conditional execution predicates
7908
+;;
7909
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7910
+;
7911
+; Sadly, these aren't complete like they should be.  Although these are all of
7912
+; the conditional execution prefixes that the Zip CPU supports, GCC looks for
7913
+; other conditions then these.  That is, (cond_exec ...) is not as well
7914
+; recognized as (if_then_else ...).  So we have to duplicate things to support
7915
+; both methods.
7916
+;
7917
+(define_cond_exec
7918 122 dgisselq
+       [(ne (reg:CC CC_REG) (const_int 0))]
7919 102 dgisselq
+       ""
7920
+       "(NZ)"
7921
+       [(set_attr "conditional" "yes")])
7922
+(define_cond_exec
7923 122 dgisselq
+       [(lt (reg:CC CC_REG) (const_int 0))]
7924 102 dgisselq
+       ""
7925
+       "(LT)"
7926
+       [(set_attr "conditional" "yes")])
7927
+(define_cond_exec
7928 122 dgisselq
+       [(eq (reg:CC CC_REG) (const_int 0))]
7929 102 dgisselq
+       ""
7930
+       "(Z)"
7931
+       [(set_attr "conditional" "yes")])
7932
+(define_cond_exec
7933 122 dgisselq
+       [(gt (reg:CC CC_REG) (const_int 0))]
7934 102 dgisselq
+       ""
7935
+       "(GT)"
7936
+       [(set_attr "conditional" "yes")])
7937
+(define_cond_exec
7938 122 dgisselq
+       [(ge (reg:CC CC_REG) (const_int 0))]
7939 102 dgisselq
+       ""
7940
+       "(GE)"
7941
+       [(set_attr "conditional" "yes")])
7942
+(define_cond_exec
7943 122 dgisselq
+       [(ltu (reg:CC CC_REG) (const_int 0))]
7944 102 dgisselq
+       ""
7945
+       "(C)"
7946
+       [(set_attr "conditional" "yes")])
7947
+;
7948
+;
7949
+;
7950
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7951
+;;
7952
+;; Conditional move instructions, since these won't accept conditional
7953
+;;     execution RTL
7954
+;;
7955
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7956
+;
7957
+; // Look for #define HAVE_conditional_move to understand how these might be
7958
+; // used.
7959
+;
7960
+(define_insn "set_zero_or_one<mode>"
7961
+       [(set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
7962
+                       (match_operator 1 "ordered_comparison_operator"
7963 122 dgisselq
+                                       [(reg:CC CC_REG) (const_int 0)])
7964 102 dgisselq
+                       (const_int 1) (const_int 0)))]
7965
+       ""
7966
+       { return (zip_set_zero_or_one(operands[1], operands[0]));
7967
+       }
7968
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7969
+(define_insn "mov<mode>cc"
7970
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7971
+               (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
7972 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
7973 102 dgisselq
+                       (match_operand:ZI 2 "general_operand" "rio")
7974
+                       (match_operand:ZI 3 "nonmemory_operand" "rio")))]
7975
+       ""
7976
+       {
7977
+       return zip_movsicc(operands[0], operands[1], operands[2], operands[3]);
7978
+       }
7979
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7980
+(define_insn "add<mode>cc"
7981
+       [(set (match_operand:ZI 0 "register_operand" "=r,r")
7982
+               (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
7983 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
7984 102 dgisselq
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "0,r")
7985
+                               (match_operand:ZI 3 "nonmemory_operand" "rO,M"))
7986
+                       (match_dup 0)))]
7987
+       ""
7988
+       {
7989
+       return zip_addsicc(operands[0], operands[1], operands[2], operands[3]);
7990
+       }
7991
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7992
+;
7993
+;
7994
+;(define_expand "mov<mode>cc"
7995
+;      [(set (match_operand:ZI 0 "general_operand" "=rm,rm,r,r,r"
7996
+;              (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
7997 122 dgisselq
+;                      [(reg:CC CC_REG) (const_int 0)])
7998 102 dgisselq
+;                      (match_operand:ZI 2 "general_operand" "0,r,0,m,rm")
7999
+;                      (match_operand:ZI 3 "general_operand" "r,0,m,0,rm"))))]
8000
+;      )
8001
+;
8002
+;
8003
+;
8004
+; While an interesting approach, the following suffers from problems when the
8005
+; move amount is constant.  At anything less than four, moves should not require
8006
+; the movmemSI instruction.  At anything greater, if constant, the initial tests
8007
+; are not required and should result in a hardcoded result.  Practically,
8008
+; though, this should really be a define_expand instruction, calling on the
8009
+; RTX's of all the respective subinstructions found below.
8010
+;
8011
+;(define_insn "movmemSI"
8012
+;      [(parallel [(set (mem:BLK (match_operand 0 "register_operand" "+r"));Dst
8013
+;                      (mem:BLK (match_operand 1 "register_operand" "+r")));Src
8014
+;              (use (match_operand:SI 2 "register_operand" "+r"))]); Length
8015
+;              (match_operand 3 "" "")                 ;Alignment
8016
+;              (clobber (match_scratch:SI 4 "=r"))
8017
+;              (clobber (match_scratch:SI 5 "=r"))
8018
+;              (clobber (match_scratch:SI 6 "=r"))
8019
+;              (clobber (match_scratch:SI 7 "=r"))]
8020
+;      ""
8021
+;      "TEST\t1,%2
8022
+;      LOD.NZ\t%1,%4
8023
+;      STO.NZ\t%4,%0
8024
+;      ADD.NZ\t1,%0
8025
+;      ADD.NZ\t1,%1
8026
+;      TEST\t2,%2
8027
+;      LOD.NZ\t%1,%4
8028
+;      LOD.NZ\t1(%1),%5
8029
+;      STO.NZ\t%4,(%0)
8030
+;      STO.NZ\t%4,1(%0)
8031
+;      ADD.NZ\t2,%0
8032
+;      ADD.NZ\t2,%1
8033
+;      AND\t-4,%2
8034
+;      BZ\t.Lskp%=\n.Ltop%=:
8035
+;      LOD\t(%1),%4
8036
+;      LOD\t1(%1),%5
8037
+;      LOD\t2(%1,%6
8038
+;      LOD\t3(%1),%7
8039
+;      STO\t%4,(%1)
8040
+;      STO\t%5,1(%1)
8041
+;      STO\t%6,2(%1)
8042
+;      STO\t%7,3(%1)
8043
+;      SUB\t4,%2
8044
+;      BZ\t%.Lskp%=
8045
+;      BRA\t.Ltop%=\n.Lskp%=:"
8046
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8047
+;(define_insn "setmemsi"
8048
+;      [(parallel
8049
+;              [(set (mem:BLK
8050
+;                      (match_operand 0 "register_operand" "+r")); Destination
8051
+;                      (match_operand:SI 2 "register_operand" "r")) ; Source
8052
+;              (use (match_operand:SI 1 "register_operand" "+r"))])  ; Length
8053
+;              (match_operand 3 "" "")]
8054
+;      ""
8055
+;      "TEST\t1,%1
8056
+;      STO.NZ\t%2,(%0)
8057
+;      ADD.NZ\t1,%0
8058
+;      TEST\t2,%1
8059
+;      STO.NZ\t%2,(%0)
8060
+;      STO.NZ\t%2,1(%0)
8061
+;      ADD.NZ\t2,%0
8062
+;      AND\t-4,%1
8063
+;      BZ\t.Lskp%=\n.Ltop%=:\n
8064
+;      STO\t%2,(%0)
8065
+;      STO\t%2,1(%0)
8066
+;      STO\t%2,2(%0)
8067
+;      STO\t%2,3(%0)
8068
+;      SUB\t%4,%0
8069
+;      BZ\t.Lskp%=
8070
+;      BRA\t.Ltop%=\n.Lskp%=:"
8071
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8072
+;;
8073
+;
8074
+;
8075
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8076
+;;
8077
+;; Control flow instructions
8078
+;;
8079
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8080
+;
8081
+;
8082
+;
8083
+(define_expand "jump"
8084
+       [(set (pc)
8085
+               (label_ref (match_operand 0 "" "")))]); // Was general-op, "mro"
8086
+(define_insn "jump_const"      ; Must be modeless, VOIDmode, not SI or any othr
8087
+       [(set (pc)      ; Otherwise it won't accept jumps to labels
8088
+               (match_operand:SI 0 "zip_const_address_operand_p" ""))]
8089
+       ""
8090
+       "BRA    %0"
8091
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8092
+(define_insn "jump_label"      ; Must be modeless, VOIDmode, not SI or any othr
8093
+       [(set (pc)      ; Otherwise it won't accept jumps to labels
8094
+               (label_ref (match_operand 0 "" "")))]
8095
+       ""
8096
+       "BRA    %0"
8097
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8098
+;
8099
+; This is really the same thing as an indirect jump ... the big difference
8100
+; is that the zip_address_operand_p checks for an "N" type condition, not an
8101
+; "M" type condition ... a bug, but one that works for now.  (The assembler
8102
+; should be able to catch and except on it ...)
8103
+;
8104
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
8105
+(define_insn "jump_variable"
8106
+       [(set (pc)
8107
+               (match_operand:SI 0 "zip_address_operand_p" ""))]
8108
+       ""
8109
+       "JMP    %0"
8110
+       [(set_attr "ccresult" "unchanged")])
8111
+;
8112
+; Indirect jumps ... both to registers, and registers plus offsets
8113
+;
8114
+(define_insn "indirect_jump"
8115
+       [(set (pc)
8116
+               (match_operand:SI 0 "register_operand" "r"))]
8117
+       ""
8118
+       "JMP    %0"
8119
+       [(set_attr "ccresult" "unchanged")])
8120
+(define_insn "indirect_jump_mem"
8121
+       [(set (pc) (match_operand:SI 0 "zip_memory_operand_p" "o"))]
8122
+       ""
8123
+       "LOD    %0,PC"
8124
+       [(set_attr "ccresult" "unchanged")])
8125
+(define_insn "indirect_jump_off"
8126
+       [(set (pc)
8127
+               (plus:SI (match_operand:SI 0 "register_operand" "r")
8128
+                       (match_operand:SI 1 "const_int_operand" "M")))]
8129
+       ""
8130
+       "JMP    %1(%0)"
8131
+       [(set_attr "ccresult" "unchanged")])
8132
+;;
8133
+; cbranchsi4
8134
+;;     Op 0 = the comparison operator (le,lt,eq,ne,gt,ge,and usgn ltu,geu,etc.)
8135
+;;     Op 1&2 the operands of the compare instruction
8136
+;;     Op 3 is the jump label
8137
+;;
8138
+;;
8139
+;; #warning Need to adjust this so that the "LT" code doesnt get generated ...
8140
+;;
8141
+(define_expand "cbranch<mode>4"
8142 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_operand:ZI 1 "register_operand" "r")
8143
+               (match_operand:ZI 2 "zip_opb_operand_p" "rO")))
8144 102 dgisselq
+       (set (pc) (if_then_else (match_operator 0 "ordered_comparison_operator"
8145 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
8146 102 dgisselq
+                       (label_ref (match_operand 3 "" ""))
8147
+                       (pc)))]
8148
+       ""
8149
+       {
8150 124 dgisselq
+               if (false) {
8151 117 dgisselq
+               extern void zip_debug_rtx_pfx(const char *, const_rtx);
8152 102 dgisselq
+               //; Two branches give us no end of difficulty when implementing.
8153
+               //; Let's check for these two branch codes, and swap the
8154
+               //; comparison to simplify them.
8155 122 dgisselq
+               //; fprintf(stderr, "CBRANCH\n");
8156
+               //; zip_debug_rtx_pfx("- CMP: ", operands[0]);
8157
+               //; zip_debug_rtx_pfx("- A  : ", operands[1]);
8158
+               //; zip_debug_rtx_pfx("- B  : ", operands[2]);
8159
+               //; zip_debug_rtx_pfx("- JMP: ", operands[3]);
8160 117 dgisselq
+               //; Can we do better if we reverse some compares?
8161 102 dgisselq
+               if ((GET_CODE(operands[0])==GTU)&&(REG_P(operands[2]))) {
8162 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(GTU,?,REG,?)\n");
8163
+                       emit_insn(gen_cmpsi(operands[2], operands[1]));
8164 102 dgisselq
+                       emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8165
+                       DONE;
8166
+               } else if((GET_CODE(operands[0])==GEU)&&(REG_P(operands[2]))) {
8167 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(GEU,?,REG,?)\n");
8168
+                       emit_insn(gen_cmpsi_off(operands[2], operands[1],
8169
+                                       GEN_INT(1)));
8170
+                       emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8171 102 dgisselq
+                       DONE;
8172 117 dgisselq
+               } else if ((GET_CODE(operands[0])==LE)&&(REG_P(operands[2]))) {
8173 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(LE,?,REG,?)\n");
8174 117 dgisselq
+                       //; Swap operands, turn into a GTE compare
8175 122 dgisselq
+                       emit_insn(gen_cmpsi(operands[2], operands[1]));
8176 117 dgisselq
+                       emit_jump_insn(gen_cbranch_jmp_ge(operands[3]));
8177
+                       DONE;
8178 102 dgisselq
+               } // ; Otherwise ... just handle the branch normally
8179
+
8180
+               //; Except ... we can do better for some instructions, such as
8181
+               //; LE.  While we could exchange CMP Rx,Ry into -1(Rx),Ry, it
8182
+               //; would be difficult to explain to users why MIN_INT didn't
8183
+               //; compare properly.  Hence we only adjust constant integers.
8184
+               //;
8185 122 dgisselq
+               if (GET_CODE(operands[0])==LE) {
8186
+                       if ((CONST_INT_P(operands[2]))
8187 117 dgisselq
+                               &&(INTVAL(operands[2])<(1<<17)-2)) {
8188 122 dgisselq
+                               //; fprintf(stderr, "CBRANCH:(LE,?,#,?)\n");
8189
+                               emit_insn(gen_cmpsi(operands[1],
8190
+                                               GEN_INT(INTVAL(operands[2])+1)));
8191
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
8192
+                               DONE;
8193
+                       //; Now for the controversial ones--where we add one
8194
+                       //; when it may or may not be permissable.  For now, we
8195
+                       //; just do it anyway and postpone the philosophical
8196
+                       //; discussion for later.
8197
+                       } else if (REG_P(operands[2])) {
8198
+                               emit_insn(gen_cmpsi_off(operands[1],
8199
+                                               operands[2],GEN_INT(1)));
8200
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
8201
+                               DONE;
8202
+                       } else if ((GET_CODE(operands[2])==PLUS)
8203
+                               &&(REG_P(XEXP(operands[2],0)))
8204
+                               &&(CONST_INT_P(XEXP(operands[2],1)))
8205
+                               &&(INTVAL(XEXP(operands[2],1))<((1<<13)-2))) {
8206
+                               emit_insn(gen_cmpsi_off(operands[1],
8207
+                                               XEXP(operands[2],0),
8208
+                                       GEN_INT(INTVAL(XEXP(operands[2],1))+1)));
8209
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
8210
+                               DONE;
8211
+                       }
8212
+               } else if (GET_CODE(operands[0])==LEU) {
8213
+                       if ((CONST_INT_P(operands[2]))
8214 102 dgisselq
+                               &&(INTVAL(operands[2])<(1<<17)-2)) {
8215 122 dgisselq
+                               //; fprintf(stderr, "CBRANCH:(LEU,?,#,?)\n");
8216
+                               emit_insn(gen_cmpsi(operands[1],
8217
+                                               GEN_INT(INTVAL(operands[2])+1)));
8218
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8219
+                               DONE;
8220
+                       //; Now for the controversial ones--this time having
8221
+                       //; to do with unsigned compares.
8222
+                       } else if (REG_P(operands[2])) {
8223
+                               emit_insn(gen_cmpsi_off(operands[1],
8224
+                                                       operands[2],GEN_INT(1)));
8225
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8226
+                               DONE;
8227
+                       } else if ((GET_CODE(operands[2])==PLUS)
8228
+                               &&(REG_P(XEXP(operands[2],0)))
8229
+                               &&(CONST_INT_P(XEXP(operands[2],1)))
8230
+                               &&(INTVAL(XEXP(operands[2],1))<((1<<13)-2))) {
8231
+                               emit_insn(gen_cmpsi_off(operands[1],
8232
+                                       XEXP(operands[2],0),
8233
+                                       GEN_INT(INTVAL(XEXP(operands[2],1))+1)));
8234
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8235
+                               DONE;
8236
+                       }
8237 124 dgisselq
+               }}
8238 102 dgisselq
+       })
8239
+(define_insn "cbranch_jmp_eq"
8240 122 dgisselq
+       [(set (pc) (if_then_else (eq (reg:CC CC_REG) (const_int 0))
8241 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8242
+                (pc)))]
8243
+       ""
8244
+       "BZ\t%0"
8245
+       [(set_attr "predicable" "no")
8246
+               (set_attr "conditional" "yes")
8247
+               (set_attr "ccresult" "unchanged")])
8248
+(define_insn "cbranch_jmp_neq"
8249 122 dgisselq
+       [(set (pc) (if_then_else (ne (reg:CC CC_REG) (const_int 0))
8250 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8251
+                (pc)))]
8252
+       ""
8253
+       "BNZ\t%0"
8254
+       [(set_attr "predicable" "no")
8255
+               (set_attr "conditional" "yes")
8256
+               (set_attr "ccresult" "unchanged")])
8257
+(define_insn "cbranch_jmp_lt"
8258 122 dgisselq
+       [(set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
8259 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8260
+                (pc)))]
8261
+       ""
8262
+       "BLT\t%0"
8263
+       [(set_attr "predicable" "no")
8264
+               (set_attr "conditional" "yes")
8265
+               (set_attr "ccresult" "unchanged")])
8266
+(define_insn "cbranch_jmp_le"
8267 122 dgisselq
+       [(set (pc) (if_then_else (le (reg:CC CC_REG) (const_int 0))
8268 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8269
+                (pc)))]
8270
+       ""
8271
+       "BLT\t%0
8272
+       BZ\t%0"
8273
+       [(set_attr "predicable" "no")
8274
+               (set_attr "conditional" "yes")
8275
+               (set_attr "ccresult" "unchanged")])
8276
+(define_insn "cbranch_jmp_gt"
8277 122 dgisselq
+       [(set (pc) (if_then_else (gt (reg:CC CC_REG) (const_int 0))
8278 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8279
+                (pc)))]
8280
+       ""
8281
+       "BGT\t%0"
8282
+       [(set_attr "predicable" "no")
8283
+               (set_attr "conditional" "yes")
8284
+               (set_attr "ccresult" "unchanged")])
8285
+(define_insn "cbranch_jmp_ge"
8286 122 dgisselq
+       [(set (pc) (if_then_else (ge (reg:CC CC_REG) (const_int 0))
8287 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8288
+                (pc)))]
8289
+       ""
8290
+       "BGE\t%0"
8291
+       [(set_attr "predicable" "no")
8292
+               (set_attr "conditional" "yes")
8293
+               (set_attr "ccresult" "unchanged")])
8294
+(define_insn "cbranch_jmp_ltu"
8295 122 dgisselq
+       [(set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
8296 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8297
+                (pc)))]
8298
+       ""
8299
+       "BC\t%0"
8300
+       [(set_attr "predicable" "no")
8301
+               (set_attr "conditional" "yes")
8302
+               (set_attr "ccresult" "unchanged")])
8303
+(define_insn "cbranch_jmp_gtu"
8304 122 dgisselq
+       [(set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
8305 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8306 122 dgisselq
+                (pc)))
8307
+       ;(clobber (reg:CC CC_REG))
8308
+       ]
8309 102 dgisselq
+       ""      ; Flip the condition, and then we can jump
8310
+       "XOR\t2,CC
8311
+       BC\t%0"
8312
+       [(set_attr "predicable" "no")
8313
+               (set_attr "conditional" "yes")
8314
+               (set_attr "ccresult" "unknown")])
8315
+(define_insn "cbranch_jmp_leu"
8316 122 dgisselq
+       [(set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
8317 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8318
+                (pc)))]
8319
+       ""      ; Need to check for both LTU (i.e. C) and Z
8320
+       "BC\t%0
8321
+       BZ\t%0"
8322
+       [(set_attr "predicable" "no")
8323
+               (set_attr "conditional" "yes")
8324
+               (set_attr "ccresult" "unchanged")])
8325
+(define_insn "cbranch_jmp_geu"
8326 122 dgisselq
+       [(set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
8327 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8328 122 dgisselq
+                (pc)))
8329
+       ;(clobber (reg:CC CC_REG))
8330
+       ]
8331 102 dgisselq
+       ""      ; Flip the comparison, then check for GEU (once flipped)a
8332
+               ; Z is naturally checked for, as C would've never been set on Z
8333
+               ; so by flipping it, it is tantamount to saying Z or GTU.
8334
+       "BZ\t%0
8335
+       XOR\t2,CC
8336
+       BC\t%0"
8337
+       [(set_attr "predicable" "no")
8338
+               (set_attr "conditional" "yes")
8339
+               (set_attr "ccresult" "unknown")])
8340
+(define_insn "cbranchdi4"
8341
+       [(set (pc) (if_then_else
8342
+               (match_operator 0 "ordered_comparison_operator"
8343
+                       [(match_operand:DI 1 "register_operand" "r")
8344 122 dgisselq
+                               (match_operand:DI 2 "register_operand" "r")])
8345 102 dgisselq
+                       (label_ref (match_operand 3 "" ""))
8346
+                       (pc)))
8347 122 dgisselq
+       (clobber (reg:CC CC_REG))]
8348 102 dgisselq
+       ""
8349
+       {
8350
+               switch(GET_CODE(operands[0])) {
8351
+               case EQ:
8352
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBZ\t%3";
8353
+               case NE:
8354
+                       return "CMP\t%H2,%H1\n\tCMP.NZ\t%L2,%L1\n\tBNZ\t%3";
8355
+               case LE:
8356
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
8357
+               case GT:
8358
+                       return "CMP\t%H1,%H2\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L1,%L2\n\tBC\t%3\n.Ldi%=:";
8359
+               case LT:
8360
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L2,%L1\n\tBC\t%3\n.Ldi%=:";
8361
+               case GE:
8362
+                       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%=:";
8363
+               case LTU:
8364
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n";
8365
+               case LEU:
8366
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
8367
+               case GTU:
8368
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\n";
8369
+               case GEU:
8370
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\nBZ\t%3";
8371
+               default:
8372
+                       gcc_unreachable();
8373
+               }
8374
+       }
8375
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8376
+;
8377
+;
8378
+;
8379
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8380
+;;
8381
+;; Subroutine call
8382
+;;
8383
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8384
+;
8385
+;
8386
+; There are two types of calls: "call" and "call_value".
8387
+;
8388
+; Each of these types of calls are then expanded into one of:
8389
+;
8390
+;      _const          - A call to a constant address, such as a symbol
8391
+;                      reference or a fixed location
8392
+;
8393
+;      _label          - This should be the same as _const, except that for
8394
+;                      some reason the RTL and matching rules are separate.
8395
+;                      Hence we have a separate rule for this.
8396
+;
8397
+;      _mem            - The memory address we wish to jump to is stored in
8398
+;                      memory somewhere, and we have only a pointer.  In this
8399
+;                      case, we load that pointer straight to the PC and go.
8400
+;
8401
+;      _var            - The address to jump to is given as an offset to a
8402
+;                      register, such as X+R3.  This is an indirect jump.
8403
+;                      Although we support it, it does require different RTL
8404
+;                      code.
8405
+;
8406
+(define_expand "call"
8407
+       [(call (match_operand 0 "" "")
8408
+               (match_operand 1 "" ""))]
8409
+       ""
8410
+       {
8411
+               if (MEM_P(operands[0])) {
8412
+                       // This should always be the case
8413
+                       rtx addr = XEXP(operands[0],0);
8414
+                       if (zip_const_address_operand_p(addr, SImode)) {
8415 122 dgisselq
+                               //; fprintf(stderr, "Generating gen_void_call_const()\n");
8416 102 dgisselq
+                               emit_call_insn(gen_void_call_const(addr,
8417
+                                               operands[1]));
8418
+                       } else if ((MEM_P(addr))&&(zip_address_operand(
8419
+                                                       XEXP(addr,0)))) {
8420
+                               emit_call_insn(gen_void_call_mem(XEXP(addr,0),
8421
+                                                                operands[1]));
8422
+                       } else {
8423
+                               emit_call_insn(gen_void_call_var(addr,
8424
+                                                                operands[1]));
8425
+                       }
8426
+                       DONE;
8427
+               }
8428
+       })
8429
+;
8430
+;
8431
+;
8432
+; How do we want to do this better?
8433
+;      Replace the RTL w/
8434
+;              return_label= gen_label_rtx();
8435
+;              emit_movsi(gen_rtx_REG(zip_R0),plus_constant(
8436
+;                      gen_rtx_REG(zip_PC),return_label));
8437
+;              emit_jump(label_rtx(
8438
+;
8439
+;              emit_label(return_label);
8440
+;
8441
+; The problem is: we can't!  GCC distinguishes between jumps and calls when
8442
+; optimizing, and it doesn't see the need to keep the label around.  Thus, the
8443
+; label gets removed and the call gets lost.  Hence we do it this way (below).
8444
+; I'll probably bastardize a means of getting a new codelabel that GCC doesn't
8445
+; recognize as such, but for now we'll use .Lcall# as our label.
8446
+;
8447
+(define_insn "void_call_const"
8448 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
8449 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
8450 122 dgisselq
+               (clobber (reg:SI RTN_REG))
8451
+               (clobber (reg:CC CC_REG))]
8452 102 dgisselq
+       ""
8453
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
8454
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8455
+(define_insn "void_call_mem"
8456 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
8457 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
8458 122 dgisselq
+               (clobber (reg:SI RTN_REG))
8459
+               (clobber (reg:CC CC_REG))]
8460 102 dgisselq
+       ""
8461
+       "MOV    .Lcall%=(PC),R0\;LOD\t%0,PC\n.Lcall%=:"
8462
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8463
+;
8464
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
8465
+(define_insn "void_call_var"
8466 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
8467 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
8468 122 dgisselq
+               (clobber (reg:SI RTN_REG))
8469
+               (clobber (reg:CC CC_REG))]
8470 102 dgisselq
+       ""
8471
+       "MOV    .Lcall%=(PC),R0\;JMP\t%0\n.Lcall%=:"
8472
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8473
+(define_expand "call_value"
8474 122 dgisselq
+       [(parallel [(set (reg:SI RTNV_REG)
8475 102 dgisselq
+               (call (match_operand:SI 1 "" "")
8476 111 dgisselq
+                       (match_operand 2 "const_int_operand" "n")))
8477 122 dgisselq
+       (set (match_operand:SI 0 "register_operand" "=r") (reg:SI RTNV_REG))
8478
+       (clobber (reg:CC CC_REG))])]
8479 102 dgisselq
+       ""
8480
+       {
8481 122 dgisselq
+               //; extern void zip_debug_rtx(const_rtx);
8482
+               //; fprintf(stderr, "ZIP.MD::CALL-VALUE()\n");
8483
+               //; zip_debug_rtx(operands[1]);
8484 102 dgisselq
+               if (MEM_P(operands[1])) {
8485 122 dgisselq
+                       //; fprintf(stderr, "ZIP.MD::CALL-VALUE() MEM_P\n");
8486
+                       //; zip_debug_rtx(operands[1]);
8487
+                       //; This should always be the case
8488 102 dgisselq
+                       rtx addr = XEXP(operands[1],0);
8489
+                       if (zip_const_address_operand_p(addr, SImode)) {
8490 122 dgisselq
+                               //; fprintf(stderr, "Generating gen_reg_call_const()\n");
8491 102 dgisselq
+                               emit_call_insn(gen_reg_call_const(addr, operands[2]));
8492
+                       } else if ((MEM_P(addr))&&(zip_address_operand(XEXP(addr,0)))) {
8493 122 dgisselq
+                               //; fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
8494 102 dgisselq
+                               emit_call_insn(gen_reg_call_mem(XEXP(addr,0), operands[2]));
8495
+                       } else {
8496 122 dgisselq
+                               //; fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
8497 102 dgisselq
+                               emit_call_insn(gen_reg_call_var(addr, operands[2]));
8498
+                       }
8499
+                       DONE;
8500
+               }
8501
+       })
8502
+(define_insn "reg_call_const"
8503 122 dgisselq
+       [(set (reg:SI RTNV_REG)
8504 102 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
8505 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n")))
8506 122 dgisselq
+               (clobber (reg:SI RTN_REG))
8507
+               (clobber (reg:CC CC_REG))]
8508 102 dgisselq
+       ""
8509
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
8510
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8511
+(define_insn "reg_call_mem"
8512
+       [(set (reg:SI RTNV_REG)
8513 111 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
8514
+                       (match_operand 1 "const_int_operand" "n")))
8515 122 dgisselq
+               (clobber (reg:SI RTN_REG))
8516
+               (clobber (reg:CC CC_REG))]
8517 102 dgisselq
+       ""
8518 111 dgisselq
+       "MOV    .Lcall%=(PC),R0\n\tLOD\t%0,PC\n.Lcall%=:"
8519 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8520 111 dgisselq
+;
8521 102 dgisselq
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
8522
+(define_insn "reg_call_var"
8523 122 dgisselq
+       [(set (reg:SI RTNV_REG)
8524 102 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
8525 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n")))
8526 122 dgisselq
+               (clobber (reg:SI RTN_REG))
8527
+               (clobber (reg:CC CC_REG))]
8528 102 dgisselq
+       ""
8529 111 dgisselq
+       "MOV    .Lcall%=(PC),R0\n\tJMP\t%0\n.Lcall%=:"
8530 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8531
+;
8532
+;
8533
+;
8534
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8535
+;;
8536
+;; Frame manipulation RTX
8537
+;;
8538
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8539
+;
8540
+;
8541
+;
8542
+(define_expand "prologue"
8543
+       [(const_int 0)]
8544
+       ""
8545
+       "{ zip_expand_prologue(); DONE; }")
8546
+(define_expand "epilogue"
8547
+       [(return)]
8548
+       ""
8549
+       "{ zip_expand_epilogue(); DONE; }")
8550
+(define_expand "return" ; In order to use the function predicate, this *must*
8551
+       [(return)]      ; be a define_expand
8552
+       "zip_use_return_insn()")
8553
+       ; "JMP  R0"
8554
+       ; [(set_attr "ccresult" "unchanged")])
8555
+(define_insn "*return" ; A "*" -- means it cannot be called from C
8556
+       [(return)]
8557
+       ""
8558
+       "JMP    R0"
8559
+       [(set_attr "ccresult" "unchanged")])
8560
+(define_insn "simple_return"   ; A "*" -- means it cannot be called from C
8561
+       [(simple_return)]
8562
+       ""
8563
+       "JMP    R0"
8564
+       [(set_attr "ccresult" "unchanged")])
8565
+;
8566
+;
8567
+;
8568
+;;;;;;;;;;;;;;;;;;;;;;;;;;
8569
+;;
8570
+;; Zip Builtin Functions
8571
+;;
8572
+;;;;;;;;;;;;;;;;;;;;;;;;;;
8573
+;
8574
+;
8575
+;
8576
+(define_insn "zip_rtu"
8577
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_RTU)
8578 122 dgisselq
+       (clobber (reg:CC CC_REG))]
8579 102 dgisselq
+       "(!ZIP_USER)"
8580
+       "RTU"
8581
+       [(set_attr "ccresult" "unknown")])
8582
+(define_insn "zip_halt" ; Needs to be unspec_volatile, or optimizer will opt out
8583
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_HALT)
8584 122 dgisselq
+       (clobber (reg:CC CC_REG))]
8585 102 dgisselq
+       "(!ZIP_USER)"
8586
+       "HALT"
8587
+       [(set_attr "ccresult" "unknown")])
8588
+(define_insn "zip_idle"
8589
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_IDLE)
8590 122 dgisselq
+       (clobber (reg:CC CC_REG))]
8591 102 dgisselq
+       ""
8592
+       "WAIT"
8593
+       [(set_attr "ccresult" "unknown")])
8594
+(define_insn "zip_syscall"
8595
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_SYSCALL)]
8596
+       ""
8597
+       "CLR\tCC"
8598
+       [(set_attr "ccresult" "unknown")])
8599
+;
8600
+;
8601
+; Operator "save_context"
8602
+;
8603 117 dgisselq
+;      Okay, so we're not really reading and writing operand 0, %0, however
8604
+;      if we don't list it as a "+r" register, the compiler may allocate it
8605
+;      among the other registers, thus we clobber it in the middle of the
8606
+;      operation before the task is complete.
8607 102 dgisselq
+;
8608
+(define_insn "zip_save_context"
8609 117 dgisselq
+       [(unspec_volatile
8610
+                       [ (match_operand:SI 0 "register_operand" "+r") ]
8611 102 dgisselq
+                       UNSPEC_SAVE_CONTEXT)
8612
+               (clobber (match_scratch:SI 1 "=r"))
8613
+               (clobber (match_scratch:SI 2 "=r"))
8614
+               (clobber (match_scratch:SI 3 "=r"))
8615 117 dgisselq
+               (clobber (match_scratch:SI 4 "=r"))]
8616 102 dgisselq
+       "(!ZIP_USER)"
8617
+       "MOV\tuR0,%1
8618
+       MOV\tuR1,%2
8619
+       MOV\tuR2,%3
8620
+       MOV\tuR3,%4
8621
+       STO\t%1,%0
8622
+       STO\t%2,1(%0)
8623
+       STO\t%3,2(%0)
8624
+       STO\t%4,3(%0)
8625
+       MOV\tuR4,%1
8626
+       MOV\tuR5,%2
8627
+       MOV\tuR6,%3
8628
+       MOV\tuR7,%4
8629
+       STO\t%1,4(%0)
8630
+       STO\t%2,5(%0)
8631
+       STO\t%3,6(%0)
8632
+       STO\t%4,7(%0)
8633
+       MOV\tuR8,%1
8634
+       MOV\tuR9,%2
8635
+       MOV\tuR10,%3
8636
+       MOV\tuR11,%4
8637
+       STO\t%1,8(%0)
8638
+       STO\t%2,9(%0)
8639
+       STO\t%3,10(%0)
8640
+       STO\t%4,11(%0)
8641
+       MOV\tuR12,%1
8642
+       MOV\tuSP,%2
8643
+       MOV\tuCC,%3
8644
+       MOV\tuPC,%4
8645
+       STO\t%1,12(%0)
8646
+       STO\t%2,13(%0)
8647
+       STO\t%3,14(%0)
8648
+       STO\t%4,15(%0)"
8649 122 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8650 117 dgisselq
+;
8651
+; See the comment above about why operand 0, %0, *must* be a "+r" operand,
8652
+; even though we don't really read (or change) its value throughout this
8653
+; operation.
8654
+;
8655 102 dgisselq
+(define_insn "zip_restore_context"
8656
+       [(unspec_volatile [
8657 117 dgisselq
+               (match_operand:SI 0 "register_operand" "+r")] UNSPEC_RESTORE_CONTEXT)
8658 102 dgisselq
+       (clobber (match_scratch:SI 1 "=r"))
8659
+       (clobber (match_scratch:SI 2 "=r"))
8660
+       (clobber (match_scratch:SI 3 "=r"))
8661 117 dgisselq
+       (clobber (match_scratch:SI 4 "=r"))]
8662 102 dgisselq
+       "(!ZIP_USER)"
8663
+       "LOD\t0(%0),%1
8664
+       LOD\t1(%0),%2
8665
+       LOD\t2(%0),%3
8666
+       LOD\t3(%0),%4
8667
+       MOV\t%1,uR0
8668
+       MOV\t%2,uR1
8669
+       MOV\t%3,uR2
8670
+       MOV\t%4,uR3
8671
+       LOD\t4(%0),%1
8672
+       LOD\t5(%0),%2
8673
+       LOD\t6(%0),%3
8674
+       LOD\t7(%0),%4
8675
+       MOV\t%1,uR4
8676
+       MOV\t%2,uR5
8677
+       MOV\t%3,uR6
8678
+       MOV\t%4,uR7
8679
+       LOD\t8(%0),%1
8680
+       LOD\t9(%0),%2
8681
+       LOD\t10(%0),%3
8682
+       LOD\t11(%0),%4
8683
+       MOV\t%1,uR8
8684
+       MOV\t%2,uR9
8685
+       MOV\t%3,uR10
8686
+       MOV\t%4,uR11
8687
+       LOD\t12(%0),%1
8688
+       LOD\t13(%0),%2
8689
+       LOD\t14(%0),%3
8690
+       LOD\t15(%0),%4
8691
+       MOV\t%1,uR12
8692
+       MOV\t%2,uSP
8693
+       MOV\t%3,uCC
8694
+       MOV\t%4,uPC"
8695 122 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8696 102 dgisselq
+(define_insn "zip_bitrev"
8697
+       [(set (match_operand:SI 0 "register_operand" "=r")
8698
+               (unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_BITREV))
8699
+       ]
8700
+       ""
8701
+       "BREV\t%1,%0"
8702 122 dgisselq
+       [(set_attr "ccresult" "unchanged")])
8703 102 dgisselq
+(define_insn "zip_cc"
8704
+       [(set (match_operand:SI 0 "register_operand" "=r")
8705
+               (unspec:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
8706
+       ""
8707
+       "MOV\tCC,%0"
8708
+       [(set_attr "ccresult" "unchanged")])
8709 117 dgisselq
+(define_insn "zip_ucc"
8710
+       [(set (match_operand:SI 0 "register_operand" "=r")
8711
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETUCC))]
8712
+       ""
8713
+       "MOV\tuCC,%0"
8714
+       [(set_attr "ccresult" "unchanged")])
8715 111 dgisselq
+(define_insn "zip_cc_sto"
8716
+       [(set (mem:SI (match_operand:SI 0 "register_operand" "r"))
8717 117 dgisselq
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
8718 111 dgisselq
+       ""
8719
+       "STO\tCC,(%0)"
8720
+       [(set_attr "ccresult" "unchanged")])
8721
+(define_insn "zip_cc_sto_off"
8722
+       [(set (mem:SI (plus:SI
8723
+                       (match_operand:SI 0 "register_operand" "r")
8724
+                       (match_operand:SI 1 "const_int_operand" "N")))
8725 117 dgisselq
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
8726 111 dgisselq
+       ""
8727
+       "STO\tCC,%1(%0)"
8728
+       [(set_attr "ccresult" "unchanged")])
8729 102 dgisselq
+(define_insn "ldilo"
8730
+       [(set (match_operand:SI 0 "register_operand" "=r")
8731
+               (unspec:SI [(match_operand:SI 1 "immediate_operand" "")] UNSPEC_LDILO))]
8732
+       ""
8733
+       "LDILO  %1,%0"
8734
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
8735
+
8736
+;
8737
+;
8738
+;
8739
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8740
+;;
8741
+;; Floating point Op-codes
8742
+;;
8743
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8744
+;
8745
+;
8746
+;
8747
+(define_insn "addsf3"
8748
+       [(set (match_operand:SF 0 "register_operand" "=r")
8749
+               (plus:SF (match_operand:SF 1 "register_operand" "0")
8750 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
8751
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8752 102 dgisselq
+       "(ZIP_FPU)"
8753
+       "FPADD  %2,%0"
8754
+       [(set_attr "ccresult" "unknown")])
8755
+(define_insn "subsf3"
8756
+       [(set (match_operand:SF 0 "register_operand" "=r")
8757
+               (minus:SF (match_operand:SF 1 "register_operand" "0")
8758 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
8759
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8760 102 dgisselq
+       "(ZIP_FPU)"
8761
+       "FPSUB  %2,%0"
8762
+       [(set_attr "ccresult" "unknown")])
8763
+(define_insn "mulsf3"
8764
+       [(set (match_operand:SF 0 "register_operand" "=r")
8765
+               (mult:SF (match_operand:SF 1 "register_operand" "0")
8766 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
8767
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8768 102 dgisselq
+       "(ZIP_FPU)"
8769
+       "FPMUL  %2,%0"
8770
+       [(set_attr "ccresult" "unknown")])
8771
+(define_insn "divsf3"
8772
+       [(set (match_operand:SF 0 "register_operand" "=r")
8773
+               (div:SF (match_operand:SF 1 "register_operand" "0")
8774 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
8775
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8776 102 dgisselq
+       "(ZIP_FPU)"
8777
+       "FPDIV  %2,%0"
8778
+       [(set_attr "ccresult" "unknown")])
8779 111 dgisselq
+(define_expand "negsf2"
8780
+       [(set (match_operand:SF 0 "register_operand" "=r")
8781
+               (neg:SF (match_operand:SF 1 "register_operand" "0")))
8782
+       ]
8783
+       ""
8784
+       {
8785
+               operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
8786
+               if (can_create_pseudo_p()) {
8787
+                       rtx tmp = gen_reg_rtx(SImode);
8788
+                       emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x80000000,SImode)));
8789 122 dgisselq
+                       emit_insn(gen_xorsi3(operands[0], operands[0], tmp));
8790 111 dgisselq
+                       DONE;
8791
+               } else {
8792
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
8793 122 dgisselq
+                       emit_insn(gen_iorsi3(operands[0], operands[0],
8794
+                               gen_int_mode(1,SImode)));
8795 111 dgisselq
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
8796
+                       DONE;
8797
+               }
8798
+       })
8799
+(define_expand "abssf2"
8800 122 dgisselq
+       [(set (match_operand:SF 0 "register_operand" "=r")
8801
+               (abs:SF (match_operand:SF 1 "register_operand" "0")))
8802 111 dgisselq
+       ]
8803
+       ""
8804
+       {
8805
+               operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
8806
+               if (can_create_pseudo_p()) {
8807
+                       rtx tmp = gen_reg_rtx(SImode);
8808
+                       emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x7fffffff,SImode)));
8809 122 dgisselq
+                       emit_insn(gen_andsi3(operands[0], operands[0], tmp));
8810 111 dgisselq
+                       DONE;
8811
+               } else {
8812
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
8813 122 dgisselq
+                       emit_insn(gen_andsi3(operands[0], operands[0],
8814
+                               gen_int_mode(-2,SImode)));
8815 111 dgisselq
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
8816
+                       DONE;
8817
+               }
8818
+       })
8819 102 dgisselq
+;
8820
+;
8821
+;
8822
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8823
+;;
8824
+;; Trap Instruction
8825
+;;
8826
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8827
+;
8828
+;
8829
+; The ZipCPU doesn't really have a "trap" instruction per se.  The goal is that
8830
+; *nothing* should ever trap, and so we should never get here.  However, the
8831
+; compiler seems to want a trap instruction for some reason.  (It keeps us
8832
+; from calling the abort() function, if we don't define these ...)  So let's
8833
+; just grab onto the break instruction and declare it to be a trap instruction
8834
+; for our purposes.  Alternatively, we might've used a syscall, but ... this
8835
+; will work for both user and system instructions.
8836
+;
8837
+(define_insn "trap"
8838
+       [(trap_if (const_int 1) (const_int 0))]
8839
+       ""
8840
+       "BREAK"
8841
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
8842
+;
8843
+(define_expand "ctrap<mode>4"
8844 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8845
+               (match_operand:ZI 1 "register_operand" "r")
8846
+               (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8847 102 dgisselq
+       (trap_if (match_operator 0 "ordered_comparison_operator"
8848 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
8849 102 dgisselq
+                       (match_operand 3 "const_int_operand" "O"))]
8850
+       ""
8851
+       )
8852
+(define_insn "trapif"
8853
+       [(trap_if (match_operator 0 "ordered_comparison_operator"
8854 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
8855 102 dgisselq
+                       (match_operand 1 "const_int_operand" "O"))]
8856
+       ""
8857
+       "BREAK\t%1"
8858
+       [(set_attr "predicable" "no")])
8859
+;
8860
+;
8861
+;
8862
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8863
+;;
8864
+;; Unimplemented (or not yet implemented) RTL Codes
8865
+;;
8866
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8867
+;
8868
+;
8869
+;
8870
+;(define_insn "sync_compare_and_swapsi"
8871
+;      [(set ...
8872
+;              )]
8873
+;      "(ZIP_ATMOC)"
8874
+;      LOCK            (alu)           // Hmmm ... need to modify if I will
8875
+;      LOD     %1,%0   OP-VALID        // operate on the value before the store
8876
+;      CMP     %0,%2   DCD-valid
8877
+;      STO.Z   %2,%1   PF-valid
8878
+;
8879
+;(define_insn "sync_lock_test_and_setsi"
8880
+;      LOCK
8881
+;      LOD     %1,%0
8882
+;      STO     %0,%1
8883
+;
8884
+;(define_insn "sync_lock_releasesi"
8885
+;      STO     %1,%0
8886
+;
8887
+;
8888
+;(define_insn "negvsi3"
8889
+;      "MOV    %1,%0
8890
+;      XOR     -1,%0
8891
+;      ADD     1,%0
8892
+;      BV      %2"
8893
+;      "")
8894 124 dgisselq
+;
8895
+; Match:
8896
+;      CMP     R1,R0
8897
+;      BGTU    lbl
8898
+; Transform to:
8899
+;      CMP     R0,R1
8900
+;      BC      lbl
8901
+;
8902 117 dgisselq
+(define_peephole2
8903 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8904
+               (match_operand:SI 0 "register_operand")
8905
+               (match_operand:SI 1 "register_operand")))
8906
+       (set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
8907
+                       (label_ref (match_operand 2 ""))
8908 117 dgisselq
+                       (pc)))]
8909
+       ""
8910 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 1) (match_dup 0)))
8911
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
8912 117 dgisselq
+                       (label_ref (match_dup 2))
8913
+                       (pc)))]
8914
+       "")
8915 124 dgisselq
+;
8916
+;
8917
+; Match:
8918
+;      CMP     R1,R0
8919
+;      BGEU    lbl
8920
+; Transform to:
8921
+;      CMP     1(R0),R1
8922
+;      BC      lbl
8923
+;
8924 117 dgisselq
+(define_peephole2
8925 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8926
+               (match_operand:SI 0 "register_operand")
8927
+               (match_operand:SI 1 "register_operand")))
8928
+       (set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
8929
+                       (label_ref (match_operand 2 ""))
8930 117 dgisselq
+                       (pc)))]
8931
+       ""
8932 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8933
+               (match_dup 1) (plus (match_dup 0) (const_int 1))))
8934
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
8935 117 dgisselq
+                       (label_ref (match_dup 2))
8936
+                       (pc)))]
8937
+       "")
8938 124 dgisselq
+;
8939
+;
8940
+; Match:
8941
+;      CMP     R1,R0
8942
+;      BGE     lbl
8943
+; Transform to:
8944
+;      CMP     1(R0),R1
8945
+;      BLT     lbl
8946
+;
8947 117 dgisselq
+(define_peephole2
8948 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8949
+               (match_operand:SI 0 "register_operand")
8950
+               (match_operand:SI 1 "register_operand")))
8951
+       (set (pc) (if_then_else (ge (reg:CC CC_REG) (const_int 0))
8952
+                       (label_ref (match_operand 2 ""))
8953 117 dgisselq
+                       (pc)))]
8954
+       ""
8955 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 1)
8956
+                       (plus:SI (match_dup 0) (const_int 1))))
8957
+       (set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
8958 117 dgisselq
+                       (label_ref (match_dup 2))
8959
+                       (pc)))]
8960
+       "")
8961 124 dgisselq
+;
8962
+;
8963
+; Match:
8964
+;      CMP     R1,R0
8965
+;      BLEU    lbl
8966
+; Transform to:
8967
+;      CMP     1(R1),R0
8968
+;      BLT     lbl
8969
+;
8970 117 dgisselq
+(define_peephole2
8971 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8972
+               (match_operand:SI 0 "register_operand" "")
8973 117 dgisselq
+               (match_operand:SI 1 "register_operand" "")))
8974 122 dgisselq
+       (set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
8975 117 dgisselq
+                       (label_ref (match_operand 2 "" ""))
8976
+                       (pc)))]
8977
+       ""
8978 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0)
8979
+                       (plus (match_dup 1) (const_int 1))))
8980
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
8981 117 dgisselq
+                       (label_ref (match_dup 2))
8982
+                       (pc)))]
8983
+       "")
8984
+;
8985
+; I need to revisit these peephole optimizations when I can come up with another
8986
+; way of adding one to the constant integer.  The approach listed below just
8987
+; ... doesn't work.
8988 102 dgisselq
+;
8989 117 dgisselq
+;(define_peephole2
8990 122 dgisselq
+;      [(set (reg:CC CC_REG) (compare (match_operand:SI 0 "register_operand" "")
8991 117 dgisselq
+;              (match_operand:SI 1 "const_int_operand" "")))
8992 122 dgisselq
+;      (set (pc) (if_then_else (le (reg:CC CC_REG) (const_int 0))
8993 117 dgisselq
+;                      (label_ref (match_operand 2 "" ""))
8994
+;                      (pc)))]
8995
+;      "(INTVAL(operands[1])<((1<<17)-2))"
8996 122 dgisselq
+;      [(set (reg:CC CC_REG) (compare (match_dup 0) (plus (match_dup 1) (const_int 1))))
8997
+;      (set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
8998 117 dgisselq
+;                      (label_ref (match_dup 2))
8999
+;                      (pc)))]
9000
+;      "")
9001
+;(define_peephole2
9002 122 dgisselq
+;      [(set (reg:CC CC_REG) (compare (match_operand:SI 0 "register_operand" "")
9003 117 dgisselq
+;              (match_operand:SI 1 "const_int_operand" "")))
9004 122 dgisselq
+;      (set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
9005 117 dgisselq
+;                      (label_ref (match_operand 2 "" ""))
9006
+;                      (pc)))]
9007
+;      "(INTVAL(operands[1])<((1<<17)-2))"
9008 122 dgisselq
+;      [(set (reg:CC CC_REG) (compare (match_dup 0) (plus (match_dup 1) (const_int 1))))
9009
+;      (set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
9010 117 dgisselq
+;                      (label_ref (match_dup 2))
9011
+;                      (pc)))]
9012
+;      "")
9013
+;
9014
+;
9015
+;
9016
+;
9017 122 dgisselq
+; Match:
9018
+;      MOV A(R1),R3
9019
+;      CMP R3,R0
9020
+;      (R3 is dead)
9021
+; Transform to:
9022
+;      CMP A(R1),R0
9023
+;
9024
+(define_peephole2
9025
+       [(set (match_operand:SI 3 "register_operand")
9026
+               (plus:SI (match_operand:SI 1 "register_operand")
9027
+                       (match_operand:SI 2 "zip_mvimm_operand_p")))
9028
+       (set (reg:CC CC_REG)
9029
+               (compare:CC (match_operand:SI 0 "register_operand")
9030
+                       (match_dup 3)))]
9031
+       "peep2_regno_dead_p(2, REGNO(operands[3]))"
9032
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0)
9033
+               (plus:SI (match_dup 1) (match_dup 2))))]
9034
+       "")
9035
+;
9036
+;
9037
+; Match:
9038
+;      ALU OpB,R0
9039
+;      CMP 0,R0
9040
+; Transform to:
9041
+;      ALU OpB,R0
9042
+;
9043
+(define_peephole2
9044 124 dgisselq
+       [(parallel [(set (match_operand:SI 0 "register_operand")
9045
+                       (match_operand:SI 1 ""))
9046 122 dgisselq
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9047
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9048
+       ""
9049
+       [(parallel [(set (match_dup 0) (match_dup 1))
9050
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9051
+       ])
9052
+;
9053
+;
9054
+; Match:
9055
+;      ALU OpB,R0
9056
+;      MOV R1,R2       // Can be LDI, LOD, STO, etc.
9057
+;      CMP 0,R1
9058
+; Transform to:
9059
+;      ALU OpB,R0
9060
+;      MOV R0,R1
9061
+;
9062
+(define_peephole2
9063 124 dgisselq
+       [(parallel [(set (match_operand:SI 0 "register_operand")
9064
+                       (match_operand:SI 1 ""))
9065 122 dgisselq
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9066 124 dgisselq
+       (set (match_operand:SI 2 "nonimmediate_operand") (match_operand:SI 3 ""))
9067 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9068
+       "(!REG_P(operands[2]))||((REGNO(operands[2])!=REGNO(operands[0]))&&((REGNO(operands[2])>FIRST_PSEUDO_REGISTER)||(REGNO(operands[2])<CC_REG)))"
9069
+       [(parallel [(set (match_dup 0) (match_dup 1))
9070
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9071
+       (set (match_dup 2) (match_dup 3))
9072
+       ])
9073
+;
9074
+;
9075
+; Match:
9076
+;      ALU OpB,R0
9077
+;      MOV R0,R1
9078
+;      CMP 0,R1
9079
+; Transform to:
9080
+;      ALU OpB,R0
9081
+;      MOV R0,R1
9082
+;
9083
+(define_peephole2
9084 124 dgisselq
+       [(parallel [(set (match_operand:SI 0 "register_operand")
9085
+                       (match_operand:SI 1 ""))
9086 122 dgisselq
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9087 124 dgisselq
+       (set (match_operand:SI 2 "register_operand") (match_dup 0))
9088 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))]
9089
+       ""
9090
+       [(parallel [(set (match_dup 0) (match_dup 1))
9091
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9092
+       (set (match_dup 2) (match_dup 3))
9093
+       ])
9094
+;
9095 124 dgisselq
+;
9096
+; Match:
9097
+;      MOV A(R0),R0
9098
+;      ADD $x,R1
9099
+;      (CCREG is dead, and (A+x) is within range ...)
9100
+; Transform to:
9101
+;      MOV (A+$x)(R1),R0
9102
+; ... how do I do the plus?  Let's build it with a plus of zero, and work from
9103
+; there
9104
+;      MOV R1,R0
9105
+;      ADD $x,R0
9106
+;      (CCREG is dead, and x is within range ...)
9107
+; Transform to:
9108
+;      MOV (A+$x)(R1),R0
9109
+(define_peephole2
9110
+       [(set (match_operand:SI 0 "register_operand")
9111
+               (match_operand:SI 1 "register_operand"))
9112
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0)
9113
+                               (match_operand 2 "zip_mvimm_operand_p")))
9114
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9115
+       ]
9116
+       "(peep2_regno_dead_p(2,CC_REG))"
9117
+       [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])
9118
+;
9119
+;
9120
+;
9121
+; Match:
9122
+;      ADD $x,R0
9123
+;      MOV R0,R1
9124
+;      (CCREG is dead, and R0 is dead)
9125
+; Transform to:
9126
+;      MOV (A+$x)(R0),R1
9127
+; ... again, how do I build this plus?
9128
+;
9129
+(define_peephole2
9130
+       [(parallel [(set (match_operand:SI 0 "register_operand")
9131
+                       (plus:SI (match_dup 0)
9132
+                               (match_operand 1 "zip_mvimm_operand_p")))
9133
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9134
+       (set (match_operand:SI 2 "register_operand") (match_dup 0))]
9135
+       "(peep2_regno_dead_p(2, REGNO(operands[0])))&&(peep2_regno_dead_p(2,CC_REG))"
9136
+       [(set (match_dup 2) (plus:SI (match_dup 0) (match_dup 1)))])
9137
+;
9138
+;
9139
+; Match:
9140
+;      ADD     $x,R0
9141
+;      ADD     R0,Rn
9142
+;      (R0 is dead, if R0 is not Rn)
9143
+; Transform to:
9144
+;      ADD     $x(R0),Rn
9145
+;
9146
+(define_peephole2
9147
+       [(parallel [(set (match_operand:SI 0 "register_operand")
9148
+                       (plus:SI (match_dup 0)
9149
+                               (match_operand 1 "zip_opb_immv_p")))
9150
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9151
+       (parallel [(set (match_operand:SI 2 "register_operand")
9152
+                       (plus:SI (match_dup 2) (match_dup 0)))
9153
+               (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))])
9154
+       ]
9155
+       "(REGNO(operands[0])!=REGNO(operands[2]))&&(peep2_regno_dead_p(2, REGNO(operands[0])))"
9156
+       [(parallel [(set (match_dup 2)
9157
+                       (plus:SI (match_dup 2)
9158
+                               (plus:SI (match_dup 0)
9159
+                                       (match_dup 1))))
9160
+               (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))])
9161
+       ])
9162
+;
9163
+; Match:
9164
+;      ADD     $x,R0
9165
+;      LOD     -x(R0),R1
9166
+; Transform to:
9167
+;      LOD     (R0),R1
9168
+;      ADD     $x,R0
9169
+;
9170
+(define_peephole2
9171
+       [(parallel [(set (match_operand:SI 0 "register_operand")
9172
+                       (plus:SI (match_dup 0)
9173
+                               (match_operand 1 "zip_opb_immv_p")))
9174
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9175
+       (set (match_operand:SI 3 "register_operand")
9176
+               (mem:SI (plus:SI (match_dup 0)
9177
+                       (match_operand 2 "zip_opb_immv_p"))))
9178
+       ]
9179
+       "(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
9180
+       [(set (match_dup 3) (mem:SI (match_dup 0)))
9181
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
9182
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9183
+       ])
9184
+;
9185
+;
9186
+;
9187
+; Match:
9188
+;      ADD     $x,R0
9189
+;      STO     R1,-x(R0)
9190
+; Transform to:
9191
+;      STO     R1,(R0)
9192
+;      ADD     $x,R0
9193
+;
9194
+(define_peephole2
9195
+       [(parallel [(set (match_operand:SI 0 "register_operand")
9196
+                       (plus:SI (match_dup 0)
9197
+                               (match_operand 1 "zip_opb_immv_p")))
9198
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9199
+       (set (mem:SI (plus:SI (match_dup 0) (match_operand 2 "zip_opb_immv_p")))
9200
+               (match_operand:SI 3 "register_operand"))
9201
+       ]
9202
+       "(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
9203
+       [(set (mem:SI (match_dup 0)) (match_dup 3))
9204
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
9205
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9206
+       ])
9207
+;
9208
+;
9209
+; Match:
9210
+;      ADD     $x,R0
9211
+;      ANY     R1,R2 (destination is not R0, source does not reference R0)
9212
+;      ADD     R0,Rn (could be 1 or 2, not 0)
9213
+;      (R0 is dead)
9214
+; Transform to:
9215
+;      ANY     R1,R2
9216
+;      ADD     $x(R0),Rn
9217
+;
9218
+;
9219
+;
9220
+; Need a peephole optimizer (not peephole2) for
9221
+;      [(call ...
9222
+;      (set (pc) (label))]
9223
+;      To result with
9224
+;      "MOV\tlabel,R0
9225
+;      JMP\tsubroutine"
9226
+;
9227
+; and for
9228
+;      BRA target
9229
+;      BRA target ; two branches to the same identical target in a row ...
9230
+;
9231
+;
9232
+;
9233 102 dgisselq
+; STILL MISSING:
9234
+;      SYSCALL(ID)
9235
+;              MOV %ID,R0
9236
+;              CLR     CC
9237
+;      cmove   ... the conditional move, created from a
9238
+;      (set (match_op 0 "" "r") (if_then_else (condition) (a) (reg X))))
9239
+;      pattern
9240
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
9241
--- gcc-5.3.0-original/gcc/config/zip/zip-modes.def     1969-12-31 19:00:00.000000000 -0500
9242 111 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip-modes.def  2016-03-08 12:10:21.982586940 -0500
9243
@@ -0,0 +1,23 @@
9244 102 dgisselq
+/*
9245
+ * Commends in C-long comment form
9246
+ * class
9247
+ *     Mode = "SI"
9248
+ *     PRECISION, BYTESIZE, COUNT ??
9249
+ *     FORMAT
9250
+ *     EXPR
9251 111 dgisselq
+ *
9252
+ * The manual says I need to define BITS_PER_UNIT here.
9253 102 dgisselq
+ */
9254
+// INT_MODE(QI, 1);
9255
+// INT_MODE(HI, 1);
9256
+// INT_MODE(SI, 1);
9257
+// INT_MODE(DI, 2);
9258
+
9259
+// FLOAT_MODE(SF, 1, ieee_single_format);
9260
+// FLOAT_MODE(DF, 2, ieee_single_format);
9261
+
9262
+// We cannot override machmodes.def from here.  Thus, even though our QI,
9263
+// HI, and SI modes are all 1-byte, we cant set them that way here.  The
9264
+// change needed to be made in machmodes.def.  Hence, here is a target
9265
+// configuration change--in machmodes.def--that properly belonged in the
9266
+// config directory.
9267
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
9268
--- gcc-5.3.0-original/gcc/config/zip/zip-protos.h      1969-12-31 19:00:00.000000000 -0500
9269 122 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip-protos.h   2016-04-06 14:25:35.431154171 -0400
9270
@@ -0,0 +1,78 @@
9271 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
9272
+//
9273
+// Filename:   zip-protos.h
9274
+//
9275
+// Project:    Zip CPU backend for the GNU Compiler Collection
9276
+//
9277
+// Purpose:
9278
+//
9279
+// Creator:    Dan Gisselquist, Ph.D.
9280
+//             Gisselquist Technology, LLC
9281
+//
9282
+////////////////////////////////////////////////////////////////////////////////
9283
+//
9284
+// Copyright (C) 2016, Gisselquist Technology, LLC
9285
+//
9286
+// This program is free software (firmware): you can redistribute it and/or
9287
+// modify it under the terms of  the GNU General Public License as published
9288
+// by the Free Software Foundation, either version 3 of the License, or (at
9289
+// your option) any later version.
9290
+//
9291
+// This program is distributed in the hope that it will be useful, but WITHOUT
9292
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
9293
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9294
+// for more details.
9295
+//
9296
+// You should have received a copy of the GNU General Public License along
9297
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
9298
+// target there if the PDF file isn't present.)  If not, see
9299
+// <http://www.gnu.org/licenses/> for a copy.
9300
+//
9301
+// License:    GPL, v3, as defined and found on www.gnu.org,
9302
+//             http://www.gnu.org/licenses/gpl.html
9303
+//
9304
+//
9305
+////////////////////////////////////////////////////////////////////////////////
9306
+#ifndef        ZIP_PROTOS_H
9307
+#define        ZIP_PROTOS_H
9308
+
9309
+extern void    zip_expand_prologue(void);
9310
+extern void    zip_expand_epilogue(void);
9311
+extern int     zip_initial_elimination_offset(int, int);
9312
+extern void    zip_print_operand(FILE *, rtx, int);
9313
+extern void    zip_print_operand_address(FILE *, rtx);
9314
+extern enum    reg_class       zip_reg_class(int);
9315
+extern rtx     zip_return_addr_rtx(int, rtx);
9316
+extern int     zip_num_arg_regs(enum machine_mode, tree);
9317
+
9318
+extern void    zip_asm_output_def(FILE *s, const char *n, const char *v);
9319 122 dgisselq
+
9320
+#ifdef HAVE_cc0
9321 102 dgisselq
+extern void    zip_update_cc_notice(rtx exp, rtx_insn *insn);
9322 122 dgisselq
+#else
9323
+extern void    zip_canonicalize_comparison(int *, rtx *, rtx *, bool);
9324
+#endif
9325 102 dgisselq
+extern int     zip_address_operand(rtx op);
9326
+extern int     zip_const_address_operand(rtx op);
9327
+extern bool    zip_gen_move_rtl(rtx, rtx);
9328
+extern bool    zip_use_return_insn(void);
9329
+extern const char *zip_set_zero_or_one(rtx, rtx);
9330
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
9331
+
9332
+extern int     zip_ct_address_operand(rtx op);
9333 111 dgisselq
+extern int     zip_pd_opb_operand(rtx op);
9334 102 dgisselq
+extern int     zip_pd_mov_operand(rtx op);
9335 111 dgisselq
+extern int     zip_pd_imm_operand(rtx op);
9336
+extern int     zip_pd_mvimm_operand(rtx op);
9337 102 dgisselq
+extern int     zip_ct_const_address_operand(rtx op);
9338
+extern int     zip_pd_const_address_operand(rtx op);
9339
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
9340
+extern const char *zip_addsicc(rtx, rtx, rtx, rtx);
9341
+
9342 122 dgisselq
+extern void    zip_ifcvt_machdep_init(struct ce_if_block *ceinfo);
9343
+extern void    zip_ifcvt_modify_cancel(struct ce_if_block *ceinfo);
9344
+extern void    zip_ifcvt_modify_final(struct ce_if_block *ceinfo);
9345
+extern void    zip_ifcvt_modify_tests(struct ce_if_block *ceinfo, rtx *true_expr, rtx *false_expr);
9346
+
9347 102 dgisselq
+#endif
9348
+
9349
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config.gcc gcc-5.3.0-zip/gcc/config.gcc
9350
--- gcc-5.3.0-original/gcc/config.gcc   2015-09-10 10:17:53.000000000 -0400
9351
+++ gcc-5.3.0-zip/gcc/config.gcc        2016-02-14 00:53:37.389411987 -0500
9352
@@ -479,6 +479,10 @@
9353
 tilepro*-*-*)
9354
        cpu_type=tilepro
9355
        ;;
9356
+zip*)
9357
+       cpu_type=zip
9358
+       tmake_file=zip/t-zip
9359
+       ;;
9360
 esac
9361
 
9362
 tm_file=${cpu_type}/${cpu_type}.h
9363
@@ -2972,6 +2976,15 @@
9364
        c_target_objs="m32c-pragma.o"
9365
        cxx_target_objs="m32c-pragma.o"
9366
        ;;
9367
+zip-*-netbsd*)
9368
+       tm_file="${tm_file} elfos.h netbsd.h netbsd-elf.h zip/netbsd.h"
9369
+       tmake_file="${tmake_file} zip/t-zip"
9370
+       ;;
9371
+zip*)
9372
+       target_has_targetm_common=yes
9373
+       tm_file="elfos.h newlib-stdint.h ${tm_file}"
9374
+       tmake_file="${tmake_file} zip/t-zip"
9375
+       ;;
9376
 *)
9377
        echo "*** Configuration ${target} not supported" 1>&2
9378
        exit 1
9379
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/cse.c gcc-5.3.0-zip/gcc/cse.c
9380
--- gcc-5.3.0-original/gcc/cse.c        2015-02-03 15:41:38.000000000 -0500
9381 122 dgisselq
+++ gcc-5.3.0-zip/gcc/cse.c     2016-04-05 22:26:30.816200542 -0400
9382 111 dgisselq
@@ -634,6 +634,15 @@
9383 102 dgisselq
 
9384
 /* Nonzero if X has the form (PLUS frame-pointer integer).  */
9385
 
9386 111 dgisselq
+// #define     DO_ZIP_DEBUGS
9387 102 dgisselq
+#ifdef DO_ZIP_DEBUGS
9388
+#include <stdio.h>
9389
+extern void zip_debug_rtx(const_rtx);
9390
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s\n", STR); zip_debug_rtx(RTX); } while(0)
9391
+#else
9392
+#define        ZIP_DEBUG_LINE(STR,RTX)
9393
+#endif
9394
+
9395
 static bool
9396
 fixed_base_plus_p (rtx x)
9397
 {
9398
@@ -2898,6 +2907,7 @@
9399
          validate_canon_reg (&XVECEXP (x, i, j), insn);
9400
     }
9401
 
9402
+       ZIP_DEBUG_LINE("CANON-REG-RTN", x);
9403
   return x;
9404
 }
9405
 
9406
@@ -3144,14 +3154,16 @@
9407
   if (x == 0)
9408
     return x;
9409
 
9410
+       ZIP_DEBUG_LINE("FOLD-RTX", x);
9411
   /* Try to perform some initial simplifications on X.  */
9412
   code = GET_CODE (x);
9413
   switch (code)
9414
     {
9415
     case MEM:
9416
     case SUBREG:
9417
-      if ((new_rtx = equiv_constant (x)) != NULL_RTX)
9418
-        return new_rtx;
9419
+      if ((new_rtx = equiv_constant (x)) != NULL_RTX) {
9420
+       ZIP_DEBUG_LINE("FOLD-RTX-NEW", new_rtx);
9421
+        return new_rtx; }
9422
       return x;
9423
 
9424
     case CONST:
9425
@@ -3208,6 +3220,8 @@
9426
        rtx folded_arg = XEXP (x, i), const_arg;
9427
        machine_mode mode_arg = GET_MODE (folded_arg);
9428
 
9429
+       ZIP_DEBUG_LINE("FOLD-RTX-ARG = ", folded_arg);
9430
+
9431
        switch (GET_CODE (folded_arg))
9432
          {
9433
          case MEM:
9434
@@ -3317,6 +3331,7 @@
9435
        }
9436
 
9437
       apply_change_group ();
9438
+       ZIP_DEBUG_LINE("FOLD-RTX-CANONICALIZED = ", insn);
9439
     }
9440
 
9441
   /* If X is an arithmetic operation, see if we can simplify it.  */
9442
@@ -4203,6 +4218,7 @@
9443
 {
9444
   rtx dest = SET_DEST (set);
9445
   rtx src = SET_SRC (set);
9446
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG", insn);
9447
 
9448
   if (REG_P (dest)
9449
       && REG_P (src) && ! HARD_REGISTER_P (src)
9450
@@ -4258,6 +4274,7 @@
9451
            }
9452
        }
9453
     }
9454
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG, done", insn);
9455
 }
9456
 
9457
 /* Record all the SETs in this instruction into SETS_PTR,
9458
@@ -4351,6 +4368,7 @@
9459
   rtx tem;
9460
   rtx x = PATTERN (insn);
9461
   int i;
9462
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN", insn);
9463
 
9464
   if (CALL_P (insn))
9465
     {
9466
@@ -4364,6 +4382,7 @@
9467
       canon_reg (SET_SRC (x), insn);
9468
       apply_change_group ();
9469
       fold_rtx (SET_SRC (x), insn);
9470
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN, was set:", insn);
9471
     }
9472
   else if (GET_CODE (x) == CLOBBER)
9473
     {
9474
@@ -4400,6 +4419,7 @@
9475
     canon_reg (PATTERN (insn), insn);
9476
   else if (GET_CODE (x) == PARALLEL)
9477
     {
9478
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/parallel", insn);
9479
       for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
9480
        {
9481
          rtx y = XVECEXP (x, 0, i);
9482
@@ -4491,6 +4511,7 @@
9483
 
9484
      The result of apply_change_group can be ignored; see canon_reg.  */
9485
 
9486
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/done", insn);
9487
   apply_change_group ();
9488
 }
9489
 
9490
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/defaults.h gcc-5.3.0-zip/gcc/defaults.h
9491
--- gcc-5.3.0-original/gcc/defaults.h   2015-03-03 10:04:02.000000000 -0500
9492
+++ gcc-5.3.0-zip/gcc/defaults.h        2016-02-06 16:57:53.939410173 -0500
9493
@@ -480,6 +480,8 @@
9494
 #define LOG2_BITS_PER_UNIT 3
9495
 #elif BITS_PER_UNIT == 16
9496
 #define LOG2_BITS_PER_UNIT 4
9497
+#elif BITS_PER_UNIT == 32
9498
+#define LOG2_BITS_PER_UNIT 5
9499
 #else
9500
 #error Unknown BITS_PER_UNIT
9501
 #endif
9502
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/doc/gcc.log gcc-5.3.0-zip/gcc/doc/gcc.log
9503
--- gcc-5.3.0-original/gcc/doc/gcc.log  1969-12-31 19:00:00.000000000 -0500
9504
+++ gcc-5.3.0-zip/gcc/doc/gcc.log       2016-01-30 15:18:43.262724969 -0500
9505
@@ -0,0 +1,214 @@
9506
+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
9507
+entering extended mode
9508
+ restricted \write18 enabled.
9509
+ file:line:error style messages enabled.
9510
+ %&-line parsing enabled.
9511
+**\catcode126=12 \def\normaltilde{~}\catcode126=13 \let~\normaltilde  \input ./
9512
+gcc.texi
9513
+(./gcc.texi (/usr/share/texmf/tex/texinfo/texinfo.tex
9514
+Loading texinfo [version 2013-09-11.11]:
9515
+\bindingoffset=\dimen16
9516
+\normaloffset=\dimen17
9517
+\pagewidth=\dimen18
9518
+\pageheight=\dimen19
9519
+\outerhsize=\dimen20
9520
+\outervsize=\dimen21
9521
+\cornerlong=\dimen22
9522
+\cornerthick=\dimen23
9523
+\topandbottommargin=\dimen24
9524
+\headlinebox=\box16
9525
+\footlinebox=\box17
9526
+\margin=\insert252
9527
+\EMsimple=\toks13
9528
+\groupbox=\box18
9529
+\groupinvalidhelp=\toks14
9530
+\mil=\dimen25
9531
+\exdentamount=\skip18
9532
+\inmarginspacing=\skip19
9533
+\centerpenalty=\count27
9534
+ pdf,
9535
+\tempnum=\count28
9536
+\lnkcount=\count29
9537
+\filename=\toks15
9538
+\filenamelength=\count30
9539
+\pgn=\count31
9540
+\toksA=\toks16
9541
+\toksB=\toks17
9542
+\toksC=\toks18
9543
+\toksD=\toks19
9544
+\boxA=\box19
9545
+\countA=\count32
9546
+\nopdfimagehelp=\toks20
9547
+ fonts,
9548
+\sffam=\fam8
9549
+\textleading=\dimen26
9550
+ markup,
9551
+\fontdepth=\count33
9552
+ glyphs,
9553
+\errorbox=\box20
9554
+
9555
+page headings,
9556
+\titlepagetopglue=\skip20
9557
+\titlepagebottomglue=\skip21
9558
+\evenheadline=\toks21
9559
+\oddheadline=\toks22
9560
+\evenfootline=\toks23
9561
+\oddfootline=\toks24
9562
+ tables,
9563
+\tableindent=\dimen27
9564
+\itemindent=\dimen28
9565
+\itemmargin=\dimen29
9566
+\itemmax=\dimen30
9567
+\itemno=\count34
9568
+\multitableparskip=\skip22
9569
+\multitableparindent=\skip23
9570
+\multitablecolspace=\dimen31
9571
+\multitablelinespace=\skip24
9572
+\colcount=\count35
9573
+\everytab=\toks25
9574
+ conditionals,
9575
+\doignorecount=\count36
9576
+ indexing,
9577
+\whatsitskip=\skip25
9578
+\whatsitpenalty=\count37
9579
+\secondaryindent=\skip26
9580
+\partialpage=\box21
9581
+\doublecolumnhsize=\dimen32
9582
+ sectioning,
9583
+\unnumberedno=\count38
9584
+\chapno=\count39
9585
+\secno=\count40
9586
+\subsecno=\count41
9587
+\subsubsecno=\count42
9588
+\appendixno=\count43
9589
+\absseclevel=\count44
9590
+\secbase=\count45
9591
+\chapheadingskip=\skip27
9592
+\secheadingskip=\skip28
9593
+\subsecheadingskip=\skip29
9594
+ toc,
9595
+\tocfile=\write0
9596
+\contentsrightmargin=\skip30
9597
+\savepageno=\count46
9598
+\lastnegativepageno=\count47
9599
+\tocindent=\dimen33
9600
+ environments,
9601
+\lispnarrowing=\skip31
9602
+\envskipamount=\skip32
9603
+\circthick=\dimen34
9604
+\cartouter=\dimen35
9605
+\cartinner=\dimen36
9606
+\normbskip=\skip33
9607
+\normpskip=\skip34
9608
+\normlskip=\skip35
9609
+\lskip=\skip36
9610
+\rskip=\skip37
9611
+\nonfillparindent=\dimen37
9612
+\tabw=\dimen38
9613
+\verbbox=\box22
9614
+
9615
+defuns,
9616
+\defbodyindent=\skip38
9617
+\defargsindent=\skip39
9618
+\deflastargmargin=\skip40
9619
+\defunpenalty=\count48
9620
+\parencount=\count49
9621
+\brackcount=\count50
9622
+ macros,
9623
+\paramno=\count51
9624
+\macname=\toks26
9625
+ cross references,
9626
+\auxfile=\write1
9627
+\savesfregister=\count52
9628
+\toprefbox=\box23
9629
+\printedrefnamebox=\box24
9630
+\infofilenamebox=\box25
9631
+\printedmanualbox=\box26
9632
+ insertions,
9633
+\footnoteno=\count53
9634
+\SAVEfootins=\box27
9635
+\SAVEmargin=\box28
9636
+
9637
+(/usr/share/texlive/texmf-dist/tex/generic/epsf/epsf.tex
9638
+This is `epsf.tex' v2.7.4 <14 February 2011>
9639
+\epsffilein=\read1
9640
+\epsfframemargin=\dimen39
9641
+\epsfframethickness=\dimen40
9642
+\epsfrsize=\dimen41
9643
+\epsftmp=\dimen42
9644
+\epsftsize=\dimen43
9645
+\epsfxsize=\dimen44
9646
+\epsfysize=\dimen45
9647
+\pspoints=\dimen46
9648
+)
9649
+\noepsfhelp=\toks27
9650
+ localization,
9651
+\nolanghelp=\toks28
9652
+\countUTFx=\count54
9653
+\countUTFy=\count55
9654
+\countUTFz=\count56
9655
+ formatting,
9656
+\defaultparindent=\dimen47
9657
+ and turning on texinfo input format.)
9658
+\openout1 = `gcc.aux'.
9659
+
9660
+@cpindfile=@write2
9661
+@fnindfile=@write3
9662
+@vrindfile=@write4
9663
+@tpindfile=@write5
9664
+@kyindfile=@write6
9665
+@pgindfile=@write7
9666
+texinfo.tex: doing @include of gcc-common.texi
9667
+
9668
+
9669
+./gcc.texi:25: I can't find file `gcc-common.texi'.
9670
+@temp ->@input gcc-common.texi
9671
+
9672
+@includezzz ...and @input #1 }@expandafter }@temp
9673
+                                                  @popthisfilestack
9674
+l.25 @include gcc-common.texi
9675
+
9676
+(Press Enter to retry, or Control-D to exit)
9677
+Please type another input file name: include/gcc-common.texi
9678
+(./include/gcc-common.texi
9679
+texinfo.tex: doing @include of gcc-vers.texi
9680
+
9681
+
9682
+./include/gcc-common.texi:11: I can't find file `gcc-vers.texi'.
9683
+@temp ->@input gcc-vers.texi
9684
+
9685
+@includezzz ...and @input #1 }@expandafter }@temp
9686
+                                                  @popthisfilestack
9687
+l.11 @include gcc-vers.texi
9688
+
9689
+(Press Enter to retry, or Control-D to exit)
9690
+Please type another input file name: include/gcc-vers.texi
9691
+./include/gcc-common.texi:11: I can't find file `include/gcc-vers.texi'.
9692
+@temp ->@input gcc-vers.texi
9693
+
9694
+@includezzz ...and @input #1 }@expandafter }@temp
9695
+                                                  @popthisfilestack
9696
+l.11 @include gcc-vers.texi
9697
+
9698
+(Press Enter to retry, or Control-D to exit)
9699
+Please type another input file name:
9700
+./include/gcc-common.texi:11: I can't find file `include/gcc-vers.texi'.
9701
+@temp ->@input gcc-vers.texi
9702
+
9703
+@includezzz ...and @input #1 }@expandafter }@temp
9704
+                                                  @popthisfilestack
9705
+l.11 @include gcc-vers.texi
9706
+
9707
+(Press Enter to retry, or Control-D to exit)
9708
+Please type another input file name:
9709
+./include/gcc-common.texi:11: Emergency stop.
9710
+@temp ->@input gcc-vers.texi
9711
+
9712
+@includezzz ...and @input #1 }@expandafter }@temp
9713
+                                                  @popthisfilestack
9714
+l.11 @include gcc-vers.texi
9715
+
9716
+End of file on the terminal!
9717
+
9718
+./include/gcc-common.texi:11:  ==> Fatal error occurred, no output PDF file pro
9719
+duced!
9720 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/emit-rtl.c gcc-5.3.0-zip/gcc/emit-rtl.c
9721
--- gcc-5.3.0-original/gcc/emit-rtl.c   2015-08-05 07:20:59.000000000 -0400
9722
+++ gcc-5.3.0-zip/gcc/emit-rtl.c        2016-04-01 06:40:42.812171791 -0400
9723
@@ -81,6 +81,15 @@
9724
 #include "builtins.h"
9725
 #include "rtl-iter.h"
9726
 
9727
+// #define     DO_ZIP_DEBUGS
9728
+#include <stdio.h>
9729
+#ifdef DO_ZIP_DEBUGS
9730
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
9731
+extern void    zip_debug_rtx(const_rtx);
9732
+#else
9733
+#define        ZIP_DEBUG_LINE(STR,RTX)
9734
+#endif
9735
+
9736
 struct target_rtl default_target_rtl;
9737
 #if SWITCHABLE_TARGET
9738
 struct target_rtl *this_target_rtl = &default_target_rtl;
9739
@@ -2925,6 +2934,8 @@
9740
   int copied = 0;
9741
   int length;
9742
 
9743
+ZIP_DEBUG_LINE("Copy RTX if shared",*orig1);
9744
+
9745
   /* Repeat is used to turn tail-recursion into iteration.  */
9746
 repeat:
9747
   x = *orig1;
9748
@@ -2979,6 +2990,8 @@
9749
       break;
9750
     }
9751
 
9752
+ZIP_DEBUG_LINE("Before RTX_FLAG",x);
9753
+
9754
   /* This rtx may not be shared.  If it has already been seen,
9755
      replace it with a copy of itself.  */
9756
 
9757
@@ -2989,6 +3002,8 @@
9758
     }
9759
   RTX_FLAG (x, used) = 1;
9760
 
9761
+ZIP_DEBUG_LINE("Post RTX_FLAG",x);
9762
+
9763
   /* Now scan the subexpressions recursively.
9764
      We can store any replaced subexpressions directly into X
9765
      since we know X is not shared!  Any vectors in X
9766 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/expr.c gcc-5.3.0-zip/gcc/expr.c
9767
--- gcc-5.3.0-original/gcc/expr.c       2015-04-07 10:34:06.000000000 -0400
9768 103 dgisselq
+++ gcc-5.3.0-zip/gcc/expr.c    2016-03-08 04:07:01.426335724 -0500
9769 102 dgisselq
@@ -7999,6 +7999,8 @@
9770
    the back of the caller.
9771
    The normal operating mode is to pass FALSE for this parameter.  */
9772
 
9773
+#include "print-tree.h"
9774
+
9775
 rtx
9776
 expand_expr_real (tree exp, rtx target, machine_mode tmode,
9777
                  enum expand_modifier modifier, rtx *alt_rtl,
9778 111 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/final.c gcc-5.3.0-zip/gcc/final.c
9779
--- gcc-5.3.0-original/gcc/final.c      2015-01-15 08:28:42.000000000 -0500
9780 122 dgisselq
+++ gcc-5.3.0-zip/gcc/final.c   2016-04-06 10:11:34.628479923 -0400
9781 111 dgisselq
@@ -109,6 +109,14 @@
9782
 #include "wide-int-print.h"
9783
 #include "rtl-iter.h"
9784
 
9785 122 dgisselq
+// #define     DO_ZIP_DEBUGS
9786 111 dgisselq
+#ifdef DO_ZIP_DEBUGS
9787
+extern void zip_debug_rtx(const_rtx);
9788
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
9789
+#else
9790
+#define        ZIP_DEBUG_LINE(STR,RTX)
9791
+#endif
9792
+
9793
 #ifdef XCOFF_DEBUGGING_INFO
9794
 #include "xcoffout.h"          /* Needed for external data
9795
                                   declarations for e.g. AIX 4.x.  */
9796
@@ -2071,6 +2079,8 @@
9797
   /* Output the insns.  */
9798
   for (insn = first; insn;)
9799
     {
9800
+       ZIP_DEBUG_LINE("final()\n", insn);
9801
+
9802
       if (HAVE_ATTR_length)
9803
        {
9804
          if ((unsigned) INSN_UID (insn) >= INSN_ADDRESSES_SIZE ())
9805 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/genmodes.c gcc-5.3.0-zip/gcc/genmodes.c
9806
--- gcc-5.3.0-original/gcc/genmodes.c   2015-01-05 07:33:28.000000000 -0500
9807
+++ gcc-5.3.0-zip/gcc/genmodes.c        2016-03-04 21:27:49.669147699 -0500
9808
@@ -330,7 +330,8 @@
9809
         the size of a CC mode is four units.  */
9810
       validate_mode (m, UNSET, UNSET, UNSET, UNSET, UNSET);
9811
 
9812
-      m->bytesize = 4;
9813
+       /* For the ZipCPU, however, it is only one unit */
9814
+      m->bytesize = 1;
9815
       m->ncomponents = 1;
9816
       m->component = 0;
9817
       break;
9818
@@ -766,11 +767,12 @@
9819
 
9820
   /* So put the default value unless the target needs a non standard
9821
      value. */
9822
-#ifdef BITS_PER_UNIT
9823
-  bits_per_unit = BITS_PER_UNIT;
9824
-#else
9825
-  bits_per_unit = 8;
9826
-#endif
9827
+// #ifdef BITS_PER_UNIT
9828
+  // bits_per_unit = BITS_PER_UNIT;
9829
+// #else
9830
+  bits_per_unit = 32;
9831
+#warning "Is there a more automated way to set bits per unit?"
9832
+// #endif
9833
 
9834
 #ifdef MAX_BITSIZE_MODE_ANY_INT
9835
   max_bitsize_mode_any_int = MAX_BITSIZE_MODE_ANY_INT;
9836
@@ -1083,7 +1085,7 @@
9837
       first = modes[c];
9838
       last = 0;
9839
       for (m = first; m; last = m, m = m->next)
9840
-       ;
9841
+       if ((m->next)&&(m->next->bytesize == m->bytesize)) first = m;
9842
 
9843
       /* Don't use BImode for MIN_MODE_INT, since otherwise the middle
9844
         end will try to use it for bitfields in structures and the
9845
@@ -1268,7 +1270,7 @@
9846
            continue;
9847
          if (m->precision != (unsigned int) -1)
9848
            {
9849
-             if (m2->precision != 2 * m->precision)
9850
+             if (m2->precision < 2 * m->precision)
9851
                continue;
9852
            }
9853
          else
9854
@@ -1323,7 +1325,6 @@
9855
       tagged_printf ("MODE_MASK (%u)", m->precision, m->name);
9856
     else
9857
       tagged_printf ("MODE_MASK (%u*BITS_PER_UNIT)", m->bytesize, m->name);
9858
-
9859
   puts ("#undef MODE_MASK");
9860
   print_closer ();
9861
 }
9862
@@ -1351,12 +1352,23 @@
9863
   int c;
9864
   struct mode_data *m;
9865
 
9866
+  puts(
9867
+"\n\n/* This is a rather strange conundrum.  Alignment is used by the host in\n"
9868
+" * the assembly file, whereas the size is used by the target.  Thus, for\n"
9869
+" * now, to align to a single target word means to align to 4 8-bit bytes in\n"
9870
+" * assembly.  If you get it wrong, the assembler will try to help.  Thus,\n"
9871
+" * aligning to anything less than 4 (1 target word) will cause an alignment\n"
9872
+" * of the target word in size.  However, this tries to do a little something\n"
9873
+" * teach our compiler what we are doing.\n"
9874
+" */\n");
9875
   print_maybe_const_decl ("%sunsigned char",
9876
                          "mode_base_align", "NUM_MACHINE_MODES",
9877
                          alignment);
9878
 
9879
   for_all_modes (c, m)
9880
-    tagged_printf ("%u", m->alignment, m->name);
9881
+    tagged_printf ("%u", 4*m->bytesize,
9882
+               // m->alignment,
9883
+               m->name);
9884
 
9885
   print_closer ();
9886
 }
9887 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/jump.c gcc-5.3.0-zip/gcc/jump.c
9888
--- gcc-5.3.0-original/gcc/jump.c       2015-01-27 04:19:30.000000000 -0500
9889 122 dgisselq
+++ gcc-5.3.0-zip/gcc/jump.c    2016-04-06 14:06:50.207563805 -0400
9890 117 dgisselq
@@ -80,6 +80,14 @@
9891
 #include "target.h"
9892
 #include "rtl-iter.h"
9893
 
9894
+// #define     DO_ZIP_DEBUGS
9895
+#ifdef DO_ZIP_DEBUGS
9896
+#include <stdio.h>
9897
+#define        ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); }while(0)
9898
+extern void zip_debug_rtx(const_rtx);
9899
+#else
9900
+#define        ZIP_DEBUG_LINE(STR,RTX)
9901
+#endif
9902
 /* Optimize jump y; x: ... y: jumpif... x?
9903
    Don't know if it is worth bothering with.  */
9904
 /* Optimize two cases of conditional jump to conditional jump?
9905
@@ -1136,6 +1144,7 @@
9906
   int i;
9907
   const char *fmt;
9908
 
9909
+ZIP_DEBUG_LINE("Mark jump label",insn);
9910
   switch (code)
9911
     {
9912
     case PC:
9913
@@ -1248,6 +1257,8 @@
9914
       break;
9915
     }
9916
 
9917
+ZIP_DEBUG_LINE("Post case",insn);
9918
+
9919
   fmt = GET_RTX_FORMAT (code);
9920
 
9921
   /* The primary target of a tablejump is the label of the ADDR_VEC,
9922 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.def gcc-5.3.0-zip/gcc/machmode.def
9923
--- gcc-5.3.0-original/gcc/machmode.def 2015-01-05 07:33:28.000000000 -0500
9924 111 dgisselq
+++ gcc-5.3.0-zip/gcc/machmode.def      2016-03-08 11:56:45.375491523 -0500
9925 102 dgisselq
@@ -184,11 +184,11 @@
9926
    larger types, then corresponding modes must be added here.  The
9927
    name OI is reserved for a 256-bit type (needed by some back ends).
9928
     */
9929
-INT_MODE (QI, 1);
9930
-INT_MODE (HI, 2);
9931
-INT_MODE (SI, 4);
9932
-INT_MODE (DI, 8);
9933
-INT_MODE (TI, 16);
9934
+// INT_MODE (QI, 1);
9935
+// INT_MODE (HI, 1);
9936
+INT_MODE (SI, 1);
9937
+INT_MODE (DI, 2);
9938
+INT_MODE (TI, 4);
9939
 
9940
 /* No partial integer modes are defined by default.  */
9941
 
9942 111 dgisselq
@@ -206,35 +206,35 @@
9943 102 dgisselq
    These are the IEEE mappings.  They can be overridden with
9944
    RESET_FLOAT_FORMAT or at runtime (in TARGET_OPTION_OVERRIDE).  */
9945
 
9946
-FLOAT_MODE (SF, 4, ieee_single_format);
9947
-FLOAT_MODE (DF, 8, ieee_double_format);
9948
+FLOAT_MODE (SF, 1, ieee_single_format);
9949
+FLOAT_MODE (DF, 2, ieee_double_format);
9950
 
9951
 /* Basic CC modes.
9952
    FIXME define this only for targets that need it.  */
9953 111 dgisselq
 CC_MODE (CC);
9954 102 dgisselq
 
9955
 /* Fixed-point modes.  */
9956 111 dgisselq
-FRACT_MODE (QQ, 1, 7); /* s.7 */
9957 102 dgisselq
-FRACT_MODE (HQ, 2, 15); /* s.15 */
9958
-FRACT_MODE (SQ, 4, 31); /* s.31 */
9959
-FRACT_MODE (DQ, 8, 63); /* s.63 */
9960
-FRACT_MODE (TQ, 16, 127); /* s.127 */
9961 111 dgisselq
-
9962
-UFRACT_MODE (UQQ, 1, 8); /* .8 */
9963 102 dgisselq
-UFRACT_MODE (UHQ, 2, 16); /* .16 */
9964
-UFRACT_MODE (USQ, 4, 32); /* .32 */
9965
-UFRACT_MODE (UDQ, 8, 64); /* .64 */
9966
-UFRACT_MODE (UTQ, 16, 128); /* .128 */
9967 111 dgisselq
-
9968
-ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
9969
-ACCUM_MODE (SA, 4, 16, 15); /* s16.15 */
9970
-ACCUM_MODE (DA, 8, 32, 31); /* s32.31 */
9971
-ACCUM_MODE (TA, 16, 64, 63); /* s64.63 */
9972
-
9973
-UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
9974
-UACCUM_MODE (USA, 4, 16, 16); /* 16.16 */
9975
-UACCUM_MODE (UDA, 8, 32, 32); /* 32.32 */
9976
-UACCUM_MODE (UTA, 16, 64, 64); /* 64.64 */
9977
+/* FRACT_MODE (QQ, 1, 7); /* s.7 */
9978
+/* FRACT_MODE (HQ, 1, 15); /* s.15 */
9979
+FRACT_MODE (SQ, 1, 31); /* s.31 */
9980
+FRACT_MODE (DQ, 2, 63); /* s.63 */
9981
+FRACT_MODE (TQ, 4, 127); /* s.127 */
9982
+
9983
+/* UFRACT_MODE (UQQ, 1, 8); /* .8 */
9984
+/* UFRACT_MODE (UHQ, 1, 16); /* .16 */
9985 102 dgisselq
+UFRACT_MODE (USQ, 1, 32); /* .32 */
9986
+UFRACT_MODE (UDQ, 2, 64); /* .64 */
9987
+UFRACT_MODE (UTQ, 4, 128); /* .128 */
9988 111 dgisselq
+
9989
+/* ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
9990
+ACCUM_MODE (SA, 1, 16, 15); /* s16.15 */
9991
+ACCUM_MODE (DA, 2, 32, 31); /* s32.31 */
9992
+ACCUM_MODE (TA, 4, 64, 63); /* s64.63 */
9993
+
9994
+/* UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
9995
+UACCUM_MODE (USA, 1, 16, 16); /* 16.16 */
9996
+UACCUM_MODE (UDA, 2, 32, 32); /* 32.32 */
9997
+UACCUM_MODE (UTA, 4, 64, 64); /* 64.64 */
9998 102 dgisselq
 
9999 111 dgisselq
 /* Allow the target to specify additional modes of various kinds.  */
10000
 #if HAVE_EXTRA_MODES
10001 102 dgisselq
@@ -246,9 +246,9 @@
10002
 COMPLEX_MODES (FLOAT);
10003
 
10004
 /* Decimal floating point modes.  */
10005
-DECIMAL_FLOAT_MODE (SD, 4, decimal_single_format);
10006
-DECIMAL_FLOAT_MODE (DD, 8, decimal_double_format);
10007
-DECIMAL_FLOAT_MODE (TD, 16, decimal_quad_format);
10008
+DECIMAL_FLOAT_MODE (SD, 1, decimal_single_format);
10009
+DECIMAL_FLOAT_MODE (DD, 2, decimal_double_format);
10010
+DECIMAL_FLOAT_MODE (TD, 4, decimal_quad_format);
10011
 
10012
 /* The symbol Pmode stands for one of the above machine modes (usually SImode).
10013
    The tm.h file specifies which one.  It is not a distinct mode.  */
10014
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.h gcc-5.3.0-zip/gcc/machmode.h
10015
--- gcc-5.3.0-original/gcc/machmode.h   2015-01-05 07:33:28.000000000 -0500
10016
+++ gcc-5.3.0-zip/gcc/machmode.h        2016-02-06 17:21:49.592924065 -0500
10017
@@ -180,13 +180,7 @@
10018
 /* Get the size in bytes and bits of an object of mode MODE.  */
10019
 
10020
 extern CONST_MODE_SIZE unsigned char mode_size[NUM_MACHINE_MODES];
10021
-#if GCC_VERSION >= 4001
10022
-#define GET_MODE_SIZE(MODE) \
10023
-  ((unsigned short) (__builtin_constant_p (MODE) \
10024
-                    ? mode_size_inline (MODE) : mode_size[MODE]))
10025
-#else
10026
 #define GET_MODE_SIZE(MODE)    ((unsigned short) mode_size[MODE])
10027
-#endif
10028
 #define GET_MODE_BITSIZE(MODE) \
10029
   ((unsigned short) (GET_MODE_SIZE (MODE) * BITS_PER_UNIT))
10030
 
10031
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/objc/objc-encoding.c gcc-5.3.0-zip/gcc/objc/objc-encoding.c
10032
--- gcc-5.3.0-original/gcc/objc/objc-encoding.c 2015-01-09 15:18:42.000000000 -0500
10033
+++ gcc-5.3.0-zip/gcc/objc/objc-encoding.c      2016-03-04 22:53:40.431902505 -0500
10034
@@ -765,10 +765,14 @@
10035
        {
10036
          switch (TYPE_MODE (type))
10037
            {
10038
+#ifdef HAVE_QImode
10039
            case QImode:
10040
              charType = 'C'; break;
10041
+#endif
10042
+#ifdef HAVE_HImode
10043
            case HImode:
10044
              charType = 'S'; break;
10045
+#endif
10046
            case SImode:
10047
              {
10048
                if (type == long_unsigned_type_node)
10049
@@ -788,10 +792,14 @@
10050
        {
10051
          switch (TYPE_MODE (type))
10052
            {
10053
+#ifdef HAVE_QImode
10054
            case QImode:
10055
              charType = 'c'; break;
10056
+#endif
10057
+#ifdef HAVE_HImode
10058
            case HImode:
10059
              charType = 's'; break;
10060
+#endif
10061
            case SImode:
10062
              {
10063
                if (type == long_integer_type_node)
10064
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/postreload.c gcc-5.3.0-zip/gcc/postreload.c
10065
--- gcc-5.3.0-original/gcc/postreload.c 2015-07-17 09:50:38.000000000 -0400
10066 111 dgisselq
+++ gcc-5.3.0-zip/gcc/postreload.c      2016-03-24 21:30:23.402590035 -0400
10067
@@ -71,6 +71,14 @@
10068 102 dgisselq
 #include "df.h"
10069
 #include "dbgcnt.h"
10070
 
10071 111 dgisselq
+// #define     DO_ZIP_DEBUGS
10072 102 dgisselq
+#ifdef DO_ZIP_DEBUGS
10073
+extern void zip_debug_rtx(const_rtx);
10074
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10075
+#else
10076
+#define        ZIP_DEBUG_LINE(STR,RTX)
10077
+#endif
10078
+
10079
 static int reload_cse_noop_set_p (rtx);
10080
 static bool reload_cse_simplify (rtx_insn *, rtx);
10081
 static void reload_cse_regs_1 (void);
10082 111 dgisselq
@@ -120,6 +128,8 @@
10083 102 dgisselq
   basic_block insn_bb = BLOCK_FOR_INSN (insn);
10084
   unsigned insn_bb_succs = EDGE_COUNT (insn_bb->succs);
10085
 
10086
+       ZIP_DEBUG_LINE("RELOAD-CSE-SIMPLIFY:",insn);
10087
+
10088
   if (GET_CODE (body) == SET)
10089
     {
10090
       int count = 0;
10091 111 dgisselq
@@ -147,6 +157,7 @@
10092 102 dgisselq
        apply_change_group ();
10093
       else
10094
        reload_cse_simplify_operands (insn, testreg);
10095
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
10096
     }
10097
   else if (GET_CODE (body) == PARALLEL)
10098
     {
10099 111 dgisselq
@@ -205,6 +216,7 @@
10100 102 dgisselq
        apply_change_group ();
10101
       else
10102
        reload_cse_simplify_operands (insn, testreg);
10103
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
10104
     }
10105
 
10106
 done:
10107 111 dgisselq
@@ -246,6 +258,7 @@
10108 102 dgisselq
          cfg_changed |= reload_cse_simplify (insn, testreg);
10109
 
10110
        cselib_process_insn (insn);
10111
+       ZIP_DEBUG_LINE("End-CSE-REGS-1:",insn);
10112
       }
10113
 
10114
   /* Clean up.  */
10115 111 dgisselq
@@ -276,6 +289,8 @@
10116 102 dgisselq
 #endif
10117
   bool speed = optimize_bb_for_speed_p (BLOCK_FOR_INSN (insn));
10118
 
10119
+
10120
+       ZIP_DEBUG_LINE("RELOAD:Attempting to simplify set",set);
10121
   dreg = true_regnum (SET_DEST (set));
10122
   if (dreg < 0)
10123
     return 0;
10124 111 dgisselq
@@ -427,6 +442,7 @@
10125 102 dgisselq
   /* Array of alternatives, sorted in order of decreasing desirability.  */
10126
   int *alternative_order;
10127
 
10128
+       ZIP_DEBUG_LINE("Simplify-Operands", insn);
10129
   extract_constrain_insn (insn);
10130
 
10131
   if (recog_data.n_alternatives == 0 || recog_data.n_operands == 0)
10132 111 dgisselq
@@ -519,6 +535,7 @@
10133 102 dgisselq
          SET_HARD_REG_BIT (equiv_regs[i], REGNO (l->loc));
10134
     }
10135
 
10136
+       ZIP_DEBUG_LINE("Simplify-Operands - A", insn);
10137
   alternative_mask preferred = get_preferred_alternatives (insn);
10138
   for (i = 0; i < recog_data.n_operands; i++)
10139
     {
10140 111 dgisselq
@@ -617,6 +634,7 @@
10141 102 dgisselq
            }
10142
        }
10143
     }
10144
+       ZIP_DEBUG_LINE("Simplify-Operands - B", insn);
10145
 
10146
   /* Record all alternatives which are better or equal to the currently
10147
      matching one in the alternative_order array.  */
10148 111 dgisselq
@@ -666,6 +684,7 @@
10149 102 dgisselq
       validate_change (insn, recog_data.operand_loc[i],
10150
                       gen_rtx_REG (mode, op_alt_regno[i][j]), 1);
10151
     }
10152
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
10153
 
10154
   for (i = recog_data.n_dups - 1; i >= 0; i--)
10155
     {
10156 111 dgisselq
@@ -679,6 +698,7 @@
10157 102 dgisselq
                       gen_rtx_REG (mode, op_alt_regno[op][j]), 1);
10158
     }
10159
 
10160
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
10161
   return apply_change_group ();
10162
 }
10163
 
10164 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/recog.c gcc-5.3.0-zip/gcc/recog.c
10165
--- gcc-5.3.0-original/gcc/recog.c      2015-03-20 02:07:30.000000000 -0400
10166 122 dgisselq
+++ gcc-5.3.0-zip/gcc/recog.c   2016-04-06 17:45:29.552304498 -0400
10167 117 dgisselq
@@ -68,6 +68,15 @@
10168
 #include "df.h"
10169
 #include "insn-codes.h"
10170
 
10171
+// #define     DO_ZIP_DEBUGS
10172
+#ifdef DO_ZIP_DEBUGS
10173
+extern void    zip_debug_rtx(const_rtx);
10174
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10175
+#else
10176
+#define        ZIP_DEBUG_LINE(STR,RTX)
10177
+#endif
10178
+
10179
+
10180
 #ifndef STACK_PUSH_CODE
10181
 #ifdef STACK_GROWS_DOWNWARD
10182
 #define STACK_PUSH_CODE PRE_DEC
10183 122 dgisselq
@@ -2283,6 +2292,7 @@
10184
   recog_data.n_dups = 0;
10185
   recog_data.is_asm = false;
10186
 
10187
+ZIP_DEBUG_LINE("Extract-insn", insn);
10188
   switch (GET_CODE (body))
10189
     {
10190
     case USE:
10191
@@ -3671,7 +3681,6 @@
10192 117 dgisselq
            break;
10193
 
10194
          /* The buffer filled to the current maximum, so try to match.  */
10195
-
10196
          pos = peep2_buf_position (peep2_current + peep2_current_count);
10197
          peep2_insn_data[pos].insn = PEEP2_EOB;
10198
          COPY_REG_SET (peep2_insn_data[pos].live_before, live);
10199 122 dgisselq
@@ -3704,6 +3713,7 @@
10200 117 dgisselq
     rebuild_jump_labels (get_insns ());
10201
   if (peep2_do_cleanup_cfg)
10202
     cleanup_cfg (CLEANUP_CFG_CHANGED);
10203
+
10204
 }
10205
 #endif /* HAVE_peephole2 */
10206
 
10207
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload1.c gcc-5.3.0-zip/gcc/reload1.c
10208
--- gcc-5.3.0-original/gcc/reload1.c    2015-01-15 08:28:42.000000000 -0500
10209 124 dgisselq
+++ gcc-5.3.0-zip/gcc/reload1.c 2016-04-08 18:48:36.995557279 -0400
10210 117 dgisselq
@@ -72,6 +72,14 @@
10211
 #include "dumpfile.h"
10212
 #include "rtl-iter.h"
10213
 
10214
+// #define     DO_ZIP_DEBUGS
10215
+#ifdef DO_ZIP_DEBUGS
10216
+extern void    zip_debug_rtx(const_rtx);
10217
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10218
+#else
10219
+#define        ZIP_DEBUG_LINE(STR,RTX)
10220
+#endif
10221
+
10222
 /* This file contains the reload pass of the compiler, which is
10223
    run after register allocation has been done.  It checks that
10224
    each insn is valid (operands required to be in registers really
10225
@@ -794,6 +802,18 @@
10226
   basic_block bb;
10227
   bool inserted;
10228
 
10229
+#ifdef DO_ZIP_DEBUGS
10230
+  {
10231
+       int     total_count = 0, current_count = 0;
10232
+       for (insn = first; insn; insn = NEXT_INSN (insn))
10233
+               total_count++;
10234
+       for (insn = first; insn; insn = NEXT_INSN (insn)) {
10235
+               fprintf(stderr, "B %3d/%3d", current_count++, total_count);
10236
+               zip_debug_rtx(insn);
10237
+       }
10238
+  }
10239
+#endif
10240
+
10241
   /* Make sure even insns with volatile mem refs are recognizable.  */
10242
   init_recog ();
10243
 
10244
@@ -1366,6 +1386,18 @@
10245
 
10246
   reload_completed = !failure;
10247
 
10248
+#ifdef DO_ZIP_DEBUGS
10249
+  {
10250
+       int     total_count = 0, current_count = 0;
10251
+       for (insn = first; insn; insn = NEXT_INSN (insn))
10252
+               total_count++;
10253
+       for (insn = first; insn; insn = NEXT_INSN (insn)) {
10254
+               fprintf(stderr, "A %3d/%3d", current_count++, total_count);
10255
+               zip_debug_rtx(insn);
10256
+       }
10257
+  }
10258
+#endif
10259
+
10260
   return need_dce;
10261
 }
10262
 
10263 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload.c gcc-5.3.0-zip/gcc/reload.c
10264
--- gcc-5.3.0-original/gcc/reload.c     2015-01-15 08:28:42.000000000 -0500
10265 122 dgisselq
+++ gcc-5.3.0-zip/gcc/reload.c  2016-04-06 17:49:33.418613170 -0400
10266
@@ -136,6 +136,15 @@
10267
 #include "target.h"
10268
 #include "ira.h"
10269
 
10270
+// #define     DO_ZIP_DEBUGS
10271
+#ifdef DO_ZIP_DEBUGS
10272
+extern void zip_debug_rtx(const_rtx);
10273
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr, "%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); }while(0)
10274
+#else
10275
+#define        ZIP_DEBUG_LINE(STR,RTX)
10276
+#endif
10277
+
10278
+
10279
 /* True if X is a constant that can be forced into the constant pool.
10280
    MODE is the mode of the operand, or VOIDmode if not known.  */
10281
 #define CONST_POOL_OK_P(MODE, X)               \
10282
@@ -2700,6 +2709,8 @@
10283
   hard_regs_live_known = live_known;
10284
   static_reload_reg_p = reload_reg_p;
10285
 
10286
+ZIP_DEBUG_LINE("Find reloads\n", insn);
10287
+
10288
   /* JUMP_INSNs and CALL_INSNs are not allowed to have any output reloads;
10289
      neither are insns that SET cc0.  Insns that use CC0 are not allowed
10290
      to have any input reloads.  */
10291
@@ -2707,8 +2718,17 @@
10292 102 dgisselq
     no_output_reloads = 1;
10293
 
10294
 #ifdef HAVE_cc0
10295
+  // If the instruction depends upon cc0, such as a branch, if_then_else, or
10296
+  // cond_exec instruction, we cannot change the input so that the instruction
10297
+  // relies on another register--cc0 is specific.  This requries that the
10298
+  // references be only cc0 and (const_int 0), rather than allowing other
10299
+  // registers here as well.
10300
   if (reg_referenced_p (cc0_rtx, PATTERN (insn)))
10301
     no_input_reloads = 1;
10302
+  // If the result of an instruction is the cc0 register, that cannot
10303
+  // be changed, therefore no output reloading is allowed.  This only
10304
+  // works if instructions *only* set the cc0 register, and not multiple
10305
+  // registers.
10306
   if (reg_set_p (cc0_rtx, PATTERN (insn)))
10307
     no_output_reloads = 1;
10308
 #endif
10309
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
10310
--- gcc-5.3.0-original/gcc/testsuite/lib/target-supports.exp    2015-11-26 05:10:58.000000000 -0500
10311
+++ gcc-5.3.0-zip/gcc/testsuite/lib/target-supports.exp 2016-01-30 15:14:21.620586694 -0500
10312
@@ -503,6 +503,11 @@
10313
        return 0
10314
     }
10315
 
10316
+    # Zip CPU doesn't support profiling (yet)
10317
+    if { [istarget zip*] }
10318
+        return 0
10319
+    }
10320
+
10321
     # MinGW does not support -p.
10322
     if { [istarget *-*-mingw*] && $test_what == "-p" } {
10323
        return 0
10324
@@ -986,6 +991,12 @@
10325
        }]
10326
     }
10327
 
10328
+    # No real hardware FPU support for ZipCPU yet--even though the instruction
10329
+    # set supports it, the CPU just isn't ready yet.
10330
+    if { [istarget zip*-*-*] } {
10331
+        return 0
10332
+    }
10333
+
10334
     # This proc is actually checking the availabilty of FPU
10335
     # support for doubles, so on the RX we must fail if the
10336
     # 64-bit double multilib has been selected.
10337
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
10338
--- gcc-5.3.0-original/gcc/tree-ssa-math-opts.c 2015-08-11 03:58:07.000000000 -0400
10339
+++ gcc-5.3.0-zip/gcc/tree-ssa-math-opts.c      2016-02-12 11:21:11.309149239 -0500
10340
@@ -972,7 +972,7 @@
10341
     {
10342
       if (val & 1)
10343
        {
10344
-         digit = val & ((1 << POWI_WINDOW_SIZE) - 1);
10345
+         digit = val & ((1l << POWI_WINDOW_SIZE) - 1);
10346
          result += powi_lookup_cost (digit, cache)
10347
                    + POWI_WINDOW_SIZE + 1;
10348
          val >>= POWI_WINDOW_SIZE;
10349
@@ -1012,7 +1012,7 @@
10350
     }
10351
   else if (n & 1)
10352
     {
10353
-      digit = n & ((1 << POWI_WINDOW_SIZE) - 1);
10354
+      digit = n & ((1l << POWI_WINDOW_SIZE) - 1);
10355
       op0 = powi_as_mults_1 (gsi, loc, type, n - digit, cache);
10356
       op1 = powi_as_mults_1 (gsi, loc, type, digit, cache);
10357
     }
10358
@@ -1651,7 +1651,7 @@
10359
 };
10360
 
10361
 #define BITS_PER_MARKER 8
10362
-#define MARKER_MASK ((1 << BITS_PER_MARKER) - 1)
10363
+#define MARKER_MASK ((1l << BITS_PER_MARKER) - 1)
10364
 #define MARKER_BYTE_UNKNOWN MARKER_MASK
10365
 #define HEAD_MARKER(n, size) \
10366
   ((n) & ((uint64_t) MARKER_MASK << (((size) - 1) * BITS_PER_MARKER)))
10367
@@ -1687,7 +1687,7 @@
10368
   /* Zero out the extra bits of N in order to avoid them being shifted
10369
      into the significant bits.  */
10370
   if (size < 64 / BITS_PER_MARKER)
10371
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
10372
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
10373
 
10374
   switch (code)
10375
     {
10376
@@ -1714,7 +1714,7 @@
10377
     }
10378
   /* Zero unused bits for size.  */
10379
   if (size < 64 / BITS_PER_MARKER)
10380
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
10381
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
10382
   return true;
10383
 }
10384
 
10385
@@ -1761,7 +1761,7 @@
10386
   n->n = CMPNOP;
10387
 
10388
   if (size < 64 / BITS_PER_MARKER)
10389
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
10390
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
10391
 
10392
   return true;
10393
 }
10394
@@ -2020,7 +2020,7 @@
10395
          {
10396
            int i, size = TYPE_PRECISION (n->type) / BITS_PER_UNIT;
10397
            uint64_t val = int_cst_value (rhs2), mask = 0;
10398
-           uint64_t tmp = (1 << BITS_PER_UNIT) - 1;
10399
+           uint64_t tmp = (1l << BITS_PER_UNIT) - 1;
10400
 
10401
            /* Only constants masking full bytes are allowed.  */
10402
            for (i = 0; i < size; i++, tmp <<= BITS_PER_UNIT)
10403
@@ -2064,7 +2064,7 @@
10404
              {
10405
                /* If STMT casts to a smaller type mask out the bits not
10406
                   belonging to the target type.  */
10407
-               n->n &= ((uint64_t) 1 << (type_size * BITS_PER_MARKER)) - 1;
10408
+               n->n &= ((uint64_t) 1l << (type_size * BITS_PER_MARKER)) - 1;
10409
              }
10410
            n->type = type;
10411
            if (!n->base_addr)
10412
@@ -2177,7 +2177,7 @@
10413
     {
10414
       uint64_t mask;
10415
 
10416
-      mask = ((uint64_t) 1 << (n->range * BITS_PER_MARKER)) - 1;
10417
+      mask = ((uint64_t) 1l << (n->range * BITS_PER_MARKER)) - 1;
10418
       cmpxchg >>= (64 / BITS_PER_MARKER - n->range) * BITS_PER_MARKER;
10419
       cmpnop &= mask;
10420
     }
10421
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/var-tracking.c gcc-5.3.0-zip/gcc/var-tracking.c
10422
--- gcc-5.3.0-original/gcc/var-tracking.c       2015-03-26 09:19:00.000000000 -0400
10423 117 dgisselq
+++ gcc-5.3.0-zip/gcc/var-tracking.c    2016-03-31 18:55:03.584197958 -0400
10424 102 dgisselq
@@ -143,6 +143,13 @@
10425
 #include "rtl-iter.h"
10426
 #include "fibonacci_heap.h"
10427
 
10428 117 dgisselq
+#ifdef DO_ZIP_DEBUGS
10429 102 dgisselq
+#include <stdio.h>
10430
+extern void zip_debug_rtx(const_rtx);
10431
+#define ZIP_DEBUG_LINE(STR,RTX) do {fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10432
+#else
10433
+#define ZIP_DEBUG_LINE(STR,RTX)
10434
+#endif
10435
 typedef fibonacci_heap <long, basic_block_def> bb_heap_t;
10436
 typedef fibonacci_node <long, basic_block_def> bb_heap_node_t;
10437
 
10438
@@ -6356,6 +6363,7 @@
10439
                machine_mode indmode
10440
                  = TYPE_MODE (TREE_TYPE (argtype));
10441
                rtx mem = gen_rtx_MEM (indmode, x);
10442
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref", mem);
10443
                cselib_val *val = cselib_lookup (mem, indmode, 0, VOIDmode);
10444
                if (val && cselib_preserved_value_p (val))
10445
                  {
10446
@@ -6462,12 +6470,14 @@
10447
       machine_mode mode
10448
        = TYPE_MODE (TREE_TYPE (OBJ_TYPE_REF_EXPR (obj_type_ref)));
10449
       rtx clobbered = gen_rtx_MEM (mode, this_arg);
10450
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered", clobbered);
10451
       HOST_WIDE_INT token
10452
        = tree_to_shwi (OBJ_TYPE_REF_TOKEN (obj_type_ref));
10453
       if (token)
10454
        clobbered = plus_constant (mode, clobbered,
10455
                                   token * GET_MODE_SIZE (mode));
10456
       clobbered = gen_rtx_MEM (mode, clobbered);
10457
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered-2", clobbered);
10458
       x = gen_rtx_CONCAT (mode, gen_rtx_CLOBBER (VOIDmode, pc_rtx), clobbered);
10459
       call_arguments
10460
        = gen_rtx_EXPR_LIST (VOIDmode, x, call_arguments);
10461
@@ -9790,6 +9800,7 @@
10462
              machine_mode indmode
10463
                = TYPE_MODE (TREE_TYPE (TREE_TYPE (parm)));
10464
              rtx mem = gen_rtx_MEM (indmode, incoming);
10465
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/incoming", incoming);
10466
              cselib_val *val = cselib_lookup_from_insn (mem, indmode, true,
10467
                                                         VOIDmode,
10468
                                                         get_insns ());
10469
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgcc/config.host gcc-5.3.0-zip/libgcc/config.host
10470
--- gcc-5.3.0-original/libgcc/config.host       2015-10-01 08:01:18.000000000 -0400
10471
+++ gcc-5.3.0-zip/libgcc/config.host    2016-01-30 15:16:00.459883558 -0500
10472
@@ -195,6 +195,9 @@
10473
 tic6x-*-*)
10474
        cpu_type=c6x
10475
        ;;
10476
+zip*)
10477
+       cpu_type=zip
10478
+       ;;
10479
 esac
10480
 
10481
 # Common parts for widely ported systems.
10482
@@ -1300,6 +1303,9 @@
10483
        echo "*** Configuration ${host} not supported" 1>&2
10484
        exit 1
10485
        ;;
10486
+zip*)
10487
+       tmake_file="${tmake_file} t-softfp-sfdf t-softfp"
10488
+       ;;
10489
 esac
10490
 
10491
 case ${host} in
10492
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgomp/configure.tgt gcc-5.3.0-zip/libgomp/configure.tgt
10493
--- gcc-5.3.0-original/libgomp/configure.tgt    2015-03-13 06:57:07.000000000 -0400
10494
+++ gcc-5.3.0-zip/libgomp/configure.tgt 2016-01-30 15:16:51.323521641 -0500
10495
@@ -150,6 +150,9 @@
10496
        # Need to link with -lpthread so libgomp.so is self-contained.
10497
        XLDFLAGS="${XLDFLAGS} -lpthread"
10498
        ;;
10499
+  zip*)
10500
+        config_path="bsd posix"
10501
+        ;;
10502
 
10503
   *)
10504
        ;;

powered by: WebSVN 2.1.0

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