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

Subversion Repositories zipcpu

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

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

Line No. Rev Author Line
1 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/config.sub gcc-5.3.0-zip/config.sub
2
--- gcc-5.3.0-original/config.sub       2015-01-02 04:30:21.000000000 -0500
3
+++ gcc-5.3.0-zip/config.sub    2016-01-30 12:27:56.023073747 -0500
4
@@ -316,7 +316,7 @@
5
        | visium \
6
        | we32k \
7
        | x86 | xc16x | xstormy16 | xtensa \
8
-       | z8k | z80)
9
+       | z8k | z80 | zip)
10
                basic_machine=$basic_machine-unknown
11
                ;;
12
        c54x)
13
@@ -1547,6 +1547,9 @@
14
 # system, and we'll never get to this point.
15
 
16
 case $basic_machine in
17
+       zip-*)
18
+               os=-elf
19
+               ;;
20
        score-*)
21
                os=-elf
22
                ;;
23
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/configure gcc-5.3.0-zip/configure
24
--- gcc-5.3.0-original/configure        2015-05-03 13:29:57.000000000 -0400
25
+++ gcc-5.3.0-zip/configure     2016-01-30 16:19:48.264867231 -0500
26
@@ -3927,6 +3927,8 @@
27
   vax-*-*)
28
     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
29
     ;;
30
+  zip*)
31
+    noconfigdirs="$noconfigdirs target-libffi target-boehm-gc gdb gprof"
32
 esac
33
 
34
 # If we aren't building newlib, then don't build libgloss, since libgloss
35
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/configure.ac gcc-5.3.0-zip/configure.ac
36
--- gcc-5.3.0-original/configure.ac     2015-05-03 13:29:57.000000000 -0400
37
+++ gcc-5.3.0-zip/configure.ac  2016-02-12 10:47:23.847194843 -0500
38
@@ -1274,6 +1274,10 @@
39
   vax-*-*)
40
     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
41
     ;;
42
+  zip*)
43
+    noconfigdirs="$noconfigdirs target-libffi target-boehm-gc gdb gprof"
44
+    unsupported_languages="$unsupported_languages fortran java"
45
+    ;;
46
 esac
47
 
48
 # If we aren't building newlib, then don't build libgloss, since libgloss
49
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/common/config/zip/zip-common.c gcc-5.3.0-zip/gcc/common/config/zip/zip-common.c
50
--- gcc-5.3.0-original/gcc/common/config/zip/zip-common.c       1969-12-31 19:00:00.000000000 -0500
51
+++ gcc-5.3.0-zip/gcc/common/config/zip/zip-common.c    2016-02-14 00:54:31.821055716 -0500
52
@@ -0,0 +1,52 @@
53
+////////////////////////////////////////////////////////////////////////////////
54
+//
55
+// Filename:   common/config/zip/zip-common.c
56
+//
57
+// Project:    Zip CPU backend for the GNU Compiler Collection
58
+//
59
+// Purpose:    To eliminate the frame register automatically.
60
+//
61
+// Creator:    Dan Gisselquist, Ph.D.
62
+//             Gisselquist Technology, LLC
63
+//
64
+////////////////////////////////////////////////////////////////////////////////
65
+//
66
+// Copyright (C) 2016, Gisselquist Technology, LLC
67
+//
68
+// This program is free software (firmware): you can redistribute it and/or
69
+// modify it under the terms of  the GNU General Public License as published
70
+// by the Free Software Foundation, either version 3 of the License, or (at
71
+// your option) any later version.
72
+//
73
+// This program is distributed in the hope that it will be useful, but WITHOUT
74
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
75
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
76
+// for more details.
77
+//
78
+// You should have received a copy of the GNU General Public License along
79
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
80
+// target there if the PDF file isn't present.)  If not, see
81
+// <http://www.gnu.org/licenses/> for a copy.
82
+//
83
+// License:    GPL, v3, as defined and found on www.gnu.org,
84
+//             http://www.gnu.org/licenses/gpl.html
85
+//
86
+//
87
+////////////////////////////////////////////////////////////////////////////////
88
+#include "config.h"
89
+#include "system.h"
90
+#include "coretypes.h"
91
+#include "tm.h"
92
+#include "common/common-target.h"
93
+#include "common/common-target-def.h"
94
+
95
+static const struct default_options zip_option_optimization_table[] =
96
+  {
97
+    { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 },
98
+    { OPT_LEVELS_NONE, 0, NULL, 0 }
99
+  };
100
+
101
+#undef TARGET_OPTION_OPTIMIZATION_TABLE
102
+#define        TARGET_OPTION_OPTIMIZATION_TABLE        zip_option_optimization_table
103
+
104
+struct gcc_targetm_common      targetm_common = TARGETM_COMMON_INITIALIZER;
105
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/aarch64/aarch64-linux.h gcc-5.3.0-zip/gcc/config/aarch64/aarch64-linux.h
106
--- gcc-5.3.0-original/gcc/config/aarch64/aarch64-linux.h       2016-02-05 15:18:17.489469806 -0500
107
+++ gcc-5.3.0-zip/gcc/config/aarch64/aarch64-linux.h    2015-07-24 12:00:26.000000000 -0400
108
@@ -21,7 +21,7 @@
109
 #ifndef GCC_AARCH64_LINUX_H
110
 #define GCC_AARCH64_LINUX_H
111
 
112
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
113
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
114
 
115
 #undef  ASAN_CC1_SPEC
116
 #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
117
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/alpha/linux-elf.h gcc-5.3.0-zip/gcc/config/alpha/linux-elf.h
118
--- gcc-5.3.0-original/gcc/config/alpha/linux-elf.h     2016-02-05 15:18:17.489469806 -0500
119
+++ gcc-5.3.0-zip/gcc/config/alpha/linux-elf.h  2015-01-05 07:33:28.000000000 -0500
120
@@ -23,8 +23,8 @@
121
 #define EXTRA_SPECS \
122
 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
123
 
124
-#define GLIBC_DYNAMIC_LINKER   "/tools/lib/ld-linux.so.2"
125
-#define UCLIBC_DYNAMIC_LINKER "/tools/lib/ld-uClibc.so.0"
126
+#define GLIBC_DYNAMIC_LINKER   "/lib/ld-linux.so.2"
127
+#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
128
 #if DEFAULT_LIBC == LIBC_UCLIBC
129
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
130
 #elif DEFAULT_LIBC == LIBC_GLIBC
131
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/arm/linux-eabi.h gcc-5.3.0-zip/gcc/config/arm/linux-eabi.h
132
--- gcc-5.3.0-original/gcc/config/arm/linux-eabi.h      2016-02-05 15:18:17.489469806 -0500
133
+++ gcc-5.3.0-zip/gcc/config/arm/linux-eabi.h   2015-01-05 07:33:28.000000000 -0500
134
@@ -68,8 +68,8 @@
135
    GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI.  */
136
 
137
 #undef  GLIBC_DYNAMIC_LINKER
138
-#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/tools/lib/ld-linux.so.3"
139
-#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/tools/lib/ld-linux-armhf.so.3"
140
+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
141
+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
142
 #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
143
 
144
 #define GLIBC_DYNAMIC_LINKER \
145
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/arm/linux-elf.h gcc-5.3.0-zip/gcc/config/arm/linux-elf.h
146
--- gcc-5.3.0-original/gcc/config/arm/linux-elf.h       2016-02-05 15:18:17.489469806 -0500
147
+++ gcc-5.3.0-zip/gcc/config/arm/linux-elf.h    2015-06-23 05:26:54.000000000 -0400
148
@@ -62,7 +62,7 @@
149
 
150
 #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
151
 
152
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
153
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
154
 
155
 #define LINUX_TARGET_LINK_SPEC  "%{h*} \
156
    %{static:-Bstatic} \
157
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/bfin/linux.h gcc-5.3.0-zip/gcc/config/bfin/linux.h
158
--- gcc-5.3.0-original/gcc/config/bfin/linux.h  2016-02-05 15:18:17.489469806 -0500
159
+++ gcc-5.3.0-zip/gcc/config/bfin/linux.h       2015-01-05 07:33:28.000000000 -0500
160
@@ -45,7 +45,7 @@
161
   %{shared:-G -Bdynamic} \
162
   %{!shared: %{!static: \
163
    %{rdynamic:-export-dynamic} \
164
-   -dynamic-linker /tools/lib/ld-uClibc.so.0} \
165
+   -dynamic-linker /lib/ld-uClibc.so.0} \
166
    %{static}} -init __init -fini __fini"
167
 
168
 #undef TARGET_SUPPORTS_SYNC_CALLS
169
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/cris/linux.h gcc-5.3.0-zip/gcc/config/cris/linux.h
170
--- gcc-5.3.0-original/gcc/config/cris/linux.h  2016-02-05 15:18:17.489469806 -0500
171
+++ gcc-5.3.0-zip/gcc/config/cris/linux.h       2015-01-05 07:33:28.000000000 -0500
172
@@ -102,7 +102,7 @@
173
 #undef CRIS_DEFAULT_CPU_VERSION
174
 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
175
 
176
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
177
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
178
 
179
 #undef CRIS_LINK_SUBTARGET_SPEC
180
 #define CRIS_LINK_SUBTARGET_SPEC \
181
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/freebsd-spec.h gcc-5.3.0-zip/gcc/config/freebsd-spec.h
182
--- gcc-5.3.0-original/gcc/config/freebsd-spec.h        2016-02-05 15:18:17.489469806 -0500
183
+++ gcc-5.3.0-zip/gcc/config/freebsd-spec.h     2015-06-25 13:53:14.000000000 -0400
184
@@ -129,9 +129,9 @@
185
 #endif
186
 
187
 #if FBSD_MAJOR < 6
188
-#define FBSD_DYNAMIC_LINKER "/tools/libexec/ld-elf.so.1"
189
+#define FBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.1"
190
 #else
191
-#define FBSD_DYNAMIC_LINKER "/tools/libexec/ld-elf.so.1"
192
+#define FBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
193
 #endif
194
 
195
 /* NOTE: The freebsd-spec.h header is included also for various
196
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/frv/linux.h gcc-5.3.0-zip/gcc/config/frv/linux.h
197
--- gcc-5.3.0-original/gcc/config/frv/linux.h   2016-02-05 15:18:17.493469779 -0500
198
+++ gcc-5.3.0-zip/gcc/config/frv/linux.h        2015-01-05 07:33:28.000000000 -0500
199
@@ -34,7 +34,7 @@
200
 #define ENDFILE_SPEC \
201
   "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
202
 
203
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
204
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
205
 
206
 #undef LINK_SPEC
207
 #define LINK_SPEC "\
208
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/gnu.h gcc-5.3.0-zip/gcc/config/i386/gnu.h
209
--- gcc-5.3.0-original/gcc/config/i386/gnu.h    2016-02-05 15:18:17.493469779 -0500
210
+++ gcc-5.3.0-zip/gcc/config/i386/gnu.h 2015-01-05 07:33:28.000000000 -0500
211
@@ -22,7 +22,7 @@
212
 #define GNU_USER_LINK_EMULATION "elf_i386"
213
 
214
 #undef GNU_USER_DYNAMIC_LINKER
215
-#define GNU_USER_DYNAMIC_LINKER "/tools/lib/ld.so"
216
+#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so"
217
 
218
 #undef STARTFILE_SPEC
219
 #if defined HAVE_LD_PIE
220
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu64.h gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu64.h
221
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu64.h 2016-02-05 15:18:17.493469779 -0500
222
+++ gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu64.h      2015-01-05 07:33:28.000000000 -0500
223
@@ -22,6 +22,6 @@
224
 #define GNU_USER_LINK_EMULATION64 "elf_x86_64_fbsd"
225
 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64_fbsd"
226
 
227
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld.so.1"
228
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib/ld-kfreebsd-x86-64.so.1"
229
-#define GLIBC_DYNAMIC_LINKERX32 "/tools/lib/ld-kfreebsd-x32.so.1"
230
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
231
+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-kfreebsd-x86-64.so.1"
232
+#define GLIBC_DYNAMIC_LINKERX32 "/lib/ld-kfreebsd-x32.so.1"
233
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu.h gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu.h
234
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu.h   2016-02-05 15:18:17.493469779 -0500
235
+++ gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu.h        2015-01-05 07:33:28.000000000 -0500
236
@@ -19,4 +19,4 @@
237
 <http://www.gnu.org/licenses/>.  */
238
 
239
 #define GNU_USER_LINK_EMULATION "elf_i386_fbsd"
240
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
241
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
242
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/linux64.h gcc-5.3.0-zip/gcc/config/i386/linux64.h
243
--- gcc-5.3.0-original/gcc/config/i386/linux64.h        2016-02-05 15:18:17.493469779 -0500
244
+++ gcc-5.3.0-zip/gcc/config/i386/linux64.h     2015-01-05 07:33:28.000000000 -0500
245
@@ -27,6 +27,6 @@
246
 #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
247
 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
248
 
249
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-linux.so.2"
250
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib64/ld-linux-x86-64.so.2"
251
-#define GLIBC_DYNAMIC_LINKERX32 "/tools/libx32/ld-linux-x32.so.2"
252
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
253
+#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
254
+#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
255
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/linux.h gcc-5.3.0-zip/gcc/config/i386/linux.h
256
--- gcc-5.3.0-original/gcc/config/i386/linux.h  2016-02-05 15:18:17.493469779 -0500
257
+++ gcc-5.3.0-zip/gcc/config/i386/linux.h       2015-01-05 07:33:28.000000000 -0500
258
@@ -20,4 +20,4 @@
259
 <http://www.gnu.org/licenses/>.  */
260
 
261
 #define GNU_USER_LINK_EMULATION "elf_i386"
262
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
263
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
264
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/ia64/linux.h gcc-5.3.0-zip/gcc/config/ia64/linux.h
265
--- gcc-5.3.0-original/gcc/config/ia64/linux.h  2016-02-05 15:18:17.493469779 -0500
266
+++ gcc-5.3.0-zip/gcc/config/ia64/linux.h       2015-01-05 07:33:28.000000000 -0500
267
@@ -55,7 +55,7 @@
268
 /* Define this for shared library support because it isn't in the main
269
    linux.h file.  */
270
 
271
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux-ia64.so.2"
272
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
273
 
274
 #undef LINK_SPEC
275
 #define LINK_SPEC "\
276
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/knetbsd-gnu.h gcc-5.3.0-zip/gcc/config/knetbsd-gnu.h
277
--- gcc-5.3.0-original/gcc/config/knetbsd-gnu.h 2016-02-05 15:18:17.493469779 -0500
278
+++ gcc-5.3.0-zip/gcc/config/knetbsd-gnu.h      2015-01-05 07:33:28.000000000 -0500
279
@@ -32,4 +32,4 @@
280
 
281
 
282
 #undef GNU_USER_DYNAMIC_LINKER
283
-#define GNU_USER_DYNAMIC_LINKER "/tools/lib/ld.so.1"
284
+#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
285
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h gcc-5.3.0-zip/gcc/config/kopensolaris-gnu.h
286
--- gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h    2016-02-05 15:18:17.493469779 -0500
287
+++ gcc-5.3.0-zip/gcc/config/kopensolaris-gnu.h 2015-01-05 07:33:28.000000000 -0500
288
@@ -31,5 +31,4 @@
289
   while (0)
290
 
291
 #undef GNU_USER_DYNAMIC_LINKER
292
-#define GNU_USER_DYNAMIC_LINKER "/tools/lib/ld.so.1"
293
-
294
+#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
295
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/linux.h gcc-5.3.0-zip/gcc/config/linux.h
296
--- gcc-5.3.0-original/gcc/config/linux.h       2016-02-05 15:18:17.493469779 -0500
297
+++ gcc-5.3.0-zip/gcc/config/linux.h    2015-01-05 07:33:28.000000000 -0500
298
@@ -73,10 +73,10 @@
299
    GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
300
    GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
301
    supporting both 32-bit and 64-bit compilation.  */
302
-#define UCLIBC_DYNAMIC_LINKER "/tools/lib/ld-uClibc.so.0"
303
-#define UCLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-uClibc.so.0"
304
-#define UCLIBC_DYNAMIC_LINKER64 "/tools/lib/ld64-uClibc.so.0"
305
-#define UCLIBC_DYNAMIC_LINKERX32 "/tools/lib/ldx32-uClibc.so.0"
306
+#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
307
+#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
308
+#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
309
+#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
310
 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
311
 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
312
 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
313
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/lm32/uclinux-elf.h gcc-5.3.0-zip/gcc/config/lm32/uclinux-elf.h
314
--- gcc-5.3.0-original/gcc/config/lm32/uclinux-elf.h    2016-02-05 15:18:17.493469779 -0500
315
+++ gcc-5.3.0-zip/gcc/config/lm32/uclinux-elf.h 2015-01-05 07:33:28.000000000 -0500
316
@@ -67,7 +67,7 @@
317
    %{shared:-shared} \
318
    %{symbolic:-Bsymbolic} \
319
    %{rdynamic:-export-dynamic} \
320
-   -dynamic-linker /tools/lib/ld-linux.so.2"
321
+   -dynamic-linker /lib/ld-linux.so.2"
322
 
323
 #define TARGET_OS_CPP_BUILTINS() GNU_USER_TARGET_OS_CPP_BUILTINS()
324
 
325
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/m68k/linux.h gcc-5.3.0-zip/gcc/config/m68k/linux.h
326
--- gcc-5.3.0-original/gcc/config/m68k/linux.h  2016-02-05 15:18:17.493469779 -0500
327
+++ gcc-5.3.0-zip/gcc/config/m68k/linux.h       2015-01-05 07:33:28.000000000 -0500
328
@@ -71,7 +71,7 @@
329
    When the -shared link option is used a final link is not being
330
    done.  */
331
 
332
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
333
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
334
 
335
 #undef LINK_SPEC
336
 #define LINK_SPEC "-m m68kelf %{shared} \
337
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/microblaze/linux.h gcc-5.3.0-zip/gcc/config/microblaze/linux.h
338
--- gcc-5.3.0-original/gcc/config/microblaze/linux.h    2016-02-05 15:18:17.493469779 -0500
339
+++ gcc-5.3.0-zip/gcc/config/microblaze/linux.h 2015-05-28 10:08:19.000000000 -0400
340
@@ -28,7 +28,7 @@
341
 #undef TLS_NEEDS_GOT
342
 #define TLS_NEEDS_GOT 1
343
 
344
-#define DYNAMIC_LINKER "/tools/lib/ld.so.1"
345
+#define DYNAMIC_LINKER "/lib/ld.so.1"
346
 #undef  SUBTARGET_EXTRA_SPECS
347
 #define SUBTARGET_EXTRA_SPECS \
348
   { "dynamic_linker", DYNAMIC_LINKER }
349
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/mips/linux.h gcc-5.3.0-zip/gcc/config/mips/linux.h
350
--- gcc-5.3.0-original/gcc/config/mips/linux.h  2016-02-05 15:18:17.493469779 -0500
351
+++ gcc-5.3.0-zip/gcc/config/mips/linux.h       2015-01-05 07:33:28.000000000 -0500
352
@@ -22,20 +22,20 @@
353
 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
354
 
355
 #define GLIBC_DYNAMIC_LINKER32 \
356
-  "%{mnan=2008:/tools/lib/ld-linux-mipsn8.so.1;:/tools/lib/ld.so.1}"
357
+  "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
358
 #define GLIBC_DYNAMIC_LINKER64 \
359
-  "%{mnan=2008:/tools/lib64/ld-linux-mipsn8.so.1;:/tools/lib64/ld.so.1}"
360
+  "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}"
361
 #define GLIBC_DYNAMIC_LINKERN32 \
362
-  "%{mnan=2008:/tools/lib32/ld-linux-mipsn8.so.1;:/tools/lib32/ld.so.1}"
363
+  "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}"
364
 
365
 #undef UCLIBC_DYNAMIC_LINKER32
366
 #define UCLIBC_DYNAMIC_LINKER32 \
367
-  "%{mnan=2008:/tools/lib/ld-uClibc-mipsn8.so.0;:/tools/lib/ld-uClibc.so.0}"
368
+  "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
369
 #undef UCLIBC_DYNAMIC_LINKER64
370
 #define UCLIBC_DYNAMIC_LINKER64 \
371
-  "%{mnan=2008:/tools/lib/ld64-uClibc-mipsn8.so.0;:/tools/lib/ld64-uClibc.so.0}"
372
+  "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
373
 #define UCLIBC_DYNAMIC_LINKERN32 \
374
-  "%{mnan=2008:/tools/lib32/ld-uClibc-mipsn8.so.0;:/tools/lib32/ld-uClibc.so.0}"
375
+  "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
376
 
377
 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
378
 #define GNU_USER_DYNAMIC_LINKERN32 \
379
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/mn10300/linux.h gcc-5.3.0-zip/gcc/config/mn10300/linux.h
380
--- gcc-5.3.0-original/gcc/config/mn10300/linux.h       2016-02-05 15:18:17.493469779 -0500
381
+++ gcc-5.3.0-zip/gcc/config/mn10300/linux.h    2015-01-05 07:33:28.000000000 -0500
382
@@ -32,7 +32,7 @@
383
 #undef  ASM_SPEC
384
 #define ASM_SPEC ""
385
 
386
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
387
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
388
 
389
 #undef  LINK_SPEC
390
 #define LINK_SPEC "%{mrelax:--relax} %{shared:-shared} \
391
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/pa/pa-linux.h gcc-5.3.0-zip/gcc/config/pa/pa-linux.h
392
--- gcc-5.3.0-original/gcc/config/pa/pa-linux.h 2016-02-05 15:18:17.493469779 -0500
393
+++ gcc-5.3.0-zip/gcc/config/pa/pa-linux.h      2015-09-24 20:04:26.000000000 -0400
394
@@ -37,7 +37,7 @@
395
 /* Define this for shared library support because it isn't in the main
396
    linux.h file.  */
397
 
398
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
399
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
400
 
401
 #undef LINK_SPEC
402
 #define LINK_SPEC "\
403
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/rs6000/linux64.h gcc-5.3.0-zip/gcc/config/rs6000/linux64.h
404
--- gcc-5.3.0-original/gcc/config/rs6000/linux64.h      2016-02-05 15:18:17.493469779 -0500
405
+++ gcc-5.3.0-zip/gcc/config/rs6000/linux64.h   2015-03-09 19:18:57.000000000 -0400
406
@@ -357,14 +357,14 @@
407
 #undef LINK_OS_DEFAULT_SPEC
408
 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
409
 
410
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld.so.1"
411
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
412
 #ifdef LINUX64_DEFAULT_ABI_ELFv2
413
-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/tools/lib64/ld64.so.1;:/tools/lib64/ld64.so.2}"
414
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
415
 #else
416
-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/tools/lib64/ld64.so.2;:/tools/lib64/ld64.so.1}"
417
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
418
 #endif
419
-#define UCLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-uClibc.so.0"
420
-#define UCLIBC_DYNAMIC_LINKER64 "/tools/lib/ld64-uClibc.so.0"
421
+#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
422
+#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
423
 #if DEFAULT_LIBC == LIBC_UCLIBC
424
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
425
 #elif DEFAULT_LIBC == LIBC_GLIBC
426
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/rs6000/sysv4.h gcc-5.3.0-zip/gcc/config/rs6000/sysv4.h
427
--- gcc-5.3.0-original/gcc/config/rs6000/sysv4.h        2016-02-05 15:18:17.493469779 -0500
428
+++ gcc-5.3.0-zip/gcc/config/rs6000/sysv4.h     2015-09-24 09:46:45.000000000 -0400
429
@@ -757,8 +757,8 @@
430
 
431
 #define LINK_START_LINUX_SPEC ""
432
 
433
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
434
-#define UCLIBC_DYNAMIC_LINKER "/tools/lib/ld-uClibc.so.0"
435
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
436
+#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
437
 #if DEFAULT_LIBC == LIBC_UCLIBC
438
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
439
 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
440
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/rs6000/sysv4.h.orig gcc-5.3.0-zip/gcc/config/rs6000/sysv4.h.orig
441
--- gcc-5.3.0-original/gcc/config/rs6000/sysv4.h.orig   2015-09-24 09:46:45.000000000 -0400
442
+++ gcc-5.3.0-zip/gcc/config/rs6000/sysv4.h.orig        1969-12-31 19:00:00.000000000 -0500
443
@@ -1,945 +0,0 @@
444
-/* Target definitions for GNU compiler for PowerPC running System V.4
445
-   Copyright (C) 1995-2015 Free Software Foundation, Inc.
446
-   Contributed by Cygnus Support.
447
-
448
-   This file is part of GCC.
449
-
450
-   GCC is free software; you can redistribute it and/or modify it
451
-   under the terms of the GNU General Public License as published
452
-   by the Free Software Foundation; either version 3, or (at your
453
-   option) any later version.
454
-
455
-   GCC is distributed in the hope that it will be useful, but WITHOUT
456
-   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
457
-   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
458
-   License for more details.
459
-
460
-   Under Section 7 of GPL version 3, you are granted additional
461
-   permissions described in the GCC Runtime Library Exception, version
462
-   3.1, as published by the Free Software Foundation.
463
-
464
-   You should have received a copy of the GNU General Public License and
465
-   a copy of the GCC Runtime Library Exception along with this program;
466
-   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
467
-   <http://www.gnu.org/licenses/>.  */
468
-
469
-/* Header files should be C++ aware in general.  */
470
-#undef  NO_IMPLICIT_EXTERN_C
471
-#define NO_IMPLICIT_EXTERN_C
472
-
473
-/* Yes!  We are ELF.  */
474
-#define        TARGET_OBJECT_FORMAT OBJECT_ELF
475
-
476
-/* Default ABI to compile code for.  */
477
-#define DEFAULT_ABI rs6000_current_abi
478
-
479
-/* Default ABI to use.  */
480
-#define RS6000_ABI_NAME "sysv"
481
-
482
-/* Override rs6000.h definition.  */
483
-#undef ASM_DEFAULT_SPEC
484
-#define        ASM_DEFAULT_SPEC "-mppc"
485
-
486
-#define        TARGET_TOC              ((rs6000_isa_flags & OPTION_MASK_64BIT) \
487
-                                || ((rs6000_isa_flags                  \
488
-                                     & (OPTION_MASK_RELOCATABLE        \
489
-                                        | OPTION_MASK_MINIMAL_TOC))    \
490
-                                    && flag_pic > 1)                   \
491
-                                || DEFAULT_ABI != ABI_V4)
492
-
493
-#define        TARGET_BITFIELD_TYPE    (! TARGET_NO_BITFIELD_TYPE)
494
-#define        TARGET_BIG_ENDIAN       (! TARGET_LITTLE_ENDIAN)
495
-#define        TARGET_PROTOTYPE        target_prototype
496
-#define        TARGET_NO_PROTOTYPE     (! TARGET_PROTOTYPE)
497
-#define        TARGET_NO_TOC           (! TARGET_TOC)
498
-#define        TARGET_NO_EABI          (! TARGET_EABI)
499
-#define        TARGET_REGNAMES         rs6000_regnames
500
-
501
-#ifdef HAVE_AS_REL16
502
-#undef TARGET_SECURE_PLT
503
-#define TARGET_SECURE_PLT      secure_plt
504
-#endif
505
-
506
-#define SDATA_DEFAULT_SIZE 8
507
-
508
-/* The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
509
-   get control in TARGET_OPTION_OVERRIDE.  */
510
-
511
-#define SUBTARGET_OVERRIDE_OPTIONS                                     \
512
-do {                                                                   \
513
-  if (!global_options_set.x_g_switch_value)                            \
514
-    g_switch_value = SDATA_DEFAULT_SIZE;                               \
515
-                                                                       \
516
-  if (rs6000_abi_name == NULL)                                         \
517
-    rs6000_abi_name = RS6000_ABI_NAME;                                 \
518
-                                                                       \
519
-  if (!strcmp (rs6000_abi_name, "sysv"))                               \
520
-    rs6000_current_abi = ABI_V4;                                       \
521
-  else if (!strcmp (rs6000_abi_name, "sysv-noeabi"))                   \
522
-    {                                                                  \
523
-      rs6000_current_abi = ABI_V4;                                     \
524
-      rs6000_isa_flags &= ~ OPTION_MASK_EABI;                          \
525
-    }                                                                  \
526
-  else if (!strcmp (rs6000_abi_name, "sysv-eabi")                      \
527
-          || !strcmp (rs6000_abi_name, "eabi"))                        \
528
-    {                                                                  \
529
-      rs6000_current_abi = ABI_V4;                                     \
530
-      rs6000_isa_flags |= OPTION_MASK_EABI;                            \
531
-    }                                                                  \
532
-  else if (!strcmp (rs6000_abi_name, "aixdesc"))                       \
533
-    rs6000_current_abi = ABI_AIX;                                      \
534
-  else if (!strcmp (rs6000_abi_name, "freebsd")                                \
535
-          || !strcmp (rs6000_abi_name, "linux"))                       \
536
-    {                                                                  \
537
-      if (TARGET_64BIT)                                                        \
538
-       rs6000_current_abi = ABI_AIX;                                   \
539
-      else                                                             \
540
-       rs6000_current_abi = ABI_V4;                                    \
541
-    }                                                                  \
542
-  else if (!strcmp (rs6000_abi_name, "netbsd"))                                \
543
-    rs6000_current_abi = ABI_V4;                                       \
544
-  else if (!strcmp (rs6000_abi_name, "openbsd"))                       \
545
-    rs6000_current_abi = ABI_V4;                                       \
546
-  else if (!strcmp (rs6000_abi_name, "i960-old"))                      \
547
-    {                                                                  \
548
-      rs6000_current_abi = ABI_V4;                                     \
549
-      rs6000_isa_flags |= (OPTION_MASK_LITTLE_ENDIAN | OPTION_MASK_EABI); \
550
-      rs6000_isa_flags &= ~OPTION_MASK_STRICT_ALIGN;                   \
551
-      TARGET_NO_BITFIELD_WORD = 1;                                     \
552
-    }                                                                  \
553
-  else                                                                 \
554
-    {                                                                  \
555
-      rs6000_current_abi = ABI_V4;                                     \
556
-      error ("bad value for -mcall-%s", rs6000_abi_name);              \
557
-    }                                                                  \
558
-                                                                       \
559
-  if (rs6000_sdata_name)                                               \
560
-    {                                                                  \
561
-      if (!strcmp (rs6000_sdata_name, "none"))                         \
562
-       rs6000_sdata = SDATA_NONE;                                      \
563
-      else if (!strcmp (rs6000_sdata_name, "data"))                    \
564
-       rs6000_sdata = SDATA_DATA;                                      \
565
-      else if (!strcmp (rs6000_sdata_name, "default"))                 \
566
-       rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV;         \
567
-      else if (!strcmp (rs6000_sdata_name, "sysv"))                    \
568
-       rs6000_sdata = SDATA_SYSV;                                      \
569
-      else if (!strcmp (rs6000_sdata_name, "eabi"))                    \
570
-       rs6000_sdata = SDATA_EABI;                                      \
571
-      else                                                             \
572
-       error ("bad value for -msdata=%s", rs6000_sdata_name);          \
573
-    }                                                                  \
574
-  else if (DEFAULT_ABI == ABI_V4)                                      \
575
-    {                                                                  \
576
-      rs6000_sdata = SDATA_DATA;                                       \
577
-      rs6000_sdata_name = "data";                                      \
578
-    }                                                                  \
579
-  else                                                                 \
580
-    {                                                                  \
581
-      rs6000_sdata = SDATA_NONE;                                       \
582
-      rs6000_sdata_name = "none";                                      \
583
-    }                                                                  \
584
-                                                                       \
585
-  if (TARGET_RELOCATABLE &&                                            \
586
-      (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV))      \
587
-    {                                                                  \
588
-      rs6000_sdata = SDATA_DATA;                                       \
589
-      error ("-mrelocatable and -msdata=%s are incompatible",          \
590
-            rs6000_sdata_name);                                        \
591
-    }                                                                  \
592
-                                                                       \
593
-  else if (flag_pic && DEFAULT_ABI == ABI_V4                           \
594
-          && (rs6000_sdata == SDATA_EABI                               \
595
-              || rs6000_sdata == SDATA_SYSV))                          \
596
-    {                                                                  \
597
-      rs6000_sdata = SDATA_DATA;                                       \
598
-      error ("-f%s and -msdata=%s are incompatible",                   \
599
-            (flag_pic > 1) ? "PIC" : "pic",                            \
600
-            rs6000_sdata_name);                                        \
601
-    }                                                                  \
602
-                                                                       \
603
-  if ((rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4)            \
604
-      || (rs6000_sdata == SDATA_EABI && !TARGET_EABI))                 \
605
-    {                                                                  \
606
-      rs6000_sdata = SDATA_NONE;                                       \
607
-      error ("-msdata=%s and -mcall-%s are incompatible",              \
608
-            rs6000_sdata_name, rs6000_abi_name);                       \
609
-    }                                                                  \
610
-                                                                       \
611
-  targetm.have_srodata_section = rs6000_sdata == SDATA_EABI;           \
612
-                                                                       \
613
-  if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC)                       \
614
-    {                                                                  \
615
-      rs6000_isa_flags |= OPTION_MASK_MINIMAL_TOC;                     \
616
-      error ("-mrelocatable and -mno-minimal-toc are incompatible");   \
617
-    }                                                                  \
618
-                                                                       \
619
-  if (TARGET_RELOCATABLE && rs6000_current_abi != ABI_V4)              \
620
-    {                                                                  \
621
-      rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE;                    \
622
-      error ("-mrelocatable and -mcall-%s are incompatible",           \
623
-            rs6000_abi_name);                                          \
624
-    }                                                                  \
625
-                                                                       \
626
-  if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi != ABI_V4)   \
627
-    {                                                                  \
628
-      flag_pic = 0;                                                    \
629
-      error ("-fPIC and -mcall-%s are incompatible",                   \
630
-            rs6000_abi_name);                                          \
631
-    }                                                                  \
632
-                                                                       \
633
-  if (TARGET_SECURE_PLT != secure_plt)                                 \
634
-    {                                                                  \
635
-      error ("-msecure-plt not supported by your assembler");          \
636
-    }                                                                  \
637
-                                                                       \
638
-  /* Treat -fPIC the same as -mrelocatable.  */                                \
639
-  if (flag_pic > 1 && DEFAULT_ABI == ABI_V4)                           \
640
-    {                                                                  \
641
-      rs6000_isa_flags |= OPTION_MASK_RELOCATABLE | OPTION_MASK_MINIMAL_TOC; \
642
-      TARGET_NO_FP_IN_TOC = 1;                                         \
643
-    }                                                                  \
644
-                                                                       \
645
-  else if (TARGET_RELOCATABLE)                                         \
646
-    if (!flag_pic)                                                     \
647
-      flag_pic = 2;                                                    \
648
-} while (0)
649
-
650
-#ifndef RS6000_BI_ARCH
651
-# define SUBSUBTARGET_OVERRIDE_OPTIONS                                 \
652
-do {                                                                   \
653
-  if ((TARGET_DEFAULT ^ rs6000_isa_flags) & OPTION_MASK_64BIT)         \
654
-    error ("-m%s not supported in this configuration",                 \
655
-          (rs6000_isa_flags & OPTION_MASK_64BIT) ? "64" : "32");       \
656
-} while (0)
657
-#endif
658
-
659
-/* Override rs6000.h definition.  */
660
-#undef TARGET_DEFAULT
661
-#define        TARGET_DEFAULT 0
662
-
663
-/* Override rs6000.h definition.  */
664
-#undef PROCESSOR_DEFAULT
665
-#define        PROCESSOR_DEFAULT PROCESSOR_PPC750
666
-
667
-#define FIXED_R2 1
668
-/* System V.4 uses register 13 as a pointer to the small data area,
669
-   so it is not available to the normal user.  */
670
-#define FIXED_R13 1
671
-
672
-/* Override default big endianism definitions in rs6000.h.  */
673
-#undef BYTES_BIG_ENDIAN
674
-#undef WORDS_BIG_ENDIAN
675
-#define        BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
676
-#define        WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
677
-
678
-/* Put jump tables in read-only memory, rather than in .text.  */
679
-#define JUMP_TABLES_IN_TEXT_SECTION 0
680
-
681
-/* Prefix and suffix to use to saving floating point.  */
682
-#define        SAVE_FP_PREFIX "_savefpr_"
683
-#define SAVE_FP_SUFFIX ""
684
-
685
-/* Prefix and suffix to use to restoring floating point.  */
686
-#define        RESTORE_FP_PREFIX "_restfpr_"
687
-#define RESTORE_FP_SUFFIX ""
688
-
689
-/* Type used for size_t, as a string used in a declaration.  */
690
-#undef  SIZE_TYPE
691
-#define SIZE_TYPE "unsigned int"
692
-
693
-/* Type used for ptrdiff_t, as a string used in a declaration.  */
694
-#define PTRDIFF_TYPE "int"
695
-
696
-#undef WCHAR_TYPE
697
-#define WCHAR_TYPE "long int"
698
-
699
-#undef WCHAR_TYPE_SIZE
700
-#define WCHAR_TYPE_SIZE 32
701
-
702
-/* Make int foo : 8 not cause structures to be aligned to an int boundary.  */
703
-/* Override elfos.h definition.  */
704
-#undef PCC_BITFIELD_TYPE_MATTERS
705
-#define        PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
706
-
707
-#undef BITFIELD_NBYTES_LIMITED
708
-#define        BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD)
709
-
710
-/* Define this macro to be the value 1 if instructions will fail to
711
-   work if given data not on the nominal alignment.  If instructions
712
-   will merely go slower in that case, define this macro as 0.  */
713
-#undef STRICT_ALIGNMENT
714
-#define        STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
715
-
716
-/* Define this macro if you wish to preserve a certain alignment for
717
-   the stack pointer, greater than what the hardware enforces.  The
718
-   definition is a C expression for the desired alignment (measured
719
-   in bits).  This macro must evaluate to a value equal to or larger
720
-   than STACK_BOUNDARY.
721
-   For the SYSV ABI and variants the alignment of the stack pointer
722
-   is usually controlled manually in rs6000.c. However, to maintain
723
-   alignment across alloca () in all circumstances,
724
-   PREFERRED_STACK_BOUNDARY needs to be set as well.
725
-   This has the additional advantage of allowing a bigger maximum
726
-   alignment of user objects on the stack.  */
727
-
728
-#undef PREFERRED_STACK_BOUNDARY
729
-#define PREFERRED_STACK_BOUNDARY 128
730
-
731
-/* Real stack boundary as mandated by the appropriate ABI.  */
732
-#define ABI_STACK_BOUNDARY \
733
-  ((TARGET_EABI && !TARGET_ALTIVEC && !TARGET_ALTIVEC_ABI) ? 64 : 128)
734
-
735
-/* An expression for the alignment of a structure field FIELD if the
736
-   alignment computed in the usual way is COMPUTED.  */
737
-#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED)                                  \
738
-       (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED))            \
739
-        ? 128 : COMPUTED)
740
-
741
-#undef  BIGGEST_FIELD_ALIGNMENT
742
-
743
-/* Use ELF style section commands.  */
744
-
745
-#define        TEXT_SECTION_ASM_OP     "\t.section\t\".text\""
746
-
747
-#define        DATA_SECTION_ASM_OP     "\t.section\t\".data\""
748
-
749
-#define        BSS_SECTION_ASM_OP      "\t.section\t\".bss\""
750
-
751
-/* Override elfos.h definition.  */
752
-#undef INIT_SECTION_ASM_OP
753
-#define        INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
754
-
755
-/* Override elfos.h definition.  */
756
-#undef FINI_SECTION_ASM_OP
757
-#define        FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
758
-
759
-#define        TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
760
-
761
-/* Put PC relative got entries in .got2.  */
762
-#define        MINIMAL_TOC_SECTION_ASM_OP \
763
-  (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI == ABI_V4)           \
764
-   ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
765
-
766
-#define        SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
767
-#define        SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
768
-#define        SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits"
769
-
770
-/* Override default elf definitions.  */
771
-#define TARGET_ASM_INIT_SECTIONS rs6000_elf_asm_init_sections
772
-#undef  TARGET_ASM_RELOC_RW_MASK
773
-#define TARGET_ASM_RELOC_RW_MASK rs6000_elf_reloc_rw_mask
774
-#undef TARGET_ASM_SELECT_RTX_SECTION
775
-#define        TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section
776
-
777
-/* Return nonzero if this entry is to be written into the constant pool
778
-   in a special way.  We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
779
-   containing one of them.  If -mfp-in-toc (the default), we also do
780
-   this for floating-point constants.  We actually can only do this
781
-   if the FP formats of the target and host machines are the same, but
782
-   we can't check that since not every file that uses these target macros
783
-   includes real.h.
784
-
785
-   Unlike AIX, we don't key off of -mminimal-toc, but instead do not
786
-   allow floating point constants in the TOC if -mrelocatable.  */
787
-
788
-#undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
789
-#define        ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE)                        \
790
-  (TARGET_TOC                                                          \
791
-   && (GET_CODE (X) == SYMBOL_REF                                      \
792
-       || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS     \
793
-          && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF)           \
794
-       || GET_CODE (X) == LABEL_REF                                    \
795
-       || (GET_CODE (X) == CONST_INT                                   \
796
-          && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))      \
797
-       || (!TARGET_NO_FP_IN_TOC                                                \
798
-          && !TARGET_RELOCATABLE                                       \
799
-          && GET_CODE (X) == CONST_DOUBLE                              \
800
-          && SCALAR_FLOAT_MODE_P (GET_MODE (X))                        \
801
-          && BITS_PER_WORD == HOST_BITS_PER_INT)))
802
-
803
-/* These macros generate the special .type and .size directives which
804
-   are used to set the corresponding fields of the linker symbol table
805
-   entries in an ELF object file under SVR4.  These macros also output
806
-   the starting labels for the relevant functions/objects.  */
807
-
808
-/* Write the extra assembler code needed to declare a function properly.
809
-   Some svr4 assemblers need to also have something extra said about the
810
-   function's return value.  We allow for that here.  */
811
-
812
-/* Override elfos.h definition.  */
813
-#undef ASM_DECLARE_FUNCTION_NAME
814
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                    \
815
-  rs6000_elf_declare_function_name ((FILE), (NAME), (DECL))
816
-
817
-/* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore
818
-   flag.  The LOCAL_LABEL_PREFIX variable is used by dbxelf.h.  */
819
-
820
-#define        LOCAL_LABEL_PREFIX "."
821
-#define        USER_LABEL_PREFIX ""
822
-
823
-#define        ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX)   \
824
-  asm_fprintf (FILE, "%L%s", PREFIX)
825
-
826
-/* Globalizing directive for a label.  */
827
-#define GLOBAL_ASM_OP "\t.globl "
828
-
829
-/* This says how to output assembler code to declare an
830
-   uninitialized internal linkage data object.  Under SVR4,
831
-   the linker seems to want the alignment of data objects
832
-   to depend on their types.  We do exactly that here.  */
833
-
834
-#define        LOCAL_ASM_OP    "\t.local\t"
835
-
836
-#define        LCOMM_ASM_OP    "\t.lcomm\t"
837
-
838
-/* Describe how to emit uninitialized local items.  */
839
-#define        ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN)    \
840
-do {                                                                   \
841
-  if ((DECL) && rs6000_elf_in_small_data_p (DECL))                     \
842
-    {                                                                  \
843
-      switch_to_section (sbss_section);                                        \
844
-      ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT));     \
845
-      ASM_OUTPUT_LABEL (FILE, NAME);                                   \
846
-      ASM_OUTPUT_SKIP (FILE, SIZE);                                    \
847
-      if (!flag_inhibit_size_directive && (SIZE) > 0)                  \
848
-       ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE);                   \
849
-    }                                                                  \
850
-  else                                                                 \
851
-    {                                                                  \
852
-      fprintf (FILE, "%s", LCOMM_ASM_OP);                              \
853
-      assemble_name ((FILE), (NAME));                                  \
854
-      fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n",         \
855
-              (SIZE), (ALIGN) / BITS_PER_UNIT);                        \
856
-    }                                                                  \
857
-  ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");                    \
858
-} while (0)
859
-
860
-/* Describe how to emit uninitialized external linkage items.  */
861
-#define        ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)           \
862
-do {                                                                   \
863
-  ASM_OUTPUT_ALIGNED_DECL_LOCAL (FILE, DECL, NAME, SIZE, ALIGN);       \
864
-} while (0)
865
-
866
-#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
867
-/* To support -falign-* switches we need to use .p2align so
868
-   that alignment directives in code sections will be padded
869
-   with no-op instructions, rather than zeroes.  */
870
-#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP)                   \
871
-  if ((LOG) != 0)                                                      \
872
-    {                                                                  \
873
-      if ((MAX_SKIP) == 0)                                             \
874
-       fprintf ((FILE), "\t.p2align %d\n", (LOG));                     \
875
-      else                                                             \
876
-       fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));     \
877
-    }
878
-#endif
879
-
880
-/* This is how to output code to push a register on the stack.
881
-   It need not be very fast code.
882
-
883
-   On the rs6000, we must keep the backchain up to date.  In order
884
-   to simplify things, always allocate 16 bytes for a push (System V
885
-   wants to keep stack aligned to a 16 byte boundary).  */
886
-
887
-#define        ASM_OUTPUT_REG_PUSH(FILE, REGNO)                                \
888
-do {                                                                   \
889
-  if (DEFAULT_ABI == ABI_V4)                                           \
890
-    asm_fprintf (FILE,                                                 \
891
-                "\tstwu %s,-16(%s)\n\tstw %s,12(%s)\n",        \
892
-                reg_names[1], reg_names[1], reg_names[REGNO],          \
893
-                reg_names[1]);                                         \
894
-} while (0)
895
-
896
-/* This is how to output an insn to pop a register from the stack.
897
-   It need not be very fast code.  */
898
-
899
-#define        ASM_OUTPUT_REG_POP(FILE, REGNO)                                 \
900
-do {                                                                   \
901
-  if (DEFAULT_ABI == ABI_V4)                                           \
902
-    asm_fprintf (FILE,                                                 \
903
-                "\tlwz %s,12(%s)\n\taddi %s,%s,16\n",  \
904
-                reg_names[REGNO], reg_names[1], reg_names[1],          \
905
-                reg_names[1]);                                         \
906
-} while (0)
907
-
908
-extern int fixuplabelno;
909
-
910
-/* Handle constructors specially for -mrelocatable.  */
911
-#define TARGET_ASM_CONSTRUCTOR  rs6000_elf_asm_out_constructor
912
-#define TARGET_ASM_DESTRUCTOR   rs6000_elf_asm_out_destructor
913
-
914
-/* This is the end of what might become sysv4.h.  */
915
-
916
-/* Use DWARF 2 debugging information by default.  */
917
-#undef  PREFERRED_DEBUGGING_TYPE
918
-#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
919
-
920
-/* Historically we have also supported stabs debugging.  */
921
-#define DBX_DEBUGGING_INFO 1
922
-
923
-#define TARGET_ENCODE_SECTION_INFO  rs6000_elf_encode_section_info
924
-#define TARGET_IN_SMALL_DATA_P  rs6000_elf_in_small_data_p
925
-
926
-/* The ELF version doesn't encode [DS] or whatever at the end of symbols.  */
927
-
928
-#define        RS6000_OUTPUT_BASENAME(FILE, NAME)      \
929
-    assemble_name (FILE, NAME)
930
-
931
-/* We have to output the stabs for the function name *first*, before
932
-   outputting its label.  */
933
-
934
-#define        DBX_FUNCTION_FIRST
935
-
936
-/* This is the end of what might become sysv4dbx.h.  */
937
-
938
-#define TARGET_OS_SYSV_CPP_BUILTINS()          \
939
-  do                                           \
940
-    {                                          \
941
-      if (rs6000_isa_flags_explicit            \
942
-         & OPTION_MASK_RELOCATABLE)            \
943
-       builtin_define ("_RELOCATABLE");        \
944
-    }                                          \
945
-  while (0)
946
-
947
-#ifndef        TARGET_OS_CPP_BUILTINS
948
-#define TARGET_OS_CPP_BUILTINS()               \
949
-  do                                           \
950
-    {                                          \
951
-      builtin_define_std ("PPC");              \
952
-      builtin_define_std ("unix");             \
953
-      builtin_define ("__svr4__");             \
954
-      builtin_assert ("system=unix");          \
955
-      builtin_assert ("system=svr4");          \
956
-      builtin_assert ("cpu=powerpc");          \
957
-      builtin_assert ("machine=powerpc");      \
958
-      TARGET_OS_SYSV_CPP_BUILTINS ();          \
959
-    }                                          \
960
-  while (0)
961
-#endif
962
-
963
-/* Select one of BIG_OPT, LITTLE_OPT or DEFAULT_OPT depending
964
-   on various -mbig, -mlittle and -mcall- options.  */
965
-#define ENDIAN_SELECT(BIG_OPT, LITTLE_OPT, DEFAULT_OPT)        \
966
-"%{mlittle|mlittle-endian:"    LITTLE_OPT ";"  \
967
-  "mbig|mbig-endian:"          BIG_OPT    ";"  \
968
-  "mcall-i960-old:"            LITTLE_OPT ";"  \
969
-  ":"                          DEFAULT_OPT "}"
970
-
971
-#define DEFAULT_ASM_ENDIAN " -mbig"
972
-
973
-#undef ASM_SPEC
974
-#define        ASM_SPEC "%(asm_cpu) \
975
-%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
976
-%{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
977
-%{memb|msdata=eabi: -memb}" \
978
-ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
979
-
980
-#ifndef CC1_SECURE_PLT_DEFAULT_SPEC
981
-#define CC1_SECURE_PLT_DEFAULT_SPEC ""
982
-#endif
983
-
984
-/* Pass -G xxx to the compiler.  */
985
-#undef CC1_SPEC
986
-#define        CC1_SPEC "%{G*} %(cc1_cpu)" \
987
-"%{meabi: %{!mcall-*: -mcall-sysv }} \
988
-%{!meabi: %{!mno-eabi: \
989
-    %{mrelocatable: -meabi } \
990
-    %{mcall-freebsd: -mno-eabi } \
991
-    %{mcall-i960-old: -meabi } \
992
-    %{mcall-linux: -mno-eabi } \
993
-    %{mcall-netbsd: -mno-eabi } \
994
-    %{mcall-openbsd: -mno-eabi }}} \
995
-%{msdata: -msdata=default} \
996
-%{mno-sdata: -msdata=none} \
997
-%{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \
998
-%{profile: -p}"
999
-
1000
-/* Default starting address if specified.  */
1001
-#define LINK_START_SPEC "\
1002
-%{mads         : %(link_start_ads)         ; \
1003
-  myellowknife : %(link_start_yellowknife) ; \
1004
-  mmvme        : %(link_start_mvme)        ; \
1005
-  msim         : %(link_start_sim)         ; \
1006
-  mcall-freebsd: %(link_start_freebsd)     ; \
1007
-  mcall-linux  : %(link_start_linux)       ; \
1008
-  mcall-netbsd : %(link_start_netbsd)      ; \
1009
-  mcall-openbsd: %(link_start_openbsd)     ; \
1010
-               : %(link_start_default)     }"
1011
-
1012
-#define LINK_START_DEFAULT_SPEC ""
1013
-
1014
-#undef LINK_SPEC
1015
-#define        LINK_SPEC "\
1016
-%{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \
1017
-%{R*} \
1018
-%(link_shlib) \
1019
-%{!T*: %(link_start) } \
1020
-%(link_os)"
1021
-
1022
-/* Shared libraries are not default.  */
1023
-#define LINK_SHLIB_SPEC "\
1024
-%{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
1025
-%{static: } \
1026
-%{shared:-G -dy -z text } \
1027
-%{symbolic:-Bsymbolic -G -dy -z text }"
1028
-
1029
-/* Any specific OS flags.  */
1030
-#define LINK_OS_SPEC "\
1031
-%{mads         : %(link_os_ads)         ; \
1032
-  myellowknife : %(link_os_yellowknife) ; \
1033
-  mmvme        : %(link_os_mvme)        ; \
1034
-  msim         : %(link_os_sim)         ; \
1035
-  mcall-freebsd: %(link_os_freebsd)     ; \
1036
-  mcall-linux  : %(link_os_linux)       ; \
1037
-  mcall-netbsd : %(link_os_netbsd)      ; \
1038
-  mcall-openbsd: %(link_os_openbsd)     ; \
1039
-               : %(link_os_default)     }"
1040
-
1041
-#define LINK_OS_DEFAULT_SPEC ""
1042
-
1043
-#define DRIVER_SELF_SPECS "%{mfpu=none: %<mfpu=* \
1044
-       %<msingle-float %<mdouble-float}"
1045
-
1046
-/* Override rs6000.h definition.  */
1047
-#undef CPP_SPEC
1048
-#define        CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
1049
-%{mads         : %(cpp_os_ads)         ; \
1050
-  myellowknife : %(cpp_os_yellowknife) ; \
1051
-  mmvme        : %(cpp_os_mvme)        ; \
1052
-  msim         : %(cpp_os_sim)         ; \
1053
-  mcall-freebsd: %(cpp_os_freebsd)     ; \
1054
-  mcall-linux  : %(cpp_os_linux)       ; \
1055
-  mcall-netbsd : %(cpp_os_netbsd)      ; \
1056
-  mcall-openbsd: %(cpp_os_openbsd)     ; \
1057
-               : %(cpp_os_default)     }"
1058
-
1059
-#define        CPP_OS_DEFAULT_SPEC ""
1060
-
1061
-#undef STARTFILE_SPEC
1062
-#define        STARTFILE_SPEC "\
1063
-%{mads         : %(startfile_ads)         ; \
1064
-  myellowknife : %(startfile_yellowknife) ; \
1065
-  mmvme        : %(startfile_mvme)        ; \
1066
-  msim         : %(startfile_sim)         ; \
1067
-  mcall-freebsd: %(startfile_freebsd)     ; \
1068
-  mcall-linux  : %(startfile_linux)       ; \
1069
-  mcall-netbsd : %(startfile_netbsd)      ; \
1070
-  mcall-openbsd: %(startfile_openbsd)     ; \
1071
-               : %(startfile_default)     }"
1072
-
1073
-#define        STARTFILE_DEFAULT_SPEC "ecrti.o%s crtbegin.o%s"
1074
-
1075
-#undef LIB_SPEC
1076
-#define        LIB_SPEC "\
1077
-%{mads         : %(lib_ads)         ; \
1078
-  myellowknife : %(lib_yellowknife) ; \
1079
-  mmvme        : %(lib_mvme)        ; \
1080
-  msim         : %(lib_sim)         ; \
1081
-  mcall-freebsd: %(lib_freebsd)     ; \
1082
-  mcall-linux  : %(lib_linux)       ; \
1083
-  mcall-netbsd : %(lib_netbsd)      ; \
1084
-  mcall-openbsd: %(lib_openbsd)     ; \
1085
-               : %(lib_default)     }"
1086
-
1087
-#define LIB_DEFAULT_SPEC "-lc"
1088
-
1089
-#undef ENDFILE_SPEC
1090
-#define        ENDFILE_SPEC "\
1091
-%{mads         : %(endfile_ads)         ; \
1092
-  myellowknife : %(endfile_yellowknife) ; \
1093
-  mmvme        : %(endfile_mvme)        ; \
1094
-  msim         : %(endfile_sim)         ; \
1095
-  mcall-freebsd: %(endfile_freebsd)     ; \
1096
-  mcall-linux  : %(endfile_linux)       ; \
1097
-  mcall-netbsd : %(endfile_netbsd)      ; \
1098
-  mcall-openbsd: %(endfile_openbsd)     ; \
1099
-               : %(crtsavres_default) %(endfile_default)     }"
1100
-
1101
-#define CRTSAVRES_DEFAULT_SPEC ""
1102
-
1103
-#define        ENDFILE_DEFAULT_SPEC "crtend.o%s ecrtn.o%s"
1104
-
1105
-/* Motorola ADS support.  */
1106
-#define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
1107
-
1108
-#define        STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
1109
-
1110
-#define        ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s"
1111
-
1112
-#define LINK_START_ADS_SPEC "-T ads.ld%s"
1113
-
1114
-#define LINK_OS_ADS_SPEC ""
1115
-
1116
-#define CPP_OS_ADS_SPEC ""
1117
-
1118
-/* Motorola Yellowknife support.  */
1119
-#define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
1120
-
1121
-#define        STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
1122
-
1123
-#define        ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s"
1124
-
1125
-#define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
1126
-
1127
-#define LINK_OS_YELLOWKNIFE_SPEC ""
1128
-
1129
-#define CPP_OS_YELLOWKNIFE_SPEC ""
1130
-
1131
-/* Motorola MVME support.  */
1132
-#define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
1133
-
1134
-#define        STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
1135
-
1136
-#define        ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s"
1137
-
1138
-#define LINK_START_MVME_SPEC "-Ttext 0x40000"
1139
-
1140
-#define LINK_OS_MVME_SPEC ""
1141
-
1142
-#define CPP_OS_MVME_SPEC ""
1143
-
1144
-/* PowerPC simulator based on netbsd system calls support.  */
1145
-#define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
1146
-
1147
-#define        STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s"
1148
-
1149
-#define        ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s"
1150
-
1151
-#define LINK_START_SIM_SPEC ""
1152
-
1153
-#define LINK_OS_SIM_SPEC "-m elf32ppcsim"
1154
-
1155
-#define CPP_OS_SIM_SPEC ""
1156
-
1157
-/* FreeBSD support.  */
1158
-
1159
-#define CPP_OS_FREEBSD_SPEC    "\
1160
-  -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
1161
-  -Acpu=powerpc -Amachine=powerpc"
1162
-
1163
-#define        STARTFILE_FREEBSD_SPEC  FBSD_STARTFILE_SPEC
1164
-#define ENDFILE_FREEBSD_SPEC   FBSD_ENDFILE_SPEC
1165
-#define LIB_FREEBSD_SPEC       FBSD_LIB_SPEC
1166
-#define LINK_START_FREEBSD_SPEC        ""
1167
-
1168
-#define LINK_OS_FREEBSD_SPEC "\
1169
-  %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
1170
-  %{v:-V} \
1171
-  %{assert*} %{R*} %{rpath*} %{defsym*} \
1172
-  %{shared:-Bshareable %{h*} %{soname*}} \
1173
-  %{!shared: \
1174
-    %{!static: \
1175
-      %{rdynamic: -export-dynamic} \
1176
-      -dynamic-linker %(fbsd_dynamic_linker) } \
1177
-    %{static:-Bstatic}} \
1178
-  %{symbolic:-Bsymbolic}"
1179
-
1180
-/* GNU/Linux support.  */
1181
-#define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
1182
-%{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
1183
-%{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
1184
-
1185
-#ifdef HAVE_LD_PIE
1186
-#define        STARTFILE_LINUX_SPEC "\
1187
-%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
1188
-%{mnewlib:ecrti.o%s;:crti.o%s} \
1189
-%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
1190
-#else
1191
-#define        STARTFILE_LINUX_SPEC "\
1192
-%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
1193
-%{mnewlib:ecrti.o%s;:crti.o%s} \
1194
-%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
1195
-#endif
1196
-
1197
-#define        ENDFILE_LINUX_SPEC "\
1198
-%{shared|pie:crtendS.o%s;:crtend.o%s} \
1199
-%{mnewlib:ecrtn.o%s;:crtn.o%s}"
1200
-
1201
-#define LINK_START_LINUX_SPEC ""
1202
-
1203
-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
1204
-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
1205
-#if DEFAULT_LIBC == LIBC_UCLIBC
1206
-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
1207
-#elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
1208
-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
1209
-#else
1210
-#error "Unsupported DEFAULT_LIBC"
1211
-#endif
1212
-#define GNU_USER_DYNAMIC_LINKER \
1213
-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
1214
-
1215
-#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
1216
-  %{rdynamic:-export-dynamic} \
1217
-  -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
1218
-
1219
-#if defined(HAVE_LD_EH_FRAME_HDR)
1220
-# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
1221
-#endif
1222
-
1223
-#define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
1224
-%{!undef:                                                        \
1225
-  %{!ansi:                                                       \
1226
-    %{!std=*:-Dunix -D__unix -Dlinux -D__linux}                          \
1227
-    %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}}              \
1228
--Asystem=linux -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
1229
-
1230
-/* NetBSD support.  */
1231
-#define LIB_NETBSD_SPEC "\
1232
--lc"
1233
-
1234
-#define        STARTFILE_NETBSD_SPEC "\
1235
-ncrti.o%s crt0.o%s \
1236
-%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1237
-
1238
-#define ENDFILE_NETBSD_SPEC "\
1239
-%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
1240
-ncrtn.o%s"
1241
-
1242
-#define LINK_START_NETBSD_SPEC "\
1243
-"
1244
-
1245
-#define LINK_OS_NETBSD_SPEC "\
1246
-%{!shared: %{!static: \
1247
-  %{rdynamic:-export-dynamic} \
1248
-  -dynamic-linker /usr/libexec/ld.elf_so}}"
1249
-
1250
-#define CPP_OS_NETBSD_SPEC "\
1251
--D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__"
1252
-
1253
-/* OpenBSD support.  */
1254
-#ifndef        LIB_OPENBSD_SPEC
1255
-#define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}"
1256
-#endif
1257
-
1258
-#ifndef        STARTFILE_OPENBSD_SPEC
1259
-#define        STARTFILE_OPENBSD_SPEC "\
1260
-%{!shared: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
1261
-%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1262
-#endif
1263
-
1264
-#ifndef        ENDFILE_OPENBSD_SPEC
1265
-#define        ENDFILE_OPENBSD_SPEC "\
1266
-%{!shared:crtend.o%s} %{shared:crtendS.o%s}"
1267
-#endif
1268
-
1269
-#ifndef LINK_START_OPENBSD_SPEC
1270
-#define LINK_START_OPENBSD_SPEC "-Ttext 0x400074"
1271
-#endif
1272
-
1273
-#ifndef LINK_OS_OPENBSD_SPEC
1274
-#define LINK_OS_OPENBSD_SPEC ""
1275
-#endif
1276
-
1277
-#ifndef CPP_OS_OPENBSD_SPEC
1278
-#define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
1279
-#endif
1280
-
1281
-/* Define any extra SPECS that the compiler needs to generate.  */
1282
-/* Override rs6000.h definition.  */
1283
-#undef SUBTARGET_EXTRA_SPECS
1284
-#define        SUBTARGET_EXTRA_SPECS                                           \
1285
-  { "crtsavres_default",       CRTSAVRES_DEFAULT_SPEC },               \
1286
-  { "lib_ads",                 LIB_ADS_SPEC },                         \
1287
-  { "lib_yellowknife",         LIB_YELLOWKNIFE_SPEC },                 \
1288
-  { "lib_mvme",                        LIB_MVME_SPEC },                        \
1289
-  { "lib_sim",                 LIB_SIM_SPEC },                         \
1290
-  { "lib_freebsd",             LIB_FREEBSD_SPEC },                     \
1291
-  { "lib_linux",               LIB_LINUX_SPEC },                       \
1292
-  { "lib_netbsd",              LIB_NETBSD_SPEC },                      \
1293
-  { "lib_openbsd",             LIB_OPENBSD_SPEC },                     \
1294
-  { "lib_default",             LIB_DEFAULT_SPEC },                     \
1295
-  { "startfile_ads",           STARTFILE_ADS_SPEC },                   \
1296
-  { "startfile_yellowknife",   STARTFILE_YELLOWKNIFE_SPEC },           \
1297
-  { "startfile_mvme",          STARTFILE_MVME_SPEC },                  \
1298
-  { "startfile_sim",           STARTFILE_SIM_SPEC },                   \
1299
-  { "startfile_freebsd",       STARTFILE_FREEBSD_SPEC },               \
1300
-  { "startfile_linux",         STARTFILE_LINUX_SPEC },                 \
1301
-  { "startfile_netbsd",                STARTFILE_NETBSD_SPEC },                \
1302
-  { "startfile_openbsd",       STARTFILE_OPENBSD_SPEC },               \
1303
-  { "startfile_default",       STARTFILE_DEFAULT_SPEC },               \
1304
-  { "endfile_ads",             ENDFILE_ADS_SPEC },                     \
1305
-  { "endfile_yellowknife",     ENDFILE_YELLOWKNIFE_SPEC },             \
1306
-  { "endfile_mvme",            ENDFILE_MVME_SPEC },                    \
1307
-  { "endfile_sim",             ENDFILE_SIM_SPEC },                     \
1308
-  { "endfile_freebsd",         ENDFILE_FREEBSD_SPEC },                 \
1309
-  { "endfile_linux",           ENDFILE_LINUX_SPEC },                   \
1310
-  { "endfile_netbsd",          ENDFILE_NETBSD_SPEC },                  \
1311
-  { "endfile_openbsd",         ENDFILE_OPENBSD_SPEC },                 \
1312
-  { "endfile_default",         ENDFILE_DEFAULT_SPEC },                 \
1313
-  { "link_shlib",              LINK_SHLIB_SPEC },                      \
1314
-  { "link_start",              LINK_START_SPEC },                      \
1315
-  { "link_start_ads",          LINK_START_ADS_SPEC },                  \
1316
-  { "link_start_yellowknife",  LINK_START_YELLOWKNIFE_SPEC },          \
1317
-  { "link_start_mvme",         LINK_START_MVME_SPEC },                 \
1318
-  { "link_start_sim",          LINK_START_SIM_SPEC },                  \
1319
-  { "link_start_freebsd",      LINK_START_FREEBSD_SPEC },              \
1320
-  { "link_start_linux",                LINK_START_LINUX_SPEC },                \
1321
-  { "link_start_netbsd",       LINK_START_NETBSD_SPEC },               \
1322
-  { "link_start_openbsd",      LINK_START_OPENBSD_SPEC },              \
1323
-  { "link_start_default",      LINK_START_DEFAULT_SPEC },              \
1324
-  { "link_os",                 LINK_OS_SPEC },                         \
1325
-  { "link_os_ads",             LINK_OS_ADS_SPEC },                     \
1326
-  { "link_os_yellowknife",     LINK_OS_YELLOWKNIFE_SPEC },             \
1327
-  { "link_os_mvme",            LINK_OS_MVME_SPEC },                    \
1328
-  { "link_os_sim",             LINK_OS_SIM_SPEC },                     \
1329
-  { "link_os_freebsd",         LINK_OS_FREEBSD_SPEC },                 \
1330
-  { "link_os_linux",           LINK_OS_LINUX_SPEC },                   \
1331
-  { "link_os_netbsd",          LINK_OS_NETBSD_SPEC },                  \
1332
-  { "link_os_openbsd",         LINK_OS_OPENBSD_SPEC },                 \
1333
-  { "link_os_default",         LINK_OS_DEFAULT_SPEC },                 \
1334
-  { "cc1_secure_plt_default",  CC1_SECURE_PLT_DEFAULT_SPEC },          \
1335
-  { "cpp_os_ads",              CPP_OS_ADS_SPEC },                      \
1336
-  { "cpp_os_yellowknife",      CPP_OS_YELLOWKNIFE_SPEC },              \
1337
-  { "cpp_os_mvme",             CPP_OS_MVME_SPEC },                     \
1338
-  { "cpp_os_sim",              CPP_OS_SIM_SPEC },                      \
1339
-  { "cpp_os_freebsd",          CPP_OS_FREEBSD_SPEC },                  \
1340
-  { "cpp_os_linux",            CPP_OS_LINUX_SPEC },                    \
1341
-  { "cpp_os_netbsd",           CPP_OS_NETBSD_SPEC },                   \
1342
-  { "cpp_os_openbsd",          CPP_OS_OPENBSD_SPEC },                  \
1343
-  { "cpp_os_default",          CPP_OS_DEFAULT_SPEC },                  \
1344
-  { "fbsd_dynamic_linker",     FBSD_DYNAMIC_LINKER },                  \
1345
-  SUBSUBTARGET_EXTRA_SPECS
1346
-
1347
-#define        SUBSUBTARGET_EXTRA_SPECS
1348
-
1349
-/* Define this macro as a C expression for the initializer of an
1350
-   array of string to tell the driver program which options are
1351
-   defaults for this target and thus do not need to be handled
1352
-   specially when using `MULTILIB_OPTIONS'.
1353
-
1354
-   Do not define this macro if `MULTILIB_OPTIONS' is not defined in
1355
-   the target makefile fragment or if none of the options listed in
1356
-   `MULTILIB_OPTIONS' are set by default.  *Note Target Fragment::.  */
1357
-
1358
-#define        MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
1359
-
1360
-/* Define this macro if the code for function profiling should come
1361
-   before the function prologue.  Normally, the profiling code comes
1362
-   after.  */
1363
-#define PROFILE_BEFORE_PROLOGUE 1
1364
-
1365
-/* Function name to call to do profiling.  */
1366
-#define RS6000_MCOUNT "_mcount"
1367
-
1368
-/* Select a format to encode pointers in exception handling data.  CODE
1369
-   is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
1370
-   true if the symbol may be affected by dynamic relocations.  */
1371
-#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)                           \
1372
-  ((flag_pic || TARGET_RELOCATABLE)                                         \
1373
-   ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
1374
-   : DW_EH_PE_absptr)
1375
-
1376
-#define DOUBLE_INT_ASM_OP "\t.quad\t"
1377
-
1378
-/* Generate entries in .fixup for relocatable addresses.  */
1379
-#define RELOCATABLE_NEEDS_FIXUP 1
1380
-
1381
-#define TARGET_ASM_FILE_END rs6000_elf_file_end
1382
-
1383
-#undef TARGET_ASAN_SHADOW_OFFSET
1384
-#define TARGET_ASAN_SHADOW_OFFSET rs6000_asan_shadow_offset
1385
-
1386
-/* This target uses the sysv4.opt file.  */
1387
-#define TARGET_USES_SYSV4_OPT 1
1388
-
1389
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/s390/linux.h gcc-5.3.0-zip/gcc/config/s390/linux.h
1390
--- gcc-5.3.0-original/gcc/config/s390/linux.h  2016-02-05 15:18:17.493469779 -0500
1391
+++ gcc-5.3.0-zip/gcc/config/s390/linux.h       2015-05-11 03:14:10.000000000 -0400
1392
@@ -60,8 +60,8 @@
1393
 #define MULTILIB_DEFAULTS { "m31" }
1394
 #endif
1395
 
1396
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld.so.1"
1397
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib/ld64.so.1"
1398
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
1399
+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
1400
 
1401
 #undef  LINK_SPEC
1402
 #define LINK_SPEC \
1403
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sh/linux.h gcc-5.3.0-zip/gcc/config/sh/linux.h
1404
--- gcc-5.3.0-original/gcc/config/sh/linux.h    2016-02-05 15:18:17.493469779 -0500
1405
+++ gcc-5.3.0-zip/gcc/config/sh/linux.h 2015-01-05 07:33:28.000000000 -0500
1406
@@ -43,7 +43,7 @@
1407
 
1408
 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
1409
 
1410
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
1411
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
1412
 
1413
 #undef SUBTARGET_LINK_EMUL_SUFFIX
1414
 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
1415
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sparc/linux64.h gcc-5.3.0-zip/gcc/config/sparc/linux64.h
1416
--- gcc-5.3.0-original/gcc/config/sparc/linux64.h       2016-02-05 15:18:17.493469779 -0500
1417
+++ gcc-5.3.0-zip/gcc/config/sparc/linux64.h    2015-01-05 07:33:28.000000000 -0500
1418
@@ -84,8 +84,8 @@
1419
    When the -shared link option is used a final link is not being
1420
    done.  */
1421
 
1422
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-linux.so.2"
1423
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib64/ld-linux.so.2"
1424
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
1425
+#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
1426
 
1427
 #ifdef SPARC_BI_ARCH
1428
 
1429
@@ -193,7 +193,7 @@
1430
 #else /* !SPARC_BI_ARCH */
1431
 
1432
 #undef LINK_SPEC
1433
-#define LINK_SPEC "-m elf64_sparc -Y P,%R/tools/lib64 %{shared:-shared} \
1434
+#define LINK_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
1435
   %{!shared: \
1436
     %{!static: \
1437
       %{rdynamic:-export-dynamic} \
1438
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sparc/linux.h gcc-5.3.0-zip/gcc/config/sparc/linux.h
1439
--- gcc-5.3.0-original/gcc/config/sparc/linux.h 2016-02-05 15:18:17.493469779 -0500
1440
+++ gcc-5.3.0-zip/gcc/config/sparc/linux.h      2015-01-05 07:33:28.000000000 -0500
1441
@@ -83,7 +83,7 @@
1442
    When the -shared link option is used a final link is not being
1443
    done.  */
1444
 
1445
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
1446
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
1447
 
1448
 #undef  LINK_SPEC
1449
 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
1450
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/vax/linux.h gcc-5.3.0-zip/gcc/config/vax/linux.h
1451
--- gcc-5.3.0-original/gcc/config/vax/linux.h   2016-02-05 15:18:17.493469779 -0500
1452
+++ gcc-5.3.0-zip/gcc/config/vax/linux.h        2015-01-05 07:33:28.000000000 -0500
1453
@@ -41,7 +41,7 @@
1454
   %{!shared: \
1455
     %{!static: \
1456
       %{rdynamic:-export-dynamic} \
1457
-      -dynamic-linker /tools/lib/ld.so.1} \
1458
+      -dynamic-linker /lib/ld.so.1} \
1459
     %{static:-static}}"
1460
 
1461
 #undef  WCHAR_TYPE
1462
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/xtensa/linux.h gcc-5.3.0-zip/gcc/config/xtensa/linux.h
1463
--- gcc-5.3.0-original/gcc/config/xtensa/linux.h        2016-02-05 15:18:17.493469779 -0500
1464
+++ gcc-5.3.0-zip/gcc/config/xtensa/linux.h     2015-01-05 07:33:28.000000000 -0500
1465
@@ -44,7 +44,7 @@
1466
   %{mlongcalls:--longcalls} \
1467
   %{mno-longcalls:--no-longcalls}"
1468
 
1469
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
1470
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
1471
 
1472
 #undef LINK_SPEC
1473
 #define LINK_SPEC \
1474
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/netbsd.h gcc-5.3.0-zip/gcc/config/zip/netbsd.h
1475
--- gcc-5.3.0-original/gcc/config/zip/netbsd.h  1969-12-31 19:00:00.000000000 -0500
1476
+++ gcc-5.3.0-zip/gcc/config/zip/netbsd.h       2016-01-30 15:04:14.796899050 -0500
1477
@@ -0,0 +1,82 @@
1478
+////////////////////////////////////////////////////////////////////////////////
1479
+//
1480
+// Filename:   netbsd.h
1481
+//
1482
+// Project:    Zip CPU backend for the GNU Compiler Collection
1483
+//
1484
+// Purpose:
1485
+//
1486
+// Creator:    Dan Gisselquist, Ph.D.
1487
+//             Gisselquist Technology, LLC
1488
+//
1489
+////////////////////////////////////////////////////////////////////////////////
1490
+//
1491
+// Copyright (C) 2016, Gisselquist Technology, LLC
1492
+//
1493
+// This program is free software (firmware): you can redistribute it and/or
1494
+// modify it under the terms of  the GNU General Public License as published
1495
+// by the Free Software Foundation, either version 3 of the License, or (at
1496
+// your option) any later version.
1497
+//
1498
+// This program is distributed in the hope that it will be useful, but WITHOUT
1499
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
1500
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1501
+// for more details.
1502
+//
1503
+// You should have received a copy of the GNU General Public License along
1504
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
1505
+// target there if the PDF file isn't present.)  If not, see
1506
+// <http://www.gnu.org/licenses/> for a copy.
1507
+//
1508
+// License:    GPL, v3, as defined and found on www.gnu.org,
1509
+//             http://www.gnu.org/licenses/gpl.html
1510
+//
1511
+//
1512
+////////////////////////////////////////////////////////////////////////////////
1513
+#ifndef        ZIP_NETBSD_H
1514
+#define        ZIP_NETBSD_H
1515
+
1516
+/* Define default target values. */
1517
+
1518
+#undef MACHINE_TYPE
1519
+#define        MACHINE_TYPE    "NetBSD/Zip ELF"
1520
+
1521
+#undef TARGET_OS_CPP_BUILTINS
1522
+#define        TARGET_OS_CPP_BUILTINS()        \
1523
+       do { NETBSD_OS_CPP_BUILTINS_ELF();              \
1524
+       builtin_define("__ZIPCPU__");                   \
1525
+       builtin_assert("cpu=zip");                      \
1526
+       builtin_assert("machine=zip");                  \
1527
+       } while(0);
1528
+
1529
+#undef CPP_SPEC
1530
+#define        CPP_SPEC        NETBSD_CPP_SPEC
1531
+
1532
+#undef STARTFILE_SPEC
1533
+#define        STARTFILE_SPEC  NETBSD_STARTFILE_SPEC
1534
+
1535
+#undef ENDFILE_SPEC
1536
+#define        ENDFILE_SPEC    NETBSD_ENDFILE_SPEC
1537
+
1538
+#undef LIB_SPEC
1539
+#define        LIB_SPEC        NETBSD_LIB_SPEC
1540
+
1541
+#undef TARGET_VERSION
1542
+#define        TARGET_VERSION  fprintf(stderr, " (%s)", MACHINE_TYPE);
1543
+
1544
+/* Make gcc agree with <machine/ansi.h> */
1545
+
1546
+#undef WCHAR_TYPE
1547
+#define        WCHAR_TYPE      "int"
1548
+
1549
+#undef WCHAR_TYPE_SIZE
1550
+#define        WCHAR_TYPE_SIZE 32
1551
+
1552
+#undef WINT_TYPE
1553
+#define        WINT_TYPE       "int"
1554
+
1555
+/* Clean up after the generic Zip/ELF configuration. */
1556
+#undef MD_EXEC_PREFIX
1557
+#undef MD_STARTFILE_PREFIX
1558
+
1559
+#endif /* ZIP_NETBSD_H */
1560
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/t-zip gcc-5.3.0-zip/gcc/config/zip/t-zip
1561
--- gcc-5.3.0-original/gcc/config/zip/t-zip     1969-12-31 19:00:00.000000000 -0500
1562
+++ gcc-5.3.0-zip/gcc/config/zip/t-zip  2016-02-04 19:00:59.939652587 -0500
1563
@@ -0,0 +1,47 @@
1564
+################################################################################
1565
+##
1566
+## Filename:   t-zip
1567
+##
1568
+## Project:    Zip CPU backend for the GNU Compiler Collection
1569
+##
1570
+## Purpose:
1571
+##
1572
+## Creator:    Dan Gisselquist, Ph.D.
1573
+##             Gisselquist Technology, LLC
1574
+##
1575
+################################################################################
1576
+##
1577
+## Copyright (C) 2016, Gisselquist Technology, LLC
1578
+##
1579
+## This program is free software (firmware): you can redistribute it and/or
1580
+## modify it under the terms of  the GNU General Public License as published
1581
+## by the Free Software Foundation, either version 3 of the License, or (at
1582
+## your option) any later version.
1583
+##
1584
+## This program is distributed in the hope that it will be useful, but WITHOUT
1585
+## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
1586
+## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1587
+## for more details.
1588
+##
1589
+## You should have received a copy of the GNU General Public License along
1590
+## with this program.  (It's in the $(ROOT)/doc directory, run make with no
1591
+## target there if the PDF file isn't present.)  If not, see
1592
+## <http://www.gnu.org/licenses/> for a copy.
1593
+##
1594
+## License:    GPL, v3, as defined and found on www.gnu.org,
1595
+##             http://www.gnu.org/licenses/gpl.html
1596
+##
1597
+##
1598
+################################################################################
1599
+
1600
+FPBIT = fp-bit.c
1601
+DPBIT = dp-bit.c
1602
+
1603
+# dp-bit.c: $(srcdir)/config/fp-bit.c
1604
+       # cat $(srcdir)/config/fp-bit.c > dp-bit.c
1605
+#
1606
+# fp-bit.c: $(srcdir)/config/fp-bit.c
1607
+       # echo '#define FLOAT" > fp-bit.c
1608
+       # cat $(srcdir)/config/fp-bit.c >> fp-bit.c
1609
+
1610
+
1611
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.c gcc-5.3.0-zip/gcc/config/zip/zip.c
1612
--- gcc-5.3.0-original/gcc/config/zip/zip.c     1969-12-31 19:00:00.000000000 -0500
1613
+++ gcc-5.3.0-zip/gcc/config/zip/zip.c  2016-03-05 20:33:58.899277709 -0500
1614
@@ -0,0 +1,2160 @@
1615
+////////////////////////////////////////////////////////////////////////////////
1616
+//
1617
+// Filename:   zip.c
1618
+//
1619
+// Project:    Zip CPU backend for the GNU Compiler Collection
1620
+//
1621
+// Purpose:
1622
+//
1623
+// Creator:    Dan Gisselquist, Ph.D.
1624
+//             Gisselquist Technology, LLC
1625
+//
1626
+////////////////////////////////////////////////////////////////////////////////
1627
+//
1628
+// Copyright (C) 2016, Gisselquist Technology, LLC
1629
+//
1630
+// This program is free software (firmware): you can redistribute it and/or
1631
+// modify it under the terms of  the GNU General Public License as published
1632
+// by the Free Software Foundation, either version 3 of the License, or (at
1633
+// your option) any later version.
1634
+//
1635
+// This program is distributed in the hope that it will be useful, but WITHOUT
1636
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
1637
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1638
+// for more details.
1639
+//
1640
+// You should have received a copy of the GNU General Public License along
1641
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
1642
+// target there if the PDF file isn't present.)  If not, see
1643
+// <http://www.gnu.org/licenses/> for a copy.
1644
+//
1645
+// License:    GPL, v3, as defined and found on www.gnu.org,
1646
+//             http://www.gnu.org/licenses/gpl.html
1647
+//
1648
+//
1649
+////////////////////////////////////////////////////////////////////////////////
1650
+#include "config.h"
1651
+#include "system.h"
1652
+#include "coretypes.h"
1653
+#include "tm.h"
1654
+#include "rtl.h"
1655
+#include "dominance.h"
1656
+#include "cfg.h"
1657
+#include "cfgrtl.h"
1658
+#include "cfganal.h"
1659
+#include "lcm.h"
1660
+#include "cfgbuild.h"
1661
+#include "cfgcleanup.h"
1662
+#include "predict.h"
1663
+#include "basic-block.h"
1664
+#include "df.h"
1665
+#include "hashtab.h"
1666
+#include "hash-set.h"
1667
+#include "machmode.h"
1668
+#include "symtab.h"
1669
+#include "rtlhash.h"
1670
+#include "tree.h"
1671
+#include "regs.h"
1672
+#include "hard-reg-set.h"
1673
+#include "real.h"
1674
+#include "insn-config.h"
1675
+#include "conditions.h"
1676
+#include "output.h"
1677
+#include "insn-attr.h"
1678
+#include "flags.h"
1679
+#include "expr.h"
1680
+#include "function.h"
1681
+#include "recog.h"
1682
+#include "toplev.h"
1683
+#include "ggc.h"
1684
+#include "builtins.h"
1685
+#include "calls.h"
1686
+#include "langhooks.h"
1687
+#include "optabs.h"
1688
+#include "explow.h"
1689
+#include "emit-rtl.h"
1690
+
1691
+// #include "tmp_p.h"
1692
+#include "target.h"
1693
+#include "target-def.h"
1694
+// #include "tm-constrs.h"
1695
+// #include "tm-preds.h"
1696
+
1697
+#include "diagnostic.h"
1698
+// #include "integrate.h"
1699
+
1700
+// static int  zip_arg_partial_bytes(CUMULATIVE_ARGS *, enum machine_mode, tree, bool);
1701
+// static      bool    zip_pass_by_reference(CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool);
1702
+static bool    zip_return_in_memory(const_tree, const_tree);
1703
+static bool    zip_frame_pointer_required(void);
1704
+// static      bool    zip_must_pass_in_stack(enum machine_mode, const_tree);
1705
+
1706
+// static      void    zip_setup_incoming_varargs(CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int);
1707
+static void zip_function_arg_advance(cumulative_args_t ca, enum machine_mode mode,
1708
+               const_tree type, bool named);
1709
+static rtx zip_function_arg(cumulative_args_t ca, enum machine_mode mode, const_tree type, bool named);
1710
+
1711
+static void    zip_asm_trampoline_template(FILE *);
1712
+static void    zip_trampoline_init(rtx, tree, rtx);
1713
+static void    zip_init_builtins(void);
1714
+static tree zip_builtin_decl(unsigned, bool);
1715
+// static void zip_asm_output_anchor(rtx x);
1716
+       void    zip_asm_output_def(FILE *s, const char *n, const char *v);
1717
+       void    zip_update_cc_notice(rtx exp, rtx_insn *insn);
1718
+static rtx     zip_expand_builtin(tree exp, rtx target, rtx subtarget,
1719
+                       enum machine_mode tmode, int    ignore);
1720
+static bool    zip_scalar_mode_supported_p(enum machine_mode mode);
1721
+static bool    zip_libgcc_floating_mode_supported_p(enum machine_mode mode);
1722
+static int     zip_address_cost(rtx addr, enum machine_mode mode, addr_space_t as, bool spd);
1723
+static bool    zip_mode_dependent_address_p(const_rtx addr, addr_space_t);
1724
+static unsigned HOST_WIDE_INT  zip_const_anchor = 0x20000;
1725
+static          HOST_WIDE_INT  zip_min_anchor_offset = -0x20000;
1726
+static          HOST_WIDE_INT  zip_max_anchor_offset =  0x1ffff;
1727
+static          HOST_WIDE_INT  zip_min_mov_offset = -0x1000;
1728
+static          HOST_WIDE_INT  zip_max_mov_offset =  0x0fff;
1729
+static int     zip_sched_issue_rate(void) { return 1; }
1730
+static bool    zip_legitimate_address_p(machine_mode, rtx, bool);
1731
+static bool    zip_legitimate_move_operand_p(machine_mode, rtx, bool);
1732
+       void    zip_debug_rtx_pfx(const char *, const_rtx x);
1733
+       void    zip_debug_rtx(const_rtx x);
1734
+static void    zip_override_options(void);
1735
+static bool    zip_can_eliminate(int from ATTRIBUTE_UNUSED, int to);
1736
+// static      void    zip_canonicalize_comparison(int *, rtx *, rtx *, bool);
1737
+static int     zip_memory_move_cost(machine_mode, reg_class_t, bool);
1738
+
1739
+
1740
+#define        ALL_DEBUG_OFF   true
1741
+#define        ALL_DEBUG_ON    false
1742
+
1743
+enum ZIP_BUILTIN_ID_CODE {
1744
+       ZIP_BUILTIN_RTU,
1745
+       ZIP_BUILTIN_HALT,
1746
+       ZIP_BUILTIN_IDLE,
1747
+       ZIP_BUILTIN_SYSCALL,
1748
+       ZIP_BUILTIN_SAVE_CONTEXT,
1749
+       ZIP_BUILTIN_RESTORE_CONTEXT,
1750
+       ZIP_BUILTIN_BITREV,
1751
+       ZIP_BUILTIN_CC,
1752
+       ZIP_BUILTIN_MAX
1753
+};
1754
+
1755
+static GTY (()) tree   zip_builtins[(int)ZIP_BUILTIN_MAX];
1756
+static enum insn_code  zip_builtins_icode[(int)ZIP_BUILTIN_MAX];
1757
+
1758
+
1759
+#include "gt-zip.h"
1760
+
1761
+/* The Global 'targetm' Variable. */
1762
+struct gcc_target      targetm = TARGET_INITIALIZER;
1763
+
1764
+
1765
+enum   reg_class zip_reg_class(int);
1766
+
1767
+#define        LOSE_AND_RETURN(msgid, x)               \
1768
+       do {                                    \
1769
+               zip_operand_lossage(msgid, x);  \
1770
+               return;                         \
1771
+       } while(0)
1772
+
1773
+/* Per-function machine data. */
1774
+struct GTY(()) machine_function
1775
+{
1776
+       /* number of pretented arguments for varargs */
1777
+       int     pretend_size;
1778
+
1779
+       /* Number of bytes saved on the stack for local variables. */
1780
+       int     local_vars_size;
1781
+
1782
+       /* Number of bytes saved on stack for register save area */
1783
+       int     saved_reg_size;
1784
+       int     save_ret;
1785
+
1786
+       int     sp_fp_offset;
1787
+       bool    fp_needed;
1788
+       int     size_for_adjusting_sp;
1789
+};
1790
+
1791
+/* Allocate a chunk of memory for per-function machine-dependent data. */
1792
+
1793
+static struct machine_function *
1794
+zip_init_machine_status(void) {
1795
+       return ggc_cleared_alloc<machine_function>();
1796
+}
1797
+
1798
+static void
1799
+zip_override_options(void)
1800
+{
1801
+       init_machine_status = zip_init_machine_status;
1802
+}
1803
+
1804
+enum   reg_class
1805
+zip_reg_class(int regno)
1806
+{
1807
+       if (is_ZIP_GENERAL_REG(regno)) {
1808
+               return GENERAL_REGS;
1809
+       } else if (is_ZIP_REG(regno)) {
1810
+               return ALL_REGS;
1811
+       } return NO_REGS;
1812
+}
1813
+
1814
+/* Worker function for TARGET_RETURN_IN_MEMORY. */
1815
+static bool
1816
+zip_return_in_memory(const_tree type, const_tree fntype ATTRIBUTE_UNUSED) {
1817
+       const   HOST_WIDE_INT size = int_size_in_bytes(type);
1818
+       return (size == -1)||(size > UNITS_PER_WORD);
1819
+}
1820
+
1821
+/* Emit an error emssage when we're in an asm, and a fatal error for "normal"
1822
+ * insn.  Formatted output isn't easily implemented, since we use output operand
1823
+ * lossage to output the actual message and handle the categorization of the
1824
+ * error.  */
1825
+
1826
+static void
1827
+zip_operand_lossage(const char *msgid, rtx op) {
1828
+       fprintf(stderr, "Operand lossage??\n");
1829
+       debug_rtx(op);
1830
+       zip_debug_rtx(op);
1831
+       output_operand_lossage("%s", msgid);
1832
+}
1833
+
1834
+/* The PRINT_OPERAND_ADDRESS worker.   */
1835
+void
1836
+zip_print_operand_address(FILE *file, rtx x) {
1837
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1838
+
1839
+       if (dbg) zip_debug_rtx(x);
1840
+       switch(GET_CODE(x)) {
1841
+               case REG:
1842
+                       fprintf(file, "(%s)", reg_names[REGNO(x)]);
1843
+                       break;
1844
+               case SYMBOL_REF:
1845
+                       fprintf(file, "%s", XSTR(x,0));
1846
+                       break;
1847
+               case LABEL_REF:
1848
+                       x = LABEL_REF_LABEL(x);
1849
+               case CODE_LABEL:
1850
+                       { char buf[256];
1851
+                       ASM_GENERATE_INTERNAL_LABEL(buf, "L", CODE_LABEL_NUMBER(x));
1852
+#ifdef ASM_OUTPUT_LABEL_REF
1853
+                       ASM_OUTPUT_LABEL_REF(file, buf);
1854
+#else
1855
+                       assemble_name(file, buf);
1856
+#endif
1857
+                       }
1858
+                       break;
1859
+               case PLUS:
1860
+                       if (!REG_P(XEXP(x, 0)))
1861
+                               abort();
1862
+                       if (CONST_INT_P(XEXP(x, 1))) {
1863
+                               if (INTVAL(XEXP(x,1))!=0) {
1864
+                                       fprintf(file, "%ld(%s)",
1865
+                                       INTVAL(XEXP(x, 1)),
1866
+                                       reg_names[REGNO(XEXP(x, 0))]);
1867
+                               } else {
1868
+                                       fprintf(file, "(%s)",
1869
+                                       reg_names[REGNO(XEXP(x, 0))]);
1870
+                               }
1871
+                       } else if (GET_CODE(XEXP(x,1)) == SYMBOL_REF) {
1872
+                               fprintf(file, "%s(%s)", XSTR(x,0),
1873
+                                       reg_names[REGNO(XEXP(x, 0))]);
1874
+                       } else if ((GET_CODE(XEXP(x, 1)) == MINUS)
1875
+                               && (GET_CODE(XEXP(XEXP(x, 1), 0))==SYMBOL_REF)
1876
+                               && (GET_CODE(XEXP(XEXP(x, 1), 1))==SYMBOL_REF)) {
1877
+                               fprintf(file, "%s-%s(%s)",
1878
+                                       XSTR(XEXP(XEXP(x, 1),0),0),
1879
+                                       XSTR(XEXP(XEXP(x, 1),1),0),
1880
+                                       reg_names[REGNO(XEXP(x, 0))]);
1881
+                       } else
1882
+                               fprintf(file, "#INVALID(%s)",
1883
+                                       reg_names[REGNO(XEXP(x, 0))]);
1884
+                       /*
1885
+                       else if (GET_CODE(XEXP(addr, 1)) == LABEL)
1886
+                               fprintf(file, "%s(%s)",
1887
+                                       GET_CODE(XEXP(addr, 1)),
1888
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
1889
+                       else if ((GET_CODE(XEXP(addr, 1)) == MINUS)
1890
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 0))==LABEL)
1891
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 1))==LABEL)) {
1892
+                               fprintf(file, "%s-%s(%s)",
1893
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
1894
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
1895
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
1896
+                       }
1897
+                       */
1898
+                       break;
1899
+               // We don't support direct memory addressing within our
1900
+               // instruction set, even though the instructions themselves
1901
+               // would support direct memory addressing of the lower 18 bits
1902
+               // of memory space.
1903
+               case MEM:
1904
+                       if (dbg) zip_debug_rtx(x);
1905
+                       zip_print_operand_address(file, XEXP(x, 0));
1906
+                       break;
1907
+               default:
1908
+                       abort(); break;
1909
+                       // output_addr_const(file, x);
1910
+               break;
1911
+       }
1912
+}
1913
+
1914
+/* The PRINT_OPERAND worker. */
1915
+
1916
+void
1917
+zip_print_operand(FILE *file, rtx x, int code)
1918
+{
1919
+       rtx operand = x;
1920
+       int     rgoff = 0;
1921
+
1922
+       // fprintf(file, "Print Operand!\n");
1923
+
1924
+       /* New code entries should just be added to the switch below.  If
1925
+        * handling is finished, just return.  If handling was just a
1926
+        * modification of the operand, the modified operand should be put in
1927
+        * "operand", and then do a break to let default handling
1928
+        * (zero-modifier) output the operand.
1929
+        */
1930
+       switch(code) {
1931
+               case 0:
1932
+                       /* No code, print as usual. */
1933
+                       break;
1934
+               case 'L':
1935
+                       /* Lower of two registers, print one up */
1936
+                       rgoff = 1;
1937
+                       break;
1938
+               case 'R':
1939
+               case 'H':
1940
+                       /* Higher of a register pair, print normal */
1941
+                       break;
1942
+
1943
+               default:
1944
+                       LOSE_AND_RETURN("invalid operand modifier letter", x);
1945
+       }
1946
+
1947
+       /* Print an operand as without a modifier letter. */
1948
+       switch (GET_CODE(operand)) {
1949
+       case REG:
1950
+               if (REGNO(operand)+rgoff >= FIRST_PSEUDO_REGISTER)
1951
+                       internal_error("internal error: bad register: %d", REGNO(operand));
1952
+               fprintf(file, "%s", reg_names[REGNO(operand)+rgoff]);
1953
+               return;
1954
+       case SCRATCH:
1955
+               LOSE_AND_RETURN("Need a scratch register", x);
1956
+               return;
1957
+
1958
+       case CODE_LABEL:
1959
+       case LABEL_REF:
1960
+       case SYMBOL_REF:
1961
+       case PLUS:
1962
+               PRINT_OPERAND_ADDRESS(file, operand);
1963
+               return;
1964
+       case MEM:
1965
+               PRINT_OPERAND_ADDRESS(file, XEXP(operand, 0));
1966
+               return;
1967
+
1968
+       default:
1969
+               /* No need to handle all strange variants, let
1970
+                * output_addr_const do it for us.
1971
+                */
1972
+               if (CONSTANT_P(operand)) {
1973
+                       output_addr_const(file, operand);
1974
+                       return;
1975
+               }
1976
+
1977
+               LOSE_AND_RETURN("unexpected operand", x);
1978
+       }
1979
+}
1980
+
1981
+static bool
1982
+zip_frame_pointer_required(void)
1983
+{
1984
+       // This should really depend upon whether we have variable sized
1985
+       // arguments in our frame or not.  Once this fails, let's look
1986
+       // at what the problem was and then whether or not we can detect
1987
+       // it.
1988
+       //
1989
+       // Use a GCC global to determine our answer
1990
+       return (frame_pointer_needed);
1991
+//     return (cfun->calls_alloca);
1992
+/*
1993
+       fprintf(stderr, "ZIP_FRAME_POINTER_REQUIRED()\n");
1994
+       if (frame_pointer_needed) {
1995
+               fprintf(stderr, "FRAME_POINTER_NEEDED is true\n");
1996
+               zip_debug_rtx(frame_pointer_rtx);
1997
+               if (frame_pointer_rtx == NULL_RTX)
1998
+                       return true;
1999
+               if (GET_CODE(frame_pointer_rtx)==PLUS) {
2000
+                       if ((REG_P(XEXP(frame_pointer_rtx,0)))
2001
+                               &&(REGNO(XEXP(frame_pointer_rtx, 0))==zip_SP)
2002
+                               &&(CONST_INT_P(XEXP(frame_pointer_rtx,1))))
2003
+                               return false;
2004
+                       if ((REG_P(XEXP(frame_pointer_rtx,1)))
2005
+                               &&(REGNO(XEXP(frame_pointer_rtx, 1))==zip_SP)
2006
+                               &&(CONST_INT_P(XEXP(frame_pointer_rtx,0))))
2007
+                               return false;
2008
+                       return true;
2009
+               } else if ((REG_P(frame_pointer_rtx))
2010
+                               &&(REGNO(frame_pointer_rtx) == zip_SP))
2011
+                       return false;
2012
+               return true;
2013
+       } else return false;
2014
+*/
2015
+}
2016
+
2017
+/* Determine whether or not a register needs to be saved on the stack or not.
2018
+ */
2019
+static bool
2020
+zip_save_reg(int regno) {
2021
+       if (regno == 0)
2022
+               return ((!crtl->is_leaf)
2023
+                       ||((df_regs_ever_live_p(0))&&(!call_used_regs[0])));
2024
+       else if ((regno == zip_GOT)&&(!ZIP_PIC))
2025
+               return  ((df_regs_ever_live_p(regno))
2026
+                               &&(!call_used_regs[regno]));
2027
+       else if (regno == zip_FP)
2028
+               return((zip_frame_pointer_required())||((df_regs_ever_live_p(regno))
2029
+                               &&(!call_used_regs[regno])));
2030
+       else if (regno < zip_FP)
2031
+               return  ((df_regs_ever_live_p(regno))
2032
+                               &&(!call_used_regs[regno]));
2033
+       return false;
2034
+}
2035
+
2036
+/* Compute the size of the local area and the size to be adjusted by the
2037
+ * prologue and epilogue.
2038
+ *
2039
+ * Here's what we are looking at (top is the current, bottom is the last ...)
2040
+ *
2041
+ *     Stack Pointer ->
2042
+ *                     Local variables (could be variable size)
2043
+ *     Frame Pointer ->        (= Stack Pointer + sp_fp_offset)
2044
+ *                     Saved return address, if saved
2045
+ *                     Other Saved registers
2046
+ *                     Saved frame pointer (if used)
2047
+ *                     Saved R12, if used
2048
+ *                     (Stack pointer is not saved)
2049
+ *     Original stack pointer ->       (= Stack_Pointer +size_for_adjusting_sp)
2050
+ *                     Called arguments (not passed in registers)
2051
+ *                     Return arguments (not R1, args.pretend_args_size)
2052
+ *             (Prior function's stack frame ... )
2053
+ *
2054
+ */
2055
+static void
2056
+zip_compute_frame(void) {
2057
+       int     regno;
2058
+       int     args_size;
2059
+
2060
+       // gcc_assert(crtl);
2061
+       gcc_assert(cfun);
2062
+       gcc_assert(cfun->machine);
2063
+
2064
+       args_size=(ACCUMULATE_OUTGOING_ARGS ? crtl->outgoing_args_size : 0);
2065
+
2066
+       if(crtl->args.pretend_args_size > 0) {
2067
+               args_size += crtl->args.pretend_args_size;
2068
+               // printf("%s pretend_args_size : %d\n", current_function_name(),
2069
+                       // crtl->args.pretend_args_size);
2070
+               cfun->machine->pretend_size = crtl->args.pretend_args_size;
2071
+       }
2072
+
2073
+       cfun->machine->local_vars_size = get_frame_size();
2074
+
2075
+       // Save callee-saved registers.
2076
+       cfun->machine->saved_reg_size = 0;
2077
+       for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
2078
+               if (zip_save_reg(regno))
2079
+                       cfun->machine->saved_reg_size ++;
2080
+       }
2081
+
2082
+       cfun->machine->fp_needed = (zip_frame_pointer_required());
2083
+
2084
+       if ((cfun->machine->fp_needed)&&
2085
+                       (!df_regs_ever_live_p(zip_FP))) {
2086
+               cfun->machine->saved_reg_size ++;
2087
+       }
2088
+
2089
+       cfun->machine->sp_fp_offset = args_size + cfun->machine->local_vars_size;
2090
+       cfun->machine->size_for_adjusting_sp = cfun->machine->local_vars_size
2091
+                       + cfun->machine->saved_reg_size
2092
+                       + args_size;
2093
+
2094
+       /*
2095
+       if (cfun->machine->fp_needed)
2096
+               frame_pointer_rtx = gen_rtx_REG(Pmode, zip_FP);
2097
+       else
2098
+               frame_pointer_rtx = plus_constant(Pmode, gen_rtx_REG(Pmode, zip_SP),
2099
+                       cfun->machine->sp_fp_offset);
2100
+       */
2101
+}
2102
+
2103
+void
2104
+zip_expand_prologue(void) {
2105
+       rtx     insn;
2106
+
2107
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2108
+       zip_compute_frame();
2109
+
2110
+       if (cfun->machine->size_for_adjusting_sp != 0) {
2111
+               insn = emit_insn(gen_subsi3(stack_pointer_rtx,
2112
+                               stack_pointer_rtx,
2113
+                       gen_int_mode(cfun->machine->size_for_adjusting_sp,
2114
+                               SImode)));
2115
+                       // cfun->machine->sp_fp_offset
2116
+
2117
+               RTX_FRAME_RELATED_P(insn) = 1;
2118
+       }
2119
+
2120
+       {
2121
+               int offset = 0, regno;
2122
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
2123
+                       if (zip_save_reg(regno)) {
2124
+                               insn=emit_insn(gen_movsi_sto(
2125
+                                       gen_rtx_MEM(SImode, plus_constant(
2126
+                                               Pmode, stack_pointer_rtx,
2127
+                                               cfun->machine->sp_fp_offset
2128
+                                               +offset++, true)),
2129
+                                       gen_rtx_REG(SImode, regno)));
2130
+                               RTX_FRAME_RELATED_P(insn) = 1;
2131
+                       }
2132
+               }
2133
+       }
2134
+
2135
+       if (cfun->machine->fp_needed) {
2136
+               if (dbg) zip_debug_rtx(stack_pointer_rtx);
2137
+               if (dbg) zip_debug_rtx(frame_pointer_rtx);
2138
+               insn = emit_insn(gen_movsi_reg_off(frame_pointer_rtx,
2139
+                               stack_pointer_rtx, gen_int_mode(
2140
+                                               cfun->machine->sp_fp_offset,
2141
+                                               SImode)));
2142
+               RTX_FRAME_RELATED_P(insn) = 1;
2143
+       }
2144
+}
2145
+
2146
+bool
2147
+zip_use_return_insn(void)
2148
+{
2149
+       if ((!reload_completed)||(cfun->machine->fp_needed)
2150
+                       ||(get_frame_size()!=0)) {
2151
+               // If R0 ever gets pushed to the stack, then we cannot
2152
+               // use a master return from anywhere.  We need to clean up the
2153
+               // stack first.
2154
+               if ((!crtl->is_leaf)||((df_regs_ever_live_p(0))
2155
+                                               &&(!call_used_regs[0]))) {
2156
+                       return false;
2157
+               }
2158
+       }
2159
+       zip_compute_frame();
2160
+       return (cfun->machine->size_for_adjusting_sp == 0);
2161
+}
2162
+
2163
+/* As per the notes in M68k.c, quote the function epilogue should not depend
2164
+ * upon the current stack pointer.  It should use the frame poitner only,
2165
+ * if there is a frame pointer.  This is mandatory because of alloca; we also
2166
+ * take advantage of it to omit stack adjustments before returning ...
2167
+ *
2168
+ * Let's see if we can use their approach here.
2169
+ *
2170
+ * We can't.  Consider our choices:
2171
+ *     LOD (FP),R0
2172
+ *     LOD 1(FP),R4
2173
+ *     LOD 2(FP),R5
2174
+ *     LOD 3(FP),R6
2175
+ *     LOD 4(FP),FP
2176
+ *     ... Then what is the stack pointer?
2177
+ * or
2178
+ *     LOD (FP),R0
2179
+ *     LOD 1(FP),R4
2180
+ *     LOD 2(FP),R5
2181
+ *     LOD 3(FP),R6
2182
+ *     MOV FP,SP
2183
+ *     LOD 4(SP),FP
2184
+ *     ... Which suffers unnecessary pipeline stalls, and certainly doesn't
2185
+ *     exploit our pipeline memory function
2186
+ * or
2187
+ *     MOV FP,SP
2188
+ *     LOD (SP),R0
2189
+ *     LOD 1(SP),R4
2190
+ *     LOD 2(SP),R5
2191
+ *     LOD 3(SP),R6
2192
+ *     LOD 4(SP),FP
2193
+ * Which will be our choice.  Note that we do use the stack pointer, eventually.
2194
+ *
2195
+ */
2196
+void
2197
+zip_expand_epilogue(void) {
2198
+       int     regno, offset;
2199
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2200
+
2201
+       zip_compute_frame();
2202
+
2203
+       if (dbg) fprintf(stderr, "EPILOG::\n");
2204
+       if (cfun->machine->fp_needed) {
2205
+               if (dbg) fprintf(stderr, "EPILOG::Moving frame pointer to stack register\n");
2206
+               emit_insn(gen_movsi_reg(stack_pointer_rtx, frame_pointer_rtx));
2207
+       }
2208
+
2209
+       if (cfun->machine->saved_reg_size != 0) {
2210
+               offset =  (cfun->machine->size_for_adjusting_sp -
2211
+                               cfun->machine->sp_fp_offset
2212
+                       - cfun->machine->saved_reg_size);
2213
+               if (dbg) fprintf(stderr, "EPILOG::Saved_REG_Size = %d\n", cfun->machine->saved_reg_size);
2214
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
2215
+                       if (zip_save_reg(regno)) {
2216
+                               if (dbg) fprintf(stderr, "EPILOG::RESTORING R%d\n", regno);
2217
+                               emit_insn(gen_movsi_lod(
2218
+                                               gen_rtx_REG(SImode, regno),
2219
+                                       gen_rtx_MEM(SImode, plus_constant( SImode,
2220
+                                               stack_pointer_rtx, offset++, true))));
2221
+                       }
2222
+               }
2223
+       }
2224
+
2225
+       if (cfun->machine->size_for_adjusting_sp != 0) {
2226
+               if (dbg) fprintf(stderr, "EPILOG::ADDSI3(StackPtr, %d)\n",
2227
+                               cfun->machine->size_for_adjusting_sp);
2228
+               emit_insn(gen_addsi3(stack_pointer_rtx, stack_pointer_rtx,
2229
+                       gen_int_mode(
2230
+                               cfun->machine->size_for_adjusting_sp
2231
+                               -cfun->machine->sp_fp_offset, SImode)));
2232
+       }
2233
+       if (dbg) fprintf(stderr, "EPILOG::EMITTING-RETURN\n");
2234
+
2235
+       emit_jump_insn(ret_rtx);
2236
+}
2237
+
2238
+/* Implement RETURN_ADDR_RTX(COUNT, FRAMEADDR).
2239
+ *
2240
+ * We currently only support calculating the return address for the current
2241
+ * frame.
2242
+ */
2243
+
2244
+/*
2245
+rtx
2246
+zip_return_addr_rtx(int count, rtx frame ATTRIBUTE_UNUSED)
2247
+{
2248
+       if (count)
2249
+               return NULL_RTX;
2250
+
2251
+       zip_compute_frame();
2252
+
2253
+       // saved return address for current function is at fp - 1
2254
+       if (cfun->machine->save_ret)
2255
+               return gen_rtx_MEM(Pmode, plus_constant(frame_pointer_rtx,
2256
+                               -UNITS_PER_WORD));
2257
+       return get_hard_reg_initial_val(Pmode, RETURN_ADDRESS_REGNUM);
2258
+}
2259
+*/
2260
+
2261
+/* Implements the macro INITIAL_ELIMINATION_OFFSET,
2262
+ * return the OFFSET.
2263
+ */
2264
+/*
2265
+int
2266
+zip_initial_elimination_offset(int from, int to) {
2267
+       int     ret = 0;
2268
+       zip_compute_frame();
2269
+
2270
+       if (((from) == FRAME_POINTER_REGNUM)&&((to) == STACK_POINTER_REGNUM)) {
2271
+               ret = cfun->machine->sp_fp_offset;
2272
+       } else if (((from)=ARG_POINTER_REGNUM)&&((to)==FRAME_POINTER_REGNUM)) {
2273
+               ret = cfun->machine->local_vars_size;
2274
+       } else {
2275
+               abort();
2276
+       }
2277
+
2278
+       return ret;
2279
+}
2280
+*/
2281
+
2282
+/* Return non-zero if the function argument described by TYPE is to be passed
2283
+ * by reference.
2284
+ */
2285
+/*
2286
+static bool
2287
+zip_pass_by_reference(CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
2288
+               enum machine_mode mode, const_tree type,
2289
+               bool name ATTRIBUTE_UNUSED) {
2290
+       unsigned        HOST_WIDE_INT   size;
2291
+
2292
+       if (type) {
2293
+               if (AGGREGATE_TYPE_P(type)) {
2294
+                       return TRUE;
2295
+               } size = int_size_in_bytes(type);
2296
+       } else
2297
+               size = GET_MODE_SIZE(mode);
2298
+
2299
+       return (size > GET_MODE_SIZE(SImode)); // > 1 word : is this okay?
2300
+       // The idea is to pass everything larger than an int by reference (or
2301
+       // on the stack)
2302
+}
2303
+*/
2304
+
2305
+/*
2306
+ * Code taken from m68k ...
2307
+ */
2308
+static bool
2309
+zip_can_eliminate(int from, int to)
2310
+{
2311
+       // fprintf(stderr, "CAN_ELIMINATE::QUERYING(%d,%d)\n", from, to);
2312
+       if ((from == zip_FP)&&(to == zip_SP))
2313
+               return !cfun->machine->fp_needed;
2314
+       return true;
2315
+}
2316
+
2317
+/*
2318
+static bool
2319
+zip_must_pass_in_stack(enum machine_mode mode, const_tree type)
2320
+{
2321
+       if (mode == BLKmode) {
2322
+               return true;
2323
+       } if (type == NULL) {
2324
+               return false;
2325
+       } return AGGREGATE_TYPE_P(type);
2326
+}
2327
+*/
2328
+
2329
+/*
2330
+static void
2331
+zip_basic_check(void)
2332
+{
2333
+       gcc_assert(mode_base_align[SImode]==4);
2334
+       if ((BITS_PER_UNIT != 32)
2335
+                       ||(GET_MODE_SIZE(SImode)!=1)
2336
+                       ||(GET_MODE_SIZE(DImode)!=1)
2337
+                       ||(HARD_REGNO_NREGS(0,SImode)!=1)) {
2338
+               printf("SIZEOF(SIMode) == %d\n", GET_MODE_SIZE(SImode));
2339
+               printf("BITS_PER_UNIT  == %d\n", BITS_PER_UNIT);
2340
+               gcc_assert(BITS_PER_UNIT==32);
2341
+               gcc_assert(GET_MODE_SIZE(SImode)==1);
2342
+               gcc_assert(HARD_REGNO_NREGS(0,SImode)==1);
2343
+       }
2344
+}
2345
+*/
2346
+
2347
+#define        zip_basic_check()
2348
+
2349
+/* Compute the number of word sized regiters needed to hold a function
2350
+ * argument of mode INT_MODE and tree type TYPE.
2351
+ */
2352
+int
2353
+zip_num_arg_regs(enum machine_mode mode, const_tree type) {
2354
+       int     size;
2355
+
2356
+       zip_basic_check();
2357
+
2358
+       if (targetm.calls.must_pass_in_stack(mode, type))
2359
+               return 0;
2360
+
2361
+       if ((type)&&(mode == BLKmode))
2362
+               size = int_size_in_bytes(type);
2363
+       else
2364
+               size = GET_MODE_SIZE(mode);
2365
+
2366
+       return (size + UNITS_PER_WORD - 1)/UNITS_PER_WORD;
2367
+}
2368
+
2369
+/* pushed in function prologue */
2370
+/*
2371
+static void
2372
+zip_setup_incoming_varargs(CUMULATIVE_ARGS *cum, enum machine_mode mode,
2373
+               tree type, int *pretend_size, int no_rtl) {
2374
+       if (no_rtl)
2375
+               return;
2376
+
2377
+       gcc_assert(mode != BLKmode);
2378
+
2379
+       if (*cum < (ZIP_LAST_ARG_REGNO+1)) {
2380
+               int size = ZIP_FIRST_ARG_REGNO + ZIP_NUM_ARGS_REGS - *cum;
2381
+               rtx     regblock;
2382
+               int     offset = (*cum - ZIP_FIRST_ARG_REGNO) * UNITS_PER_WORD;
2383
+               regblock = gen_rtx_MEM(BLKmode,
2384
+                       plus_constant(arg_pointer_rtx, offset));
2385
+               move_block_from_reg(*cum, regblock, size);
2386
+               *pretend_size = size * UNITS_PER_WORD;
2387
+       }
2388
+
2389
+       if (targetm.calls.strict_argument_naming(cum))
2390
+               *cum = *cum + zip_num_arg_regs(mode, type);
2391
+}
2392
+*/
2393
+
2394
+/*
2395
+static int
2396
+zip_arg_partial_bytes(CUMULATIVE_ARGS *cum, enum machine_mode mode,
2397
+               tree type, bool name ATTRIBUTE_UNUSED) {
2398
+       int     words;
2399
+       unsigned int    regs = zip_num_arg_regs(mode, type);
2400
+
2401
+       if (*cum >= ZIP_LAST_ARG_REGNO + 1)
2402
+               words = 0;
2403
+       else if ((*cum + regs) > ZIP_LAST_ARG_REGNO + 1)
2404
+               words = (*cum + regs) - ZIP_LAST_ARG_REGNO + 1;
2405
+       else
2406
+               words = 0;
2407
+
2408
+       return words * UNITS_PER_WORD;
2409
+}
2410
+*/
2411
+
2412
+static void
2413
+zip_function_arg_advance(cumulative_args_t ca, machine_mode mode,
2414
+               const_tree type, bool named ATTRIBUTE_UNUSED) {
2415
+       CUMULATIVE_ARGS *cum;
2416
+       int     nreg;
2417
+
2418
+       zip_basic_check();
2419
+
2420
+       cum = get_cumulative_args(ca);
2421
+       nreg = zip_num_arg_regs(mode, type);
2422
+       if (((*cum)+nreg) > NUM_ARG_REGS)
2423
+               (*cum) = NUM_ARG_REGS;
2424
+       else
2425
+               (*cum) += nreg;
2426
+}
2427
+
2428
+static rtx
2429
+zip_function_arg(cumulative_args_t ca, machine_mode mode,
2430
+               const_tree type ATTRIBUTE_UNUSED, bool named) {
2431
+       CUMULATIVE_ARGS *cum;
2432
+
2433
+       zip_basic_check();
2434
+
2435
+
2436
+       if (!named)
2437
+               return NULL_RTX;
2438
+       //if (targetm.calls.must_pass_in_stack(mode, type))
2439
+               //return NULL_RTX;
2440
+       cum = get_cumulative_args(ca);
2441
+
2442
+       if ((*cum) >= NUM_ARG_REGS)
2443
+               return NULL_RTX;
2444
+       return
2445
+               gen_rtx_REG(mode, (*cum)+1);
2446
+}
2447
+
2448
+/* NOTICE_UPDATE_CC sends us here
2449
+ */
2450
+void
2451
+zip_update_cc_notice(rtx exp, rtx_insn *insn)
2452
+{
2453
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2454
+       enum    attr_ccresult  ccr;
2455
+       enum    attr_conditional  conditionally_executed;
2456
+
2457
+       // The default is that nothing has changed.
2458
+       // cc_status = cc_status_prev;
2459
+       rtx     src, dest;
2460
+
2461
+       if (dbg) fprintf(stderr, "CC-NOTICE ...\n");
2462
+       if (dbg) zip_debug_rtx_pfx("CC :", exp);
2463
+       if (dbg) debug_rtx(exp);
2464
+
2465
+       ccr = get_attr_ccresult(insn);
2466
+       if (ccr == CCRESULT_UNKNOWN) {
2467
+               CC_STATUS_INIT;
2468
+               if (dbg) fprintf(stderr, "\tINIT-CC\n");
2469
+               return;
2470
+       } else if (ccr == CCRESULT_UNCHANGED) {
2471
+               if (dbg) fprintf(stderr, "\tUnchanged CC\n");
2472
+               return;
2473
+       }
2474
+
2475
+       if ((GET_CODE(exp) == PARALLEL)&&(GET_CODE(XVECEXP(exp, 0, 0))==SET)) {
2476
+               // This works up and until we add cc0 parallel instructions
2477
+               // to our instruction set.
2478
+               dest = SET_DEST(XVECEXP(exp, 0, 0));
2479
+               src  = SET_SRC (XVECEXP(exp, 0, 0));
2480
+       } else if (GET_CODE(exp) == SET) {
2481
+               dest = SET_DEST(exp);
2482
+               src  = SET_SRC (exp);
2483
+       } else {
2484
+               // First, do nothing if we haven't touched the condition codes.
2485
+               // Condition codes can only be changed as a result of a set
2486
+               // expression ...?
2487
+               if (dbg) fprintf(stderr, "Non-set expression, doesn\'t touch condition codes\n");
2488
+               return;
2489
+       }
2490
+
2491
+       // Gotta wait on this test, until we know whether or not the
2492
+       // conditionally executed instruction was designed to set the
2493
+       // CC0 register.
2494
+       conditionally_executed = get_attr_conditional(insn);
2495
+       if ((conditionally_executed == CONDITIONAL_YES)&&(dest != cc0_rtx)) {
2496
+               // cc_status is unchanged
2497
+               if (dbg) fprintf(stderr, "\tCC -- unchanged (conditional exec)\n");
2498
+               return;
2499
+       }
2500
+
2501
+       if (ccr == CCRESULT_VALIDZN)
2502
+               cc_status.flags = CC_NO_OVERFLOW;
2503
+       else
2504
+               cc_status.flags = 0;
2505
+       cc_status.value1 = dest;
2506
+       if (dest == cc0_rtx)
2507
+               cc_status.value2 = src;
2508
+       else if((REG_P(dest))&&(!reg_mentioned_p(dest, src)))
2509
+               cc_status.value2 = src;
2510
+       else if((SUBREG_P(dest))&&(!reg_mentioned_p(XEXP(dest,0), src)))
2511
+               cc_status.value2 = src;
2512
+       else
2513
+               cc_status.value2 = 0;
2514
+       if (dbg) fprintf(stderr, "\tCC -- Set flags for\n");
2515
+       if (dbg) zip_debug_rtx_pfx("V1: ", dest);
2516
+       if ((dbg)&&(cc_status.value2)) zip_debug_rtx_pfx("V2: ", src);
2517
+       else if (dbg)   fprintf(stderr, "V2: (No SRC)\n");
2518
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "src refers to dest ?? %s\n",
2519
+               refers_to_regno_p(REGNO(dest),REGNO(dest),src,NULL)?"Yes":"No");
2520
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "Occurrs %d times\n",
2521
+               count_occurrences(dest,src,0));
2522
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "%s mentioned\n",
2523
+               reg_mentioned_p(dest,src)?"Is":"Is not");
2524
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "%s referenced\n",
2525
+               reg_referenced_p(dest,src)?"Is":"Is not");
2526
+
2527
+//
2528
+// These results are only used in final.c, where they are used to remove
2529
+// compare instructions if the optimizer is on.  If I produce nothing, no
2530
+// compare instructions will be removed.  If I produce something, a smart
2531
+// decision may be made to remove compare instructions.
2532
+//
2533
+// cc_status will be compared  with subsequent
2534
+//     (set (cc0) (something)) (i.e. compare only) instructions
2535
+//
2536
+//     (set (cc0) (compare (x) (y)))
2537
+//     dst = cc0 -- the destination of the set is ignored, save that it must be
2538
+//             cc0
2539
+//     src1 = (compare (x) (y))
2540
+//     if (src1 == compare)&&(y == (const_int 0))
2541
+//             src2 = (x)
2542
+//     else
2543
+//             src2 = null
2544
+//
2545
+//     Four conditions:
2546
+//     1. if (val1)&&(src1 == val1)
2547
+//             This would be true if I had seen a (set (val1) (src1)) insn
2548
+//             If I have seen a (set (val1) (src1))
2549
+//                     or equivalently a (set (val1) (compare (x) (y)))
2550
+//     or
2551
+//     2. if (val2)&&(src1 == val2)
2552
+//             This would be true if I had seen a (set (val1) (src1)) insn,
2553
+//             and only if val2 was still valid.
2554
+//     or
2555
+//     3. if (src2)&&(value1)&&(src2 == value1)
2556
+//             This would be true if we are comparing against zero, and the
2557
+//             number we are comparing against zero is value 1
2558
+//     or
2559
+//     4. if (src2)&&(value2)&&(src2 == value2)
2560
+//             ... or value2.  This is the common ZipCPU case.
2561
+//
2562
+//             then delete the compare.
2563
+//
2564
+}
2565
+
2566
+
2567
+/* totally buggy - we can't return pointers to nested functions */
2568
+static void
2569
+zip_asm_trampoline_template(FILE *f) {
2570
+       // Whereas at one time I thought I wouldn't need it, now I know I
2571
+       // need this trampoline function, although it is for a completely
2572
+       // different purpose than the one I was familiar with.
2573
+       fprintf(f, "\tldihi 0,r1\n");
2574
+       fprintf(f, "\tldilo 0,r1\n");
2575
+       fprintf(f, "\tjmp r1\n");
2576
+}
2577
+
2578
+/* Worker function for TARGET_TRAMPOLINE_INIT. */
2579
+static void
2580
+zip_trampoline_init(rtx m_tramp ATTRIBUTE_UNUSED,
2581
+       tree fndecl ATTRIBUTE_UNUSED,
2582
+       rtx chain_value ATTRIBUTE_UNUSED) {
2583
+// #warning "This needs to be filled out"
2584
+       abort();
2585
+}
2586
+
2587
+static tree
2588
+def_builtin(const char *name, enum insn_code icode, enum ZIP_BUILTIN_ID_CODE code,
2589
+       tree type)
2590
+{
2591
+       tree t = add_builtin_function(name,type,code,BUILT_IN_MD, NULL, NULL_TREE);
2592
+       zip_basic_check();
2593
+
2594
+       if(t) {
2595
+               zip_builtins[code] = t;
2596
+               zip_builtins_icode[code] = icode;
2597
+       }
2598
+
2599
+       return t;
2600
+
2601
+}
2602
+
2603
+void   zip_init_builtins(void) {
2604
+       zip_basic_check();
2605
+
2606
+  tree void_ftype_void = build_function_type_list(void_type_node, NULL_TREE);
2607
+#ifdef HAVE_zip_rtu
2608
+  def_builtin("zip_rtu", CODE_FOR_zip_rtu, ZIP_BUILTIN_RTU, void_ftype_void);
2609
+#endif
2610
+#ifdef HAVE_zip_halt
2611
+  def_builtin("zip_halt",  CODE_FOR_zip_halt,  ZIP_BUILTIN_HALT, void_ftype_void);
2612
+#endif
2613
+#ifdef HAVE_zip_idle
2614
+  def_builtin("zip_idle", CODE_FOR_zip_idle, ZIP_BUILTIN_IDLE, void_ftype_void);
2615
+#endif
2616
+
2617
+#ifdef HAVE_zip_syscall
2618
+// Support int SYSCALL(callID, int a, int b, int c);
2619
+  def_builtin("zip_syscall", CODE_FOR_zip_syscall, ZIP_BUILTIN_SYSCALL,
2620
+                       build_function_type_list(void_type_node, NULL_TREE));
2621
+#endif
2622
+
2623
+#ifdef HAVE_zip_save_context
2624
+  def_builtin("zip_save_context", CODE_FOR_zip_save_context, ZIP_BUILTIN_SAVE_CONTEXT,
2625
+               build_function_type_list(void_type_node, ptr_type_node, 0));
2626
+#endif
2627
+
2628
+#ifdef HAVE_zip_restore_context
2629
+  def_builtin("zip_restore_context", CODE_FOR_zip_restore_context, ZIP_BUILTIN_RESTORE_CONTEXT,
2630
+       build_function_type_list(void_type_node, ptr_type_node, 0));
2631
+#endif
2632
+
2633
+#ifdef HAVE_zip_bitrev
2634
+  def_builtin("zip_bitrev", CODE_FOR_zip_bitrev, ZIP_BUILTIN_BITREV,
2635
+       build_function_type_list(unsigned_type_node, unsigned_type_node,
2636
+               NULL_TREE));
2637
+#endif
2638
+
2639
+#ifdef HAVE_zip_cc
2640
+  def_builtin("zip_cc", CODE_FOR_zip_cc, ZIP_BUILTIN_CC,
2641
+       build_function_type_list(unsigned_type_node, NULL_TREE));
2642
+#endif
2643
+
2644
+}
2645
+
2646
+static tree
2647
+zip_builtin_decl(unsigned zip_builtin_code, bool initialize_p ATTRIBUTE_UNUSED)
2648
+{
2649
+  if (zip_builtin_code >= ZIP_BUILTIN_MAX)
2650
+    return error_mark_node;
2651
+
2652
+  return zip_builtins[zip_builtin_code];
2653
+}
2654
+
2655
+static rtx
2656
+zip_expand_builtin(tree exp, rtx target,
2657
+               rtx subtarget ATTRIBUTE_UNUSED,
2658
+               machine_mode tmode ATTRIBUTE_UNUSED,
2659
+               int     ignore ATTRIBUTE_UNUSED) {
2660
+
2661
+       tree    fndecl = TREE_OPERAND(CALL_EXPR_FN(exp), 0);
2662
+       bool    nonvoid = (TREE_TYPE(TREE_TYPE(fndecl)) != void_type_node);
2663
+       enum    ZIP_BUILTIN_ID_CODE code=(enum ZIP_BUILTIN_ID_CODE)DECL_FUNCTION_CODE(fndecl);
2664
+       enum    insn_code icode = zip_builtins_icode[code];
2665
+       rtx     pat, op[5];
2666
+       call_expr_arg_iterator  iter;
2667
+       tree    arg;
2668
+
2669
+       if ((code == ZIP_BUILTIN_SAVE_CONTEXT)
2670
+                       ||(code == ZIP_BUILTIN_RESTORE_CONTEXT)) {
2671
+               arg = first_call_expr_arg(exp, &iter);
2672
+               if (arg == error_mark_node)
2673
+                       return NULL_RTX;
2674
+               op[0] = expand_normal(arg);
2675
+               if (GET_CODE(op[0]) != REG)
2676
+                       op[0] = force_reg(Pmode, op[0]);
2677
+               pat = GEN_FCN(icode)(op[0]);
2678
+       } else if (code == ZIP_BUILTIN_BITREV) {
2679
+               arg = first_call_expr_arg(exp, &iter);
2680
+               if (arg == error_mark_node) {
2681
+                       return NULL_RTX;
2682
+               }
2683
+               op[0] = expand_normal(arg);
2684
+               if (!target)
2685
+                       target = gen_reg_rtx(SImode);
2686
+               pat = GEN_FCN(icode)(target, op[0]);
2687
+       } else if (code == ZIP_BUILTIN_CC) {
2688
+               if (!target)
2689
+                       target = gen_reg_rtx(SImode);
2690
+               pat = GEN_FCN(icode)(target);
2691
+       } else // RTU, HALT, IDLE
2692
+               pat = GEN_FCN(icode)();
2693
+       if (!pat)
2694
+               return NULL_RTX;
2695
+       emit_insn(pat);
2696
+       return (nonvoid ? target : const0_rtx);
2697
+}
2698
+
2699
+static bool
2700
+zip_scalar_mode_supported_p(enum machine_mode mode) {
2701
+       zip_basic_check();
2702
+
2703
+       return ((mode)==SImode)||((mode)==DImode); // ||((mode)==SFmode);
2704
+}
2705
+
2706
+static bool
2707
+zip_libgcc_floating_mode_supported_p(enum machine_mode mode) {
2708
+       return ((mode)==SFmode)||((mode)==DFmode);
2709
+}
2710
+
2711
+static int
2712
+zip_address_cost(rtx addr ATTRIBUTE_UNUSED,
2713
+       enum machine_mode mode ATTRIBUTE_UNUSED,
2714
+       addr_space_t as ATTRIBUTE_UNUSED, bool spd ATTRIBUTE_UNUSED) {
2715
+       return 1;
2716
+}
2717
+
2718
+static bool
2719
+zip_mode_dependent_address_p(const_rtx addr ATTRIBUTE_UNUSED,
2720
+       addr_space_t as ATTRIBUTE_UNUSED) {
2721
+       return false;
2722
+}
2723
+
2724
+/*
2725
+static void
2726
+zip_asm_output_anchor(rtx x) {
2727
+       printf("ANCHOR: OP(%d)\n", GET_CODE(x));
2728
+}
2729
+*/
2730
+
2731
+static void
2732
+zip_debug_print(const char *pfx, int lvl, const char *str) {
2733
+       int     i;
2734
+       i = lvl;
2735
+       if ((true)||(lvl == 0))
2736
+               fprintf(stderr, "%s", pfx);
2737
+       else
2738
+               i += strlen(pfx);
2739
+       while(i-->0)
2740
+               fprintf(stderr, "  ");
2741
+       fprintf(stderr, "%s\n", str);
2742
+}
2743
+
2744
+static void
2745
+zip_debug_print_m(const char *pfx, int lvl, const char *str, enum machine_mode m) {
2746
+       int     i;
2747
+
2748
+       i = lvl;
2749
+       if ((true)||(lvl == 0))
2750
+               fprintf(stderr, "%s", pfx);
2751
+       else
2752
+               i = lvl+strlen(pfx);
2753
+       while(i-->0)
2754
+               fprintf(stderr, "  ");
2755
+       switch(m) {
2756
+               case VOIDmode:
2757
+                       fprintf(stderr, "%s:V\n", str);
2758
+                       break;
2759
+               case BLKmode:
2760
+                       fprintf(stderr, "%s:BLK\n", str);
2761
+                       break;
2762
+               case BImode:
2763
+                       fprintf(stderr, "%s:BI\n", str);
2764
+                       break;
2765
+#ifdef HAVE_QImode
2766
+               case QImode:
2767
+                       fprintf(stderr, "%s:QI\n", str);
2768
+                       break;
2769
+#endif
2770
+#ifdef HAVE_HImode
2771
+               case HImode:
2772
+                       fprintf(stderr, "%s:HI\n", str);
2773
+                       break;
2774
+#endif
2775
+               case SImode:
2776
+                       fprintf(stderr, "%s:SI\n", str);
2777
+                       break;
2778
+               case DImode:
2779
+                       fprintf(stderr, "%s:DI\n", str);
2780
+                       break;
2781
+               default:
2782
+                       fprintf(stderr, "%s:?\n", str);
2783
+       }
2784
+}
2785
+
2786
+static void
2787
+zip_debug_rtx_1(const char *pfx, const_rtx x, int lvl) {
2788
+       if (x == NULL_RTX) {
2789
+               zip_debug_print(pfx, lvl, "(NULL-RTX)");
2790
+               return;
2791
+       } else if (GET_CODE(x) > NUM_RTX_CODE) {
2792
+               char    buf[64];
2793
+               sprintf(buf, "(BAD-RTX-CODE %d)", GET_CODE(x));
2794
+               zip_debug_print(pfx, lvl, buf);
2795
+               return;
2796
+       } switch(GET_CODE(x)) { // rtl.def
2797
+       case PARALLEL: zip_debug_print(pfx, lvl, "(PARALLEL");
2798
+               debug_rtx(x); break;
2799
+       case INT_LIST: zip_debug_print(pfx, lvl, "(INT-LIST"); break;
2800
+       case SEQUENCE: zip_debug_print(pfx, lvl, "(SEQUENCE"); break;
2801
+       case ADDRESS: zip_debug_print(pfx, lvl, "(ADDRESS"); break;
2802
+       case DEBUG_INSN: zip_debug_print(pfx, lvl, "(DEBUG-INSN"); break;
2803
+       case INSN:
2804
+               zip_debug_print(pfx, lvl, "(INSN");
2805
+               /*
2806
+               { const rtx_insn *tmp_rtx;
2807
+               for(tmp_rtx = as_a <const rtx_insn *>(x); tmp_rtx != 0; tmp_rtx = NEXT_INSN(tmp_rtx)) {
2808
+                       zip_debug_rtx_1(tmp_rtx, lvl+1);
2809
+               }}
2810
+               */
2811
+               zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
2812
+               debug_rtx(x);
2813
+               zip_debug_print(pfx, lvl, ")");
2814
+               break;
2815
+       case JUMP_INSN: zip_debug_print(pfx, lvl, "(JUMP-INSN");
2816
+               if (JUMP_LABEL(x)) {
2817
+                       zip_debug_print(pfx, lvl+1, "(w/Label)");
2818
+               } else
2819
+                       zip_debug_print(pfx, lvl+1, "(NO label)");
2820
+               break;
2821
+       case CALL:
2822
+               zip_debug_print(pfx, lvl, "(CALL (Adr) (Args)");
2823
+               zip_debug_rtx_1(pfx, XEXP(x,0), lvl+1);
2824
+               zip_debug_rtx_1(pfx, XEXP(x,1), lvl+1);
2825
+               zip_debug_print(pfx, lvl, ")");
2826
+               break;
2827
+       case CALL_INSN: zip_debug_print(pfx, lvl, "(CALL-INSN");
2828
+               debug_rtx(x);
2829
+               break;
2830
+       case BARRIER: zip_debug_print(pfx, lvl, "(BARRIER)"); break;
2831
+       case RETURN: zip_debug_print(pfx, lvl, "(RETURN)"); break;
2832
+       case NOTE:
2833
+               {       char buf[128];
2834
+                       sprintf(buf, "(NOTE %s)", GET_REG_NOTE_NAME(GET_MODE(x)));
2835
+                       zip_debug_print(pfx, lvl, buf);
2836
+               }break;
2837
+       case COND_EXEC: zip_debug_print(pfx, lvl, "(COND_EXEC)");
2838
+               debug_rtx(x);
2839
+               break;
2840
+       case ASM_INPUT: zip_debug_print(pfx, lvl, "(ASM INPUT)"); break;
2841
+       case ASM_OPERANDS: zip_debug_print(pfx, lvl, "(ASM OPERANDS)"); break;
2842
+       case UNSPEC: zip_debug_print(pfx, lvl, "(UNSPEC)"); break;
2843
+       case UNSPEC_VOLATILE: zip_debug_print(pfx, lvl, "(UNSPEC_VOLATILE)"); break;
2844
+       case CODE_LABEL:
2845
+               {
2846
+                       char    buf[64];
2847
+                       sprintf(buf, "(CODE_LABEL %d)", CODE_LABEL_NUMBER(x));
2848
+                       zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
2849
+               } break;
2850
+       case SET:
2851
+               zip_debug_print_m(pfx, lvl, "(SET", GET_MODE(x));
2852
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2853
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2854
+               zip_debug_print(pfx, lvl, ")");
2855
+               break;
2856
+       case REG:
2857
+               if (REGNO(x) == zip_PC)
2858
+                       zip_debug_print(pfx, lvl, "(PC)");
2859
+               else if (REGNO(x) == zip_CC)
2860
+                       zip_debug_print(pfx, lvl, "(CC0)");
2861
+               else if (REGNO(x) == zip_SP)
2862
+                       zip_debug_print(pfx, lvl, "(SP)");
2863
+               else if (REGNO(x) == zip_FP)
2864
+                       zip_debug_print(pfx, lvl, "(REG FP)");
2865
+               else if (REGNO(x) == zip_GOT)
2866
+                       zip_debug_print(pfx, lvl, "(REG GBL)");
2867
+               else if (FUNCTION_VALUE_REGNO_P(REGNO(x)))
2868
+                       zip_debug_print(pfx, lvl, "(REG RTN-VL)");
2869
+               else if (REGNO(x) == RETURN_ADDRESS_REGNUM)
2870
+                       zip_debug_print(pfx, lvl, "(REG RTN-AD)");
2871
+               else { char buf[25];
2872
+               sprintf(buf, "(REG %d)", REGNO(x));
2873
+               zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
2874
+               } break;
2875
+       case IF_THEN_ELSE: // 51
2876
+               zip_debug_print(pfx, lvl, "(IF-THEN-ELSE");
2877
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2878
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2879
+               zip_debug_rtx_1(pfx, XEXP(x,2),lvl+1);
2880
+               zip_debug_print(pfx, lvl, ")");
2881
+               break;
2882
+       case PC:
2883
+               zip_debug_print(pfx, lvl, "(PC)");
2884
+               break;
2885
+       case CC0:
2886
+               zip_debug_print(pfx, lvl, "(CC0)");
2887
+               break;
2888
+       case COMPARE:
2889
+               zip_debug_print(pfx, lvl, "(COMPARE");
2890
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2891
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2892
+               zip_debug_print(pfx, lvl, ")");
2893
+               break;
2894
+       case CONST_INT:
2895
+               { char buf[25];
2896
+               if (GET_MODE(x)==SImode)
2897
+                       sprintf(buf, "(CONST:SI %ld)", INTVAL(x));
2898
+               else if (GET_MODE(x)==VOIDmode)
2899
+                       sprintf(buf, "(CONST:V %ld)", INTVAL(x));
2900
+               else
2901
+                       sprintf(buf, "(CONST:? %ld)", INTVAL(x));
2902
+               zip_debug_print(pfx, lvl, buf);
2903
+               } break;
2904
+       case LABEL_REF:
2905
+               zip_debug_print(pfx, lvl, "(LABEL)");
2906
+               break;
2907
+       case SYMBOL_REF:
2908
+               {
2909
+                       char buf[64];
2910
+                       sprintf(buf, "(SYMBOL: %s)", XSTR(x,0));
2911
+                       // fprintf(file, "%s", XSTR(x,0));
2912
+                       zip_debug_print(pfx, lvl, buf);
2913
+               }
2914
+               break;
2915
+       case MEM:
2916
+               zip_debug_print_m(pfx, lvl, "(MEM", GET_MODE(x));
2917
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2918
+               zip_debug_print(pfx, lvl, ")");
2919
+               break;
2920
+       /*
2921
+       case VALUE:
2922
+               {
2923
+                       char buf[64];
2924
+                       sprintf(buf, "(VALUE: %d)", INTVAL(XEXP,0));
2925
+                       zip_debug_print_m(pfx, lvl, "buf", GET_MODE(x));
2926
+               }
2927
+               break;
2928
+       */
2929
+       case PLUS:
2930
+               zip_debug_print_m(pfx, lvl, "(PLUS", GET_MODE(x));
2931
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2932
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2933
+               zip_debug_print(pfx, lvl, ")");
2934
+               break;
2935
+       case MINUS:
2936
+               zip_debug_print_m(pfx, lvl, "(MINUS", GET_MODE(x));
2937
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2938
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2939
+               zip_debug_print(pfx, lvl, ")");
2940
+               break;
2941
+       case AND:
2942
+               zip_debug_print_m(pfx, lvl, "(AND", GET_MODE(x));
2943
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2944
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2945
+               zip_debug_print(pfx, lvl, ")");
2946
+               break;
2947
+       case IOR:
2948
+               zip_debug_print_m(pfx, lvl, "(OR", GET_MODE(x));
2949
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2950
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2951
+               zip_debug_print(pfx, lvl, ")");
2952
+               break;
2953
+       case XOR:
2954
+               zip_debug_print_m(pfx, lvl, "(XOR", GET_MODE(x));
2955
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2956
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2957
+               zip_debug_print(pfx, lvl, ")");
2958
+               break;
2959
+       case MULT:
2960
+               zip_debug_print_m(pfx, lvl, "(MULT", GET_MODE(x));
2961
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2962
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2963
+               zip_debug_print(pfx, lvl, ")");
2964
+               break;
2965
+       case EQ:        //
2966
+               zip_debug_print_m(pfx, lvl, "(EQ", GET_MODE(x));
2967
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2968
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2969
+               zip_debug_print(pfx, lvl, ")");
2970
+               break;
2971
+       case NE:        //
2972
+               zip_debug_print_m(pfx, lvl, "(NE", GET_MODE(x));
2973
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2974
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2975
+               zip_debug_print(pfx, lvl, ")");
2976
+               break;
2977
+       case GE:        //
2978
+               zip_debug_print_m(pfx, lvl, "(GE", GET_MODE(x));
2979
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2980
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2981
+               zip_debug_print(pfx, lvl, ")");
2982
+               break;
2983
+       case GT:        //
2984
+               zip_debug_print_m(pfx, lvl, "(GT", GET_MODE(x));
2985
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2986
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2987
+               zip_debug_print(pfx, lvl, ")");
2988
+               break;
2989
+       case LE:        //
2990
+               zip_debug_print_m(pfx, lvl, "(LE", GET_MODE(x));
2991
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2992
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2993
+               zip_debug_print(pfx, lvl, ")");
2994
+               break;
2995
+       case LT:        //
2996
+               zip_debug_print_m(pfx, lvl, "(LT", GET_MODE(x));
2997
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2998
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2999
+               zip_debug_print(pfx, lvl, ")");
3000
+               break;
3001
+       case GEU:       //
3002
+               zip_debug_print_m(pfx, lvl, "(GEU", GET_MODE(x));
3003
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
3004
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
3005
+               zip_debug_print(pfx, lvl, ")");
3006
+               break;
3007
+       case GTU:       //
3008
+               zip_debug_print_m(pfx, lvl, "(GTU", GET_MODE(x));
3009
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
3010
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
3011
+               zip_debug_print(pfx, lvl, ")");
3012
+               break;
3013
+       case LEU:       //
3014
+               zip_debug_print_m(pfx, lvl, "(LEU", GET_MODE(x));
3015
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
3016
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
3017
+               zip_debug_print(pfx, lvl, ")");
3018
+               break;
3019
+       case LTU:       //
3020
+               zip_debug_print_m(pfx, lvl, "(LTU", GET_MODE(x));
3021
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
3022
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
3023
+               zip_debug_print(pfx, lvl, ")");
3024
+               break;
3025
+       case SCRATCH:   //
3026
+               zip_debug_print_m(pfx, lvl, "(SCRATCH)", GET_MODE(x));
3027
+               break;
3028
+       case SUBREG:
3029
+               { char buf[25];
3030
+               sprintf(buf, "(SUBREG %d/%d)", REGNO(XEXP(x,0)),
3031
+                       SUBREG_BYTE(x));
3032
+               zip_debug_print(pfx, lvl, buf);
3033
+               } break;
3034
+       default:
3035
+               { char buf[25];
3036
+               sprintf(buf, "(? = %d) -- calling DEBUG-RTX", GET_CODE(x));
3037
+               zip_debug_print(pfx, lvl, buf);
3038
+               debug_rtx(x);
3039
+               } break;
3040
+       }
3041
+}
3042
+
3043
+void
3044
+zip_debug_rtx_pfx(const char *pfx, const_rtx x) {
3045
+       zip_debug_rtx_1(pfx, x, 0);
3046
+}
3047
+
3048
+void
3049
+zip_debug_rtx(const_rtx x) {
3050
+       zip_debug_rtx_pfx("", x);
3051
+}
3052
+
3053
+void
3054
+zip_debug_insn(rtx_insn *insn ATTRIBUTE_UNUSED) {
3055
+}
3056
+
3057
+void
3058
+zip_debug_bb(basic_block bb) {
3059
+       rtx_insn        *insn;
3060
+
3061
+       fprintf(stderr, "************ BASIC-BLOCK ***************\n");
3062
+       FOR_BB_INSNS(bb, insn)
3063
+       {
3064
+               zip_debug_rtx(insn);
3065
+       }
3066
+}
3067
+
3068
+
3069
+static bool
3070
+zip_legitimate_operand_address(const_rtx x, bool strict)
3071
+{
3072
+       const bool      dbg = ((ALL_DEBUG_ON)||(true))&&(!ALL_DEBUG_OFF);
3073
+
3074
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS\n");
3075
+       if (dbg) zip_debug_rtx_pfx("Test: ", x);
3076
+
3077
+       /*
3078
+        * While this might seem to make sense, it sends GCC into an infinite
3079
+        * loop.
3080
+        *
3081
+       if (GET_CODE(x) == MEM) {
3082
+               return (zip_legitimate_operand_address(XEXP(x,0),strict));
3083
+       }
3084
+       */
3085
+
3086
+       /*
3087
+       if (MEM_P(x)) {
3088
+               if((REG_P(XEXP(x,0)))||(GET_CODE(XEXP(x,0))==PLUS))
3089
+                       return (zip_legitimate_operand_address(XEXP(x,0),strict));
3090
+       } else
3091
+       */
3092
+
3093
+       if (NULL_RTX == x)
3094
+               return false;
3095
+       else if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode))
3096
+               return false;
3097
+       else if (REG_P(x)) {
3098
+               // Only insist the register b a valid register if strict is true
3099
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS -> YES! (Reg)\n");
3100
+               return (!strict)||(REGNO(x) != zip_CC);
3101
+       } else if (GET_CODE(x) == PLUS) {
3102
+               // Is it a valid register?
3103
+               /*
3104
+               if (GET_CODE(XEXP(x,0))==PLUS) {
3105
+                       return (zip_legitimate_operand_address(XEXP(XEXP(x,0),0), strict))
3106
+                               &&(zip_const_address_operand(XEXP(XEXP(x,0),1)));
3107
+               } */
3108
+               if(!REG_P(XEXP(x,0))) {
3109
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS -> No (No reg in +%s)\n",
3110
+                       (GET_CODE(XEXP(x,1))==REG)?", reg in op[1]":"");
3111
+                       return false;
3112
+               } if ((strict)&&(REGNO(XEXP(x,0)) == zip_CC)) {
3113
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS -> No (Wrong reg in +, %d)\n", REGNO(XEXP(x,0)));
3114
+                       return false;
3115
+               } if ((GET_CODE(XEXP(x, 1)) == CONST_INT)
3116
+                       &&(INTVAL(XEXP(x, 1)) <= zip_max_anchor_offset)
3117
+                       &&(INTVAL(XEXP(x, 1)) >= zip_min_anchor_offset)) {
3118
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS -> YES! (reg+int)\n");
3119
+                       return true;
3120
+               } if ((GET_CODE(XEXP(x, 1)) == LABEL_REF)
3121
+                       ||(GET_CODE(XEXP(x, 1)) == SYMBOL_REF)) {
3122
+                       // While we can technically support this, the problem
3123
+                       // is that the symbol address could be anywhere, and we
3124
+                       // have no way of recovering if it's outside of our
3125
+                       // 14 allowable bits.
3126
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS -> No. (reg+lbl)\n");
3127
+                       return false;
3128
+               } if ((GET_CODE(XEXP(x, 1)) == MINUS)
3129
+                       &&((GET_CODE(XEXP(XEXP(x,1),0)) == LABEL_REF)
3130
+                               ||(GET_CODE(XEXP(XEXP(x,1),0)) == CONST_INT)
3131
+                               ||(GET_CODE(XEXP(XEXP(x,1),0)) == SYMBOL_REF))
3132
+                       &&((GET_CODE(XEXP(XEXP(x,1),1)) == LABEL_REF)
3133
+                               ||(GET_CODE(XEXP(XEXP(x,1),0)) == CONST_INT)
3134
+                               ||(GET_CODE(XEXP(XEXP(x,1),1)) == SYMBOL_REF))
3135
+                       &&((GET_CODE(XEXP(XEXP(x,1),0)))
3136
+                               == (GET_CODE(XEXP(XEXP(x,1),1))))) {
3137
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS -> YES! (lbl-lbl+reg)\n");
3138
+                       return true;
3139
+               }
3140
+       }
3141
+
3142
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS -> No\n");
3143
+       if (dbg) zip_debug_rtx(x);
3144
+       return false;
3145
+}
3146
+
3147
+static bool
3148
+zip_legitimate_move_operand_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict) {
3149
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
3150
+
3151
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND\n");
3152
+       if (dbg) zip_debug_rtx_pfx("VMov?: ", x);
3153
+
3154
+       if (NULL_RTX == x)
3155
+               return false;
3156
+       else if (REG_P(x)) {
3157
+               // Only insist the register b a valid register if strict is true
3158
+               if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> YES! (Reg)\n");
3159
+               return (!strict)||(REGNO(x) != zip_CC);
3160
+       } else if (GET_CODE(x) == PLUS) {
3161
+               // Is it a valid register?
3162
+               if (GET_CODE(XEXP(x,0))==PLUS) {
3163
+                       return (zip_legitimate_operand_address(XEXP(x,0), strict))
3164
+                               &&(zip_const_address_operand(XEXP(x,0)));
3165
+               } if(GET_CODE(XEXP(x,0)) != REG) {
3166
+                       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> No (No reg in +%s)\n",
3167
+                       (GET_CODE(XEXP(x,1))==REG)?", reg in op[1]":"");
3168
+                       return false;
3169
+               } if ((strict)&&(REGNO(XEXP(x,0)) == zip_CC)) {
3170
+                       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> No (Wrong reg in +, %d)\n", REGNO(XEXP(x,0)));
3171
+                       return false;
3172
+               } if ((GET_CODE(XEXP(x, 1)) == CONST_INT)
3173
+                       &&(INTVAL(XEXP(x, 1)) <= zip_max_mov_offset)
3174
+                       &&(INTVAL(XEXP(x, 1)) >= zip_min_mov_offset)) {
3175
+                       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> YES! (reg+int)\n");
3176
+                       return true;
3177
+               }
3178
+       }
3179
+
3180
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> No\n");
3181
+       if (dbg) zip_debug_rtx(x);
3182
+       return false;
3183
+}
3184
+
3185
+int
3186
+zip_pd_mov_operand(rtx op)
3187
+{
3188
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
3189
+
3190
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOV(predicate) for OPERAND\n");
3191
+       return zip_legitimate_move_operand_p(VOIDmode, op, !can_create_pseudo_p());
3192
+}
3193
+
3194
+int
3195
+zip_address_operand(rtx op)
3196
+{
3197
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
3198
+
3199
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS for OPERAND\n");
3200
+       return zip_legitimate_operand_address(op, !can_create_pseudo_p());
3201
+}
3202
+
3203
+int
3204
+zip_pd_address_operand(rtx op)
3205
+{
3206
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
3207
+
3208
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS(predicate) for OPERAND\n");
3209
+       return zip_legitimate_operand_address(op, !can_create_pseudo_p());
3210
+}
3211
+
3212
+int
3213
+zip_ct_address_operand(rtx op)
3214
+{
3215
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
3216
+
3217
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS(constraint) for OPERAND\n");
3218
+       return zip_legitimate_operand_address(op, !can_create_pseudo_p());
3219
+}
3220
+
3221
+int
3222
+zip_const_address_operand(rtx x) {
3223
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
3224
+
3225
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS?\n");
3226
+       if (dbg) zip_debug_rtx(x);
3227
+       if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode))
3228
+               return false;
3229
+       if ((GET_CODE(x) == LABEL_REF)
3230
+                       ||(GET_CODE(x) == CODE_LABEL)
3231
+                       ||(GET_CODE(x) == SYMBOL_REF)) {
3232
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES!\n");
3233
+               return true;
3234
+       } else if (CONST_INT_P(x)) {
3235
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES!\n");
3236
+               return true;
3237
+       } else if (GET_CODE(x) == PLUS) {
3238
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(PLUS)\n");
3239
+               return ((zip_const_address_operand(XEXP(x,0)))
3240
+                       &&(CONST_INT_P(XEXP(x,1))));
3241
+       } else if (GET_CODE(x) == MINUS) {
3242
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(MINUS)\n");
3243
+               return ((zip_const_address_operand(XEXP(x,0)))
3244
+                       &&(zip_const_address_operand(XEXP(x,1))));
3245
+       }
3246
+
3247
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> No\n");
3248
+       if (dbg) zip_debug_rtx(x);
3249
+       return false;
3250
+}
3251
+
3252
+int
3253
+zip_ct_const_address_operand(rtx x) {
3254
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
3255
+
3256
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(constraint)\n");
3257
+       return zip_const_address_operand(x);
3258
+}
3259
+
3260
+int
3261
+zip_pd_const_address_operand(rtx x) {
3262
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
3263
+
3264
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(predicate)\n");
3265
+       return zip_const_address_operand(x);
3266
+}
3267
+
3268
+
3269
+static bool
3270
+zip_legitimate_address_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict)
3271
+{
3272
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
3273
+
3274
+       if (dbg) fprintf(stderr, "Zip-LEGITIMATE-ADDRESS-P\n");
3275
+       if (dbg) zip_debug_rtx(x);
3276
+
3277
+       // Only insist the register be a valid register if strict is true
3278
+       if (zip_legitimate_operand_address(x, strict))
3279
+               return true;
3280
+       else if (zip_const_address_operand(x))
3281
+               return true;
3282
+
3283
+       return false;
3284
+}
3285
+
3286
+void
3287
+zip_asm_output_def(FILE *stream, const char *name, const char *value)
3288
+{
3289
+       assemble_name(stream, name);
3290
+       fprintf(stream, "\t.equ ");
3291
+       assemble_name(stream, value);
3292
+       fputc('\n', stream);
3293
+}
3294
+
3295
+/*
3296
+bool   zip_load_address_lod(rtx regrx, rtx memrx) {
3297
+       fprintf(stderr, "ZIP-LOAD-ADDRESS-LOD\n");
3298
+       if (!MEM_P(memrx))
3299
+               return false;
3300
+       if (GET_CODE(regrx) != REG)
3301
+               return false;
3302
+       enum    rtx_code ic = GET_CODE(memrx);
3303
+       if ((ic == SYMBOL_REF)
3304
+               ||(ic == CODE_LABEL)
3305
+               ||(ic == LABEL_REF)) {
3306
+               if (can_create_pseudo_p()) {
3307
+                       rtx scratch_reg;
3308
+                       scratch_reg = gen_rtx_SCRATCH(SImode);
3309
+                       emit_insn(gen_movsi_ldi(scratch_reg, XEXP(memrx, 0)));
3310
+                       emit_insn(gen_movsi_lod(regrx, scratch_reg));
3311
+                       return true;
3312
+               } else return false;
3313
+       } else return false;
3314
+}
3315
+
3316
+bool   zip_load_address_sto(rtx memrx, rtx regrx) {
3317
+       fprintf(stderr,  "CHECKING-IN-W/ZIP_LOAD_ADDRESS_STORE\n");
3318
+       if (!MEM_P(memrx))
3319
+               return false;
3320
+       if (GET_CODE(regrx) != REG)
3321
+               return false;
3322
+       enum    rtx_code ic = GET_CODE(memrx);
3323
+       if ((ic == SYMBOL_REF)
3324
+               ||(ic == CODE_LABEL)
3325
+               ||(ic == LABEL_REF)) {
3326
+               if (can_create_pseudo_p()) {
3327
+                       rtx scratch_reg;
3328
+                       scratch_reg = gen_rtx_SCRATCH(SImode);
3329
+                       emit_insn(gen_movsi_ldi(scratch_reg, XEXP(memrx, 0)));
3330
+                       emit_insn(gen_movsi_sto(scratch_reg, regrx));
3331
+                       return true;
3332
+               } else return false;
3333
+       } return false;
3334
+}
3335
+*/
3336
+
3337
+#define        SREG_P(RTX) ((REG_P(RTX))||(SUBREG_P(RTX)))
3338
+
3339
+bool   zip_gen_move_rtl(rtx dst, rtx src) {
3340
+       const bool      dbg = ((ALL_DEBUG_ON)||(true))&&(!ALL_DEBUG_OFF);
3341
+
3342
+       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE\n");
3343
+       if (dbg) zip_debug_rtx_pfx("FROM: ", src);
3344
+       if (dbg) zip_debug_rtx_pfx("TO  : ", dst);
3345
+       if (dbg) fprintf(stderr, "PSEUDOs: %s\n", can_create_pseudo_p()?"true":"false");
3346
+       if ((SREG_P(dst))&&(SREG_P(src))) {
3347
+               // First type of move... register to register
3348
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/REG -- EMIT\n");
3349
+               emit_insn(gen_movsi_reg(dst, src));
3350
+       } else if ((MEM_P(dst))&&(MEM_P(XEXP(dst,0)))) {
3351
+               if (can_create_pseudo_p()) {
3352
+                       rtx     tmp = gen_reg_rtx(Pmode);
3353
+                       zip_gen_move_rtl(tmp, XEXP(dst,0));
3354
+                       zip_gen_move_rtl(gen_rtx_MEM(GET_MODE(src), tmp), src);
3355
+               } else {
3356
+                       fprintf(stderr, "ZIP:Cannot move into mem w/o pseudo\n");
3357
+                       return false;
3358
+               }
3359
+       } else if ((MEM_P(src))&&(MEM_P(XEXP(src,0)))) {
3360
+               if (can_create_pseudo_p()) {
3361
+                       rtx     tmp = gen_reg_rtx(Pmode);
3362
+                       zip_gen_move_rtl(tmp, XEXP(src,0));
3363
+                       zip_gen_move_rtl(dst, gen_rtx_MEM(GET_MODE(src), tmp));
3364
+               } else {
3365
+                       fprintf(stderr, "ZIP: Cannot move from mem(mem(ptr)) w/o pseudo\n");
3366
+                       return false;
3367
+               }
3368
+       } else if ((SREG_P(dst))&&(GET_CODE(src)==PLUS)
3369
+                       &&(REG_P(XEXP(src,0)))
3370
+                       &&(CONST_INT_P(XEXP(src,1)))) {
3371
+               // Second type of move... register plus offset to register
3372
+               if ((INTVAL(XEXP(src, 1)) <= zip_max_mov_offset)
3373
+                       &&(INTVAL(XEXP(src, 1)) >= zip_min_mov_offset)) {
3374
+                       // The offset is within bounds
3375
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/REG+OFF -- EMIT\n");
3376
+                       emit_insn(gen_movsi_reg_off(dst, XEXP(src,0),XEXP(src,1)));
3377
+               } else if (can_create_pseudo_p()) {
3378
+                       // The offset is out of bounds, get a new register and
3379
+                       // generate an add instruction to split this up.
3380
+                       rtx     tmp = gen_reg_rtx(GET_MODE(XEXP(src,0)));
3381
+
3382
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LDI\n");
3383
+                       emit_insn(gen_movsi_ldi(tmp, XEXP(src,1)));
3384
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/ADD\n");
3385
+                       emit_insn(gen_addsi3(tmp, tmp, XEXP(src,0)));
3386
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/DST\n");
3387
+                       emit_insn(gen_movsi_reg(dst, tmp));
3388
+               } else {
3389
+                       fprintf(stderr, "ZIP: Cannot move a(r),b w/o pseudo for out of bounds a\n");
3390
+                       return false;
3391
+               }
3392
+       } else if ((MEM_P(dst))&&(MEM_P(src))) {
3393
+               rtx     tmp;
3394
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/MEM/MEM\n");
3395
+               if (can_create_pseudo_p()) {
3396
+                       tmp = gen_reg_rtx(GET_MODE(src));
3397
+                       emit_insn(gen_movsi(tmp, src));
3398
+                       emit_insn(gen_movsi(dst, tmp));
3399
+               } else {
3400
+                       fprintf(stderr, "ZIP: Cannot move mem(A) to mem(B) w/o pseudo\n");
3401
+                       return false;
3402
+               }
3403
+       } else if ((SREG_P(dst))&&(MEM_P(src))) {
3404
+               // Memory load
3405
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LOD\n");
3406
+               if (zip_legitimate_operand_address(XEXP(src, 0), false)) {
3407
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/SIMPLE-LOD(ADDR)\n");
3408
+                       if (dbg) zip_debug_rtx_pfx("Smple-Addr: ", src);
3409
+                       if (REG_P(XEXP(src,0)))
3410
+                               mark_reg_pointer(XEXP(src,0),0);
3411
+                       else if ((GET_CODE(XEXP(src,0))==PLUS)
3412
+                                       &&(REG_P(XEXP(XEXP(src,0),0))))
3413
+                               mark_reg_pointer(XEXP(XEXP(src,0),0),0);
3414
+                       emit_insn(gen_movsi_lod(dst, src));
3415
+               } else if (zip_const_address_operand(XEXP(src,0))) {
3416
+                       if (can_create_pseudo_p()) {
3417
+                               rtx     tmp;
3418
+                               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LOD(CONST-ADDR)\n");
3419
+                               tmp = gen_reg_rtx(Pmode);
3420
+                               mark_reg_pointer(tmp,0);
3421
+                               emit_insn(gen_movsi_ldi(tmp, XEXP(src,0)));
3422
+                               emit_insn(gen_movsi_lod(dst, gen_rtx_MEM(GET_MODE(src),tmp)));
3423
+                       } else {
3424
+                               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LOD(CONST-ADDR,SELF)\n");
3425
+                               emit_insn(gen_movsi_ldi(dst, XEXP(src,0)));
3426
+                               emit_insn(gen_movsi_lod(dst, gen_rtx_MEM(GET_MODE(src),dst)));
3427
+                       }
3428
+               } else {
3429
+                       internal_error("%s", "ZIP/No usable load\n");
3430
+               }
3431
+       } else if ((MEM_P(dst))&&(SREG_P(src))) {
3432
+               // Memory store
3433
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO\n");
3434
+               if (zip_legitimate_operand_address(XEXP(dst, 0), false)) {
3435
+                       // If it's a legitimate address already, do nothing mor
3436
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO(Legit Addr)--EMIT\n");
3437
+                       emit_insn(gen_movsi_sto(dst, src));
3438
+               } else if (zip_const_address_operand(XEXP(dst,0))) {
3439
+                       rtx     tmp;
3440
+
3441
+                       if (can_create_pseudo_p()) {
3442
+                               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO(Const Addr,Reg) -- EMIT\n");
3443
+                               // Otherwise we need to load the memory address
3444
+                               // into a register
3445
+                               tmp = gen_reg_rtx(Pmode);
3446
+                               mark_reg_pointer(tmp,0);
3447
+                               emit_insn(gen_movsi_ldi(tmp, XEXP(dst,0)));
3448
+                               //
3449
+                               // Then we can do our load
3450
+                               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO -- emit\n");
3451
+                               emit_insn(gen_movsi_sto(gen_rtx_MEM(GET_MODE(src), tmp), src));
3452
+                       } else {
3453
+                               fprintf(stderr, "Cannot move src -> mem(dst) w/o pseudo\n");
3454
+                               return false;
3455
+                       }
3456
+               } else if (can_create_pseudo_p())
3457
+                       internal_error("%s", "ZIP/No usable store\n");
3458
+               else {
3459
+                       fprintf(stderr, "ZIP/Unanticipated store problem\n");
3460
+                       return false;
3461
+               }
3462
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO -- DONE\n");
3463
+       } else if ((MEM_P(dst))&&((CONST_INT_P(src))||(GET_CODE(src)==SYMBOL_REF))) {
3464
+               // Store a constant into memory
3465
+               rtx     tmp;
3466
+
3467
+               if (can_create_pseudo_p()) {
3468
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/CONST->MEM\n");
3469
+                       // Load the source constant into a register first
3470
+                       tmp = gen_reg_rtx((GET_MODE(src)==VOIDmode)?GET_MODE(dst):GET_MODE(src));
3471
+                       emit_insn(gen_movsi_ldi(tmp,src));
3472
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/CONST->REG->MEM -- RECURSE\n");
3473
+
3474
+                       // Then do a normal move, recursing to handle memory
3475
+                       // properly
3476
+                       zip_gen_move_rtl(dst, tmp);
3477
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/CONST->MEM -- DONE\n");
3478
+               } else {
3479
+                       fprintf(stderr, "ZIP/Cannot store constant into mem w/o pseudo\n");
3480
+                       return false;
3481
+               }
3482
+       } else if ((SREG_P(dst))&&(CONST_INT_P(src))) {
3483
+               // Load a constant into a register
3484
+               // The assembler really takes care of all of this, since
3485
+               // the assembler will split the constant if it doesn't fit
3486
+               // into a single instruction.
3487
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/CONST->REG\n");
3488
+               // if ((GET_MODE(dst)==VOIDmode)&&(GET_MODE(src)==VOIDmode))
3489
+                       // PUT_MODE(dst,SImode);
3490
+               emit_insn(gen_movsi_ldi(dst, src));
3491
+       } else if ((REG_P(dst))&&
3492
+                       ((LABEL_P(src))
3493
+                       ||(GET_CODE(src)==SYMBOL_REF)
3494
+                       ||(GET_CODE(src)==LABEL_REF))) {
3495
+               // Load a constant into a register
3496
+               // The assembler really takes care of all of this, since
3497
+               // the assembler will split the constant if it doesn't fit
3498
+               // into a single instruction.
3499
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LABEL->REG\n");
3500
+               emit_insn(gen_movsi_ldi(dst, src));
3501
+       } else {
3502
+               fprintf(stderr, "ZIP/No usable move\n");
3503
+               zip_debug_rtx_pfx("TO  : ", dst);
3504
+               zip_debug_rtx_pfx("FROM: ", src);
3505
+               debug_rtx(dst);
3506
+               debug_rtx(src);
3507
+               return false;
3508
+       }
3509
+       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE -- DONE\n");
3510
+       return true;
3511
+}
3512
+
3513
+const char *zip_set_zero_or_one(rtx condition, rtx dst) {
3514
+       const bool      dbg = ((ALL_DEBUG_ON)||(true))&&(!ALL_DEBUG_OFF);
3515
+       if (dbg) fprintf(stderr, "ZIP::SET-ZERO-OR-ONE\n");
3516
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
3517
+       if (dbg) zip_debug_rtx_pfx("REG", dst);
3518
+       switch(GET_CODE(condition)) {
3519
+       case EQ:        return "LDI\t0,%0\n\tLDILO.Z\t1,%0";
3520
+       case NE:        return "LDI\t0,%0\n\tLDILO.NZ\t1,%0";
3521
+       case LT:        return "LDI\t0,%0\n\tLDILO.LT\t1,%0";
3522
+       case GT:        return "LDI\t0,%0\n\tLDILO.GT\t1,%0";
3523
+       case LE:        return "LDI\t1,%0\n\tLDILO.GT\t0,%0";
3524
+       case GE:        return "LDI\t0,%0\n\tLDILO.GE\t1,%0";
3525
+       case LTU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0";
3526
+       case GTU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0\n\tLDILO.Z\t0,%0";
3527
+       case LEU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0\n\tLDILO.Z\t1,%0";
3528
+       case GEU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0";
3529
+       default:
3530
+               zip_debug_rtx(condition);
3531
+               internal_error("CSTORE Unsupported condition");
3532
+               return NULL;
3533
+       }
3534
+}
3535
+
3536
+const char *zip_binary_movsicc(rtx_code condition, const char *op, const int opno) {
3537
+       static char     result[64] = "";
3538
+       switch(condition) {
3539
+               //
3540
+               // Result already exists in the iffalse register
3541
+               // Can't change it.  Therefore, on the
3542
+               // condition ... move true register to the
3543
+               // destination
3544
+               //
3545
+               case EQ:        sprintf(result, "%s.Z\t%%%d,%%0", op, opno); break;
3546
+               case NE:        sprintf(result, "%s.NZ\t%%%d,%%0", op, opno); break;
3547
+               case LT:        sprintf(result, "%s.LT\t%%%d,%%0", op, opno); break;
3548
+               case GT:        sprintf(result, "%s.GT\t%%%d,%%0", op, opno); break;
3549
+               // .LE doesn't exist on Zip CPU--turn this into two instructions
3550
+               case LE:        sprintf(result, "%s.LT\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
3551
+               case GE:        sprintf(result, "%s.GE\t%%%d,%%0", op, opno); break;
3552
+               case LTU:       sprintf(result, "%s.C\t%%%d,%%0", op, opno); break;
3553
+               //
3554
+               // .GTU doesn't exist on the Zip CPU either. We also note that
3555
+               // .C will never be set on an equal condition.  Therefore, we
3556
+               // turn this into a XOR.NZ 2,CC, which will set the .C condition
3557
+               // as long as .Z wasn't true.  We then undo this when we're
3558
+               // done.  This is possible since none of these instructions
3559
+               // (LDI/MOV/Lod conditional, nor Xor conditional) will ever set
3560
+               // the condition codes.
3561
+               //
3562
+               // This is obviously not very optimal.  Avoid this by all means
3563
+               // if you can
3564
+               case GTU:       sprintf(result, "XOR.NZ\t2,CC\n%s.C\t%%%d,%%0\n\tXOR.NZ\t2,CC", op, opno); break;
3565
+               // .LEU doesn't exist on Zip CPU either--turn this into another
3566
+               // two instructions
3567
+               case LEU:       sprintf(result, "%s.C\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
3568
+               //
3569
+               // .GEU doesn't exist on Zip CPU.  Implementing it her is
3570
+               // painful.  We can change the condition codes to make it so,
3571
+               // but the instruction requires the condition codes not be
3572
+               // changed.  Hence, we must change them back if we do so.
3573
+               //
3574
+               // .C will be set on less than but not equal.  Hence !.C will
3575
+               // be true on greater than or equal.
3576
+               case GEU:       sprintf(result, "XOR\t2,CC\n%s.C\t%%%d,%%0\n\tXOR\t2,CC", op, opno); break;
3577
+               default:
3578
+                       internal_error("MOVSICC(BINARY) Unsupported condition");
3579
+                       return NULL;
3580
+       } return result;
3581
+}
3582
+
3583
+const char *zip_tertiary_movsicc(rtx condition, const char *optrue, const char *opfalse) {
3584
+       static  char    result[64] = "";
3585
+       switch(GET_CODE(condition)) {
3586
+               case EQ:        sprintf(result,"%s\t%%3,%%0\n\t%s.Z\t%%2,%%0", opfalse, optrue); break;
3587
+               case NE:        sprintf(result,"%s\t%%3,%%0\n\t%s.NZ\t%%2,%%0", opfalse, optrue); break;
3588
+               case LT:        sprintf(result,"%s\t%%3,%%0\n\t%s.LT\t%%2,%%0", opfalse, optrue); break;
3589
+               case GT:        sprintf(result,"%s\t%%3,%%0\n\t%s.GT\t%%2,%%0", opfalse, optrue); break;
3590
+               // LE doesn't exist on a Zip CPU.  Accomplish this by
3591
+               // reversing the condition: i.e., load the false value into
3592
+               // the register, and the on condition load the true value.
3593
+               case LE:        sprintf(result,"%s\t%%2,%%0\n\t%s.GT\t%%3,%%0", optrue, opfalse); break;
3594
+               case GE:        sprintf(result,"%s\t%%3,%%0\n\t%s.GE\t%%2,%%0", opfalse, optrue); break;
3595
+               case LTU:       sprintf(result,"%s\t%%3,%%0\n\t%s.C\t%%2,%%0", opfalse, optrue); break;
3596
+               //
3597
+               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;
3598
+               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;
3599
+               case GEU:       sprintf(result,"%s\t%%2,%%0\n\t%s.C\t%%3,%%0\n", optrue, opfalse); break;
3600
+               default:
3601
+                       internal_error("MOVSICC Unsupported condition");
3602
+                       return NULL;
3603
+       } return result;
3604
+}
3605
+
3606
+const char *zip_movsicc(rtx dst, rtx condition, rtx iftrue, rtx iffalse) {
3607
+       const bool      dbg = ((ALL_DEBUG_ON)||(true))&&(!ALL_DEBUG_OFF);
3608
+       if (dbg) fprintf(stderr, "ZIP::MOVSICC\n");
3609
+       if (dbg) zip_debug_rtx_pfx("DST", dst);
3610
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
3611
+       if (dbg) zip_debug_rtx_pfx("TRU", iftrue);
3612
+       if (dbg) zip_debug_rtx_pfx("FAL", iffalse);
3613
+       if ((REG_P(iftrue))&&(REGNO(dst)==REGNO(iftrue))) {
3614
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- CASE if(X) -> R\n");
3615
+               if (zip_legitimate_move_operand_p(SImode, iffalse, true))
3616
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "MOV", 3);
3617
+               else if (zip_const_address_operand(iffalse))
3618
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LDI", 3);
3619
+               else if (zip_const_address_operand(iffalse))
3620
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LDI", 3);
3621
+               else if ((MEM_P(iffalse))&&(zip_legitimate_operand_address(XEXP(iffalse,0), true)))
3622
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LOD", 3);
3623
+               else {
3624
+                       internal_error("MOVSICC Unsupported mode");
3625
+                       return NULL;
3626
+               }
3627
+       } if ((REG_P(iftrue))&&(REGNO(dst)==REGNO(iftrue))) {
3628
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- CASE if(!X) -> R\n");
3629
+               if (zip_legitimate_move_operand_p(SImode, iftrue, true))
3630
+                       return zip_binary_movsicc(GET_CODE(condition), "MOV",2);
3631
+               else if (zip_const_address_operand(iffalse))
3632
+                       return zip_binary_movsicc(GET_CODE(condition), "LDI",2);
3633
+               else if (zip_const_address_operand(iffalse))
3634
+                       return zip_binary_movsicc(GET_CODE(condition), "LDI",2);
3635
+               else if ((MEM_P(iffalse))&&(zip_legitimate_operand_address(XEXP(iffalse,0), true)))
3636
+                       return zip_binary_movsicc(GET_CODE(condition), "LOD",2);
3637
+               else {
3638
+                       internal_error("MOVSICC Unsupported mode");
3639
+                       return NULL;
3640
+               }
3641
+       } if ((zip_const_address_operand(iftrue))&&(zip_const_address_operand(iffalse))) {
3642
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) #1 ELSE #2\n");
3643
+               return zip_tertiary_movsicc(condition, "LDI", "LDI");
3644
+       } if ((zip_const_address_operand(iftrue))&&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
3645
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) #1 ELSE A+B\n");
3646
+               return zip_tertiary_movsicc(condition, "LDI", "MOV");
3647
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))&&(zip_const_address_operand(iffalse))) {
3648
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE #x\n");
3649
+               return zip_tertiary_movsicc(condition, "MOV", "LDI");
3650
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))
3651
+                       &&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
3652
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE C+D\n");
3653
+               return zip_tertiary_movsicc(condition, "MOV", "MOV");
3654
+       }
3655
+       if ((MEM_P(iftrue))
3656
+               &&(zip_legitimate_operand_address(XEXP(iftrue,0), true))
3657
+               &&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
3658
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A[B] ELSE C+D\n");
3659
+               return zip_tertiary_movsicc(condition, "LOD", "MOV");
3660
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))
3661
+               &&(MEM_P(iffalse))&&(zip_legitimate_operand_address(XEXP(iffalse,0), true))) {
3662
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE C[D]\n");
3663
+               return zip_tertiary_movsicc(condition, "MOV", "LOD");
3664
+       } if ((MEM_P(iftrue))&&(zip_legitimate_operand_address(XEXP(iftrue,0), true))
3665
+               &&(MEM_P(iffalse))&&(zip_legitimate_operand_address(XEXP(iffalse,0), true))) {
3666
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A[B] ELSE C[D]\n");
3667
+               return zip_tertiary_movsicc(condition, "LOD", "LOD");
3668
+       }
3669
+
3670
+       internal_error("MOVSICC Operands not supported");
3671
+}
3672
+
3673
+const char *zip_addsicc(rtx dst, rtx condition, rtx ifsrc, rtx addv ATTRIBUTE_UNUSED) {
3674
+       // We know upon entry that REG_P(dst) must be true
3675
+       if (!REG_P(dst))
3676
+               internal_error("%s","ADDSICC into something other than register");
3677
+       if ((REG_P(ifsrc))&&(REGNO(dst)==REGNO(ifsrc))) {
3678
+               switch (GET_CODE(condition)) {
3679
+               case EQ: return "ADD.Z\t%3,%0";
3680
+               case NE: return "ADD.NZ\t%3,%0";
3681
+               case LT: return "ADD.LT\t%3,%0";
3682
+               case GT: return "ADD.GT\t%3,%0";
3683
+               case LE: return "ADD.LT\t%3,%0\n\tADD.Z\t%3,%0";
3684
+               case GE: return "ADD.GE\t%3,%0";
3685
+               case LTU: return "ADD.C\t%3,%0";
3686
+               case LEU: return "ADD.C\t%3,%0\n\tADD.Z\t%3,%0";
3687
+               case GEU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tXOR\t2,CC";
3688
+               // Can do a GEU comparison, and then undo on the Zero condition
3689
+               case GTU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tSUB.Z\t%3,%0\n\tXOR\t2,CC";
3690
+               default:
3691
+                       internal_error("%s", "Zip/No usable addsi expansion");
3692
+                       break;
3693
+               }
3694
+       } else {
3695
+               // MOV A+REG,REG
3696
+               switch (GET_CODE(condition)) {
3697
+               case EQ: return "MOV.Z\t%3+%2,%0";
3698
+               case NE: return "MOV.NZ\t%3+%2,%0";
3699
+               case LT: return "MOV.LT\t%3+%2,%0";
3700
+               case GT: return "MOV.GT\t%3+%2,%0";
3701
+               case LE: return "MOV.LT\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
3702
+               case GE: return "MOV.GE\t%3+%2,%0";
3703
+               case LTU: return "MOV.C\t%3+%2,%0";
3704
+               case LEU: return "MOV.C\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
3705
+               case GEU: return "XOR\t2,CC\n\tMOV.C\t%3+%2,%0\n\tXOR\t2,CC";
3706
+               // Can do a GEU comparison, and then undo on the Zero condition
3707
+               // EXCEPT: with a move instruction, what's there to undo?  We
3708
+               // just clobbered our register!
3709
+               // case GTU: return "XOR\t2,CC\n\tMOV.C\t%3,%0\n\tSUB.Z\t%3,%0XOR\t2,CC";
3710
+               default:
3711
+                       internal_error("%s", "Zip/No usable addsi(reg,reg) expansion");
3712
+                       break;
3713
+               }
3714
+       }
3715
+
3716
+       return "BREAK";
3717
+}
3718
+
3719
+static void
3720
+zip_canonicalize_comparison(int *code ATTRIBUTE_UNUSED, rtx *op0 ATTRIBUTE_UNUSED, rtx *op1 ATTRIBUTE_UNUSED, bool preserve_op0 ATTRIBUTE_UNUSED)
3721
+{
3722
+/*
3723
+ * While I'd like to keep and have this code, it does absolutely nothing.  The
3724
+ * code apparently only gets called on non-CC0 targets.
3725
+ *
3726
+ *
3727
+       const bool      dbg = true;
3728
+
3729
+       if (dbg) fprintf(stderr, "CANONICALIZE ...%s\n", (preserve_op0)?"(Preserve Op0)":"");
3730
+       if (dbg) zip_debug_rtx_pfx("CODE", gen_rtx_fmt_ee((rtx_code)*code, VOIDmode, cc0_rtx, const0_rtx));
3731
+       if (dbg) zip_debug_rtx_pfx("OP0 ", *op0);
3732
+       if (dbg) zip_debug_rtx_pfx("OP1 ", *op1);
3733
+
3734
+       if ((!preserve_op0)&&((*code == LE)||(*code == GTU)||(*code == GEU))) {
3735
+               rtx tem = *op0;
3736
+               *op0 = *op1;
3737
+               *op1 = tem;
3738
+               *code = (int)swap_condition((enum rtx_code)*code);
3739
+       }
3740
+
3741
+       if ((*code == LE)||(*code == LEU)||(*code==GTU)) {
3742
+               int     offset = (*code == GTU) ? 1 : -1;
3743
+               bool    swap = false;
3744
+               // A < B => A <= B-1
3745
+               if (CONST_INT_P(*op1)) {
3746
+                       *op1 = GEN_INT(INTVAL(*op1)+offset);
3747
+                       swap = true;
3748
+               } else if (REG_P(*op1)) {
3749
+                       *op1 = plus_constant(SImode, *op1, offset, true);
3750
+                       swap = true;
3751
+               } else if ((GET_CODE(*op1)==PLUS)&&(CONST_INT_P(XEXP(*op1,1)))){
3752
+                       *op1 = plus_constant(GET_MODE(*op1),XEXP(*op1,0),
3753
+                                       INTVAL(XEXP(*op1,1))+offset);
3754
+                       swap = true;
3755
+               } if (swap) {
3756
+                       if (*code == LE)
3757
+                               (*code) = LT;
3758
+                       else if (*code == LEU)
3759
+                               (*code) = LTU;
3760
+                       else // (*code) == GTU
3761
+                               (*code) = GEU;
3762
+               }
3763
+       }
3764
+*/
3765
+}
3766
+
3767
+static int     zip_memory_move_cost(machine_mode mode, reg_class_t ATTRIBUTE_UNUSED, bool in) {
3768
+       int     rv = 14;
3769
+       if ((mode == DImode)||(mode == DFmode))
3770
+               rv += 2;
3771
+       return rv;
3772
+}
3773
+
3774
+
3775
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.h gcc-5.3.0-zip/gcc/config/zip/zip.h
3776
--- gcc-5.3.0-original/gcc/config/zip/zip.h     1969-12-31 19:00:00.000000000 -0500
3777
+++ gcc-5.3.0-zip/gcc/config/zip/zip.h  2016-03-05 12:28:06.303411350 -0500
3778
@@ -0,0 +1,3667 @@
3779
+////////////////////////////////////////////////////////////////////////////////
3780
+//
3781
+// Filename:   gcc/config/zip/zip.h
3782
+//
3783
+// Project:    Zip CPU backend for the GNU Compiler Collection
3784
+//
3785
+// Purpose:
3786
+//
3787
+// Creator:    Dan Gisselquist, Ph.D.
3788
+//             Gisselquist Technology, LLC
3789
+//
3790
+////////////////////////////////////////////////////////////////////////////////
3791
+//
3792
+// Copyright (C) 2016, Gisselquist Technology, LLC
3793
+//
3794
+// This program is free software (firmware): you can redistribute it and/or
3795
+// modify it under the terms of  the GNU General Public License as published
3796
+// by the Free Software Foundation, either version 3 of the License, or (at
3797
+// your option) any later version.
3798
+//
3799
+// This program is distributed in the hope that it will be useful, but WITHOUT
3800
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
3801
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3802
+// for more details.
3803
+//
3804
+// You should have received a copy of the GNU General Public License along
3805
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
3806
+// target there if the PDF file isn't present.)  If not, see
3807
+// <http://www.gnu.org/licenses/> for a copy.
3808
+//
3809
+// License:    GPL, v3, as defined and found on www.gnu.org,
3810
+//             http://www.gnu.org/licenses/gpl.html
3811
+//
3812
+//
3813
+////////////////////////////////////////////////////////////////////////////////
3814
+#ifndef        GCC_ZIP_H
3815
+#define        GCC_ZIP_H
3816
+
3817
+
3818
+//
3819
+//
3820
+// Zip CPU configuration registers
3821
+//
3822
+//
3823
+#define        ZIP_USER        0        // Assume we are in supervisor mode
3824
+#define        ZIP_MULTIPLY    1       // Assume we have multiply instructions
3825
+#define        ZIP_DIVIDE      1       // Assume we have divide instructions
3826
+#define        ZIP_FPU         0        // Assume we have no floating point instructions
3827
+#define        ZIP_PIPELINED   1       // Assume our instructions are pipelined
3828
+#define        ZIP_VLIW        1       // Assume we have the VLIW feature
3829
+#define        ZIP_ATOMIC      ((ZIP_PIPELINED)&&(ZIP_VLIW))
3830
+#define        ZIP_PIC         0        // Attempting to produce PIC code, with GOT
3831
+#define        ZIP_HAS_DI      1
3832
+
3833
+// Zip has 16 registers in each user mode.
3834
+//     Register 15 is the program counter (PC)
3835
+//     Register 14 is the condition codes (CC)
3836
+//     Register 13 is the stack pointer   (SP)
3837
+//     Register 12 (may be) the Global Offset Table pointer (GOT)
3838
+//     Register  0 (may be) the return address pointer
3839
+// Registers 16-31 may only be used in supervisor mode.
3840
+#define        is_ZIP_GENERAL_REG(REGNO)       ((REGNO)<13)
3841
+#define        is_ZIP_REG(REGNO)               ((REGNO)<16)
3842
+
3843
+#undef STARTFILE_SPEC
3844
+#define        STARTFILE_SPEC  "_start"
3845
+
3846
+#undef ENDFILE_SPEC
3847
+#define        ENDFILE_SPEC    ""
3848
+
3849
+#undef LIB_SPEC
3850
+#define        LIB_SPEC        "%{!g:-lc} %{g:-lg} -lzip"
3851
+
3852
+#define        zip_PC  15
3853
+#define        zip_CC  14
3854
+#define        zip_SP  13
3855
+#define        zip_FP  12
3856
+#define        zip_GOT 11
3857
+#define        zip_AP  10
3858
+#define        zip_R1  1
3859
+#define        zip_R0  0
3860
+
3861
+#define        ZIP_FIRST_ARG_REGNO     1
3862
+#define        ZIP_LAST_ARG_REGNO      5
3863
+#define        NUM_ARG_REGS            5
3864
+#define        MAX_PARM_REGS           5
3865
+
3866
+/* The overall framework of an assembler file */
3867
+
3868
+#undef ASM_SPEC
3869
+#define        ASM_COMMENT_START       ";"
3870
+#define        ASM_APP_ON              ""
3871
+#define        ASM_APP_OFF             ""
3872
+
3873
+#define        FILE_ASM_OP             "\t.file\n"
3874
+
3875
+/* Output and Generation of Labels */
3876
+#define        GLOBAL_ASM_OP           "\t.global\t"
3877
+
3878
+#undef BITS_PER_UNIT
3879
+#define        BITS_PER_UNIT   (32)
3880
+
3881
+/* Assembler Commands for Alignment */
3882
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
3883
+               { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
3884
+
3885
+
3886
+/* A C compound statement to output to stdio stream STREAM the assembler syntax
3887
+ * for an instruction operand X. */
3888
+#define        PRINT_OPERAND(STREAM, X, CODE)  zip_print_operand(STREAM, X, CODE)
3889
+#define        PRINT_OPERAND_ADDRESS(STREAM, X) zip_print_operand_address(STREAM, X)
3890
+
3891
+/* Passing arguments in registers */
3892
+#define        FUNCTION_VALUE_REGNO_P(REGNO)   ((REGNO)==zip_R1)
3893
+
3894
+/* Define how to find the value returned by a function.  VALTYPE is the data
3895
+ * type of the value (as a tree).  If the precise function being called is known
3896
+ * FUNC is its FUNCTION_DECL; otherwise, FUNC is 0. */
3897
+#define        FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx_REG(TYPE_MODE(VALTYPE), zip_R1)
3898
+
3899
+/* Define how to find the value returned by a library function assuming the
3900
+ * value has mode MODE.
3901
+ */
3902
+#define        LIBCALL_VALUE(MODE)     gen_rtx_REG(MODE, zip_R1)
3903
+
3904
+
3905
+/* STACK AND CALLING */
3906
+
3907
+
3908
+/* Define this macro as a C expression that is nonzero for registers that are
3909
+ * used by the epilogue or the return pattern.  The stack and frame pointer
3910
+ * registers are already assumed to be used as needed.
3911
+ */
3912
+#define        EPILOGUE_USES(R)        (R == RETURN_ADDRESS_REGNUM)
3913
+
3914
+
3915
+/* Normal alignment required for function parameters on the stack, in bits.  All
3916
+ * stack parameters receive at leaswt this much alignment regardless of data
3917
+ * type. */
3918
+#define        PARM_BOUNDARY   32
3919
+
3920
+/* Alignment of field after 'int : 0' in a structure. */
3921
+#define        EMPTY_FIELD_BOUNDARY    32
3922
+
3923
+/* No data type wants to be aligned rounder than this. */
3924
+#define        BIGGEST_ALIGNMENT       32
3925
+
3926
+/* The best alignment to use in cases where we have a choice. */
3927
+#define        FASTEST_ALIGNMENT       32
3928
+
3929
+/* Every structures size must be a multiple of 32-bits. */
3930
+#define        STRUCTURE_SIZE_BOUNDARY 32
3931
+
3932
+/* PCC_BITFIELD_TYPE_MATTERS -- define this if you wish to imitate the the way
3933
+ * other C compilers handle alignment of bit-fields and the structures that
3934
+ * contain them.
3935
+ *
3936
+ * The behavior is that the type written for a named bit-field (int, short, or
3937
+ * other integer type) imposes an alignment for the entire structure, as if the
3938
+ * structure really did contain an ordinary field of that type.  In addition,
3939
+ * the bit-field is placed within the structure so that it would fit within
3940
+ * such a field, not crossing a boundary for it.
3941
+ *
3942
+ * Thus, no most machines, a named bit-field whose type is written as int would
3943
+ * not cross a four-byte boundary, and would force four-byte alignment for the
3944
+ * whole structure.  (The alignment used may not be four bytes; it is controlled
3945
+ * by other alignment parameters.)
3946
+ *
3947
+ * An unnamed bit-field will not affect the alignment of the containing
3948
+ * structure.
3949
+ *
3950
+ * If thhe macro is defined, its definition should be a C expression, a non
3951
+ * zero value for the expression enables this behavior.
3952
+ * Look at the fundamental type that is used for a bit-field and use that to
3953
+ * impose alignment on the enclosing structure.  struct s{int a:8}; should
3954
+ * have the same alignment as 'int', not 'char'.
3955
+ */
3956
+#undef PCC_BITFIELD_TYPE_MATTERS
3957
+#define        PCC_BITFIELD_TYPE_MATTERS       0
3958
+
3959
+/* MAX_FIXED_MODE_SIZE -- An integer expression for the size in bits of the
3960
+ * largest integer machine mode that should actually be used.  All integer
3961
+ * machine modes of this size and smaller can be used for structures and unions
3962
+ * with the appropriate sizes.  If this macro is undefined,
3963
+ * GET_MODE_BITSIZE(DImode) is assumed.
3964
+ *
3965
+ * ZipCPU -- The default looks good enough for us.
3966
+ */
3967
+
3968
+/* Make strings word-aligned so strcpy from constants will be faster. */
3969
+#define        CONSTANT_ALIGNMENT(EXP, ALIGN)  (((TREE_CODE(EXP)==STRING_CST)  \
3970
+       && ((ALIGN) < FASTEST_ALIGNMENT)) ? FASTEST_ALIGNMENT : (ALIGN))
3971
+
3972
+/* Make arrays of chars word-aligned for the same reasons. */
3973
+#define        DATA_ALIGNMENT(TYPE, ALIGN)     ((TREE_CODE(TYPE) == ARRAY_TYPE) \
3974
+       && (TYPE_MODE(TREE_TYPE(TYPE)) == QImode)               \
3975
+       && ((ALIGN < FASTEST_ALIGNMENT) ? FASTEST_ALIGNMENT : (ALIGN)))
3976
+
3977
+/* Generate Code for Profiling
3978
+ */
3979
+#define        FUNCTION_PROFILER(FILE,LABELNO)         (abort(), 0)
3980
+
3981
+
3982
+/* A C expression which is nonzero if register number NUM is suitable for use
3983
+ * as an index register in operand addresses.
3984
+ */
3985
+#define        REGNO_OK_FOR_INDEX_P(NUM)       0
3986
+
3987
+
3988
+/* A C compound statement with a conditional 'goto LABEL;' executed if X
3989
+ * (an RTX) is a legitimate memory address on the target machine for a memory
3990
+ * operand of mode MODE.
3991
+ */
3992
+/* 17.03 Run-time Target Specification */
3993
+
3994
+/* TARGET_CPU_CPP_BUILTINS() ... This function-like macro expands to a block of
3995
+ * code that defines built-in preprocessor macros and assertions for the target
3996
+ * CPU, using the functions builtin_define, builtin_define_std, and
3997
+ * builtin_assert.  When the front end calls this macro it provides a trailing
3998
+ * semicolon, and since it has finished command line option proccessing your
3999
+ * code can use those results freely.
4000
+ *
4001
+ * ZipCPU --- We should probably capture in this macro what capabilities the
4002
+ * command line parameters we've been given indicate that our CPU has.  That
4003
+ * way, code can be adjusted depending upon the CPU's capabilities.
4004
+ */
4005
+#define        TARGET_CPU_CPP_BUILTINS()                       \
4006
+       { builtin_define("__ZIPCPU__");                 \
4007
+       if (ZIP_FPU) builtin_define("__ZIPFPU__");      \
4008
+       if (ZIP_ATOMIC) builtin_define("__ZIPATOMIC__");        \
4009
+       }
4010
+       // If (zip_param_has_fpu)  builtin_define("__ZIPFPU__");
4011
+       // If (zip_param_has_div)  builtin_define("__ZIPDIV__");
4012
+       // If (zip_param_has_mpy)  builtin_define("__ZIPMPY__");
4013
+       // If (zip_param_has_lock) builtin_define("__ZIPLOCK__");
4014
+       // If (zip_param_supervisor) builtin_define("__ZIPUREGS__");
4015
+       // If (we support int64s) builtin_define("___int64_t_defined");
4016
+
4017
+/* TARGET_OS_CPP_BUILTINS() ... Similarly to TARGET_CPU_CPP_BUILTINS but this
4018
+ * macro is optional and is used for the target operating system instead.
4019
+ */
4020
+
4021
+/* Option macros: (we need to define these eventually ... )
4022
+ *
4023
+ *     TARGET_HANDLE_OPTION
4024
+ *     TARGET_HANDLE_C_OPTION
4025
+ *     TARGET_OBJ_CONSTRUCT_STRING_OBJECT
4026
+ *     TARGET_OBJ_DECLARE_UNRESOLVED_CLASS_REFERENCE
4027
+ *     TARGET_OBJ_DECLARE_CLASS_DEFINITION
4028
+ *     TARGET_STRING_OBJECT_REF_TYPE_P
4029
+ *     TARGET_CHECK_STRING_OBJECT_FORMAT_ARG
4030
+ *     TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE(VOID)
4031
+ *     C_COMMON_OVERRIDE_OTPTIONS
4032
+ *     TARGET_OPTION_OPTIMIZATION_TABLE
4033
+ *     TARGET_OPTION_INIT_STRUCT
4034
+ *     TARGET_OPTION_DEFAULT_PARAMS
4035
+ */
4036
+
4037
+/* SWITCHABLE_TARGET
4038
+ *
4039
+ * Zip CPU doesn't need this, so it defaults to zero.  No need to change it
4040
+ * here.
4041
+ */
4042
+
4043
+/* TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(VOID) ... Returns true if the
4044
+ * target supports IEEE 754 floating-point exceptions and rounding modes, false
4045
+ * otherwise.  This is intended to relate to the float and double types, but not
4046
+ * necessarily "long double".  By default, returns true if the adddf3
4047
+ * instruction pattern is available and false otherwise, on the assumption that
4048
+ * hardware floating point supports exceptions and rounding modes but software
4049
+ * floating point does not.
4050
+ *
4051
+ * ZipCPU floating point is barely going to be functional, I doubt it will
4052
+ * support all of these bells and whistles when full functionality is even
4053
+ * achieved.  Therefore, we won't support these modes.  However, we can't just
4054
+ * set this to zero, so let's come back to this.
4055
+ */
4056
+// #warning "Wrong answer encoded to date"
4057
+// #undef      TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(X)
4058
+// #define     TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(X) 0
4059
+
4060
+/* 17.04 Defining data structures for per-function information */
4061
+
4062
+/* INIT_EXPANDERS ... Macro called to initialize any target specific
4063
+ * information.  This macro is called once per function, before generation of
4064
+ * any RTL has begun.  The intention is to allow the initialization of the
4065
+ * function pointer init_machine_status.
4066
+ */
4067
+// #warning "I may need to define this to handle function return addresses ..."
4068
+
4069
+/* 17.05 Storage Layout */
4070
+
4071
+/* Storage Layout */
4072
+#define        BITS_BIG_ENDIAN         0        // MSB has highest number
4073
+#define        BYTES_BIG_ENDIAN        1       // 1 if MSB is lowest number
4074
+#define        WORDS_BIG_ENDIAN        1       // 1 if MSW is lowest number
4075
+#define        FLOAT_WORDS_BIG_ENDIAN  1
4076
+#define        BITS_PER_WORD           32
4077
+// #define     MAX_BITS_PER_WORD       // defaults to BITS_PER_WORD
4078
+#define        UNITS_PER_WORD          1       // Storage units in a word, pwr of 2:1-8
4079
+#define        MIN_UNITS_PER_WORD      1       // Default is UNITS_PER_WORD
4080
+/* POINTER_SIZE ... Width of a pointer in bits.  You must specify a value no
4081
+ * wider than the width of Pmode.  If it is not equal to the width of Pmode,
4082
+ * you must define POINTERS_EXTEND_UNSIGNED. If you do not specify a value the
4083
+ * default is BITS_PER_WORD.
4084
+ *
4085
+ * ZipCPU --- All of our pointers are 32-bits, the width of our address bus.
4086
+ */
4087
+#define        POINTER_SIZE            32      // Ptr width in bits
4088
+/* POINTERS_EXTEND_UNSIGNED ... A C expression that determines how pointers
4089
+ * should be extended from ptr_mode to either Pmode or word_mode.  It is greater
4090
+ * than zero if pointers should be zero-extended, zero if they should be sign
4091
+ * extended, and negative if some other conversion is needed.  In the last case,
4092
+ * the extension is done by the target's ptr_extend instruction.
4093
+ *
4094
+ * You need not define this macro if the ptr_mode, Pmode, and word_mode are all
4095
+ * the same width.
4096
+ *
4097
+ * ZipCPU --- While we shouldn't need this, QImode and HImode have the same
4098
+ * number of bits as SImode.  Therefore, one might wish to convert between the
4099
+ * two.  Hence, we specify how we would do that here.
4100
+ */
4101
+#define        POINTERS_EXTEND_UNSIGNED        0
4102
+
4103
+/* PROMOTE_MODE(m,unsignedp,type) ... A macro to update m and unsignedp when an
4104
+ * object whose type is type and which has he specified mode and signedness is
4105
+ * to be stored in a register.  This macro is only called when type is a scalar
4106
+ * type.
4107
+ *
4108
+ * On most RISC machines, which only have operations that operate on a full
4109
+ * register, define this macro to set m to word_mode if m is an integer mode
4110
+ * narrower than BITS_PER_WORD.  In most cases, only integer modes should be
4111
+ * widened because wider precision floating-point operations are usually more
4112
+ * expensive than their narrower counterparts.
4113
+ *
4114
+ * For most machines, the macro definition does not change unsigndep.  However,
4115
+ * some machines, have instructions that preferentially handle either signed or
4116
+ * unsigned quantities of certain modes.  For example, on the DEC Alpha, 32-bit
4117
+ * loads from memory and 32-bit add instructions sign-extend the result to
4118
+ * 64-bits. On such machines, set unsignedp according to which kind of extension
4119
+ * is more efficient.
4120
+ *
4121
+ * Do not define this macro if it would never modify m.
4122
+ *
4123
+ * ZipCPU --- We need to always (if possible) promote everything to SImode where
4124
+ * we can handle things.  HImode and QImode just don't make sense on this CPU.
4125
+ */
4126
+#define        PROMOTE_MODE(M,U,T)     if ((GET_MODE_CLASS(M)==MODE_INT)&&(GET_MODE_SIZE(M)<2)) (M)=SImode;
4127
+
4128
+// TARGET_PROMOTE_FUNCTION_MODE
4129
+/* PARM_BOUNDARY ... Normal alignment required for function parameters on the
4130
+ * stack, in bits.  All stack parameters receive at least this much alignment
4131
+ * regardless of data type.  On most machines, this is the same as the size of
4132
+ * an integer.
4133
+ */
4134
+#define        PARM_BOUNDARY   32
4135
+
4136
+/* STACK_BOUNDARY ... Define this macro to the minimum alignment enforced by
4137
+ * hardware for the stack pointer on this machine.  The definition is a C
4138
+ * expression for the desired alignment (measured in bits).  This value is used
4139
+ * as a default if PREFERRED_STACK_BOUNDARY is not defined.  On most machines,
4140
+ * this should be the same as PARM_BOUNDARY.
4141
+ */
4142
+#define        STACK_BOUNDARY  PARM_BOUNDARY
4143
+
4144
+/* PREFERRED_STACK_BOUNDARY ... Define this ... */
4145
+
4146
+/* INCOMING_STACK_BOUNDARY
4147
+ */
4148
+
4149
+/* FUNCTION_BOUNDARY ... Alignment required for a function entry point, in bits.
4150
+ */
4151
+#define        FUNCTION_BOUNDARY       32
4152
+
4153
+/* BIGGEST_ALIGNMENT ... Biggest alignment that any data type can require on
4154
+ * this machine, in bits.  Note that this is not the biggest alignment that is
4155
+ * supported, just the biggest alignment that, when violated, may cause a fault.
4156
+ */
4157
+#define BIGGEST_ALIGNMENT      32
4158
+
4159
+/* MINIMUM_ATOMIC_ALIGNMENT ... If defined, the smallest alignment, that can be
4160
+ * given to an object that can be referenced in one operation, without
4161
+ * disturbing any nearby object.  Normally, this is BITS_PER_UNIT, but may be
4162
+ * larger on machines that don't have byte or halfword store operations.
4163
+ */
4164
+#define        MINIMUM_ATOMIC_ALIGNMENT        BITS_PER_UNIT
4165
+
4166
+/* STRICT_ALIGNMENT ... Set this nonzero if move instructions will actually
4167
+ * fail to work when given unaligned data.  If instructions will merely go
4168
+ * slower in that case, define this macro as 0.
4169
+ */
4170
+#define        STRICT_ALIGNMENT        1
4171
+
4172
+/* MAX_FIXED_MODE_SIZE ... An integer expression for the size in bits of the
4173
+ * largest integer machine mode that should actually be used.  All integer
4174
+ * machine modes of this size or smaller can be used for structures and unions
4175
+ * with the appropriate sizes.  If this macro is undefined,
4176
+ * GET_MODE_BITSIZE(DImode) is assumed.
4177
+ *
4178
+ * ZipCPU ... Get_MOD_BITSIZE(DImode) will be 64, and this is really not the
4179
+ * size on bits of the largest integer machine mode.  However, that's the case
4180
+ * with most DI implementations: A long is two words, spliced together.  We'd
4181
+ * like to support that eventually, but we need to get there.  Hence, let's use
4182
+ * compile time flag (ZIP_HAS_DI) that we can enable when we're ready.
4183
+ */
4184
+#if (ZIP_HAS_DI != 0)
4185
+#define        MAX_FIXED_MODE_SIZE     64
4186
+#else
4187
+#define        MAX_FIXED_MODE_SIZE     32
4188
+#endif
4189
+
4190
+
4191
+/* 17.06 Layout of Source Language Data Types */
4192
+
4193
+#undef CHAR_TYPE_SIZE
4194
+#undef SHORT_TYPE_SIZE
4195
+#undef INT_TYPE_SIZE
4196
+#undef LONG_TYPE_SIZE
4197
+#undef LONG_LONG_TYPE_SIZE
4198
+//
4199
+#define        CHAR_TYPE_SIZE  32
4200
+#define        SHORT_TYPE_SIZE 32
4201
+#define        INT_TYPE_SIZE   32
4202
+#define        LONG_TYPE_SIZE  32
4203
+#define        LONG_LONG_TYPE_SIZE     64
4204
+// BOOL_TYPE_SIZE defaults to CHAR_TYPE_SIZE
4205
+#undef FLOAT_TYPE_SIZE
4206
+#undef DOUBLE_TYPE_SIZE
4207
+#undef LONG_DOUBLE_TYPE_SIZE
4208
+#define        FLOAT_TYPE_SIZE         32
4209
+#define        DOUBLE_TYPE_SIZE        FLOAT_TYPE_SIZE // Zip CPU doesn't support dbls
4210
+#define        LONG_DOUBLE_TYPE_SIZE   64      // This'll need to be done via emulation
4211
+// SHORT_FRAC_TYPE_SIZE
4212
+// LONG_FFRACT_TYPE_SIZE
4213
+// LONG_LONG_FRACT_TIME_SIZE
4214
+#undef SHORT_ACCUM_TYPE_SIZE
4215
+#undef ACCUM_TYPE_SIZE
4216
+#undef LONG_ACCUM_TYPE_SIZE
4217
+#define        SHORT_ACCUM_TYPE_SIZE   SHORT_TYPE_SIZE
4218
+#define        ACCUM_TYPE_SIZE         INT_TYPE_SIZE
4219
+#define        LONG_ACCUM_TYPE_SIZE    LONG_TYPE_SIZE
4220
+
4221
+/* LIBGCC2_GNU_PREFIX ... This macro corresponds to the TARGET_GNU_PREFIX target
4222
+ * hook and should be defined if that hook is overriden to be true.  It causes
4223
+ * function names in libgcc to be changed to use a __gnu_ prefix for their name
4224
+ * rather than the default __.  A port which uses this macro should also arrange
4225
+ * to use t-gnu-prefix in the libgcc config.host.
4226
+ *
4227
+ * ZipCPU -- I see no reason to define and therefore change this behavior.
4228
+ */
4229
+
4230
+/* TARGET_FLT_EVAL_METHOD ... A C expression for the value for FLT_EVAL_METHOD
4231
+ * in float.h,, assuming, if applicable, that the floating-point control word
4232
+ * is in its default state.  If you do not define this macro the value of
4233
+ * FLT_EVAL_METHOD will be zero.
4234
+ *
4235
+ * ZipCPU --- ???
4236
+ */
4237
+
4238
+/* WIDEST_HARDWARE_FP_SIZE ... A C expression for the size in bits of the widest
4239
+ * floating-point format supported by the hardware.  If you define this macro,
4240
+ * you must specify a value less than or equal to the value of LONG_DOUBLE_...
4241
+ * If you do not define this macro, the value of LONG_DOUBLE_TYPE_SIZE is the
4242
+ * default.
4243
+ *
4244
+ * ZipCPU supports 32-bit IEEE floats--IF THE SUPPORT IS COMPILED IN!  This
4245
+ * really needs to be determined, then, based upon a compile time parameter
4246
+ * where the one compiling the code states whether or not the H/W even has
4247
+ * floating point support.
4248
+ *
4249
+ * For now, we'll assume it does--but once we implement GCC parameters, we'll
4250
+ * need to change this.
4251
+ */
4252
+#undef WIDEST_HARDWARE_FP_SIZE
4253
+// #warning "Definition needs to change if no FPU present"
4254
+#define        WIDEST_HARDWARE_FP_SIZE FLOAT_TYPE_SIZE
4255
+
4256
+/* DEFAULT_SIGNED_CHAR ... An expression whose value is 1 or 0, according to
4257
+ * whether the type char should be signed or unsigned by default.  The user
4258
+ * can always override this default with the options -fsigned-char and
4259
+ * -funsigned-char.
4260
+ *
4261
+ * ZipCPU--let's go with the default behavior.
4262
+ */
4263
+#define        DEFAULT_SIGNED_CHAR     1
4264
+
4265
+/* TARGET_DEFAULT_SHORT_ENUMS(VOID) ... This target hook should return true if
4266
+ * the compiler should give an enum type onyl as many bytes as it takes to
4267
+ * represent the range of possible values of that type.  It should return
4268
+ * false if all enum types should be allocated like int.
4269
+ *
4270
+ * The default is to return false.  This is what the ZipCPU needs, so we won't
4271
+ * override it.
4272
+ */
4273
+
4274
+/* SIZE_TYPE ... A C expression for a string describing the name of the data
4275
+ * type to use for size values.  The typedef name size_t is defined using the
4276
+ * contents of the string.
4277
+ *
4278
+ * If you don't define this macro, the default is "long unsigned int".  Since
4279
+ * on the ZipCPU this is a 32-bit number, and all ZipCPU values are 32-bits,
4280
+ * the default seems perfect for us.
4281
+ */
4282
+#define        SIZE_TYPE       "unsigned int"
4283
+
4284
+/* SIZETYPE ... GCC defines internal types () for expressions dealing with size.
4285
+ * This macro is a C expression for a string describing the name of the data
4286
+ * type from which the precision of sizetype is extracted.  The string has the
4287
+ * same restrictions as SIZE_TYPE string.  If you don't define this macro, the
4288
+ * default is SIZE_TYPE --- which seems good enough for us.
4289
+ */
4290
+
4291
+/* PTRDIFF_TYPE ... A C expression for a string describing the name of the data
4292
+ * type to use fo rthe result of subtracting two pointers.  The typedef name
4293
+ * ptrdiff_t is defined using the contents of the string.  See SIZE_TYPE for
4294
+ * more information.
4295
+ *
4296
+ * The default is "long int" which for the ZipCPU is 32-bits---still good enough
4297
+ * for us.
4298
+ */
4299
+#define        PTRDIFF_TYPE    "int"
4300
+
4301
+/* WCHAR_TYPE ... A C expression for a string describing the name of the data
4302
+ * type to use for wide characters.  The typedef name wchar_t is defined using
4303
+ * the contents of  the string.  If you don't define this macro, the default is
4304
+ * 'int'--good enough for ZipCPU.
4305
+ */
4306
+
4307
+/* WCHAR_TYPE_SIZE ... A C expression for the size in bits of the data type for
4308
+ * wide characters.  This is used in cpp, which cannot make use of WCHAR_TYPE.
4309
+ */
4310
+#undef WCHAR_TYPE_SIZE
4311
+#define        WCHAR_TYPE_SIZE 32
4312
+
4313
+/* WINT_TYPE ... A C expression for a string describing the name of the data
4314
+ * type to use for wide characters passed to printf and returned from getwc.
4315
+ * The typedef name wint_t is defined using the contents of the string.  See
4316
+ *
4317
+ * If you don't define this macro, the default is "unsigned int"--also best
4318
+ * for us again.
4319
+ */
4320
+
4321
+/* INTMAX_TYPE ... A C expression for a string describing the name of the
4322
+ * data type that can represent any value of any standard or extended signed
4323
+ * integer type.  The typedef name intmax_t is defined using the contents of
4324
+ * the string.
4325
+ *
4326
+ * If you don't define this macro, the default is the first of "int", "long int"
4327
+ * or "long long int" that has as much precision as "long long int".
4328
+ */
4329
+
4330
+/* UINTMAX_TYPE ... same as INTMAX_TYPE, but for unsigned
4331
+ */
4332
+
4333
+#undef SIG_ATOMIC_TYPE
4334
+#if (ZIP_ATOMIC != 0)
4335
+#define        SIG_ATOMIC_TYPE "int"
4336
+#else
4337
+#define        SIG_ATOMIC_TYPE NULL    // We have no atomic types, but registers
4338
+#endif
4339
+#undef INT8_TYPE
4340
+#define        INT8_TYPE               NULL    // We have no 8-bit integer type
4341
+#undef INT16_TYPE
4342
+#define        INT16_TYPE              NULL
4343
+#undef INT32_TYPE
4344
+#define        INT32_TYPE              "int"
4345
+#undef UINT8_TYPE
4346
+#define        UINT8_TYPE              NULL
4347
+#undef UINT16_TYPE
4348
+#define        UINT16_TYPE             NULL
4349
+#undef UINT32_TYPE
4350
+#define        UINT32_TYPE             "unsigned int"
4351
+#undef INT_LEAST8_TYPE
4352
+#define        INT_LEAST8_TYPE         "int"
4353
+#undef INT_LEAST16_TYPE
4354
+#define        INT_LEAST16_TYPE        "int"
4355
+#undef INT_LEAST32_TYPE
4356
+#define        INT_LEAST32_TYPE        "int"
4357
+#undef UINT_LEAST8_TYPE
4358
+#define        UINT_LEAST8_TYPE        "unsigned int"
4359
+#undef UINT_LEAST16_TYPE
4360
+#define        UINT_LEAST16_TYPE       "unsigned int"
4361
+#undef UINT_LEAST32_TYPE
4362
+#define        UINT_LEAST32_TYPE       "unsigned int"
4363
+#undef INT_FAST8_TYPE
4364
+#define        INT_FAST8_TYPE          "int"
4365
+#undef INT_FAST16_TYPE
4366
+#define        INT_FAST16_TYPE         "int"
4367
+#undef INT_FAST32_TYPE
4368
+#define        INT_FAST32_TYPE         "int"
4369
+#undef UINT_FAST8_TYPE
4370
+#define        UINT_FAST8_TYPE         "unsigned int"
4371
+#undef UINT_FAST16_TYPE
4372
+#define        UINT_FAST16_TYPE        "unsigned int"
4373
+#undef UINT_FAST32_TYPE
4374
+#define        UINT_FAST32_TYPE        "unsigned int"
4375
+#undef INTPTR_TYPE
4376
+#define        INTPTR_TYPE             "unsigned int"
4377
+#undef UINTPTR_TYPE
4378
+#define        UINTPTR_TYPE            "unsigned int"
4379
+
4380
+#undef INT64_TYPE
4381
+#undef UINT64_TYPE
4382
+#undef INT_LEAST64_TYPE
4383
+#undef UINT_LEAST64_TYPE
4384
+#undef INT_FAST64_TYPE
4385
+#undef UINT_FAST64_TYPE
4386
+
4387
+#if (ZIP_HAS_DI != 0)
4388
+#define        INT64_TYPE              "long int"
4389
+#define        UINT64_TYPE             "long unsigned int"
4390
+#define        INT_LEAST64_TYPE        "long int"
4391
+#define        UINT_LEAST64_TYPE       "long unsigned int"
4392
+#define        INT_FAST64_TYPE         "long int"
4393
+#define        UINT_FAST64_TYPE        "long unsigned int"
4394
+#else
4395
+#define        INT64_TYPE              NULL
4396
+#define        UINT64_TYPE             NULL
4397
+#define        INT_LEAST64_TYPE        NULL
4398
+#define        UINT_LEAST64_TYPE       NULL
4399
+#define        INT_FAST64_TYPE         NULL
4400
+#define        UINT_FAST64_TYPE        NULL
4401
+#endif
4402
+
4403
+#define        TARGET_PTRMEMFUNC_VBI_LOCATION  ptrmemfunc_vbit_in_pfn
4404
+
4405
+
4406
+/* 17.07 Register Usage / Register definitions */
4407
+
4408
+/* FIRST_PSEUDO_REGISTER ... Number of hardware registers known to the compiler.
4409
+ * They receive numbers 0 through FIRST_PSEUDO_REGISTER-1; thus the first
4410
+ * pseudo register's numbrer really is assigned the number
4411
+ * FIRST_PSEUDO_REGISTER.
4412
+ *
4413
+ * ZipCPU---There are 16 registers in the ZipCPU, numbered 0-15 with the CC
4414
+ * and PC register being numbered 14 and 15 respectively.  Therefore, the
4415
+ * compiler can take register number 16 and above and do whatever it wants
4416
+ * with it.
4417
+ */
4418
+#ifdef DEFINE_USER_REGS
4419
+#define        FIRST_PSEUDO_REGISTER   32
4420
+#else
4421
+#define        FIRST_PSEUDO_REGISTER   16
4422
+#endif
4423
+
4424
+/* FIXED_REGISTERS ... An initializer that says which registers are used for
4425
+ * fixed purposes all throughout the compiled code and are therefore not
4426
+ * available for general allocation.  These would include the stack pointer, the
4427
+ * frame pointer (except on machines where that can be used as a general
4428
+ * register when no frame pointer is needed), the program counter on machines
4429
+ * where that is considered one of the addressable registers, and any other
4430
+ * numbered register with a standard use.
4431
+ *
4432
+ * This information is expressed as a sequence of numbers, separated by commas,
4433
+ * and surrounded by braces.  The nth number is 1 if register n is fixed, 0
4434
+ * otherwise.
4435
+ *
4436
+ * For the Zip CPU, we have three fixed registers that are not available for
4437
+ * general allocation:
4438
+ *
4439
+ *     SP      The stack pointer
4440
+ *     CC      The condition codes and CPU state register
4441
+ *     PC      The program counter
4442
+ *
4443
+ * Other registers, such as FP (the frame pointer) or GBL (the global offset
4444
+ * table pointer) are registers that we hope will not be so fixed.
4445
+ */
4446
+#define        FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1 }
4447
+
4448
+/* CALL_USED_REGISTERS ... like FIXED_REGISTERS but has 1 for each register
4449
+ * that is clobbered (in general) by function calls as well as for fixed
4450
+ * registers.  This macro therefore identifies the registers that are not
4451
+ * available for general allocation of values that must live across function
4452
+ * calls.
4453
+ *
4454
+ * If a register has 0 in CALL_USED_REGISTERS, the compiler automatically saves
4455
+ * it on function entry and restores it on function exit, if the register is
4456
+ * used within the function.
4457
+ *
4458
+ * On the Zip CPU, we must save R0 (the return address), and (let's pick) any
4459
+ * register above R5.
4460
+ */
4461
+#define        CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1 }
4462
+
4463
+/* CALL_REALLY_USED_REGISTERS ...  optional macro that, if not defined, defaults
4464
+ * to the value of CALL_USED_REGISTERS.
4465
+ */
4466
+
4467
+/* HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE) ... A C expression that is nonzero
4468
+ * if it is not permissible to store a value of mode MODE in hard register REGNO
4469
+ * across a call without some part of it being clobbbered.  For most machines,
4470
+ * this macro need not be defined.  It is only required for machines that do
4471
+ * not preserve the eentire contents of a register across a call.
4472
+ *
4473
+ * In the Zip CPU, we clobber R0 with our return address during a call, so let's
4474
+ * make sure this gets included here.
4475
+ */
4476
+#define        HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE)      (REGNO==0)
4477
+
4478
+/* TARGET_CONDITIONAL_REGISTER_USAGE(VOID) ... This hook may conditionally
4479
+ * modify five variables fixed_regs, call_used_regs, global_regs, reg_names, and
4480
+ * reg_class_contents, to take into account any dependence of these register
4481
+ * sets on target flags.  The first three of these are of type char[]
4482
+ * (interpreted as Boolean vectors).  global_regs is a const char *[] and
4483
+ * reg_class_contents is a HARD_REG_SET.  Before the macro is called,
4484
+ * fixed_regs, call_used_regs, reg_class_contents, and reg_names have been
4485
+ * initialized from FIXED_REGISTERS, CALL_USED_REGISTERS, REG_CLASS_CONTENTS,
4486
+ * and REGISTER_NAMES, respectively.  global_regs has been cleared, and any
4487
+ * -ffixed-reg, -fcall-used-reg, and -fcall-saved-reg command options have been
4488
+ * applied.
4489
+ *
4490
+ * ZipCPU -- I may need to return and define this depending upon how FP and
4491
+ * GBL register allocation go.  But for now, we'll leave this at its default
4492
+ * value.
4493
+ */
4494
+// #warning "Revisit me after FP and GBL allocation"
4495
+
4496
+/* INCOMING_REGNO(out) ... Define this macro if the target machine has register
4497
+ * windows. ...
4498
+ *
4499
+ * Zip CPU has no register windows.
4500
+ */
4501
+
4502
+/* OUTGOING_REGNO ... same thing.
4503
+ */
4504
+
4505
+/* LOCAL_REGNO ... same thing.
4506
+ */
4507
+
4508
+/* PC_REGNUM ... If the program counter has a register number, define this as
4509
+ * that register number.  Otherwise do not define it.
4510
+ */
4511
+#define        PC_REGNUM       zip_PC
4512
+
4513
+
4514
+/* REG_ALLOC_ORDER ... If defined, an initializer for a vector of integers,
4515
+ * containing the number of hard registers in the order in which GCC should
4516
+ * prefer to use them (from most preferred to least.
4517
+ *
4518
+ * If this macro is not definedd, registers are used lowest numbered first (all
4519
+ * else being equal).
4520
+ *
4521
+ * Since the default is the ZipCPU desired case, we won't define this here.
4522
+ */
4523
+
4524
+/* ADJUST_REG_ALLOC_ORDER ... on most machines it is not necessary to define
4525
+ * this macro, so we won't either.
4526
+ */
4527
+
4528
+/* HONOR_REG_ALLOC_ORDER ...
4529
+ */
4530
+
4531
+/* HONOR_REG_ALLOC_ORDER ... on most machines it is not necessary to define
4532
+ * this macro, so we won't either.
4533
+ */
4534
+
4535
+/* HARD_REGNO_NREGS(REGNO, MODE) ... A C expression for the number of
4536
+ * consecutive hard registers, starting at register number REGNO, required to
4537
+ * hold a value of mode MODE.
4538
+ *
4539
+ * On a machine where all registers are exactly one word, a suitable definition
4540
+ * is given of ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)/UNITS_PER_WORD.
4541
+ *
4542
+ * On ZipCPU, we might do
4543
+ *     ((((MODE)==DImode)||((MODE)==DFmode))?2:1)
4544
+ * but I think the default (above) code should work as well.  Hence, let's stick
4545
+ * with the default, lest someone try to create larger modes (TImode, OImode,
4546
+ * XImode) and expect us to follow them properly some how.
4547
+ *
4548
+ * Okay, now in hind sight, we know that the default doesn't work for our
4549
+ * architecture, since GET_MODE_SIZE(SImode)=4, not 1.  Thus, let's rearrange
4550
+ * this expression to work in bits rather than in bytes and we'll know more
4551
+ * of what we are doing.
4552
+ */
4553
+#undef HARD_REGNO_NREGS
4554
+#define        HARD_REGNO_NREGS(REGNO, MODE)   ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)\
4555
+               / (UNITS_PER_WORD))
4556
+
4557
+/* HARD_REGNO_NREGS_HAS_PADDING(REGNO,MODE) ... A C expression that is nonzero
4558
+ * if a value of mode MODE, stored in memory, ends with padding that causes it
4559
+ * to take up more space than in registers starting at register number REGNO
4560
+ * (as determined by multiplying GCC's notion of the size of the register when
4561
+ * containing this mode by the number of registers returned by HARD_REGNO_NREGS)
4562
+ * By default this is zero.
4563
+ *
4564
+ * Zip CPU --- The default looks good enough to me.
4565
+ */
4566
+
4567
+/* HARD_REGNO_NREGS_WITH_PADDING(REGNO, MODE)
4568
+ *
4569
+ * ZipCPU ---
4570
+ */
4571
+
4572
+/* REGMODE_NATURAL_SIZE(MODE) -- Define this macro if the natural size of
4573
+ * registers that hold values of mode mode is not the word size.  It is a C
4574
+ * expression that should give the natural size in bytes for the specified mode.
4575
+ * It is used by the register allocator to try to optimize its results.
4576
+ *
4577
+ * ZipCPU ---
4578
+ */
4579
+// #define     REGMODE_NATURAL_SIZE(MODE)      (((MODE)==DImode)?2:1)
4580
+
4581
+/* HARD_REGNO_MODE_OK ... A C expression that is nonzero if it is permissible
4582
+ * to store a value of mode MODE in a hard regsiter number REGNO (or in several
4583
+ * registers starting with that one).  For a machine where all registers are
4584
+ * equivalent, a suitable definition is '1'.  You need not include code to check
4585
+ * for the numbers of fixed registers, because the allocation mechanism
4586
+ * considered them to be always occupied.
4587
+ *
4588
+ * ZipCPU --- As long as you are already avoiding the fixed registers, the
4589
+ * suitable default definition mentioned above should be sufficient.
4590
+ */
4591
+#undef HARD_REGNO_MODE_OK
4592
+#define        HARD_REGNO_MODE_OK(R,M) 1
4593
+
4594
+/* HARD_REGNO_RENAME_OK(FROM,TO) ... A C expression that is nonzero if it is
4595
+ * okay to rename a hard register FROM to another hard register TO.  One common
4596
+ * use of this macro is to prevernt renaming of a register to another register
4597
+ * that is not saved by a prologue in an interrupt handler.  The default is
4598
+ * always nonzero.
4599
+ *
4600
+ * ZipCPU --- The default looks good enough to us.
4601
+ */
4602
+#undef HARD_REGNO_RENAME_OK
4603
+#define        HARD_REGNO_RENAME_OK(FROM,TO)   ((is_ZIP_GENERAL_REG(FROM))&&(is_ZIP_GENERAL_REG(TO)))
4604
+
4605
+
4606
+/* MODES_TIABLE_P(M1, M2) ... A C expression that is nonzero if a value of mode
4607
+ * M1 is accessible in mode M2 without copying.
4608
+ *
4609
+ * ZipCPU --- well, that's true for us (although we support scant few modes) ...
4610
+ * so lets' set to one.
4611
+ */
4612
+#define        MODES_TIEABLE_P(M1,M2)  1
4613
+
4614
+/* TARGET_HARD_REGNO_SCRATCH_OK(REGNO)
4615
+ * This target hook should return true if it is OK to use a hard register
4616
+ * REGNO has a scratch register in peephole2.  One common use of this macro is
4617
+ * to prevent using of a register that is not saved by a prologue in an
4618
+ * interrupt handler.  The default version of this hook always returns true.
4619
+ *
4620
+ * ZipCPU --- the default works for us as well.  If you are in an interrupt
4621
+ * context, you have an entirely new set of registers (the supervisor set), so
4622
+ * this is a non-issue.
4623
+ */
4624
+
4625
+/* AVOID_CCMODE_COPIES ... define this macro if the compiler should avoid
4626
+ * copies to/from CCmode register(s).  You should only define this macro if
4627
+ * support for copying to/from CCmode is incomplete.
4628
+ *
4629
+ * ZipCPU --- CCmode register copies work like any other, so we'll keep with the
4630
+ * default definition.
4631
+ */
4632
+
4633
+/* STACK_REGS ... Define this if the machine has any stack-like registers.
4634
+ *
4635
+ * Zip CPU has no stack-like registers, as their definition is different from
4636
+ * the ZipCPU stack pointer register.
4637
+ */
4638
+
4639
+#define        ZIP_REG_BYTE_SIZE       1
4640
+
4641
+/* 17.08 Register Classes */
4642
+
4643
+/* enum reg_class ... An enumerate type that must be defined with all the
4644
+ * register class names as enumerated values.  NO_REGS must be first.  ALL_REGS
4645
+ * must be the last register class, followed by one more enumerated value,
4646
+ * LIM_REG_CLASSES, which is not a register class but rather tells how many
4647
+ * classes there are.
4648
+ *
4649
+ * ZipCPU --- We'll defined register 0-13 as general registers, 14-15 in
4650
+ * all_regs, and go from there.
4651
+ */
4652
+enum   reg_class {
4653
+       NO_REGS, GENERAL_REGS,
4654
+#ifdef DEFINE_USER_REGS
4655
+       USER_REGS,
4656
+#endif
4657
+       ALL_REGS, LIM_REG_CLASSES
4658
+};
4659
+
4660
+/* N_REG_CLASSES ... the number of distinct register classes, defined as follows
4661
+ */
4662
+#define        N_REG_CLASSES   (int)LIM_REG_CLASSES
4663
+
4664
+/* REG_CLASS_NAMES ... An initializer containing the names of the register
4665
+ * classes as C string constants.  These names are used in writing some of the
4666
+ * debugging dumps.
4667
+ */
4668
+#define        REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "ALL_REGS" }
4669
+
4670
+/* REG_CLASS_CONTENTS ... An initializer containing the contents of the register
4671
+ * classes, as integerss which are bit masks.  The nth integer specifies the
4672
+ * contents of class n.  That way the integer mask is interpreted as that
4673
+ * register r is in the class if (mask&(1<<r)) is 1.
4674
+ *
4675
+ * When the machine has more than 32 registers ... that's not us.
4676
+ *
4677
+ * ZipCPU --- This is straight forward, three register classes, etc.
4678
+ */
4679
+#define        REG_CLASS_CONTENTS { { 0x00000}, {0x03fff}, {0x0ffff} }
4680
+
4681
+#ifdef DEFINE_USER_REGS
4682
+#define        REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "USER_REGS", "ALL_REGS" }
4683
+#define        REG_CLASS_CONTENTS { { 0x00000},{0x03fff},{0x0ffff0000},{0x0ffffffff} }
4684
+#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 }
4685
+#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 }
4686
+#endif
4687
+
4688
+/* REGNO_REG_CLASS ... A C expression whose value is a register class
4689
+ * containing hard register REGNO.  In general there is more than one such
4690
+ * class;  Choose a class which is minimal, meaning that no smaller class also
4691
+ * contains the register.
4692
+ */
4693
+#undef REGNO_REG_CLASS
4694
+#define        REGNO_REG_CLASS(R)      (is_ZIP_REG(R)?((R<=13)?GENERAL_REGS:ALL_REGS):NO_REGS)
4695
+
4696
+/* BASE_REG_CLASS ... A macro whose definition is the name of the class to which
4697
+ * a valid base register must belong.  A base register is one used in an address
4698
+ * which is the register value plus a displacement.
4699
+ */
4700
+#undef BASE_REG_CLASS
4701
+#define        BASE_REG_CLASS  GENERAL_REGS
4702
+
4703
+/* MODE_BASE_CLASS(MODE) ... This is a variation of the BASE_REG_CLASS macro
4704
+ * which allows the selection of a bse register in a mode dependent manner.  If
4705
+ * mode is VOIDmode then it should return the same value as BASE_REG_CLASS.
4706
+ */
4707
+#undef MODE_BASE_CLASS
4708
+#define        MODE_BASE_CLASS(MODE)   GENERAL_REGS
4709
+
4710
+/* MODE_BASE_REG_REG_CLASS(MODE) ... A C expression whose value is the register
4711
+ * class to which a valid base register must belong in order to be used in a
4712
+ * base plus index register address.  You should define this macro if base plus
4713
+ * index addresses have different requirements than other base register uses.
4714
+ *
4715
+ * Zip CPU does not support the base plus index addressing mode, thus ...
4716
+ */
4717
+#undef MODE_BASE_REG_REG_CLASS
4718
+#define        MODE_BASE_REG_REG_CLASS(MODE)   NO_REGS
4719
+
4720
+/* INDEX_REG_CLASS ... A macro whose definition is the name of the class to
4721
+ * which a valid index register must belong.  An index register is one used in
4722
+ * an address where its value is either multiplied by a scale factor or added
4723
+ * to another register (as well as added to a displacement).
4724
+ *
4725
+ * ZipCPU -- Has no index registers.
4726
+ */
4727
+#undef INDEX_REG_CLASS
4728
+#define        INDEX_REG_CLASS NO_REGS
4729
+
4730
+/* REGNO_OK_FOR_BASE_P(NUM) ... A C expression which is nonzero if register
4731
+ * number num is suitable for use as a base register in operand addresses.
4732
+ */
4733
+#undef REGNO_OK_FOR_BASE_P
4734
+#ifdef DEFINE_USER_REGS
4735
+# define REGNO_