1 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/config.sub gcc-6.2.0-zip/config.sub
|
2 |
|
|
--- gcc-6.2.0/config.sub 2015-12-31 16:13:28.000000000 -0500
|
3 |
|
|
+++ gcc-6.2.0-zip/config.sub 2017-01-11 11:07:21.116065311 -0500
|
4 |
|
|
@@ -355,6 +355,14 @@
|
5 |
|
|
xscaleel)
|
6 |
|
|
basic_machine=armel-unknown
|
7 |
102 |
dgisselq |
;;
|
8 |
202 |
dgisselq |
+ zip-*-linux*)
|
9 |
|
|
+ basic_machine=zip
|
10 |
|
|
+ os=-linux
|
11 |
|
|
+ ;;
|
12 |
|
|
+ zip*)
|
13 |
|
|
+ basic_machine=zip-unknown
|
14 |
|
|
+ os=-none
|
15 |
|
|
+ ;;
|
16 |
102 |
dgisselq |
|
17 |
202 |
dgisselq |
# We use `pc' rather than `unknown'
|
18 |
|
|
# because (1) that's what they normally are, and
|
19 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/configure gcc-6.2.0-zip/configure
|
20 |
|
|
--- gcc-6.2.0/configure 2016-03-17 18:54:19.000000000 -0400
|
21 |
|
|
+++ gcc-6.2.0-zip/configure 2017-02-06 21:54:22.244807700 -0500
|
22 |
|
|
@@ -3548,6 +3548,44 @@
|
23 |
|
|
ft32-*-*)
|
24 |
|
|
noconfigdirs="$noconfigdirs ${libgcj}"
|
25 |
|
|
;;
|
26 |
|
|
+ zip*)
|
27 |
|
|
+ noconfigdirs="$noconfigdirs ${libgcj}"
|
28 |
|
|
+ noconfigdirs="$noconfigdirs target-boehm-gc"
|
29 |
|
|
+ noconfigdirs="$noconfigdirs target-libgfortran"
|
30 |
|
|
+ # noconfigdirs="$noconfigdirs target-libsanitizer"
|
31 |
|
|
+ # noconfigdirs="$noconfigdirs target-libada"
|
32 |
|
|
+ # noconfigdirs="$noconfigdirs target-libatomic"
|
33 |
|
|
+ # noconfigdirs="$noconfigdirs target-libcilkrts"
|
34 |
|
|
+ # noconfigdirs="$noconfigdirs target-libitm"
|
35 |
|
|
+ # noconfigdirs="$noconfigdirs target-libquadmath"
|
36 |
|
|
+ # noconfigdirs="$noconfigdirs target-libstdc++-v3"
|
37 |
|
|
+ # noconfigdirs="$noconfigdirs target-libssp"
|
38 |
|
|
+ # noconfigdirs="$noconfigdirs target-libgo"
|
39 |
|
|
+ # noconfigdirs="$noconfigdirs target-libgomp"
|
40 |
|
|
+ # noconfigdirs="$noconfigdirs target-libvtv"
|
41 |
|
|
+ # noconfigdirs="$noconfigdirs target-libobjc"
|
42 |
|
|
+ # target-libgcc
|
43 |
|
|
+ # target-liboffloadmic
|
44 |
|
|
+ # target-libmpx # Only gets enabled by request
|
45 |
|
|
+ # target-libbacktrace
|
46 |
|
|
+ # ${libgcj}
|
47 |
|
|
+ # target-boehm-gc
|
48 |
|
|
+ # target-libada
|
49 |
|
|
+ # target-libatomic
|
50 |
|
|
+ # target-libcilkrts
|
51 |
|
|
+ # target-libgfortran
|
52 |
|
|
+ # target-libgo
|
53 |
|
|
+ # target-libgomp
|
54 |
|
|
+ # target-libitm
|
55 |
|
|
+ # target-libobjc
|
56 |
|
|
+ # target-libquadmath
|
57 |
|
|
+ # target-libsanitizer
|
58 |
|
|
+ # target-libstdc++-v3
|
59 |
|
|
+ # target-libssp
|
60 |
|
|
+ # target-libvtv
|
61 |
|
|
+ # target-libgloss
|
62 |
|
|
+ # target-newlib
|
63 |
|
|
+ ;;
|
64 |
|
|
*-*-lynxos*)
|
65 |
|
|
noconfigdirs="$noconfigdirs ${libgcj}"
|
66 |
|
|
;;
|
67 |
|
|
@@ -3575,6 +3613,9 @@
|
68 |
|
|
*-*-aix*)
|
69 |
|
|
noconfigdirs="$noconfigdirs target-libgo"
|
70 |
|
|
;;
|
71 |
|
|
+ zip*)
|
72 |
|
|
+ noconfigdirs="$noconfigdirs target-libgo"
|
73 |
|
|
+ ;;
|
74 |
|
|
esac
|
75 |
|
|
fi
|
76 |
|
|
|
77 |
|
|
@@ -3971,6 +4012,9 @@
|
78 |
102 |
dgisselq |
vax-*-*)
|
79 |
|
|
noconfigdirs="$noconfigdirs target-newlib target-libgloss"
|
80 |
|
|
;;
|
81 |
|
|
+ zip*)
|
82 |
|
|
+ noconfigdirs="$noconfigdirs target-libffi target-boehm-gc gdb gprof"
|
83 |
202 |
dgisselq |
+ ;;
|
84 |
102 |
dgisselq |
esac
|
85 |
|
|
|
86 |
|
|
# If we aren't building newlib, then don't build libgloss, since libgloss
|
87 |
202 |
dgisselq |
@@ -6785,16 +6829,16 @@
|
88 |
|
|
# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
|
89 |
|
|
if test "x$CFLAGS_FOR_TARGET" = x; then
|
90 |
|
|
if test "x${is_cross_compiler}" = xyes; then
|
91 |
|
|
- CFLAGS_FOR_TARGET="-g -O2"
|
92 |
|
|
+ CFLAGS_FOR_TARGET="-O3"
|
93 |
|
|
else
|
94 |
|
|
CFLAGS_FOR_TARGET=$CFLAGS
|
95 |
|
|
case " $CFLAGS " in
|
96 |
|
|
- *" -O2 "*) ;;
|
97 |
|
|
- *) CFLAGS_FOR_TARGET="-O2 $CFLAGS_FOR_TARGET" ;;
|
98 |
|
|
+ *" -O3 "*) ;;
|
99 |
|
|
+ *) CFLAGS_FOR_TARGET="-O3 $CFLAGS_FOR_TARGET" ;;
|
100 |
|
|
esac
|
101 |
|
|
case " $CFLAGS " in
|
102 |
|
|
*" -g "* | *" -g3 "*) ;;
|
103 |
|
|
- *) CFLAGS_FOR_TARGET="-g $CFLAGS_FOR_TARGET" ;;
|
104 |
|
|
+ *) CFLAGS_FOR_TARGET="$CFLAGS_FOR_TARGET" ;;
|
105 |
|
|
esac
|
106 |
|
|
fi
|
107 |
|
|
fi
|
108 |
|
|
@@ -6802,16 +6846,16 @@
|
109 |
|
|
|
110 |
|
|
if test "x$CXXFLAGS_FOR_TARGET" = x; then
|
111 |
|
|
if test "x${is_cross_compiler}" = xyes; then
|
112 |
|
|
- CXXFLAGS_FOR_TARGET="-g -O2"
|
113 |
|
|
+ CXXFLAGS_FOR_TARGET="-O3"
|
114 |
|
|
else
|
115 |
|
|
CXXFLAGS_FOR_TARGET=$CXXFLAGS
|
116 |
|
|
case " $CXXFLAGS " in
|
117 |
|
|
- *" -O2 "*) ;;
|
118 |
|
|
- *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS_FOR_TARGET" ;;
|
119 |
|
|
+ *" -O3 "*) ;;
|
120 |
|
|
+ *) CXXFLAGS_FOR_TARGET="-O3 $CXXFLAGS_FOR_TARGET" ;;
|
121 |
|
|
esac
|
122 |
|
|
case " $CXXFLAGS " in
|
123 |
|
|
*" -g "* | *" -g3 "*) ;;
|
124 |
|
|
- *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS_FOR_TARGET" ;;
|
125 |
|
|
+ *) CXXFLAGS_FOR_TARGET="$CXXFLAGS_FOR_TARGET" ;;
|
126 |
|
|
esac
|
127 |
|
|
fi
|
128 |
|
|
fi
|
129 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/configure.ac gcc-6.2.0-zip/configure.ac
|
130 |
|
|
--- gcc-6.2.0/configure.ac 2016-03-17 18:54:19.000000000 -0400
|
131 |
|
|
+++ gcc-6.2.0-zip/configure.ac 2017-01-10 12:43:23.819301273 -0500
|
132 |
|
|
@@ -884,6 +884,9 @@
|
133 |
|
|
ft32-*-*)
|
134 |
|
|
noconfigdirs="$noconfigdirs ${libgcj}"
|
135 |
|
|
;;
|
136 |
|
|
+ zip*)
|
137 |
|
|
+ noconfigdirs="$noconfigdirs ${libgcj}"
|
138 |
|
|
+ ;;
|
139 |
|
|
*-*-lynxos*)
|
140 |
|
|
noconfigdirs="$noconfigdirs ${libgcj}"
|
141 |
|
|
;;
|
142 |
|
|
@@ -911,6 +914,9 @@
|
143 |
|
|
*-*-aix*)
|
144 |
|
|
noconfigdirs="$noconfigdirs target-libgo"
|
145 |
|
|
;;
|
146 |
|
|
+ zip*)
|
147 |
|
|
+ noconfigdirs="$noconfigdirs target-libgo"
|
148 |
|
|
+ ;;
|
149 |
|
|
esac
|
150 |
|
|
fi
|
151 |
|
|
|
152 |
|
|
@@ -1307,6 +1313,10 @@
|
153 |
102 |
dgisselq |
vax-*-*)
|
154 |
|
|
noconfigdirs="$noconfigdirs target-newlib target-libgloss"
|
155 |
|
|
;;
|
156 |
|
|
+ zip*)
|
157 |
202 |
dgisselq |
+ noconfigdirs="$noconfigdirs target-libffi target-boehm-gc gdb gprof ${libgcj}"
|
158 |
|
|
+ unsupported_languages="$unsupported_languages fortran"
|
159 |
102 |
dgisselq |
+ ;;
|
160 |
|
|
esac
|
161 |
|
|
|
162 |
|
|
# If we aren't building newlib, then don't build libgloss, since libgloss
|
163 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/cfgexpand.c gcc-6.2.0-zip/gcc/cfgexpand.c
|
164 |
|
|
--- gcc-6.2.0/gcc/cfgexpand.c 2016-04-27 08:23:50.000000000 -0400
|
165 |
|
|
+++ gcc-6.2.0-zip/gcc/cfgexpand.c 2016-12-31 16:38:36.195534819 -0500
|
166 |
|
|
@@ -74,6 +74,15 @@
|
167 |
117 |
dgisselq |
#include "tree-chkp.h"
|
168 |
|
|
#include "rtl-chkp.h"
|
169 |
|
|
|
170 |
202 |
dgisselq |
+
|
171 |
117 |
dgisselq |
+#ifdef DO_ZIP_DEBUGS
|
172 |
|
|
+#include <stdio.h>
|
173 |
202 |
dgisselq |
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s;%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX);} while(0)
|
174 |
117 |
dgisselq |
+extern void zip_debug_rtx(const_rtx);
|
175 |
|
|
+#else
|
176 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX)
|
177 |
|
|
+#endif
|
178 |
|
|
+
|
179 |
|
|
/* Some systems use __main in a way incompatible with its use in gcc, in these
|
180 |
|
|
cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
|
181 |
|
|
give the same symbol without quotes for an alternative entry point. You
|
182 |
202 |
dgisselq |
@@ -1172,7 +1181,7 @@
|
183 |
|
|
base_align = crtl->max_used_stack_slot_alignment;
|
184 |
|
|
else
|
185 |
|
|
base_align = MAX (crtl->max_used_stack_slot_alignment,
|
186 |
|
|
- GET_MODE_ALIGNMENT (SImode)
|
187 |
|
|
+ GET_MODE_ALIGNMENT (word_mode)
|
188 |
|
|
<< ASAN_SHADOW_SHIFT);
|
189 |
|
|
}
|
190 |
|
|
else
|
191 |
|
|
@@ -2225,7 +2234,7 @@
|
192 |
|
|
data.asan_vec.safe_push (offset);
|
193 |
|
|
/* Leave space for alignment if STRICT_ALIGNMENT. */
|
194 |
|
|
if (STRICT_ALIGNMENT)
|
195 |
|
|
- alloc_stack_frame_space ((GET_MODE_ALIGNMENT (SImode)
|
196 |
|
|
+ alloc_stack_frame_space ((GET_MODE_ALIGNMENT (word_mode)
|
197 |
|
|
<< ASAN_SHADOW_SHIFT)
|
198 |
|
|
/ BITS_PER_UNIT, 1);
|
199 |
111 |
dgisselq |
|
200 |
202 |
dgisselq |
@@ -5745,7 +5754,7 @@
|
201 |
|
|
&& (last = get_last_insn ())
|
202 |
|
|
&& JUMP_P (last))
|
203 |
|
|
{
|
204 |
|
|
- rtx dummy = gen_reg_rtx (SImode);
|
205 |
|
|
+ rtx dummy = gen_reg_rtx (word_mode);
|
206 |
|
|
emit_insn_after_noloc (gen_move_insn (dummy, dummy), last, NULL);
|
207 |
|
|
}
|
208 |
|
|
|
209 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/cgraphbuild.c gcc-6.2.0-zip/gcc/cgraphbuild.c
|
210 |
|
|
--- gcc-6.2.0/gcc/cgraphbuild.c 2016-01-04 09:30:50.000000000 -0500
|
211 |
|
|
+++ gcc-6.2.0-zip/gcc/cgraphbuild.c 2016-12-31 16:39:44.963107994 -0500
|
212 |
|
|
@@ -32,6 +32,15 @@
|
213 |
|
|
#include "ipa-utils.h"
|
214 |
|
|
#include "except.h"
|
215 |
|
|
|
216 |
|
|
+
|
217 |
111 |
dgisselq |
+#ifdef DO_ZIP_DEBUGS
|
218 |
202 |
dgisselq |
+#include <stdio.h>
|
219 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s;%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX);} while(0)
|
220 |
|
|
+extern void zip_debug_rtx(const_rtx);
|
221 |
111 |
dgisselq |
+#else
|
222 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX)
|
223 |
|
|
+#endif
|
224 |
|
|
+
|
225 |
|
|
/* Context of record_reference. */
|
226 |
|
|
struct record_reference_ctx
|
227 |
|
|
{
|
228 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/combine.c gcc-6.2.0-zip/gcc/combine.c
|
229 |
|
|
--- gcc-6.2.0/gcc/combine.c 2016-08-08 06:06:15.000000000 -0400
|
230 |
|
|
+++ gcc-6.2.0-zip/gcc/combine.c 2017-02-03 09:25:19.676720321 -0500
|
231 |
|
|
@@ -103,6 +103,15 @@
|
232 |
|
|
#include "rtl-iter.h"
|
233 |
|
|
#include "print-rtl.h"
|
234 |
|
|
|
235 |
|
|
+#define DO_ZIP_DEBUGS
|
236 |
|
|
+#ifdef DO_ZIP_DEBUGS
|
237 |
|
|
+#include <stdio.h>
|
238 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX);} while(0)
|
239 |
|
|
+extern void zip_debug_rtx(const_rtx);
|
240 |
|
|
+#else
|
241 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX)
|
242 |
|
|
+#endif
|
243 |
|
|
+
|
244 |
|
|
#ifndef LOAD_EXTEND_OP
|
245 |
|
|
#define LOAD_EXTEND_OP(M) UNKNOWN
|
246 |
|
|
#endif
|
247 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/common/config/zip/zip-common.c gcc-6.2.0-zip/gcc/common/config/zip/zip-common.c
|
248 |
|
|
--- gcc-6.2.0/gcc/common/config/zip/zip-common.c 1969-12-31 19:00:00.000000000 -0500
|
249 |
|
|
+++ gcc-6.2.0-zip/gcc/common/config/zip/zip-common.c 2017-01-11 09:41:34.483106099 -0500
|
250 |
102 |
dgisselq |
@@ -0,0 +1,52 @@
|
251 |
|
|
+////////////////////////////////////////////////////////////////////////////////
|
252 |
|
|
+//
|
253 |
|
|
+// Filename: common/config/zip/zip-common.c
|
254 |
|
|
+//
|
255 |
|
|
+// Project: Zip CPU backend for the GNU Compiler Collection
|
256 |
|
|
+//
|
257 |
|
|
+// Purpose: To eliminate the frame register automatically.
|
258 |
|
|
+//
|
259 |
|
|
+// Creator: Dan Gisselquist, Ph.D.
|
260 |
|
|
+// Gisselquist Technology, LLC
|
261 |
|
|
+//
|
262 |
|
|
+////////////////////////////////////////////////////////////////////////////////
|
263 |
|
|
+//
|
264 |
202 |
dgisselq |
+// Copyright (C) 2016-2017, Gisselquist Technology, LLC
|
265 |
102 |
dgisselq |
+//
|
266 |
|
|
+// This program is free software (firmware): you can redistribute it and/or
|
267 |
|
|
+// modify it under the terms of the GNU General Public License as published
|
268 |
|
|
+// by the Free Software Foundation, either version 3 of the License, or (at
|
269 |
|
|
+// your option) any later version.
|
270 |
|
|
+//
|
271 |
|
|
+// This program is distributed in the hope that it will be useful, but WITHOUT
|
272 |
|
|
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
273 |
|
|
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
274 |
|
|
+// for more details.
|
275 |
|
|
+//
|
276 |
|
|
+// You should have received a copy of the GNU General Public License along
|
277 |
|
|
+// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
278 |
|
|
+// target there if the PDF file isn't present.) If not, see
|
279 |
|
|
+// <http://www.gnu.org/licenses/> for a copy.
|
280 |
|
|
+//
|
281 |
|
|
+// License: GPL, v3, as defined and found on www.gnu.org,
|
282 |
|
|
+// http://www.gnu.org/licenses/gpl.html
|
283 |
|
|
+//
|
284 |
|
|
+//
|
285 |
|
|
+////////////////////////////////////////////////////////////////////////////////
|
286 |
|
|
+#include "config.h"
|
287 |
|
|
+#include "system.h"
|
288 |
|
|
+#include "coretypes.h"
|
289 |
|
|
+#include "tm.h"
|
290 |
|
|
+#include "common/common-target.h"
|
291 |
|
|
+#include "common/common-target-def.h"
|
292 |
|
|
+
|
293 |
|
|
+static const struct default_options zip_option_optimization_table[] =
|
294 |
|
|
+ {
|
295 |
|
|
+ { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 },
|
296 |
|
|
+ { OPT_LEVELS_NONE, 0, NULL, 0 }
|
297 |
|
|
+ };
|
298 |
|
|
+
|
299 |
|
|
+#undef TARGET_OPTION_OPTIMIZATION_TABLE
|
300 |
|
|
+#define TARGET_OPTION_OPTIMIZATION_TABLE zip_option_optimization_table
|
301 |
|
|
+
|
302 |
|
|
+struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;
|
303 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/config/zip/genzipops.c gcc-6.2.0-zip/gcc/config/zip/genzipops.c
|
304 |
|
|
--- gcc-6.2.0/gcc/config/zip/genzipops.c 1969-12-31 19:00:00.000000000 -0500
|
305 |
|
|
+++ gcc-6.2.0-zip/gcc/config/zip/genzipops.c 2017-03-07 12:03:59.062584503 -0500
|
306 |
|
|
@@ -0,0 +1,444 @@
|
307 |
102 |
dgisselq |
+////////////////////////////////////////////////////////////////////////////////
|
308 |
|
|
+//
|
309 |
202 |
dgisselq |
+// Filename: genzipops.c
|
310 |
102 |
dgisselq |
+//
|
311 |
202 |
dgisselq |
+// Project: Zip CPU -- a small, lightweight, RISC CPU soft core
|
312 |
102 |
dgisselq |
+//
|
313 |
202 |
dgisselq |
+// Purpose: This program generates the zip-ops.md machine description file.
|
314 |
102 |
dgisselq |
+//
|
315 |
202 |
dgisselq |
+// While I understand that this is not GCC's preferred method of generating
|
316 |
|
|
+// machine description files, there were just so many instructions to
|
317 |
|
|
+// generate, and so many forms of them, and the GCC infrastructure didn't
|
318 |
|
|
+// support the conditional execution model of the ZipCPU that ... I built
|
319 |
|
|
+// it this way.
|
320 |
|
|
+//
|
321 |
|
|
+// As of this writing, building zip-ops.md is not an automatic part of
|
322 |
|
|
+// making GCC. To build genzipops, just type:
|
323 |
|
|
+//
|
324 |
|
|
+// g++ genzipops.c -o genzipops
|
325 |
|
|
+//
|
326 |
|
|
+// And to run it, type:
|
327 |
|
|
+//
|
328 |
|
|
+// genzipops > zip-ops.md
|
329 |
|
|
+//
|
330 |
|
|
+// genzipops takes no arguments, and does nothing but write the machine
|
331 |
|
|
+// descriptions to the standard output.
|
332 |
|
|
+//
|
333 |
|
|
+//
|
334 |
102 |
dgisselq |
+// Creator: Dan Gisselquist, Ph.D.
|
335 |
|
|
+// Gisselquist Technology, LLC
|
336 |
|
|
+//
|
337 |
|
|
+////////////////////////////////////////////////////////////////////////////////
|
338 |
|
|
+//
|
339 |
202 |
dgisselq |
+// Copyright (C) 2017, Gisselquist Technology, LLC
|
340 |
102 |
dgisselq |
+//
|
341 |
|
|
+// This program is free software (firmware): you can redistribute it and/or
|
342 |
|
|
+// modify it under the terms of the GNU General Public License as published
|
343 |
|
|
+// by the Free Software Foundation, either version 3 of the License, or (at
|
344 |
|
|
+// your option) any later version.
|
345 |
|
|
+//
|
346 |
|
|
+// This program is distributed in the hope that it will be useful, but WITHOUT
|
347 |
|
|
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
348 |
|
|
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
349 |
|
|
+// for more details.
|
350 |
|
|
+//
|
351 |
|
|
+// You should have received a copy of the GNU General Public License along
|
352 |
202 |
dgisselq |
+// with this program. (It's in the $(ROOT)/doc directory. Run make with no
|
353 |
102 |
dgisselq |
+// target there if the PDF file isn't present.) If not, see
|
354 |
|
|
+// <http://www.gnu.org/licenses/> for a copy.
|
355 |
|
|
+//
|
356 |
|
|
+// License: GPL, v3, as defined and found on www.gnu.org,
|
357 |
|
|
+// http://www.gnu.org/licenses/gpl.html
|
358 |
|
|
+//
|
359 |
|
|
+//
|
360 |
|
|
+////////////////////////////////////////////////////////////////////////////////
|
361 |
202 |
dgisselq |
+//
|
362 |
|
|
+//
|
363 |
|
|
+#include <unistd.h>
|
364 |
|
|
+#include <stdlib.h>
|
365 |
|
|
+#include <stdio.h>
|
366 |
|
|
+#include <string.h>
|
367 |
102 |
dgisselq |
+
|
368 |
202 |
dgisselq |
+void legal(FILE *fp) {
|
369 |
|
|
+ fprintf(fp, ""
|
370 |
|
|
+";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"
|
371 |
|
|
+";;\n"
|
372 |
|
|
+";; Filename: zip-ops.md\n"
|
373 |
|
|
+";;\n"
|
374 |
|
|
+";; Project: Zip CPU -- a small, lightweight, RISC CPU soft core\n"
|
375 |
|
|
+";;\n"
|
376 |
|
|
+";; Purpose: This is a computer generated machine description of the\n"
|
377 |
|
|
+";; ZipCPU\'s operations. It is computer generated simply for\n"
|
378 |
|
|
+";; two reasons. First, I can\'t seem to find a way to generate this\n"
|
379 |
|
|
+";; information within GCC\'s current constructs. Specifically, the\n"
|
380 |
|
|
+";; CPU\'s instructions normally set the condition codes, unless they\n"
|
381 |
|
|
+";; are conditional instructions when they don\'t. Second, the ZipCPU is\n"
|
382 |
|
|
+";; actually quite regular. Almost all of the instructions have the same\n"
|
383 |
|
|
+";; form. This form turns into many, many RTL instructions. Because the\n"
|
384 |
|
|
+";; CPU doesn\'t match any of the others within GCC, that means either\n"
|
385 |
|
|
+";; I have a *lot* of cut, copy, paste, and edit to do to create the file\n"
|
386 |
|
|
+";; and upon any and every edit, or I need to build a program to generate\n"
|
387 |
|
|
+";; the remaining .md constructs. Hence, I chose the latter to minimize\n"
|
388 |
|
|
+";; the amount of work I needed to do.\n"
|
389 |
|
|
+";;\n"
|
390 |
|
|
+";;\n"
|
391 |
|
|
+";; Creator: Dan Gisselquist, Ph.D.\n"
|
392 |
|
|
+";; Gisselquist Technology, LLC\n"
|
393 |
|
|
+";;\n"
|
394 |
|
|
+";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"
|
395 |
|
|
+";;\n"
|
396 |
|
|
+";; Copyright (C) 2017, Gisselquist Technology, LLC\n"
|
397 |
|
|
+";;\n"
|
398 |
|
|
+";; This program is free software (firmware): you can redistribute it and/or\n"
|
399 |
|
|
+";; modify it under the terms of the GNU General Public License as published\n"
|
400 |
|
|
+";; by the Free Software Foundation, either version 3 of the License, or (at\n"
|
401 |
|
|
+";; your option) any later version.\n"
|
402 |
|
|
+";;\n"
|
403 |
|
|
+";; This program is distributed in the hope that it will be useful, but WITHOUT\n"
|
404 |
|
|
+";; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or\n"
|
405 |
|
|
+";; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n"
|
406 |
|
|
+";; for more details.\n"
|
407 |
|
|
+";;\n"
|
408 |
|
|
+";; License: GPL, v3, as defined and found on www.gnu.org,\n"
|
409 |
|
|
+";; http://www.gnu.org/licenses/gpl.html\n"
|
410 |
|
|
+";;\n"
|
411 |
|
|
+";;\n"
|
412 |
|
|
+";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"
|
413 |
|
|
+";;\n"
|
414 |
|
|
+";;\n");
|
415 |
|
|
+}
|
416 |
102 |
dgisselq |
+
|
417 |
202 |
dgisselq |
+void gen_heading(FILE *fp, const char *heading) {
|
418 |
|
|
+ fprintf(fp, ";\n;\n; %s\n;\n;\n", heading);
|
419 |
|
|
+}
|
420 |
102 |
dgisselq |
+
|
421 |
202 |
dgisselq |
+void genzip_condop(FILE *fp, const char *md_opname,
|
422 |
|
|
+ const char *rtxstr, const char *insn_cond,
|
423 |
|
|
+ const char *zip_op,
|
424 |
|
|
+ const char *rtx_cond, const char *zip_cond) {
|
425 |
102 |
dgisselq |
+
|
426 |
202 |
dgisselq |
+ fprintf(fp, "(define_insn \"%s_%s\"\n"
|
427 |
|
|
+ "\t[(cond_exec (%s (reg:CC CC_REG) (const_int 0))\n"
|
428 |
|
|
+ "\t\t\t%s)]\n"
|
429 |
|
|
+ "\t\"%s\"\t; Condition\n"
|
430 |
|
|
+ "\t\"%s.%s\\t%%1,%%0\t; genzip, conditional operator\"\t; Template\n"
|
431 |
|
|
+ "\t[(set_attr \"predicable\" \"no\") "
|
432 |
|
|
+ "(set_attr \"ccresult\" \"unchanged\")])\n;\n;\n",
|
433 |
|
|
+ md_opname, rtx_cond, rtx_cond, rtxstr, insn_cond, zip_op, zip_cond);
|
434 |
102 |
dgisselq |
+
|
435 |
202 |
dgisselq |
+}
|
436 |
102 |
dgisselq |
+
|
437 |
202 |
dgisselq |
+void genzipop_long(FILE *fp, const char *md_opname, const char *uncond_rtx, const char *insn_cond, const char *split_rtx, const char *dup_rtx, const char *zip_op) {
|
438 |
|
|
+ char heading[128];
|
439 |
|
|
+ sprintf(heading, "%s (genzipop_long)", zip_op);
|
440 |
|
|
+ fprintf(fp, ";\n;\n;\n; %s (genzipop_long)\n;\n;\n;\n", zip_op);
|
441 |
102 |
dgisselq |
+
|
442 |
202 |
dgisselq |
+ fprintf(fp, "(define_insn \"%s\"\n"
|
443 |
|
|
+"\t[%s\n"
|
444 |
|
|
+"\t(clobber (reg:CC CC_REG))]\n"
|
445 |
|
|
+"\t\"%s\"\n"
|
446 |
|
|
+"\t\"%s\\t%%2,%%0\t; %s\"\n"
|
447 |
|
|
+"\t[(set_attr \"predicable\" \"no\") (set_attr \"ccresult\" \"set\")])\n;\n;\n",
|
448 |
|
|
+ md_opname, uncond_rtx, insn_cond, zip_op, md_opname);
|
449 |
102 |
dgisselq |
+
|
450 |
|
|
+
|
451 |
202 |
dgisselq |
+ fprintf(fp, "(define_insn \"%s_raw\"\n"
|
452 |
|
|
+"\t[%s\n"
|
453 |
|
|
+"\t(set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]\n"
|
454 |
|
|
+"\t\"%s\"\n"
|
455 |
|
|
+"\t\"%s\\t%%1,%%0\t; %s_raw\"\n"
|
456 |
|
|
+"\t[(set_attr \"predicable\" \"no\") (set_attr \"ccresult\" \"set\")])\n;\n;\n",
|
457 |
|
|
+ md_opname, dup_rtx, insn_cond, zip_op, md_opname);
|
458 |
102 |
dgisselq |
+
|
459 |
202 |
dgisselq |
+ genzip_condop(fp, md_opname, dup_rtx, insn_cond, zip_op, "eq", "Z");
|
460 |
|
|
+ genzip_condop(fp, md_opname, dup_rtx, insn_cond, zip_op, "ne", "NZ");
|
461 |
|
|
+ genzip_condop(fp, md_opname, dup_rtx, insn_cond, zip_op, "lt", "LT");
|
462 |
|
|
+ genzip_condop(fp, md_opname, dup_rtx, insn_cond, zip_op, "ge", "GE");
|
463 |
|
|
+ genzip_condop(fp, md_opname, dup_rtx, insn_cond, zip_op, "ltu", "C");
|
464 |
|
|
+ genzip_condop(fp, md_opname, dup_rtx, insn_cond, zip_op, "geu", "NC");
|
465 |
|
|
+}
|
466 |
102 |
dgisselq |
+
|
467 |
202 |
dgisselq |
+void genzipop(FILE *fp, const char *md_opname, const char *rtx_name, const char *insn_cond, const char *zip_op) {
|
468 |
|
|
+ char rtxstr[512], splitstr[512], dupstr[512], altname[64];
|
469 |
102 |
dgisselq |
+
|
470 |
202 |
dgisselq |
+ sprintf(rtxstr,
|
471 |
|
|
+"(set (match_operand:SI 0 \"register_operand\" \"=r\")\n"
|
472 |
|
|
+"\t\t(%s (match_operand:SI 1 \"register_operand\" \"0\")\n"
|
473 |
|
|
+"\t\t\t(match_operand:SI 2 \"zip_opb_single_operand_p\" \"rO\")))", rtx_name);
|
474 |
|
|
+ sprintf(splitstr,
|
475 |
|
|
+ "(set (match_dup 0) (%s (match_dup 0) (match_dup 2)))", rtx_name);
|
476 |
102 |
dgisselq |
+
|
477 |
202 |
dgisselq |
+ sprintf(dupstr,
|
478 |
|
|
+"(set (match_operand:SI 0 \"register_operand\" \"=r\")\n"
|
479 |
|
|
+"\t\t(%s (match_dup 0)\n"
|
480 |
|
|
+"\t\t\t(match_operand:SI 1 \"zip_opb_single_operand_p\" \"rO\")))", rtx_name);
|
481 |
102 |
dgisselq |
+
|
482 |
202 |
dgisselq |
+ genzipop_long(fp, md_opname, rtxstr, insn_cond, splitstr, dupstr, zip_op);
|
483 |
171 |
dgisselq |
+
|
484 |
202 |
dgisselq |
+ sprintf(rtxstr,
|
485 |
|
|
+"(set (match_operand:SI 0 \"register_operand\" \"=r\")\n"
|
486 |
|
|
+"\t\t(%s (match_operand:SI 1 \"register_operand\" \"0\")\n"
|
487 |
|
|
+"\t\t\t(plus:SI (match_operand:SI 2 \"register_operand\" \"r\")\n"
|
488 |
|
|
+"\t\t\t\t(match_operand:SI 3 \"const_int_operand\" \"N\"))))", rtx_name);
|
489 |
|
|
+ sprintf(splitstr,
|
490 |
|
|
+ "(set (match_dup 0) (%s (match_dup 0)\n"
|
491 |
|
|
+"\t\t\t(plus:SI (match_dup 2) (match_dup 3))))", rtx_name);
|
492 |
171 |
dgisselq |
+
|
493 |
202 |
dgisselq |
+ sprintf(dupstr,
|
494 |
|
|
+"(set (match_operand:SI 0 \"register_operand\" \"=r\")\n"
|
495 |
|
|
+"\t\t(%s (match_dup 0)\n"
|
496 |
|
|
+"\t\t\t(plus:SI (match_operand:SI 1 \"register_operand\" \"r\")\n"
|
497 |
|
|
+"\t\t\t\t(match_operand:SI 2 \"const_int_operand\" \"N\"))))", rtx_name);
|
498 |
102 |
dgisselq |
+
|
499 |
202 |
dgisselq |
+ sprintf(altname, "%s_off", md_opname);
|
500 |
102 |
dgisselq |
+
|
501 |
202 |
dgisselq |
+ genzipop_long(fp, altname, rtxstr, insn_cond, splitstr, dupstr, zip_op);
|
502 |
|
|
+}
|
503 |
102 |
dgisselq |
+
|
504 |
202 |
dgisselq |
+void gencmov(FILE *fp, const char *md_opname, const char *md_cond, const char *zip_cond) {
|
505 |
|
|
+ fprintf(fp, ";\n;\n"
|
506 |
|
|
+"(define_insn \"%s_%s\"\n"
|
507 |
|
|
+ "\t[(set (match_operand:SI 0 \"register_operand\" \"=r,r,r,Q\")\n"
|
508 |
|
|
+ "\t\t(if_then_else:SI (%s (reg:CC CC_REG) (const_int 0))\n"
|
509 |
|
|
+ "\t\t\t(match_operand:SI 1 \"general_operand\" \"r,Q,i,r\")\n"
|
510 |
|
|
+ "\t\t\t(match_dup 0)))]\n"
|
511 |
|
|
+ "\t\"\"\n"
|
512 |
|
|
+ "\t\"@\n"
|
513 |
|
|
+ "\tMOV.%s\t%%1,%%0\t; cmov\n"
|
514 |
|
|
+ "\tLW.%s\t%%1,%%0\t; cmov\n"
|
515 |
|
|
+ "\tLDI.%s\t%%1,%%0\t; cmov\n"
|
516 |
|
|
+ "\tSW.%s\t%%1,%%0\t; cmov\"\n"
|
517 |
|
|
+ "\t[(set_attr \"predicable\" \"no\") (set_attr \"ccresult\" \"unchanged\")])\n",
|
518 |
|
|
+ md_opname, md_cond, md_cond, zip_cond, zip_cond, zip_cond, zip_cond);
|
519 |
102 |
dgisselq |
+
|
520 |
202 |
dgisselq |
+}
|
521 |
|
|
+
|
522 |
|
|
+void gencadd(FILE *fp, const char *md_opname, const char *md_cond, const char *zip_cond) {
|
523 |
|
|
+ fprintf(fp, ";\n;\n"
|
524 |
|
|
+"(define_insn \"%s_%s\"\n"
|
525 |
|
|
+ "\t[(set (match_operand:SI 0 \"register_operand\" \"=r\")\n"
|
526 |
|
|
+ "\t\t(if_then_else:SI (%s (reg:CC CC_REG) (const_int 0))\n"
|
527 |
|
|
+ "\t\t\t(plus:SI (match_dup 0)\n"
|
528 |
|
|
+ "\t\t\t\t(match_operand:SI 1 \"zip_opb_single_operand_p\" \"rO\"))\n"
|
529 |
|
|
+ "\t\t\t(match_dup 0)))]\n"
|
530 |
|
|
+ "\t\"\"\n"
|
531 |
|
|
+ "\t\"ADD.%s\t%%1,%%0\t; cadd\"\n"
|
532 |
|
|
+ "\t[(set_attr \"predicable\" \"no\") (set_attr \"ccresult\" \"unchanged\")])\n",
|
533 |
|
|
+ md_opname, md_cond, md_cond, zip_cond);
|
534 |
|
|
+}
|
535 |
|
|
+
|
536 |
|
|
+void gencnot(FILE *fp, const char *md_opname, const char *md_cond, const char *zip_cond) {
|
537 |
|
|
+ fprintf(fp, ";\n;\n"
|
538 |
|
|
+"(define_insn \"%s_%s\"\n"
|
539 |
|
|
+ "\t[(set (match_operand:SI 0 \"register_operand\" \"=r\")\n"
|
540 |
|
|
+ "\t\t(if_then_else:SI (%s (reg:CC CC_REG) (const_int 0))\n"
|
541 |
|
|
+ "\t\t\t(xor:SI (match_dup 0)\n"
|
542 |
|
|
+ "\t\t\t\t(const_int -1))\n"
|
543 |
|
|
+ "\t\t\t(match_dup 0)))]\n"
|
544 |
|
|
+ "\t\"\"\n"
|
545 |
|
|
+ "\t\"NOT.%s\t%%0\t; cnot\"\n"
|
546 |
|
|
+ "\t[(set_attr \"predicable\" \"no\") (set_attr \"ccresult\" \"unchanged\")])\n",
|
547 |
|
|
+ md_opname, md_cond, md_cond, zip_cond);
|
548 |
|
|
+}
|
549 |
|
|
+
|
550 |
|
|
+void gencneg(FILE *fp, const char *md_opname, const char *md_cond, const char *zip_cond) {
|
551 |
|
|
+ fprintf(fp, ";\n;\n"
|
552 |
|
|
+"(define_insn \"%s_%s\"\n"
|
553 |
|
|
+ "\t[(set (match_operand:SI 0 \"register_operand\" \"+r\")\n"
|
554 |
|
|
+ "\t\t(if_then_else:SI (%s (reg:CC CC_REG) (const_int 0))\n"
|
555 |
|
|
+ "\t\t\t(neg:SI (match_dup 0))\n"
|
556 |
|
|
+ "\t\t\t(match_dup 0)))]\n"
|
557 |
|
|
+ "\t\"\"\n"
|
558 |
|
|
+ "\t\"NEG.%s\t%%0\t; cneg\"\n"
|
559 |
|
|
+ "\t[(set_attr \"predicable\" \"no\") (set_attr \"ccresult\" \"unchanged\")])\n",
|
560 |
|
|
+ md_opname, md_cond, md_cond, zip_cond);
|
561 |
|
|
+}
|
562 |
|
|
+
|
563 |
|
|
+
|
564 |
|
|
+void gencand(FILE *fp, const char *md_opname, const char *md_cond, const char *zip_cond) {
|
565 |
|
|
+ fprintf(fp, ";\n;\n"
|
566 |
|
|
+"(define_insn \"%s_%s\"\n"
|
567 |
|
|
+ "\t[(set (match_operand:SI 0 \"register_operand\" \"+r\")\n"
|
568 |
|
|
+ "\t\t(if_then_else:SI (%s (reg:CC CC_REG) (const_int 0))\n"
|
569 |
|
|
+ "\t\t\t(and:SI (match_dup 0) (match_operand:SI 1 \"zip_opb_single_operand_p\" \"rO\"))\n"
|
570 |
|
|
+ "\t\t\t(match_dup 0)))]\n"
|
571 |
|
|
+ "\t\"\"\n"
|
572 |
|
|
+ "\t\"AND.%s\t%%1,%%0\t; cand\"\n"
|
573 |
|
|
+ "\t[(set_attr \"predicable\" \"no\") (set_attr \"ccresult\" \"unchanged\")])\n",
|
574 |
|
|
+ md_opname, md_cond, md_cond, zip_cond);
|
575 |
|
|
+}
|
576 |
|
|
+
|
577 |
|
|
+
|
578 |
|
|
+void gencior(FILE *fp, const char *md_opname, const char *md_cond, const char *zip_cond) {
|
579 |
|
|
+ fprintf(fp, ";\n;\n"
|
580 |
|
|
+"(define_insn \"%s_%s\"\n"
|
581 |
|
|
+ "\t[(set (match_operand:SI 0 \"register_operand\" \"+r\")\n"
|
582 |
|
|
+ "\t\t(if_then_else:SI (%s (reg:CC CC_REG) (const_int 0))\n"
|
583 |
|
|
+ "\t\t\t(ior:SI (match_dup 0) (match_operand:SI 1 \"zip_opb_single_operand_p\" \"rO\"))\n"
|
584 |
|
|
+ "\t\t\t(match_dup 0)))]\n"
|
585 |
|
|
+ "\t\"\"\n"
|
586 |
|
|
+ "\t\"OR.%s\t%%1,%%0\t; cior\"\n"
|
587 |
|
|
+ "\t[(set_attr \"predicable\" \"no\") (set_attr \"ccresult\" \"unchanged\")])\n",
|
588 |
|
|
+ md_opname, md_cond, md_cond, zip_cond);
|
589 |
|
|
+}
|
590 |
|
|
+
|
591 |
|
|
+void gencxor(FILE *fp, const char *md_opname, const char *md_cond, const char *zip_cond) {
|
592 |
|
|
+ fprintf(fp, ";\n;\n"
|
593 |
|
|
+"(define_insn \"%s_%s\"\n"
|
594 |
|
|
+ "\t[(set (match_operand:SI 0 \"register_operand\" \"+r\")\n"
|
595 |
|
|
+ "\t\t(if_then_else:SI (%s (reg:CC CC_REG) (const_int 0))\n"
|
596 |
|
|
+ "\t\t\t(xor:SI (match_dup 0) (match_operand:SI 1 \"zip_opb_single_operand_p\" \"rO\"))\n"
|
597 |
|
|
+ "\t\t\t(match_dup 0)))]\n"
|
598 |
|
|
+ "\t\"\"\n"
|
599 |
|
|
+ "\t\"XOR.%s\t%%1,%%0\t; cxor\"\n"
|
600 |
|
|
+ "\t[(set_attr \"predicable\" \"no\") (set_attr \"ccresult\" \"unchanged\")])\n",
|
601 |
|
|
+ md_opname, md_cond, md_cond, zip_cond);
|
602 |
|
|
+}
|
603 |
|
|
+
|
604 |
|
|
+void usage(void) {
|
605 |
|
|
+ printf("USAGE: genzipops <new-zip-ops.md filename>\n");
|
606 |
|
|
+}
|
607 |
|
|
+
|
608 |
|
|
+const char *TMPPATH = ".zip-ops.md";
|
609 |
|
|
+const char *TAILPATH = "zip-ops.md";
|
610 |
|
|
+
|
611 |
|
|
+int main(int argc, char **argv) {
|
612 |
|
|
+ FILE *fp = fopen(TMPPATH, "w");
|
613 |
|
|
+ const char *newname = TAILPATH;
|
614 |
|
|
+
|
615 |
|
|
+ if ((argc>1)&&(argv[1][0] == '-')) {
|
616 |
|
|
+ usage();
|
617 |
|
|
+ exit(EXIT_FAILURE);
|
618 |
|
|
+ }
|
619 |
|
|
+
|
620 |
|
|
+ if (argc>1) {
|
621 |
|
|
+ if ((strlen(argv[1])>=strlen(TAILPATH))
|
622 |
|
|
+ &&(strcmp(&argv[1][strlen(argv[1])-strlen(TAILPATH)],
|
623 |
|
|
+ TAILPATH)==0)
|
624 |
|
|
+ &&(access(argv[1], F_OK)==0))
|
625 |
|
|
+ unlink(argv[1]);
|
626 |
|
|
+ newname = argv[1];
|
627 |
|
|
+ }
|
628 |
|
|
+
|
629 |
|
|
+ legal(fp);
|
630 |
|
|
+ genzipop(fp, "addsi3", "plus:SI", "", "ADD");
|
631 |
|
|
+ genzipop(fp, "subsi3", "minus:SI", "", "SUB");
|
632 |
|
|
+ genzipop(fp, "mulsi3", "mult:SI", "", "MPY");
|
633 |
|
|
+ genzipop(fp, "divsi3", "div:SI", "(ZIP_DIVIDE)", "DIVS");
|
634 |
|
|
+ genzipop(fp, "udivsi3", "udiv:SI", "(ZIP_DIVIDE)", "DIVU");
|
635 |
|
|
+ genzipop(fp, "andsi3", "and:SI", "", "AND");
|
636 |
|
|
+ genzipop(fp, "iorsi3", "ior:SI", "", "OR");
|
637 |
|
|
+ genzipop(fp, "xorsi3", "xor:SI", "", "XOR");
|
638 |
|
|
+ genzipop(fp, "ashrsi3", "ashiftrt:SI","", "ASR");
|
639 |
|
|
+ genzipop(fp, "ashlsi3", "ashift:SI", "", "LSL");
|
640 |
|
|
+ genzipop(fp, "lshrsi3", "lshiftrt:SI","", "LSR");
|
641 |
|
|
+
|
642 |
|
|
+ genzipop_long(fp, "smulsi_highpart",
|
643 |
|
|
+ "(set (match_operand:SI 0 \"register_operand\" \"=r\")\n"
|
644 |
|
|
+ "\t\t(truncate:SI (ashiftrt:DI (mult:DI\n"
|
645 |
|
|
+ "\t\t\t(sign_extend:DI (match_operand:SI 1 \"register_operand\" \"0\"))\n"
|
646 |
|
|
+ "\t\t\t(sign_extend:DI (match_operand:SI 2 \"zip_opb_operand_p\" \"rO\")))\n"
|
647 |
|
|
+ "\t\t\t(const_int 32))))",
|
648 |
|
|
+ "(ZIP_HAS_DI)",
|
649 |
|
|
+ "(set (match_dup 0)\n"
|
650 |
|
|
+ "\t\t(truncate:SI (ashiftrt:DI (mult:DI\n"
|
651 |
|
|
+ "\t\t\t(sign_extend:DI (match_dup 1))\n"
|
652 |
|
|
+ "\t\t\t(sign_extend:DI (match_dup 2)))\n"
|
653 |
|
|
+ "\t\t\t(const_int 32))))",
|
654 |
|
|
+ //
|
655 |
|
|
+ "(set (match_operand:SI 0 \"register_operand\" \"=r\")\n"
|
656 |
|
|
+ "\t\t(truncate:SI (ashiftrt:DI (mult:DI\n"
|
657 |
|
|
+ "\t\t\t(sign_extend:DI (match_dup 0))\n"
|
658 |
|
|
+ "\t\t\t(sign_extend:DI (match_operand:SI 1 \"zip_opb_operand_p\" \"rO\")))\n"
|
659 |
|
|
+ "\t\t\t(const_int 32))))",
|
660 |
|
|
+ "MPYSHI");
|
661 |
|
|
+ genzipop_long(fp, "umulsi_highpart",
|
662 |
|
|
+ "(set (match_operand:SI 0 \"register_operand\" \"=r\")\n"
|
663 |
|
|
+ "\t\t(truncate:SI (ashiftrt:DI (mult:DI\n"
|
664 |
|
|
+ "\t\t\t(zero_extend:DI (match_operand:SI 1 \"register_operand\" \"0\"))\n"
|
665 |
|
|
+ "\t\t\t(zero_extend:DI (match_operand:SI 2 \"zip_opb_operand_p\" \"rO\")))\n"
|
666 |
|
|
+ "\t\t\t(const_int 32))))",
|
667 |
|
|
+ "(ZIP_HAS_DI)",
|
668 |
|
|
+ "(set (match_dup 0)\n"
|
669 |
|
|
+ "\t\t(truncate:SI (ashiftrt:DI (mult:DI\n"
|
670 |
|
|
+ "\t\t\t(zero_extend:DI (match_dup 1))\n"
|
671 |
|
|
+ "\t\t\t(zero_extend:DI (match_dup 2)))\n"
|
672 |
|
|
+ "\t\t\t(const_int 32))))",
|
673 |
|
|
+ //
|
674 |
|
|
+ "(set (match_operand:SI 0 \"register_operand\" \"=r\")\n"
|
675 |
|
|
+ "\t\t(truncate:SI (ashiftrt:DI (mult:DI\n"
|
676 |
|
|
+ "\t\t\t(zero_extend:DI (match_dup 0))\n"
|
677 |
|
|
+ "\t\t\t(zero_extend:DI (match_operand:SI 1 \"zip_opb_operand_p\" \"rO\")))\n"
|
678 |
|
|
+ "\t\t\t(const_int 32))))",
|
679 |
|
|
+ "MPYUHI");
|
680 |
|
|
+
|
681 |
|
|
+ gen_heading(fp, "Conditional move instructions");
|
682 |
|
|
+
|
683 |
|
|
+ gencmov(fp, "cmov", "eq", "Z");
|
684 |
|
|
+ gencmov(fp, "cmov", "ne", "NZ");
|
685 |
|
|
+ gencmov(fp, "cmov", "lt", "LT");
|
686 |
|
|
+ gencmov(fp, "cmov", "ge", "GE");
|
687 |
|
|
+ gencmov(fp, "cmov", "ltu", "C");
|
688 |
|
|
+ gencmov(fp, "cmov", "geu", "NC");
|
689 |
|
|
+
|
690 |
|
|
+ gen_heading(fp, "Conditional add instructions");
|
691 |
|
|
+
|
692 |
|
|
+ gencadd(fp, "cadd", "eq", "Z");
|
693 |
|
|
+ gencadd(fp, "cadd", "ne", "NZ");
|
694 |
|
|
+ gencadd(fp, "cadd", "lt", "LT");
|
695 |
|
|
+ gencadd(fp, "cadd", "ge", "GE");
|
696 |
|
|
+ gencadd(fp, "cadd", "ltu", "C");
|
697 |
|
|
+ gencadd(fp, "cadd", "geu", "NC");
|
698 |
|
|
+
|
699 |
|
|
+ gen_heading(fp, "Conditional negate instructions");
|
700 |
|
|
+
|
701 |
|
|
+ gencneg(fp, "cneg", "eq", "Z");
|
702 |
|
|
+ gencneg(fp, "cneg", "ne", "NZ");
|
703 |
|
|
+ gencneg(fp, "cneg", "lt", "LT");
|
704 |
|
|
+ gencneg(fp, "cneg", "ge", "GE");
|
705 |
|
|
+ gencneg(fp, "cneg", "ltu", "C");
|
706 |
|
|
+ gencneg(fp, "cneg", "geu", "NC");
|
707 |
|
|
+
|
708 |
|
|
+ gen_heading(fp, "Conditional not instructions");
|
709 |
|
|
+
|
710 |
|
|
+ gencnot(fp, "cnot", "eq", "Z");
|
711 |
|
|
+ gencnot(fp, "cnot", "ne", "NZ");
|
712 |
|
|
+ gencnot(fp, "cnot", "lt", "LT");
|
713 |
|
|
+ gencnot(fp, "cnot", "ge", "GE");
|
714 |
|
|
+ gencnot(fp, "cnot", "ltu", "C");
|
715 |
|
|
+ gencnot(fp, "cnot", "geu", "NC");
|
716 |
|
|
+
|
717 |
|
|
+ gen_heading(fp, "Conditional and instructions");
|
718 |
|
|
+
|
719 |
|
|
+ gencand(fp, "cand", "eq", "Z");
|
720 |
|
|
+ gencand(fp, "cand", "ne", "NZ");
|
721 |
|
|
+ gencand(fp, "cand", "lt", "LT");
|
722 |
|
|
+ gencand(fp, "cand", "ge", "GE");
|
723 |
|
|
+ gencand(fp, "cand", "ltu", "C");
|
724 |
|
|
+ gencand(fp, "cand", "geu", "NC");
|
725 |
|
|
+
|
726 |
|
|
+ gen_heading(fp, "Conditional ior instructions");
|
727 |
|
|
+
|
728 |
|
|
+ gencior(fp, "cior", "eq", "Z");
|
729 |
|
|
+ gencior(fp, "cior", "ne", "NZ");
|
730 |
|
|
+ gencior(fp, "cior", "lt", "LT");
|
731 |
|
|
+ gencior(fp, "cior", "ge", "GE");
|
732 |
|
|
+ gencior(fp, "cior", "ltu", "C");
|
733 |
|
|
+ gencior(fp, "cior", "geu", "NC");
|
734 |
|
|
+
|
735 |
|
|
+ gen_heading(fp, "Conditional xor instructions");
|
736 |
|
|
+
|
737 |
|
|
+ gencxor(fp, "cxor", "eq", "Z");
|
738 |
|
|
+ gencxor(fp, "cxor", "ne", "NZ");
|
739 |
|
|
+ gencxor(fp, "cxor", "lt", "LT");
|
740 |
|
|
+ gencxor(fp, "cxor", "ge", "GE");
|
741 |
|
|
+ gencxor(fp, "cxor", "ltu", "C");
|
742 |
|
|
+ gencxor(fp, "cxor", "geu", "NC");
|
743 |
|
|
+
|
744 |
|
|
+ fclose(fp);
|
745 |
|
|
+
|
746 |
|
|
+ if (rename(TMPPATH, newname) != 0) {
|
747 |
|
|
+ fprintf(stderr, "ERR: Could not create %s, leaving results in %s\n", newname, TMPPATH);
|
748 |
|
|
+ exit(EXIT_FAILURE);
|
749 |
|
|
+ } exit(EXIT_SUCCESS);
|
750 |
|
|
+}
|
751 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/config/zip/zip.c gcc-6.2.0-zip/gcc/config/zip/zip.c
|
752 |
|
|
--- gcc-6.2.0/gcc/config/zip/zip.c 1969-12-31 19:00:00.000000000 -0500
|
753 |
|
|
+++ gcc-6.2.0-zip/gcc/config/zip/zip.c 2017-03-07 12:03:18.566583672 -0500
|
754 |
|
|
@@ -0,0 +1,2679 @@
|
755 |
102 |
dgisselq |
+////////////////////////////////////////////////////////////////////////////////
|
756 |
|
|
+//
|
757 |
|
|
+// Filename: zip.c
|
758 |
|
|
+//
|
759 |
|
|
+// Project: Zip CPU backend for the GNU Compiler Collection
|
760 |
|
|
+//
|
761 |
|
|
+// Purpose:
|
762 |
|
|
+//
|
763 |
|
|
+// Creator: Dan Gisselquist, Ph.D.
|
764 |
|
|
+// Gisselquist Technology, LLC
|
765 |
|
|
+//
|
766 |
|
|
+////////////////////////////////////////////////////////////////////////////////
|
767 |
|
|
+//
|
768 |
202 |
dgisselq |
+// Copyright (C) 2016-2017, Gisselquist Technology, LLC
|
769 |
102 |
dgisselq |
+//
|
770 |
|
|
+// This program is free software (firmware): you can redistribute it and/or
|
771 |
|
|
+// modify it under the terms of the GNU General Public License as published
|
772 |
|
|
+// by the Free Software Foundation, either version 3 of the License, or (at
|
773 |
|
|
+// your option) any later version.
|
774 |
|
|
+//
|
775 |
|
|
+// This program is distributed in the hope that it will be useful, but WITHOUT
|
776 |
|
|
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
777 |
|
|
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
778 |
|
|
+// for more details.
|
779 |
|
|
+//
|
780 |
|
|
+// You should have received a copy of the GNU General Public License along
|
781 |
|
|
+// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
782 |
|
|
+// target there if the PDF file isn't present.) If not, see
|
783 |
|
|
+// <http://www.gnu.org/licenses/> for a copy.
|
784 |
|
|
+//
|
785 |
|
|
+// License: GPL, v3, as defined and found on www.gnu.org,
|
786 |
|
|
+// http://www.gnu.org/licenses/gpl.html
|
787 |
|
|
+//
|
788 |
|
|
+//
|
789 |
|
|
+////////////////////////////////////////////////////////////////////////////////
|
790 |
|
|
+#include "config.h"
|
791 |
|
|
+#include "system.h"
|
792 |
|
|
+#include "coretypes.h"
|
793 |
|
|
+#include "tm.h"
|
794 |
|
|
+#include "rtl.h"
|
795 |
|
|
+#include "dominance.h"
|
796 |
|
|
+#include "cfg.h"
|
797 |
|
|
+#include "cfgrtl.h"
|
798 |
|
|
+#include "cfganal.h"
|
799 |
|
|
+#include "lcm.h"
|
800 |
|
|
+#include "cfgbuild.h"
|
801 |
|
|
+#include "cfgcleanup.h"
|
802 |
|
|
+#include "predict.h"
|
803 |
|
|
+#include "basic-block.h"
|
804 |
202 |
dgisselq |
+#include "bitmap.h"
|
805 |
102 |
dgisselq |
+#include "df.h"
|
806 |
|
|
+#include "hashtab.h"
|
807 |
|
|
+#include "hash-set.h"
|
808 |
|
|
+#include "machmode.h"
|
809 |
|
|
+#include "symtab.h"
|
810 |
|
|
+#include "rtlhash.h"
|
811 |
|
|
+#include "tree.h"
|
812 |
|
|
+#include "regs.h"
|
813 |
|
|
+#include "hard-reg-set.h"
|
814 |
|
|
+#include "real.h"
|
815 |
|
|
+#include "insn-config.h"
|
816 |
|
|
+#include "conditions.h"
|
817 |
|
|
+#include "output.h"
|
818 |
|
|
+#include "insn-attr.h"
|
819 |
|
|
+#include "flags.h"
|
820 |
|
|
+#include "expr.h"
|
821 |
|
|
+#include "function.h"
|
822 |
|
|
+#include "recog.h"
|
823 |
|
|
+#include "toplev.h"
|
824 |
|
|
+#include "ggc.h"
|
825 |
|
|
+#include "builtins.h"
|
826 |
|
|
+#include "calls.h"
|
827 |
|
|
+#include "langhooks.h"
|
828 |
|
|
+#include "optabs.h"
|
829 |
|
|
+#include "explow.h"
|
830 |
|
|
+#include "emit-rtl.h"
|
831 |
122 |
dgisselq |
+#include "ifcvt.h"
|
832 |
202 |
dgisselq |
+#include "genrtl.h"
|
833 |
102 |
dgisselq |
+
|
834 |
|
|
+// #include "tmp_p.h"
|
835 |
|
|
+#include "target.h"
|
836 |
|
|
+#include "target-def.h"
|
837 |
|
|
+// #include "tm-constrs.h"
|
838 |
122 |
dgisselq |
+#include "tm-preds.h"
|
839 |
102 |
dgisselq |
+
|
840 |
|
|
+#include "diagnostic.h"
|
841 |
|
|
+// #include "integrate.h"
|
842 |
|
|
+
|
843 |
200 |
dgisselq |
+#include "zip-protos.h"
|
844 |
|
|
+
|
845 |
102 |
dgisselq |
+static bool zip_return_in_memory(const_tree, const_tree);
|
846 |
|
|
+static bool zip_frame_pointer_required(void);
|
847 |
|
|
+
|
848 |
|
|
+static void zip_function_arg_advance(cumulative_args_t ca, enum machine_mode mode,
|
849 |
|
|
+ const_tree type, bool named);
|
850 |
|
|
+static rtx zip_function_arg(cumulative_args_t ca, enum machine_mode mode, const_tree type, bool named);
|
851 |
|
|
+
|
852 |
|
|
+static void zip_asm_trampoline_template(FILE *);
|
853 |
|
|
+static void zip_trampoline_init(rtx, tree, rtx);
|
854 |
|
|
+static void zip_init_builtins(void);
|
855 |
202 |
dgisselq |
+static tree zip_builtin_decl(unsigned, bool);
|
856 |
102 |
dgisselq |
+// static void zip_asm_output_anchor(rtx x);
|
857 |
|
|
+ void zip_asm_output_def(FILE *s, const char *n, const char *v);
|
858 |
|
|
+static rtx zip_expand_builtin(tree exp, rtx target, rtx subtarget,
|
859 |
|
|
+ enum machine_mode tmode, int ignore);
|
860 |
|
|
+static bool zip_scalar_mode_supported_p(enum machine_mode mode);
|
861 |
|
|
+static bool zip_libgcc_floating_mode_supported_p(enum machine_mode mode);
|
862 |
|
|
+static int zip_address_cost(rtx addr, enum machine_mode mode, addr_space_t as, bool spd);
|
863 |
|
|
+static bool zip_mode_dependent_address_p(const_rtx addr, addr_space_t);
|
864 |
|
|
+static unsigned HOST_WIDE_INT zip_const_anchor = 0x20000;
|
865 |
122 |
dgisselq |
+static HOST_WIDE_INT zip_min_opb_imm = -0x20000;
|
866 |
|
|
+static HOST_WIDE_INT zip_max_opb_imm = 0x1ffff;
|
867 |
142 |
dgisselq |
+static HOST_WIDE_INT zip_min_anchor_offset = -0x2000;
|
868 |
|
|
+static HOST_WIDE_INT zip_max_anchor_offset = 0x1fff;
|
869 |
102 |
dgisselq |
+static HOST_WIDE_INT zip_min_mov_offset = -0x1000;
|
870 |
|
|
+static HOST_WIDE_INT zip_max_mov_offset = 0x0fff;
|
871 |
|
|
+static int zip_sched_issue_rate(void) { return 1; }
|
872 |
|
|
+static bool zip_legitimate_address_p(machine_mode, rtx, bool);
|
873 |
|
|
+static bool zip_legitimate_move_operand_p(machine_mode, rtx, bool);
|
874 |
|
|
+ void zip_debug_rtx_pfx(const char *, const_rtx x);
|
875 |
|
|
+ void zip_debug_rtx(const_rtx x);
|
876 |
|
|
+static void zip_override_options(void);
|
877 |
|
|
+static bool zip_can_eliminate(int from ATTRIBUTE_UNUSED, int to);
|
878 |
|
|
+static int zip_memory_move_cost(machine_mode, reg_class_t, bool);
|
879 |
111 |
dgisselq |
+static rtx zip_legitimize_address(rtx x, rtx oldx, machine_mode mode);
|
880 |
117 |
dgisselq |
+static bool zip_cannot_modify_jumps_p(void);
|
881 |
122 |
dgisselq |
+static bool zip_fixed_condition_code_regs(unsigned int *a, unsigned int *b);
|
882 |
102 |
dgisselq |
+
|
883 |
|
|
+
|
884 |
202 |
dgisselq |
+#define ZIP_ALL_DEBUG_OFF false
|
885 |
|
|
+#define ZIP_ALL_DEBUG_ON false
|
886 |
|
|
+#define ZIPDEBUGFLAG(A,B) const bool A = \
|
887 |
|
|
+ ((ZIP_ALL_DEBUG_ON)||(B))&&(!ZIP_ALL_DEBUG_OFF)
|
888 |
102 |
dgisselq |
+
|
889 |
|
|
+enum ZIP_BUILTIN_ID_CODE {
|
890 |
|
|
+ ZIP_BUILTIN_RTU,
|
891 |
|
|
+ ZIP_BUILTIN_HALT,
|
892 |
|
|
+ ZIP_BUILTIN_IDLE,
|
893 |
|
|
+ ZIP_BUILTIN_SYSCALL,
|
894 |
|
|
+ ZIP_BUILTIN_SAVE_CONTEXT,
|
895 |
|
|
+ ZIP_BUILTIN_RESTORE_CONTEXT,
|
896 |
|
|
+ ZIP_BUILTIN_BITREV,
|
897 |
|
|
+ ZIP_BUILTIN_CC,
|
898 |
117 |
dgisselq |
+ ZIP_BUILTIN_UCC,
|
899 |
171 |
dgisselq |
+ ZIP_BUILTIN_BUSY,
|
900 |
102 |
dgisselq |
+ ZIP_BUILTIN_MAX
|
901 |
|
|
+};
|
902 |
|
|
+
|
903 |
|
|
+static GTY (()) tree zip_builtins[(int)ZIP_BUILTIN_MAX];
|
904 |
|
|
+static enum insn_code zip_builtins_icode[(int)ZIP_BUILTIN_MAX];
|
905 |
|
|
+
|
906 |
202 |
dgisselq |
+#undef TARGET_ASM_ALIGNED_HI_OP
|
907 |
|
|
+#undef TARGET_ASM_ALIGNED_SI_OP
|
908 |
|
|
+#undef TARGET_ASM_ALIGNED_DI_OP
|
909 |
|
|
+#define TARGET_ASM_ALIGNED_HI_OP "\t.short\t"
|
910 |
|
|
+#define TARGET_ASM_ALIGNED_SI_OP "\t.int\t"
|
911 |
|
|
+#define TARGET_ASM_ALIGNED_DI_OP "\t.quad\t"
|
912 |
102 |
dgisselq |
+
|
913 |
202 |
dgisselq |
+#undef TARGET_ASM_UNALIGNED_HI_OP
|
914 |
|
|
+#undef TARGET_ASM_UNALIGNED_SI_OP
|
915 |
|
|
+#undef TARGET_ASM_UNALIGNED_DI_OP
|
916 |
|
|
+#define TARGET_ASM_UNALIGNED_HI_OP TARGET_ASM_ALIGNED_HI_OP
|
917 |
|
|
+#define TARGET_ASM_UNALIGNED_SI_OP TARGET_ASM_ALIGNED_SI_OP
|
918 |
|
|
+#define TARGET_ASM_UNALIGNED_DI_OP TARGET_ASM_ALIGNED_DI_OP
|
919 |
|
|
+
|
920 |
102 |
dgisselq |
+#include "gt-zip.h"
|
921 |
|
|
+
|
922 |
|
|
+/* The Global 'targetm' Variable. */
|
923 |
|
|
+struct gcc_target targetm = TARGET_INITIALIZER;
|
924 |
|
|
+
|
925 |
|
|
+
|
926 |
|
|
+enum reg_class zip_reg_class(int);
|
927 |
|
|
+
|
928 |
|
|
+#define LOSE_AND_RETURN(msgid, x) \
|
929 |
|
|
+ do { \
|
930 |
|
|
+ zip_operand_lossage(msgid, x); \
|
931 |
|
|
+ return; \
|
932 |
|
|
+ } while(0)
|
933 |
|
|
+
|
934 |
|
|
+/* Per-function machine data. */
|
935 |
|
|
+struct GTY(()) machine_function
|
936 |
|
|
+{
|
937 |
|
|
+ /* number of pretented arguments for varargs */
|
938 |
|
|
+ int pretend_size;
|
939 |
|
|
+
|
940 |
|
|
+ /* Number of bytes saved on the stack for local variables. */
|
941 |
|
|
+ int local_vars_size;
|
942 |
|
|
+
|
943 |
|
|
+ /* Number of bytes saved on stack for register save area */
|
944 |
|
|
+ int saved_reg_size;
|
945 |
|
|
+ int save_ret;
|
946 |
|
|
+
|
947 |
|
|
+ int sp_fp_offset;
|
948 |
|
|
+ bool fp_needed;
|
949 |
|
|
+ int size_for_adjusting_sp;
|
950 |
|
|
+};
|
951 |
|
|
+
|
952 |
|
|
+/* Allocate a chunk of memory for per-function machine-dependent data. */
|
953 |
|
|
+
|
954 |
|
|
+static struct machine_function *
|
955 |
|
|
+zip_init_machine_status(void) {
|
956 |
|
|
+ return ggc_cleared_alloc<machine_function>();
|
957 |
|
|
+}
|
958 |
|
|
+
|
959 |
|
|
+static void
|
960 |
|
|
+zip_override_options(void)
|
961 |
|
|
+{
|
962 |
|
|
+ init_machine_status = zip_init_machine_status;
|
963 |
|
|
+}
|
964 |
|
|
+
|
965 |
|
|
+enum reg_class
|
966 |
|
|
+zip_reg_class(int regno)
|
967 |
|
|
+{
|
968 |
|
|
+ if (is_ZIP_GENERAL_REG(regno)) {
|
969 |
|
|
+ return GENERAL_REGS;
|
970 |
|
|
+ } else if (is_ZIP_REG(regno)) {
|
971 |
|
|
+ return ALL_REGS;
|
972 |
|
|
+ } return NO_REGS;
|
973 |
|
|
+}
|
974 |
|
|
+
|
975 |
|
|
+/* Worker function for TARGET_RETURN_IN_MEMORY. */
|
976 |
|
|
+static bool
|
977 |
|
|
+zip_return_in_memory(const_tree type, const_tree fntype ATTRIBUTE_UNUSED) {
|
978 |
|
|
+ const HOST_WIDE_INT size = int_size_in_bytes(type);
|
979 |
202 |
dgisselq |
+ return (size == -1)||(size > 2*UNITS_PER_WORD);
|
980 |
102 |
dgisselq |
+}
|
981 |
|
|
+
|
982 |
|
|
+/* Emit an error emssage when we're in an asm, and a fatal error for "normal"
|
983 |
|
|
+ * insn. Formatted output isn't easily implemented, since we use output operand
|
984 |
|
|
+ * lossage to output the actual message and handle the categorization of the
|
985 |
|
|
+ * error. */
|
986 |
|
|
+
|
987 |
|
|
+static void
|
988 |
|
|
+zip_operand_lossage(const char *msgid, rtx op) {
|
989 |
|
|
+ debug_rtx(op);
|
990 |
|
|
+ zip_debug_rtx(op);
|
991 |
|
|
+ output_operand_lossage("%s", msgid);
|
992 |
|
|
+}
|
993 |
|
|
+
|
994 |
|
|
+/* The PRINT_OPERAND_ADDRESS worker. */
|
995 |
|
|
+void
|
996 |
|
|
+zip_print_operand_address(FILE *file, rtx x) {
|
997 |
202 |
dgisselq |
+ ZIPDEBUGFLAG(dbg, false);
|
998 |
102 |
dgisselq |
+
|
999 |
|
|
+ if (dbg) zip_debug_rtx(x);
|
1000 |
|
|
+ switch(GET_CODE(x)) {
|
1001 |
|
|
+ case REG:
|
1002 |
127 |
dgisselq |
+ gcc_assert(is_ZIP_REG(REGNO(x)));
|
1003 |
171 |
dgisselq |
+ gcc_assert(REGNO(x) < 16);
|
1004 |
102 |
dgisselq |
+ fprintf(file, "(%s)", reg_names[REGNO(x)]);
|
1005 |
|
|
+ break;
|
1006 |
|
|
+ case SYMBOL_REF:
|
1007 |
|
|
+ fprintf(file, "%s", XSTR(x,0));
|
1008 |
|
|
+ break;
|
1009 |
|
|
+ case LABEL_REF:
|
1010 |
|
|
+ x = LABEL_REF_LABEL(x);
|
1011 |
|
|
+ case CODE_LABEL:
|
1012 |
|
|
+ { char buf[256];
|
1013 |
|
|
+ ASM_GENERATE_INTERNAL_LABEL(buf, "L", CODE_LABEL_NUMBER(x));
|
1014 |
|
|
+#ifdef ASM_OUTPUT_LABEL_REF
|
1015 |
|
|
+ ASM_OUTPUT_LABEL_REF(file, buf);
|
1016 |
|
|
+#else
|
1017 |
|
|
+ assemble_name(file, buf);
|
1018 |
|
|
+#endif
|
1019 |
|
|
+ }
|
1020 |
|
|
+ break;
|
1021 |
|
|
+ case PLUS:
|
1022 |
111 |
dgisselq |
+ if (!REG_P(XEXP(x, 0))) {
|
1023 |
|
|
+ fprintf(stderr, "Unsupported address construct\n");
|
1024 |
|
|
+ zip_debug_rtx(x);
|
1025 |
102 |
dgisselq |
+ abort();
|
1026 |
127 |
dgisselq |
+ } gcc_assert(is_ZIP_REG(REGNO(XEXP(x,0))));
|
1027 |
171 |
dgisselq |
+ gcc_assert(REGNO(XEXP(x,0))<16);
|
1028 |
127 |
dgisselq |
+ if (CONST_INT_P(XEXP(x, 1))) {
|
1029 |
102 |
dgisselq |
+ if (INTVAL(XEXP(x,1))!=0) {
|
1030 |
|
|
+ fprintf(file, "%ld(%s)",
|
1031 |
135 |
dgisselq |
+ (long)INTVAL(XEXP(x, 1)),
|
1032 |
102 |
dgisselq |
+ reg_names[REGNO(XEXP(x, 0))]);
|
1033 |
|
|
+ } else {
|
1034 |
|
|
+ fprintf(file, "(%s)",
|
1035 |
|
|
+ reg_names[REGNO(XEXP(x, 0))]);
|
1036 |
|
|
+ }
|
1037 |
|
|
+ } else if (GET_CODE(XEXP(x,1)) == SYMBOL_REF) {
|
1038 |
|
|
+ fprintf(file, "%s(%s)", XSTR(x,0),
|
1039 |
|
|
+ reg_names[REGNO(XEXP(x, 0))]);
|
1040 |
|
|
+ } else if ((GET_CODE(XEXP(x, 1)) == MINUS)
|
1041 |
|
|
+ && (GET_CODE(XEXP(XEXP(x, 1), 0))==SYMBOL_REF)
|
1042 |
|
|
+ && (GET_CODE(XEXP(XEXP(x, 1), 1))==SYMBOL_REF)) {
|
1043 |
|
|
+ fprintf(file, "%s-%s(%s)",
|
1044 |
|
|
+ XSTR(XEXP(XEXP(x, 1),0),0),
|
1045 |
|
|
+ XSTR(XEXP(XEXP(x, 1),1),0),
|
1046 |
|
|
+ reg_names[REGNO(XEXP(x, 0))]);
|
1047 |
|
|
+ } else
|
1048 |
|
|
+ fprintf(file, "#INVALID(%s)",
|
1049 |
|
|
+ reg_names[REGNO(XEXP(x, 0))]);
|
1050 |
|
|
+ /*
|
1051 |
|
|
+ else if (GET_CODE(XEXP(addr, 1)) == LABEL)
|
1052 |
|
|
+ fprintf(file, "%s(%s)",
|
1053 |
|
|
+ GET_CODE(XEXP(addr, 1)),
|
1054 |
|
|
+ reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
|
1055 |
|
|
+ else if ((GET_CODE(XEXP(addr, 1)) == MINUS)
|
1056 |
|
|
+ && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 0))==LABEL)
|
1057 |
|
|
+ && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 1))==LABEL)) {
|
1058 |
|
|
+ fprintf(file, "%s-%s(%s)",
|
1059 |
|
|
+ reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
|
1060 |
|
|
+ reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
|
1061 |
|
|
+ reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
|
1062 |
|
|
+ }
|
1063 |
|
|
+ */
|
1064 |
|
|
+ break;
|
1065 |
|
|
+ // We don't support direct memory addressing within our
|
1066 |
|
|
+ // instruction set, even though the instructions themselves
|
1067 |
|
|
+ // would support direct memory addressing of the lower 18 bits
|
1068 |
|
|
+ // of memory space.
|
1069 |
|
|
+ case MEM:
|
1070 |
|
|
+ if (dbg) zip_debug_rtx(x);
|
1071 |
|
|
+ zip_print_operand_address(file, XEXP(x, 0));
|
1072 |
|
|
+ break;
|
1073 |
111 |
dgisselq |
+ case CONST_INT:
|
1074 |
135 |
dgisselq |
+ fprintf(file, "%ld",(long)INTVAL(x));
|
1075 |
111 |
dgisselq |
+ break;
|
1076 |
102 |
dgisselq |
+ default:
|
1077 |
111 |
dgisselq |
+ fprintf(stderr, "Unknown address format\n");
|
1078 |
|
|
+ zip_debug_rtx(x);
|
1079 |
102 |
dgisselq |
+ abort(); break;
|
1080 |
|
|
+ // output_addr_const(file, x);
|
1081 |
|
|
+ break;
|
1082 |
|
|
+ }
|
1083 |
|
|
+}
|
1084 |
|
|
+
|
1085 |
|
|
+/* The PRINT_OPERAND worker. */
|
1086 |
|
|
+
|
1087 |
|
|
+void
|
1088 |
|
|
+zip_print_operand(FILE *file, rtx x, int code)
|
1089 |
|
|
+{
|
1090 |
|
|
+ rtx operand = x;
|
1091 |
|
|
+ int rgoff = 0;
|
1092 |
|
|
+
|
1093 |
|
|
+ // fprintf(file, "Print Operand!\n");
|
1094 |
|
|
+
|
1095 |
|
|
+ /* New code entries should just be added to the switch below. If
|
1096 |
|
|
+ * handling is finished, just return. If handling was just a
|
1097 |
|
|
+ * modification of the operand, the modified operand should be put in
|
1098 |
|
|
+ * "operand", and then do a break to let default handling
|
1099 |
|
|
+ * (zero-modifier) output the operand.
|
1100 |
|
|
+ */
|
1101 |
|
|
+ switch(code) {
|
1102 |
|
|
+ case 0:
|
1103 |
|
|
+ /* No code, print as usual. */
|
1104 |
|
|
+ break;
|
1105 |
|
|
+ case 'L':
|
1106 |
|
|
+ /* Lower of two registers, print one up */
|
1107 |
|
|
+ rgoff = 1;
|
1108 |
|
|
+ break;
|
1109 |
|
|
+ case 'R':
|
1110 |
|
|
+ case 'H':
|
1111 |
|
|
+ /* Higher of a register pair, print normal */
|
1112 |
|
|
+ break;
|
1113 |
|
|
+
|
1114 |
|
|
+ default:
|
1115 |
|
|
+ LOSE_AND_RETURN("invalid operand modifier letter", x);
|
1116 |
|
|
+ }
|
1117 |
|
|
+
|
1118 |
|
|
+ /* Print an operand as without a modifier letter. */
|
1119 |
|
|
+ switch (GET_CODE(operand)) {
|
1120 |
|
|
+ case REG:
|
1121 |
|
|
+ if (REGNO(operand)+rgoff >= FIRST_PSEUDO_REGISTER)
|
1122 |
|
|
+ internal_error("internal error: bad register: %d", REGNO(operand));
|
1123 |
|
|
+ fprintf(file, "%s", reg_names[REGNO(operand)+rgoff]);
|
1124 |
|
|
+ return;
|
1125 |
|
|
+ case SCRATCH:
|
1126 |
|
|
+ LOSE_AND_RETURN("Need a scratch register", x);
|
1127 |
|
|
+ return;
|
1128 |
|
|
+
|
1129 |
|
|
+ case CODE_LABEL:
|
1130 |
|
|
+ case LABEL_REF:
|
1131 |
|
|
+ case SYMBOL_REF:
|
1132 |
|
|
+ case PLUS:
|
1133 |
|
|
+ PRINT_OPERAND_ADDRESS(file, operand);
|
1134 |
|
|
+ return;
|
1135 |
|
|
+ case MEM:
|
1136 |
|
|
+ PRINT_OPERAND_ADDRESS(file, XEXP(operand, 0));
|
1137 |
|
|
+ return;
|
1138 |
|
|
+
|
1139 |
|
|
+ default:
|
1140 |
|
|
+ /* No need to handle all strange variants, let
|
1141 |
|
|
+ * output_addr_const do it for us.
|
1142 |
|
|
+ */
|
1143 |
|
|
+ if (CONSTANT_P(operand)) {
|
1144 |
|
|
+ output_addr_const(file, operand);
|
1145 |
|
|
+ return;
|
1146 |
|
|
+ }
|
1147 |
|
|
+
|
1148 |
202 |
dgisselq |
+ zip_debug_rtx(x);
|
1149 |
102 |
dgisselq |
+ LOSE_AND_RETURN("unexpected operand", x);
|
1150 |
|
|
+ }
|
1151 |
|
|
+}
|
1152 |
|
|
+
|
1153 |
|
|
+static bool
|
1154 |
|
|
+zip_frame_pointer_required(void)
|
1155 |
|
|
+{
|
1156 |
|
|
+ // This should really depend upon whether we have variable sized
|
1157 |
|
|
+ // arguments in our frame or not. Once this fails, let's look
|
1158 |
|
|
+ // at what the problem was and then whether or not we can detect
|
1159 |
|
|
+ // it.
|
1160 |
|
|
+ //
|
1161 |
|
|
+ // Use a GCC global to determine our answer
|
1162 |
103 |
dgisselq |
+ if (cfun->calls_alloca)
|
1163 |
|
|
+ return true;
|
1164 |
202 |
dgisselq |
+
|
1165 |
|
|
+ // If the stack frame is too large to access saved registers with
|
1166 |
|
|
+ // immediate offsets, then we *must* use a frame pointer
|
1167 |
|
|
+ unsigned stack_size = 36;
|
1168 |
|
|
+ stack_size += (ACCUMULATE_OUTGOING_ARGS ? crtl->outgoing_args_size : 0);
|
1169 |
|
|
+
|
1170 |
|
|
+ //
|
1171 |
|
|
+ // if cfun->machine->size_for_adjusting_sp might ever be larger than
|
1172 |
|
|
+ // zip_max_anchor_offset, then we MUST have a frame pointer.
|
1173 |
|
|
+ //
|
1174 |
|
|
+ // cfun->machine->size_for_adjusting_sp =
|
1175 |
|
|
+ // get_frame_size
|
1176 |
|
|
+ // + saved_reg_size (will always be <= 36)
|
1177 |
|
|
+ // + outgoing_args_size;
|
1178 |
|
|
+ // + pretend_args_size;
|
1179 |
|
|
+
|
1180 |
|
|
+ if(crtl->args.pretend_args_size > 0)
|
1181 |
|
|
+ stack_size += crtl->args.pretend_args_size;
|
1182 |
|
|
+ stack_size += get_frame_size();
|
1183 |
|
|
+ // Align our attempted stack size
|
1184 |
|
|
+ stack_size = ((stack_size+3)&-4);
|
1185 |
|
|
+
|
1186 |
|
|
+ // Now here's our test
|
1187 |
|
|
+ if (stack_size >= zip_max_anchor_offset)
|
1188 |
|
|
+ return true;
|
1189 |
102 |
dgisselq |
+ return (frame_pointer_needed);
|
1190 |
|
|
+/*
|
1191 |
|
|
+*/
|
1192 |
|
|
+}
|
1193 |
|
|
+
|
1194 |
|
|
+/* Determine whether or not a register needs to be saved on the stack or not.
|
1195 |
|
|
+ */
|
1196 |
|
|
+static bool
|
1197 |
|
|
+zip_save_reg(int regno) {
|
1198 |
|
|
+ if (regno == 0)
|
1199 |
|
|
+ return ((!crtl->is_leaf)
|
1200 |
|
|
+ ||((df_regs_ever_live_p(0))&&(!call_used_regs[0])));
|
1201 |
|
|
+ else if ((regno == zip_GOT)&&(!ZIP_PIC))
|
1202 |
|
|
+ return ((df_regs_ever_live_p(regno))
|
1203 |
|
|
+ &&(!call_used_regs[regno]));
|
1204 |
|
|
+ else if (regno == zip_FP)
|
1205 |
|
|
+ return((zip_frame_pointer_required())||((df_regs_ever_live_p(regno))
|
1206 |
|
|
+ &&(!call_used_regs[regno])));
|
1207 |
|
|
+ else if (regno < zip_FP)
|
1208 |
|
|
+ return ((df_regs_ever_live_p(regno))
|
1209 |
|
|
+ &&(!call_used_regs[regno]));
|
1210 |
|
|
+ return false;
|
1211 |
|
|
+}
|
1212 |
|
|
+
|
1213 |
|
|
+/* Compute the size of the local area and the size to be adjusted by the
|
1214 |
|
|
+ * prologue and epilogue.
|
1215 |
|
|
+ *
|
1216 |
|
|
+ * Here's what we are looking at (top is the current, bottom is the last ...)
|
1217 |
|
|
+ *
|
1218 |
|
|
+ * Stack Pointer ->
|
1219 |
124 |
dgisselq |
+ * Outgoing arguments
|
1220 |
102 |
dgisselq |
+ * Local variables (could be variable size)
|
1221 |
|
|
+ * Frame Pointer -> (= Stack Pointer + sp_fp_offset)
|
1222 |
|
|
+ * Saved return address, if saved
|
1223 |
|
|
+ * Other Saved registers
|
1224 |
|
|
+ * Saved frame pointer (if used)
|
1225 |
|
|
+ * Saved R12, if used
|
1226 |
|
|
+ * (Stack pointer is not saved)
|
1227 |
171 |
dgisselq |
+ * (PRETEND-ARGS)
|
1228 |
102 |
dgisselq |
+ * Original stack pointer -> (= Stack_Pointer +size_for_adjusting_sp)
|
1229 |
|
|
+ * Called arguments (not passed in registers)
|
1230 |
|
|
+ * Return arguments (not R1, args.pretend_args_size)
|
1231 |
|
|
+ * (Prior function's stack frame ... )
|
1232 |
|
|
+ *
|
1233 |
|
|
+ */
|
1234 |
|
|
+static void
|
1235 |
|
|
+zip_compute_frame(void) {
|
1236 |
|
|
+ int regno;
|
1237 |
|
|
+ int args_size;
|
1238 |
202 |
dgisselq |
+ ZIPDEBUGFLAG(dbg, false);
|
1239 |
102 |
dgisselq |
+
|
1240 |
171 |
dgisselq |
+ if (dbg) fprintf(stderr, "ZIP-COMPUTE-FRAME: %s\n", current_function_name());
|
1241 |
102 |
dgisselq |
+ // gcc_assert(crtl);
|
1242 |
|
|
+ gcc_assert(cfun);
|
1243 |
|
|
+ gcc_assert(cfun->machine);
|
1244 |
|
|
+
|
1245 |
|
|
+ args_size=(ACCUMULATE_OUTGOING_ARGS ? crtl->outgoing_args_size : 0);
|
1246 |
|
|
+
|
1247 |
|
|
+ if(crtl->args.pretend_args_size > 0) {
|
1248 |
|
|
+ args_size += crtl->args.pretend_args_size;
|
1249 |
171 |
dgisselq |
+ if (dbg) fprintf(stderr, "%s pretend_args_size : %d\n", current_function_name(),
|
1250 |
|
|
+ crtl->args.pretend_args_size);
|
1251 |
102 |
dgisselq |
+ cfun->machine->pretend_size = crtl->args.pretend_args_size;
|
1252 |
|
|
+ }
|
1253 |
|
|
+
|
1254 |
|
|
+ cfun->machine->local_vars_size = get_frame_size();
|
1255 |
|
|
+
|
1256 |
202 |
dgisselq |
+ // Force frame alignment of the local variable section
|
1257 |
|
|
+ cfun->machine->local_vars_size += 3;
|
1258 |
|
|
+ cfun->machine->local_vars_size &= -4;
|
1259 |
|
|
+
|
1260 |
102 |
dgisselq |
+ // Save callee-saved registers.
|
1261 |
|
|
+ cfun->machine->saved_reg_size = 0;
|
1262 |
|
|
+ for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
|
1263 |
|
|
+ if (zip_save_reg(regno))
|
1264 |
202 |
dgisselq |
+ cfun->machine->saved_reg_size += 4;
|
1265 |
102 |
dgisselq |
+ }
|
1266 |
|
|
+
|
1267 |
|
|
+ cfun->machine->fp_needed = (zip_frame_pointer_required());
|
1268 |
|
|
+
|
1269 |
|
|
+ if ((cfun->machine->fp_needed)&&
|
1270 |
|
|
+ (!df_regs_ever_live_p(zip_FP))) {
|
1271 |
202 |
dgisselq |
+ cfun->machine->saved_reg_size += 4;
|
1272 |
102 |
dgisselq |
+ }
|
1273 |
|
|
+
|
1274 |
171 |
dgisselq |
+ cfun->machine->sp_fp_offset = crtl->outgoing_args_size
|
1275 |
|
|
+ + cfun->machine->local_vars_size;
|
1276 |
102 |
dgisselq |
+ cfun->machine->size_for_adjusting_sp = cfun->machine->local_vars_size
|
1277 |
|
|
+ + cfun->machine->saved_reg_size
|
1278 |
|
|
+ + args_size;
|
1279 |
124 |
dgisselq |
+ if(dbg) {
|
1280 |
171 |
dgisselq |
+ fprintf(stderr, "\t---- STACK PTR ----\n");
|
1281 |
|
|
+ fprintf(stderr, "\tOUTGOIN-SIZE: %d\n",
|
1282 |
|
|
+ crtl->outgoing_args_size);
|
1283 |
124 |
dgisselq |
+ fprintf(stderr, "\tLOCALS-SIZE : %d\n",
|
1284 |
|
|
+ cfun->machine->local_vars_size);
|
1285 |
171 |
dgisselq |
+ fprintf(stderr, "\t---- FRAME PTR ----%s\n",
|
1286 |
|
|
+ cfun->machine->fp_needed?"":" (Eliminated)");
|
1287 |
124 |
dgisselq |
+ fprintf(stderr, "\tREGISTERS : %d\n",
|
1288 |
|
|
+ cfun->machine->saved_reg_size);
|
1289 |
171 |
dgisselq |
+ fprintf(stderr, "\tPRETEND SIZE: %d\n",
|
1290 |
|
|
+ crtl->args.pretend_args_size);
|
1291 |
|
|
+ fprintf(stderr, "\t---- ARG PTR (Original SP, should be eliminated) ----\n");
|
1292 |
|
|
+ fprintf(stderr, "\t----\n");
|
1293 |
|
|
+ fprintf(stderr, "\tARGS-SIZE : %d\n", args_size);
|
1294 |
124 |
dgisselq |
+ fprintf(stderr, "\tSP_FP_OFFSET: %d\n",
|
1295 |
|
|
+ cfun->machine->sp_fp_offset);
|
1296 |
|
|
+ fprintf(stderr, "\tSP-ADJUSTMNT: %d\n",
|
1297 |
|
|
+ cfun->machine->size_for_adjusting_sp);
|
1298 |
|
|
+ }
|
1299 |
102 |
dgisselq |
+}
|
1300 |
|
|
+
|
1301 |
|
|
+void
|
1302 |
202 |
dgisselq |
+zip_save_registers(rtx basereg_rtx, int sp_offset_to_first_register) {
|
1303 |
102 |
dgisselq |
+ rtx insn;
|
1304 |
202 |
dgisselq |
+ ZIPDEBUGFLAG(dbg, false);
|
1305 |
102 |
dgisselq |
+
|
1306 |
202 |
dgisselq |
+ // Compute Frame has already been calculated before coming into here
|
1307 |
|
|
+ //
|
1308 |
|
|
+ // zip_compute_frame();
|
1309 |
|
|
+ if (dbg) fprintf(stderr, "PROLOGUE::SAVE-REGISTER\n");
|
1310 |
|
|
+
|
1311 |
|
|
+ int offset = 0, regno;
|
1312 |
|
|
+ for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
|
1313 |
|
|
+ if (zip_save_reg(regno)) {
|
1314 |
|
|
+ if (dbg) fprintf(stderr,
|
1315 |
|
|
+ "PROLOGUE::SAVE-REGISTER Saving R%d in %d+%d(SP)\n",
|
1316 |
|
|
+ regno, sp_offset_to_first_register, offset);
|
1317 |
|
|
+ insn=emit_insn(gen_movsi_sto_off(
|
1318 |
|
|
+ basereg_rtx,
|
1319 |
|
|
+ GEN_INT(sp_offset_to_first_register +offset),
|
1320 |
|
|
+ gen_rtx_REG(SImode, regno)));
|
1321 |
|
|
+ RTX_FRAME_RELATED_P(insn) = 1;
|
1322 |
|
|
+ offset += 4;
|
1323 |
|
|
+ }
|
1324 |
|
|
+ } if (dbg) fprintf(stderr, "%d registers saved%s\n", offset,
|
1325 |
|
|
+ (crtl->saves_all_registers)?", should be all of them":", less than all");
|
1326 |
|
|
+
|
1327 |
|
|
+}
|
1328 |
|
|
+
|
1329 |
|
|
+/*
|
1330 |
|
|
+ * zip_expand_small_prologue()
|
1331 |
|
|
+ *
|
1332 |
|
|
+ * To be used when the sp_fp_offset is less then zip_max_opb_offset.
|
1333 |
|
|
+ *
|
1334 |
|
|
+ *
|
1335 |
|
|
+ * Approach:
|
1336 |
|
|
+ * SUB size_for_adjusting_sp,SP
|
1337 |
|
|
+ * SW REG,0(SP)
|
1338 |
|
|
+ * SW REG,4(SP)
|
1339 |
|
|
+ * SW REG,8(SP)
|
1340 |
|
|
+ * ....
|
1341 |
|
|
+ * SW REG,#(SP)
|
1342 |
|
|
+ *
|
1343 |
|
|
+ * and if we need a frame register, we'll either do ...
|
1344 |
|
|
+ * MOV sp_fp_offset+SP,FP
|
1345 |
|
|
+ * or if the offset is too large, we'll do ...
|
1346 |
|
|
+ * MOV SP,FP
|
1347 |
|
|
+ * ADD sp_fp_offset,FP
|
1348 |
|
|
+ *
|
1349 |
|
|
+ */
|
1350 |
|
|
+void
|
1351 |
|
|
+zip_expand_small_prologue(void) {
|
1352 |
|
|
+ ZIPDEBUGFLAG(dbg, false);
|
1353 |
|
|
+ rtx insn;
|
1354 |
|
|
+
|
1355 |
102 |
dgisselq |
+ zip_compute_frame();
|
1356 |
|
|
+
|
1357 |
202 |
dgisselq |
+ if (dbg) fprintf(stderr, "PROLOGUE:::EXPAND-SMALL-PROLOGUE(SP-FP offset is %d)\n",
|
1358 |
|
|
+ cfun->machine->sp_fp_offset);
|
1359 |
|
|
+
|
1360 |
|
|
+ insn = emit_insn(gen_subsi3(stack_pointer_rtx, stack_pointer_rtx,
|
1361 |
102 |
dgisselq |
+ gen_int_mode(cfun->machine->size_for_adjusting_sp,
|
1362 |
|
|
+ SImode)));
|
1363 |
202 |
dgisselq |
+ RTX_FRAME_RELATED_P(insn) = 1;
|
1364 |
102 |
dgisselq |
+
|
1365 |
202 |
dgisselq |
+ zip_save_registers(stack_pointer_rtx, cfun->machine->sp_fp_offset);
|
1366 |
102 |
dgisselq |
+
|
1367 |
|
|
+ if (cfun->machine->fp_needed) {
|
1368 |
202 |
dgisselq |
+ if (dbg) fprintf(stderr, "PROLOGUE:::EXPAND-SMALL-PROLOGUE(FP-NEEDED)\n");
|
1369 |
102 |
dgisselq |
+ if (dbg) zip_debug_rtx(stack_pointer_rtx);
|
1370 |
|
|
+ if (dbg) zip_debug_rtx(frame_pointer_rtx);
|
1371 |
202 |
dgisselq |
+ if (cfun->machine->sp_fp_offset < zip_max_mov_offset) {
|
1372 |
|
|
+ if (dbg) fprintf(stderr,
|
1373 |
|
|
+ "PROLOGUE:::EXPAND-SMALL-PROLOGUE() "
|
1374 |
|
|
+ "gen_movsi_reg_off(FP, SP, %d), %d < %ld\n",
|
1375 |
|
|
+ cfun->machine->sp_fp_offset,
|
1376 |
|
|
+ cfun->machine->sp_fp_offset,
|
1377 |
|
|
+ zip_max_mov_offset);
|
1378 |
|
|
+ insn = emit_insn(gen_movsi_reg_off(frame_pointer_rtx,
|
1379 |
124 |
dgisselq |
+ stack_pointer_rtx,
|
1380 |
|
|
+ GEN_INT(cfun->machine->sp_fp_offset)));
|
1381 |
202 |
dgisselq |
+ RTX_FRAME_RELATED_P(insn) = 1;
|
1382 |
|
|
+ } else {
|
1383 |
|
|
+ rtx fp_rtx;
|
1384 |
|
|
+
|
1385 |
|
|
+ fp_rtx = gen_rtx_REG(SImode, zip_FP);
|
1386 |
|
|
+
|
1387 |
|
|
+ insn = emit_insn(gen_movsi(fp_rtx, stack_pointer_rtx));
|
1388 |
|
|
+ RTX_FRAME_RELATED_P(insn) = 1;
|
1389 |
|
|
+
|
1390 |
|
|
+ insn = emit_insn(gen_addsi3(fp_rtx, fp_rtx,
|
1391 |
|
|
+ GEN_INT(cfun->machine->sp_fp_offset)));
|
1392 |
|
|
+ RTX_FRAME_RELATED_P(insn) = 1;
|
1393 |
|
|
+ }
|
1394 |
102 |
dgisselq |
+ }
|
1395 |
|
|
+}
|
1396 |
|
|
+
|
1397 |
202 |
dgisselq |
+/*
|
1398 |
|
|
+ * zip_expand_large_prologue()
|
1399 |
|
|
+ *
|
1400 |
|
|
+ * The prologue function will be called when the size_for_adjusting_sp is too
|
1401 |
|
|
+ * large to fit into a single OPB-immediate as part of a subtract.
|
1402 |
|
|
+ *
|
1403 |
|
|
+ * Approach:
|
1404 |
|
|
+ * SUB (size_for_adjusting_sp-sp_fp_offset),SP
|
1405 |
|
|
+ * SW R0,(SP)
|
1406 |
|
|
+ * SW R5,4(SP)
|
1407 |
|
|
+ * SW R6,8SP)
|
1408 |
|
|
+ * SW R7,(SP)
|
1409 |
|
|
+ * ...
|
1410 |
|
|
+ * SW FP,(SP)
|
1411 |
|
|
+ *
|
1412 |
|
|
+ * LDI sp_fp_offset,FP
|
1413 |
|
|
+ * SUB FP,SP
|
1414 |
|
|
+ * ADD SP,FP
|
1415 |
|
|
+ */
|
1416 |
|
|
+void
|
1417 |
|
|
+zip_expand_large_prologue(void) {
|
1418 |
|
|
+ ZIPDEBUGFLAG(dbg, false);
|
1419 |
|
|
+ rtx insn, fp_rtx;
|
1420 |
|
|
+
|
1421 |
|
|
+ gcc_assert(cfun->machine->fp_needed);
|
1422 |
|
|
+
|
1423 |
|
|
+ if (dbg) fprintf(stderr, "PROLOGUE::expand-large(%d-%d)\n",
|
1424 |
|
|
+ cfun->machine->size_for_adjusting_sp,
|
1425 |
|
|
+ cfun->machine->sp_fp_offset);
|
1426 |
|
|
+ insn = emit_insn(gen_subsi3(stack_pointer_rtx, stack_pointer_rtx,
|
1427 |
|
|
+ gen_int_mode(cfun->machine->size_for_adjusting_sp
|
1428 |
|
|
+ -cfun->machine->sp_fp_offset, SImode)));
|
1429 |
|
|
+ RTX_FRAME_RELATED_P(insn) = 1;
|
1430 |
|
|
+
|
1431 |
|
|
+ zip_save_registers(stack_pointer_rtx, 0);
|
1432 |
|
|
+
|
1433 |
|
|
+ fp_rtx = gen_rtx_REG(SImode, zip_FP);
|
1434 |
|
|
+
|
1435 |
|
|
+ insn = emit_insn(gen_movsi(fp_rtx,
|
1436 |
|
|
+ gen_int_mode(cfun->machine->sp_fp_offset, SImode)));
|
1437 |
|
|
+ RTX_FRAME_RELATED_P(insn) = 1;
|
1438 |
|
|
+
|
1439 |
|
|
+ insn = emit_insn(gen_subsi3(stack_pointer_rtx, stack_pointer_rtx,
|
1440 |
|
|
+ fp_rtx));
|
1441 |
|
|
+ RTX_FRAME_RELATED_P(insn) = 1;
|
1442 |
|
|
+
|
1443 |
|
|
+ insn = emit_insn(gen_addsi3(fp_rtx, fp_rtx, stack_pointer_rtx));
|
1444 |
|
|
+ RTX_FRAME_RELATED_P(insn) = 1;
|
1445 |
|
|
+}
|
1446 |
|
|
+
|
1447 |
|
|
+void
|
1448 |
|
|
+zip_expand_prologue(void) {
|
1449 |
|
|
+ ZIPDEBUGFLAG(dbg, false);
|
1450 |
|
|
+
|
1451 |
|
|
+ zip_compute_frame();
|
1452 |
|
|
+
|
1453 |
|
|
+ if (dbg) fprintf(stderr, "PROLOGUE: Computing Prologue instructions\n");
|
1454 |
|
|
+ if (dbg) fprintf(stderr, "PROLOGUE: SP-FP offset is %d\n",
|
1455 |
|
|
+ cfun->machine->sp_fp_offset);
|
1456 |
|
|
+ if (cfun->machine->size_for_adjusting_sp != 0) {
|
1457 |
|
|
+ if (cfun->machine->size_for_adjusting_sp <= zip_max_anchor_offset) {
|
1458 |
|
|
+ if (dbg) fprintf(stderr, "PROLOGUE: "
|
1459 |
|
|
+ "%d <= %ld, so going small\n",
|
1460 |
|
|
+ cfun->machine->size_for_adjusting_sp,
|
1461 |
|
|
+ zip_max_opb_imm);
|
1462 |
|
|
+ zip_expand_small_prologue();
|
1463 |
|
|
+ } else {
|
1464 |
|
|
+ zip_expand_large_prologue();
|
1465 |
|
|
+ }
|
1466 |
|
|
+ }
|
1467 |
|
|
+}
|
1468 |
|
|
+
|
1469 |
200 |
dgisselq |
+int
|
1470 |
102 |
dgisselq |
+zip_use_return_insn(void)
|
1471 |
|
|
+{
|
1472 |
|
|
+ if ((!reload_completed)||(cfun->machine->fp_needed)
|
1473 |
|
|
+ ||(get_frame_size()!=0)) {
|
1474 |
|
|
+ // If R0 ever gets pushed to the stack, then we cannot
|
1475 |
|
|
+ // use a master return from anywhere. We need to clean up the
|
1476 |
|
|
+ // stack first.
|
1477 |
|
|
+ if ((!crtl->is_leaf)||((df_regs_ever_live_p(0))
|
1478 |
|
|
+ &&(!call_used_regs[0]))) {
|
1479 |
200 |
dgisselq |
+ return 0;
|
1480 |
102 |
dgisselq |
+ }
|
1481 |
|
|
+ }
|
1482 |
|
|
+ zip_compute_frame();
|
1483 |
200 |
dgisselq |
+ return (cfun->machine->size_for_adjusting_sp == 0)?1:0;
|
1484 |
102 |
dgisselq |
+}
|
1485 |
|
|
+
|
1486 |
|
|
+/* As per the notes in M68k.c, quote the function epilogue should not depend
|
1487 |
202 |
dgisselq |
+ * upon the current stack pointer. It should use the frame pointer only,
|
1488 |
102 |
dgisselq |
+ * if there is a frame pointer. This is mandatory because of alloca; we also
|
1489 |
|
|
+ * take advantage of it to omit stack adjustments before returning ...
|
1490 |
|
|
+ *
|
1491 |
|
|
+ * Let's see if we can use their approach here.
|
1492 |
|
|
+ *
|
1493 |
|
|
+ * We can't. Consider our choices:
|
1494 |
202 |
dgisselq |
+ * LW (FP),R0
|
1495 |
|
|
+ * LW 4(FP),R4
|
1496 |
|
|
+ * LW 8(FP),R5
|
1497 |
|
|
+ * LW 12(FP),R6
|
1498 |
|
|
+ * LW 16(FP),FP
|
1499 |
102 |
dgisselq |
+ * ... Then what is the stack pointer?
|
1500 |
|
|
+ * or
|
1501 |
202 |
dgisselq |
+ * LW (FP),R0
|
1502 |
|
|
+ * LW 4(FP),R4
|
1503 |
|
|
+ * LW 8(FP),R5
|
1504 |
|
|
+ * LW 12(FP),R6
|
1505 |
102 |
dgisselq |
+ * MOV FP,SP
|
1506 |
202 |
dgisselq |
+ * LW 16(SP),FP
|
1507 |
102 |
dgisselq |
+ * ... Which suffers unnecessary pipeline stalls, and certainly doesn't
|
1508 |
|
|
+ * exploit our pipeline memory function
|
1509 |
|
|
+ * or
|
1510 |
|
|
+ * MOV FP,SP
|
1511 |
202 |
dgisselq |
+ * LW (SP),R0
|
1512 |
|
|
+ * LW 4(SP),R4
|
1513 |
|
|
+ * LW 8(SP),R5
|
1514 |
|
|
+ * LW 12(SP),R6
|
1515 |
|
|
+ * LW 16(SP),FP
|
1516 |
102 |
dgisselq |
+ * Which will be our choice. Note that we do use the stack pointer, eventually.
|
1517 |
|
|
+ *
|
1518 |
|
|
+ */
|
1519 |
|
|
+void
|
1520 |
|
|
+zip_expand_epilogue(void) {
|
1521 |
|
|
+ int regno, offset;
|
1522 |
202 |
dgisselq |
+ ZIPDEBUGFLAG(dbg, false);
|
1523 |
138 |
dgisselq |
+ rtx insn;
|
1524 |
102 |
dgisselq |
+
|
1525 |
|
|
+ zip_compute_frame();
|
1526 |
|
|
+
|
1527 |
|
|
+ if (dbg) fprintf(stderr, "EPILOG::\n");
|
1528 |
|
|
+ if (cfun->machine->fp_needed) {
|
1529 |
124 |
dgisselq |
+ // This is done special--if you can't trust the stack pointer
|
1530 |
|
|
+ // enough so that you must have a frame pointer, then you can't
|
1531 |
|
|
+ // trust its offset enough to restore from it. Hence, we start
|
1532 |
|
|
+ // by moving the frame pointer to the stack pointer to recover
|
1533 |
|
|
+ // the stack pointer back to a usable value.
|
1534 |
102 |
dgisselq |
+ if (dbg) fprintf(stderr, "EPILOG::Moving frame pointer to stack register\n");
|
1535 |
202 |
dgisselq |
+ insn = emit_insn(gen_movsi_raw(stack_pointer_rtx, frame_pointer_rtx));
|
1536 |
138 |
dgisselq |
+ RTX_FRAME_RELATED_P(insn) = 1;
|
1537 |
102 |
dgisselq |
+ }
|
1538 |
|
|
+
|
1539 |
|
|
+ if (cfun->machine->saved_reg_size != 0) {
|
1540 |
124 |
dgisselq |
+ if (cfun->machine->fp_needed)
|
1541 |
|
|
+ offset = 0;
|
1542 |
|
|
+ else
|
1543 |
|
|
+ offset = cfun->machine->sp_fp_offset;
|
1544 |
102 |
dgisselq |
+ if (dbg) fprintf(stderr, "EPILOG::Saved_REG_Size = %d\n", cfun->machine->saved_reg_size);
|
1545 |
|
|
+ for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
|
1546 |
|
|
+ if (zip_save_reg(regno)) {
|
1547 |
202 |
dgisselq |
+ if (dbg) fprintf(stderr, "EPILOG::RESTORING R%d from SP+%d\n", regno, offset);
|
1548 |
138 |
dgisselq |
+ rtx reg = gen_rtx_REG(SImode, regno);
|
1549 |
|
|
+ insn = emit_insn(gen_movsi_lod_off(
|
1550 |
|
|
+ reg,
|
1551 |
124 |
dgisselq |
+ stack_pointer_rtx,
|
1552 |
202 |
dgisselq |
+ GEN_INT(offset)));
|
1553 |
138 |
dgisselq |
+ add_reg_note(insn, REG_CFA_RESTORE, reg);
|
1554 |
|
|
+ RTX_FRAME_RELATED_P(insn) = 1;
|
1555 |
202 |
dgisselq |
+ offset += 4;
|
1556 |
102 |
dgisselq |
+ }
|
1557 |
|
|
+ }
|
1558 |
|
|
+ }
|
1559 |
|
|
+
|
1560 |
124 |
dgisselq |
+ if (cfun->machine->fp_needed) {
|
1561 |
|
|
+ // Restore the stack pointer back to the original, the
|
1562 |
|
|
+ // difference being the difference from the frame pointer
|
1563 |
|
|
+ // to the original stack
|
1564 |
202 |
dgisselq |
+ insn = emit_insn(gen_addsi3(stack_pointer_rtx,
|
1565 |
138 |
dgisselq |
+ stack_pointer_rtx,
|
1566 |
124 |
dgisselq |
+ GEN_INT(cfun->machine->size_for_adjusting_sp
|
1567 |
|
|
+ -cfun->machine->sp_fp_offset)));
|
1568 |
138 |
dgisselq |
+ RTX_FRAME_RELATED_P(insn) = 1;
|
1569 |
124 |
dgisselq |
+ } else {
|
1570 |
|
|
+ // else now the difference is between the stack pointer and
|
1571 |
|
|
+ // the original stack pointer.
|
1572 |
102 |
dgisselq |
+ if (dbg) fprintf(stderr, "EPILOG::ADDSI3(StackPtr, %d)\n",
|
1573 |
|
|
+ cfun->machine->size_for_adjusting_sp);
|
1574 |
202 |
dgisselq |
+ insn = emit_insn(gen_addsi3(stack_pointer_rtx, stack_pointer_rtx,
|
1575 |
124 |
dgisselq |
+ GEN_INT(cfun->machine->size_for_adjusting_sp)));
|
1576 |
138 |
dgisselq |
+ RTX_FRAME_RELATED_P(insn) = 1;
|
1577 |
102 |
dgisselq |
+ }
|
1578 |
|
|
+ if (dbg) fprintf(stderr, "EPILOG::EMITTING-RETURN\n");
|
1579 |
|
|
+
|
1580 |
138 |
dgisselq |
+ // The return RTX is not allowed to be frame related
|
1581 |
|
|
+ insn = emit_jump_insn(ret_rtx);
|
1582 |
|
|
+ // RTX_FRAME_RELATED_P(insn) = 1;
|
1583 |
102 |
dgisselq |
+}
|
1584 |
|
|
+
|
1585 |
191 |
dgisselq |
+void
|
1586 |
|
|
+zip_sibcall_epilogue(void) {
|
1587 |
|
|
+ int regno, offset;
|
1588 |
202 |
dgisselq |
+ ZIPDEBUGFLAG(dbg, false);
|
1589 |
191 |
dgisselq |
+ rtx insn;
|
1590 |
|
|
+
|
1591 |
|
|
+ zip_compute_frame();
|
1592 |
|
|
+
|
1593 |
|
|
+ if (dbg) fprintf(stderr, "EPILOG::\n");
|
1594 |
|
|
+ if (cfun->machine->fp_needed) {
|
1595 |
|
|
+ // This is done special--if you can't trust the stack pointer
|
1596 |
|
|
+ // enough so that you must have a frame pointer, then you can't
|
1597 |
|
|
+ // trust its offset enough to restore from it. Hence, we start
|
1598 |
|
|
+ // by moving the frame pointer to the stack pointer to recover
|
1599 |
|
|
+ // the stack pointer back to a usable value.
|
1600 |
|
|
+ if (dbg) fprintf(stderr, "SIBCALL-EPILOG::Moving frame pointer to stack register\n");
|
1601 |
202 |
dgisselq |
+ insn = emit_insn(gen_movsi_raw(stack_pointer_rtx, frame_pointer_rtx));
|
1602 |
191 |
dgisselq |
+ RTX_FRAME_RELATED_P(insn) = 1;
|
1603 |
|
|
+ }
|
1604 |
|
|
+
|
1605 |
|
|
+ if (cfun->machine->saved_reg_size != 0) {
|
1606 |
|
|
+ if (cfun->machine->fp_needed)
|
1607 |
|
|
+ offset = 0;
|
1608 |
|
|
+ else
|
1609 |
|
|
+ offset = cfun->machine->sp_fp_offset;
|
1610 |
|
|
+ if (dbg) fprintf(stderr, "SIBCALL-EPILOG::Saved_REG_Size = %d\n", cfun->machine->saved_reg_size);
|
1611 |
|
|
+ for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
|
1612 |
|
|
+ if (zip_save_reg(regno)) {
|
1613 |
|
|
+ if (dbg) fprintf(stderr, "SIBCALL-EPILOG::RESTORING R%d\n", regno);
|
1614 |
|
|
+ rtx reg = gen_rtx_REG(SImode, regno);
|
1615 |
|
|
+ insn = emit_insn(gen_movsi_lod_off(
|
1616 |
|
|
+ reg,
|
1617 |
|
|
+ stack_pointer_rtx,
|
1618 |
202 |
dgisselq |
+ GEN_INT(offset)));
|
1619 |
191 |
dgisselq |
+ add_reg_note(insn, REG_CFA_RESTORE, reg);
|
1620 |
|
|
+ RTX_FRAME_RELATED_P(insn) = 1;
|
1621 |
202 |
dgisselq |
+ offset += 4;
|
1622 |
191 |
dgisselq |
+ }
|
1623 |
|
|
+ }
|
1624 |
|
|
+ }
|
1625 |
|
|
+
|
1626 |
|
|
+ if (cfun->machine->fp_needed) {
|
1627 |
|
|
+ // Restore the stack pointer back to the original, the
|
1628 |
|
|
+ // difference being the difference from the frame pointer
|
1629 |
|
|
+ // to the original stack
|
1630 |
202 |
dgisselq |
+ insn = emit_insn(gen_addsi3(stack_pointer_rtx, stack_pointer_rtx,
|
1631 |
191 |
dgisselq |
+ GEN_INT(cfun->machine->size_for_adjusting_sp
|
1632 |
|
|
+ -cfun->machine->sp_fp_offset)));
|
1633 |
|
|
+ RTX_FRAME_RELATED_P(insn) = 1;
|
1634 |
|
|
+ } else {
|
1635 |
|
|
+ // else now the difference is between the stack pointer and
|
1636 |
|
|
+ // the original stack pointer.
|
1637 |
|
|
+ if (dbg) fprintf(stderr, "SIBCALL-EPILOG::ADDSI3(StackPtr, %d)\n",
|
1638 |
|
|
+ cfun->machine->size_for_adjusting_sp);
|
1639 |
202 |
dgisselq |
+ insn = emit_insn(gen_addsi3(stack_pointer_rtx,stack_pointer_rtx,
|
1640 |
191 |
dgisselq |
+ GEN_INT(cfun->machine->size_for_adjusting_sp)));
|
1641 |
|
|
+ RTX_FRAME_RELATED_P(insn) = 1;
|
1642 |
|
|
+ }
|
1643 |
|
|
+}
|
1644 |
|
|
+
|
1645 |
202 |
dgisselq |
+rtx
|
1646 |
|
|
+zip_return_addr_rtx(int count, rtx frame ATTRIBUTE_UNUSED)
|
1647 |
|
|
+{
|
1648 |
|
|
+ //
|
1649 |
|
|
+ // Don't try to compute anything other than frame zero.
|
1650 |
|
|
+ //
|
1651 |
|
|
+ if (count != 0)
|
1652 |
|
|
+ return NULL_RTX;
|
1653 |
|
|
+
|
1654 |
|
|
+ // Make sure we've computed our frame, do we need to save registers?
|
1655 |
|
|
+ zip_compute_frame();
|
1656 |
|
|
+
|
1657 |
|
|
+ if (zip_save_reg(zip_LR)) {
|
1658 |
|
|
+ if (cfun->machine->fp_needed)
|
1659 |
|
|
+ return gen_rtx_MEM(SImode, frame_pointer_rtx);
|
1660 |
|
|
+ else
|
1661 |
|
|
+ return gen_rtx_MEM(SImode, gen_rtx_PLUS(Pmode,
|
1662 |
|
|
+ stack_pointer_rtx,
|
1663 |
|
|
+ GEN_INT(cfun->machine->sp_fp_offset)));
|
1664 |
|
|
+ } else {
|
1665 |
|
|
+ return gen_rtx_REG(Pmode, zip_LR);
|
1666 |
|
|
+
|
1667 |
|
|
+ }
|
1668 |
|
|
+}
|
1669 |
|
|
+
|
1670 |
102 |
dgisselq |
+/* Implement RETURN_ADDR_RTX(COUNT, FRAMEADDR).
|
1671 |
|
|
+ *
|
1672 |
|
|
+ * We currently only support calculating the return address for the current
|
1673 |
|
|
+ * frame.
|
1674 |
|
|
+ */
|
1675 |
|
|
+
|
1676 |
|
|
+/*
|
1677 |
|
|
+rtx
|
1678 |
|
|
+zip_return_addr_rtx(int count, rtx frame ATTRIBUTE_UNUSED)
|
1679 |
|
|
+{
|
1680 |
|
|
+ if (count)
|
1681 |
|
|
+ return NULL_RTX;
|
1682 |
|
|
+
|
1683 |
|
|
+ zip_compute_frame();
|
1684 |
|
|
+
|
1685 |
|
|
+ // saved return address for current function is at fp - 1
|
1686 |
|
|
+ if (cfun->machine->save_ret)
|
1687 |
|
|
+ return gen_rtx_MEM(Pmode, plus_constant(frame_pointer_rtx,
|
1688 |
|
|
+ -UNITS_PER_WORD));
|
1689 |
|
|
+ return get_hard_reg_initial_val(Pmode, RETURN_ADDRESS_REGNUM);
|
1690 |
|
|
+}
|
1691 |
|
|
+*/
|
1692 |
|
|
+
|
1693 |
|
|
+/* Implements the macro INITIAL_ELIMINATION_OFFSET,
|
1694 |
|
|
+ * return the OFFSET.
|
1695 |
|
|
+ */
|
1696 |
|
|
+int
|
1697 |
|
|
+zip_initial_elimination_offset(int from, int to) {
|
1698 |
|
|
+ int ret = 0;
|
1699 |
|
|
+ zip_compute_frame();
|
1700 |
|
|
+
|
1701 |
171 |
dgisselq |
+/*
|
1702 |
102 |
dgisselq |
+ if (((from) == FRAME_POINTER_REGNUM)&&((to) == STACK_POINTER_REGNUM)) {
|
1703 |
|
|
+ ret = cfun->machine->sp_fp_offset;
|
1704 |
117 |
dgisselq |
+ } else if (((from)=ARG_POINTER_REGNUM)&&((to)==STACK_POINTER_REGNUM)) {
|
1705 |
171 |
dgisselq |
+ // Since the ARG_POINTER_REGNUM is defined to be identical
|
1706 |
|
|
+ // to the FRAME_POINTER_REGNUM, this "if" will never ever
|
1707 |
|
|
+ // get called.
|
1708 |
117 |
dgisselq |
+ ret = cfun->machine->sp_fp_offset;
|
1709 |
102 |
dgisselq |
+ } else if (((from)=ARG_POINTER_REGNUM)&&((to)==FRAME_POINTER_REGNUM)) {
|
1710 |
171 |
dgisselq |
+ // Since we define ARG_POINTER_REGNUM to be FRAME_POINTER_REGNUM
|
1711 |
|
|
+ // we're asked for the offset between the frame pointer and
|
1712 |
|
|
+ // itself. The result had better be zero.
|
1713 |
|
|
+ //
|
1714 |
117 |
dgisselq |
+ ret = 0;
|
1715 |
102 |
dgisselq |
+ } else {
|
1716 |
|
|
+ abort();
|
1717 |
|
|
+ }
|
1718 |
171 |
dgisselq |
+*/
|
1719 |
102 |
dgisselq |
+
|
1720 |
171 |
dgisselq |
+ // Let's try using an ARG_POINTER != FRAME_POINTER
|
1721 |
|
|
+ if (((from) == FRAME_POINTER_REGNUM)&&((to) == STACK_POINTER_REGNUM)) {
|
1722 |
|
|
+ ret = cfun->machine->sp_fp_offset;
|
1723 |
|
|
+ } else if (((from)=ARG_POINTER_REGNUM)&&((to)==STACK_POINTER_REGNUM)) {
|
1724 |
|
|
+ // Since the ARG_POINTER_REGNUM is defined to be identical
|
1725 |
|
|
+ // to the FRAME_POINTER_REGNUM, this "if" will never ever
|
1726 |
|
|
+ // get called.
|
1727 |
|
|
+ ret = cfun->machine->size_for_adjusting_sp;
|
1728 |
|
|
+ } else if (((from)=ARG_POINTER_REGNUM)&&((to)==FRAME_POINTER_REGNUM)) {
|
1729 |
|
|
+ ret = cfun->machine->size_for_adjusting_sp
|
1730 |
|
|
+ - cfun->machine->sp_fp_offset;
|
1731 |
|
|
+ } else {
|
1732 |
|
|
+ abort();
|
1733 |
|
|
+ }
|
1734 |
|
|
+
|
1735 |
102 |
dgisselq |
+ return ret;
|
1736 |
|
|
+}
|
1737 |
|
|
+
|
1738 |
|
|
+/*
|
1739 |
|
|
+ * Code taken from m68k ...
|
1740 |
|
|
+ */
|
1741 |
|
|
+static bool
|
1742 |
|
|
+zip_can_eliminate(int from, int to)
|
1743 |
|
|
+{
|
1744 |
|
|
+ // fprintf(stderr, "CAN_ELIMINATE::QUERYING(%d,%d)\n", from, to);
|
1745 |
|
|
+ if ((from == zip_FP)&&(to == zip_SP))
|
1746 |
|
|
+ return !cfun->machine->fp_needed;
|
1747 |
|
|
+ return true;
|
1748 |
|
|
+}
|
1749 |
|
|
+
|
1750 |
171 |
dgisselq |
+/* Compute the number of word sized registers needed to hold a function
|
1751 |
102 |
dgisselq |
+ * argument of mode INT_MODE and tree type TYPE.
|
1752 |
|
|
+ */
|
1753 |
|
|
+int
|
1754 |
|
|
+zip_num_arg_regs(enum machine_mode mode, const_tree type) {
|
1755 |
|
|
+ int size;
|
1756 |
|
|
+
|
1757 |
|
|
+ if (targetm.calls.must_pass_in_stack(mode, type))
|
1758 |
|
|
+ return 0;
|
1759 |
|
|
+
|
1760 |
|
|
+ if ((type)&&(mode == BLKmode))
|
1761 |
|
|
+ size = int_size_in_bytes(type);
|
1762 |
|
|
+ else
|
1763 |
|
|
+ size = GET_MODE_SIZE(mode);
|
1764 |
|
|
+
|
1765 |
|
|
+ return (size + UNITS_PER_WORD - 1)/UNITS_PER_WORD;
|
1766 |
|
|
+}
|
1767 |
|
|
+
|
1768 |
|
|
+static void
|
1769 |
|
|
+zip_function_arg_advance(cumulative_args_t ca, machine_mode mode,
|
1770 |
|
|
+ const_tree type, bool named ATTRIBUTE_UNUSED) {
|
1771 |
|
|
+ CUMULATIVE_ARGS *cum;
|
1772 |
|
|
+ int nreg;
|
1773 |
|
|
+
|
1774 |
|
|
+ cum = get_cumulative_args(ca);
|
1775 |
|
|
+ nreg = zip_num_arg_regs(mode, type);
|
1776 |
|
|
+ if (((*cum)+nreg) > NUM_ARG_REGS)
|
1777 |
|
|
+ (*cum) = NUM_ARG_REGS;
|
1778 |
|
|
+ else
|
1779 |
|
|
+ (*cum) += nreg;
|
1780 |
|
|
+}
|
1781 |
|
|
+
|
1782 |
|
|
+static rtx
|
1783 |
|
|
+zip_function_arg(cumulative_args_t ca, machine_mode mode,
|
1784 |
|
|
+ const_tree type ATTRIBUTE_UNUSED, bool named) {
|
1785 |
|
|
+ CUMULATIVE_ARGS *cum;
|
1786 |
|
|
+
|
1787 |
|
|
+ if (!named)
|
1788 |
|
|
+ return NULL_RTX;
|
1789 |
|
|
+ cum = get_cumulative_args(ca);
|
1790 |
|
|
+
|
1791 |
|
|
+ if ((*cum) >= NUM_ARG_REGS)
|
1792 |
|
|
+ return NULL_RTX;
|
1793 |
|
|
+ return
|
1794 |
|
|
+ gen_rtx_REG(mode, (*cum)+1);
|
1795 |
|
|
+}
|
1796 |
|
|
+
|
1797 |
191 |
dgisselq |
+/* DECL is the declaration of the function being targeted by the call, and EXP
|
1798 |
|
|
+ * is the CALL_EXPR representing the call.
|
1799 |
|
|
+ */
|
1800 |
|
|
+bool zip_function_ok_for_sibcall(ATTRIBUTE_UNUSED tree decl, tree exp) {
|
1801 |
|
|
+ // calls.c already checks whether or not the parameter stack space
|
1802 |
|
|
+ // is identical, so ... let's hope this all works and find out.
|
1803 |
|
|
+
|
1804 |
|
|
+ //
|
1805 |
|
|
+ // Actually, this will fail: If the sibling uses R5 to pass registers
|
1806 |
|
|
+ // in and we don't, then there will be no way to restore R5. This is
|
1807 |
|
|
+ // true for the current configuration. It will be true for future
|
1808 |
|
|
+ // configurations if the sibling ever uses a register that must be
|
1809 |
|
|
+ // saved as a parameter register.
|
1810 |
|
|
+ //
|
1811 |
|
|
+ // We can check this ... if we can count how many registers the
|
1812 |
|
|
+ // sibling call will use.
|
1813 |
|
|
+ //
|
1814 |
|
|
+ CUMULATIVE_ARGS cum_v;
|
1815 |
|
|
+ cumulative_args_t cum;
|
1816 |
|
|
+ tree parameter;
|
1817 |
|
|
+ machine_mode mode;
|
1818 |
|
|
+ tree ttype;
|
1819 |
|
|
+ rtx parm_rtx;
|
1820 |
|
|
+ int i;
|
1821 |
|
|
+ static const char zip_call_used_register[] = CALL_USED_REGISTERS;
|
1822 |
|
|
+
|
1823 |
|
|
+ INIT_CUMULATIVE_ARGS(cum_v, NULL, NULL, 0,0);
|
1824 |
|
|
+ cum = pack_cumulative_args(&cum_v);
|
1825 |
|
|
+ for (i=0; i<call_expr_nargs(exp); i++) {
|
1826 |
|
|
+
|
1827 |
|
|
+ parameter = CALL_EXPR_ARG(exp, i);
|
1828 |
|
|
+
|
1829 |
|
|
+ if ((!parameter) || (TREE_CODE(parameter)==ERROR_MARK))
|
1830 |
|
|
+ return true;
|
1831 |
|
|
+ ttype = TREE_TYPE(parameter);
|
1832 |
|
|
+ gcc_assert(ttype);
|
1833 |
|
|
+ mode = ttype->type_common.mode;
|
1834 |
|
|
+
|
1835 |
|
|
+ if (pass_by_reference(&cum_v, mode, ttype, true)) {
|
1836 |
|
|
+ mode = Pmode;
|
1837 |
|
|
+ ttype = build_pointer_type(ttype);
|
1838 |
|
|
+ }
|
1839 |
|
|
+
|
1840 |
|
|
+ parm_rtx = zip_function_arg(cum, mode, ttype, 0);
|
1841 |
|
|
+ zip_function_arg_advance(cum, mode, ttype, 0);
|
1842 |
|
|
+ if (!parm_rtx)
|
1843 |
|
|
+ continue;
|
1844 |
|
|
+
|
1845 |
|
|
+ // If it is a register
|
1846 |
|
|
+ // and it is *NOT* a CALL_USED_REGISTER
|
1847 |
|
|
+ // then we can't do this.
|
1848 |
|
|
+ //
|
1849 |
|
|
+ // Example: func(R1,..R4,R5)
|
1850 |
|
|
+ // can be followed by func2(R1,.., up to R5)
|
1851 |
|
|
+ // (not supported, though... just to simplify our test
|
1852 |
|
|
+ // below)
|
1853 |
|
|
+ // Example: func(R1,..R4)
|
1854 |
|
|
+ // cannot be followed by func2(R1,..,R5)
|
1855 |
|
|
+ // We would blow R5 away by our prologue, even if it was
|
1856 |
|
|
+ // properly set.
|
1857 |
|
|
+ // Example: func(R1,..R5)
|
1858 |
|
|
+ // can be followed by func2(R1,.., up to R4)
|
1859 |
|
|
+ // func2 may save R5 (which doesn't need saving) but that's
|
1860 |
|
|
+ // irrelevant
|
1861 |
|
|
+ // Example: func(R1,..up to R4)
|
1862 |
|
|
+ // can be followed by func2(R1,.., up to R4)
|
1863 |
|
|
+ //
|
1864 |
|
|
+ if (REG_P(parm_rtx)&&(REGNO(parm_rtx))
|
1865 |
|
|
+ &&(REGNO(parm_rtx)<sizeof(zip_call_used_register))
|
1866 |
|
|
+ &&(!zip_call_used_register[REGNO(parm_rtx)]))
|
1867 |
|
|
+ return false;
|
1868 |
|
|
+ }
|
1869 |
|
|
+
|
1870 |
|
|
+ return true;
|
1871 |
|
|
+
|
1872 |
|
|
+ // We also need to check if the return types are the same ... or
|
1873 |
|
|
+ // will GCC handle that for us?
|
1874 |
|
|
+}
|
1875 |
|
|
+
|
1876 |
122 |
dgisselq |
+void zip_canonicalize_comparison(int *code, rtx *op0, rtx *op1,
|
1877 |
|
|
+ bool preserve_op0)
|
1878 |
|
|
+{
|
1879 |
202 |
dgisselq |
+ ZIPDEBUGFLAG(dbg, false);
|
1880 |
|
|
+ bool reverse = false;
|
1881 |
102 |
dgisselq |
+
|
1882 |
122 |
dgisselq |
+ if (dbg) fprintf(stderr, "CANONICALIZE ...%s\n", (preserve_op0)?"(Preserve Op0)":"");
|
1883 |
|
|
+ if (dbg) zip_debug_rtx_pfx("CODE", gen_rtx_fmt_ee((rtx_code)*code, VOIDmode, gen_rtx_REG(CCmode,zip_CC), const0_rtx));
|
1884 |
|
|
+ if (dbg) zip_debug_rtx_pfx("OP0 ", *op0);
|
1885 |
|
|
+ if (dbg) zip_debug_rtx_pfx("OP1 ", *op1);
|
1886 |
|
|
+
|
1887 |
202 |
dgisselq |
+ // Z -> Z
|
1888 |
|
|
+ // NZ -> !Z
|
1889 |
|
|
+ // LT -> N
|
1890 |
|
|
+ // GE -> !N
|
1891 |
|
|
+ // LTU -> C
|
1892 |
|
|
+ // GEU -> !C
|
1893 |
|
|
+ //
|
1894 |
|
|
+ // LTE -> GTE w/ swapped operands
|
1895 |
|
|
+ // GT -> LT w/ swapped operands
|
1896 |
|
|
+ // GTU -> LTU w/ swapped operands
|
1897 |
|
|
+ // LEU -> GEU w/ swapped operands
|
1898 |
|
|
+ //
|
1899 |
|
|
+
|
1900 |
|
|
+ if ((CONST_INT_P(*op0))||(GET_CODE(*op0) == PLUS)) {
|
1901 |
|
|
+ rtx tmp = *op0;
|
1902 |
122 |
dgisselq |
+ *op0 = *op1;
|
1903 |
202 |
dgisselq |
+ *op1 = tmp;
|
1904 |
122 |
dgisselq |
+ *code = (int)swap_condition((enum rtx_code)*code);
|
1905 |
|
|
+ }
|
1906 |
|
|
+
|
1907 |
202 |
dgisselq |
+ if (*code == GTU) {
|
1908 |
|
|
+ if (REG_P(*op1)) {
|
1909 |
|
|
+ //; Reverse the comparison
|
1910 |
|
|
+ reverse = true;
|
1911 |
|
|
+ } else if (CONST_INT_P(*op1)) {
|
1912 |
|
|
+ //; A > B
|
1913 |
|
|
+ //; A >= B+1
|
1914 |
|
|
+ //; Add one to the integer constant,
|
1915 |
|
|
+ //; And use a GEU comparison
|
1916 |
|
|
+ *code = GEU;
|
1917 |
|
|
+ *op1 = GEN_INT(INTVAL(*op1)+1);
|
1918 |
|
|
+ } else {
|
1919 |
|
|
+ //; Reverse the comparison
|
1920 |
|
|
+ reverse = true;
|
1921 |
122 |
dgisselq |
+ }
|
1922 |
202 |
dgisselq |
+ } else if (*code == LEU) {
|
1923 |
|
|
+ if (REG_P(*op1)) {
|
1924 |
|
|
+ reverse = true;
|
1925 |
|
|
+ } else if (CONST_INT_P(*op1)) {
|
1926 |
|
|
+ //; A <= B
|
1927 |
|
|
+ //; A < B+1
|
1928 |
|
|
+ //; Add one to the integer constant,
|
1929 |
|
|
+ //; And use a GTU comparison
|
1930 |
|
|
+ *op1 = GEN_INT(INTVAL(*op1)+1);
|
1931 |
|
|
+ *code = LTU;
|
1932 |
|
|
+ } else {
|
1933 |
|
|
+ reverse = true;
|
1934 |
|
|
+ }
|
1935 |
|
|
+ } else if (*code == LE) {
|
1936 |
|
|
+ if (REG_P(*op1)) {
|
1937 |
|
|
+ reverse = true;
|
1938 |
|
|
+ } else if (CONST_INT_P(*op1)) {
|
1939 |
|
|
+ //; A < B
|
1940 |
|
|
+ //; A <= B-1
|
1941 |
|
|
+ //; Add one to the integer constant,
|
1942 |
|
|
+ //; And use a GTU comparison
|
1943 |
|
|
+ *op1 = GEN_INT(INTVAL(*op1)-1);
|
1944 |
|
|
+ *code = LT;
|
1945 |
|
|
+ } else {
|
1946 |
|
|
+ reverse = true;
|
1947 |
|
|
+ }
|
1948 |
|
|
+ } else if (*code == GT) {
|
1949 |
|
|
+ if (REG_P(*op1)) {
|
1950 |
|
|
+ //; Reverse the comparison
|
1951 |
|
|
+ reverse = true;
|
1952 |
|
|
+ } else if (CONST_INT_P(*op1)) {
|
1953 |
|
|
+ //; A > B
|
1954 |
|
|
+ //; A >= B+1
|
1955 |
|
|
+ //; Add one to the integer constant,
|
1956 |
|
|
+ //; And use a GTU comparison
|
1957 |
|
|
+ *op1 = GEN_INT(INTVAL(*op1)+1);
|
1958 |
|
|
+ *code = GE;
|
1959 |
|
|
+ } else {
|
1960 |
|
|
+ reverse = true;
|
1961 |
|
|
+ }
|
1962 |
122 |
dgisselq |
+ }
|
1963 |
202 |
dgisselq |
+
|
1964 |
|
|
+ if (reverse) {
|
1965 |
|
|
+ rtx tem = *op0;
|
1966 |
|
|
+ *op0 = *op1;
|
1967 |
|
|
+ *op1 = tem;
|
1968 |
|
|
+ *code = (int)swap_condition((enum rtx_code)*code);
|
1969 |
|
|
+ }
|
1970 |
122 |
dgisselq |
+}
|
1971 |
|
|
+
|
1972 |
|
|
+static bool
|
1973 |
|
|
+zip_fixed_condition_code_regs(unsigned int *a, unsigned int *b) {
|
1974 |
|
|
+ *a = zip_CC;
|
1975 |
|
|
+ *b = INVALID_REGNUM;
|
1976 |
|
|
+ return true;
|
1977 |
|
|
+}
|
1978 |
|
|
+
|
1979 |
|
|
+
|
1980 |
102 |
dgisselq |
+/* totally buggy - we can't return pointers to nested functions */
|
1981 |
|
|
+static void
|
1982 |
202 |
dgisselq |
+zip_asm_trampoline_template(FILE *f)
|
1983 |
|
|
+{
|
1984 |
138 |
dgisselq |
+ fprintf(f, "\tbrev\t0,r1\n");
|
1985 |
|
|
+ fprintf(f, "\tldilo\t0,r1\n");
|
1986 |
102 |
dgisselq |
+ fprintf(f, "\tjmp r1\n");
|
1987 |
|
|
+}
|
1988 |
|
|
+
|
1989 |
|
|
+/* Worker function for TARGET_TRAMPOLINE_INIT. */
|
1990 |
|
|
+static void
|
1991 |
|
|
+zip_trampoline_init(rtx m_tramp ATTRIBUTE_UNUSED,
|
1992 |
|
|
+ tree fndecl ATTRIBUTE_UNUSED,
|
1993 |
|
|
+ rtx chain_value ATTRIBUTE_UNUSED) {
|
1994 |
|
|
+// #warning "This needs to be filled out"
|
1995 |
|
|
+ abort();
|
1996 |
|
|
+}
|
1997 |
|
|
+
|
1998 |
|
|
+static tree
|
1999 |
|
|
+def_builtin(const char *name, enum insn_code icode, enum ZIP_BUILTIN_ID_CODE code,
|
2000 |
|
|
+ tree type)
|
2001 |
|
|
+{
|
2002 |
202 |
dgisselq |
+ tree t = add_builtin_function(name,type,code, BUILT_IN_MD, NULL, NULL_TREE);
|
2003 |
102 |
dgisselq |
+
|
2004 |
|
|
+ if(t) {
|
2005 |
|
|
+ zip_builtins[code] = t;
|
2006 |
|
|
+ zip_builtins_icode[code] = icode;
|
2007 |
|
|
+ }
|
2008 |
|
|
+
|
2009 |
|
|
+ return t;
|
2010 |
|
|
+
|
2011 |
|
|
+}
|
2012 |
|
|
+
|
2013 |
|
|
+void zip_init_builtins(void) {
|
2014 |
|
|
+
|
2015 |
|
|
+ tree void_ftype_void = build_function_type_list(void_type_node, NULL_TREE);
|
2016 |
|
|
+#ifdef HAVE_zip_rtu
|
2017 |
|
|
+ def_builtin("zip_rtu", CODE_FOR_zip_rtu, ZIP_BUILTIN_RTU, void_ftype_void);
|
2018 |
|
|
+#endif
|
2019 |
|
|
+#ifdef HAVE_zip_halt
|
2020 |
|
|
+ def_builtin("zip_halt", CODE_FOR_zip_halt, ZIP_BUILTIN_HALT, void_ftype_void);
|
2021 |
|
|
+#endif
|
2022 |
171 |
dgisselq |
+#ifdef HAVE_zip_busy
|
2023 |
|
|
+ def_builtin("zip_busy", CODE_FOR_zip_busy, ZIP_BUILTIN_BUSY, void_ftype_void);
|
2024 |
|
|
+#endif
|
2025 |
102 |
dgisselq |
+#ifdef HAVE_zip_idle
|
2026 |
|
|
+ def_builtin("zip_idle", CODE_FOR_zip_idle, ZIP_BUILTIN_IDLE, void_ftype_void);
|
2027 |
|
|
+#endif
|
2028 |
|
|
+
|
2029 |
|
|
+#ifdef HAVE_zip_syscall
|
2030 |
|
|
+// Support int SYSCALL(callID, int a, int b, int c);
|
2031 |
|
|
+ def_builtin("zip_syscall", CODE_FOR_zip_syscall, ZIP_BUILTIN_SYSCALL,
|
2032 |
|
|
+ build_function_type_list(void_type_node, NULL_TREE));
|
2033 |
|
|
+#endif
|
2034 |
|
|
+
|
2035 |
|
|
+#ifdef HAVE_zip_save_context
|
2036 |
|
|
+ def_builtin("zip_save_context", CODE_FOR_zip_save_context, ZIP_BUILTIN_SAVE_CONTEXT,
|
2037 |
|
|
+ build_function_type_list(void_type_node, ptr_type_node, 0));
|
2038 |
|
|
+#endif
|
2039 |
|
|
+
|
2040 |
|
|
+#ifdef HAVE_zip_restore_context
|
2041 |
|
|
+ def_builtin("zip_restore_context", CODE_FOR_zip_restore_context, ZIP_BUILTIN_RESTORE_CONTEXT,
|
2042 |
|
|
+ build_function_type_list(void_type_node, ptr_type_node, 0));
|
2043 |
|
|
+#endif
|
2044 |
|
|
+
|
2045 |
|
|
+#ifdef HAVE_zip_bitrev
|
2046 |
|
|
+ def_builtin("zip_bitrev", CODE_FOR_zip_bitrev, ZIP_BUILTIN_BITREV,
|
2047 |
|
|
+ build_function_type_list(unsigned_type_node, unsigned_type_node,
|
2048 |
|
|
+ NULL_TREE));
|
2049 |
|
|
+#endif
|
2050 |
|
|
+
|
2051 |
|
|
+#ifdef HAVE_zip_cc
|
2052 |
|
|
+ def_builtin("zip_cc", CODE_FOR_zip_cc, ZIP_BUILTIN_CC,
|
2053 |
|
|
+ build_function_type_list(unsigned_type_node, NULL_TREE));
|
2054 |
|
|
+#endif
|
2055 |
|
|
+
|
2056 |
117 |
dgisselq |
+#ifdef HAVE_zip_ucc
|
2057 |
|
|
+ def_builtin("zip_ucc", CODE_FOR_zip_ucc, ZIP_BUILTIN_UCC,
|
2058 |
|
|
+ build_function_type_list(unsigned_type_node, NULL_TREE));
|
2059 |
|
|
+#endif
|
2060 |
|
|
+
|
2061 |
102 |
dgisselq |
+}
|
2062 |
|
|
+
|
2063 |
|
|
+static tree
|
2064 |
|
|
+zip_builtin_decl(unsigned zip_builtin_code, bool initialize_p ATTRIBUTE_UNUSED)
|
2065 |
|
|
+{
|
2066 |
|
|
+ if (zip_builtin_code >= ZIP_BUILTIN_MAX)
|
2067 |
|
|
+ return error_mark_node;
|
2068 |
|
|
+
|
2069 |
|
|
+ return zip_builtins[zip_builtin_code];
|
2070 |
|
|
+}
|
2071 |
|
|
+
|
2072 |
|
|
+static rtx
|
2073 |
|
|
+zip_expand_builtin(tree exp, rtx target,
|
2074 |
|
|
+ rtx subtarget ATTRIBUTE_UNUSED,
|
2075 |
|
|
+ machine_mode tmode ATTRIBUTE_UNUSED,
|
2076 |
202 |
dgisselq |
+ int ignore ATTRIBUTE_UNUSED)
|
2077 |
|
|
+{
|
2078 |
102 |
dgisselq |
+ tree fndecl = TREE_OPERAND(CALL_EXPR_FN(exp), 0);
|
2079 |
|
|
+ bool nonvoid = (TREE_TYPE(TREE_TYPE(fndecl)) != void_type_node);
|
2080 |
|
|
+ enum ZIP_BUILTIN_ID_CODE code=(enum ZIP_BUILTIN_ID_CODE)DECL_FUNCTION_CODE(fndecl);
|
2081 |
|
|
+ enum insn_code icode = zip_builtins_icode[code];
|
2082 |
|
|
+ rtx pat, op[5];
|
2083 |
|
|
+ call_expr_arg_iterator iter;
|
2084 |
|
|
+ tree arg;
|
2085 |
|
|
+
|
2086 |
|
|
+ if ((code == ZIP_BUILTIN_SAVE_CONTEXT)
|
2087 |
|
|
+ ||(code == ZIP_BUILTIN_RESTORE_CONTEXT)) {
|
2088 |
|
|
+ arg = first_call_expr_arg(exp, &iter);
|
2089 |
|
|
+ if (arg == error_mark_node)
|
2090 |
|
|
+ return NULL_RTX;
|
2091 |
|
|
+ op[0] = expand_normal(arg);
|
2092 |
|
|
+ if (GET_CODE(op[0]) != REG)
|
2093 |
|
|
+ op[0] = force_reg(Pmode, op[0]);
|
2094 |
|
|
+ pat = GEN_FCN(icode)(op[0]);
|
2095 |
|
|
+ } else if (code == ZIP_BUILTIN_BITREV) {
|
2096 |
|
|
+ arg = first_call_expr_arg(exp, &iter);
|
2097 |
|
|
+ if (arg == error_mark_node) {
|
2098 |
|
|
+ return NULL_RTX;
|
2099 |
|
|
+ }
|
2100 |
|
|
+ op[0] = expand_normal(arg);
|
2101 |
|
|
+ if (!target)
|
2102 |
|
|
+ target = gen_reg_rtx(SImode);
|
2103 |
|
|
+ pat = GEN_FCN(icode)(target, op[0]);
|
2104 |
117 |
dgisselq |
+ } else if ((code == ZIP_BUILTIN_CC)||(code == ZIP_BUILTIN_UCC)) {
|
2105 |
102 |
dgisselq |
+ if (!target)
|
2106 |
|
|
+ target = gen_reg_rtx(SImode);
|
2107 |
|
|
+ pat = GEN_FCN(icode)(target);
|
2108 |
|
|
+ } else // RTU, HALT, IDLE
|
2109 |
|
|
+ pat = GEN_FCN(icode)();
|
2110 |
|
|
+ if (!pat)
|
2111 |
|
|
+ return NULL_RTX;
|
2112 |
|
|
+ emit_insn(pat);
|
2113 |
|
|
+ return (nonvoid ? target : const0_rtx);
|
2114 |
|
|
+}
|
2115 |
|
|
+
|
2116 |
|
|
+static bool
|
2117 |
202 |
dgisselq |
+zip_scalar_mode_supported_p(enum machine_mode mode)
|
2118 |
|
|
+{
|
2119 |
|
|
+ if ((ZIP_HAS_DI)&&(mode == DImode))
|
2120 |
|
|
+ return true;
|
2121 |
|
|
+ if ((mode==SImode)||(mode==HImode)||(mode==QImode))
|
2122 |
|
|
+ return true;
|
2123 |
|
|
+ if (mode==SFmode) // &&(ZIP_FPU)
|
2124 |
|
|
+ return true; // If (!ZIP_CPU), will need to be emulated
|
2125 |
|
|
+ if (mode==DFmode) // Must always be emulated
|
2126 |
|
|
+ return true;
|
2127 |
|
|
+ return false;
|
2128 |
102 |
dgisselq |
+}
|
2129 |
|
|
+
|
2130 |
|
|
+static bool
|
2131 |
202 |
dgisselq |
+zip_libgcc_floating_mode_supported_p(enum machine_mode mode)
|
2132 |
|
|
+{
|
2133 |
102 |
dgisselq |
+ return ((mode)==SFmode)||((mode)==DFmode);
|
2134 |
|
|
+}
|
2135 |
|
|
+
|
2136 |
|
|
+static int
|
2137 |
|
|
+zip_address_cost(rtx addr ATTRIBUTE_UNUSED,
|
2138 |
|
|
+ enum machine_mode mode ATTRIBUTE_UNUSED,
|
2139 |
|
|
+ addr_space_t as ATTRIBUTE_UNUSED, bool spd ATTRIBUTE_UNUSED) {
|
2140 |
|
|
+ return 1;
|
2141 |
|
|
+}
|
2142 |
|
|
+
|
2143 |
|
|
+static bool
|
2144 |
|
|
+zip_mode_dependent_address_p(const_rtx addr ATTRIBUTE_UNUSED,
|
2145 |
|
|
+ addr_space_t as ATTRIBUTE_UNUSED) {
|
2146 |
|
|
+ return false;
|
2147 |
|
|
+}
|
2148 |
|
|
+
|
2149 |
|
|
+static void
|
2150 |
|
|
+zip_debug_print(const char *pfx, int lvl, const char *str) {
|
2151 |
|
|
+ int i;
|
2152 |
|
|
+ i = lvl;
|
2153 |
|
|
+ if ((true)||(lvl == 0))
|
2154 |
|
|
+ fprintf(stderr, "%s", pfx);
|
2155 |
|
|
+ else
|
2156 |
|
|
+ i += strlen(pfx);
|
2157 |
|
|
+ while(i-->0)
|
2158 |
|
|
+ fprintf(stderr, " ");
|
2159 |
|
|
+ fprintf(stderr, "%s\n", str);
|
2160 |
|
|
+}
|
2161 |
|
|
+
|
2162 |
|
|
+static void
|
2163 |
|
|
+zip_debug_print_m(const char *pfx, int lvl, const char *str, enum machine_mode m) {
|
2164 |
|
|
+ int i;
|
2165 |
|
|
+
|
2166 |
|
|
+ i = lvl;
|
2167 |
|
|
+ if ((true)||(lvl == 0))
|
2168 |
|
|
+ fprintf(stderr, "%s", pfx);
|
2169 |
|
|
+ else
|
2170 |
|
|
+ i = lvl+strlen(pfx);
|
2171 |
|
|
+ while(i-->0)
|
2172 |
|
|
+ fprintf(stderr, " ");
|
2173 |
|
|
+ switch(m) {
|
2174 |
|
|
+ case VOIDmode:
|
2175 |
|
|
+ fprintf(stderr, "%s:V\n", str);
|
2176 |
|
|
+ break;
|
2177 |
|
|
+ case BLKmode:
|
2178 |
|
|
+ fprintf(stderr, "%s:BLK\n", str);
|
2179 |
|
|
+ break;
|
2180 |
|
|
+ case BImode:
|
2181 |
|
|
+ fprintf(stderr, "%s:BI\n", str);
|
2182 |
|
|
+ break;
|
2183 |
|
|
+ case QImode:
|
2184 |
|
|
+ fprintf(stderr, "%s:QI\n", str);
|
2185 |
|
|
+ break;
|
2186 |
|
|
+ case HImode:
|
2187 |
|
|
+ fprintf(stderr, "%s:HI\n", str);
|
2188 |
|
|
+ break;
|
2189 |
202 |
dgisselq |
+#ifdef HAVE_SImode
|
2190 |
102 |
dgisselq |
+ case SImode:
|
2191 |
|
|
+ fprintf(stderr, "%s:SI\n", str);
|
2192 |
|
|
+ break;
|
2193 |
202 |
dgisselq |
+#endif
|
2194 |
|
|
+#ifdef HAVE_DImode
|
2195 |
|
|
+ case DImode:
|
2196 |
|
|
+ fprintf(stderr, "%s:DI\n", str);
|
2197 |
|
|
+ break;
|
2198 |
|
|
+#endif
|
2199 |
122 |
dgisselq |
+ case CCmode:
|
2200 |
|
|
+ fprintf(stderr, "%s:CC\n", str);
|
2201 |
|
|
+ break;
|
2202 |
102 |
dgisselq |
+ default:
|
2203 |
|
|
+ fprintf(stderr, "%s:?\n", str);
|
2204 |
|
|
+ }
|
2205 |
|
|
+}
|
2206 |
|
|
+
|
2207 |
|
|
+static void
|
2208 |
|
|
+zip_debug_rtx_1(const char *pfx, const_rtx x, int lvl) {
|
2209 |
|
|
+ if (x == NULL_RTX) {
|
2210 |
|
|
+ zip_debug_print(pfx, lvl, "(NULL-RTX)");
|
2211 |
|
|
+ return;
|
2212 |
|
|
+ } else if (GET_CODE(x) > NUM_RTX_CODE) {
|
2213 |
|
|
+ char buf[64];
|
2214 |
|
|
+ sprintf(buf, "(BAD-RTX-CODE %d)", GET_CODE(x));
|
2215 |
|
|
+ zip_debug_print(pfx, lvl, buf);
|
2216 |
117 |
dgisselq |
+ gcc_assert(0 && "Bad RTX Code");
|
2217 |
102 |
dgisselq |
+ return;
|
2218 |
|
|
+ } switch(GET_CODE(x)) { // rtl.def
|
2219 |
122 |
dgisselq |
+ case PARALLEL:
|
2220 |
|
|
+ zip_debug_print(pfx, lvl, "(PARALLEL");
|
2221 |
202 |
dgisselq |
+ if (XVEC(x,0) != NULL)
|
2222 |
|
|
+ for(int j=0; j<XVECLEN(x,0);j++)
|
2223 |
|
|
+ zip_debug_rtx_1(pfx, XVECEXP(x,0,j), lvl+1);
|
2224 |
122 |
dgisselq |
+ zip_debug_print(pfx, lvl, ")");
|
2225 |
|
|
+ debug_rtx(x);
|
2226 |
|
|
+ break;
|
2227 |
102 |
dgisselq |
+ case INT_LIST: zip_debug_print(pfx, lvl, "(INT-LIST"); break;
|
2228 |
122 |
dgisselq |
+ case SEQUENCE:
|
2229 |
|
|
+ zip_debug_print(pfx, lvl, "(SEQUENCE");
|
2230 |
|
|
+ for(int j=0; j<XVECLEN(x,0);j++)
|
2231 |
|
|
+ zip_debug_rtx_1(pfx, XVECEXP(x,0,j), lvl+1);
|
2232 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2233 |
|
|
+ debug_rtx(x);
|
2234 |
|
|
+ break;
|
2235 |
102 |
dgisselq |
+ case ADDRESS: zip_debug_print(pfx, lvl, "(ADDRESS"); break;
|
2236 |
|
|
+ case DEBUG_INSN: zip_debug_print(pfx, lvl, "(DEBUG-INSN"); break;
|
2237 |
|
|
+ case INSN:
|
2238 |
|
|
+ zip_debug_print(pfx, lvl, "(INSN");
|
2239 |
|
|
+ /*
|
2240 |
|
|
+ { const rtx_insn *tmp_rtx;
|
2241 |
|
|
+ for(tmp_rtx = as_a <const rtx_insn *>(x); tmp_rtx != 0; tmp_rtx = NEXT_INSN(tmp_rtx)) {
|
2242 |
|
|
+ zip_debug_rtx_1(tmp_rtx, lvl+1);
|
2243 |
|
|
+ }}
|
2244 |
|
|
+ */
|
2245 |
|
|
+ zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
|
2246 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2247 |
117 |
dgisselq |
+ debug_rtx(x);
|
2248 |
102 |
dgisselq |
+ break;
|
2249 |
|
|
+ case JUMP_INSN: zip_debug_print(pfx, lvl, "(JUMP-INSN");
|
2250 |
111 |
dgisselq |
+ zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
|
2251 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2252 |
|
|
+ /*
|
2253 |
102 |
dgisselq |
+ if (JUMP_LABEL(x)) {
|
2254 |
111 |
dgisselq |
+ if (GET_CODE(JUMP_LABEL(x)) == LABEL_REF) {
|
2255 |
|
|
+ char buf[64];
|
2256 |
|
|
+ sprintf(buf, "(LABEL *.L%d))", CODE_LABEL_NUMBER(LABEL_REF_LABEL(JUMP_LABEL(x))));
|
2257 |
|
|
+ zip_debug_print(pfx, lvl+1, buf);
|
2258 |
|
|
+ } else if (GET_CODE(JUMP_LABEL(x))==CODE_LABEL) {
|
2259 |
|
|
+ char buf[64];
|
2260 |
|
|
+ sprintf(buf, "(CODE_LABEL *.L%d))", CODE_LABEL_NUMBER(JUMP_LABEL(x)));
|
2261 |
|
|
+ zip_debug_print(pfx, lvl+1, buf);
|
2262 |
|
|
+ } else
|
2263 |
|
|
+ zip_debug_print(pfx, lvl+1, "(w/Label))");
|
2264 |
102 |
dgisselq |
+ } else
|
2265 |
111 |
dgisselq |
+ zip_debug_print(pfx, lvl+1, "(NO label))");
|
2266 |
|
|
+ debug_rtx(x);
|
2267 |
|
|
+ */
|
2268 |
102 |
dgisselq |
+ break;
|
2269 |
|
|
+ case CALL:
|
2270 |
|
|
+ zip_debug_print(pfx, lvl, "(CALL (Adr) (Args)");
|
2271 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0), lvl+1);
|
2272 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1), lvl+1);
|
2273 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2274 |
|
|
+ break;
|
2275 |
|
|
+ case CALL_INSN: zip_debug_print(pfx, lvl, "(CALL-INSN");
|
2276 |
|
|
+ debug_rtx(x);
|
2277 |
|
|
+ break;
|
2278 |
|
|
+ case BARRIER: zip_debug_print(pfx, lvl, "(BARRIER)"); break;
|
2279 |
|
|
+ case RETURN: zip_debug_print(pfx, lvl, "(RETURN)"); break;
|
2280 |
|
|
+ case NOTE:
|
2281 |
|
|
+ { char buf[128];
|
2282 |
|
|
+ sprintf(buf, "(NOTE %s)", GET_REG_NOTE_NAME(GET_MODE(x)));
|
2283 |
|
|
+ zip_debug_print(pfx, lvl, buf);
|
2284 |
|
|
+ }break;
|
2285 |
|
|
+ case COND_EXEC: zip_debug_print(pfx, lvl, "(COND_EXEC)");
|
2286 |
|
|
+ debug_rtx(x);
|
2287 |
|
|
+ break;
|
2288 |
|
|
+ case ASM_INPUT: zip_debug_print(pfx, lvl, "(ASM INPUT)"); break;
|
2289 |
|
|
+ case ASM_OPERANDS: zip_debug_print(pfx, lvl, "(ASM OPERANDS)"); break;
|
2290 |
|
|
+ case UNSPEC: zip_debug_print(pfx, lvl, "(UNSPEC)"); break;
|
2291 |
|
|
+ case UNSPEC_VOLATILE: zip_debug_print(pfx, lvl, "(UNSPEC_VOLATILE)"); break;
|
2292 |
|
|
+ case CODE_LABEL:
|
2293 |
|
|
+ {
|
2294 |
192 |
dgisselq |
+ char buf[128];
|
2295 |
111 |
dgisselq |
+ sprintf(buf, "(CODE_LABEL *.L%d)", CODE_LABEL_NUMBER(x));
|
2296 |
102 |
dgisselq |
+ zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
|
2297 |
|
|
+ } break;
|
2298 |
|
|
+ case SET:
|
2299 |
|
|
+ zip_debug_print_m(pfx, lvl, "(SET", GET_MODE(x));
|
2300 |
117 |
dgisselq |
+ zip_debug_rtx_1(pfx, SET_DEST(x),lvl+1);
|
2301 |
|
|
+ zip_debug_rtx_1(pfx, SET_SRC(x),lvl+1);
|
2302 |
102 |
dgisselq |
+ zip_debug_print(pfx, lvl, ")");
|
2303 |
117 |
dgisselq |
+ debug_rtx(x);
|
2304 |
102 |
dgisselq |
+ break;
|
2305 |
122 |
dgisselq |
+ case REG: {
|
2306 |
127 |
dgisselq |
+ char buf[25], mstr[4];
|
2307 |
|
|
+ mstr[0] = '\0';
|
2308 |
202 |
dgisselq |
+ if (GET_MODE(x) == QImode)
|
2309 |
|
|
+ strcpy(mstr, ":QI");
|
2310 |
|
|
+ else if (GET_MODE(x) == HImode)
|
2311 |
|
|
+ strcpy(mstr, ":HI");
|
2312 |
127 |
dgisselq |
+ else if (GET_MODE(x) == VOIDmode)
|
2313 |
|
|
+ strcpy(mstr, ":V");
|
2314 |
102 |
dgisselq |
+ if (REGNO(x) == zip_PC)
|
2315 |
127 |
dgisselq |
+ sprintf(buf, "(PC%s)", mstr);
|
2316 |
102 |
dgisselq |
+ else if (REGNO(x) == zip_CC)
|
2317 |
127 |
dgisselq |
+ sprintf(buf, "(CC%s)", mstr);
|
2318 |
102 |
dgisselq |
+ else if (REGNO(x) == zip_SP)
|
2319 |
127 |
dgisselq |
+ sprintf(buf, "(SP%s)", mstr);
|
2320 |
102 |
dgisselq |
+ else if (REGNO(x) == zip_FP)
|
2321 |
127 |
dgisselq |
+ sprintf(buf, "(REG%s FP)", mstr);
|
2322 |
102 |
dgisselq |
+ else if (REGNO(x) == zip_GOT)
|
2323 |
127 |
dgisselq |
+ sprintf(buf, "(REG%s GBL)", mstr);
|
2324 |
102 |
dgisselq |
+ else if (FUNCTION_VALUE_REGNO_P(REGNO(x)))
|
2325 |
127 |
dgisselq |
+ sprintf(buf, "(REG%s RTN-VL)", mstr);
|
2326 |
102 |
dgisselq |
+ else if (REGNO(x) == RETURN_ADDRESS_REGNUM)
|
2327 |
127 |
dgisselq |
+ sprintf(buf, "(REG%s RTN-AD)", mstr);
|
2328 |
122 |
dgisselq |
+ else
|
2329 |
127 |
dgisselq |
+ sprintf(buf, "(REG%s %d)", mstr, REGNO(x));
|
2330 |
|
|
+ if (mstr[0])
|
2331 |
|
|
+ zip_debug_print(pfx, lvl, buf);
|
2332 |
|
|
+ else
|
2333 |
|
|
+ zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
|
2334 |
102 |
dgisselq |
+ } break;
|
2335 |
|
|
+ case IF_THEN_ELSE: // 51
|
2336 |
|
|
+ zip_debug_print(pfx, lvl, "(IF-THEN-ELSE");
|
2337 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2338 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2339 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,2),lvl+1);
|
2340 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2341 |
|
|
+ break;
|
2342 |
|
|
+ case PC:
|
2343 |
|
|
+ zip_debug_print(pfx, lvl, "(PC)");
|
2344 |
|
|
+ break;
|
2345 |
|
|
+ case CC0:
|
2346 |
|
|
+ zip_debug_print(pfx, lvl, "(CC0)");
|
2347 |
|
|
+ break;
|
2348 |
|
|
+ case COMPARE:
|
2349 |
127 |
dgisselq |
+ zip_debug_print_m(pfx, lvl, "(COMPARE", GET_MODE(x));
|
2350 |
102 |
dgisselq |
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2351 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2352 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2353 |
|
|
+ break;
|
2354 |
111 |
dgisselq |
+ case CONST:
|
2355 |
|
|
+ zip_debug_print_m(pfx, lvl, "(CONST", GET_MODE(x));
|
2356 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2357 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2358 |
|
|
+ break;
|
2359 |
102 |
dgisselq |
+ case CONST_INT:
|
2360 |
192 |
dgisselq |
+ { char buf[128];
|
2361 |
202 |
dgisselq |
+ if (GET_MODE(x)==QImode)
|
2362 |
|
|
+ sprintf(buf, "(CONST_INT:QI %ld)", (long)INTVAL(x));
|
2363 |
102 |
dgisselq |
+ else if (GET_MODE(x)==VOIDmode)
|
2364 |
202 |
dgisselq |
+ sprintf(buf, "(CONST_INT:V %ld, %016lx)", (long)INTVAL(x),
|
2365 |
|
|
+ (unsigned long)INTVAL(x));
|
2366 |
102 |
dgisselq |
+ else
|
2367 |
135 |
dgisselq |
+ sprintf(buf, "(CONST_INT:? %ld)", (long)INTVAL(x));
|
2368 |
102 |
dgisselq |
+ zip_debug_print(pfx, lvl, buf);
|
2369 |
|
|
+ } break;
|
2370 |
|
|
+ case LABEL_REF:
|
2371 |
122 |
dgisselq |
+ { char buf[256];
|
2372 |
111 |
dgisselq |
+ sprintf(buf, "(LABEL *.L%d)", CODE_LABEL_NUMBER(LABEL_REF_LABEL(x)));
|
2373 |
|
|
+ zip_debug_print(pfx, lvl, buf);
|
2374 |
|
|
+ }
|
2375 |
102 |
dgisselq |
+ break;
|
2376 |
|
|
+ case SYMBOL_REF:
|
2377 |
|
|
+ {
|
2378 |
202 |
dgisselq |
+ char buf[1024];
|
2379 |
102 |
dgisselq |
+ sprintf(buf, "(SYMBOL: %s)", XSTR(x,0));
|
2380 |
|
|
+ // fprintf(file, "%s", XSTR(x,0));
|
2381 |
|
|
+ zip_debug_print(pfx, lvl, buf);
|
2382 |
|
|
+ }
|
2383 |
|
|
+ break;
|
2384 |
|
|
+ case MEM:
|
2385 |
|
|
+ zip_debug_print_m(pfx, lvl, "(MEM", GET_MODE(x));
|
2386 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2387 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2388 |
|
|
+ break;
|
2389 |
|
|
+ /*
|
2390 |
|
|
+ case VALUE:
|
2391 |
|
|
+ {
|
2392 |
|
|
+ char buf[64];
|
2393 |
|
|
+ sprintf(buf, "(VALUE: %d)", INTVAL(XEXP,0));
|
2394 |
|
|
+ zip_debug_print_m(pfx, lvl, "buf", GET_MODE(x));
|
2395 |
|
|
+ }
|
2396 |
|
|
+ break;
|
2397 |
|
|
+ */
|
2398 |
|
|
+ case PLUS:
|
2399 |
|
|
+ zip_debug_print_m(pfx, lvl, "(PLUS", GET_MODE(x));
|
2400 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2401 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2402 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2403 |
|
|
+ break;
|
2404 |
|
|
+ case MINUS:
|
2405 |
|
|
+ zip_debug_print_m(pfx, lvl, "(MINUS", GET_MODE(x));
|
2406 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2407 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2408 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2409 |
|
|
+ break;
|
2410 |
|
|
+ case AND:
|
2411 |
|
|
+ zip_debug_print_m(pfx, lvl, "(AND", GET_MODE(x));
|
2412 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2413 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2414 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2415 |
|
|
+ break;
|
2416 |
|
|
+ case IOR:
|
2417 |
|
|
+ zip_debug_print_m(pfx, lvl, "(OR", GET_MODE(x));
|
2418 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2419 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2420 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2421 |
|
|
+ break;
|
2422 |
|
|
+ case XOR:
|
2423 |
|
|
+ zip_debug_print_m(pfx, lvl, "(XOR", GET_MODE(x));
|
2424 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2425 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2426 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2427 |
|
|
+ break;
|
2428 |
|
|
+ case MULT:
|
2429 |
|
|
+ zip_debug_print_m(pfx, lvl, "(MULT", GET_MODE(x));
|
2430 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2431 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2432 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2433 |
|
|
+ break;
|
2434 |
|
|
+ case EQ: //
|
2435 |
|
|
+ zip_debug_print_m(pfx, lvl, "(EQ", GET_MODE(x));
|
2436 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2437 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2438 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2439 |
|
|
+ break;
|
2440 |
|
|
+ case NE: //
|
2441 |
|
|
+ zip_debug_print_m(pfx, lvl, "(NE", GET_MODE(x));
|
2442 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2443 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2444 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2445 |
|
|
+ break;
|
2446 |
|
|
+ case GE: //
|
2447 |
|
|
+ zip_debug_print_m(pfx, lvl, "(GE", GET_MODE(x));
|
2448 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2449 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2450 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2451 |
|
|
+ break;
|
2452 |
|
|
+ case GT: //
|
2453 |
|
|
+ zip_debug_print_m(pfx, lvl, "(GT", GET_MODE(x));
|
2454 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2455 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2456 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2457 |
|
|
+ break;
|
2458 |
|
|
+ case LE: //
|
2459 |
|
|
+ zip_debug_print_m(pfx, lvl, "(LE", GET_MODE(x));
|
2460 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2461 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2462 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2463 |
|
|
+ break;
|
2464 |
|
|
+ case LT: //
|
2465 |
|
|
+ zip_debug_print_m(pfx, lvl, "(LT", GET_MODE(x));
|
2466 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2467 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2468 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2469 |
|
|
+ break;
|
2470 |
|
|
+ case GEU: //
|
2471 |
|
|
+ zip_debug_print_m(pfx, lvl, "(GEU", GET_MODE(x));
|
2472 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2473 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2474 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2475 |
|
|
+ break;
|
2476 |
|
|
+ case GTU: //
|
2477 |
|
|
+ zip_debug_print_m(pfx, lvl, "(GTU", GET_MODE(x));
|
2478 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2479 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2480 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2481 |
|
|
+ break;
|
2482 |
|
|
+ case LEU: //
|
2483 |
|
|
+ zip_debug_print_m(pfx, lvl, "(LEU", GET_MODE(x));
|
2484 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2485 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2486 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2487 |
|
|
+ break;
|
2488 |
|
|
+ case LTU: //
|
2489 |
|
|
+ zip_debug_print_m(pfx, lvl, "(LTU", GET_MODE(x));
|
2490 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2491 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2492 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2493 |
|
|
+ break;
|
2494 |
|
|
+ case SCRATCH: //
|
2495 |
|
|
+ zip_debug_print_m(pfx, lvl, "(SCRATCH)", GET_MODE(x));
|
2496 |
|
|
+ break;
|
2497 |
|
|
+ case SUBREG:
|
2498 |
202 |
dgisselq |
+ { char buf[64], mstr[8];
|
2499 |
|
|
+ if (GET_MODE(x) == QImode)
|
2500 |
|
|
+ strcpy(mstr, ":QI");
|
2501 |
|
|
+ else if (GET_MODE(x) == HImode)
|
2502 |
|
|
+ strcpy(mstr, ":HI");
|
2503 |
|
|
+ else if (GET_MODE(x) == SImode)
|
2504 |
|
|
+ strcpy(mstr, ":SI");
|
2505 |
|
|
+ else if (GET_MODE(x) == VOIDmode)
|
2506 |
|
|
+ strcpy(mstr, ":V");
|
2507 |
|
|
+ else
|
2508 |
|
|
+ strcpy(mstr, ":?");
|
2509 |
111 |
dgisselq |
+ if (REG_P(XEXP(x,0))) {
|
2510 |
202 |
dgisselq |
+ int hreg = REGNO(XEXP(x,0)), mod = GET_MODE(XEXP(x,0)),
|
2511 |
|
|
+ sb = SUBREG_BYTE(x);
|
2512 |
|
|
+ if (mod==QImode)
|
2513 |
|
|
+ sprintf(buf,"(SUBREG%s (REG:QI %d)/%d)",mstr,hreg, sb);
|
2514 |
|
|
+ else if (mod==HImode)
|
2515 |
|
|
+ sprintf(buf,"(SUBREG%s (REG:HI %d)/%d)",mstr,hreg, sb);
|
2516 |
|
|
+ else if (mod==QImode)
|
2517 |
|
|
+ sprintf(buf,"(SUBREG%s (REG:QI %d)/%d)",mstr,hreg, sb);
|
2518 |
|
|
+ else if (mod==VOIDmode)
|
2519 |
|
|
+ sprintf(buf,"(SUBREG%s (REG:V %d)/%d)",mstr,hreg, sb);
|
2520 |
|
|
+ else
|
2521 |
|
|
+ sprintf(buf,"(SUBREG%s %d:?/%d)",mstr,hreg, sb);
|
2522 |
111 |
dgisselq |
+ zip_debug_print(pfx, lvl, buf);
|
2523 |
|
|
+ } else if (MEM_P(XEXP(x,0))) {
|
2524 |
202 |
dgisselq |
+ sprintf(buf, "(SUBREG%s /%d", mstr,SUBREG_BYTE(x));
|
2525 |
111 |
dgisselq |
+ zip_debug_print(pfx, lvl, buf);
|
2526 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2527 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2528 |
|
|
+ } else {
|
2529 |
202 |
dgisselq |
+ sprintf(buf, "(SUBREG%s UNK /%d", mstr,SUBREG_BYTE(x));
|
2530 |
111 |
dgisselq |
+ zip_debug_print(pfx, lvl, buf);
|
2531 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2532 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2533 |
|
|
+ }}
|
2534 |
|
|
+ break;
|
2535 |
127 |
dgisselq |
+ case ASHIFT:
|
2536 |
|
|
+ zip_debug_print_m(pfx, lvl, "(ASHIFT", GET_MODE(x));
|
2537 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2538 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2539 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2540 |
|
|
+ break;
|
2541 |
|
|
+ case ASHIFTRT:
|
2542 |
|
|
+ zip_debug_print_m(pfx, lvl, "(ASHIFTRT", GET_MODE(x));
|
2543 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2544 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2545 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2546 |
|
|
+ break;
|
2547 |
|
|
+ case LSHIFTRT:
|
2548 |
|
|
+ zip_debug_print_m(pfx, lvl, "(LSHIFTRT", GET_MODE(x));
|
2549 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2550 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
|
2551 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2552 |
|
|
+ break;
|
2553 |
202 |
dgisselq |
+ case ZERO_EXTRACT:
|
2554 |
|
|
+ zip_debug_print_m(pfx, lvl, "(ZERO_EXTRACT", GET_MODE(x));
|
2555 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2556 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2557 |
|
|
+ break;
|
2558 |
|
|
+ case ZERO_EXTEND:
|
2559 |
|
|
+ zip_debug_print_m(pfx, lvl, "(ZERO_EXTEND", GET_MODE(x));
|
2560 |
|
|
+ zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
|
2561 |
|
|
+ zip_debug_print(pfx, lvl, ")");
|
2562 |
|
|
+ break;
|
2563 |
102 |
dgisselq |
+ default:
|
2564 |
111 |
dgisselq |
+ { char buf[128];
|
2565 |
102 |
dgisselq |
+ sprintf(buf, "(? = %d) -- calling DEBUG-RTX", GET_CODE(x));
|
2566 |
|
|
+ zip_debug_print(pfx, lvl, buf);
|
2567 |
|
|
+ debug_rtx(x);
|
2568 |
|
|
+ } break;
|
2569 |
|
|
+ }
|
2570 |
|
|
+}
|
2571 |
|
|
+
|
2572 |
|
|
+void
|
2573 |
|
|
+zip_debug_rtx_pfx(const char *pfx, const_rtx x) {
|
2574 |
|
|
+ zip_debug_rtx_1(pfx, x, 0);
|
2575 |
|
|
+}
|
2576 |
|
|
+
|
2577 |
|
|
+void
|
2578 |
|
|
+zip_debug_rtx(const_rtx x) {
|
2579 |
|
|
+ zip_debug_rtx_pfx("", x);
|
2580 |
|
|
+}
|
2581 |
|
|
+
|
2582 |
|
|
+void
|
2583 |
142 |
dgisselq |
+zip_debug_ccode(int ccode) {
|
2584 |
|
|
+ switch(ccode) {
|
2585 |
|
|
+ case EQ: fprintf(stderr, "EQ"); break;
|
2586 |
|
|
+ case NE: fprintf(stderr, "NE"); break;
|
2587 |
|
|
+ case GE: fprintf(stderr, "GE"); break;
|
2588 |
|
|
+ case LT: fprintf(stderr, "LT"); break;
|
2589 |
202 |
dgisselq |
+ case LTU: fprintf(stderr, "LTU"); break;
|
2590 |
142 |
dgisselq |
+ case GEU: fprintf(stderr, "GEU"); break;
|
2591 |
202 |
dgisselq |
+ case GT: fprintf(stderr, "GT[!]"); break;
|
2592 |
|
|
+ case LE: fprintf(stderr, "LE[!]"); break;
|
2593 |
|
|
+ case GTU: fprintf(stderr, "GTU[!]"); break;
|
2594 |
|
|
+ case LEU: fprintf(stderr, "LEU[!]"); break;
|
2595 |
142 |
dgisselq |
+ default:
|
2596 |
|
|
+ fprintf(stderr, "%d", ccode); break;
|
2597 |
|
|
+ }
|
2598 |
|
|
+}
|
2599 |
|
|
+
|
2600 |
|
|
+void
|
2601 |
102 |
dgisselq |
+zip_debug_insn(rtx_insn *insn ATTRIBUTE_UNUSED) {
|
2602 |
|
|
+}
|
2603 |
|
|
+
|
2604 |
|
|
+void
|
2605 |
|
|
+zip_debug_bb(basic_block bb) {
|
2606 |
|
|
+ rtx_insn *insn;
|
2607 |
|
|
+
|
2608 |
|
|
+ fprintf(stderr, "************ BASIC-BLOCK ***************\n");
|
2609 |
|
|
+ FOR_BB_INSNS(bb, insn)
|
2610 |
|
|
+ {
|
2611 |
|
|
+ zip_debug_rtx(insn);
|
2612 |
|
|
+ }
|
2613 |
|
|
+}
|
2614 |
|
|
+
|
2615 |
|
|
+
|
2616 |
|
|
+static bool
|
2617 |
122 |
dgisselq |
+zip_legitimate_opb(rtx x, bool strict)
|
2618 |
102 |
dgisselq |
+{
|
2619 |
202 |
dgisselq |
+ ZIPDEBUGFLAG(dbg, false);
|
2620 |
102 |
dgisselq |
+
|
2621 |
111 |
dgisselq |
+ if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB\n");
|
2622 |
102 |
dgisselq |
+ if (dbg) zip_debug_rtx_pfx("Test: ", x);
|
2623 |
|
|
+
|
2624 |
|
|
+ if (NULL_RTX == x)
|
2625 |
|
|
+ return false;
|
2626 |
202 |
dgisselq |
+ else if ((GET_MODE(x) != QImode)
|
2627 |
|
|
+ &&(GET_MODE(x) != HImode)
|
2628 |
|
|
+ &&(GET_MODE(x) != SImode)
|
2629 |
|
|
+ &&(GET_MODE(x) != VOIDmode)) {
|
2630 |
122 |
dgisselq |
+ if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> Mode failure\n");
|
2631 |
102 |
dgisselq |
+ return false;
|
2632 |
122 |
dgisselq |
+ } else if ((strict)&&(REG_P(x))) {
|
2633 |
|
|
+ if (REGNO(x)<zip_CC) {
|
2634 |
|
|
+ if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> (Reg)\n");
|
2635 |
|
|
+ return true;
|
2636 |
|
|
+ } else return false;
|
2637 |
|
|
+ } else if (register_operand(x, GET_MODE(x))) {
|
2638 |
|
|
+ // This also handles subregs
|
2639 |
|
|
+ if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> (Reg)\n");
|
2640 |
|
|
+ return true;
|
2641 |
111 |
dgisselq |
+ } else if ((CONST_INT_P(x))
|
2642 |
|
|
+ &&(INTVAL(x) >= zip_min_opb_imm)
|
2643 |
|
|
+ &&(INTVAL(x) <= zip_max_opb_imm)) {
|
2644 |
136 |
dgisselq |
+ if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> YES! (Const) %ld <= %ld <= %ld\n", (long)zip_min_opb_imm, (long)INTVAL(x), (long)zip_max_opb_imm);
|
2645 |
111 |
dgisselq |
+ return true;
|
2646 |
122 |
dgisselq |
+ // } else if ((GET_CODE(x) == LABEL_REF)||(GET_CODE(x)==CODE_LABEL)) {
|
2647 |
|
|
+ // return true;
|
2648 |
102 |
dgisselq |
+ } else if (GET_CODE(x) == PLUS) {
|
2649 |
|
|
+ // Is it a valid register?
|
2650 |
202 |
dgisselq |
+ rtx regrtx = XEXP(x, 0);
|
2651 |
|
|
+ if ((!strict)&&(!REG_P(regrtx))) {
|
2652 |
111 |
dgisselq |
+ if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No (No reg in +%s)\n",
|
2653 |
102 |
dgisselq |
+ (GET_CODE(XEXP(x,1))==REG)?", reg in op[1]":"");
|
2654 |
|
|
+ return false;
|
2655 |
122 |
dgisselq |
+ } else if ((strict)&&((!REG_P(XEXP(x,0)))||(REGNO(XEXP(x,0))>=zip_CC))) {
|
2656 |
102 |
dgisselq |
+ return false;
|
2657 |
|
|
+ } if ((GET_CODE(XEXP(x, 1)) == CONST_INT)
|
2658 |
|
|
+ &&(INTVAL(XEXP(x, 1)) <= zip_max_anchor_offset)
|
2659 |
|
|
+ &&(INTVAL(XEXP(x, 1)) >= zip_min_anchor_offset)) {
|
2660 |
111 |
dgisselq |
+ if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> YES! (reg+int)\n");
|
2661 |
103 |
dgisselq |
+ // if((INTVAL(XEXP(x,1))<0)&&(REGNO(XEXP(x,0))==zip_SP))
|
2662 |
|
|
+ // gcc_unreachable();
|
2663 |
102 |
dgisselq |
+ return true;
|
2664 |
|
|
+ } if ((GET_CODE(XEXP(x, 1)) == LABEL_REF)
|
2665 |
122 |
dgisselq |
+ ||(GET_CODE(XEXP(x, 1)) == CODE_LABEL)
|
2666 |
102 |
dgisselq |
+ ||(GET_CODE(XEXP(x, 1)) == SYMBOL_REF)) {
|
2667 |
|
|
+ // While we can technically support this, the problem
|
2668 |
|
|
+ // is that the symbol address could be anywhere, and we
|
2669 |
|
|
+ // have no way of recovering if it's outside of our
|
2670 |
|
|
+ // 14 allowable bits.
|
2671 |
111 |
dgisselq |
+ if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No. (reg+lbl)\n");
|
2672 |
102 |
dgisselq |
+ return false;
|
2673 |
|
|
+ }
|
2674 |
|
|
+ }
|
2675 |
|
|
+
|
2676 |
111 |
dgisselq |
+ if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No\n");
|
2677 |
102 |
dgisselq |
+ if (dbg) zip_debug_rtx(x);
|
2678 |
|
|
+ return false;
|
2679 |
|
|
+}
|
2680 |
|
|
+
|
2681 |
|
|
+static bool
|
2682 |
|
|
+zip_legitimate_move_operand_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict) {
|
2683 |
202 |
dgisselq |
+ const bool dbg = ((ZIP_ALL_DEBUG_ON)||(false))&&(!ZIP_ALL_DEBUG_OFF);
|
2684 |
102 |
dgisselq |
+
|
2685 |
|
|
+ if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND\n");
|
2686 |
|
|
+ if (dbg) zip_debug_rtx_pfx("VMov?: ", x);
|
2687 |
|
|
+
|
2688 |
122 |
dgisselq |
+ if (!zip_legitimate_opb(x, strict))
|
2689 |
102 |
dgisselq |
+ return false;
|
2690 |
122 |
dgisselq |
+ else if ((GET_CODE(x)==PLUS)&&(CONST_INT_P(XEXP(x,1)))) {
|
2691 |
|
|
+ if ((INTVAL(XEXP(x, 1)) > zip_max_mov_offset)
|
2692 |
|
|
+ ||(INTVAL(XEXP(x, 1)) < zip_min_mov_offset)) {
|
2693 |
135 |
dgisselq |
+ if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> NO! (reg+int), int out of bounds: %ld\n", (long)INTVAL(XEXP(x,1)));
|
2694 |
102 |
dgisselq |
+ return false;
|
2695 |
|
|
+ }
|
2696 |
|
|
+ }
|
2697 |
|
|
+
|
2698 |
122 |
dgisselq |
+ if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> Yes\n");
|
2699 |
102 |
dgisselq |
+ if (dbg) zip_debug_rtx(x);
|
2700 |
122 |
dgisselq |
+ return true;
|
2701 |
102 |
dgisselq |
+}
|
2702 |
|
|
+
|
2703 |
|
|
+int
|
2704 |
|
|
+zip_pd_mov_operand(rtx op)
|
2705 |
|
|
+{
|
2706 |
202 |
dgisselq |
+ const bool dbg = ((ZIP_ALL_DEBUG_ON)||(false))&&(!ZIP_ALL_DEBUG_OFF);
|
2707 |
102 |
dgisselq |
+
|
2708 |
|
|
+ if (dbg) fprintf(stderr, "ZIP-VALID-MOV(predicate) for OPERAND\n");
|
2709 |
|
|
+ return zip_legitimate_move_operand_p(VOIDmode, op, !can_create_pseudo_p());
|
2710 |
|
|
+}
|
2711 |
|
|
+
|
2712 |
|
|
+int
|
2713 |
111 |
dgisselq |
+zip_pd_mvimm_operand(rtx op)
|
2714 |
|
|
+{
|
2715 |
202 |
dgisselq |
+ const bool dbg = ((ZIP_ALL_DEBUG_ON)||(false))&&(!ZIP_ALL_DEBUG_OFF);
|
2716 |
111 |
dgisselq |
+
|
2717 |
|
|
+ if (dbg) fprintf(stderr, "ZIP-VALID-MVIMM(predicate) for OPERAND\n");
|
2718 |
|
|
+ if (!CONST_INT_P(op))
|
2719 |
|
|
+ return false;
|
2720 |
|
|
+ if (INTVAL(op) > zip_max_mov_offset)
|
2721 |
|
|
+ return false;
|
2722 |
|
|
+ if (INTVAL(op) < zip_min_mov_offset)
|
2723 |
|
|
+ return false;
|
2724 |
|
|
+ return true;
|
2725 |
|
|
+}
|
2726 |
|
|
+
|
2727 |
|
|
+int
|
2728 |
|
|
+zip_pd_imm_operand(rtx op)
|
2729 |
|
|
+{
|
2730 |
202 |
dgisselq |
+ const bool dbg = ((ZIP_ALL_DEBUG_ON)||(false))&&(!ZIP_ALL_DEBUG_OFF);
|
2731 |
111 |
dgisselq |
+
|
2732 |
|
|
+ if (dbg) fprintf(stderr, "ZIP-VALID-IMM(predicate) for OPERAND\n");
|
2733 |
|
|
+ if (!CONST_INT_P(op))
|
2734 |
|
|
+ return false;
|
2735 |
|
|
+ if (INTVAL(op) > zip_max_anchor_offset)
|
2736 |
|
|
+ return false;
|
2737 |
|
|
+ if (INTVAL(op) < zip_min_anchor_offset)
|
2738 |
|
|
+ return false;
|
2739 |
|
|
+ return true;
|
2740 |
|
|
+}
|
2741 |
|
|
+
|
2742 |
|
|
+int
|
2743 |
102 |
dgisselq |
+zip_address_operand(rtx op)
|
2744 |
|
|
+{
|
2745 |
202 |
dgisselq |
+ const bool dbg = ((ZIP_ALL_DEBUG_ON)||(false))&&(!ZIP_ALL_DEBUG_OFF);
|
2746 |
102 |
dgisselq |
+
|
2747 |
|
|
+ if (dbg) fprintf(stderr, "ZIP-ADDRESS for OPERAND\n");
|
2748 |
111 |
dgisselq |
+ if ((REG_P(op))&&(REGNO(op)==zip_CC))
|
2749 |
|
|
+ return false;
|
2750 |
|
|
+ else if ((GET_CODE(op) == PLUS)&&(REG_P(XEXP(op,0)))
|
2751 |
|
|
+ &&(REGNO(XEXP(op,0))==zip_CC))
|
2752 |
|
|
+ return false;
|
2753 |
|
|
+ else
|
2754 |
|
|
+ return zip_legitimate_opb(op, !can_create_pseudo_p());
|
2755 |
102 |
dgisselq |
+}
|
2756 |
|
|
+
|
2757 |
|
|
+int
|
2758 |
111 |
dgisselq |
+zip_pd_opb_operand(rtx op)
|
2759 |
102 |
dgisselq |
+{
|
2760 |
202 |
dgisselq |
+ ZIPDEBUGFLAG(dbg, false);
|
2761 |
102 |
dgisselq |
+
|
2762 |
111 |
dgisselq |
+ if (dbg) fprintf(stderr, "ZIP-OPB(predicate) for OPERAND\n");
|
2763 |
122 |
dgisselq |
+ return zip_legitimate_opb(op, false); //, !can_create_pseudo_p());
|
2764 |
102 |
dgisselq |
+}
|
2765 |
|
|
+
|
2766 |
|
|
+int
|
2767 |
|
|
+zip_ct_address_operand(rtx op)
|
2768 |
|
|
+{
|
2769 |
202 |
dgisselq |
+ ZIPDEBUGFLAG(dbg, false);
|
2770 |
102 |
dgisselq |
+
|
2771 |
|
|
+ if (dbg) fprintf(stderr, "ZIP-ADDRESS(constraint) for OPERAND\n");
|
2772 |
111 |
dgisselq |
+ return zip_legitimate_opb(op, !can_create_pseudo_p());
|
2773 |
102 |
dgisselq |
+}
|
2774 |
|
|
+
|
2775 |
|
|
+int
|
2776 |
|
|
+zip_const_address_operand(rtx x) {
|
2777 |
202 |
dgisselq |
+ ZIPDEBUGFLAG(dbg, false);
|
2778 |
102 |
dgisselq |
+
|
2779 |
|
|
+ if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS?\n");
|
2780 |
|
|
+ if (dbg) zip_debug_rtx(x);
|
2781 |
127 |
dgisselq |
+ if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode)) {
|
2782 |
|
|
+ fprintf(stderr, "is ZIP-CONST-ADDRESS? -> NO, BAD MODE\n");
|
2783 |
102 |
dgisselq |
+ return false;
|
2784 |
127 |
dgisselq |
+ }
|
2785 |
102 |
dgisselq |
+ if ((GET_CODE(x) == LABEL_REF)
|
2786 |
|
|
+ ||(GET_CODE(x) == CODE_LABEL)
|
2787 |
|
|
+ ||(GET_CODE(x) == SYMBOL_REF)) {
|
2788 |
127 |
dgisselq |
+ if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES! (LBL)\n");
|
2789 |
102 |
dgisselq |
+ return true;
|
2790 |
|
|
+ } else if (CONST_INT_P(x)) {
|
2791 |
127 |
dgisselq |
+ if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES! (INT)\n");
|
2792 |
102 |
dgisselq |
+ return true;
|
2793 |
|
|
+ } else if (GET_CODE(x) == PLUS) {
|
2794 |
|
|
+ if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(PLUS)\n");
|
2795 |
|
|
+ return ((zip_const_address_operand(XEXP(x,0)))
|
2796 |
|
|
+ &&(CONST_INT_P(XEXP(x,1))));
|
2797 |
|
|
+ } else if (GET_CODE(x) == MINUS) {
|
2798 |
|
|
+ if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(MINUS)\n");
|
2799 |
|
|
+ return ((zip_const_address_operand(XEXP(x,0)))
|
2800 |
|
|
+ &&(zip_const_address_operand(XEXP(x,1))));
|
2801 |
|
|
+ }
|
2802 |
|
|
+
|
2803 |
|
|
+ if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> No\n");
|
2804 |
|
|
+ if (dbg) zip_debug_rtx(x);
|
2805 |
|
|
+ return false;
|
2806 |
|
|
+}
|
2807 |
|
|
+
|
2808 |
|
|
+int
|
2809 |
|
|
+zip_ct_const_address_operand(rtx x) {
|
2810 |
202 |
dgisselq |
+ ZIPDEBUGFLAG(dbg, false);
|
2811 |
102 |
dgisselq |
+
|
2812 |
|
|
+ if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(constraint)\n");
|
2813 |
|
|
+ return zip_const_address_operand(x);
|
2814 |
|
|
+}
|
2815 |
|
|
+
|
2816 |
|
|
+int
|
2817 |
|
|
+zip_pd_const_address_operand(rtx x) {
|
2818 |
202 |
dgisselq |
+ ZIPDEBUGFLAG(dbg, false);
|
2819 |
102 |
dgisselq |
+
|
2820 |
|
|
+ if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(predicate)\n");
|
2821 |
|
|
+ return zip_const_address_operand(x);
|
2822 |
|
|
+}
|
2823 |
|
|
+
|
2824 |
|
|
+
|
2825 |
|
|
+static bool
|
2826 |
|
|
+zip_legitimate_address_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict)
|
2827 |
|
|
+{
|
2828 |
202 |
dgisselq |
+ ZIPDEBUGFLAG(dbg, false);
|
2829 |
102 |
dgisselq |
+
|
2830 |
|
|
+ if (dbg) fprintf(stderr, "Zip-LEGITIMATE-ADDRESS-P\n");
|
2831 |
|
|
+ if (dbg) zip_debug_rtx(x);
|
2832 |
|
|
+
|
2833 |
|
|
+ // Only insist the register be a valid register if strict is true
|
2834 |
111 |
dgisselq |
+ if (zip_legitimate_opb(x, strict))
|
2835 |
102 |
dgisselq |
+ return true;
|
2836 |
111 |
dgisselq |
+ // else if (zip_const_address_operand(x))
|
2837 |
|
|
+ // return true;
|
2838 |
102 |
dgisselq |
+
|
2839 |
|
|
+ return false;
|
2840 |
|
|
+}
|
2841 |
|
|
+
|
2842 |
111 |
dgisselq |
+static rtx
|
2843 |
|
|
+zip_legitimize_address(rtx x, rtx oldx ATTRIBUTE_UNUSED, machine_mode mode ATTRIBUTE_UNUSED) {
|
2844 |
202 |
dgisselq |
+ ZIPDEBUGFLAG(dbg, false);
|
2845 |
111 |
dgisselq |
+
|
2846 |
202 |
dgisselq |
+
|
2847 |
111 |
dgisselq |
+ if (dbg) zip_debug_rtx_pfx("LEGITIMIZE: ", x);
|
2848 |
|
|
+ if (zip_legitimate_address_p(mode, x, !can_create_pseudo_p()))
|
2849 |
|
|
+ return x;
|
2850 |
|
|
+
|
2851 |
202 |
dgisselq |
+ if (dbg) zip_debug_rtx_pfx("ILLEGITIMATE: ", x);
|
2852 |
111 |
dgisselq |
+ if (GET_CODE(x)==PLUS) {
|
2853 |
202 |
dgisselq |
+ // if ((zip_legitimate_address_p(mode, XEXP(x,0),
|
2854 |
|
|
+ // !can_create_pseudo_p()))
|
2855 |
|
|
+ // &&(GETMODE(XEXP(x,1))==CONST_INT)) {
|
2856 |
|
|
+ //}
|
2857 |
111 |
dgisselq |
+ if (!REG_P(XEXP(x,0)))
|
2858 |
202 |
dgisselq |
+ XEXP(x,0) = force_reg(Pmode,XEXP(x,0));
|
2859 |
111 |
dgisselq |
+ if ((!zip_legitimate_address_p(mode, x, !can_create_pseudo_p()))
|
2860 |
|
|
+ &&(!CONST_INT_P(XEXP(x,1))))
|
2861 |
|
|
+ x = force_reg(GET_MODE(x),x);
|
2862 |
|
|
+ } else if (MEM_P(x))
|
2863 |
|
|
+ x = force_reg(GET_MODE(x),x);
|
2864 |
|
|
+
|
2865 |
|
|
+ if (dbg) zip_debug_rtx_pfx("LEGITIMATE: ", x);
|
2866 |
|
|
+ return x;
|
2867 |
|
|
+}
|
2868 |
|
|
+
|
2869 |
102 |
dgisselq |
+void
|
2870 |
|
|
+zip_asm_output_def(FILE *stream, const char *name, const char *value)
|
2871 |
|
|
+{
|
2872 |
202 |
dgisselq |
+ fprintf(stream, "\t.equ %s, %s\n", name, value);
|
2873 |
102 |
dgisselq |
+}
|
2874 |
|
|
+
|
2875 |
202 |
dgisselq |
+const char *zip_set_zero_or_one(rtx condition, rtx dst) {
|
2876 |
|
|
+ ZIPDEBUGFLAG(dbg, false);
|
2877 |
102 |
dgisselq |
+
|
2878 |
|
|
+ if (dbg) fprintf(stderr, "ZIP::SET-ZERO-OR-ONE\n");
|
2879 |
|
|
+ if (dbg) zip_debug_rtx_pfx("CND", condition);
|
2880 |
|
|
+ if (dbg) zip_debug_rtx_pfx("REG", dst);
|
2881 |
|
|
+ switch(GET_CODE(condition)) {
|
2882 |
202 |
dgisselq |
+ case EQ: return "LDI\t0,%0\n\tLDILO.Z\t1,%0\t; set01_eq";
|
2883 |
|
|
+ case NE: return "LDI\t0,%0\n\tLDILO.NZ\t1,%0\t; set01_ne";
|
2884 |
|
|
+ case LT: return "LDI\t0,%0\n\tLDILO.LT\t1,%0\t; set01_lt";
|
2885 |
|
|
+ case GT: return "LDI\t1,%0\n\tLDILO.LT\t1,%0\n\tLDILO.Z\t1,%0\t; set01_gt";
|
2886 |
|
|
+ case LE: return "LDI\t0,%0\n\tLDILO.LT\t1,%0\n\tLDILO.Z\t1,%0\t; set01_le";
|
2887 |
|
|
+ case GE: return "LDI\t0,%0\n\tLDILO.GE\t1,%0\t; set01_ge";
|
2888 |
|
|
+ case LTU: return "LDI\t0,%0\n\tLDILO.C\t1,%0\t; set01_ltu";
|
2889 |
|
|
+ case GEU: return "LDI\t0,%0\n\tLDILO.NC\t1,%0\t; set01_geu";
|
2890 |
|
|
+ case GTU: return "LDI\t1,%0\n\tLDILO.C\t0,%0\n\tLDILO.Z\t0,%0\t; set01_gtu";
|
2891 |
|
|
+ case LEU: return "LDI\t0,%0\n\tLDILO.C\t1,%0\n\tLDILO.Z\t1,%0\t; set01_leu";
|
2892 |
102 |
dgisselq |
+ default:
|
2893 |
|
|
+ zip_debug_rtx(condition);
|
2894 |
|
|
+ internal_error("CSTORE Unsupported condition");
|
2895 |
|
|
+ return NULL;
|
2896 |
|
|
+ }
|
2897 |
|
|
+}
|
2898 |
|
|
+
|
2899 |
200 |
dgisselq |
+int
|
2900 |
127 |
dgisselq |
+zip_supported_condition(int c) {
|
2901 |
|
|
+ switch(c) {
|
2902 |
202 |
dgisselq |
+ case EQ: case NE: case LT: case GE: case LTU: case GEU:
|
2903 |
200 |
dgisselq |
+ return 1;
|
2904 |
127 |
dgisselq |
+ break;
|
2905 |
|
|
+ default:
|
2906 |
|
|
+ break;
|
2907 |
200 |
dgisselq |
+ } return 0;
|
2908 |
102 |
dgisselq |
+}
|
2909 |
|
|
+
|
2910 |
127 |
dgisselq |
+bool
|
2911 |
|
|
+zip_signed_comparison(int c) {
|
2912 |
|
|
+ switch(c) {
|
2913 |
202 |
dgisselq |
+ case NE: case LT: case EQ: case GE:
|
2914 |
127 |
dgisselq |
+ return true;
|
2915 |
|
|
+ default:
|
2916 |
|
|
+ break;
|
2917 |
|
|
+ } return false;
|
2918 |
|
|
+}
|
2919 |
|
|
+
|
2920 |
200 |
dgisselq |
+int
|
2921 |
202 |
dgisselq |
+zip_expand_movdi(rtx dst, rtx src) {
|
2922 |
|
|
+ ZIPDEBUGFLAG(dbg, false);
|
2923 |
|
|
+
|
2924 |
|
|
+ if (dbg) fprintf(stderr, "\nZIP::MOVDI\n");
|
2925 |
102 |
dgisselq |
+ if (dbg) zip_debug_rtx_pfx("DST", dst);
|
2926 |
202 |
dgisselq |
+ if (dbg) zip_debug_rtx_pfx("SRC", src);
|
2927 |
127 |
dgisselq |
+
|
2928 |
202 |
dgisselq |
+ // MOV !REG->!REG
|
2929 |
|
|
+ if ((!REG_P(dst))&&(!REG_P(src))&&(can_create_pseudo_p())) {
|
2930 |
|
|
+ // This includes:
|
2931 |
|
|
+ // MOV MEM->MEM
|
2932 |
|
|
+ // MOV IMM->MEM
|
2933 |
|
|
+ if (dbg) fprintf(stderr, "ZIP::MOVDI -- !REG->!REG\n");
|
2934 |
127 |
dgisselq |
+
|
2935 |
202 |
dgisselq |
+ rtx tmp = gen_reg_rtx(DImode);
|
2936 |
|
|
+ emit_insn(gen_movdi(tmp, src));
|
2937 |
|
|
+ emit_insn(gen_movdi(dst, tmp));
|
2938 |
|
|
+ return 1;
|
2939 |
142 |
dgisselq |
+ }
|
2940 |
|
|
+
|
2941 |
202 |
dgisselq |
+ // MOV REG->REG
|
2942 |
|
|
+ if ((REG_P(dst))&&(REG_P(src))) {
|
2943 |
|
|
+ if (dbg) fprintf(stderr, "ZIP::MOVDI -- REG->REG\n");
|
2944 |
127 |
dgisselq |
+
|
2945 |
202 |
dgisselq |
+ emit_insn(gen_movdi_raw(dst, src));
|
2946 |
|
|
+ return 1;
|
2947 |
|
|
+ }
|
2948 |
127 |
dgisselq |
+
|
2949 |
202 |
dgisselq |
+ // MOV REG->MEM (a store instruction)
|
2950 |
|
|
+ if ((MEM_P(dst))&&(REG_P(src))) {
|
2951 |
|
|
+ rtx addr = XEXP(dst,0);
|
2952 |
|
|
+ long offset = 0;
|
2953 |
|
|
+ if ((GET_CODE(addr)==PLUS)&&(CONST_INT_P(XEXP(addr,1))))
|
2954 |
|
|
+ offset = INTVAL(XEXP(addr,1));
|
2955 |
127 |
dgisselq |
+
|
2956 |
202 |
dgisselq |
+ if (dbg) fprintf(stderr, "ZIP::MOVDI -- REG->MEM\n");
|
2957 |
|
|
+ if (REG_P(addr)) {
|
2958 |
|
|
+ emit_insn(gen_movdi_raw(dst, src));
|
2959 |
|
|
+ return 1;
|
2960 |
|
|
+ } else if ((GET_CODE(addr)==PLUS)
|
2961 |
|
|
+ &&(REG_P(XEXP(addr,0)))
|
2962 |
|
|
+ &&(CONST_INT_P(XEXP(addr,1)))
|
2963 |
|
|
+ &&(offset>=(long)zip_min_anchor_offset)
|
2964 |
|
|
+ &&(offset+4<(long)zip_max_anchor_offset)) {
|
2965 |
|
|
+ // Demonstrated and works
|
2966 |
|
|
+ emit_insn(gen_movdi_raw(dst, src));
|
2967 |
|
|
+ return 1;
|
2968 |
|
|
+ } else if (can_create_pseudo_p()) {
|
2969 |
|
|
+ rtx tmp = gen_reg_rtx(Pmode);
|
2970 |
|
|
+ emit_insn(gen_movsi(tmp, addr));
|
2971 |
|
|
+ emit_insn(gen_movdi_raw(gen_rtx_MEM(DImode, tmp), src));
|
2972 |
|
|
+ return 1;
|
2973 |
102 |
dgisselq |
+ }
|
2974 |
|
|
+ }
|
2975 |
|
|
+
|
2976 |
202 |
dgisselq |
+ // MOV MEM->REG (a load instruction)
|
2977 |
|
|
+ if ((REG_P(dst))&&(MEM_P(src))) {
|
2978 |
|
|
+ rtx addr = XEXP(src,0);
|
2979 |
|
|
+ long offset = 0;
|
2980 |
|
|
+ if ((GET_CODE(addr)==PLUS)&&(CONST_INT_P(XEXP(addr,1))))
|
2981 |
|
|
+ offset = INTVAL(XEXP(addr,1));
|
2982 |
142 |
dgisselq |
+
|
2983 |
202 |
dgisselq |
+ if (dbg) fprintf(stderr, "ZIP::MOVDI -- MEM->REG\n");
|
2984 |
|
|
+ if (REG_P(addr)) {
|
2985 |
|
|
+ if (dbg) fprintf(stderr, "ZIP::MOVDI -- MEM[R]->REG\n");
|
2986 |
|
|
+ emit_insn(gen_movdi_raw(dst, src));
|
2987 |
|
|
+ return 1;
|
2988 |
|
|
+ } else if ((GET_CODE(addr)==PLUS)
|
2989 |
|
|
+ &&(REG_P(XEXP(addr,0)))
|
2990 |
|
|
+ &&(CONST_INT_P(XEXP(addr,1)))
|
2991 |
|
|
+ &&(offset>=(long)zip_min_anchor_offset)
|
2992 |
|
|
+ &&(offset+4<(long)zip_max_anchor_offset)) {
|
2993 |
|
|
+ if (dbg) fprintf(stderr, "ZIP::MOVDI -- MEM[#+R]->REG -- DONE\n");
|
2994 |
|
|
+ emit_insn(gen_movdi_raw(dst, src));
|
2995 |
|
|
+ return 1;
|
2996 |
|
|
+ } else if (can_create_pseudo_p()) {
|
2997 |
|
|
+ if (dbg) fprintf(stderr, "ZIP::MOVDI -- LDI #,R, MEM[R]->REG\n");
|
2998 |
|
|
+ rtx tmp = gen_reg_rtx(Pmode);
|
2999 |
|
|
+ emit_insn(gen_movsi(tmp, addr));
|
3000 |
|
|
+ emit_insn(gen_movdi_raw(dst,
|
3001 |
|
|
+ gen_rtx_MEM(DImode, tmp)));
|
3002 |
|
|
+ return 1;
|
3003 |
|
|
+ } else if (dbg)
|
3004 |
|
|
+ fprintf(stderr, "ZIP::MOVDI -- MEM[?]->REG (no match)\n");
|
3005 |
142 |
dgisselq |
+ }
|
3006 |
127 |
dgisselq |
+
|
3007 |
202 |
dgisselq |
+ // MOV #->REG (An LDI instruction, but for DIwords)
|
3008 |
|
|
+ if ((CONST_INT_P(src))&&(REG_P(dst))) {
|
3009 |
|
|
+ if (dbg) fprintf(stderr, "ZIP::MOVDI -- IMM->REG\n");
|
3010 |
|
|
+ emit_insn(gen_movdi_raw(dst, src));
|
3011 |
|
|
+ return 1;
|
3012 |
142 |
dgisselq |
+ }
|
3013 |
127 |
dgisselq |
+
|
3014 |
202 |
dgisselq |
+ return 0;
|
3015 |
|
|
+}
|
3016 |
142 |
dgisselq |
+
|
3017 |
202 |
dgisselq |
+const char *
|
3018 |
|
|
+zip_addsicc(rtx dst, rtx condition, rtx ifsrc, rtx addv) {
|
3019 |
|
|
+ // We know upon entry that REG_P(dst) must be true
|
3020 |
|
|
+ if (!REG_P(dst))
|
3021 |
|
|
+ internal_error("%s","ADDSICC into something other than register");
|
3022 |
127 |
dgisselq |
+
|
3023 |
202 |
dgisselq |
+ if ((REG_P(dst))&&(REG_P(ifsrc))&&(REG_P(addv))
|
3024 |
|
|
+ &&(REGNO(dst)!=REGNO(ifsrc))) {
|
3025 |
|
|
+ switch (GET_CODE(condition)) {
|
3026 |
|
|
+ case EQ: return "MOV.Z\t%2,%0\n\tADD.Z\t%3,%0";
|
3027 |
|
|
+ case NE: return "MOV.NZ\t%2,%0\n\tADD.NZ\t%3,%0";
|
3028 |
|
|
+ case LT: return "MOV.LT\t%2,%0\n\tADD.LT\t%3,%0";
|
3029 |
127 |
dgisselq |
+
|
3030 |
202 |
dgisselq |
+ case LE: return "MOV.LT\t%3,%0\n\tMOV.Z\t%3,%0\n\tADD.LT\t%3,%0\n\tADD.Z\t%3,%0";
|
3031 |
|
|
+ case GE: return "MOV.GE\t%2,%0\n\tADD.GE\t%3,%0";
|
3032 |
142 |
dgisselq |
+
|
3033 |
202 |
dgisselq |
+ case GT: return "BLT\t%.Laddsi%=\n\tBZ\t%%.Laddsi%=\n\tMOV\t%2,%0\n\tADD\t%3,%0\n.Laddsi%=:";
|
3034 |
|
|
+ case LTU: return "MOV.C\t%2,%0\n\tADD.C\t%3,%0";
|
3035 |
|
|
+
|
3036 |
|
|
+ case LEU: return "MOV.C\t%2,%0\n\tMOV.Z\t%2,%0\n\tADD.C\t%3,%0\n\tADD.Z\t%3,%0";
|
3037 |
|
|
+ case GEU: return "MOV.NC\t%2,%0\n\tADD.NC\t%3,%0";
|
3038 |
|
|
+ case GTU: return "BZ\t%.Laddsi%=\n\tMOV.NC\t%3,%0\n\tADD.NC\t%3,%0\n.Laddsi%=:";
|
3039 |
|
|
+ default:
|
3040 |
|
|
+ internal_error("%s", "Zip/No usable addsi expansion");
|
3041 |
|
|
+ break;
|
3042 |
|
|
+ }
|
3043 |
142 |
dgisselq |
+ }
|
3044 |
|
|
+
|
3045 |
102 |
dgisselq |
+ if ((REG_P(ifsrc))&&(REGNO(dst)==REGNO(ifsrc))) {
|
3046 |
|
|
+ switch (GET_CODE(condition)) {
|
3047 |
|
|
+ case EQ: return "ADD.Z\t%3,%0";
|
3048 |
|
|
+ case NE: return "ADD.NZ\t%3,%0";
|
3049 |
|
|
+ case LT: return "ADD.LT\t%3,%0";
|
3050 |
|
|
+ case LE: return "ADD.LT\t%3,%0\n\tADD.Z\t%3,%0";
|
3051 |
|
|
+ case GE: return "ADD.GE\t%3,%0";
|
3052 |
202 |
dgisselq |
+ case GT: return "ADD.GE\t%3,%0\n\tSUB.Z\t%3,%0";
|
3053 |
102 |
dgisselq |
+ case LTU: return "ADD.C\t%3,%0";
|
3054 |
|
|
+ case LEU: return "ADD.C\t%3,%0\n\tADD.Z\t%3,%0";
|
3055 |
202 |
dgisselq |
+ case GEU: return "ADD.NC\t%3,%0";
|
3056 |
|
|
+ case GTU: return "SUB.Z\t%3,%0\n\tADD.NC\t%3,%0";
|
3057 |
102 |
dgisselq |
+ default:
|
3058 |
|
|
+ internal_error("%s", "Zip/No usable addsi expansion");
|
3059 |
|
|
+ break;
|
3060 |
|
|
+ }
|
3061 |
|
|
+ } else {
|
3062 |
|
|
+ // MOV A+REG,REG
|
3063 |
|
|
+ switch (GET_CODE(condition)) {
|
3064 |
|
|
+ case EQ: return "MOV.Z\t%3+%2,%0";
|
3065 |
|
|
+ case NE: return "MOV.NZ\t%3+%2,%0";
|
3066 |
|
|
+ case LT: return "MOV.LT\t%3+%2,%0";
|
3067 |
202 |
dgisselq |
+ case GT: return "BLT\t.Laddcc%=\n\tBZ\t.Laddcc%=\n\tMOV\t%3+%2,%0\n.Laddcc%=";
|
3068 |
102 |
dgisselq |
+ case LE: return "MOV.LT\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
|
3069 |
|
|
+ case GE: return "MOV.GE\t%3+%2,%0";
|
3070 |
|
|
+ case LTU: return "MOV.C\t%3+%2,%0";
|
3071 |
|
|
+ case LEU: return "MOV.C\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
|
3072 |
202 |
dgisselq |
+ case GEU: return "MOV.NC\t%3+%2,%0";
|
3073 |
|
|
+ case GTU: return "BZ\t.Laddcc%=\n\tMOV.NC\t%3+%2,%0\n\t.Laddcc%=:";
|
3074 |
102 |
dgisselq |
+ default:
|
3075 |
|
|
+ internal_error("%s", "Zip/No usable addsi(reg,reg) expansion");
|
3076 |
|
|
+ break;
|
3077 |
|
|
+ }
|
3078 |
|
|
+ }
|
3079 |
|
|
+
|
3080 |
|
|
+ return "BREAK";
|
3081 |
|
|
+}
|
3082 |
|
|
+
|
3083 |
103 |
dgisselq |
+static int zip_memory_move_cost(machine_mode mode, reg_class_t ATTRIBUTE_UNUSED, bool in ATTRIBUTE_UNUSED) {
|
3084 |
102 |
dgisselq |
+ int rv = 14;
|
3085 |
|
|
+ if ((mode == DImode)||(mode == DFmode))
|
3086 |
|
|
+ rv += 2;
|
3087 |
|
|
+ return rv;
|
3088 |
|
|
+}
|
3089 |
|
|
+
|
3090 |
103 |
dgisselq |
+// #warning "How do we tell the compiler LDI label is expensive as 2 ops"?
|
3091 |
117 |
dgisselq |
+static bool zip_cannot_modify_jumps_p(void) {
|
3092 |
|
|
+ // Let's try their suggested approach, keeping us from modifying jumps
|
3093 |
|
|
+ // after reload. This should also allow our peephole2 optimizations
|
3094 |
|
|
+ // to adjust things back to what they need to be if necessary.
|
3095 |
|
|
+ return (reload_completed || reload_in_progress);
|
3096 |
|
|
+}
|
3097 |
122 |
dgisselq |
+
|
3098 |
|
|
+rtx_insn *zip_ifcvt_info;
|
3099 |
|
|
+
|
3100 |
|
|
+void
|
3101 |
|
|
+zip_ifcvt_modify_tests(ce_if_block *ce_info ATTRIBUTE_UNUSED, rtx *true_expr, rtx *false_expr) {
|
3102 |
202 |
dgisselq |
+ const bool dbg = ((ZIP_ALL_DEBUG_ON)||(false))&&(!ZIP_ALL_DEBUG_OFF);
|
3103 |
122 |
dgisselq |
+ if (dbg) fprintf(stderr, "IFCVT-MODIFY-TESTS\n");
|
3104 |
|
|
+ if (*true_expr) switch(GET_CODE(*true_expr)) {
|
3105 |
202 |
dgisselq |
+ // These are our unsupported conditions
|
3106 |
122 |
dgisselq |
+ case LE:
|
3107 |
202 |
dgisselq |
+ case GT:
|
3108 |
|
|
+ case LEU:
|
3109 |
122 |
dgisselq |
+ case GTU:
|
3110 |
|
|
+ if (dbg) fprintf(stderr, "TRUE, missing expr\n");
|
3111 |
|
|
+ if (dbg) zip_debug_rtx(*true_expr);
|
3112 |
|
|
+ *true_expr = NULL_RTX;
|
3113 |
|
|
+ break;
|
3114 |
|
|
+ default: // LT, GT, GTE, LTU, NE, EQ
|
3115 |
|
|
+ break;
|
3116 |
|
|
+ }
|
3117 |
|
|
+
|
3118 |
|
|
+ if (*false_expr) switch(GET_CODE(*false_expr)) {
|
3119 |
|
|
+ case LE:
|
3120 |
202 |
dgisselq |
+ case GT:
|
3121 |
|
|
+ case LEU:
|
3122 |
122 |
dgisselq |
+ case GTU:
|
3123 |
|
|
+ if (dbg) fprintf(stderr, "FALSE, missing expr\n");
|
3124 |
|
|
+ if (dbg) zip_debug_rtx(*false_expr);
|
3125 |
|
|
+ *false_expr = NULL_RTX;
|
3126 |
|
|
+ default:
|
3127 |
|
|
+ break;
|
3128 |
|
|
+ }
|
3129 |
|
|
+ if ((dbg)&&((!*true_expr)||(!*false_expr)))
|
3130 |
|
|
+ fprintf(stderr, "IFCVT-MODIFY-TESTS -- FAIL\n");
|
3131 |
|
|
+}
|
3132 |
|
|
+
|
3133 |
|
|
+void
|
3134 |
142 |
dgisselq |
+zip_ifcvt_machdep_init(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
|
3135 |
122 |
dgisselq |
+/*
|
3136 |
142 |
dgisselq |
+if (!ceinfo->then_bb)
|
3137 |
|
|
+ return;
|
3138 |
|
|
+rtx_insn *insn;
|
3139 |
|
|
+FOR_BB_INSNS(ceinfo->then_bb, insn) {
|
3140 |
|
|
+ fprintf(stderr, "IFCVT -- INIT\n");
|
3141 |
|
|
+ zip_debug_rtx_pfx("INIT-BB", insn);
|
3142 |
122 |
dgisselq |
+}
|
3143 |
|
|
+*/
|
3144 |
|
|
+/*
|
3145 |
|
|
+ zip_ifcvt_info = NULL;
|
3146 |
|
|
+ rtx_insn *insn, *ifinsn = NULL;
|
3147 |
|
|
+ FOR_BB_INSNS(ceinfo->test_bb, insn) {
|
3148 |
|
|
+ rtx p;
|
3149 |
|
|
+ p = single_set(insn);
|
3150 |
|
|
+ if (!p) continue;
|
3151 |
|
|
+ if (SET_DEST(p)==pc_rtx) {
|
3152 |
|
|
+ ifinsn = insn;
|
3153 |
|
|
+ }
|
3154 |
|
|
+ if (!REG_P(SET_DEST(p)))
|
3155 |
|
|
+ continue;
|
3156 |
|
|
+ if (GET_MODE(SET_DEST(p))!=CCmode)
|
3157 |
|
|
+ continue;
|
3158 |
|
|
+ if (REGNO(SET_DEST(p))!=zip_CC)
|
3159 |
|
|
+ continue;
|
3160 |
|
|
+ zip_ifcvt_info = insn;
|
3161 |
|
|
+ }
|
3162 |
|
|
+
|
3163 |
|
|
+ if (zip_ifcvt_info)
|
3164 |
|
|
+ zip_debug_rtx_pfx("PUTATIVE-CMP",zip_ifcvt_info);
|
3165 |
|
|
+ if (ifinsn)
|
3166 |
|
|
+ zip_debug_rtx_pfx("PRIOR-JMP",ifinsn);
|
3167 |
|
|
+*/
|
3168 |
|
|
+}
|
3169 |
|
|
+
|
3170 |
142 |
dgisselq |
+void
|
3171 |
|
|
+zip_ifcvt_modify_insn(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED,
|
3172 |
|
|
+ rtx pattern ATTRIBUTE_UNUSED,
|
3173 |
|
|
+ rtx_insn *insn ATTRIBUTE_UNUSED) {
|
3174 |
|
|
+ // zip_debug_rtx_pfx("MODIFY-INSN: ", insn);
|
3175 |
|
|
+}
|
3176 |
|
|
+
|
3177 |
|
|
+void
|
3178 |
|
|
+zip_ifcvt_modify_cancel(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
|
3179 |
|
|
+/*
|
3180 |
|
|
+ fprintf(stderr, "IFCVT -- CANCEL\n");
|
3181 |
|
|
+ zip_ifcvt_info = NULL;
|
3182 |
|
|
+*/
|
3183 |
|
|
+}
|
3184 |
|
|
+
|
3185 |
|
|
+void
|
3186 |
|
|
+zip_ifcvt_modify_final(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
|
3187 |
|
|
+/*
|
3188 |
|
|
+rtx_insn *insn;
|
3189 |
|
|
+FOR_BB_INSNS(ceinfo->test_bb, insn) {
|
3190 |
|
|
+ fprintf(stderr, "IFCVT -- FINAL\n");
|
3191 |
|
|
+ zip_debug_rtx_pfx("FINAL-TEST-BB", insn);
|
3192 |
|
|
+}
|
3193 |
|
|
+ zip_ifcvt_info = NULL;
|
3194 |
|
|
+*/
|
3195 |
|
|
+}
|
3196 |
|
|
+
|
3197 |
|
|
+
|
3198 |
127 |
dgisselq |
+int zip_insn_sets_cc(rtx_insn *insn) {
|
3199 |
|
|
+ return (get_attr_ccresult(insn)==CCRESULT_SET);
|
3200 |
|
|
+}
|
3201 |
|
|
+
|
3202 |
202 |
dgisselq |
+const char *
|
3203 |
|
|
+zip_cbranchdi_const(rtx comparison,
|
3204 |
|
|
+ rtx a ATTRIBUTE_UNUSED,
|
3205 |
|
|
+ rtx b,
|
3206 |
|
|
+ rtx label ATTRIBUTE_UNUSED) {
|
3207 |
|
|
+ gcc_assert(CONST_INT_P(b));
|
3208 |
|
|
+ long value = INTVAL(b);
|
3209 |
|
|
+
|
3210 |
|
|
+ // Look into the combine routines to find out why this routine never
|
3211 |
|
|
+ // gets called.
|
3212 |
|
|
+
|
3213 |
|
|
+ switch(GET_CODE(comparison)) {
|
3214 |
|
|
+ case EQ:
|
3215 |
|
|
+ if (value < 0)
|
3216 |
|
|
+ return "CMP\t-1,%H1\t; cbranchdi/# EQ (neg)\n\tCMP.Z\t%2,%L1\n\tBZ\t%3";
|
3217 |
|
|
+ else
|
3218 |
|
|
+ return "CMP\t0,%H1\t; cbranchdi/# EQ\n\tCMP.Z\t%2,%L1\n\tBZ\t%3";
|
3219 |
|
|
+ case NE:
|
3220 |
|
|
+ if (value < 0)
|
3221 |
|
|
+ return "CMP\t-1,%H1\t; cbranchdi/# NE (neg)\n\tCMP.Z\t%2,%L1\n\tBNZ\t%3";
|
3222 |
|
|
+ else
|
3223 |
|
|
+ return "CMP\t0,%H1\t; cbranchdi/# NE\n\tCMP.Z\t%2,%L1\n\tBNZ\t%3";
|
3224 |
|
|
+ case LE:
|
3225 |
|
|
+ if (value == 0)
|
3226 |
|
|
+ return "CMP\t0,%H1\t; cbranchdi/# LE 0\n\tBLT\t%3\n\tCMP.Z\t0,%L1\n\tBZ\t%3";
|
3227 |
|
|
+ else if (value == -1)
|
3228 |
|
|
+ return "CMP\t0,%H1\t; cbranchdi/# LE -1\n\tBLT\t%3";
|
3229 |
|
|
+ else if (value < 0) {
|
3230 |
|
|
+ char tmp[128];
|
3231 |
|
|
+ sprintf(tmp, "CMP\t-1,%%H1\t; cbranchdi/# LE (neg)\n"
|
3232 |
|
|
+ "\tBLT\t.Lcmpdile%%=\n"
|
3233 |
|
|
+ "\tBNZ\t%%3\n"
|
3234 |
|
|
+ "\tCMP\t%ld,%%L1\n"
|
3235 |
|
|
+ "\tBC\t%%3", (value+1l)&0x0ffffffff);
|
3236 |
|
|
+ return ggc_alloc_string(tmp, -1);
|
3237 |
|
|
+ } else { //; value > 0
|
3238 |
|
|
+ char tmp[128];
|
3239 |
|
|
+ sprintf(tmp, "CMP\t0,%%H1\t; cbranchdi/# LE\n"
|
3240 |
|
|
+ "\tBLT\t%%3\n"
|
3241 |
|
|
+ "\tBNZ\t.Lcmple%%=\n"
|
3242 |
|
|
+ "\tCMP\t%ld,%%L1\n"
|
3243 |
|
|
+ "\tBC\t%%3\n"
|
3244 |
|
|
+ ".Lcmple%%=:", value-1);
|
3245 |
|
|
+ return ggc_alloc_string(tmp, -1);
|
3246 |
|
|
+ }
|
3247 |
|
|
+ case LT:
|
3248 |
|
|
+ if (value == 0)
|
3249 |
|
|
+ return "CMP\t0,%H1\t; cbranchdi/# LT 0\n\tBLT\t%3";
|
3250 |
|
|
+ else if (value < 0)
|
3251 |
|
|
+ return "CMP\t-1,%H1\t; cbranchdi/# LT neg\n\tCMP.Z\t%2,%L1\n\tBC\t%3";
|
3252 |
|
|
+ else
|
3253 |
|
|
+ return "CMP\t0,%H1\t; cbranchdi/# LT\n"
|
3254 |
|
|
+ "\tBLT\t%3\n"
|
3255 |
|
|
+ "\tBNZ\t.Lcmplt%=\n"
|
3256 |
|
|
+ "\tCMP\t%2,%L1\n"
|
3257 |
|
|
+ "\tBC\t%3\n"
|
3258 |
|
|
+ ".Lcmplt%=:";
|
3259 |
|
|
+ case GT:
|
3260 |
|
|
+ if (value == 0)
|
3261 |
|
|
+ return "CMP\t1,%H1\t; cbranchdi/# GT 0\n"
|
3262 |
|
|
+ "\tBGE\t%3\n"
|
3263 |
|
|
+ "\tBNZ\t.Lcmpgt%=\n"
|
3264 |
|
|
+ "\tCMP\t0,%L1\n"
|
3265 |
|
|
+ "\tBNZ\t%3\n"
|
3266 |
|
|
+ ".Lcmpgt%=:";
|
3267 |
|
|
+ else if (value == -1)
|
3268 |
|
|
+ return "CMP\t0,%H1\t; cbranchdi/# GT -1\n"
|
3269 |
|
|
+ "\tBGE\t%3\n";
|
3270 |
|
|
+ else if (value < 0) {
|
3271 |
|
|
+ char tmp[128];
|
3272 |
|
|
+ sprintf(tmp, "CMP\t-1,%%H1\t; cbranchdi/# GT neg\n"
|
3273 |
|
|
+ "\tBLT\t.Lcmpgt%%=\n"
|
3274 |
|
|
+ "\tBNZ\t%%3\n"
|
3275 |
|
|
+ "\tCMP\t%ld,%%H3\n"
|
3276 |
|
|
+ "\tBNC\t%%3\n"
|
3277 |
|
|
+ ".Lcmpgt%%=:", value+1l);
|
3278 |
|
|
+ return ggc_alloc_string(tmp, -1);
|
3279 |
|
|
+ } else {
|
3280 |
|
|
+ char tmp[128];
|
3281 |
|
|
+ sprintf(tmp, "CMP\t0,%%H1\t; cbranchdi/# GT\n"
|
3282 |
|
|
+ "\tBLT\t.Lcmpgt%%=\n"
|
3283 |
|
|
+ "\tBNZ\t%%3\n"
|
3284 |
|
|
+ "\tCMP\t%ld,%%L1\n"
|
3285 |
|
|
+ "\tBNC\t%%3\n"
|
3286 |
|
|
+ ".Lcmpgt%%=:", value+1l);
|
3287 |
|
|
+ return ggc_alloc_string(tmp, -1);
|
3288 |
|
|
+ }
|
3289 |
|
|
+ case GE:
|
3290 |
|
|
+ if (value == 0)
|
3291 |
|
|
+ return "CMP\t0,%H1\t; cbranchdi/# GE 0\n"
|
3292 |
|
|
+ "\tBLT\t.Lcmpge%=\n"
|
3293 |
|
|
+ "\tBNZ\t%3\n"
|
3294 |
|
|
+ "\tCMP\t0,%L1\n"
|
3295 |
|
|
+ "\tBNC\t%3\n"
|
3296 |
|
|
+ ".Lcmpge%=:";
|
3297 |
|
|
+ else if (value == -1)
|
3298 |
|
|
+ return "CMP\t-1,%H1\t; cbranchdi/# GE -1\n"
|
3299 |
|
|
+ "\tBLT\t.Lcmpge%=\n"
|
3300 |
|
|
+ "\tBNZ\t%3\n"
|
3301 |
|
|
+ "\tCMP\t-1,%L1\n"
|
3302 |
|
|
+ "\tBZ\t%3\n"
|
3303 |
|
|
+ ".Lcmpge%=:";
|
3304 |
|
|
+ else if (value < 0)
|
3305 |
|
|
+ return "CMP\t-1,%H1\t; cbranchdi/# GE <\n"
|
3306 |
|
|
+ "\tBLT\t.Lcmpge%=\n"
|
3307 |
|
|
+ "\tBNZ\t%3\n"
|
3308 |
|
|
+ "\tCMP\t%2,%L1\n"
|
3309 |
|
|
+ "\tBNC\t%3\n"
|
3310 |
|
|
+ ".Lcmpge%=:";
|
3311 |
|
|
+ else
|
3312 |
|
|
+ return "CMP\t0,%H1\t; cbranchdi/# GE\n"
|
3313 |
|
|
+ "\tBLT\t.Lcmpge%=\n"
|
3314 |
|
|
+ "\tBNZ\t%3\n"
|
3315 |
|
|
+ "\tCMP\t%2,%L1\n"
|
3316 |
|
|
+ "\tBNC\t%3\n"
|
3317 |
|
|
+ ".Lcmpge%=:";
|
3318 |
|
|
+ case LTU:
|
3319 |
|
|
+ if (value == 0) { //; Impossible, cannot be < 0 unsignd
|
3320 |
|
|
+ return "; cbranchdi/# LTU 0 (Impossible!)";
|
3321 |
|
|
+ } else
|
3322 |
|
|
+ return "CMP\t0,%H1\t; cbranchdi/#\n\tCMP.Z\t%2,%L1\n\tBC\t%3\n";
|
3323 |
|
|
+ case LEU:
|
3324 |
|
|
+ if (value == 0) { //; Only possible if == 0
|
3325 |
|
|
+ return "CMP\t0,%%H0\t; cbranchdi/# LEU 0\n"
|
3326 |
|
|
+ "\tCMP.Z\t0,%%L0\n"
|
3327 |
|
|
+ "\tBZ\t%3";
|
3328 |
|
|
+ } else {
|
3329 |
|
|
+ //; Subtract one, and LTU works
|
3330 |
|
|
+ char tmp[128];
|
3331 |
|
|
+ sprintf(tmp, "CMP\t0,%%H1\t; cbranchdi/# LEU\n"
|
3332 |
|
|
+ "\tCMP.Z\t%ld,%%L1\n"
|
3333 |
|
|
+ "\tBC\t%%3\n", value-1);
|
3334 |
|
|
+ return ggc_alloc_string(tmp, -1);
|
3335 |
|
|
+ }
|
3336 |
|
|
+ case GTU:
|
3337 |
|
|
+ if (value == 0) {
|
3338 |
|
|
+ //; Equivalent to not equal to zero
|
3339 |
|
|
+ return "CMP\t0,%H1\t; cbranchdi/# GTU 0\n\tCMP.Z\t0,%L1\n\tBNZ\t%3";
|
3340 |
|
|
+ } else {
|
3341 |
|
|
+ char tmp[128];
|
3342 |
|
|
+ sprintf(tmp,
|
3343 |
|
|
+ "CMP\t0,%%H1\t; cbranchdi/# GTU\n"
|
3344 |
|
|
+ "\tBNZ\t%%3\n"
|
3345 |
|
|
+ "\tCMP\t%ld,%%L1\n"
|
3346 |
|
|
+ "\tBNC\t%%3\n", value+1);
|
3347 |
|
|
+ return ggc_alloc_string(tmp, -1);
|
3348 |
|
|
+ }
|
3349 |
|
|
+ case GEU:
|
3350 |
|
|
+ if (value == 0) //; Unsigned, always true
|
3351 |
|
|
+ return "BRA\t%3\t; cbranchdi/# GEU 0";
|
3352 |
|
|
+ else
|
3353 |
|
|
+ return "CMP\t0,%H1\t; cbranchdi/# GEU\n"
|
3354 |
|
|
+ "\tBNZ\t%3\n"
|
3355 |
|
|
+ "\tCMP\t%2,%L1\n"
|
3356 |
|
|
+ "\tBNC\t%3";
|
3357 |
|
|
+ default:
|
3358 |
|
|
+ gcc_unreachable();
|
3359 |
|
|
+ }
|
3360 |
127 |
dgisselq |
+}
|
3361 |
202 |
dgisselq |
+
|
3362 |
|
|
+const char *
|
3363 |
|
|
+zip_cbranchdi_reg(rtx comparison,
|
3364 |
|
|
+ rtx a ATTRIBUTE_UNUSED,
|
3365 |
|
|
+ rtx b ATTRIBUTE_UNUSED,
|
3366 |
|
|
+ rtx label ATTRIBUTE_UNUSED) {
|
3367 |
|
|
+
|
3368 |
|
|
+ switch(GET_CODE(comparison)) {
|
3369 |
|
|
+ case EQ:
|
3370 |
|
|
+ return "CMP\t%H2,%H1\t; cbranchdi/r EQ\n\tCMP.Z\t%L2,%L1\n\tBZ\t%3";
|
3371 |
|
|
+ case NE:
|
3372 |
|
|
+ return "CMP\t%H2,%H1\t; cbranchdi/r NE\n\tCMP.Z\t%L2,%L1\n\tBNZ\t%3";
|
3373 |
|
|
+ case LE:
|
3374 |
|
|
+ return "CMP\t%H2,%H1\t; cbranchdi/r LE\n"
|
3375 |
|
|
+ "\tBLT\t%3\n"
|
3376 |
|
|
+ "\tBNZ\t.Ldi%=\n"
|
3377 |
|
|
+ "\tCMP\t%L1,%L2\n"
|
3378 |
|
|
+ "\tBNC\t%3\n"
|
3379 |
|
|
+ ".Ldi%=:";
|
3380 |
|
|
+ case GT:
|
3381 |
|
|
+ return "CMP\t%H1,%H2\t; cbranchdi/r GT\n"
|
3382 |
|
|
+ "\tBLT\t%3\n"
|
3383 |
|
|
+ "\tBNZ\t.Ldi%=\n"
|
3384 |
|
|
+ "\tCMP\t%L1,%L2\n"
|
3385 |
|
|
+ "\tBC\t%3\n"
|
3386 |
|
|
+ ".Ldi%=:";
|
3387 |
|
|
+ case LT:
|
3388 |
|
|
+ return "CMP\t%H2,%H1\t; cbranchdi/r LT\n"
|
3389 |
|
|
+ "\tBLT\t%3\n"
|
3390 |
|
|
+ "\tBNZ\t.Ldi%=\n"
|
3391 |
|
|
+ "\tCMP\t%L2,%L1\n"
|
3392 |
|
|
+ "\tBC\t%3\n"
|
3393 |
|
|
+ ".Ldi%=:";
|
3394 |
|
|
+ case GE:
|
3395 |
|
|
+ return "CMP\t%H1,%H2\t; cbranchdi/r GE\n"
|
3396 |
|
|
+ "\tBLT\t%3\n"
|
3397 |
|
|
+ "\tBNZ\t.Ldi%=\n"
|
3398 |
|
|
+ "\tCMP\t%L2,%L1\n"
|
3399 |
|
|
+ "\tBNC\t%3\n"
|
3400 |
|
|
+ ".Ldi%=:";
|
3401 |
|
|
+ case LTU:
|
3402 |
|
|
+ return "CMP\t%H2,%H1\t; cbranchdi/r LTU\n"
|
3403 |
|
|
+ "\tCMP.Z\t%L2,%L1\n"
|
3404 |
|
|
+ "\tBC\t%3\n";
|
3405 |
|
|
+ case LEU:
|
3406 |
|
|
+ return "CMP\t%H1,%H2\t; cbranchdi/r LEU\n"
|
3407 |
|
|
+ "\tBC\t.Ldi%=\n" //; H1 > H2, skip
|
3408 |
|
|
+ "\tCMP.Z\t%L1,%L2\n" //; (H1==H2) test L1-L2
|
3409 |
|
|
+ "\tBNC\t%3\n" //; If (L1>=L2)||(H1>H2)
|
3410 |
|
|
+ ".Ldi%=:";
|
3411 |
|
|
+ case GTU:
|
3412 |
|
|
+ return "CMP\t%H1,%H2\t; cbranchdi/r GTU\n"
|
3413 |
|
|
+ "\tCMP.Z\t%L1,%L2\n"
|
3414 |
|
|
+ "\tBC\t%3";
|
3415 |
|
|
+ case GEU:
|
3416 |
|
|
+ return "CMP\t%H2,%H1\t; cbranchdi/r GEU\n"
|
3417 |
|
|
+ "\tBC\t.Ldi%=\n"
|
3418 |
|
|
+ "\tCMP.Z\t%L2,%L1\n"
|
3419 |
|
|
+ "\tBNC\t%3\n"
|
3420 |
|
|
+ ".Ldi%=:";
|
3421 |
|
|
+ default:
|
3422 |
|
|
+ gcc_unreachable();
|
3423 |
|
|
+ }
|
3424 |
|
|
+}
|
3425 |
|
|
+
|
3426 |
|
|
+const char *
|
3427 |
|
|
+zip_cbranchdi(rtx comparison, rtx a, rtx b, rtx label) {
|
3428 |
|
|
+ if (REG_P(b))
|
3429 |
|
|
+ return zip_cbranchdi_reg(comparison, a, b, label);
|
3430 |
|
|
+ else
|
3431 |
|
|
+ return zip_cbranchdi_const(comparison, a, b, label);
|
3432 |
|
|
+}
|
3433 |
|
|
+
|
3434 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/config/zip/zipdbg.h gcc-6.2.0-zip/gcc/config/zip/zipdbg.h
|
3435 |
|
|
--- gcc-6.2.0/gcc/config/zip/zipdbg.h 1969-12-31 19:00:00.000000000 -0500
|
3436 |
|
|
+++ gcc-6.2.0-zip/gcc/config/zip/zipdbg.h 2017-02-17 16:47:25.727651898 -0500
|
3437 |
|
|
@@ -0,0 +1,8 @@
|
3438 |
|
|
+#define DO_ZIP_DEBUGS
|
3439 |
|
|
+#ifdef DO_ZIP_DEBUGS
|
3440 |
|
|
+#include <stdio.h>
|
3441 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX);} while(0)
|
3442 |
|
|
+extern void zip_debug_rtx(const_rtx);
|
3443 |
|
|
+#else
|
3444 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX)
|
3445 |
|
|
+#endif
|
3446 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/config/zip/zip-di.md gcc-6.2.0-zip/gcc/config/zip/zip-di.md
|
3447 |
|
|
--- gcc-6.2.0/gcc/config/zip/zip-di.md 1969-12-31 19:00:00.000000000 -0500
|
3448 |
|
|
+++ gcc-6.2.0-zip/gcc/config/zip/zip-di.md 2017-02-22 15:56:17.195319460 -0500
|
3449 |
|
|
@@ -0,0 +1,528 @@
|
3450 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
3451 |
|
|
+;;
|
3452 |
|
|
+;; Filename: zip-di.md
|
3453 |
|
|
+;;
|
3454 |
|
|
+;; Project: Zip CPU -- a small, lightweight, RISC CPU soft core
|
3455 |
|
|
+;;
|
3456 |
|
|
+;; Purpose: This is the machine description of the Zip CPU as needed by the
|
3457 |
|
|
+;; GNU compiler collection (GCC). Specifically, this is the
|
3458 |
|
|
+;; section of the description associated with 64-bit values and
|
3459 |
|
|
+;; arithmetic.
|
3460 |
|
|
+;;
|
3461 |
|
|
+;;
|
3462 |
|
|
+;; Creator: Dan Gisselquist, Ph.D.
|
3463 |
|
|
+;; Gisselquist Technology, LLC
|
3464 |
|
|
+;;
|
3465 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
3466 |
|
|
+;;
|
3467 |
|
|
+;; Copyright (C) 2015, Gisselquist Technology, LLC
|
3468 |
|
|
+;;
|
3469 |
|
|
+;; This program is free software (firmware): you can redistribute it and/or
|
3470 |
|
|
+;; modify it under the terms of the GNU General Public License as published
|
3471 |
|
|
+;; by the Free Software Foundation, either version 3 of the License, or (at
|
3472 |
|
|
+;; your option) any later version.
|
3473 |
|
|
+;;
|
3474 |
|
|
+;; This program is distributed in the hope that it will be useful, but WITHOUT
|
3475 |
|
|
+;; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
3476 |
|
|
+;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
3477 |
|
|
+;; for more details.
|
3478 |
|
|
+;;
|
3479 |
|
|
+;; License: GPL, v3, as defined and found on www.gnu.org,
|
3480 |
|
|
+;; http://www.gnu.org/licenses/gpl.html
|
3481 |
|
|
+;;
|
3482 |
|
|
+;;
|
3483 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
3484 |
|
|
+;;
|
3485 |
|
|
+;;
|
3486 |
|
|
+;
|
3487 |
|
|
+;
|
3488 |
|
|
+;
|
3489 |
|
|
+(define_expand "movdi"
|
3490 |
|
|
+ [(set (match_operand:DI 0 "nonimmediate_operand" "")
|
3491 |
|
|
+ (match_operand:DI 1 "general_operand" ""))]
|
3492 |
|
|
+ "(ZIP_HAS_DI)"
|
3493 |
|
|
+ {
|
3494 |
|
|
+ if (zip_expand_movdi(operands[0], operands[1]))
|
3495 |
|
|
+ DONE;
|
3496 |
|
|
+ FAIL;
|
3497 |
|
|
+ }
|
3498 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
|
3499 |
|
|
+;
|
3500 |
|
|
+;
|
3501 |
|
|
+;
|
3502 |
|
|
+(define_insn "movdi_raw"
|
3503 |
|
|
+ [(set (match_operand:DI 0 "nonimmediate_operand" "=r,Q,r,r")
|
3504 |
|
|
+ (match_operand:DI 1 "general_operand" "r,r,Q,i"))]
|
3505 |
|
|
+ "(ZIP_HAS_DI)"
|
3506 |
|
|
+ {
|
3507 |
|
|
+ if ((REG_P(operands[0]))&&(REG_P(operands[1])))
|
3508 |
|
|
+ return "MOV %H1,%H0\t; MOV:DI\n\tMOV %L1,%L0";
|
3509 |
|
|
+ else if (MEM_P(operands[0])) //; StoreDI
|
3510 |
|
|
+ return "SW %H1,%0\t; Store:DI\n\tSW %L1,4+%0";
|
3511 |
|
|
+ else if (MEM_P(operands[1])) //; LoadDI
|
3512 |
|
|
+ return "LW %1,%H0\t; Load:DI\n\tLW 4+%1,%L0";
|
3513 |
|
|
+ else if (CONST_INT_P(operands[1])) {
|
3514 |
|
|
+ char tmp[128];
|
3515 |
|
|
+ HOST_WIDE_INT v = INTVAL(operands[1]);
|
3516 |
|
|
+ sprintf(tmp, "LDI\t0x%08x,%%H0\t; LDI #:DI,%%H0\n\tLDI\t0x%08x,%%L0",
|
3517 |
|
|
+ (unsigned)(v>>32),
|
3518 |
|
|
+ (unsigned)(v));
|
3519 |
|
|
+ return ggc_alloc_string(tmp, -1);
|
3520 |
|
|
+ } else
|
3521 |
|
|
+ gcc_unreachable();
|
3522 |
|
|
+ }
|
3523 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
|
3524 |
|
|
+;
|
3525 |
|
|
+;
|
3526 |
|
|
+;
|
3527 |
|
|
+; ADD
|
3528 |
|
|
+;
|
3529 |
|
|
+;
|
3530 |
|
|
+(define_insn "adddi3" ; Fastest/best instruction always goes first
|
3531 |
|
|
+ [(set (match_operand:DI 0 "register_operand" "=r")
|
3532 |
|
|
+ (plus:DI (match_operand:DI 1 "register_operand" "0")
|
3533 |
|
|
+ (match_operand:DI 2 "register_operand" "r")))
|
3534 |
|
|
+ (clobber (reg:CC CC_REG))
|
3535 |
|
|
+ ]
|
3536 |
|
|
+ "(ZIP_HAS_DI)"
|
3537 |
|
|
+ "ADD %L2,%L0\n\tADD.C\t1,%H0\n\tADD\t%H2,%H0"
|
3538 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
3539 |
|
|
+;
|
3540 |
|
|
+;
|
3541 |
|
|
+;
|
3542 |
|
|
+; SUB
|
3543 |
|
|
+;
|
3544 |
|
|
+;
|
3545 |
|
|
+(define_insn "subdi3"
|
3546 |
|
|
+ [(set (match_operand:DI 0 "register_operand" "=r")
|
3547 |
|
|
+ (minus:DI (match_operand:DI 1 "register_operand" "0")
|
3548 |
|
|
+ (match_operand:DI 2 "register_operand" "r")))
|
3549 |
|
|
+ (clobber (reg:CC CC_REG))
|
3550 |
|
|
+ ]
|
3551 |
|
|
+ "(ZIP_HAS_DI)"
|
3552 |
|
|
+ "SUB %L2,%L0\n\tSUB.C\t1,%H0\n\tSUB\t%H2,%H0"
|
3553 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
3554 |
|
|
+;
|
3555 |
|
|
+;
|
3556 |
|
|
+;
|
3557 |
|
|
+; AND
|
3558 |
|
|
+;
|
3559 |
|
|
+;
|
3560 |
|
|
+(define_insn "anddi3"
|
3561 |
|
|
+ [(set (match_operand:DI 0 "register_operand" "=r")
|
3562 |
|
|
+ (and:DI (match_operand:DI 1 "register_operand" "%0")
|
3563 |
|
|
+ (match_operand:DI 2 "register_operand" "r")))
|
3564 |
|
|
+ (clobber (reg:CC CC_REG))
|
3565 |
|
|
+ ]
|
3566 |
|
|
+ "(ZIP_HAS_DI)"
|
3567 |
|
|
+ "AND %L2,%L0\t; AND:DI\n\tAND\t%H2,%H0"
|
3568 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
3569 |
|
|
+;
|
3570 |
|
|
+;
|
3571 |
|
|
+;
|
3572 |
|
|
+; iOR
|
3573 |
|
|
+;
|
3574 |
|
|
+;
|
3575 |
|
|
+(define_insn "iordi3"
|
3576 |
|
|
+ [(set (match_operand:DI 0 "register_operand" "=r")
|
3577 |
|
|
+ (ior:DI (match_operand:DI 1 "register_operand" "%0")
|
3578 |
|
|
+ (match_operand:DI 2 "register_operand" "r")))
|
3579 |
|
|
+ (clobber (reg:CC CC_REG))
|
3580 |
|
|
+ ]
|
3581 |
|
|
+ "(ZIP_HAS_DI)"
|
3582 |
|
|
+ "OR %L2,%L0\t; OR:DI\n\tOR\t%H2,%H0"
|
3583 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
3584 |
|
|
+;
|
3585 |
|
|
+;
|
3586 |
|
|
+;
|
3587 |
|
|
+; XOR
|
3588 |
|
|
+;
|
3589 |
|
|
+;
|
3590 |
|
|
+(define_insn "xordi3"
|
3591 |
|
|
+ [(set (match_operand:DI 0 "register_operand" "=r")
|
3592 |
|
|
+ (xor:DI (match_operand:DI 1 "register_operand" "%0")
|
3593 |
|
|
+ (match_operand:DI 2 "register_operand" "r")))
|
3594 |
|
|
+ (clobber (reg:CC CC_REG))
|
3595 |
|
|
+ ]
|
3596 |
|
|
+ "(ZIP_HAS_DI)"
|
3597 |
|
|
+ "XOR %L2,%L0\t; XOR:DI\n\tXOR\t%H2,%H0"
|
3598 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
3599 |
|
|
+;
|
3600 |
|
|
+;
|
3601 |
|
|
+; NEG
|
3602 |
|
|
+;
|
3603 |
|
|
+;
|
3604 |
|
|
+(define_insn "negdi2"
|
3605 |
|
|
+ [(set (match_operand:DI 0 "register_operand" "=r")
|
3606 |
|
|
+ (neg:DI (match_operand:DI 1 "register_operand" "0")))
|
3607 |
|
|
+ (clobber (reg:CC CC_REG))
|
3608 |
|
|
+ ]
|
3609 |
|
|
+ "(ZIP_HAS_DI)"
|
3610 |
|
|
+ "XOR -1,%L0\t; NEG:DI\n\tXOR\t-1,%H0\n\tADD\t1,%L0\n\tADD.C\t1,%H0"
|
3611 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
3612 |
|
|
+;
|
3613 |
|
|
+;
|
3614 |
|
|
+;
|
3615 |
|
|
+; ABS
|
3616 |
|
|
+;
|
3617 |
|
|
+;
|
3618 |
|
|
+(define_insn "absdi2"
|
3619 |
|
|
+ [(set (match_operand:DI 0 "register_operand" "=r")
|
3620 |
|
|
+ (abs:DI (match_operand:DI 1 "register_operand" "0")))
|
3621 |
|
|
+ (clobber (match_scratch:SI 2 "=r"))
|
3622 |
|
|
+ (clobber (reg:CC CC_REG))
|
3623 |
|
|
+ ]
|
3624 |
|
|
+ "(ZIP_HAS_DI)"
|
3625 |
|
|
+ "CLR %2 ; ABSDI
|
3626 |
|
|
+ TEST %H0
|
3627 |
|
|
+ LDILO.LT 1,%2
|
3628 |
|
|
+ XOR.LT -1,%L0
|
3629 |
|
|
+ XOR.LT -1,%H0
|
3630 |
|
|
+ ADD %2,%L0
|
3631 |
|
|
+ ADD.C 1,%H0"
|
3632 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
3633 |
|
|
+;
|
3634 |
|
|
+;
|
3635 |
|
|
+; NOT
|
3636 |
|
|
+;
|
3637 |
|
|
+;
|
3638 |
|
|
+(define_insn "one_cmpldi2"
|
3639 |
|
|
+ [(set (match_operand:DI 0 "register_operand" "=r")
|
3640 |
|
|
+ (not:DI (match_operand:DI 1 "register_operand" "0")))
|
3641 |
|
|
+ (clobber (reg:CC CC_REG))
|
3642 |
|
|
+ ]
|
3643 |
|
|
+ "(ZIP_HAS_DI)"
|
3644 |
|
|
+ "XOR -1,%L0\t; NOT:DI\n\tXOR\t-1,%H0"
|
3645 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
3646 |
|
|
+;
|
3647 |
|
|
+;
|
3648 |
|
|
+; Unsigned min/max
|
3649 |
|
|
+;
|
3650 |
|
|
+;
|
3651 |
|
|
+(define_insn "umindi3"
|
3652 |
|
|
+ [(set (match_operand:DI 0 "register_operand" "=r")
|
3653 |
|
|
+ (umin:DI (match_operand:DI 1 "register_operand" "%0")
|
3654 |
|
|
+ (match_operand:DI 2 "register_operand" "r")))
|
3655 |
|
|
+ (clobber (reg:CC CC_REG))
|
3656 |
|
|
+ ]
|
3657 |
|
|
+ "(ZIP_HAS_DI)"
|
3658 |
|
|
+ "CMP %H0,%H2 ; umin:DI
|
3659 |
|
|
+ CMP.Z %L0,%L2
|
3660 |
|
|
+ MOV.C %H2,%H0
|
3661 |
|
|
+ MOV.C %L2,%L0"
|
3662 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
3663 |
|
|
+(define_insn "umaxdi3"
|
3664 |
|
|
+ [(set (match_operand:DI 0 "register_operand" "=r")
|
3665 |
|
|
+ (umax:DI (match_operand:DI 1 "register_operand" "%0")
|
3666 |
|
|
+ (match_operand:DI 2 "register_operand" "r")))
|
3667 |
|
|
+ (clobber (reg:CC CC_REG))
|
3668 |
|
|
+ ]
|
3669 |
|
|
+ "(ZIP_HAS_DI)"
|
3670 |
|
|
+ "CMP %H2,%H0 ; umax:DI
|
3671 |
|
|
+ CMP.Z %L2,%L0
|
3672 |
|
|
+ MOV.C %H2,%H0
|
3673 |
|
|
+ MOV.C %L2,%L0"
|
3674 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
3675 |
|
|
+;
|
3676 |
|
|
+;
|
3677 |
|
|
+; Multiply
|
3678 |
|
|
+;
|
3679 |
|
|
+;
|
3680 |
|
|
+(define_expand "muldi3"
|
3681 |
|
|
+ [(parallel [(set (match_operand:DI 0 "register_operand" "=r")
|
3682 |
|
|
+ (mult:DI (match_operand:DI 1 "register_operand" "r")
|
3683 |
|
|
+ (match_operand:DI 2 "register_operand" "r")))
|
3684 |
|
|
+ (clobber (match_dup 1))
|
3685 |
|
|
+ (clobber (match_dup 2))
|
3686 |
|
|
+ (clobber (match_scratch:SI 3 "=r"))
|
3687 |
|
|
+ (clobber (reg:CC CC_REG))])]
|
3688 |
|
|
+ "(ZIP_HAS_DI)")
|
3689 |
|
|
+;
|
3690 |
|
|
+(define_insn "muldi3_raw"
|
3691 |
|
|
+ [(set (match_operand:DI 0 "register_operand" "=r")
|
3692 |
|
|
+ (mult:DI (match_operand:DI 1 "register_operand" "r")
|
3693 |
|
|
+ (match_operand:DI 2 "register_operand" "r")))
|
3694 |
|
|
+ (clobber (match_dup 1))
|
3695 |
|
|
+ (clobber (match_dup 2))
|
3696 |
|
|
+ (clobber (match_scratch:SI 3 "=r"))
|
3697 |
|
|
+ (clobber (reg:CC CC_REG))]
|
3698 |
|
|
+ "(ZIP_HAS_DI)"
|
3699 |
|
|
+ {
|
3700 |
|
|
+ int regno[3];
|
3701 |
|
|
+ regno[0] = REGNO(operands[0]);
|
3702 |
|
|
+ regno[1] = REGNO(operands[1]);
|
3703 |
|
|
+ regno[2] = REGNO(operands[2]);
|
3704 |
|
|
+ //; We need to adjust what we are doing based upon which
|
3705 |
|
|
+ //; registers are in common. We have a couple of cases:
|
3706 |
|
|
+ //;
|
3707 |
|
|
+ if ((regno[0] == regno[1])&&(regno[0] == regno[2])) {
|
3708 |
|
|
+ //; RA = RA * RA
|
3709 |
|
|
+ //;
|
3710 |
|
|
+ //; (H0:L0) = (H0:L0) * (H0:L0)
|
3711 |
|
|
+ //; (H0:L0) = (H0*2^32 + L0) * (H0 * 2^32 + L0)
|
3712 |
|
|
+ //; (H0:L0) = (H0*H0*2^64 + (H0*L0+L0*H0)*2^32 + L0 *L0)
|
3713 |
|
|
+ //; = (H0*L0+L0*H1):(L0*L0)
|
3714 |
|
|
+ //; :L0 = LOPART(L0 * L0)
|
3715 |
|
|
+ //; H0 = HIPART(L0 * L0)
|
3716 |
|
|
+ //; H0 += LOPART(H0 * L0)
|
3717 |
|
|
+ //; H0 += LOPART(L0 * H0)
|
3718 |
|
|
+ //;
|
3719 |
|
|
+ //; Rx = L0
|
3720 |
|
|
+ //; H0 *= L0 ( = LOPART( HI * LO )
|
3721 |
|
|
+ //; H0 <<= 1 ( = 2*LOPART( HI * LO ) )
|
3722 |
|
|
+ //; Rx *= L0 ( = HIPART( LO * LO )
|
3723 |
|
|
+ //; L0 *= L0 ( = LOPART( LO * LO )
|
3724 |
|
|
+ //; H0 += Rx ( = 2*LOPART( HI * LO ) + HIPART( LO *LO)
|
3725 |
|
|
+ //;
|
3726 |
|
|
+ return "; muldi3_raw/A (%H0:%L0) = (%H1:%L1) * (%H2:%L2)\n"
|
3727 |
|
|
+ "\tMOV\t%L0,%3\n"
|
3728 |
|
|
+ "\tMPY\t%L0,%H0\n"
|
3729 |
|
|
+ "\tLSL\t1,%H0\n"
|
3730 |
|
|
+ "\tMPYUHI\t%L0,%3\n"
|
3731 |
|
|
+ "\tMPY\t%L0,%L0\n"
|
3732 |
|
|
+ "\tADD\t%3,%H0";
|
3733 |
|
|
+ } else if ((regno[0] != regno[1])&&(regno[1] == regno[2])) {
|
3734 |
|
|
+ //; RA = RB * RB
|
3735 |
|
|
+ //;
|
3736 |
|
|
+ //; (H0:L0) = (H1:L1) * (H1:L1)
|
3737 |
|
|
+ //; (H0:L0) = (H1*2^32 + L1) * (H1 * 2^32 + L1)
|
3738 |
|
|
+ //; (H0:L0) = (H1*H1*2^64 + (H1*L1+L1*H1)*2^32 + L1 * L1)
|
3739 |
|
|
+ //; = (H1*L1+L1*H1):(L1*L1)
|
3740 |
|
|
+ //; :L0 = LOPART(L1 * L1)
|
3741 |
|
|
+ //; H0 = HIPART(L1 * L1)
|
3742 |
|
|
+ //; H0 += LOPART(H1 * L1)
|
3743 |
|
|
+ //; H0 += LOPART(L1 * H1)
|
3744 |
|
|
+ //;
|
3745 |
|
|
+ //; -------------------
|
3746 |
|
|
+ //; L0 = L1
|
3747 |
|
|
+ //; L0 = LOPART(L0 * L1)
|
3748 |
|
|
+ //; H0 = H1
|
3749 |
|
|
+ //; H0 = LOPART(H0 * L1)
|
3750 |
|
|
+ //; H0 <<= 1; i.e. *= 2
|
3751 |
|
|
+ //; L1 = HIPART(L1 * L1)
|
3752 |
|
|
+ //; H0 += L1
|
3753 |
|
|
+ //;
|
3754 |
|
|
+ return "; muldi3_raw/B (%H0:%L0) = (%H1:%L1) * (%H2:%L2)\n"
|
3755 |
|
|
+ "\tMOV\t%L1,%L0\n"
|
3756 |
|
|
+ "\tMPY\t%L1,%L0\n"
|
3757 |
|
|
+ "\tMOV\t%H1,%H0\n"
|
3758 |
|
|
+ "\tMPY\t%H1,%H0\n"
|
3759 |
|
|
+ "\tLSL\t1,%H0\n"
|
3760 |
|
|
+ "\tMPY\t%L1,%L1\n"
|
3761 |
|
|
+ "\tADD\t%L2,%H0";
|
3762 |
|
|
+ } else if ((regno[0] == regno[1])&&(regno[1] != regno[2])) {
|
3763 |
|
|
+ //; RA = RA * RB, with scratch Rx
|
3764 |
|
|
+ //;
|
3765 |
|
|
+ //; (H0:L0) = (H0:L0) * (H1:L1)
|
3766 |
|
|
+ //; (H0:L0) = (H0*2^32 + L0) * (H1 * 2^32 + L1)
|
3767 |
|
|
+ //; (H0:L0) = (H0*H1*2^64 + (H0*L1+L0*H1)*2^32 + L0 *L1)
|
3768 |
|
|
+ //; = (H0*L1+L0*H1):(L0*L1)
|
3769 |
|
|
+ //; Rx = L0
|
3770 |
|
|
+ //; :L0 = LOPART(L1 * R0)
|
3771 |
|
|
+ //; H0 = LOPART(H0 * L1)
|
3772 |
|
|
+ //; H0 += H1 = LOPART(Rx * H1)
|
3773 |
|
|
+ //; H0 += HIPART(L1 * Rx)
|
3774 |
|
|
+ //;
|
3775 |
|
|
+ return "; muldi3_raw/C (%H0:%L0) = (%H1:%L1) * (%H2:%L2)\n"
|
3776 |
|
|
+ "\tMOV\t%L0,%3\n"
|
3777 |
|
|
+ "\tMPY\t%L1,%L0\n"
|
3778 |
|
|
+ "\tMOV\t%L1,%H0\n"
|
3779 |
|
|
+ "\tMPY\t%H1,%H0\n"
|
3780 |
|
|
+ "\tMPY\t%3,%H1\n"
|
3781 |
|
|
+ "\tADD\t%H1,%H0\n"
|
3782 |
|
|
+ "\tMPY\t%3,%L1\n"
|
3783 |
|
|
+ "\tADD\t%L1,%H0";
|
3784 |
|
|
+ } else {
|
3785 |
|
|
+ //; RA = RB * RC
|
3786 |
|
|
+ //;
|
3787 |
|
|
+ //; (H0:L0) = (H1:L1) * (H2:L2)
|
3788 |
|
|
+ //; (H0:L0) = (H1*2^32 + L1) * (H2 * 2^32 + L2)
|
3789 |
|
|
+ //; (H0:L0) = (H1*H2*2^64 + (H1*L2+L1*H2)*2^32 + L1 *L2)
|
3790 |
|
|
+ //; = (H1*L2+L1*H2):(L1*L2)
|
3791 |
|
|
+ //; :L0 = LOPART(L1 * L2)
|
3792 |
|
|
+ //; H0 = HIPART(L1 * L2)
|
3793 |
|
|
+ //; H0 += LOPART(H1 * L2)
|
3794 |
|
|
+ //; H0 += LOPART(L1 * H2)
|
3795 |
|
|
+ //;
|
3796 |
|
|
+ //; We can re-order this to try to save some registers
|
3797 |
|
|
+ //;
|
3798 |
|
|
+ //; H1 *= L0 // Was H1 * L2
|
3799 |
|
|
+ //; :L0 = LOPART(L1 * L2)
|
3800 |
|
|
+ //; H0 = LOPART(L1 * R1)
|
3801 |
|
|
+ //; H0 += HIPART(L1 * H2)
|
3802 |
|
|
+ //; H0 += H1
|
3803 |
|
|
+ //;
|
3804 |
|
|
+ return "; muldi3_raw/D (%H0:%L0) = (%H1:%L1) * (%H2:%L2)\n"
|
3805 |
|
|
+ "\tMPY %L2,%H1 ; H1 = H1 * L2\n"
|
3806 |
|
|
+ "\tMPY %L1,%H2 ; H2 = L1 * L2\n"
|
3807 |
|
|
+ "\tMOV %L2,%L0 ; H0:L0 = L1 * L2\n"
|
3808 |
|
|
+ "\tMOV %L2,%H0\n"
|
3809 |
|
|
+ "\tMPY %L1,%L0\n"
|
3810 |
|
|
+ "\tMPYUHI %L1,%H0\n"
|
3811 |
|
|
+ "\tADD %H2,%H0 ; H0 += (H2 = L1 * H2)\n"
|
3812 |
|
|
+ "\tADD %H1,%H0 ; H0 += (H1 = H1 * L2)";
|
3813 |
|
|
+ }
|
3814 |
|
|
+ }
|
3815 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
3816 |
|
|
+;
|
3817 |
|
|
+;
|
3818 |
|
|
+; Still missing DI instructions for smin:DI, smax:DI, movdicc, adddicc,
|
3819 |
|
|
+; div:di, divu:di (library routine)
|
3820 |
|
|
+;
|
3821 |
|
|
+;
|
3822 |
|
|
+;
|
3823 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
3824 |
|
|
+;;
|
3825 |
|
|
+;; Conditional arithmetic instructions
|
3826 |
|
|
+;;
|
3827 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
3828 |
|
|
+;
|
3829 |
|
|
+;
|
3830 |
|
|
+;
|
3831 |
|
|
+;
|
3832 |
|
|
+(define_insn "cstoredi4" ; Store 0 or 1 in %0 based on cmp between %2&%3
|
3833 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
3834 |
|
|
+ (if_then_else:SI (match_operator 1 "ordered_comparison_operator"
|
3835 |
|
|
+ [(match_operand:DI 2 "register_operand" "r")
|
3836 |
|
|
+ (match_operand:DI 3 "register_operand" "r")])
|
3837 |
|
|
+ (const_int 1) (const_int 0)))
|
3838 |
|
|
+ (clobber (reg:CC CC_REG))]
|
3839 |
|
|
+ "(ZIP_HAS_DI)&&(0)"
|
3840 |
|
|
+ {
|
3841 |
|
|
+ switch(GET_CODE(operands[1])) {
|
3842 |
|
|
+ case EQ: return "CLR\t%0\t; CSTORE-EQ\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.Z\t1,%0\n";
|
3843 |
|
|
+ case NE: return "CLR\t%0\t; CSTORE-NE\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.NZ\t1,%0\n";
|
3844 |
|
|
+ //; Missing LT
|
3845 |
|
|
+ //; Missing LE
|
3846 |
|
|
+ //; Missing GT
|
3847 |
|
|
+ //; Missing GE
|
3848 |
|
|
+ case LTU: return "CLR\t%0\t; CSTORE-LTU\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.C\t1,%0\n";
|
3849 |
|
|
+ case LEU:
|
3850 |
|
|
+ return "CLR\t%0\t; CSTORE-LEU\n\tCMP\t%H2,%H3\n\tCMP.Z\t%L2,%L3\n\tLDILO.NC\t1,%0\n";
|
3851 |
|
|
+ case GTU: return "CLR\t%0\t; CSTORE-GTU\n\tCMP\t%H2,%H3\n\tCMP.Z\t%L2,%L3\n\tLDILO.C\t1,%0\n";
|
3852 |
|
|
+ case GEU:
|
3853 |
|
|
+ return "CLR\t%0\t; CSTORE-GEU\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.NC\t1,%0\n";
|
3854 |
|
|
+ default:
|
3855 |
|
|
+ gcc_unreachable();
|
3856 |
|
|
+ }
|
3857 |
|
|
+ }
|
3858 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
3859 |
|
|
+;
|
3860 |
|
|
+;
|
3861 |
|
|
+;
|
3862 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
3863 |
|
|
+;;
|
3864 |
|
|
+;; Comparison instructions, both compare and test
|
3865 |
|
|
+;;
|
3866 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
3867 |
|
|
+;
|
3868 |
|
|
+;
|
3869 |
|
|
+;
|
3870 |
|
|
+(define_expand "cmpdi"
|
3871 |
|
|
+ [(set (reg:CC CC_REG) (compare:CC
|
3872 |
|
|
+ (match_operand:DI 0 "register_operand" "r")
|
3873 |
|
|
+ (match_operand:DI 1 "nonmemory_operand" "")))]
|
3874 |
|
|
+ ""
|
3875 |
|
|
+ {
|
3876 |
|
|
+ if (!REG_P(operands[1])) {
|
3877 |
|
|
+ if (can_create_pseudo_p()) {
|
3878 |
|
|
+ //; fprintf(stderr, "Generating pseudo register for compare\n");
|
3879 |
|
|
+ rtx tmp = gen_reg_rtx(DImode);
|
3880 |
|
|
+ emit_insn(gen_movdi(tmp,operands[1]));
|
3881 |
|
|
+ operands[1] = tmp;
|
3882 |
|
|
+ emit_insn(gen_cmpdi_reg(operands[0],tmp));
|
3883 |
|
|
+ DONE;
|
3884 |
|
|
+ } else FAIL;
|
3885 |
|
|
+ }
|
3886 |
|
|
+ })
|
3887 |
|
|
+(define_insn "cmpdi_reg"
|
3888 |
|
|
+ [(set (reg:CC CC_REG) (compare:CC
|
3889 |
|
|
+ (match_operand:SI 0 "register_operand" "r")
|
3890 |
|
|
+ (match_operand:SI 1 "register_operand" "r")))]
|
3891 |
|
|
+ ""
|
3892 |
|
|
+ "CMP\t%H1,%H0
|
3893 |
|
|
+ CMP.Z\t%L1,%L0"
|
3894 |
|
|
+ [(set_attr "ccresult" "set")])
|
3895 |
|
|
+;
|
3896 |
|
|
+;
|
3897 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
3898 |
|
|
+;;
|
3899 |
|
|
+;; Conditional move instructions, since these won't accept conditional
|
3900 |
|
|
+;; execution RTL
|
3901 |
|
|
+;;
|
3902 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
3903 |
|
|
+;
|
3904 |
|
|
+(define_expand "cbranchdi4"
|
3905 |
|
|
+ [(set (pc) (if_then_else
|
3906 |
|
|
+ (match_operator 0 "ordered_comparison_operator"
|
3907 |
|
|
+ [(match_operand:DI 1 "register_operand" "r")
|
3908 |
|
|
+ (match_operand:DI 2 "nonimmediate_operand" "")])
|
3909 |
|
|
+ (label_ref (match_operand 3 "" ""))
|
3910 |
|
|
+ (pc)))
|
3911 |
|
|
+ (clobber (reg:CC CC_REG))]
|
3912 |
|
|
+ "(ZIP_HAS_DI)"
|
3913 |
|
|
+ {
|
3914 |
|
|
+ if (!REG_P(operands[2])) {
|
3915 |
|
|
+ if ((CONST_INT_P(operands[2]))
|
3916 |
|
|
+ &&(INTVAL(operands[2])> -(1l<<17))
|
3917 |
|
|
+ &&(INTVAL(operands[2])<(1l<<17)-1)) {
|
3918 |
|
|
+ emit_jump_insn(gen_cbranchdi4_internal(operands[0],
|
3919 |
|
|
+ operands[1], operands[2], operands[3]));
|
3920 |
|
|
+ DONE;
|
3921 |
|
|
+ } if (can_create_pseudo_p()) {
|
3922 |
|
|
+ rtx tmp = gen_reg_rtx(DImode);
|
3923 |
|
|
+ emit_insn(gen_movsi(tmp, operands[2]));
|
3924 |
|
|
+ operands[2] = tmp;
|
3925 |
|
|
+ }
|
3926 |
|
|
+ }
|
3927 |
|
|
+
|
3928 |
|
|
+ if (REG_P(operands[2])) {
|
3929 |
|
|
+ emit_jump_insn(gen_cbranchdi4_internal(operands[0],
|
3930 |
|
|
+ operands[1], operands[2], operands[3]));
|
3931 |
|
|
+ DONE;
|
3932 |
|
|
+ }
|
3933 |
|
|
+ })
|
3934 |
|
|
+(define_insn "cbranchdi4_internal"
|
3935 |
|
|
+ [(set (pc) (if_then_else
|
3936 |
|
|
+ (match_operator 0 "ordered_comparison_operator"
|
3937 |
|
|
+ [(match_operand:DI 1 "register_operand" "r,r,r")
|
3938 |
|
|
+ (match_operand:DI 2 "nonmemory_operand" "K,x,r")])
|
3939 |
|
|
+ (label_ref (match_operand 3 "" ""))
|
3940 |
|
|
+ (pc)))
|
3941 |
|
|
+ (clobber (reg:CC CC_REG))]
|
3942 |
|
|
+ "(ZIP_HAS_DI)"
|
3943 |
|
|
+ {
|
3944 |
|
|
+ return zip_cbranchdi(operands[0], operands[1], operands[2], operands[3]);
|
3945 |
|
|
+ }
|
3946 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
3947 |
|
|
+;
|
3948 |
|
|
+;
|
3949 |
|
|
+;
|
3950 |
|
|
+;
|
3951 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
3952 |
|
|
+;;
|
3953 |
|
|
+;; Unimplemented (or not yet implemented) RTL Codes
|
3954 |
|
|
+;;
|
3955 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
3956 |
|
|
+;
|
3957 |
|
|
+;
|
3958 |
|
|
+;
|
3959 |
|
|
+;
|
3960 |
|
|
+;(define_insn "addvdi4"
|
3961 |
|
|
+; )
|
3962 |
|
|
+;(define_insn "subvdi4"
|
3963 |
|
|
+; )
|
3964 |
|
|
+;(define_insn "mulvdi4"
|
3965 |
|
|
+; )
|
3966 |
|
|
+;(define_insn "umulvdi4"
|
3967 |
|
|
+; )
|
3968 |
|
|
+;(define_insn "umulvdi4"
|
3969 |
|
|
+; )
|
3970 |
|
|
+;(define_insn "negvdi3"
|
3971 |
|
|
+; )
|
3972 |
|
|
+;
|
3973 |
|
|
+;(define_insn "maddsidi4"
|
3974 |
|
|
+;(define_insn "umaddsidi4"
|
3975 |
|
|
+;(define_insn "msubsidi4"
|
3976 |
|
|
+;(define_insn "umsubsidi4"
|
3977 |
|
|
+;
|
3978 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/config/zip/zip-float.md gcc-6.2.0-zip/gcc/config/zip/zip-float.md
|
3979 |
|
|
--- gcc-6.2.0/gcc/config/zip/zip-float.md 1969-12-31 19:00:00.000000000 -0500
|
3980 |
|
|
+++ gcc-6.2.0-zip/gcc/config/zip/zip-float.md 2017-01-10 14:01:42.029341062 -0500
|
3981 |
200 |
dgisselq |
@@ -0,0 +1,138 @@
|
3982 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
3983 |
|
|
+;;
|
3984 |
|
|
+;; Filename: zip-float.md
|
3985 |
|
|
+;;
|
3986 |
|
|
+;; Project: Zip CPU -- a small, lightweight, RISC CPU soft core
|
3987 |
|
|
+;;
|
3988 |
|
|
+;; Purpose: This is the machine description of the ZipCPU floating point
|
3989 |
|
|
+;; unit (if installed).
|
3990 |
|
|
+;;
|
3991 |
|
|
+;;
|
3992 |
|
|
+;; Creator: Dan Gisselquist, Ph.D.
|
3993 |
|
|
+;; Gisselquist Technology, LLC
|
3994 |
|
|
+;;
|
3995 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
3996 |
|
|
+;;
|
3997 |
202 |
dgisselq |
+;; Copyright (C) 2015,2017, Gisselquist Technology, LLC
|
3998 |
200 |
dgisselq |
+;;
|
3999 |
|
|
+;; This program is free software (firmware): you can redistribute it and/or
|
4000 |
|
|
+;; modify it under the terms of the GNU General Public License as published
|
4001 |
|
|
+;; by the Free Software Foundation, either version 3 of the License, or (at
|
4002 |
|
|
+;; your option) any later version.
|
4003 |
|
|
+;;
|
4004 |
|
|
+;; This program is distributed in the hope that it will be useful, but WITHOUT
|
4005 |
|
|
+;; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
4006 |
|
|
+;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
4007 |
|
|
+;; for more details.
|
4008 |
|
|
+;;
|
4009 |
|
|
+;; License: GPL, v3, as defined and found on www.gnu.org,
|
4010 |
|
|
+;; http://www.gnu.org/licenses/gpl.html
|
4011 |
|
|
+;;
|
4012 |
|
|
+;;
|
4013 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
4014 |
|
|
+;;
|
4015 |
|
|
+;;
|
4016 |
|
|
+;
|
4017 |
|
|
+;
|
4018 |
|
|
+;
|
4019 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
4020 |
|
|
+;;
|
4021 |
|
|
+;; Floating point Op-codes
|
4022 |
|
|
+;;
|
4023 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
4024 |
|
|
+;
|
4025 |
|
|
+;
|
4026 |
|
|
+;
|
4027 |
|
|
+(define_insn "addsf3"
|
4028 |
|
|
+ [(set (match_operand:SF 0 "register_operand" "=r")
|
4029 |
|
|
+ (plus:SF (match_operand:SF 1 "register_operand" "0")
|
4030 |
|
|
+ (match_operand:SF 2 "register_operand" "r")))
|
4031 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
|
4032 |
|
|
+ "(ZIP_FPU)"
|
4033 |
|
|
+ "FPADD %2,%0"
|
4034 |
|
|
+ [(set_attr "ccresult" "unknown")])
|
4035 |
|
|
+(define_insn "subsf3"
|
4036 |
|
|
+ [(set (match_operand:SF 0 "register_operand" "=r")
|
4037 |
|
|
+ (minus:SF (match_operand:SF 1 "register_operand" "0")
|
4038 |
|
|
+ (match_operand:SF 2 "register_operand" "r")))
|
4039 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
|
4040 |
|
|
+ "(ZIP_FPU)"
|
4041 |
|
|
+ "FPSUB %2,%0"
|
4042 |
|
|
+ [(set_attr "ccresult" "unknown")])
|
4043 |
|
|
+(define_insn "mulsf3"
|
4044 |
|
|
+ [(set (match_operand:SF 0 "register_operand" "=r")
|
4045 |
|
|
+ (mult:SF (match_operand:SF 1 "register_operand" "0")
|
4046 |
|
|
+ (match_operand:SF 2 "register_operand" "r")))
|
4047 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
|
4048 |
|
|
+ "(ZIP_FPU)"
|
4049 |
|
|
+ "FPMUL %2,%0"
|
4050 |
|
|
+ [(set_attr "ccresult" "unknown")])
|
4051 |
|
|
+(define_insn "divsf3"
|
4052 |
|
|
+ [(set (match_operand:SF 0 "register_operand" "=r")
|
4053 |
|
|
+ (div:SF (match_operand:SF 1 "register_operand" "0")
|
4054 |
|
|
+ (match_operand:SF 2 "register_operand" "r")))
|
4055 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
|
4056 |
|
|
+ "(ZIP_FPU)"
|
4057 |
|
|
+ "FPDIV %2,%0"
|
4058 |
|
|
+ [(set_attr "ccresult" "unknown")])
|
4059 |
|
|
+; (define_insn "floatsisf2"
|
4060 |
|
|
+; [(set (match_operand:SF 0 "register_operand" "=r"
|
4061 |
202 |
dgisselq |
+; (float:QI (match_operand:SF 1 "register_operand" "r"))))
|
4062 |
200 |
dgisselq |
+; (set (reg:CC CC_REG) (compare:CC (match_dup 1) (const_int 0)))]
|
4063 |
|
|
+; "(ZIP_FPU)"
|
4064 |
|
|
+; "FPI2F %1,%0")
|
4065 |
|
|
+; (define_insn "floatunssisf2" ... ?)
|
4066 |
|
|
+; (define_insn "fix_truncsfsi2"
|
4067 |
202 |
dgisselq |
+; [(set (match_operand:QI 0 "register_operand" "=r"
|
4068 |
200 |
dgisselq |
+; (float:SF (match_operand:SF 1 "register_operand" "r"))))
|
4069 |
|
|
+; (set (reg:CC CC_REG) (compare:CC (match_dup 1) (const_int 0)))]
|
4070 |
|
|
+; "(ZIP_FPU)"
|
4071 |
|
|
+; "FPI2F %1,%0")
|
4072 |
|
|
+; (define_insn "nearbyintsf2" ... ?)
|
4073 |
|
|
+; (define_insn "truncsfsi2" ... ?)
|
4074 |
|
|
+(define_expand "negsf2"
|
4075 |
|
|
+ [(set (match_operand:SF 0 "register_operand" "=r")
|
4076 |
|
|
+ (neg:SF (match_operand:SF 1 "register_operand" "0")))
|
4077 |
|
|
+ ]
|
4078 |
|
|
+ ""
|
4079 |
|
|
+ {
|
4080 |
|
|
+ operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
|
4081 |
|
|
+ if (can_create_pseudo_p()) {
|
4082 |
|
|
+ rtx tmp = gen_reg_rtx(SImode);
|
4083 |
|
|
+ emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x80000000,SImode)));
|
4084 |
|
|
+ emit_insn(gen_xorsi3(operands[0], operands[0], tmp));
|
4085 |
|
|
+ DONE;
|
4086 |
|
|
+ } else {
|
4087 |
|
|
+ emit_insn(gen_zip_bitrev(operands[0],operands[0]));
|
4088 |
|
|
+ emit_insn(gen_iorsi3(operands[0], operands[0],
|
4089 |
|
|
+ gen_int_mode(1,SImode)));
|
4090 |
|
|
+ emit_insn(gen_zip_bitrev(operands[0],operands[0]));
|
4091 |
|
|
+ DONE;
|
4092 |
|
|
+ }
|
4093 |
|
|
+ })
|
4094 |
|
|
+(define_expand "abssf2"
|
4095 |
|
|
+ [(set (match_operand:SF 0 "register_operand" "=r")
|
4096 |
|
|
+ (abs:SF (match_operand:SF 1 "register_operand" "0")))
|
4097 |
|
|
+ ]
|
4098 |
|
|
+ ""
|
4099 |
|
|
+ {
|
4100 |
|
|
+ operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
|
4101 |
|
|
+ if (can_create_pseudo_p()) {
|
4102 |
|
|
+ rtx tmp = gen_reg_rtx(SImode);
|
4103 |
|
|
+ emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x7fffffff,SImode)));
|
4104 |
|
|
+ emit_insn(gen_andsi3(operands[0], operands[0], tmp));
|
4105 |
|
|
+ DONE;
|
4106 |
|
|
+ } else {
|
4107 |
|
|
+ emit_insn(gen_zip_bitrev(operands[0],operands[0]));
|
4108 |
|
|
+ emit_insn(gen_andsi3(operands[0], operands[0],
|
4109 |
|
|
+ gen_int_mode(-2,SImode)));
|
4110 |
|
|
+ emit_insn(gen_zip_bitrev(operands[0],operands[0]));
|
4111 |
|
|
+ DONE;
|
4112 |
|
|
+ }
|
4113 |
|
|
+ })
|
4114 |
|
|
+;
|
4115 |
|
|
+;
|
4116 |
|
|
+; STILL MISSING:
|
4117 |
|
|
+;
|
4118 |
|
|
+;
|
4119 |
|
|
+;
|
4120 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/config/zip/zip.h gcc-6.2.0-zip/gcc/config/zip/zip.h
|
4121 |
|
|
--- gcc-6.2.0/gcc/config/zip/zip.h 1969-12-31 19:00:00.000000000 -0500
|
4122 |
|
|
+++ gcc-6.2.0-zip/gcc/config/zip/zip.h 2017-03-03 09:30:57.671304970 -0500
|
4123 |
|
|
@@ -0,0 +1,4114 @@
|
4124 |
102 |
dgisselq |
+////////////////////////////////////////////////////////////////////////////////
|
4125 |
|
|
+//
|
4126 |
|
|
+// Filename: gcc/config/zip/zip.h
|
4127 |
|
|
+//
|
4128 |
|
|
+// Project: Zip CPU backend for the GNU Compiler Collection
|
4129 |
|
|
+//
|
4130 |
|
|
+// Purpose:
|
4131 |
|
|
+//
|
4132 |
|
|
+// Creator: Dan Gisselquist, Ph.D.
|
4133 |
|
|
+// Gisselquist Technology, LLC
|
4134 |
|
|
+//
|
4135 |
|
|
+////////////////////////////////////////////////////////////////////////////////
|
4136 |
|
|
+//
|
4137 |
202 |
dgisselq |
+// Copyright (C) 2016-2017, Gisselquist Technology, LLC
|
4138 |
102 |
dgisselq |
+//
|
4139 |
|
|
+// This program is free software (firmware): you can redistribute it and/or
|
4140 |
|
|
+// modify it under the terms of the GNU General Public License as published
|
4141 |
|
|
+// by the Free Software Foundation, either version 3 of the License, or (at
|
4142 |
|
|
+// your option) any later version.
|
4143 |
|
|
+//
|
4144 |
|
|
+// This program is distributed in the hope that it will be useful, but WITHOUT
|
4145 |
|
|
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
4146 |
|
|
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
4147 |
|
|
+// for more details.
|
4148 |
|
|
+//
|
4149 |
|
|
+// You should have received a copy of the GNU General Public License along
|
4150 |
|
|
+// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
4151 |
|
|
+// target there if the PDF file isn't present.) If not, see
|
4152 |
|
|
+// <http://www.gnu.org/licenses/> for a copy.
|
4153 |
|
|
+//
|
4154 |
|
|
+// License: GPL, v3, as defined and found on www.gnu.org,
|
4155 |
|
|
+// http://www.gnu.org/licenses/gpl.html
|
4156 |
|
|
+//
|
4157 |
|
|
+//
|
4158 |
|
|
+////////////////////////////////////////////////////////////////////////////////
|
4159 |
|
|
+#ifndef GCC_ZIP_H
|
4160 |
|
|
+#define GCC_ZIP_H
|
4161 |
|
|
+
|
4162 |
|
|
+
|
4163 |
|
|
+//
|
4164 |
|
|
+//
|
4165 |
127 |
dgisselq |
+// Zip CPU configuration defines
|
4166 |
102 |
dgisselq |
+//
|
4167 |
|
|
+//
|
4168 |
|
|
+#define ZIP_USER 0 // Assume we are in supervisor mode
|
4169 |
|
|
+#define ZIP_MULTIPLY 1 // Assume we have multiply instructions
|
4170 |
|
|
+#define ZIP_DIVIDE 1 // Assume we have divide instructions
|
4171 |
|
|
+#define ZIP_FPU 0 // Assume we have no floating point instructions
|
4172 |
|
|
+#define ZIP_PIPELINED 1 // Assume our instructions are pipelined
|
4173 |
202 |
dgisselq |
+#define ZIP_THUMB 1 // Assume we have the THUMB feature
|
4174 |
200 |
dgisselq |
+#define ZIP_ATOMIC (ZIP_PIPELINED)
|
4175 |
102 |
dgisselq |
+#define ZIP_PIC 0 // Attempting to produce PIC code, with GOT
|
4176 |
|
|
+#define ZIP_HAS_DI 1
|
4177 |
127 |
dgisselq |
+// Should we use the peephole optimizations?
|
4178 |
|
|
+#define ZIP_PEEPHOLE 1 // 0 means no peephole optimizations.
|
4179 |
202 |
dgisselq |
+#define ZIP_NOT_AN_INSTRUCTION "NAI\t;// This is not an instruction. Getting here implies a compiler error. Please contact help support\n"
|
4180 |
102 |
dgisselq |
+
|
4181 |
|
|
+// Zip has 16 registers in each user mode.
|
4182 |
|
|
+// Register 15 is the program counter (PC)
|
4183 |
|
|
+// Register 14 is the condition codes (CC)
|
4184 |
|
|
+// Register 13 is the stack pointer (SP)
|
4185 |
|
|
+// Register 12 (may be) the Global Offset Table pointer (GOT)
|
4186 |
|
|
+// Register 0 (may be) the return address pointer
|
4187 |
|
|
+// Registers 16-31 may only be used in supervisor mode.
|
4188 |
|
|
+#define is_ZIP_GENERAL_REG(REGNO) ((REGNO)<13)
|
4189 |
171 |
dgisselq |
+#define is_ZIP_REG(REGNO) ((REGNO)<33)
|
4190 |
102 |
dgisselq |
+
|
4191 |
171 |
dgisselq |
+#define zip_AP_PSEUDO 32
|
4192 |
103 |
dgisselq |
+#define zip_PC 15
|
4193 |
|
|
+#define zip_CC 14
|
4194 |
|
|
+#define zip_SP 13
|
4195 |
|
|
+#define zip_FP 12
|
4196 |
|
|
+#define zip_GOT 11
|
4197 |
171 |
dgisselq |
+// #define zip_AP 10 // We're using a PSEUDO REG instead
|
4198 |
202 |
dgisselq |
+#define zip_R5 5 // Used for the static chain, if it exists
|
4199 |
103 |
dgisselq |
+#define zip_R1 1
|
4200 |
|
|
+#define zip_R0 0
|
4201 |
202 |
dgisselq |
+#define zip_LR zip_R0 // Link Register is also R0
|
4202 |
102 |
dgisselq |
+
|
4203 |
|
|
+#define ZIP_FIRST_ARG_REGNO 1
|
4204 |
|
|
+#define ZIP_LAST_ARG_REGNO 5
|
4205 |
111 |
dgisselq |
+#define NUM_ARG_REGS (ZIP_LAST_ARG_REGNO-ZIP_FIRST_ARG_REGNO+1)
|
4206 |
|
|
+#define MAX_PARM_REGS (ZIP_LAST_ARG_REGNO-ZIP_FIRST_ARG_REGNO+1)
|
4207 |
102 |
dgisselq |
+
|
4208 |
|
|
+/* The overall framework of an assembler file */
|
4209 |
|
|
+
|
4210 |
|
|
+#define ASM_COMMENT_START ";"
|
4211 |
|
|
+#define ASM_APP_ON ""
|
4212 |
|
|
+#define ASM_APP_OFF ""
|
4213 |
|
|
+
|
4214 |
|
|
+#define FILE_ASM_OP "\t.file\n"
|
4215 |
|
|
+
|
4216 |
|
|
+/* Output and Generation of Labels */
|
4217 |
|
|
+#define GLOBAL_ASM_OP "\t.global\t"
|
4218 |
|
|
+
|
4219 |
202 |
dgisselq |
+#define BITS_PER_WORD 32
|
4220 |
102 |
dgisselq |
+
|
4221 |
|
|
+
|
4222 |
|
|
+/* A C compound statement to output to stdio stream STREAM the assembler syntax
|
4223 |
|
|
+ * for an instruction operand X. */
|
4224 |
|
|
+#define PRINT_OPERAND(STREAM, X, CODE) zip_print_operand(STREAM, X, CODE)
|
4225 |
|
|
+#define PRINT_OPERAND_ADDRESS(STREAM, X) zip_print_operand_address(STREAM, X)
|
4226 |
|
|
+
|
4227 |
|
|
+/* Passing arguments in registers */
|
4228 |
|
|
+#define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO)==zip_R1)
|
4229 |
|
|
+
|
4230 |
|
|
+/* Define how to find the value returned by a function. VALTYPE is the data
|
4231 |
|
|
+ * type of the value (as a tree). If the precise function being called is known
|
4232 |
|
|
+ * FUNC is its FUNCTION_DECL; otherwise, FUNC is 0. */
|
4233 |
|
|
+#define FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx_REG(TYPE_MODE(VALTYPE), zip_R1)
|
4234 |
|
|
+
|
4235 |
|
|
+/* Define how to find the value returned by a library function assuming the
|
4236 |
|
|
+ * value has mode MODE.
|
4237 |
|
|
+ */
|
4238 |
|
|
+#define LIBCALL_VALUE(MODE) gen_rtx_REG(MODE, zip_R1)
|
4239 |
|
|
+
|
4240 |
|
|
+
|
4241 |
|
|
+/* STACK AND CALLING */
|
4242 |
|
|
+
|
4243 |
|
|
+
|
4244 |
|
|
+/* Define this macro as a C expression that is nonzero for registers that are
|
4245 |
|
|
+ * used by the epilogue or the return pattern. The stack and frame pointer
|
4246 |
|
|
+ * registers are already assumed to be used as needed.
|
4247 |
|
|
+ */
|
4248 |
|
|
+#define EPILOGUE_USES(R) (R == RETURN_ADDRESS_REGNUM)
|
4249 |
|
|
+
|
4250 |
|
|
+
|
4251 |
|
|
+/* The best alignment to use in cases where we have a choice. */
|
4252 |
127 |
dgisselq |
+#define FASTEST_ALIGNMENT BITS_PER_WORD
|
4253 |
102 |
dgisselq |
+
|
4254 |
|
|
+/* Generate Code for Profiling
|
4255 |
|
|
+ */
|
4256 |
|
|
+#define FUNCTION_PROFILER(FILE,LABELNO) (abort(), 0)
|
4257 |
|
|
+
|
4258 |
|
|
+
|
4259 |
|
|
+/* A C expression which is nonzero if register number NUM is suitable for use
|
4260 |
|
|
+ * as an index register in operand addresses.
|
4261 |
|
|
+ */
|
4262 |
|
|
+#define REGNO_OK_FOR_INDEX_P(NUM) 0
|
4263 |
|
|
+
|
4264 |
|
|
+
|
4265 |
|
|
+/* A C compound statement with a conditional 'goto LABEL;' executed if X
|
4266 |
|
|
+ * (an RTX) is a legitimate memory address on the target machine for a memory
|
4267 |
|
|
+ * operand of mode MODE.
|
4268 |
|
|
+ */
|
4269 |
111 |
dgisselq |
+/* 17.03 Controlling the Compilation Driver, 'gcc' */
|
4270 |
|
|
+// DRIVER_SELF_SPECS
|
4271 |
|
|
+// OPTION_DEFAULT_SPECS
|
4272 |
|
|
+// CPP_SPEC
|
4273 |
|
|
+// CPLUSPLUS_CPP_SPEC
|
4274 |
|
|
+// CC1_SPEC
|
4275 |
|
|
+// CC1PLUS_SPEC
|
4276 |
|
|
+/* ASM_SPEC ... A C string constant that tells the GCC driver program options
|
4277 |
|
|
+ * to pass to the assembler. It can also specify how to translate options you
|
4278 |
|
|
+ * give to GCC into options for GCC to pass to the assembler. See the file
|
4279 |
|
|
+ * 'sun3.h' for an example of this.
|
4280 |
|
|
+ *
|
4281 |
|
|
+ * Do not define thismacro if it does not need to do anything.
|
4282 |
|
|
+ */
|
4283 |
|
|
+// #undef ASM_SPEC
|
4284 |
|
|
+// ASM_FINAL_SPEC
|
4285 |
|
|
+// ASM_NEEDS_DASH_FOR_PIPED_INPUT
|
4286 |
|
|
+
|
4287 |
|
|
+/* LINK_SPEC ... A C string constant that tells the GCC driver program options
|
4288 |
|
|
+ * to pass to the linker. It can also specify how to translate options you give
|
4289 |
|
|
+ * to GCC into options for GCC to pass to the linker.
|
4290 |
|
|
+ *
|
4291 |
|
|
+ * Do not define this macro if it does not need to do anything.
|
4292 |
|
|
+ */
|
4293 |
|
|
+
|
4294 |
|
|
+/* LIB_SPEC ... Another C string constant very much like LINK_SPEC. The
|
4295 |
|
|
+ * difference between the two is that LIB_SPEC is used at the end of the
|
4296 |
|
|
+ * command given to the linker.
|
4297 |
|
|
+ *
|
4298 |
|
|
+ * If this macro is not defined, a default is provided that loads the standard
|
4299 |
|
|
+ * C library from the usual place. See 'gcc.c'.
|
4300 |
202 |
dgisselq |
+ *
|
4301 |
|
|
+ * ZipCPU ... We need this at its default value. It is necessary to build
|
4302 |
|
|
+ * the various GCC libraries that depend upon one another and newlib. Hence,
|
4303 |
|
|
+ * as an example we *must* include the library containing strnlen or libgfortran
|
4304 |
|
|
+ * will not. Alternatively, we might figure out how to pass arguments to the
|
4305 |
|
|
+ * compiler via the configure process ... but we'll just allow this to have its
|
4306 |
|
|
+ * default value for now.
|
4307 |
111 |
dgisselq |
+ */
|
4308 |
202 |
dgisselq |
+// #undef LIB_SPEC
|
4309 |
111 |
dgisselq |
+// #define LIB_SPEC "%{!g:-lc} %{g:-lg} -lzip"
|
4310 |
202 |
dgisselq |
+// #define LIB_SPEC ""
|
4311 |
111 |
dgisselq |
+
|
4312 |
|
|
+/* LIBGCC_SPEC ... Another C string constant that tells the GCC driver program
|
4313 |
|
|
+ * hoow and when to place a reference to 'libgcc.a' into the linker command
|
4314 |
|
|
+ * line. This constant is placed both before and after the value of LIB_SPEC.
|
4315 |
|
|
+ *
|
4316 |
|
|
+ * If this macro is not defined, the GCC driver provides a default that passes
|
4317 |
|
|
+ * the string '-lgcc' to the linker.
|
4318 |
|
|
+ */
|
4319 |
|
|
+#undef LIBGCC_SPEC
|
4320 |
|
|
+#define LIBGCC_SPEC ""
|
4321 |
|
|
+
|
4322 |
|
|
+/* REAL_LIBGCC_SPEC ... By default, if ENABLE_SHARED_LIBGCC is defined, the
|
4323 |
|
|
+ * LIBGCC_SPEC is not directly used by the driver program but is instead
|
4324 |
|
|
+ * modified to refer to different versions of 'libgcc.a' depending on the
|
4325 |
|
|
+ * values of the command line flags '-static', '-shared', '-static-libgcc',
|
4326 |
|
|
+ * and '-shared-libgcc'. On targets where these modifications are
|
4327 |
|
|
+ * inappropriate, define REAL_LIBGCC_SPEC instead. REAL_LIBGCC_SPEC tells the
|
4328 |
|
|
+ * driver how to place a reference to 'libgcc' on the link command line, but
|
4329 |
|
|
+ * unlike LIBGCC_SPEC, it is used unmodified.
|
4330 |
|
|
+ */
|
4331 |
|
|
+#define REAL_LIBGCC_SPEC ""
|
4332 |
|
|
+
|
4333 |
|
|
+// USE_LD_AS_NEEDED
|
4334 |
|
|
+// LINK_EH_SPEC
|
4335 |
|
|
+
|
4336 |
|
|
+/* STARTFILE_SPEC ... Another C string constant used much like LINK_SPEC. The
|
4337 |
|
|
+ * difference between the two is that STARTFILE_SPEC is used at the very
|
4338 |
|
|
+ * beginning of the command given to the linker.
|
4339 |
|
|
+ *
|
4340 |
|
|
+ * If this macro is not defined, a default is provided that loads the standard
|
4341 |
|
|
+ * C startup file from the usual place. See 'gcc.c'
|
4342 |
|
|
+ */
|
4343 |
|
|
+#undef STARTFILE_SPEC
|
4344 |
|
|
+#define STARTFILE_SPEC ""
|
4345 |
|
|
+
|
4346 |
|
|
+/* ENDFILE_SPEC ... Another C string constant used much like LINK_SPEC. The
|
4347 |
|
|
+ * difference between the two is that ENDFILE_SPEC is used at the very end
|
4348 |
|
|
+ * of the command given to the linker.
|
4349 |
|
|
+ *
|
4350 |
|
|
+ * Do not define this macro if it does not do anything.
|
4351 |
|
|
+ */
|
4352 |
|
|
+// #undef ENDFILE_SPEC
|
4353 |
|
|
+// #define ENDFILE_SPEC ""
|
4354 |
|
|
+
|
4355 |
|
|
+// THREAD_MODEL_SPEC
|
4356 |
|
|
+// SYSROOT_SUFFIX_SPEC
|
4357 |
|
|
+// SYSROOT_HEADERS_SUFFIX_SPEC
|
4358 |
|
|
+// EXTRA_SPECS
|
4359 |
|
|
+// LINK_LIBGCC_SPECIAL_1
|
4360 |
|
|
+// LINK_GCC_C_SEQUENCE_SPEC
|
4361 |
|
|
+// LINK_COMMAND_SPEC
|
4362 |
|
|
+// TARGET_ALWAYS_STRIP_DOTDOT
|
4363 |
|
|
+// MULTILIB_DEFAULTS
|
4364 |
|
|
+// RELATIVE_PREFIX_NOT_LINKDIR
|
4365 |
|
|
+// MD_EXEC_PREFIX
|
4366 |
|
|
+// STANDARD_STARTFILE_PREFIX
|
4367 |
|
|
+// STANDARD_STARTFILE_PREFIX_1
|
4368 |
|
|
+// STANDARD_STARTFILE_PREFIX_2
|
4369 |
|
|
+// MD_STARTFILE_PREFIX
|
4370 |
|
|
+// MD_STARTFILE_PREFIX_1
|
4371 |
|
|
+// INIT_ENVIRONMENT
|
4372 |
|
|
+// LOCAL_INCLUDE_DIR
|
4373 |
|
|
+#undef LOCAL_INCLUDE_DIR
|
4374 |
|
|
+
|
4375 |
|
|
+// NATIVE_SYSTEM_HEADER_COMPONENT
|
4376 |
|
|
+// INCLUDE_DEFAULTS
|
4377 |
|
|
+
|
4378 |
102 |
dgisselq |
+/* 17.03 Run-time Target Specification */
|
4379 |
|
|
+
|
4380 |
|
|
+/* TARGET_CPU_CPP_BUILTINS() ... This function-like macro expands to a block of
|
4381 |
|
|
+ * code that defines built-in preprocessor macros and assertions for the target
|
4382 |
|
|
+ * CPU, using the functions builtin_define, builtin_define_std, and
|
4383 |
|
|
+ * builtin_assert. When the front end calls this macro it provides a trailing
|
4384 |
|
|
+ * semicolon, and since it has finished command line option proccessing your
|
4385 |
|
|
+ * code can use those results freely.
|
4386 |
|
|
+ *
|
4387 |
|
|
+ * ZipCPU --- We should probably capture in this macro what capabilities the
|
4388 |
|
|
+ * command line parameters we've been given indicate that our CPU has. That
|
4389 |
|
|
+ * way, code can be adjusted depending upon the CPU's capabilities.
|
4390 |
|
|
+ */
|
4391 |
202 |
dgisselq |
+#define TARGET_CPU_CPP_BUILTINS() \
|
4392 |
|
|
+ { builtin_define("__ZIPCPU__"); \
|
4393 |
|
|
+ builtin_define("__IEEE_BIG_ENDIAN"); \
|
4394 |
|
|
+ builtin_define("_LDBL_EQ_DBL"); \
|
4395 |
|
|
+ if (ZIP_FPU) builtin_define("__ZIPFPU__"); \
|
4396 |
|
|
+ else builtin_define("_SOFT_FLOAT"); \
|
4397 |
102 |
dgisselq |
+ if (ZIP_ATOMIC) builtin_define("__ZIPATOMIC__"); \
|
4398 |
|
|
+ }
|
4399 |
|
|
+ // If (zip_param_has_fpu) builtin_define("__ZIPFPU__");
|
4400 |
|
|
+ // If (zip_param_has_div) builtin_define("__ZIPDIV__");
|
4401 |
|
|
+ // If (zip_param_has_mpy) builtin_define("__ZIPMPY__");
|
4402 |
|
|
+ // If (zip_param_has_lock) builtin_define("__ZIPLOCK__");
|
4403 |
|
|
+ // If (zip_param_supervisor) builtin_define("__ZIPUREGS__");
|
4404 |
|
|
+ // If (we support int64s) builtin_define("___int64_t_defined");
|
4405 |
|
|
+
|
4406 |
|
|
+/* TARGET_OS_CPP_BUILTINS() ... Similarly to TARGET_CPU_CPP_BUILTINS but this
|
4407 |
|
|
+ * macro is optional and is used for the target operating system instead.
|
4408 |
|
|
+ */
|
4409 |
|
|
+
|
4410 |
|
|
+/* Option macros: (we need to define these eventually ... )
|
4411 |
|
|
+ *
|
4412 |
|
|
+ * TARGET_HANDLE_OPTION
|
4413 |
|
|
+ * TARGET_HANDLE_C_OPTION
|
4414 |
|
|
+ * TARGET_OBJ_CONSTRUCT_STRING_OBJECT
|
4415 |
|
|
+ * TARGET_OBJ_DECLARE_UNRESOLVED_CLASS_REFERENCE
|
4416 |
|
|
+ * TARGET_OBJ_DECLARE_CLASS_DEFINITION
|
4417 |
|
|
+ * TARGET_STRING_OBJECT_REF_TYPE_P
|
4418 |
|
|
+ * TARGET_CHECK_STRING_OBJECT_FORMAT_ARG
|
4419 |
|
|
+ * TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE(VOID)
|
4420 |
|
|
+ * C_COMMON_OVERRIDE_OTPTIONS
|
4421 |
|
|
+ * TARGET_OPTION_OPTIMIZATION_TABLE
|
4422 |
|
|
+ * TARGET_OPTION_INIT_STRUCT
|
4423 |
|
|
+ * TARGET_OPTION_DEFAULT_PARAMS
|
4424 |
|
|
+ */
|
4425 |
|
|
+
|
4426 |
|
|
+/* SWITCHABLE_TARGET
|
4427 |
|
|
+ *
|
4428 |
|
|
+ * Zip CPU doesn't need this, so it defaults to zero. No need to change it
|
4429 |
|
|
+ * here.
|
4430 |
|
|
+ */
|
4431 |
|
|
+
|
4432 |
|
|
+/* TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(VOID) ... Returns true if the
|
4433 |
|
|
+ * target supports IEEE 754 floating-point exceptions and rounding modes, false
|
4434 |
|
|
+ * otherwise. This is intended to relate to the float and double types, but not
|
4435 |
|
|
+ * necessarily "long double". By default, returns true if the adddf3
|
4436 |
|
|
+ * instruction pattern is available and false otherwise, on the assumption that
|
4437 |
|
|
+ * hardware floating point supports exceptions and rounding modes but software
|
4438 |
|
|
+ * floating point does not.
|
4439 |
|
|
+ *
|
4440 |
|
|
+ * ZipCPU floating point is barely going to be functional, I doubt it will
|
4441 |
|
|
+ * support all of these bells and whistles when full functionality is even
|
4442 |
|
|
+ * achieved. Therefore, we won't support these modes. However, we can't just
|
4443 |
|
|
+ * set this to zero, so let's come back to this.
|
4444 |
|
|
+ */
|
4445 |
|
|
+// #warning "Wrong answer encoded to date"
|
4446 |
103 |
dgisselq |
+// #undef TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
|
4447 |
102 |
dgisselq |
+// #define TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(X) 0
|
4448 |
|
|
+
|
4449 |
|
|
+/* 17.04 Defining data structures for per-function information */
|
4450 |
|
|
+
|
4451 |
|
|
+/* INIT_EXPANDERS ... Macro called to initialize any target specific
|
4452 |
|
|
+ * information. This macro is called once per function, before generation of
|
4453 |
|
|
+ * any RTL has begun. The intention is to allow the initialization of the
|
4454 |
|
|
+ * function pointer init_machine_status.
|
4455 |
|
|
+ */
|
4456 |
|
|
+// #warning "I may need to define this to handle function return addresses ..."
|
4457 |
|
|
+
|
4458 |
202 |
dgisselq |
+
|
4459 |
102 |
dgisselq |
+/* 17.05 Storage Layout */
|
4460 |
|
|
+
|
4461 |
202 |
dgisselq |
+
|
4462 |
102 |
dgisselq |
+/* Storage Layout */
|
4463 |
|
|
+#define BITS_BIG_ENDIAN 0 // MSB has highest number
|
4464 |
|
|
+#define BYTES_BIG_ENDIAN 1 // 1 if MSB is lowest number
|
4465 |
|
|
+#define WORDS_BIG_ENDIAN 1 // 1 if MSW is lowest number
|
4466 |
|
|
+#define FLOAT_WORDS_BIG_ENDIAN 1
|
4467 |
202 |
dgisselq |
+#define UNITS_PER_WORD 4 // Storage units in a word, pwr of 2:1-8
|
4468 |
102 |
dgisselq |
+/* POINTER_SIZE ... Width of a pointer in bits. You must specify a value no
|
4469 |
|
|
+ * wider than the width of Pmode. If it is not equal to the width of Pmode,
|
4470 |
|
|
+ * you must define POINTERS_EXTEND_UNSIGNED. If you do not specify a value the
|
4471 |
|
|
+ * default is BITS_PER_WORD.
|
4472 |
|
|
+ *
|
4473 |
|
|
+ * ZipCPU --- All of our pointers are 32-bits, the width of our address bus.
|
4474 |
|
|
+ */
|
4475 |
|
|
+#define POINTER_SIZE 32 // Ptr width in bits
|
4476 |
202 |
dgisselq |
+
|
4477 |
102 |
dgisselq |
+/* POINTERS_EXTEND_UNSIGNED ... A C expression that determines how pointers
|
4478 |
|
|
+ * should be extended from ptr_mode to either Pmode or word_mode. It is greater
|
4479 |
|
|
+ * than zero if pointers should be zero-extended, zero if they should be sign
|
4480 |
|
|
+ * extended, and negative if some other conversion is needed. In the last case,
|
4481 |
|
|
+ * the extension is done by the target's ptr_extend instruction.
|
4482 |
|
|
+ *
|
4483 |
|
|
+ * You need not define this macro if the ptr_mode, Pmode, and word_mode are all
|
4484 |
|
|
+ * the same width.
|
4485 |
|
|
+ *
|
4486 |
202 |
dgisselq |
+ * ZipCPU --- We don't need to define this macro, since PMode and ptr_mode, and
|
4487 |
|
|
+ * our word_mode (SImode) all have the same width.
|
4488 |
102 |
dgisselq |
+ */
|
4489 |
202 |
dgisselq |
+// #define POINTERS_EXTEND_UNSIGNED 1
|
4490 |
102 |
dgisselq |
+
|
4491 |
|
|
+/* PROMOTE_MODE(m,unsignedp,type) ... A macro to update m and unsignedp when an
|
4492 |
|
|
+ * object whose type is type and which has he specified mode and signedness is
|
4493 |
|
|
+ * to be stored in a register. This macro is only called when type is a scalar
|
4494 |
|
|
+ * type.
|
4495 |
|
|
+ *
|
4496 |
|
|
+ * On most RISC machines, which only have operations that operate on a full
|
4497 |
|
|
+ * register, define this macro to set m to word_mode if m is an integer mode
|
4498 |
|
|
+ * narrower than BITS_PER_WORD. In most cases, only integer modes should be
|
4499 |
|
|
+ * widened because wider precision floating-point operations are usually more
|
4500 |
|
|
+ * expensive than their narrower counterparts.
|
4501 |
|
|
+ *
|
4502 |
|
|
+ * For most machines, the macro definition does not change unsigndep. However,
|
4503 |
|
|
+ * some machines, have instructions that preferentially handle either signed or
|
4504 |
|
|
+ * unsigned quantities of certain modes. For example, on the DEC Alpha, 32-bit
|
4505 |
|
|
+ * loads from memory and 32-bit add instructions sign-extend the result to
|
4506 |
|
|
+ * 64-bits. On such machines, set unsignedp according to which kind of extension
|
4507 |
|
|
+ * is more efficient.
|
4508 |
|
|
+ *
|
4509 |
|
|
+ * Do not define this macro if it would never modify m.
|
4510 |
|
|
+ *
|
4511 |
202 |
dgisselq |
+ * ZipCPU ---
|
4512 |
102 |
dgisselq |
+ */
|
4513 |
202 |
dgisselq |
+#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
|
4514 |
|
|
+ do { \
|
4515 |
|
|
+ if ((GET_MODE_CLASS(MODE) == MODE_INT) \
|
4516 |
|
|
+ && (GET_MODE_SIZE(MODE) < 4)) { \
|
4517 |
|
|
+ (MODE) = SImode; \
|
4518 |
|
|
+ (UNSIGNEDP) = 1; \
|
4519 |
|
|
+ } \
|
4520 |
|
|
+ } while(0)
|
4521 |
102 |
dgisselq |
+
|
4522 |
|
|
+// TARGET_PROMOTE_FUNCTION_MODE
|
4523 |
202 |
dgisselq |
+#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
|
4524 |
|
|
+
|
4525 |
102 |
dgisselq |
+/* PARM_BOUNDARY ... Normal alignment required for function parameters on the
|
4526 |
|
|
+ * stack, in bits. All stack parameters receive at least this much alignment
|
4527 |
|
|
+ * regardless of data type. On most machines, this is the same as the size of
|
4528 |
|
|
+ * an integer.
|
4529 |
|
|
+ */
|
4530 |
|
|
+#define PARM_BOUNDARY 32
|
4531 |
|
|
+
|
4532 |
|
|
+/* STACK_BOUNDARY ... Define this macro to the minimum alignment enforced by
|
4533 |
|
|
+ * hardware for the stack pointer on this machine. The definition is a C
|
4534 |
|
|
+ * expression for the desired alignment (measured in bits). This value is used
|
4535 |
|
|
+ * as a default if PREFERRED_STACK_BOUNDARY is not defined. On most machines,
|
4536 |
|
|
+ * this should be the same as PARM_BOUNDARY.
|
4537 |
|
|
+ */
|
4538 |
|
|
+#define STACK_BOUNDARY PARM_BOUNDARY
|
4539 |
|
|
+
|
4540 |
|
|
+/* PREFERRED_STACK_BOUNDARY ... Define this ... */
|
4541 |
127 |
dgisselq |
+#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY
|
4542 |
102 |
dgisselq |
+
|
4543 |
127 |
dgisselq |
+/* INCOMING_STACK_BOUNDARY ... Define this macro if the incoming stack boundary
|
4544 |
|
|
+ * may be different from PREFERRED_STACK_BOUNDARY. This macro must evaluate
|
4545 |
|
|
+ * to a value equal to or larger than STACK_BOUNDARY.
|
4546 |
102 |
dgisselq |
+ */
|
4547 |
127 |
dgisselq |
+#define INCOMING_STACK_BOUNDARY STACK_BOUNDARY
|
4548 |
102 |
dgisselq |
+
|
4549 |
|
|
+/* FUNCTION_BOUNDARY ... Alignment required for a function entry point, in bits.
|
4550 |
|
|
+ */
|
4551 |
|
|
+#define FUNCTION_BOUNDARY 32
|
4552 |
|
|
+
|
4553 |
|
|
+/* BIGGEST_ALIGNMENT ... Biggest alignment that any data type can require on
|
4554 |
|
|
+ * this machine, in bits. Note that this is not the biggest alignment that is
|
4555 |
|
|
+ * supported, just the biggest alignment that, when violated, may cause a fault.
|
4556 |
|
|
+ */
|
4557 |
|
|
+#define BIGGEST_ALIGNMENT 32
|
4558 |
|
|
+
|
4559 |
127 |
dgisselq |
+/* MALLOC_ABI_ALIGNMENT
|
4560 |
|
|
+ */
|
4561 |
|
|
+
|
4562 |
|
|
+/* ATTRIBUTE_ALIGNED_VALUE
|
4563 |
|
|
+ */
|
4564 |
|
|
+
|
4565 |
102 |
dgisselq |
+/* MINIMUM_ATOMIC_ALIGNMENT ... If defined, the smallest alignment, that can be
|
4566 |
|
|
+ * given to an object that can be referenced in one operation, without
|
4567 |
|
|
+ * disturbing any nearby object. Normally, this is BITS_PER_UNIT, but may be
|
4568 |
|
|
+ * larger on machines that don't have byte or halfword store operations.
|
4569 |
|
|
+ */
|
4570 |
|
|
+#define MINIMUM_ATOMIC_ALIGNMENT BITS_PER_UNIT
|
4571 |
|
|
+
|
4572 |
127 |
dgisselq |
+/* BIGGEST_FIELD_ALIGNMENT ... Biggest alignment that any structure or union
|
4573 |
|
|
+ * field can require on this machine, in bits. If defined, this overrides
|
4574 |
|
|
+ * BIGGEST_ALIGNMENT for structure and union fields only, unless the field
|
4575 |
|
|
+ * alignment has been set by the __attribute__((aligned(n))) construct.
|
4576 |
|
|
+ */
|
4577 |
202 |
dgisselq |
+#define BIGGEST_FIELD_ALIGNMENT BITS_PER_WORD
|
4578 |
127 |
dgisselq |
+
|
4579 |
202 |
dgisselq |
+/* ADJUST_FIELD_ALIGN(FIELD, COMPUTED) ... An expression for the alignment of
|
4580 |
|
|
+ * a structure field FIELD if the alignment computed in the usual way (including
|
4581 |
|
|
+ * applying BIGGEST_ALIGNMENT and BIGGEST_FIELD_ALIGNMENT) is COMPUTED.
|
4582 |
127 |
dgisselq |
+ */
|
4583 |
202 |
dgisselq |
+// #define ADJUST_FIELD_ALIGN(A,B) BITS_PER_WORD
|
4584 |
127 |
dgisselq |
+
|
4585 |
202 |
dgisselq |
+/* MAX_STACK_ALIGNMENT ... Biggest stack alignment guaranteed by the backend.
|
4586 |
|
|
+ * Use this macro to specify the maximum alignment of a variable on the stack.
|
4587 |
|
|
+ *
|
4588 |
|
|
+ * If not defined, the default value is STACK_BOUNDARY
|
4589 |
127 |
dgisselq |
+ */
|
4590 |
202 |
dgisselq |
+// #define MAX_STACK_ALIGNMENT BITS_PER_WORD
|
4591 |
127 |
dgisselq |
+
|
4592 |
|
|
+/* MAX_OFILE_ALIGNMENT
|
4593 |
|
|
+ */
|
4594 |
|
|
+
|
4595 |
|
|
+/* DATA_ALIGNMENT(TYPE, BASIC-ALIGN) ... If defined, a C expression to compute
|
4596 |
|
|
+ * the alignment for a variable in the static store. TYPE is the data type, and
|
4597 |
|
|
+ * BASIC-ALIGN is the alignment that the object would ordinarily have. The
|
4598 |
|
|
+ * value of this macro is used instead of that alignment to align the object.
|
4599 |
|
|
+ *
|
4600 |
|
|
+ * If this macro is not defined, then BASIC-ALIGN is used.
|
4601 |
|
|
+ *
|
4602 |
202 |
dgisselq |
+ * ZipCPU --
|
4603 |
127 |
dgisselq |
+ */
|
4604 |
202 |
dgisselq |
+// #define DATA_ALIGNMENT(TYPE, ALIGN) BITS_PER_WORD
|
4605 |
127 |
dgisselq |
+
|
4606 |
|
|
+
|
4607 |
|
|
+/* DATA_ABI_ALIGNMENT(TYPE,BASIC-ALIGN)
|
4608 |
|
|
+ */
|
4609 |
|
|
+
|
4610 |
|
|
+/* CONSTANT_ALIGNMENT(CONST, BASIC-ALIGN) ... If defined, a C expression to
|
4611 |
|
|
+ * compute the alignment given to a constant that is being placed in memory.
|
4612 |
|
|
+ * CONST is the constant and BASIC-ALIGN is the alignment that the object
|
4613 |
|
|
+ * would ordinarily have. The value of this macro is used instead of that
|
4614 |
|
|
+ * alignment to align the object.
|
4615 |
|
|
+ *
|
4616 |
|
|
+ * If this macro is not defined, then BASIC-ALIGN is used.
|
4617 |
|
|
+ *
|
4618 |
|
|
+ * ZipCPU -- in hindsiht, if this macro is not defined then the compiler is
|
4619 |
|
|
+ * broken. We'll define it as above.
|
4620 |
|
|
+ *
|
4621 |
|
|
+ */
|
4622 |
|
|
+#define CONSTANT_ALIGNMENT(EXP, ALIGN) BITS_PER_WORD
|
4623 |
|
|
+
|
4624 |
|
|
+/* LOCAL_ALIGNMENT(TYPE,BASIC-ALIGN) ... If defined ...
|
4625 |
|
|
+ */
|
4626 |
202 |
dgisselq |
+// #define LOCAL_ALIGNMENT(TYP,ALIGN) BITS_PER_WORD
|
4627 |
127 |
dgisselq |
+
|
4628 |
|
|
+/* TARGET_VECTOR_ALIGNMENT
|
4629 |
|
|
+ */
|
4630 |
|
|
+
|
4631 |
|
|
+/* STACK_SLOT_ALIGNMENT
|
4632 |
|
|
+ */
|
4633 |
|
|
+#define STACK_SLOT_ALIGNMENT(T,M,B) BITS_PER_WORD
|
4634 |
|
|
+
|
4635 |
|
|
+/* LOCAL_DECL_ALIGNMEN(DECL)
|
4636 |
|
|
+ */
|
4637 |
202 |
dgisselq |
+// #define LOCAL_DECL_ALIGNMENT(DECL) BITS_PER_WORD
|
4638 |
127 |
dgisselq |
+
|
4639 |
|
|
+/* MINIMUM_ALIGNMENT
|
4640 |
|
|
+ */
|
4641 |
202 |
dgisselq |
+// #define MINIMUM_ALIGNMENT(EXP,MOD,ALIGN) BITS_PER_WORD
|
4642 |
127 |
dgisselq |
+
|
4643 |
|
|
+/* EMPTY_FIELD_BOUNDARY
|
4644 |
|
|
+ * Alignment of field after 'int : 0' in a structure.
|
4645 |
|
|
+ */
|
4646 |
|
|
+#define EMPTY_FIELD_BOUNDARY BITS_PER_WORD
|
4647 |
|
|
+
|
4648 |
|
|
+/* STRUCTURE_SIE_BOUNDARY
|
4649 |
|
|
+ * ZipCPU -- Every structures size must be a multiple of 32-bits.
|
4650 |
|
|
+ */
|
4651 |
|
|
+#define STRUCTURE_SIZE_BOUNDARY BITS_PER_WORD
|
4652 |
|
|
+
|
4653 |
102 |
dgisselq |
+/* STRICT_ALIGNMENT ... Set this nonzero if move instructions will actually
|
4654 |
|
|
+ * fail to work when given unaligned data. If instructions will merely go
|
4655 |
|
|
+ * slower in that case, define this macro as 0.
|
4656 |
125 |
dgisselq |
+ *
|
4657 |
202 |
dgisselq |
+ * ZipCPU --
|
4658 |
102 |
dgisselq |
+ */
|
4659 |
202 |
dgisselq |
+#define STRICT_ALIGNMENT 1
|
4660 |
102 |
dgisselq |
+
|
4661 |
127 |
dgisselq |
+/* PCC_BITFIELD_TYPE_MATTERS -- define this if you wish to imitate the the way
|
4662 |
|
|
+ * other C compilers handle alignment of bit-fields and the structures that
|
4663 |
|
|
+ * contain them.
|
4664 |
|
|
+ *
|
4665 |
|
|
+ * The behavior is that the type written for a named bit-field (int, short, or
|
4666 |
|
|
+ * other integer type) imposes an alignment for the entire structure, as if the
|
4667 |
|
|
+ * structure really did contain an ordinary field of that type. In addition,
|
4668 |
|
|
+ * the bit-field is placed within the structure so that it would fit within
|
4669 |
|
|
+ * such a field, not crossing a boundary for it.
|
4670 |
|
|
+ *
|
4671 |
|
|
+ * Thus, no most machines, a named bit-field whose type is written as int would
|
4672 |
|
|
+ * not cross a four-byte boundary, and would force four-byte alignment for the
|
4673 |
|
|
+ * whole structure. (The alignment used may not be four bytes; it is controlled
|
4674 |
|
|
+ * by other alignment parameters.)
|
4675 |
|
|
+ *
|
4676 |
|
|
+ * An unnamed bit-field will not affect the alignment of the containing
|
4677 |
|
|
+ * structure.
|
4678 |
|
|
+ *
|
4679 |
|
|
+ * If the macro is defined, its definition should be a C expression, a non
|
4680 |
|
|
+ * zero value for the expression enables this behavior.
|
4681 |
|
|
+ * Look at the fundamental type that is used for a bit-field and use that to
|
4682 |
|
|
+ * impose alignment on the enclosing structure. struct s{int a:8}; should
|
4683 |
|
|
+ * have the same alignment as 'int', not 'char'.
|
4684 |
|
|
+ */
|
4685 |
|
|
+#undef PCC_BITFIELD_TYPE_MATTERS
|
4686 |
|
|
+#define PCC_BITFIELD_TYPE_MATTERS 0
|
4687 |
|
|
+
|
4688 |
102 |
dgisselq |
+/* MAX_FIXED_MODE_SIZE ... An integer expression for the size in bits of the
|
4689 |
|
|
+ * largest integer machine mode that should actually be used. All integer
|
4690 |
|
|
+ * machine modes of this size or smaller can be used for structures and unions
|
4691 |
|
|
+ * with the appropriate sizes. If this macro is undefined,
|
4692 |
|
|
+ * GET_MODE_BITSIZE(DImode) is assumed.
|
4693 |
|
|
+ *
|
4694 |
202 |
dgisselq |
+ * ZipCPU ... Get_MODE_BITSIZE(DImode) will be 64, and this really is the
|
4695 |
|
|
+ * size in bits of the largest integer machine mode. However, that's the case
|
4696 |
102 |
dgisselq |
+ * with most DI implementations: A long is two words, spliced together. We'd
|
4697 |
|
|
+ * like to support that eventually, but we need to get there. Hence, let's use
|
4698 |
|
|
+ * compile time flag (ZIP_HAS_DI) that we can enable when we're ready.
|
4699 |
|
|
+ */
|
4700 |
202 |
dgisselq |
+#undef MAX_FIXED_MODE_SIZE
|
4701 |
|
|
+#ifdef ZIP_HAS_DI
|
4702 |
|
|
+# define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE(DImode)
|
4703 |
102 |
dgisselq |
+#else
|
4704 |
202 |
dgisselq |
+# define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE(SImode)
|
4705 |
102 |
dgisselq |
+#endif
|
4706 |
|
|
+
|
4707 |
|
|
+
|
4708 |
202 |
dgisselq |
+
|
4709 |
102 |
dgisselq |
+/* 17.06 Layout of Source Language Data Types */
|
4710 |
|
|
+
|
4711 |
|
|
+#undef LONG_TYPE_SIZE
|
4712 |
|
|
+#undef LONG_LONG_TYPE_SIZE
|
4713 |
|
|
+//
|
4714 |
200 |
dgisselq |
+#define LONG_TYPE_SIZE 64
|
4715 |
102 |
dgisselq |
+#define LONG_LONG_TYPE_SIZE 64
|
4716 |
|
|
+// SHORT_FRAC_TYPE_SIZE
|
4717 |
|
|
+// LONG_FFRACT_TYPE_SIZE
|
4718 |
|
|
+// LONG_LONG_FRACT_TIME_SIZE
|
4719 |
|
|
+
|
4720 |
|
|
+/* LIBGCC2_GNU_PREFIX ... This macro corresponds to the TARGET_GNU_PREFIX target
|
4721 |
|
|
+ * hook and should be defined if that hook is overriden to be true. It causes
|
4722 |
|
|
+ * function names in libgcc to be changed to use a __gnu_ prefix for their name
|
4723 |
|
|
+ * rather than the default __. A port which uses this macro should also arrange
|
4724 |
|
|
+ * to use t-gnu-prefix in the libgcc config.host.
|
4725 |
|
|
+ *
|
4726 |
|
|
+ * ZipCPU -- I see no reason to define and therefore change this behavior.
|
4727 |
|
|
+ */
|
4728 |
|
|
+
|
4729 |
|
|
+/* TARGET_FLT_EVAL_METHOD ... A C expression for the value for FLT_EVAL_METHOD
|
4730 |
|
|
+ * in float.h,, assuming, if applicable, that the floating-point control word
|
4731 |
|
|
+ * is in its default state. If you do not define this macro the value of
|
4732 |
|
|
+ * FLT_EVAL_METHOD will be zero.
|
4733 |
|
|
+ *
|
4734 |
|
|
+ * ZipCPU --- ???
|
4735 |
|
|
+ */
|
4736 |
|
|
+
|
4737 |
|
|
+/* WIDEST_HARDWARE_FP_SIZE ... A C expression for the size in bits of the widest
|
4738 |
|
|
+ * floating-point format supported by the hardware. If you define this macro,
|
4739 |
|
|
+ * you must specify a value less than or equal to the value of LONG_DOUBLE_...
|
4740 |
|
|
+ * If you do not define this macro, the value of LONG_DOUBLE_TYPE_SIZE is the
|
4741 |
|
|
+ * default.
|
4742 |
|
|
+ *
|
4743 |
|
|
+ * ZipCPU supports 32-bit IEEE floats--IF THE SUPPORT IS COMPILED IN! This
|
4744 |
|
|
+ * really needs to be determined, then, based upon a compile time parameter
|
4745 |
|
|
+ * where the one compiling the code states whether or not the H/W even has
|
4746 |
|
|
+ * floating point support.
|
4747 |
|
|
+ *
|
4748 |
|
|
+ * For now, we'll assume it does--but once we implement GCC parameters, we'll
|
4749 |
|
|
+ * need to change this.
|
4750 |
|
|
+ */
|
4751 |
|
|
+#undef WIDEST_HARDWARE_FP_SIZE
|
4752 |
|
|
+// #warning "Definition needs to change if no FPU present"
|
4753 |
|
|
+#define WIDEST_HARDWARE_FP_SIZE FLOAT_TYPE_SIZE
|
4754 |
|
|
+
|
4755 |
|
|
+/* DEFAULT_SIGNED_CHAR ... An expression whose value is 1 or 0, according to
|
4756 |
|
|
+ * whether the type char should be signed or unsigned by default. The user
|
4757 |
|
|
+ * can always override this default with the options -fsigned-char and
|
4758 |
|
|
+ * -funsigned-char.
|
4759 |
|
|
+ *
|
4760 |
202 |
dgisselq |
+ * ZipCPU--Our hardware produces unsigned characters (and shorts) by default,
|
4761 |
|
|
+ * so let's stick to that.
|
4762 |
102 |
dgisselq |
+ */
|
4763 |
202 |
dgisselq |
+#define DEFAULT_SIGNED_CHAR 0
|
4764 |
102 |
dgisselq |
+
|
4765 |
|
|
+/* TARGET_DEFAULT_SHORT_ENUMS(VOID) ... This target hook should return true if
|
4766 |
103 |
dgisselq |
+ * the compiler should give an enum type only as many bytes as it takes to
|
4767 |
102 |
dgisselq |
+ * represent the range of possible values of that type. It should return
|
4768 |
|
|
+ * false if all enum types should be allocated like int.
|
4769 |
|
|
+ *
|
4770 |
|
|
+ * The default is to return false. This is what the ZipCPU needs, so we won't
|
4771 |
|
|
+ * override it.
|
4772 |
|
|
+ */
|
4773 |
|
|
+
|
4774 |
|
|
+/* SIZE_TYPE ... A C expression for a string describing the name of the data
|
4775 |
|
|
+ * type to use for size values. The typedef name size_t is defined using the
|
4776 |
|
|
+ * contents of the string.
|
4777 |
|
|
+ *
|
4778 |
|
|
+ * If you don't define this macro, the default is "long unsigned int". Since
|
4779 |
|
|
+ * on the ZipCPU this is a 32-bit number, and all ZipCPU values are 32-bits,
|
4780 |
|
|
+ * the default seems perfect for us.
|
4781 |
|
|
+ */
|
4782 |
|
|
+#define SIZE_TYPE "unsigned int"
|
4783 |
|
|
+
|
4784 |
|
|
+/* SIZETYPE ... GCC defines internal types () for expressions dealing with size.
|
4785 |
|
|
+ * This macro is a C expression for a string describing the name of the data
|
4786 |
|
|
+ * type from which the precision of sizetype is extracted. The string has the
|
4787 |
|
|
+ * same restrictions as SIZE_TYPE string. If you don't define this macro, the
|
4788 |
|
|
+ * default is SIZE_TYPE --- which seems good enough for us.
|
4789 |
|
|
+ */
|
4790 |
|
|
+
|
4791 |
|
|
+/* PTRDIFF_TYPE ... A C expression for a string describing the name of the data
|
4792 |
127 |
dgisselq |
+ * type to use for the result of subtracting two pointers. The typedef name
|
4793 |
102 |
dgisselq |
+ * ptrdiff_t is defined using the contents of the string. See SIZE_TYPE for
|
4794 |
|
|
+ * more information.
|
4795 |
|
|
+ *
|
4796 |
|
|
+ * The default is "long int" which for the ZipCPU is 32-bits---still good enough
|
4797 |
|
|
+ * for us.
|
4798 |
|
|
+ */
|
4799 |
|
|
+#define PTRDIFF_TYPE "int"
|
4800 |
|
|
+
|
4801 |
|
|
+/* WCHAR_TYPE ... A C expression for a string describing the name of the data
|
4802 |
|
|
+ * type to use for wide characters. The typedef name wchar_t is defined using
|
4803 |
|
|
+ * the contents of the string. If you don't define this macro, the default is
|
4804 |
|
|
+ * 'int'--good enough for ZipCPU.
|
4805 |
|
|
+ */
|
4806 |
202 |
dgisselq |
+// #define WCHAR_TYPE "int"
|
4807 |
102 |
dgisselq |
+
|
4808 |
|
|
+/* WCHAR_TYPE_SIZE ... A C expression for the size in bits of the data type for
|
4809 |
|
|
+ * wide characters. This is used in cpp, which cannot make use of WCHAR_TYPE.
|
4810 |
202 |
dgisselq |
+ *
|
4811 |
|
|
+ * ZipCPU -- This defaults to INT_TYPE_SIZE, which will work for us
|
4812 |
102 |
dgisselq |
+ */
|
4813 |
202 |
dgisselq |
+// #define WCHAR_TYPE_SIZE 32
|
4814 |
102 |
dgisselq |
+
|
4815 |
|
|
+/* WINT_TYPE ... A C expression for a string describing the name of the data
|
4816 |
|
|
+ * type to use for wide characters passed to printf and returned from getwc.
|
4817 |
|
|
+ * The typedef name wint_t is defined using the contents of the string. See
|
4818 |
|
|
+ *
|
4819 |
202 |
dgisselq |
+ * ZipCPU -- The default should work well enough for us.
|
4820 |
102 |
dgisselq |
+ */
|
4821 |
202 |
dgisselq |
+// #define WINT_TYPE "int"
|
4822 |
102 |
dgisselq |
+
|
4823 |
|
|
+/* INTMAX_TYPE ... A C expression for a string describing the name of the
|
4824 |
|
|
+ * data type that can represent any value of any standard or extended signed
|
4825 |
|
|
+ * integer type. The typedef name intmax_t is defined using the contents of
|
4826 |
|
|
+ * the string.
|
4827 |
|
|
+ *
|
4828 |
|
|
+ * If you don't define this macro, the default is the first of "int", "long int"
|
4829 |
|
|
+ * or "long long int" that has as much precision as "long long int".
|
4830 |
|
|
+ */
|
4831 |
|
|
+
|
4832 |
|
|
+/* UINTMAX_TYPE ... same as INTMAX_TYPE, but for unsigned
|
4833 |
|
|
+ */
|
4834 |
|
|
+
|
4835 |
|
|
+#undef SIG_ATOMIC_TYPE
|
4836 |
|
|
+#if (ZIP_ATOMIC != 0)
|
4837 |
|
|
+#define SIG_ATOMIC_TYPE "int"
|
4838 |
|
|
+#else
|
4839 |
|
|
+#define SIG_ATOMIC_TYPE NULL // We have no atomic types, but registers
|
4840 |
|
|
+#endif
|
4841 |
|
|
+#undef INT8_TYPE
|
4842 |
202 |
dgisselq |
+#define INT8_TYPE "char"
|
4843 |
102 |
dgisselq |
+#undef INT16_TYPE
|
4844 |
202 |
dgisselq |
+#define INT16_TYPE "short int"
|
4845 |
102 |
dgisselq |
+#undef INT32_TYPE
|
4846 |
|
|
+#define INT32_TYPE "int"
|
4847 |
|
|
+#undef UINT8_TYPE
|
4848 |
202 |
dgisselq |
+#define UINT8_TYPE "unsigned char"
|
4849 |
102 |
dgisselq |
+#undef UINT16_TYPE
|
4850 |
202 |
dgisselq |
+#define UINT16_TYPE "short unsigned int"
|
4851 |
102 |
dgisselq |
+#undef UINT32_TYPE
|
4852 |
|
|
+#define UINT32_TYPE "unsigned int"
|
4853 |
|
|
+#undef INT_LEAST8_TYPE
|
4854 |
202 |
dgisselq |
+#define INT_LEAST8_TYPE "char"
|
4855 |
102 |
dgisselq |
+#undef INT_LEAST16_TYPE
|
4856 |
202 |
dgisselq |
+#define INT_LEAST16_TYPE "short int"
|
4857 |
102 |
dgisselq |
+#undef INT_LEAST32_TYPE
|
4858 |
|
|
+#define INT_LEAST32_TYPE "int"
|
4859 |
|
|
+#undef UINT_LEAST8_TYPE
|
4860 |
202 |
dgisselq |
+#define UINT_LEAST8_TYPE "unsigned char"
|
4861 |
102 |
dgisselq |
+#undef UINT_LEAST16_TYPE
|
4862 |
202 |
dgisselq |
+#define UINT_LEAST16_TYPE "short unsigned int"
|
4863 |
102 |
dgisselq |
+#undef UINT_LEAST32_TYPE
|
4864 |
|
|
+#define UINT_LEAST32_TYPE "unsigned int"
|
4865 |
|
|
+#undef INT_FAST8_TYPE
|
4866 |
202 |
dgisselq |
+#define INT_FAST8_TYPE "char"
|
4867 |
102 |
dgisselq |
+#undef INT_FAST16_TYPE
|
4868 |
202 |
dgisselq |
+#define INT_FAST16_TYPE "short int"
|
4869 |
102 |
dgisselq |
+#undef INT_FAST32_TYPE
|
4870 |
|
|
+#define INT_FAST32_TYPE "int"
|
4871 |
|
|
+#undef UINT_FAST8_TYPE
|
4872 |
202 |
dgisselq |
+#define UINT_FAST8_TYPE "unsigned char"
|
4873 |
102 |
dgisselq |
+#undef UINT_FAST16_TYPE
|
4874 |
202 |
dgisselq |
+#define UINT_FAST16_TYPE "short unsigned int"
|
4875 |
102 |
dgisselq |
+#undef UINT_FAST32_TYPE
|
4876 |
|
|
+#define UINT_FAST32_TYPE "unsigned int"
|
4877 |
|
|
+#undef INTPTR_TYPE
|
4878 |
|
|
+#define INTPTR_TYPE "unsigned int"
|
4879 |
|
|
+#undef UINTPTR_TYPE
|
4880 |
|
|
+#define UINTPTR_TYPE "unsigned int"
|
4881 |
|
|
+
|
4882 |
|
|
+#undef INT64_TYPE
|
4883 |
|
|
+#undef UINT64_TYPE
|
4884 |
|
|
+#undef INT_LEAST64_TYPE
|
4885 |
|
|
+#undef UINT_LEAST64_TYPE
|
4886 |
|
|
+#undef INT_FAST64_TYPE
|
4887 |
|
|
+#undef UINT_FAST64_TYPE
|
4888 |
|
|
+
|
4889 |
|
|
+#if (ZIP_HAS_DI != 0)
|
4890 |
|
|
+#define INT64_TYPE "long int"
|
4891 |
|
|
+#define UINT64_TYPE "long unsigned int"
|
4892 |
|
|
+#define INT_LEAST64_TYPE "long int"
|
4893 |
|
|
+#define UINT_LEAST64_TYPE "long unsigned int"
|
4894 |
|
|
+#define INT_FAST64_TYPE "long int"
|
4895 |
|
|
+#define UINT_FAST64_TYPE "long unsigned int"
|
4896 |
|
|
+#else
|
4897 |
|
|
+#define INT64_TYPE NULL
|
4898 |
|
|
+#define UINT64_TYPE NULL
|
4899 |
|
|
+#define INT_LEAST64_TYPE NULL
|
4900 |
|
|
+#define UINT_LEAST64_TYPE NULL
|
4901 |
|
|
+#define INT_FAST64_TYPE NULL
|
4902 |
|
|
+#define UINT_FAST64_TYPE NULL
|
4903 |
|
|
+#endif
|
4904 |
|
|
+
|
4905 |
|
|
+#define TARGET_PTRMEMFUNC_VBI_LOCATION ptrmemfunc_vbit_in_pfn
|
4906 |
|
|
+
|
4907 |
|
|
+
|
4908 |
|
|
+/* 17.07 Register Usage / Register definitions */
|
4909 |
|
|
+
|
4910 |
|
|
+/* FIRST_PSEUDO_REGISTER ... Number of hardware registers known to the compiler.
|
4911 |
|
|
+ * They receive numbers 0 through FIRST_PSEUDO_REGISTER-1; thus the first
|
4912 |
|
|
+ * pseudo register's numbrer really is assigned the number
|
4913 |
|
|
+ * FIRST_PSEUDO_REGISTER.
|
4914 |
|
|
+ *
|
4915 |
|
|
+ * ZipCPU---There are 16 registers in the ZipCPU, numbered 0-15 with the CC
|
4916 |
171 |
dgisselq |
+ * and PC register being numbered 14 and 15 respectively. The ZipCPU has
|
4917 |
|
|
+ * another 16 registers, identical to the first, but user mode registers. These
|
4918 |
|
|
+ * are number the same as the first (0-15) in user mode, but numbered (16-31)
|
4919 |
|
|
+ * in supervisor mode. In addition, we create a pretend argument pointer
|
4920 |
|
|
+ * register, zip_AP_PSEUDO, to refer to our arguments. This final register,
|
4921 |
|
|
+ * although it gets a valid number, will be eliminated in optimization.
|
4922 |
102 |
dgisselq |
+ */
|
4923 |
171 |
dgisselq |
+#define FIRST_PSEUDO_REGISTER (zip_AP_PSEUDO+1)
|
4924 |
102 |
dgisselq |
+
|
4925 |
|
|
+/* FIXED_REGISTERS ... An initializer that says which registers are used for
|
4926 |
|
|
+ * fixed purposes all throughout the compiled code and are therefore not
|
4927 |
|
|
+ * available for general allocation. These would include the stack pointer, the
|
4928 |
|
|
+ * frame pointer (except on machines where that can be used as a general
|
4929 |
|
|
+ * register when no frame pointer is needed), the program counter on machines
|
4930 |
|
|
+ * where that is considered one of the addressable registers, and any other
|
4931 |
|
|
+ * numbered register with a standard use.
|
4932 |
|
|
+ *
|
4933 |
|
|
+ * This information is expressed as a sequence of numbers, separated by commas,
|
4934 |
|
|
+ * and surrounded by braces. The nth number is 1 if register n is fixed, 0
|
4935 |
|
|
+ * otherwise.
|
4936 |
|
|
+ *
|
4937 |
|
|
+ * For the Zip CPU, we have three fixed registers that are not available for
|
4938 |
|
|
+ * general allocation:
|
4939 |
|
|
+ *
|
4940 |
|
|
+ * SP The stack pointer
|
4941 |
|
|
+ * CC The condition codes and CPU state register
|
4942 |
|
|
+ * PC The program counter
|
4943 |
|
|
+ *
|
4944 |
|
|
+ * Other registers, such as FP (the frame pointer) or GBL (the global offset
|
4945 |
|
|
+ * table pointer) are registers that we hope will not be so fixed.
|
4946 |
171 |
dgisselq |
+ *
|
4947 |
|
|
+ * Okay, just updated this process. We now have more registers that are not
|
4948 |
|
|
+ * available for general allocation:
|
4949 |
|
|
+ * uR0-uPC User registers
|
4950 |
|
|
+ * PSEUDO-AP The pseudo arg pointer
|
4951 |
102 |
dgisselq |
+ */
|
4952 |
171 |
dgisselq |
+#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, 1 }
|
4953 |
102 |
dgisselq |
+
|
4954 |
|
|
+/* CALL_USED_REGISTERS ... like FIXED_REGISTERS but has 1 for each register
|
4955 |
|
|
+ * that is clobbered (in general) by function calls as well as for fixed
|
4956 |
|
|
+ * registers. This macro therefore identifies the registers that are not
|
4957 |
|
|
+ * available for general allocation of values that must live across function
|
4958 |
|
|
+ * calls.
|
4959 |
|
|
+ *
|
4960 |
|
|
+ * If a register has 0 in CALL_USED_REGISTERS, the compiler automatically saves
|
4961 |
|
|
+ * it on function entry and restores it on function exit, if the register is
|
4962 |
|
|
+ * used within the function.
|
4963 |
|
|
+ *
|
4964 |
|
|
+ * On the Zip CPU, we must save R0 (the return address), and (let's pick) any
|
4965 |
|
|
+ * register above R5.
|
4966 |
|
|
+ */
|
4967 |
171 |
dgisselq |
+#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, 1 }
|
4968 |
102 |
dgisselq |
+
|
4969 |
|
|
+/* CALL_REALLY_USED_REGISTERS ... optional macro that, if not defined, defaults
|
4970 |
|
|
+ * to the value of CALL_USED_REGISTERS.
|
4971 |
|
|
+ */
|
4972 |
|
|
+
|
4973 |
|
|
+/* HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE) ... A C expression that is nonzero
|
4974 |
|
|
+ * if it is not permissible to store a value of mode MODE in hard register REGNO
|
4975 |
|
|
+ * across a call without some part of it being clobbbered. For most machines,
|
4976 |
|
|
+ * this macro need not be defined. It is only required for machines that do
|
4977 |
103 |
dgisselq |
+ * not preserve the entire contents of a register across a call.
|
4978 |
102 |
dgisselq |
+ *
|
4979 |
127 |
dgisselq |
+ * ZipCPU--Always preserves the entire contents of those registers that are
|
4980 |
|
|
+ * preserved across calls, so this shouldnt need to be defined.
|
4981 |
102 |
dgisselq |
+ */
|
4982 |
127 |
dgisselq |
+// #define HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE) (REGNO==0)
|
4983 |
102 |
dgisselq |
+
|
4984 |
|
|
+/* TARGET_CONDITIONAL_REGISTER_USAGE(VOID) ... This hook may conditionally
|
4985 |
|
|
+ * modify five variables fixed_regs, call_used_regs, global_regs, reg_names, and
|
4986 |
|
|
+ * reg_class_contents, to take into account any dependence of these register
|
4987 |
|
|
+ * sets on target flags. The first three of these are of type char[]
|
4988 |
|
|
+ * (interpreted as Boolean vectors). global_regs is a const char *[] and
|
4989 |
|
|
+ * reg_class_contents is a HARD_REG_SET. Before the macro is called,
|
4990 |
|
|
+ * fixed_regs, call_used_regs, reg_class_contents, and reg_names have been
|
4991 |
|
|
+ * initialized from FIXED_REGISTERS, CALL_USED_REGISTERS, REG_CLASS_CONTENTS,
|
4992 |
|
|
+ * and REGISTER_NAMES, respectively. global_regs has been cleared, and any
|
4993 |
|
|
+ * -ffixed-reg, -fcall-used-reg, and -fcall-saved-reg command options have been
|
4994 |
|
|
+ * applied.
|
4995 |
|
|
+ *
|
4996 |
171 |
dgisselq |
+ * ZipCPU -- I may need to return and define this depending upon how the
|
4997 |
|
|
+ * GBL register allocation goes. But for now, we'll leave this at its default
|
4998 |
102 |
dgisselq |
+ * value.
|
4999 |
|
|
+ */
|
5000 |
|
|
+// #warning "Revisit me after FP and GBL allocation"
|
5001 |
|
|
+
|
5002 |
|
|
+/* INCOMING_REGNO(out) ... Define this macro if the target machine has register
|
5003 |
|
|
+ * windows. ...
|
5004 |
|
|
+ *
|
5005 |
|
|
+ * Zip CPU has no register windows.
|
5006 |
|
|
+ */
|
5007 |
|
|
+
|
5008 |
|
|
+/* OUTGOING_REGNO ... same thing.
|
5009 |
171 |
dgisselq |
+ * LOCAL_REGNO ... same thing.
|
5010 |
102 |
dgisselq |
+ */
|
5011 |
|
|
+
|
5012 |
|
|
+/* PC_REGNUM ... If the program counter has a register number, define this as
|
5013 |
|
|
+ * that register number. Otherwise do not define it.
|
5014 |
|
|
+ */
|
5015 |
|
|
+#define PC_REGNUM zip_PC
|
5016 |
|
|
+
|
5017 |
|
|
+
|
5018 |
|
|
+/* REG_ALLOC_ORDER ... If defined, an initializer for a vector of integers,
|
5019 |
|
|
+ * containing the number of hard registers in the order in which GCC should
|
5020 |
|
|
+ * prefer to use them (from most preferred to least.
|
5021 |
|
|
+ *
|
5022 |
103 |
dgisselq |
+ * If this macro is not defined, registers are used lowest numbered first (all
|
5023 |
102 |
dgisselq |
+ * else being equal).
|
5024 |
|
|
+ *
|
5025 |
|
|
+ * Since the default is the ZipCPU desired case, we won't define this here.
|
5026 |
|
|
+ */
|
5027 |
|
|
+
|
5028 |
|
|
+/* ADJUST_REG_ALLOC_ORDER ... on most machines it is not necessary to define
|
5029 |
|
|
+ * this macro, so we won't either.
|
5030 |
|
|
+ */
|
5031 |
|
|
+
|
5032 |
|
|
+/* HONOR_REG_ALLOC_ORDER ...
|
5033 |
|
|
+ */
|
5034 |
|
|
+
|
5035 |
|
|
+/* HONOR_REG_ALLOC_ORDER ... on most machines it is not necessary to define
|
5036 |
|
|
+ * this macro, so we won't either.
|
5037 |
|
|
+ */
|
5038 |
|
|
+
|
5039 |
|
|
+/* HARD_REGNO_NREGS(REGNO, MODE) ... A C expression for the number of
|
5040 |
|
|
+ * consecutive hard registers, starting at register number REGNO, required to
|
5041 |
|
|
+ * hold a value of mode MODE.
|
5042 |
|
|
+ *
|
5043 |
|
|
+ * On a machine where all registers are exactly one word, a suitable definition
|
5044 |
|
|
+ * is given of ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)/UNITS_PER_WORD.
|
5045 |
|
|
+ *
|
5046 |
|
|
+ */
|
5047 |
|
|
+#undef HARD_REGNO_NREGS
|
5048 |
|
|
+#define HARD_REGNO_NREGS(REGNO, MODE) ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)\
|
5049 |
|
|
+ / (UNITS_PER_WORD))
|
5050 |
|
|
+
|
5051 |
|
|
+/* HARD_REGNO_NREGS_HAS_PADDING(REGNO,MODE) ... A C expression that is nonzero
|
5052 |
|
|
+ * if a value of mode MODE, stored in memory, ends with padding that causes it
|
5053 |
|
|
+ * to take up more space than in registers starting at register number REGNO
|
5054 |
|
|
+ * (as determined by multiplying GCC's notion of the size of the register when
|
5055 |
|
|
+ * containing this mode by the number of registers returned by HARD_REGNO_NREGS)
|
5056 |
|
|
+ * By default this is zero.
|
5057 |
|
|
+ *
|
5058 |
|
|
+ * Zip CPU --- The default looks good enough to me.
|
5059 |
|
|
+ */
|
5060 |
|
|
+
|
5061 |
|
|
+/* HARD_REGNO_NREGS_WITH_PADDING(REGNO, MODE)
|
5062 |
|
|
+ *
|
5063 |
|
|
+ * ZipCPU ---
|
5064 |
|
|
+ */
|
5065 |
|
|
+
|
5066 |
|
|
+/* REGMODE_NATURAL_SIZE(MODE) -- Define this macro if the natural size of
|
5067 |
|
|
+ * registers that hold values of mode mode is not the word size. It is a C
|
5068 |
|
|
+ * expression that should give the natural size in bytes for the specified mode.
|
5069 |
|
|
+ * It is used by the register allocator to try to optimize its results.
|
5070 |
|
|
+ *
|
5071 |
|
|
+ * ZipCPU ---
|
5072 |
|
|
+ */
|
5073 |
|
|
+// #define REGMODE_NATURAL_SIZE(MODE) (((MODE)==DImode)?2:1)
|
5074 |
|
|
+
|
5075 |
|
|
+/* HARD_REGNO_MODE_OK ... A C expression that is nonzero if it is permissible
|
5076 |
103 |
dgisselq |
+ * to store a value of mode MODE in a hard register number REGNO (or in several
|
5077 |
102 |
dgisselq |
+ * registers starting with that one). For a machine where all registers are
|
5078 |
|
|
+ * equivalent, a suitable definition is '1'. You need not include code to check
|
5079 |
|
|
+ * for the numbers of fixed registers, because the allocation mechanism
|
5080 |
|
|
+ * considered them to be always occupied.
|
5081 |
|
|
+ *
|
5082 |
|
|
+ * ZipCPU --- As long as you are already avoiding the fixed registers, the
|
5083 |
|
|
+ * suitable default definition mentioned above should be sufficient.
|
5084 |
|
|
+ */
|
5085 |
|
|
+#undef HARD_REGNO_MODE_OK
|
5086 |
103 |
dgisselq |
+#define HARD_REGNO_MODE_OK(R,M) (R<zip_CC)
|
5087 |
102 |
dgisselq |
+
|
5088 |
|
|
+/* HARD_REGNO_RENAME_OK(FROM,TO) ... A C expression that is nonzero if it is
|
5089 |
|
|
+ * okay to rename a hard register FROM to another hard register TO. One common
|
5090 |
|
|
+ * use of this macro is to prevernt renaming of a register to another register
|
5091 |
|
|
+ * that is not saved by a prologue in an interrupt handler. The default is
|
5092 |
|
|
+ * always nonzero.
|
5093 |
|
|
+ *
|
5094 |
|
|
+ * ZipCPU --- The default looks good enough to us.
|
5095 |
|
|
+ */
|
5096 |
|
|
+#undef HARD_REGNO_RENAME_OK
|
5097 |
|
|
+#define HARD_REGNO_RENAME_OK(FROM,TO) ((is_ZIP_GENERAL_REG(FROM))&&(is_ZIP_GENERAL_REG(TO)))
|
5098 |
|
|
+
|
5099 |
|
|
+
|
5100 |
|
|
+/* MODES_TIABLE_P(M1, M2) ... A C expression that is nonzero if a value of mode
|
5101 |
202 |
dgisselq |
+ * M1 is accessible in mode M2 without copying.
|
5102 |
102 |
dgisselq |
+ *
|
5103 |
|
|
+ * ZipCPU --- well, that's true for us (although we support scant few modes) ...
|
5104 |
|
|
+ * so lets' set to one.
|
5105 |
|
|
+ */
|
5106 |
|
|
+#define MODES_TIEABLE_P(M1,M2) 1
|
5107 |
|
|
+
|
5108 |
|
|
+/* TARGET_HARD_REGNO_SCRATCH_OK(REGNO)
|
5109 |
|
|
+ * This target hook should return true if it is OK to use a hard register
|
5110 |
202 |
dgisselq |
+ * REGNO as a scratch register in peephole2. One common use of this macro is
|
5111 |
102 |
dgisselq |
+ * to prevent using of a register that is not saved by a prologue in an
|
5112 |
|
|
+ * interrupt handler. The default version of this hook always returns true.
|
5113 |
|
|
+ *
|
5114 |
|
|
+ * ZipCPU --- the default works for us as well. If you are in an interrupt
|
5115 |
|
|
+ * context, you have an entirely new set of registers (the supervisor set), so
|
5116 |
|
|
+ * this is a non-issue.
|
5117 |
|
|
+ */
|
5118 |
|
|
+
|
5119 |
|
|
+/* AVOID_CCMODE_COPIES ... define this macro if the compiler should avoid
|
5120 |
|
|
+ * copies to/from CCmode register(s). You should only define this macro if
|
5121 |
|
|
+ * support for copying to/from CCmode is incomplete.
|
5122 |
|
|
+ *
|
5123 |
|
|
+ * ZipCPU --- CCmode register copies work like any other, so we'll keep with the
|
5124 |
|
|
+ * default definition.
|
5125 |
|
|
+ */
|
5126 |
|
|
+
|
5127 |
|
|
+/* STACK_REGS ... Define this if the machine has any stack-like registers.
|
5128 |
|
|
+ *
|
5129 |
|
|
+ * Zip CPU has no stack-like registers, as their definition is different from
|
5130 |
|
|
+ * the ZipCPU stack pointer register.
|
5131 |
|
|
+ */
|
5132 |
|
|
+
|
5133 |
|
|
+/* 17.08 Register Classes */
|
5134 |
|
|
+
|
5135 |
|
|
+/* enum reg_class ... An enumerate type that must be defined with all the
|
5136 |
|
|
+ * register class names as enumerated values. NO_REGS must be first. ALL_REGS
|
5137 |
|
|
+ * must be the last register class, followed by one more enumerated value,
|
5138 |
|
|
+ * LIM_REG_CLASSES, which is not a register class but rather tells how many
|
5139 |
|
|
+ * classes there are.
|
5140 |
|
|
+ *
|
5141 |
|
|
+ * ZipCPU --- We'll defined register 0-13 as general registers, 14-15 in
|
5142 |
|
|
+ * all_regs, and go from there.
|
5143 |
|
|
+ */
|
5144 |
|
|
+enum reg_class {
|
5145 |
|
|
+ NO_REGS, GENERAL_REGS,
|
5146 |
|
|
+ USER_REGS,
|
5147 |
|
|
+ ALL_REGS, LIM_REG_CLASSES
|
5148 |
|
|
+};
|
5149 |
|
|
+
|
5150 |
|
|
+/* N_REG_CLASSES ... the number of distinct register classes, defined as follows
|
5151 |
|
|
+ */
|
5152 |
|
|
+#define N_REG_CLASSES (int)LIM_REG_CLASSES
|
5153 |
|
|
+
|
5154 |
|
|
+/* REG_CLASS_NAMES ... An initializer containing the names of the register
|
5155 |
|
|
+ * classes as C string constants. These names are used in writing some of the
|
5156 |
|
|
+ * debugging dumps.
|
5157 |
|
|
+ */
|
5158 |
171 |
dgisselq |
+#define REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "USER_REGS", "ALL_REGS" }
|
5159 |
102 |
dgisselq |
+
|
5160 |
|
|
+/* REG_CLASS_CONTENTS ... An initializer containing the contents of the register
|
5161 |
127 |
dgisselq |
+ * classes, as integers which are bit masks. The nth integer specifies the
|
5162 |
102 |
dgisselq |
+ * contents of class n. That way the integer mask is interpreted as that
|
5163 |
|
|
+ * register r is in the class if (mask&(1<<r)) is 1.
|
5164 |
|
|
+ *
|
5165 |
171 |
dgisselq |
+ * When the machine has more than 32 registers, an integer does not suffice.
|
5166 |
|
|
+ * Then the integers are replaced by sub-initializers, braced groupings
|
5167 |
|
|
+ * containing several integers. Each sub-initializer must be suitable as an
|
5168 |
|
|
+ * initializer for the type HARD_REG_SET which is defined in 'hard-reg-set.h'.
|
5169 |
|
|
+ * In this situation, the first integer in each subinitializer corresponds to
|
5170 |
|
|
+ * registers 0-31, the second integer to registers 32-634, and so on.
|
5171 |
102 |
dgisselq |
+ *
|
5172 |
|
|
+ * ZipCPU --- This is straight forward, three register classes, etc.
|
5173 |
|
|
+ */
|
5174 |
171 |
dgisselq |
+#define REG_CLASS_CONTENTS { { 0x000000000, 0}, {0x00003fff, 0}, {0x0ffff0000, 0}, {0x0ffffffff, 1} }
|
5175 |
102 |
dgisselq |
+
|
5176 |
|
|
+/* REGNO_REG_CLASS ... A C expression whose value is a register class
|
5177 |
|
|
+ * containing hard register REGNO. In general there is more than one such
|
5178 |
|
|
+ * class; Choose a class which is minimal, meaning that no smaller class also
|
5179 |
|
|
+ * contains the register.
|
5180 |
|
|
+ */
|
5181 |
171 |
dgisselq |
+#define REGNO_REG_CLASS(R) (is_ZIP_REG(R)?(((R)<=13)?GENERAL_REGS:ALL_REGS):NO_REGS)
|
5182 |
102 |
dgisselq |
+
|
5183 |
|
|
+/* BASE_REG_CLASS ... A macro whose definition is the name of the class to which
|
5184 |
|
|
+ * a valid base register must belong. A base register is one used in an address
|
5185 |
|
|
+ * which is the register value plus a displacement.
|
5186 |
|
|
+ */
|
5187 |
|
|
+#undef BASE_REG_CLASS
|
5188 |
|
|
+#define BASE_REG_CLASS GENERAL_REGS
|
5189 |
|
|
+
|
5190 |
|
|
+/* MODE_BASE_CLASS(MODE) ... This is a variation of the BASE_REG_CLASS macro
|
5191 |
|
|
+ * which allows the selection of a bse register in a mode dependent manner. If
|
5192 |
|
|
+ * mode is VOIDmode then it should return the same value as BASE_REG_CLASS.
|
5193 |
|
|
+ */
|
5194 |
|
|
+#undef MODE_BASE_CLASS
|
5195 |
|
|
+#define MODE_BASE_CLASS(MODE) GENERAL_REGS
|
5196 |
|
|
+
|
5197 |
|
|
+/* MODE_BASE_REG_REG_CLASS(MODE) ... A C expression whose value is the register
|
5198 |
|
|
+ * class to which a valid base register must belong in order to be used in a
|
5199 |
|
|
+ * base plus index register address. You should define this macro if base plus
|
5200 |
|
|
+ * index addresses have different requirements than other base register uses.
|
5201 |
|
|
+ *
|
5202 |
|
|
+ * Zip CPU does not support the base plus index addressing mode, thus ...
|
5203 |
|
|
+ */
|
5204 |
111 |
dgisselq |
+// #undef MODE_BASE_REG_REG_CLASS
|
5205 |
|
|
+// #define MODE_BASE_REG_REG_CLASS(MODE) NO_REGS
|
5206 |
102 |
dgisselq |
+
|
5207 |
|
|
+/* INDEX_REG_CLASS ... A macro whose definition is the name of the class to
|
5208 |
|
|
+ * which a valid index register must belong. An index register is one used in
|
5209 |
|
|
+ * an address where its value is either multiplied by a scale factor or added
|
5210 |
|
|
+ * to another register (as well as added to a displacement).
|
5211 |
|
|
+ *
|
5212 |
|
|
+ * ZipCPU -- Has no index registers.
|
5213 |
|
|
+ */
|
5214 |
|
|
+#undef INDEX_REG_CLASS
|
5215 |
|
|
+#define INDEX_REG_CLASS NO_REGS
|
5216 |
|
|
+
|
5217 |
|
|
+/* REGNO_OK_FOR_BASE_P(NUM) ... A C expression which is nonzero if register
|
5218 |
|
|
+ * number num is suitable for use as a base register in operand addresses.
|
5219 |
|
|
+ */
|
5220 |
|
|
+#undef REGNO_OK_FOR_BASE_P
|
5221 |
127 |
dgisselq |
+# define REGNO_OK_FOR_BASE_P(NUM) ((NUM>=FIRST_PSEUDO_REGISTER)||(NUM != zip_CC))
|
5222 |
102 |
dgisselq |
+
|
5223 |
|
|
+/* REGNO_MODE_OK_FOR_BASE_P ... A C expressison that is just like
|
5224 |
|
|
+ * REGNO_OK_FOR_BASE_P, except that that expression may examine the mode of the
|
5225 |
111 |
dgisselq |
+ * memory reference in MODE. You should define this macro if the mode of the
|
5226 |
102 |
dgisselq |
+ * memory reference affects whether a register may be used as a base register.
|
5227 |
|
|
+ *
|
5228 |
|
|
+ * ZipCPU --- the mode doesn't affect anything, so we don't define this.
|
5229 |
|
|
+ */
|
5230 |
|
|
+
|
5231 |
|
|
+/* REGNO_MODE_OK_FOR_REG_BASE_P(NUM, MODE) ... base plus index operand
|
5232 |
|
|
+ * addresses, accessing memory in mode mode.
|
5233 |
|
|
+ *
|
5234 |
|
|
+ * Use of this macro is deprecated.
|
5235 |
|
|
+ */
|
5236 |
|
|
+
|
5237 |
111 |
dgisselq |
+/* REGNO_MODE_CODE_OK_FOR_BASE_P(N,M,AS,OC,IC) ... A C expression which is
|
5238 |
102 |
dgisselq |
+ * nonzero if a register number N is suitable for use as a base register in
|
5239 |
|
|
+ * operand addresses, accessing memory in mode M in address space AS. This is
|
5240 |
|
|
+ * similar to REGNO_MODE_OK_FOR_BASE_P, except that the expression may examine
|
5241 |
|
|
+ * the context in which the register appears in the memory reference.
|
5242 |
|
|
+ *
|
5243 |
|
|
+ * ZipCPU---We aren't specific in how we use our registers.
|
5244 |
|
|
+ */
|
5245 |
|
|
+#define REGNO_MODE_CODE_OK_FOR_BASE_P(N,M,AS,OC,IC) REGNO_OK_FOR_BASE_P(N)
|
5246 |
|
|
+
|
5247 |
|
|
+/* REGNO_OK_FOR_INDEX_P(REGNO) ... A C expression which is nonzero if register
|
5248 |
|
|
+ * num is suitable for use as an index register in opernad addressess. It may
|
5249 |
|
|
+ * be either a suitable hard register or a pseudo register that has been
|
5250 |
111 |
dgisselq |
+ * allocated such as a hard register.
|
5251 |
102 |
dgisselq |
+ *
|
5252 |
|
|
+ * ZipCPU has no index registers, therefore we declare this to be zero.
|
5253 |
|
|
+ */
|
5254 |
|
|
+#undef REGNO_OK_FOR_INDEX_P
|
5255 |
|
|
+#define REGNO_OK_FOR_INDEX_P(REGNO) 0
|
5256 |
|
|
+
|
5257 |
|
|
+/* TARGET_PREFERRED_RENAME_CLASS(RCLASS) ... A target hook that places
|
5258 |
|
|
+ * additional preference on the register class to use when it is necessary to
|
5259 |
|
|
+ * rename a register in class RCLASS to another class, or perhaps NO_REGS, if no
|
5260 |
|
|
+ * preferred register class is found or hook preferred_rename_class is not
|
5261 |
|
|
+ * implemented. SOmething returning a more restrictive class makes better code.
|
5262 |
|
|
+ * For example, on ARM, thumb-2 instructions using LO_REGS may be smaller than
|
5263 |
|
|
+ * instructions using GENERIC_REGS. By returning LO_REGS from
|
5264 |
|
|
+ * preferred_rename_class, code size can be reduced.
|
5265 |
|
|
+ */
|
5266 |
|
|
+// #undef TARGET_PREFERRED_RENAME_CLASS
|
5267 |
|
|
+// #define TARGET_PREFERRED_RENAME_CLASS(RCLASS) RCLASS
|
5268 |
|
|
+
|
5269 |
|
|
+/* TARGET_PREFERRED_RELOAD_CLASS(X,RC) ... A target hook that places additional
|
5270 |
|
|
+ * restri tions on the register class to use when it is necessary to copy value
|
5271 |
|
|
+ * X into a register in class RC. The value is a register class; rehaps RC, or
|
5272 |
|
|
+ * perhaps a smaller class.
|
5273 |
|
|
+ *
|
5274 |
|
|
+ * The default fversion of this hook always returns value of RC argument, which
|
5275 |
|
|
+ * sounds quite appropriate for the ZipCPU.
|
5276 |
|
|
+ */
|
5277 |
|
|
+
|
5278 |
|
|
+/* PREFERRED_RELOAD_CLASS(X,CLASS) ... A C expression that places additional
|
5279 |
|
|
+ * restrictions on the register class to use when it is necessary to copy
|
5280 |
|
|
+ * value X into a register in class CLASS. On many machines, the following
|
5281 |
|
|
+ * definition is safe: PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
|
5282 |
|
|
+ * Sometimes returning a more restrictive class makes better code. For example,
|
5283 |
|
|
+ * on the 68k, when x is an integer constant that is in range for a moveq
|
5284 |
|
|
+ * instruction, the value of this macro is always DATA_REGS as long as CLASS
|
5285 |
111 |
dgisselq |
+ * includes the data registers. Requiring a data register guarantees that a
|
5286 |
102 |
dgisselq |
+ * 'moveq' will be used.
|
5287 |
|
|
+ *
|
5288 |
|
|
+ * ZipCPU --- you can't load certain values into all members of ALL_REGS. For
|
5289 |
|
|
+ * example, loading (sleep and !gie) into the CC register could halt the CPU.
|
5290 |
|
|
+ * Hence, we only allow loads into the GENERAL_REG class.
|
5291 |
|
|
+ */
|
5292 |
|
|
+#define PREFERRED_RELOAD_CLASS(X, CLASS) GENERAL_REGS
|
5293 |
|
|
+
|
5294 |
|
|
+/* TARGET_PREFERRED_OUTPUT_RELOAD_CLASS(RTX,RCLASS) ... Like TARGET_PREFERRED_..
|
5295 |
|
|
+ * RELOAD_CLASS, but for output instead of input reloads.
|
5296 |
|
|
+ *
|
5297 |
|
|
+ * ZipCPU --- there's gotta be a valid default behaviour for this.
|
5298 |
|
|
+ */
|
5299 |
|
|
+
|
5300 |
|
|
+/* LIMIT_RELOAD_CLASS(MODE, CL) ...
|
5301 |
|
|
+ *
|
5302 |
|
|
+ * Don't define this macro unless the target machine has limitations which
|
5303 |
|
|
+ * require the macro to do something nontrivial. ZipCPU doesn't, so we won't.
|
5304 |
|
|
+ */
|
5305 |
|
|
+
|
5306 |
|
|
+/* TARGET_SECONDARY_RELOAD
|
5307 |
|
|
+ * SECONDARY_ ...
|
5308 |
|
|
+ * Don't think we need these ...
|
5309 |
|
|
+ */
|
5310 |
|
|
+
|
5311 |
|
|
+/* CLASS_MAX_NREGS(CLASS,MODE) ... A C expression for the maximum number of
|
5312 |
|
|
+ * consecutive registers of class CLASS needed to hold a value of mode MODE.
|
5313 |
|
|
+ *
|
5314 |
|
|
+ * This is closely related to the macro HARD_REGNO_NREGS. In fact, the value
|
5315 |
|
|
+ * of the macro CLASS_MAX_REGS(CL,M) should be the maximum value of
|
5316 |
|
|
+ * HARD_REGNO_NREGS(REGNO,MODE) for all REGNO values in the class CLASS.
|
5317 |
|
|
+ *
|
5318 |
|
|
+ * This macro helps control the handling of multiple word values in the reload
|
5319 |
|
|
+ * pass.
|
5320 |
|
|
+ *
|
5321 |
|
|
+ * ZipCPU --- We'll just use HARDNO_REGNO_NREGS, since CLASS is independent for
|
5322 |
|
|
+ * us. We'll also choose register R0, since ... well, since it simply doesn't
|
5323 |
|
|
+ * matter. (HARD_REGNO_NREGS ignores this anyway)
|
5324 |
|
|
+ */
|
5325 |
|
|
+#define CLASS_MAX_NREGS(CLASS, MODE) HARD_REGNO_NREGS(0,MODE)
|
5326 |
|
|
+
|
5327 |
|
|
+/* CANNOT_CHANGE_MODE_CLASS
|
5328 |
|
|
+ * ???
|
5329 |
|
|
+ */
|
5330 |
|
|
+
|
5331 |
|
|
+/* TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS
|
5332 |
|
|
+ */
|
5333 |
|
|
+
|
5334 |
|
|
+/* TARRGET_LRA_P
|
5335 |
|
|
+ * Default looks good.
|
5336 |
|
|
+ */
|
5337 |
|
|
+
|
5338 |
|
|
+/* TARGET_REGISTER_PRIORITY(INT) ... A target hook which returns the register
|
5339 |
111 |
dgisselq |
+ * priority number to which the register HARD_REGNO belongs to. The bigger the
|
5340 |
102 |
dgisselq |
+ * number
|
5341 |
|
|
+ *
|
5342 |
|
|
+ * The default version of this target hook returns always zero---good enough for
|
5343 |
|
|
+ * the ZipCPU.
|
5344 |
|
|
+ */
|
5345 |
|
|
+
|
5346 |
|
|
+/* TARGET_REGISTER_USAGE_LEVELING_P(VOID) ... A target hook which returns true
|
5347 |
|
|
+ * if we need register usage leveling. That means if a few hard registers are
|
5348 |
|
|
+ * equally good for the assignment, we choose the least used hard register. The
|
5349 |
|
|
+ * register usage leveling may be profitable for some targets. Don't use usage
|
5350 |
|
|
+ * leveling for targets with conditional execution or targets with big register
|
5351 |
|
|
+ * files as it hurts if-conversion and cross-jumping optimizations. The default
|
5352 |
|
|
+ * version of this target hook returns always false.
|
5353 |
|
|
+ *
|
5354 |
|
|
+ * ZipCPU --- Default is the right answer.
|
5355 |
|
|
+ */
|
5356 |
|
|
+
|
5357 |
|
|
+/* TARGET_DIFFERENT_ADDR_DISPLACEMENT_P ...
|
5358 |
|
|
+ * Default looks good.
|
5359 |
|
|
+ */
|
5360 |
|
|
+
|
5361 |
|
|
+/* TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV_P ...
|
5362 |
|
|
+ * Default looks good.
|
5363 |
|
|
+ */
|
5364 |
|
|
+
|
5365 |
|
|
+/* TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT ....
|
5366 |
|
|
+ */
|
5367 |
|
|
+
|
5368 |
|
|
+/* TARGET_SPILL_CLASS
|
5369 |
|
|
+ *
|
5370 |
|
|
+ * ZipCPU --- If we were running in supervisor mode only, this might be the
|
5371 |
|
|
+ * user set of registers. However, we're not building for that mode (now),
|
5372 |
|
|
+ * so we'll leave this at the default of NO_REGS.
|
5373 |
|
|
+ */
|
5374 |
|
|
+
|
5375 |
|
|
+/* TARGET_CSTORE_MODE(ICODE) ... Defines the machine mode to use for the
|
5376 |
202 |
dgisselq |
+ * boolean result of conditional store patterns. The ICODE argument is the
|
5377 |
102 |
dgisselq |
+ * instruction code for the cstore being performed. Not defining this hook is
|
5378 |
|
|
+ * the same as accepting the mode encoded into operand 0 of the cstore expander
|
5379 |
|
|
+ * patterns.
|
5380 |
|
|
+ *
|
5381 |
|
|
+ * ??? ZipCPU --- I don't follow this documentation. We'll leave this at the
|
5382 |
|
|
+ * default therefore.
|
5383 |
|
|
+ */
|
5384 |
|
|
+
|
5385 |
|
|
+/* 17.09 Stack Layout and Calling Conventions */
|
5386 |
|
|
+
|
5387 |
|
|
+
|
5388 |
|
|
+/* STACK_GROWS_DOWNWARD ... Define this macro if pushing a word onto the stack
|
5389 |
|
|
+ * moves the stack pointer to a smaller address, and false otherwise.
|
5390 |
|
|
+ *
|
5391 |
|
|
+ * ZipCPU ... well, our stack does grow downward, but it doesn't do so auto-
|
5392 |
|
|
+ * magically. We have to move the stack pointer ourselves. However, since this
|
5393 |
|
|
+ * is our convention, we'll define it as such.
|
5394 |
|
|
+ */
|
5395 |
|
|
+#undef STACK_GROWS_DOWNWARD
|
5396 |
|
|
+#define STACK_GROWS_DOWNWARD 1
|
5397 |
|
|
+
|
5398 |
|
|
+/* STACK_PUSH_CODE ... This macro defines the operation used when something is
|
5399 |
|
|
+ * pushed on the stack. In RTL, a push operation will be
|
5400 |
|
|
+ * (set (mem( STACK_PUSH_CODE(reg sp))) ...) The choiecs are PRE_DEC, POST_DEC,
|
5401 |
|
|
+ * PRE_INC, and POST_INC. Which of these is correct depends on the stack
|
5402 |
|
|
+ * direction and on whether the stack pointer points to the last item on the
|
5403 |
|
|
+ * stack or whether it points to the space for the next item on the stack.
|
5404 |
|
|
+ * The default is PRE_DECC when STACK_GROWS_DOWNWARD is true, which is almost
|
5405 |
|
|
+ * always right, and PRE_INC otherwise, which is often wrong.
|
5406 |
|
|
+ *
|
5407 |
|
|
+ * ZipCPU --- None of these is right, so let's leave this at the default and
|
5408 |
|
|
+ * see how badly we get mangled. In particular, ZipCPU doesn't have any of the
|
5409 |
|
|
+ * PRE_DEC, POST_DEC, PRE_INC, or POST_INC addressing modes used here.
|
5410 |
|
|
+ */
|
5411 |
|
|
+
|
5412 |
|
|
+/* FRAME_GROWS_DOWNWARD ... Define this macro to nonzero if the addresses of
|
5413 |
|
|
+ * local variable slots are at negative offsets from the frame pointer.
|
5414 |
|
|
+ *
|
5415 |
|
|
+ * ZipCPU --- If the frame pointer is defined as the stack pointer upon the
|
5416 |
103 |
dgisselq |
+ * start of function execution, and that stack pointer grows downward, then
|
5417 |
102 |
dgisselq |
+ * this should be the case as well.
|
5418 |
|
|
+ */
|
5419 |
|
|
+#undef FRAME_GROWS_DOWNWARD
|
5420 |
|
|
+#define FRAME_GROWS_DOWNWARD 1
|
5421 |
|
|
+// #define FRAME_GROWS_DOWNWARD 0 // This was ECO32's value
|
5422 |
|
|
+
|
5423 |
|
|
+
|
5424 |
|
|
+/* ARGS_GROW_DOWNWARD ... Define this macro if successive arguments to a
|
5425 |
|
|
+ * function occupy decreasing addresses on the stack.
|
5426 |
|
|
+ *
|
5427 |
|
|
+ * ZipCPU -- we can leave this up to the compiler's preferred implementation,
|
5428 |
|
|
+ * it is of no consequence to the hardware.
|
5429 |
|
|
+ */
|
5430 |
|
|
+
|
5431 |
|
|
+/* STARTING_FRAME_OFFSET ... Offset from the frame pointer to the first local
|
5432 |
|
|
+ * variable slot to be allocated. If FRAME_GROWS_DOWNWARD, find the next slot's
|
5433 |
171 |
dgisselq |
+ * offset by subtracting the first slot's length from STARTING_FRAME_OFFSET.
|
5434 |
102 |
dgisselq |
+ * Otherwise it is found by adding the length of the first slot to the value
|
5435 |
|
|
+ * START_FRAME_OFFSET.
|
5436 |
|
|
+ *
|
5437 |
|
|
+ * ZipCPU --- I'm not certain on this, let's come back after we look at how
|
5438 |
|
|
+ * the code is getting generated. However, the ECO32 code I am copying from
|
5439 |
|
|
+ * suggests that 0 is the right value, so we'll use that here.
|
5440 |
|
|
+ */
|
5441 |
171 |
dgisselq |
+// #warning "Re-evaluate me" --- I did. This still looks good.
|
5442 |
102 |
dgisselq |
+#define STARTING_FRAME_OFFSET 0
|
5443 |
|
|
+
|
5444 |
|
|
+/* STACK_ALIGNMENT_NEEDED ... Define to zero to disable final alignment of the
|
5445 |
|
|
+ * stack during reload. The nonzero default for this macro is suitable for most
|
5446 |
|
|
+ * ports.
|
5447 |
|
|
+ *
|
5448 |
202 |
dgisselq |
+ * ZipCPU --- Yes, our stack needs to be aligned. The default should work
|
5449 |
|
|
+ * nicely.
|
5450 |
102 |
dgisselq |
+ */
|
5451 |
|
|
+
|
5452 |
|
|
+/* STACK_POINTER_OFFSET ... Offset from the SP register to the first location at
|
5453 |
|
|
+ * which outgoing arguments are placed. If not specified, the default value
|
5454 |
|
|
+ * of zero is used. This is the proper value for most machines.
|
5455 |
|
|
+ */
|
5456 |
|
|
+#define STACK_POINTER_OFFSET 0
|
5457 |
|
|
+
|
5458 |
|
|
+/* FIRST_PARM_OFFSET ... Offset from the argument pointer register to the first
|
5459 |
|
|
+ * argument's address. On some machines it may depend on the data type of the
|
5460 |
171 |
dgisselq |
+ * function.
|
5461 |
102 |
dgisselq |
+ */
|
5462 |
|
|
+#define FIRST_PARM_OFFSET(F) 0
|
5463 |
|
|
+
|
5464 |
|
|
+/* STACK_DYNAMIC_OFFSET(F) ... Offset from the stack pointer register to an item
|
5465 |
|
|
+ * dynamically allocated on the stack, e.g., by alloca. The default value for
|
5466 |
|
|
+ * this macro is STACK_POINTER_OFFSET plus the length of the outgoing arguments.
|
5467 |
|
|
+ * The default is correct for most machines, ...
|
5468 |
|
|
+ *
|
5469 |
|
|
+ * ZipCPU --- so we'll use it for the ZipCPU.
|
5470 |
|
|
+ */
|
5471 |
|
|
+
|
5472 |
|
|
+/* INITIAL_FRAME_ADDRESS_RTX ... A C expression whose value is RTL representing
|
5473 |
|
|
+ * the address of the initial stack frame. This address is passed to
|
5474 |
|
|
+ * RETURN_ADDR_RTX and DYNAMIC_CHAIN_ADDRESS. If you don't define this macro,
|
5475 |
|
|
+ * a reasonable default value will be used. Define this macro in order to make
|
5476 |
|
|
+ * frame pointer elimination work in the presence of __builtin_frame_address(C)
|
5477 |
|
|
+ * and __builtin_return_address(C) for (C) not equal to zero.
|
5478 |
|
|
+ *
|
5479 |
|
|
+ * ZipCPU --- Let's try the reasonable default and see what happens.
|
5480 |
|
|
+ */
|
5481 |
|
|
+
|
5482 |
|
|
+/* SETUP_FRAME_ADDRESSES ... A C expression that produces the machine-specific
|
5483 |
|
|
+ * code to setup the stack so that arbitrary frames can be accessed. For
|
5484 |
|
|
+ * example, on the SPARC, we must flush all of the register windows to the stack
|
5485 |
|
|
+ * before we can access arbitrary stack frames. You will seldom need to define
|
5486 |
|
|
+ * this macro. The default is to do nothing.
|
5487 |
|
|
+ *
|
5488 |
|
|
+ * ZipCPU --- which is what we shall do here.
|
5489 |
|
|
+ */
|
5490 |
|
|
+
|
5491 |
|
|
+/* TARGET_BUILTIN_SETJMP_FRAME_VALUE(VOID) ... This target hook should return
|
5492 |
|
|
+ * an RTX that is used to store the address of the current frame into the
|
5493 |
|
|
+ * builtin setjmp buffer. The default value, virtual_stack_vars_rtx, is correct
|
5494 |
|
|
+ * for most machines. One reason you may need to define this target hook is if
|
5495 |
|
|
+ * hard_frame_pointer_rtx is the appropriate value on your machine.
|
5496 |
|
|
+ *
|
5497 |
|
|
+ * ZipCPU --- leave this undefined, since the default value should be correct
|
5498 |
|
|
+ * for "most" machines.
|
5499 |
|
|
+ */
|
5500 |
|
|
+
|
5501 |
|
|
+/* FRAME_ADDR_RTX ... most machines do not need to define it.
|
5502 |
|
|
+ */
|
5503 |
|
|
+
|
5504 |
|
|
+/* RETURN_ADDR_RTX(COUNT,FRAMEADDR) ... A C expression whose value is RTL
|
5505 |
|
|
+ * representing the value of the return address for the frame COUNT steps up
|
5506 |
|
|
+ * from the current frame, after the prologue. FRAMEADDR is the frame pointer
|
5507 |
|
|
+ * of the COUNT frame, or the frame pointer of the COUNT-1 frame if
|
5508 |
|
|
+ * RETURN_ADDR_IN_PREVIOUS_FRAME is nonzero. The value of the expression must
|
5509 |
|
|
+ * always be the correct address when COUNT is nonzero, but may be NULL_RTX if
|
5510 |
|
|
+ * there is no way to determine the return address of other frames.
|
5511 |
|
|
+ *
|
5512 |
202 |
dgisselq |
+ * ZipCPU --- Our answer for the current frame is ... it depends. If we can
|
5513 |
|
|
+ * force the use of a frame in every debug context, we could compute this for
|
5514 |
|
|
+ * COUNT != 0. For now, we'll just look at the registers we save and return
|
5515 |
|
|
+ * where the return address is in the current frame. To do that, though, we
|
5516 |
|
|
+ * need some help from C.
|
5517 |
102 |
dgisselq |
+ */
|
5518 |
|
|
+#undef RETURN_ADDR_RTX
|
5519 |
202 |
dgisselq |
+#define RETURN_ADDR_RTX(COUNT,FRAMEADDR) zip_return_addr_rtx(COUNT,FRAMEADDR)
|
5520 |
102 |
dgisselq |
+
|
5521 |
|
|
+/* RETURN_ADDR_IN_PREVIOUS_FRAME ... Define this macro to nonzero value if the
|
5522 |
|
|
+ * return address of a particular stack frame is accessed from the frame pointer
|
5523 |
|
|
+ * of the previous stack frame. The zero default for this macro is suitable
|
5524 |
|
|
+ * for most ports.
|
5525 |
|
|
+ *
|
5526 |
|
|
+ * ZipCPU---Default works here as well.
|
5527 |
|
|
+ */
|
5528 |
|
|
+
|
5529 |
|
|
+/* INCOMING_RETURN_ADDR_RTX ... A C expression whose value is RTL representing
|
5530 |
|
|
+ * the location of the incoming return address at the beginning of any function,
|
5531 |
|
|
+ * before the prologue. This RTL is either a REG, indicating that the return
|
5532 |
|
|
+ * value is saved in 'REG', or a MEM representing the location in the stack.
|
5533 |
|
|
+ * If this RTL is a REG, you should define DWARF_RETURN_COLUMN to
|
5534 |
|
|
+ * DWARF_FRAME_REGNUM(REGNO).
|
5535 |
|
|
+ *
|
5536 |
|
|
+ * ZipCPU --- While our incoming return address could theoretically be in any
|
5537 |
|
|
+ * register, our machine description file is going to place it into register
|
5538 |
|
|
+ * R0, so that's what we return here.
|
5539 |
|
|
+ */
|
5540 |
|
|
+#undef INCOMING_RETURN_ADDR_RTX
|
5541 |
202 |
dgisselq |
+#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG(SImode, zip_LR)
|
5542 |
102 |
dgisselq |
+
|
5543 |
|
|
+
|
5544 |
|
|
+/* DWARF_ALT_FRAME_RETURN_COLUMN
|
5545 |
|
|
+ */
|
5546 |
|
|
+
|
5547 |
|
|
+/* DWARF_ZERO_REG ... A C exrpession whose value is an integer giving a DWARF2
|
5548 |
|
|
+ * register number that is considered to always have the value zero. This
|
5549 |
|
|
+ * should only be defined if the target has an architected zero register (ZipCPU
|
5550 |
|
|
+ * does not), and someone decided it was a good idea to use that register number
|
5551 |
|
|
+ * to terminate the stack backtrace. New ports should avoid this (so the
|
5552 |
|
|
+ * ZipCPU port will avoid it as well).
|
5553 |
|
|
+ *
|
5554 |
|
|
+ */
|
5555 |
|
|
+
|
5556 |
|
|
+/* TARGET_DWARF_HANDLE_FRAME_UNSPEC
|
5557 |
|
|
+ */
|
5558 |
|
|
+
|
5559 |
171 |
dgisselq |
+/* INCOMING_FRAME_SP_OFFSET ... A C expression whose value is an integer giving
|
5560 |
|
|
+ * the offset, in bytes, from the value of the stack pointer register to the
|
5561 |
|
|
+ * top of the stack frame at the beginning of any function, before the prologue.
|
5562 |
|
|
+ * The top of the frame is defined to be the value of the stack pointer in the
|
5563 |
|
|
+ * previous frame, just before the call instruction.
|
5564 |
|
|
+ *
|
5565 |
|
|
+ * You only need to define this macro if you want to support call frame
|
5566 |
|
|
+ * debugging information like that provided by DWARF 2.
|
5567 |
|
|
+ *
|
5568 |
|
|
+ * ZipCPU---Our value is zero.
|
5569 |
102 |
dgisselq |
+ */
|
5570 |
|
|
+#define INCOMING_FRAME_SP_OFFSET 0
|
5571 |
|
|
+
|
5572 |
|
|
+/* ARG_POINTER_CFA_OFFSET
|
5573 |
|
|
+ */
|
5574 |
|
|
+
|
5575 |
|
|
+/* FRAME_POINTER_CFA_OFFSET
|
5576 |
|
|
+ */
|
5577 |
|
|
+
|
5578 |
|
|
+/* CFA_FRAME_BASE_OFFSET
|
5579 |
|
|
+ */
|
5580 |
|
|
+
|
5581 |
|
|
+/* 17.09.02 Exception handling support */
|
5582 |
|
|
+
|
5583 |
|
|
+/* EH_RETURN_DATA_REGNO(N) ... A C expression whose value is the Nth register
|
5584 |
|
|
+ * number used for data by exception handlers, or INVALID_REGNUM if fewer than
|
5585 |
|
|
+ * N registers are usable. The exception handling library routines communicate
|
5586 |
|
|
+ * with the exception handlers via a set of agreed upon registers. Ideally
|
5587 |
|
|
+ * these registers should be call clobbered; it is possible to use call-saved
|
5588 |
|
|
+ * registers, but may negatively impact code size. The target must support at
|
5589 |
|
|
+ * least 2 data registers, but should define 4 if their are enough free
|
5590 |
|
|
+ * registers.
|
5591 |
|
|
+ *
|
5592 |
|
|
+ * You must define this macro if you want to support call frame exception
|
5593 |
|
|
+ * handling like that provided by DWARF 2.
|
5594 |
202 |
dgisselq |
+ *
|
5595 |
|
|
+ * ZipCPU -- We copy much of our definition from Moxie.
|
5596 |
102 |
dgisselq |
+ */
|
5597 |
202 |
dgisselq |
+#define EH_RETURN_DATA_REGNO(N) ((N<3)?(N+ZIP_FIRST_ARG_REGNO):INVALID_REGNUM)
|
5598 |
102 |
dgisselq |
+
|
5599 |
|
|
+/* EH_RETURN_STACKADJ_RTX ... A C expression whose value is RTL representing
|
5600 |
|
|
+ * a location in which to store a stack adjustment to be applied before function
|
5601 |
|
|
+ * return. This is used to unwind the stack to an exception handler's call
|
5602 |
|
|
+ * frame. It will be assigned zero on code paths that return normally.
|
5603 |
|
|
+ *
|
5604 |
|
|
+ * Do not define this macro if the stack pointer is saved and restored by the
|
5605 |
|
|
+ * regular prolog and epilog code in the call frame itself (which it is for the
|
5606 |
|
|
+ * ZipCPU); in this case, the exception handling library routines will update
|
5607 |
|
|
+ * the stack location to be restored in place. Otherwise, you must define this
|
5608 |
|
|
+ * macro if you want to support call frame exception handling like that provided
|
5609 |
|
|
+ * by DWARF 2.
|
5610 |
|
|
+ *
|
5611 |
|
|
+ */
|
5612 |
|
|
+
|
5613 |
|
|
+/* EH_RETURN_HANDLER_RTX ... A C expression whose value is RTL representing a
|
5614 |
|
|
+ * location in which to store the address of an exception handler to which we
|
5615 |
|
|
+ * should return. It will not be assigned on code paths that return normally.
|
5616 |
|
|
+ *
|
5617 |
|
|
+ * Typcally this is the location in the call frame at which the normal return
|
5618 |
|
|
+ * address is stored. For targets that return by popping an address of the
|
5619 |
202 |
dgisselq |
+ * stack, this might be a memory address just below the target call frame
|
5620 |
102 |
dgisselq |
+ * rather than inside the current call frame. If defined,
|
5621 |
|
|
+ * EH_RETURN_STACKADJ_RTX will have already been assigned, so it may be used
|
5622 |
|
|
+ * to calculate the location of the target call frame.
|
5623 |
|
|
+ *
|
5624 |
|
|
+ * If you want to support call frame exception handling, you must define either
|
5625 |
|
|
+ * this macro or the eh_return instruction pattern.
|
5626 |
202 |
dgisselq |
+ *
|
5627 |
|
|
+ * ZipCPU --- We again copy from Moxie
|
5628 |
102 |
dgisselq |
+ */
|
5629 |
202 |
dgisselq |
+#define EH_RETURN_HANDLER_RTX \
|
5630 |
|
|
+ gen_frame_mem(Pmode, plus_constant(Pmode, frame_pointer_rtx, UNITS_PER_WORD))
|
5631 |
102 |
dgisselq |
+
|
5632 |
|
|
+/*
|
5633 |
|
|
+ *
|
5634 |
|
|
+ *
|
5635 |
|
|
+ *
|
5636 |
|
|
+ * REST OF SECTION SKIPPED ...
|
5637 |
|
|
+ *
|
5638 |
|
|
+ *
|
5639 |
|
|
+ *
|
5640 |
|
|
+ */
|
5641 |
|
|
+
|
5642 |
|
|
+/* 17.09.03 Specifying how stack checking is done */
|
5643 |
|
|
+
|
5644 |
|
|
+/* STACK_CHECK_BUILTIN ... a non-zero value if stack checking is done by the
|
5645 |
|
|
+ * configuration files in a machine-dependent manner. You should define this
|
5646 |
|
|
+ * macro if stack checking is required by the ABI of your machine or if you
|
5647 |
|
|
+ * would like to do stack checking in some more efficient way than the generic
|
5648 |
|
|
+ * appraoch. The default value of this macro is zero.
|
5649 |
|
|
+ *
|
5650 |
|
|
+ * ZipCPU --- The default makes sense for us.
|
5651 |
|
|
+ */
|
5652 |
|
|
+// #define STACK_CHECK_BUILTIN 0
|
5653 |
|
|
+
|
5654 |
|
|
+/* STACK_CHECK_STATIC_BUILTIN ... A nonzero value if static stack checking is
|
5655 |
|
|
+ * done by the configuration files in a machine-dependent manner. You should
|
5656 |
|
|
+ * define this macro if you would like to do static stack checking in some more
|
5657 |
|
|
+ * efficient way than the generic approach. The default value of this macro
|
5658 |
|
|
+ * is zero.
|
5659 |
|
|
+ *
|
5660 |
|
|
+ * ZipCPU --- The default makes sense for us.
|
5661 |
|
|
+ */
|
5662 |
|
|
+
|
5663 |
|
|
+/* STACK_CHECK_PROBE_INTERVAL_EXP ... An integer specifying the interval at
|
5664 |
|
|
+ * which GCC must generate stack probe instructions, defined as 2 raised to this
|
5665 |
|
|
+ * interval. You will normally define this macro so that the interval is no
|
5666 |
|
|
+ * larger than the size of the "guard pages" at the end of a stack area. The
|
5667 |
|
|
+ * default value of 12 (4096-byte interval) is suitable for most systems.
|
5668 |
|
|
+ *
|
5669 |
|
|
+ * ZipCPU --- Default.
|
5670 |
|
|
+ */
|
5671 |
|
|
+
|
5672 |
|
|
+/* STACK_CHECK_MOVING_SP ... An integer which is non-zero if GCC should move
|
5673 |
|
|
+ * the stack pointer page by page when doing probes. This can be necessary
|
5674 |
|
|
+ * on systems where the stack pointer contains the bottom address of the memory
|
5675 |
|
|
+ * area accessible to the executing thread at any point in time. In this
|
5676 |
|
|
+ * situation, an alternate signal stack is required in order to be able to
|
5677 |
|
|
+ * recover from a stack overflow. The default value of this macro is zero.
|
5678 |
|
|
+ *
|
5679 |
|
|
+ * ZipCPU -- Default.
|
5680 |
|
|
+ */
|
5681 |
|
|
+
|
5682 |
|
|
+/* STACK_CHECK_PROTECT
|
5683 |
|
|
+ */
|
5684 |
|
|
+/* STACK_CHECK_MAX_FRAME_SIZE
|
5685 |
|
|
+ * ... you should normally not change the default value of this macro.
|
5686 |
|
|
+ */
|
5687 |
|
|
+/* STACK_CHECK_FIXED_FRAME_SIZE
|
5688 |
|
|
+ * ... you ... will normally use the default of four words.
|
5689 |
|
|
+ */
|
5690 |
|
|
+
|
5691 |
|
|
+/* STACK_CHECK_MAX_VAR_SIZE
|
5692 |
|
|
+ * ... you will normally not need to override that default.
|
5693 |
|
|
+ */
|
5694 |
|
|
+
|
5695 |
|
|
+/* 17.09.04 Registers that Address the Stack Frame*/
|
5696 |
|
|
+
|
5697 |
|
|
+/* STACK_POINTER_REGNUM ... The register number of the stack pointer register,
|
5698 |
|
|
+ * which must also be a fixed register according to FIXED_REGISTERS. On most
|
5699 |
|
|
+ * machines, the hardware determines which register this is.
|
5700 |
|
|
+ */
|
5701 |
|
|
+#undef STACK_POINTER_REGNUM
|
5702 |
|
|
+#define STACK_POINTER_REGNUM zip_SP
|
5703 |
|
|
+
|
5704 |
|
|
+/* FRAME_POINTER_REGNUM ... The register number of the frame pointer register,
|
5705 |
|
|
+ * which is used to access certain automatic variables in the stack frame. On
|
5706 |
|
|
+ * some machines, the hardware determines which register this is. On other
|
5707 |
|
|
+ * machines you can choose any register you wish for this purpose.
|
5708 |
|
|
+ *
|
5709 |
|
|
+ * ZipCPU --- While I'd like to dump this pointer, since I don't really see
|
5710 |
|
|
+ * a need for it, alloca() requires it. Therefore let's assine a register to
|
5711 |
|
|
+ * this purpose and watch what the compiler does with it.
|
5712 |
|
|
+ */
|
5713 |
|
|
+#define FRAME_POINTER_REGNUM zip_FP
|
5714 |
|
|
+
|
5715 |
|
|
+/* HARD_FRAME_POINTER_REGNUM ... On some machines the offset between the frame
|
5716 |
|
|
+ * pointer and starting offset of the automatic variables is not known until
|
5717 |
|
|
+ * after register allocation has been done (for example, because the saved
|
5718 |
|
|
+ * registers are between these two locations). On those machines, define
|
5719 |
|
|
+ * FRAME_POINTER_REGNUM the number of a special, fixed register to be used
|
5720 |
|
|
+ * internally until the offset is known, and define HARD_FRAME_POINTER_REGNUM
|
5721 |
|
|
+ * to be the actual hard register number used for the frame pointer.
|
5722 |
|
|
+ *
|
5723 |
|
|
+ * Do not define this macro if it would be the same as FRAME_POINTER_REGNUM
|
5724 |
|
|
+ *
|
5725 |
|
|
+ * ZipCPU --- we do not define this macro.
|
5726 |
|
|
+ */
|
5727 |
103 |
dgisselq |
+#define HARD_FRAME_POINTER_REGNUM zip_FP
|
5728 |
102 |
dgisselq |
+
|
5729 |
|
|
+/* ARG_POINTER_REGNUM ... The register number of the arg pointer register, which
|
5730 |
|
|
+ * is used to access the function's argument list. On some machines, this is
|
5731 |
|
|
+ * the same as the frame pointer register. On some machines, the hardware
|
5732 |
|
|
+ * determines which register this is. On other machines, you can choose any
|
5733 |
|
|
+ * register you wish for this purpose. If this is not the same register as the
|
5734 |
|
|
+ * frame pointer register, then you must mark it as a fixed register according
|
5735 |
|
|
+ * to FIXED_REGISTERs, or arrange to be able to eliminate it.
|
5736 |
|
|
+ *
|
5737 |
|
|
+ * ZipCPU --- We really don't want to lose another register to something
|
5738 |
|
|
+ * pointless, so let's set this to be the frame pointer register. Especially
|
5739 |
|
|
+ * given the ZipCPU's ease of accessing things via offsets of registers, this
|
5740 |
|
|
+ * should work for a rather large stack frame.
|
5741 |
171 |
dgisselq |
+ *
|
5742 |
|
|
+ * However ... we had problems with passing 6+ variables on the stack, so let's
|
5743 |
|
|
+ * try creating a pseudo register for this, and appropriately adjusting the
|
5744 |
|
|
+ * offset between this pseudo register and the stack pointer ...
|
5745 |
102 |
dgisselq |
+ */
|
5746 |
171 |
dgisselq |
+#define ARG_POINTER_REGNUM zip_AP_PSEUDO
|
5747 |
102 |
dgisselq |
+
|
5748 |
|
|
+/* HARD_FRAME_POINTER_IS_FRAME_POINTER ... define this to be a preprocessor
|
5749 |
|
|
+ * constant that is nonzero if hard_frame_pointer_rtx and frame_pointer_rtx
|
5750 |
|
|
+ * should be the same. The default definition is sufficient for us.
|
5751 |
|
|
+ */
|
5752 |
|
|
+
|
5753 |
|
|
+/* HARD_FRAME_POINTER_IS_ARG_POINTER ...
|
5754 |
|
|
+ * ZipCPU doesn't need this macro
|
5755 |
|
|
+ */
|
5756 |
|
|
+
|
5757 |
|
|
+/* RETURN_ADDRESS_POINTER_REGNUM ... The register number of the return address
|
5758 |
|
|
+ * pointer register, which is used to access the current function's return
|
5759 |
|
|
+ * address from the stack. On some machines, the return address is not at a
|
5760 |
|
|
+ * fixed offset from the frame pointer or stack pointer or argument pointer.
|
5761 |
|
|
+ * This register can be defined to point to the return address on the stack, and
|
5762 |
|
|
+ * then to be converted by ELIMINABLE_REGS into either the frame pointer or the
|
5763 |
|
|
+ * stack pointer.
|
5764 |
|
|
+ *
|
5765 |
|
|
+ * Do not define this macro unless there is no other way to get the return
|
5766 |
|
|
+ * address from the stack.
|
5767 |
|
|
+ *
|
5768 |
|
|
+ * ZipCPU---we need this.
|
5769 |
|
|
+ */
|
5770 |
202 |
dgisselq |
+#define RETURN_ADDRESS_REGNUM zip_LR
|
5771 |
102 |
dgisselq |
+
|
5772 |
|
|
+
|
5773 |
|
|
+/* STATIC_CHAIN_REGNUM ... Register numbers used for passing a function's
|
5774 |
|
|
+ * static chain pointer. If register windows are used, the register number as
|
5775 |
|
|
+ * seen by the called function is STATIC_CHAIN_INCOMING_REGNUM, while the
|
5776 |
|
|
+ * register number as seen by the calling function is STATIC_CHAIN_REGNUM. If
|
5777 |
|
|
+ * these register are the same, STATIC_CHAIN_INCOMING_REGNUM need not be
|
5778 |
|
|
+ * defined.
|
5779 |
|
|
+ *
|
5780 |
202 |
dgisselq |
+ * ZipCPU --- even without register windows, we still need to pick an
|
5781 |
|
|
+ * (arbitrary) register to pass the pointer to the static chain in the case of
|
5782 |
|
|
+ * nested functions. Let's arbitrarily pick R5, and ... see how that works for
|
5783 |
|
|
+ * us.
|
5784 |
102 |
dgisselq |
+ */
|
5785 |
202 |
dgisselq |
+#define STATIC_CHAIN_REGNUM zip_R5
|
5786 |
102 |
dgisselq |
+
|
5787 |
|
|
+/* TARGET_STATIC_CHAIN ... This hook replaces the use of STATIC_CHAIN_REGNUM et
|
5788 |
|
|
+ * al for targets that may use different static chain locations for different
|
5789 |
|
|
+ * nested functions. This may be required if the target has function attributes
|
5790 |
|
|
+ * that affect the calling conventions of the function and those calling
|
5791 |
|
|
+ * conventions use different static chain locations.
|
5792 |
|
|
+ *
|
5793 |
|
|
+ * ZipCPU --- don't need this.
|
5794 |
|
|
+ */
|
5795 |
202 |
dgisselq |
+// #define TARGET_STATIC_CHAIN zip_R11
|
5796 |
102 |
dgisselq |
+
|
5797 |
|
|
+
|
5798 |
|
|
+/* DWARF_FRAME_REGISTERS ... This macro specifies the maximum number of hard
|
5799 |
|
|
+ * registers that can be saved in a call frame. This is used to size data
|
5800 |
|
|
+ * structures used in DWARF2 exception handling.
|
5801 |
|
|
+ *
|
5802 |
|
|
+ * Prior to GCC 3.0, this macro was needed in order to establish a stable
|
5803 |
|
|
+ * exception handling ABI in the face of adding new hard registers for ISA
|
5804 |
|
|
+ * extensions. In GCC 3.0 and later, the EH ABI is insulated from changes in
|
5805 |
|
|
+ * the number of hard registers. Nevertheless, this macro can still be used to
|
5806 |
|
|
+ * reduce the runtime memory requirements of the exception handling routines,
|
5807 |
|
|
+ * which can be substantial if the ISA contains a lot of registers that are not
|
5808 |
|
|
+ * call-saved.
|
5809 |
|
|
+ *
|
5810 |
|
|
+ * If this macro is not defined, it defaults to FIRST_PSEUDO_REGISTER.
|
5811 |
|
|
+ *
|
5812 |
|
|
+ * ZipCPU --- The default is not sufficient. The CC and PC registers need to
|
5813 |
|
|
+ * be saved and examined as well in any debug/exception context. Hence, we
|
5814 |
|
|
+ * define this to be all of our registers.
|
5815 |
|
|
+ */
|
5816 |
|
|
+#undef DWARF_FRAME_REGISTERS
|
5817 |
|
|
+#define DWARF_FRAME_REGISTERS 16
|
5818 |
|
|
+
|
5819 |
|
|
+/* PRE_GCC3_DWARF_FRAME_REGISTERS ... This macro is similar to DWARF_FRAME_REG..
|
5820 |
|
|
+ * but is provided for backward compatibility in pre GCC 3.0 compiled code.
|
5821 |
|
|
+ *
|
5822 |
|
|
+ * If not defined, it defaults to DWARF_FRAME_REGISTERS---which is perfect for
|
5823 |
|
|
+ * the ZipCPU.
|
5824 |
|
|
+ */
|
5825 |
|
|
+
|
5826 |
|
|
+/* DWARF_REG_TO_UNWIND_COLUMN(REGNO) ... Define this macro if the target's
|
5827 |
|
|
+ * representation for dwarf registers is different than the internal
|
5828 |
|
|
+ * representation for unwind column. Given a dwarf register, this macro should
|
5829 |
|
|
+ * return the unwind column number to use instead.
|
5830 |
|
|
+ *
|
5831 |
|
|
+ * ... ???
|
5832 |
|
|
+ */
|
5833 |
|
|
+
|
5834 |
|
|
+/* DWARF_FRAME_REGNUM(REGNO) ... Define this macro is the target's
|
5835 |
|
|
+ * representation for dwarf registers used in .eh_frame or .debug_frame is
|
5836 |
|
|
+ * different from that used in other debug info sections. Given a GCC hard
|
5837 |
|
|
+ * register number, this macro should return the .eh_frame register number.
|
5838 |
|
|
+ * The default is DBX_REGISTER_NUMBER(REGNO).
|
5839 |
|
|
+ *
|
5840 |
|
|
+ * ZipCPU --- provided we define DBX_REGISTER_NUMBER(REGNO) well, this default
|
5841 |
|
|
+ * should still work for us.
|
5842 |
|
|
+ */
|
5843 |
|
|
+
|
5844 |
|
|
+/* DWARF2_FRAME_REG_OUT(REGNO, FOR_EH) ... Define this macro to map register
|
5845 |
|
|
+ * numbers held in the call frame info that GCC has collected using
|
5846 |
|
|
+ * DWARF_FRAME_REGNO to those that should be output in .debug_frame (for_eh is
|
5847 |
|
|
+ * zero) and .eh_frame (for_eh is non-zero). The default is to return REGNO.
|
5848 |
|
|
+ *
|
5849 |
|
|
+ * ZipCPU --- Default is good enough.
|
5850 |
|
|
+ */
|
5851 |
|
|
+
|
5852 |
|
|
+/* REG_VALUE_IN_UNWIND_CONTEXT ... Define this macro if the target stores
|
5853 |
|
|
+ * register values as _Unwind_Word type in unwind context. It should be defined
|
5854 |
|
|
+ * if target register size is larger than the size of void *. The default
|
5855 |
|
|
+ * is to store register values as void *type.
|
5856 |
|
|
+ *
|
5857 |
|
|
+ * ZipCPU --- Default is what we need.
|
5858 |
|
|
+ */
|
5859 |
|
|
+
|
5860 |
|
|
+/* ASSUME_EXTENDED_UNWIND_CONTEXT ... Define this macro to be 1 if the target
|
5861 |
|
|
+ * always uses extended unwind context with version, args_size, and by_value
|
5862 |
|
|
+ * fields. If it is undefined, it will always be defined to 1 when REG_VALUE_IN_UNWIND_CONTEXT is defined and 0 otherwise.
|
5863 |
|
|
+ *
|
5864 |
|
|
+ */
|
5865 |
|
|
+
|
5866 |
|
|
+
|
5867 |
|
|
+/* 17.09.05 Eliminating Frame Pointer and Arg Pointer */
|
5868 |
|
|
+
|
5869 |
|
|
+/* TARGET_FRAME_POINTER_REQUIRED(VOID) ... This target hook should return true
|
5870 |
|
|
+ * if a function must have and use a frame pointer. This target hook is
|
5871 |
|
|
+ * called in the reload pass. If its return value is true, the function will
|
5872 |
|
|
+ * have a frame pointer.
|
5873 |
|
|
+ *
|
5874 |
|
|
+ * This target hook can in principle examine the current function and decide
|
5875 |
|
|
+ * according to the facts, but on most machines the constant false or the
|
5876 |
|
|
+ * constant true suffices. Use false when the machine allows code to be
|
5877 |
|
|
+ * generated with no frame pointer, and doing so saves some time or space.
|
5878 |
|
|
+ * Use true when there is no possible advantage to avoiding a frame pointer.
|
5879 |
|
|
+ *
|
5880 |
|
|
+ * ZipCPU---if we add in a frame pointer, we become register starved. Hence,
|
5881 |
|
|
+ * we'll treat this as a constant false--which is also the default value.
|
5882 |
|
|
+ */
|
5883 |
|
|
+#define target_frame_pointer_required zip_frame_pointer_required
|
5884 |
|
|
+
|
5885 |
|
|
+/* INITIAL_FRAME_POINTER_OFFSET ... A C statement to store in the variable
|
5886 |
|
|
+ * depth-var the difference between the frame pointer and the stack pointer
|
5887 |
|
|
+ * values immediately after the function prologue. The value would be computed
|
5888 |
|
|
+ * from information such as the result of get_frame_size() and the tables of
|
5889 |
|
|
+ * registers regs_ever_live and call_used_regs.
|
5890 |
|
|
+ *
|
5891 |
|
|
+ * If ELIMINABLE_REGS is defined, this macro will not be used and need not be
|
5892 |
|
|
+ * defined. Otherwise, it must be defined even if TARGET_FRAME_POINTER_REQD
|
5893 |
|
|
+ * always returns true; in that case you may set depth-var to anything.
|
5894 |
|
|
+ *
|
5895 |
|
|
+ * ZipCPU --- we intend to set ELIMINABLE_REGS, so this is not necessary.
|
5896 |
|
|
+ */
|
5897 |
|
|
+// #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = 0
|
5898 |
|
|
+
|
5899 |
|
|
+
|
5900 |
|
|
+/* ELIMINABLE_REGS ... If defined, this macro specifies a table of register
|
5901 |
|
|
+ * pairs used to eliminate unneeded registers that point into the stack frame.
|
5902 |
|
|
+ * If it is not defined, the only elimination attempted by the compiler is to
|
5903 |
|
|
+ * replace references to the frame pointer with references to the stack pointer.
|
5904 |
|
|
+ *
|
5905 |
|
|
+ * On some machines, the position of the argument pointer is not known until
|
5906 |
|
|
+ * the compilation is completed. In such a case, a separate hard register
|
5907 |
|
|
+ * must be used for the argument pointer. This register can be eliminated by
|
5908 |
|
|
+ * replacing it with either the frame pointer or the argument pointer,
|
5909 |
|
|
+ * depending on whether or not the frame pointer has been eliminated.
|
5910 |
|
|
+ *
|
5911 |
|
|
+ * ZipCPU we'll take their suggestion and define this as:
|
5912 |
|
|
+ */
|
5913 |
|
|
+#undef ELIMINABLE_REGS
|
5914 |
|
|
+#define ELIMINABLE_REGS \
|
5915 |
|
|
+ {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
|
5916 |
|
|
+ { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }, \
|
5917 |
|
|
+ { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
|
5918 |
|
|
+
|
5919 |
|
|
+/* bool TARGET_CAN_ELIMINATE(FROM,TO) ... This target function should return
|
5920 |
|
|
+ * true if the compiler is allowed to try to replace register number FROM with
|
5921 |
|
|
+ * register number TO. This target hook need only be defined if ELIMINABLE_REGS
|
5922 |
|
|
+ * is defined, and will usually return true since most of the cases preventing
|
5923 |
|
|
+ * register elimination are things that the compiler already knows about.
|
5924 |
|
|
+ *
|
5925 |
|
|
+ * ZipCPU ... does the compiler know about my decision as to whether or not
|
5926 |
117 |
dgisselq |
+ * the frame pointer was needed? Yes it does, but it's kept separately. We'll
|
5927 |
|
|
+ * just say everything can be eliminated.
|
5928 |
102 |
dgisselq |
+ */
|
5929 |
|
|
+#define TARGET_CAN_ELIMINATE zip_can_eliminate
|
5930 |
|
|
+
|
5931 |
|
|
+/* INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) ... This macro is similar to
|
5932 |
|
|
+ * INITIAL_FRAME_POINTER_OFFSET. It specifies the initial difference between
|
5933 |
|
|
+ * the specified pair of registers. This macro must be defined if
|
5934 |
|
|
+ * ELIMINABLE_REGS is defined.
|
5935 |
|
|
+ *
|
5936 |
117 |
dgisselq |
+ * ZipCPU---We had at one time set this to a default offset of 0. This didn't
|
5937 |
|
|
+ * work. It turns out that this is not only the *initial* elimination offset,
|
5938 |
|
|
+ * but also the offset along the way. Hence, when a variable needs to be
|
5939 |
|
|
+ * spilled to the stack, this offset must change. Reload goes and checks for
|
5940 |
|
|
+ * this, and adjusts registers if the offset has changed. Hence, without this,
|
5941 |
|
|
+ * we get negative (i.e. illegal) stack offsets.
|
5942 |
102 |
dgisselq |
+ */
|
5943 |
|
|
+#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
|
5944 |
|
|
+ do { (OFFSET) = zip_initial_elimination_offset((FROM), (TO)); } \
|
5945 |
|
|
+ while(0) \
|
5946 |
|
|
+
|
5947 |
|
|
+/* 17.09.06 Passing function arguments on the stack */
|
5948 |
|
|
+
|
5949 |
|
|
+/* TARGET_PROMOTE_PROTOTYPES ... Returns true if an argument declared in a
|
5950 |
|
|
+ * prototype as an integral type smaller than int should actually be
|
5951 |
|
|
+ * passed as an int. In addition to avoiding errors in certain cases of
|
5952 |
|
|
+ * mismatch, it also makes for better code on certain machines. The default is
|
5953 |
|
|
+ * to not promote prototypes.
|
5954 |
|
|
+ *
|
5955 |
|
|
+ * Since everything is an int on the ZipCPU, let's promote anything smaller
|
5956 |
|
|
+ * (which should still be an int) up to an int anyway.
|
5957 |
|
|
+ */
|
5958 |
|
|
+#undef TARGET_PROMOTE_PROTOTYPES
|
5959 |
|
|
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
|
5960 |
|
|
+
|
5961 |
|
|
+/* PUSH_ARGS ... A C expression. If nonzero, push instructions will be used to
|
5962 |
|
|
+ * pass outgoing arguments. If the target machine does not have a push
|
5963 |
|
|
+ * instruction, set it to zero. That directs GCC to use an alternate strategy:
|
5964 |
|
|
+ * to allocate the entire argument block and then store the arguments into it.
|
5965 |
|
|
+ * When PUSH_ARGS is nonzero, PUSH_ROUNDING must be defined too.
|
5966 |
|
|
+ *
|
5967 |
|
|
+ * ZipCPU does not have a push instruction, so we set this to zero.
|
5968 |
|
|
+ */
|
5969 |
|
|
+#undef PUSH_ARGS
|
5970 |
|
|
+#define PUSH_ARGS 0
|
5971 |
|
|
+
|
5972 |
|
|
+/* PUSH_ARGS_REVERSED ... A C expression. If nonzero, function arguments will
|
5973 |
|
|
+ * be evaluated last to first, rather than first to last. If this macro is
|
5974 |
|
|
+ * not defined, it defaults to PUSH_ARGS on targets where the stack and args
|
5975 |
|
|
+ * grow in opposite directions, and zero otherwise.
|
5976 |
|
|
+ *
|
5977 |
|
|
+ * ZipCPU---Let's evaluate our arguments first to last.
|
5978 |
|
|
+ */
|
5979 |
|
|
+#define PUSH_ARGS_REVERSED 1
|
5980 |
|
|
+
|
5981 |
|
|
+/* PUSH_ROUNDING(NPUSHED) ... A C expression that is the number of bytes
|
5982 |
|
|
+ * actually pushed onto the stack when an instruction attempts to push
|
5983 |
|
|
+ * (NPUSHED) bytes.
|
5984 |
|
|
+ *
|
5985 |
|
|
+ * ZipCPU---We cannot push bytes. Let's leave this undefined and see what
|
5986 |
|
|
+ * happens.
|
5987 |
|
|
+ */
|
5988 |
|
|
+// #warning "No appropriate definition seemed right."
|
5989 |
|
|
+
|
5990 |
|
|
+/* ACCUMULATE_OUTGOING_ARGS ... A C expression. If non-zero, the maximum amount
|
5991 |
|
|
+ * of space required for outgoing arguments will be computed and placed into
|
5992 |
171 |
dgisselq |
+ * crtl->outgoing_args_size. No space will be pushed onto the stack for each
|
5993 |
|
|
+ * call; instead the function prologue should increase the stack frame size by
|
5994 |
|
|
+ * this amount.
|
5995 |
102 |
dgisselq |
+ *
|
5996 |
|
|
+ * ZipCPU---This is *cool* and so necessary---it saves an extra two instructions
|
5997 |
|
|
+ * each time we try to call a function/routine. Yes, we want and *need* this
|
5998 |
|
|
+ * for good performance. I mean, think of it, free performance increase? Who
|
5999 |
|
|
+ * could argue with that?
|
6000 |
|
|
+ */
|
6001 |
|
|
+#undef ACCUMULATE_OUTGOING_ARGS
|
6002 |
|
|
+#define ACCUMULATE_OUTGOING_ARGS 1
|
6003 |
|
|
+
|
6004 |
|
|
+
|
6005 |
191 |
dgisselq |
+/* REG_PARM_STACK_SPACE(FN) ... Define this macro if functions should assume
|
6006 |
102 |
dgisselq |
+ * that stack space has been allocated for arguments even when their values
|
6007 |
|
|
+ * are passed in registers. The value of this macro is the size, in bytes, of
|
6008 |
|
|
+ * the area reserved for arguments passed in registers for the function
|
6009 |
|
|
+ * represented by FN, which can be zero if GCC is calling a library function.
|
6010 |
|
|
+ * The argument FN can be the FUNCTION_DECL, or the type itself of the function.
|
6011 |
|
|
+ *
|
6012 |
|
|
+ * This space can be allocated by the caller, or be part of the machine
|
6013 |
|
|
+ * dependent stack frame: OUTGOING_REG_PARM_STACK_SPACE says which.
|
6014 |
|
|
+ *
|
6015 |
|
|
+ * ZipCPU --- Why allocate space you won't use? Let's leave this undefined
|
6016 |
|
|
+ * therefore.
|
6017 |
|
|
+ */
|
6018 |
|
|
+// #undef REG_PARM_STACK_SPACE
|
6019 |
|
|
+
|
6020 |
|
|
+
|
6021 |
|
|
+
|
6022 |
|
|
+/* INCOMING_REG_PARM_STACK_SPACE(FN) ... Like REG_PARM_STACK_SPACE, but for
|
6023 |
|
|
+ * incoming register arguments. Define this macro if space guaranteed when
|
6024 |
|
|
+ * compiling a function body is different to space required when making a call,
|
6025 |
|
|
+ * a situation that can arise with K&R style function definitions.
|
6026 |
|
|
+ *
|
6027 |
|
|
+ */
|
6028 |
|
|
+
|
6029 |
|
|
+/* OUTGOING_REG_PARM_STACK_SPACE(FN) ... Define this to a nonzero value if it
|
6030 |
|
|
+ * is the responsibility of the caller to allocate the area reserved for
|
6031 |
|
|
+ * arguments passed in registers when calling a function of FN. FN may be NULL
|
6032 |
|
|
+ * if the function called is a library function.
|
6033 |
|
|
+ *
|
6034 |
|
|
+ * ZipCPU---Why allocate space you don't need?
|
6035 |
|
|
+ */
|
6036 |
|
|
+#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 0
|
6037 |
|
|
+
|
6038 |
|
|
+
|
6039 |
|
|
+/* STACK_PARMS_IN_REG_PARM_AREA ... Define this macro if REG_PARM_STACK_SPACE
|
6040 |
|
|
+ * is defined, buyt the stack parameters don't skip the area specified by it.
|
6041 |
|
|
+ *
|
6042 |
|
|
+ * ZipCPU---We didn't define REG_PARM_STACK_SPACE, so we won't define this.
|
6043 |
|
|
+ */
|
6044 |
|
|
+
|
6045 |
|
|
+/* TARGET_RETURN_POPS_ARGS(DECL,FNTYPE,SZ) ... This target hook returns the
|
6046 |
|
|
+ * number of bytes of its own arguments that a function pops on returning, or 0
|
6047 |
|
|
+ * if the function pops no arguments and the caller must therefore pop them all
|
6048 |
|
|
+ * after the function returns.
|
6049 |
|
|
+ *
|
6050 |
|
|
+ * ZipCPU --- If we define this, we'll lose our gain from
|
6051 |
|
|
+ * ACCUMULATE_OUTOING_ARGS. Thus, we leave this undefined.
|
6052 |
|
|
+ */
|
6053 |
|
|
+
|
6054 |
|
|
+/* CALL_POPS_ARGS(CUM) ... A C expression that should indicate the number of
|
6055 |
|
|
+ * bytes a call sequence pops off of the stack. It is added to the value of
|
6056 |
|
|
+ * RETURN_POPS_ARGS when compiling a function call. CUM is the variable in
|
6057 |
|
|
+ * which all arguments to the function have been accumulated.
|
6058 |
|
|
+ *
|
6059 |
|
|
+ * ZipCPU---The call sequence, by itself, doesn't touch the stack. Therefore
|
6060 |
|
|
+ * this is zero.
|
6061 |
|
|
+ */
|
6062 |
|
|
+#undef CALL_POPS_ARGS
|
6063 |
|
|
+#define CALL_POPS_ARGS(CUM) 0
|
6064 |
|
|
+
|
6065 |
|
|
+
|
6066 |
|
|
+/* 17.09.07 Passing arguments in registers */
|
6067 |
|
|
+
|
6068 |
|
|
+/* TARGET_FUNCTION_ARG ... Return an RTX indicating whether a function argument
|
6069 |
|
|
+ * is passed in a register, and if so, which register.
|
6070 |
|
|
+ */
|
6071 |
|
|
+/*
|
6072 |
|
|
+ * This has been poisoned ... so let's not define it anymore and look for
|
6073 |
|
|
+ * a better way to do this ...
|
6074 |
|
|
+ *
|
6075 |
|
|
+ * #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) (((NAMED) == 0) ? NULL_RTX
|
6076 |
|
|
+ * : targetm.calls.must_pass_in_stack(MODE, TYPE) ? NULL_RTX
|
6077 |
|
|
+ * : (CUM) > ZIP_LAST_ARG_REGNO ? NULL_RTX
|
6078 |
|
|
+ * : gen_rtx_REG(MODE, CUM))
|
6079 |
|
|
+ */
|
6080 |
|
|
+#define TARGET_FUNCTION_ARG zip_function_arg
|
6081 |
|
|
+
|
6082 |
|
|
+
|
6083 |
171 |
dgisselq |
+/* TARGET_MUST_PASS_IN_STACK(MODE, TYPE) ... This target hook should return
|
6084 |
|
|
+ * true if we should not pass TYPE solely in registers. The file 'expr.h'
|
6085 |
|
|
+ * defines a definition that is usually appropriate, refer to 'expr.h' for
|
6086 |
|
|
+ * additional documentation.
|
6087 |
|
|
+ *
|
6088 |
|
|
+ * ZipCPU ... Ok, so I looked into expr.h and didn't find anything that looked
|
6089 |
|
|
+ * like this. So ... I don't know.
|
6090 |
102 |
dgisselq |
+ */
|
6091 |
|
|
+// #undef TARGET_MUST_PASS_IN_STACK
|
6092 |
|
|
+// #define TARGET_MUST_PASS_IN_STACK zip_must_pass_in_stack
|
6093 |
|
|
+
|
6094 |
|
|
+/* TARGET_FUNCTION_INCOMING_ARG ... Define this hook if the target machine
|
6095 |
|
|
+ * has register windows, ... which ZipCPU does not have.
|
6096 |
|
|
+ */
|
6097 |
|
|
+
|
6098 |
|
|
+/* TARGET_USE_PSEUDO_PIC_REG(void) ... This hook should return 1 in case
|
6099 |
|
|
+ * pseudo register should be created for pic_offset_table_rtx during function
|
6100 |
|
|
+ * expand.
|
6101 |
|
|
+ *
|
6102 |
|
|
+ * This should be defined by global parameters, isn't it?
|
6103 |
|
|
+ */
|
6104 |
|
|
+
|
6105 |
|
|
+/* TARGET_INIT_PIC_REG(v) ... Perform a target dependent initialization of
|
6106 |
|
|
+ * pic_offset_table_rtx. This hook is called at the start of register
|
6107 |
|
|
+ * allocation.
|
6108 |
|
|
+ *
|
6109 |
|
|
+ * ZipCPU---Let's revisit this.
|
6110 |
|
|
+ */
|
6111 |
|
|
+// #warning "Come back and relook at relocations"
|
6112 |
|
|
+
|
6113 |
|
|
+/* TARGET_ARG_PARTIAL_BYTES ... This target hook returns the number of bytes
|
6114 |
|
|
+ * at the beginning of an argument that must be put in registers. The value
|
6115 |
|
|
+ * must be zero for arguments that are passed entirely in registers or that
|
6116 |
|
|
+ * are entirely pushed on the stack.
|
6117 |
|
|
+ */
|
6118 |
|
|
+// #undef TARGET_ARG_PARTIAL_BYTES
|
6119 |
|
|
+// #define TARGET_ARG_PARTIAL_BYTES zip_arg_partial_bytes
|
6120 |
|
|
+
|
6121 |
|
|
+/* TARGET_PASS_BY_REFERENCE(CUM,MOD,TREE,NAMED) ... This target hook should
|
6122 |
|
|
+ * return true if an argument at the position indicated by CUM should be passed
|
6123 |
|
|
+ * by reference. This predicate is queried after target independent reasons
|
6124 |
|
|
+ * for being pssed by reference, such as TREE_ADDRESSABLE(TREE).
|
6125 |
|
|
+ *
|
6126 |
|
|
+ */
|
6127 |
|
|
+// #undef TARGET_PASS_BY_REFERENCE
|
6128 |
|
|
+// #define TARGET_PASS_BY_REFERENCE zip_pass_by_reference
|
6129 |
|
|
+
|
6130 |
|
|
+/* CUMULATIVE ARGS ... A C type for declaring a variable that is used as the
|
6131 |
|
|
+ * first argument of 'FUNCTION_ARG' and other related values.
|
6132 |
|
|
+ *
|
6133 |
|
|
+ * ZipCPU---We're in trouble if an 'int' won't work, so let's just use that.
|
6134 |
|
|
+ */
|
6135 |
|
|
+#define CUMULATIVE_ARGS int
|
6136 |
|
|
+
|
6137 |
|
|
+/*
|
6138 |
|
|
+ * OVERRIDE_ABI_FORMAT
|
6139 |
|
|
+ */
|
6140 |
|
|
+
|
6141 |
|
|
+/* INIT_CUMULATIVE_ARGS ... A C statement (sans semicolon) for initializing the
|
6142 |
|
|
+ * variable CUM for the state at the beginning of the argument list.
|
6143 |
|
|
+ *
|
6144 |
|
|
+ *
|
6145 |
|
|
+ * ZipCPU---The first argument is passed in register ZIP_FIRST_ARG_REGNO, or
|
6146 |
|
|
+ * R1 (unless it has been redefined above ...)
|
6147 |
|
|
+ */
|
6148 |
|
|
+#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) (CUM = 0)
|
6149 |
|
|
+
|
6150 |
|
|
+/* INIT_CUMULATIVE_LIBCALL_ARGS
|
6151 |
|
|
+ * INIT_CUMULATIVE_INCOMING_ARGS
|
6152 |
|
|
+ *
|
6153 |
|
|
+ * These default to the last INIT_CUM_ARGS value above.
|
6154 |
|
|
+ */
|
6155 |
|
|
+
|
6156 |
|
|
+/* TARGET_FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) .. This hook updates
|
6157 |
|
|
+ * the summarizer variable pointed to by CUM to advance past an argument in
|
6158 |
|
|
+ * the argument list. The values MODE, TYPE, and NAMED describe that
|
6159 |
|
|
+ * argument. Once this is done, the variable CUM is suitable for analyzing the
|
6160 |
|
|
+ * following argument with TARGET_FUNCTION_ARG, etc. This hook need not do
|
6161 |
|
|
+ * anything if the argument in question was passed on the stack. The compiler
|
6162 |
|
|
+ * knows how to track the amount of stack space used for arguments without
|
6163 |
|
|
+ * any special help.
|
6164 |
|
|
+ *
|
6165 |
|
|
+ * ZipCPU---Here we simply copy from ECO32.
|
6166 |
|
|
+ */
|
6167 |
|
|
+#define TARGET_FUNCTION_ARG_ADVANCE zip_function_arg_advance
|
6168 |
|
|
+
|
6169 |
|
|
+/*
|
6170 |
171 |
dgisselq |
+ * TARGET_ARG_OFFSET(MODE, TYPE) ... If defined, a C expression that is the
|
6171 |
|
|
+ * number of bytes to add to the offset of the argument passed in memory.
|
6172 |
|
|
+ * This is needed for the SPU, which passes char and short arguments in the
|
6173 |
|
|
+ * preferred slot that is in the middle of the quad word instead of starting
|
6174 |
|
|
+ * at the top.
|
6175 |
|
|
+ *
|
6176 |
|
|
+ * ZipCPU -- sounds like the default would be (more) appropriate.
|
6177 |
|
|
+ */
|
6178 |
|
|
+/*
|
6179 |
102 |
dgisselq |
+ * FUNCTION_ARG_PADDING --- not necessary, since we shouldn't be padding
|
6180 |
|
|
+ * PAD_VARARGS_DOWN --- not necessary, since we shouldn't be padding
|
6181 |
|
|
+ * BLOCK_REG_PADDING
|
6182 |
|
|
+ * TARGET_FUNCTION_ARG_BOUNDARY
|
6183 |
|
|
+ * TARGET_FUNCTION_ARG_ROUND_BOUNDARY
|
6184 |
|
|
+ */
|
6185 |
|
|
+
|
6186 |
|
|
+/* FUNCTION_ARG_REGNO_P(REGNO) ... A C expression that is nonzero if REGNO is
|
6187 |
|
|
+ * the number of a hard register in which function arguments are sometimes
|
6188 |
|
|
+ * passed. This does not include implicit arguments such as the static chain
|
6189 |
|
|
+ * and the structure-value address. On many machines, no registers can be used
|
6190 |
|
|
+ * for this purpose since all function arguments are pushed on the stack.
|
6191 |
|
|
+ */
|
6192 |
|
|
+#define FUNCTION_ARG_REGNO_P(r) ((r >= ZIP_FIRST_ARG_REGNO)&&(r<=ZIP_LAST_ARG_REGNO))
|
6193 |
|
|
+
|
6194 |
|
|
+/* TARGET_SPLIT_COMPLEX_ARG(TYPE) ... This hook should return true if parameter
|
6195 |
|
|
+ * of type TYPE are passed as two scalar parameters. By default, GCC will
|
6196 |
|
|
+ * attempt to pack complex arguments into the target's word size. Some ABI's
|
6197 |
|
|
+ * require complex arguments to be split and treated as their individual
|
6198 |
|
|
+ * components.
|
6199 |
|
|
+ *
|
6200 |
|
|
+ * The default value of this hook is NULL, which is treated as always false,
|
6201 |
|
|
+ * and which should be good enough for ZipCPU--which can go either way.
|
6202 |
|
|
+ */
|
6203 |
|
|
+
|
6204 |
|
|
+/* TARGET_BUILD_BUILTIN_VA_LIST ... This hook returns a type node for va_list
|
6205 |
|
|
+ * for the target. The default version of the hook returns void*.
|
6206 |
|
|
+ *
|
6207 |
|
|
+ */
|
6208 |
|
|
+
|
6209 |
|
|
+/* TARGET_ENUM_VA_LIST_P
|
6210 |
|
|
+ */
|
6211 |
|
|
+
|
6212 |
|
|
+/* TARGET_FN_ABI_VA_LIST ... This hook returns the va_list type of the calling
|
6213 |
|
|
+ * convention specified by FN. The default version of this returns va_list_type_node.
|
6214 |
|
|
+ */
|
6215 |
|
|
+
|
6216 |
|
|
+/* TARGET_FN_ABI_VA_LIST
|
6217 |
|
|
+ */
|
6218 |
|
|
+
|
6219 |
|
|
+/* TARGET_CANONICAL_VA_LIST_TYPE
|
6220 |
|
|
+ */
|
6221 |
|
|
+
|
6222 |
|
|
+/* TARGET_GIMPLIFY_VA_ARG_EXPR
|
6223 |
|
|
+ */
|
6224 |
|
|
+
|
6225 |
|
|
+/* TARGET_VALID_POINTER_MODE(MODE) ... Define this to return nonzero if the
|
6226 |
|
|
+ * port can handle pointers with machine mode MODE. The default version of this
|
6227 |
|
|
+ * hook returns true for both ptr_mode and Pmode.
|
6228 |
|
|
+ *
|
6229 |
|
|
+ * ZipCPU---if Pmode is properly defined (above, and I think it is), then the
|
6230 |
|
|
+ * default behavior is quite appropriate.
|
6231 |
|
|
+ */
|
6232 |
|
|
+
|
6233 |
|
|
+/* TARGET_REF_MAY_ALIAS_ERRNO(REFP) ... Define this to return nonzero if the
|
6234 |
|
|
+ * memory reference REF may alias with the system C library errno location.
|
6235 |
|
|
+ * The default version of this hook assumes the system C library errno location
|
6236 |
|
|
+ * is either a declaration of type int or accessed by dereferencing a pointer
|
6237 |
|
|
+ * to int.
|
6238 |
|
|
+ *
|
6239 |
|
|
+ * ZipCPU --- Default sounds good to me.
|
6240 |
|
|
+ */
|
6241 |
|
|
+
|
6242 |
|
|
+
|
6243 |
|
|
+/* TARGET_SCALAR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if
|
6244 |
202 |
dgisselq |
+ * the port is prepared to handle instructions involving scalar mode MODE. For
|
6245 |
102 |
dgisselq |
+ * a scalar mode to be considered supported, all the basic arithmetic and
|
6246 |
|
|
+ * comparisons must work.
|
6247 |
|
|
+ *
|
6248 |
|
|
+ * The default version of this hook returns true for any mode required to
|
6249 |
|
|
+ * handle the basic C types (as defined by the port). Included here are the
|
6250 |
|
|
+ * double-word arithmetic supported by the code in optabs.c.
|
6251 |
202 |
dgisselq |
+ *
|
6252 |
|
|
+ * ZipCPU --- This controls whether a data type of the given mode can even be
|
6253 |
|
|
+ * declared in C/C++. Without support for such a mode, you can't even declare
|
6254 |
|
|
+ * a data type of this type. Hence, we should support SFmode and DFmode, even
|
6255 |
|
|
+ * though the hardware *may* support SFmode, and it will *never* support DFmode.
|
6256 |
102 |
dgisselq |
+ */
|
6257 |
|
|
+#undef TARGET_SCALAR_MODE_SUPPORTED_P
|
6258 |
|
|
+#define TARGET_SCALAR_MODE_SUPPORTED_P zip_scalar_mode_supported_p
|
6259 |
|
|
+
|
6260 |
|
|
+/* TARGET_VECTOR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if the
|
6261 |
|
|
+ * port is prepared to handle instructions involving vector mode MODE. At the
|
6262 |
|
|
+ * very least, it must have move patterns for this mode.
|
6263 |
|
|
+ *
|
6264 |
|
|
+ * ZipCPU---does not support any vector modes.
|
6265 |
|
|
+ */
|
6266 |
|
|
+#undef TARGET_VECTOR_MODE_SUPPORTED_P
|
6267 |
|
|
+#define TARGET_VECTOR_MODE_SUPPORTED_P hook_bool_mode_false
|
6268 |
|
|
+
|
6269 |
|
|
+/* TARGET_ARRAY_MODE_SUPPORTED_P(MODE, NELEMS) ... Return true if GCC should
|
6270 |
|
|
+ * try to use a scalar mode to store an array of NELEMS elements, given that
|
6271 |
202 |
dgisselq |
+ * each element has mode MODE. Returning true here overrides the usual
|
6272 |
|
|
+ * MAX_FIXED_MODE limit and allows GCC to use any defined integer mode.
|
6273 |
102 |
dgisselq |
+ *
|
6274 |
|
|
+ * ZipCPU---Sounds good.
|
6275 |
|
|
+ */
|
6276 |
|
|
+// #undef TARGET_ARRAY_MODE_SUPPORTED_P
|
6277 |
|
|
+// #define TARGET_ARRAY_MODE_SUPPORTED_P zip_array_mode_supported_p
|
6278 |
|
|
+
|
6279 |
|
|
+/* TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P(MODE) ... Define this to return
|
6280 |
|
|
+ * nonzero if libgcc provides support for the floating-point mode MODE, which is
|
6281 |
|
|
+ * known to pass TARGET_SCALAR_MODE_SUPPORTED_P. The default version of this
|
6282 |
|
|
+ * hook returns true for all of SFmode, DFmode, XFmode, and TFmode, if such
|
6283 |
|
|
+ * modes exist.
|
6284 |
|
|
+ *
|
6285 |
|
|
+ * ZipCPU---We only support SFmode and DFmode, but for now only in emulation
|
6286 |
|
|
+ * (if we can). Let's allow both of those and see how far we get.
|
6287 |
|
|
+ */
|
6288 |
|
|
+#undef TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P
|
6289 |
|
|
+#define TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P zip_libgcc_floating_mode_supported_p
|
6290 |
|
|
+
|
6291 |
|
|
+/* TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P(MODE) ... Define this to return
|
6292 |
|
|
+ * nonzero for machine modes for which the port has small register classes. If
|
6293 |
|
|
+ * target hook returns nonzero for a given MODE, the compiler will try to
|
6294 |
|
|
+ * minimize the lifetime of registers in MODE. The hook may be called with
|
6295 |
|
|
+ * VOIDmode as an argument. In this case, the hook is expected to return
|
6296 |
|
|
+ * nonzero if it returns nonzero for any mode.
|
6297 |
|
|
+ *
|
6298 |
|
|
+ * The default version of this hook returns false for any mode.
|
6299 |
|
|
+ *
|
6300 |
|
|
+ * ZipCPU---Default sounds good.
|
6301 |
|
|
+ */
|
6302 |
|
|
+
|
6303 |
|
|
+/* 17.09.08 How scalar function values are returned */
|
6304 |
|
|
+
|
6305 |
|
|
+/* TARGET_FUNCTION_VALUE
|
6306 |
|
|
+ */
|
6307 |
|
|
+
|
6308 |
|
|
+/* LIBCALL_VALUE
|
6309 |
|
|
+ */
|
6310 |
|
|
+
|
6311 |
|
|
+
|
6312 |
|
|
+/* 17.09.09 How large values are returned */
|
6313 |
|
|
+
|
6314 |
|
|
+/* TARGET_RETURN_IN_MEMORY(TYP,FNTYP) ... This target hook should return a
|
6315 |
|
|
+ * nonzero value to say to return the function value in memory, just as large
|
6316 |
|
|
+ * structures are always returned. Here type will be the data type of the value
|
6317 |
|
|
+ * and FNTYP will be the type of the function doing the returning, or NULL
|
6318 |
|
|
+ * for libcalls.
|
6319 |
|
|
+ *
|
6320 |
|
|
+ */
|
6321 |
|
|
+#undef TARGET_RETURN_IN_MEMORY
|
6322 |
|
|
+#define TARGET_RETURN_IN_MEMORY zip_return_in_memory
|
6323 |
|
|
+
|
6324 |
|
|
+/* DEFAULT_PCC_STRUCT_RETURN
|
6325 |
|
|
+ * TARGET_STRUCT_VALUE_RTX
|
6326 |
|
|
+ * PCC_STATIC_STRUCT_RETURN
|
6327 |
|
|
+ * TARGET_GET_RAW_RESULT_MODE
|
6328 |
|
|
+ * TARGET_GET_RAW_ARG_MODE
|
6329 |
|
|
+ */
|
6330 |
|
|
+
|
6331 |
|
|
+
|
6332 |
|
|
+/* 17.09.10 Caller-Saves Register Allocation */
|
6333 |
|
|
+/* 17.09.11 Function Entry and Exit */
|
6334 |
111 |
dgisselq |
+// TARGET_ASM_FUNCTION_PROLOGUE
|
6335 |
|
|
+// TARGET_ASM_FUNCTION_END_PROLOGUE
|
6336 |
|
|
+// TARGET_ASM_FUNCCTION_BEGIN_EPILOGUE
|
6337 |
|
|
+// TARGET_ASM_FUNCTION_EPILOGUE
|
6338 |
|
|
+/* EXIT_IGNORE_STACK ... Define this macro as a C expression that is nonzero
|
6339 |
|
|
+ * if the return instruction or the function epilogue ignores the value of the
|
6340 |
|
|
+ * stack pointer; in other words, if it is safe to delete an instruction to
|
6341 |
|
|
+ * adjust the stack pointer before a return from the function.
|
6342 |
|
|
+ *
|
6343 |
|
|
+ * The default is 0.
|
6344 |
|
|
+ *
|
6345 |
|
|
+ * Note that this macro's value is relevant only for functions for which frame
|
6346 |
|
|
+ * pointers are maintained. It is never safe to delete a final stack adjustment
|
6347 |
|
|
+ * in a function that has no frame pointer, and the compiler knows this
|
6348 |
|
|
+ * regardless of EXIT_IGNORE_STACK.
|
6349 |
|
|
+ *
|
6350 |
|
|
+ * ZipCPU -- Thanks to the example of the m68k, and a careful selection of what
|
6351 |
|
|
+ * our options otherwise could have been, our epilogue code does not use the
|
6352 |
|
|
+ * stack register at all, but rather starts by moving the frame register into
|
6353 |
|
|
+ * the stack register.
|
6354 |
|
|
+ */
|
6355 |
|
|
+#define EXIT_IGNORE_STACK 1
|
6356 |
|
|
+// EPILOGUE_USES(regno)
|
6357 |
|
|
+// EH_USES(regno)
|
6358 |
|
|
+// TARGET_ASM_OUTPUT_MI_THUNK
|
6359 |
|
|
+// TARGET_ASM_CAN_OUTPUT_MI_THUNK
|
6360 |
|
|
+
|
6361 |
102 |
dgisselq |
+/* 17.09.12 Generating code for profiling */
|
6362 |
111 |
dgisselq |
+// FUNCTION_PROFILER
|
6363 |
|
|
+// PROFILE_HOOK
|
6364 |
|
|
+// NO_PROFILE_COUNTERS
|
6365 |
|
|
+// PROFILE_BEFORE_PROLOGUE
|
6366 |
|
|
+// TARGET_KEEP_LEAF_WHEN_PROFILED
|
6367 |
|
|
+
|
6368 |
102 |
dgisselq |
+/* 17.09.13 Permitting tail calls*/
|
6369 |
111 |
dgisselq |
+
|
6370 |
|
|
+/* TARGET_FUNCTION_OK_FOR_SIBCALL(DECL,EXP) ... True if it is OK to do sibling
|
6371 |
|
|
+ * call optimizations for the specified call expression EXP. DECL will be the
|
6372 |
|
|
+ * called function, or NULL if this is an indirect call.
|
6373 |
|
|
+ *
|
6374 |
|
|
+ * It is not uncommon for limitations of calling conventions to prevent tail
|
6375 |
|
|
+ * calls to functions outside the current unit of translation, or during PIC
|
6376 |
|
|
+ * compilation. The hook is used to enforce these restrictions, as the sibcall
|
6377 |
|
|
+ * md pattern can not fail, or fall over to a 'normal' call. The criteria for
|
6378 |
|
|
+ * successful sibling call optimization may vary greatly between different
|
6379 |
|
|
+ * architectures.
|
6380 |
|
|
+ *
|
6381 |
191 |
dgisselq |
+ * What's a sibling call? "Sibling calls or tail calls terminate the function
|
6382 |
|
|
+ * in a nonn-standard way and thus an edge to the exit must be present.
|
6383 |
|
|
+ * EDGE_SIBCALL and EDGE_ABNORMAL are set in such case(s). These edges only
|
6384 |
|
|
+ * exist in the RTL representation.
|
6385 |
|
|
+ *
|
6386 |
|
|
+ * So, basically, a sibling call is a function call at the end of one function.
|
6387 |
|
|
+ * Rather than setting up a new stack frame, return address, etc, it is
|
6388 |
|
|
+ * possible to just jump to this new function, leaving the return address for
|
6389 |
|
|
+ * the prior function as the (now) return address for this one.
|
6390 |
|
|
+ *
|
6391 |
|
|
+ * ZipCPU --- These are good things. We wish to support them. We will require,
|
6392 |
|
|
+ * though, that the sibling require no more stack space than the original.
|
6393 |
|
|
+ * We might go even stricter, requiring that the sibling require no stack space
|
6394 |
|
|
+ * at all--and only register variables.
|
6395 |
111 |
dgisselq |
+ */
|
6396 |
191 |
dgisselq |
+#define TARGET_FUNCTION_OK_FOR_SIBCALL zip_function_ok_for_sibcall
|
6397 |
111 |
dgisselq |
+
|
6398 |
191 |
dgisselq |
+/* TARGET_EXTRA_LIVE_ON_ENTRY(REGS) ... Add any hard registers to regs that are
|
6399 |
|
|
+ * live on entry to the function. This hook only needs to be defined to provide
|
6400 |
|
|
+ * registers that cannot be found by examination of FUNTION_ARG_REGNO_P, the
|
6401 |
|
|
+ * ... and the ...
|
6402 |
|
|
+ *
|
6403 |
|
|
+ * ZipCPU -- the default should be good enough for us.
|
6404 |
|
|
+ */
|
6405 |
|
|
+/* TARGET_SET_UP_BY_PROLOGUE(CONTAINER) ... This hook should add additional
|
6406 |
|
|
+ * registers that are computed by the prologue to the hard register set for
|
6407 |
|
|
+ * shrink-wrapping optimization purposes.
|
6408 |
|
|
+ *
|
6409 |
|
|
+ * ??
|
6410 |
|
|
+ */
|
6411 |
111 |
dgisselq |
+
|
6412 |
191 |
dgisselq |
+/* TARGET_WARN_FUNC_RETURN(TREE) ... True if a function's return statements
|
6413 |
|
|
+ * should be checked for matching the function's return type. This includes
|
6414 |
|
|
+ * checking for falling off the end of a non-void function. Return false if
|
6415 |
|
|
+ * no such check should be made.
|
6416 |
|
|
+ *
|
6417 |
|
|
+ * ZipCPU--the default should be good enough for us.
|
6418 |
|
|
+ */
|
6419 |
|
|
+
|
6420 |
102 |
dgisselq |
+/* 17.09.14 Stack smashing protection */
|
6421 |
111 |
dgisselq |
+// TARGET_STACK_PROTECT_GUARD
|
6422 |
|
|
+// TARGET_STACK_PROTECT_FAIL
|
6423 |
|
|
+// TARGET_SUPPORTS_SPLIT_STACK
|
6424 |
|
|
+
|
6425 |
102 |
dgisselq |
+/* 17.09.15 Miscellaneous register hooks */
|
6426 |
|
|
+
|
6427 |
111 |
dgisselq |
+// TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
|
6428 |
|
|
+
|
6429 |
102 |
dgisselq |
+/* TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
|
6430 |
|
|
+ * ZipCPU --- default is good enough for us.
|
6431 |
|
|
+ */
|
6432 |
|
|
+
|
6433 |
|
|
+/* 17.10 Implementing VARARGS MACROS */
|
6434 |
|
|
+
|
6435 |
|
|
+/* ...
|
6436 |
|
|
+ */
|
6437 |
|
|
+
|
6438 |
|
|
+/* void TARGET_SETUP_INCOMING_VARARGS(A,M,T,I,S) ... This target hook offers an
|
6439 |
|
|
+ * alternative to using __builtin_saveregs and defining the hook TARGET_EXPAND..
|
6440 |
|
|
+ * _BUILTIN_SAVEREGS. Use it to store the anonymous register arguments into the
|
6441 |
|
|
+ * stack so that all the arguments appear to have been passed consecutively
|
6442 |
|
|
+ * on the stack. Once this is done, you can use the standard implementation
|
6443 |
|
|
+ * of varargs that works for machines that pass all their arguments on the
|
6444 |
|
|
+ * stack.
|
6445 |
|
|
+ */
|
6446 |
|
|
+// #undef TARGET_SETUP_INCOMING_VARARGS
|
6447 |
|
|
+// #define TARGET_SETUP_INCOMING_VARARGS zip_setup_incoming_varargs
|
6448 |
|
|
+
|
6449 |
|
|
+/* ...
|
6450 |
|
|
+ */
|
6451 |
|
|
+
|
6452 |
|
|
+/* 17.11 Trampolines for Nested Functions */
|
6453 |
|
|
+
|
6454 |
|
|
+/* TARGET_ASM_TRAMPOLINE_TEMPLATE ... This hook is called by
|
6455 |
|
|
+ * assemble_trampoline_template to output, on the stream f, assembler code for
|
6456 |
|
|
+ * a block of data that contains the constant parts of a trampoline. This code
|
6457 |
|
|
+ * should not include a label--the label is taken care of automatically.
|
6458 |
|
|
+ *
|
6459 |
|
|
+ * ZipCPU -- looks like we need to do this.
|
6460 |
|
|
+ */
|
6461 |
|
|
+#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
|
6462 |
|
|
+#define TARGET_ASM_TRAMPOLINE_TEMPLATE zip_asm_trampoline_template
|
6463 |
|
|
+
|
6464 |
|
|
+/* TRAMPOLINE_SECTION ... Return the section into which the trampoline template
|
6465 |
|
|
+ * is to be placed. The default value is readonly_data_section.
|
6466 |
|
|
+ *
|
6467 |
|
|
+ * ZipCPU--default should be good enough.
|
6468 |
|
|
+ */
|
6469 |
|
|
+
|
6470 |
|
|
+/* TRAMPOLINE_SIZE ... A C expression for the size (in bytes) of the trampoline
|
6471 |
|
|
+ * as an integer.
|
6472 |
|
|
+ *
|
6473 |
202 |
dgisselq |
+ * ZipCPU--it's three instructions, or 96 bits: BREV, LDILO, and JMP
|
6474 |
102 |
dgisselq |
+ *
|
6475 |
|
|
+ */
|
6476 |
|
|
+// #warning "May need to redefine trampoline_size in words, not bytes"
|
6477 |
|
|
+#undef TRAMPOLINE_SIZE
|
6478 |
202 |
dgisselq |
+#define TRAMPOLINE_SIZE 3*UNITS_PER_WORD
|
6479 |
102 |
dgisselq |
+
|
6480 |
|
|
+/* TRAMPOLINE_ALIGNMENT ... alignment required for trampolines, in bits.
|
6481 |
|
|
+ *
|
6482 |
|
|
+ * Well that's well known in ZipCPU --- 32-bits.
|
6483 |
|
|
+ */
|
6484 |
|
|
+#undef TRAMPOLINE_ALIGNMENT
|
6485 |
202 |
dgisselq |
+#define TRAMPOLINE_ALIGNMENT UNITS_PER_WORD
|
6486 |
102 |
dgisselq |
+
|
6487 |
|
|
+/* void TARGET_TRAMPOLINE_INIT(RTX,TREE,RTX CH) ... This hook is called to
|
6488 |
|
|
+ * initialize a trampoline. m_tramp is an RTX for the memory block for the
|
6489 |
|
|
+ * trampoline; TREE is the FUNCTION_DECL for the nested fucntion; CH is an
|
6490 |
|
|
+ * rtx for the static chain value that should be passed to the function when
|
6491 |
|
|
+ * it is called.
|
6492 |
|
|
+ *
|
6493 |
|
|
+ * ZipCPU ... Can we get by without this?
|
6494 |
|
|
+ */
|
6495 |
|
|
+#undef TARGET_TRAMPOLINE_INIT
|
6496 |
|
|
+#define TARGET_TRAMPOLINE_INIT zip_trampoline_init
|
6497 |
|
|
+
|
6498 |
|
|
+/* TARGET_TRAMPOLINE_ADJUST_ADDRESS(RTX) ... This hook should perform any
|
6499 |
|
|
+ * machine-specific adjustment in the address of the trampoline. Its argument
|
6500 |
|
|
+ * contains the address of the memory block that was passed to
|
6501 |
|
|
+ * TARGET_TRAMPOLINE_INIT. In case the address to be used for a function call
|
6502 |
|
|
+ * should be different from the address at which the template was stored, the
|
6503 |
|
|
+ * different address should be returned; otherwise addr should be returned
|
6504 |
|
|
+ * unchanged. If the hook is not defined, RTX (addr) will be used for function
|
6505 |
|
|
+ * calls.
|
6506 |
|
|
+ *
|
6507 |
|
|
+ * ZipCPU--works for us!
|
6508 |
|
|
+ */
|
6509 |
|
|
+
|
6510 |
|
|
+/* CLEAR_INSN_CACHE(BEG,END) ... If defined, expands to a C expression clearing
|
6511 |
|
|
+ * the instruction cache in the specified interval. The definition of this
|
6512 |
|
|
+ * macro would typically be a series of asm statements. Both BEG and END are
|
6513 |
|
|
+ * pointer expressions.
|
6514 |
|
|
+ *
|
6515 |
|
|
+ * ZipCPU --- Ouch! We have no way to do this (yet)!
|
6516 |
|
|
+ */
|
6517 |
202 |
dgisselq |
+#define CLEAR_INSN_CACHE(BEG,END) gcc_assert(0);
|
6518 |
102 |
dgisselq |
+
|
6519 |
|
|
+/* TRANSFER_FROM_TRAMPOLINE ... Define this macro is trampolines need a special
|
6520 |
111 |
dgisselq |
+ * subroutine to do their work. The macro should expand to a series of asm
|
6521 |
102 |
dgisselq |
+ * statements which will be compiled with GCC. They go in a library function
|
6522 |
|
|
+ * named __transfer_from_trampoline.
|
6523 |
|
|
+ *
|
6524 |
|
|
+ * We may need to rethink trampolines on ZipCPU.
|
6525 |
|
|
+ */
|
6526 |
|
|
+
|
6527 |
|
|
+
|
6528 |
|
|
+/* 17.12 Implicit Calls to Library Routines */
|
6529 |
|
|
+
|
6530 |
|
|
+/* DECLARE_LIBRARY_RENAMES
|
6531 |
|
|
+ *
|
6532 |
|
|
+ * ZipCPU: Don't need it.
|
6533 |
|
|
+ */
|
6534 |
|
|
+
|
6535 |
|
|
+/* TARGET_INIT_LIBFUNCS(VOID) ... This hook should declare additional library
|
6536 |
|
|
+ * routines or rename existing ones, using the functions set_optab_libfunc and
|
6537 |
|
|
+ * init_one_libfunc defined in optabs.c. init_optabs calls this macro after
|
6538 |
|
|
+ * initializing all the normal library routines.
|
6539 |
|
|
+ *
|
6540 |
|
|
+ * Most ports don't need to define this hook, so we won't either.
|
6541 |
|
|
+ */
|
6542 |
|
|
+
|
6543 |
|
|
+/* TARGET_LIBFUNC_GNU_PREFIX ... If false (the default), internal library
|
6544 |
|
|
+ * routines start with two underscores. If set to true, these routines start
|
6545 |
|
|
+ * with __gnu_ instead.
|
6546 |
|
|
+ *
|
6547 |
|
|
+ * ZipCPU: No change necessary.
|
6548 |
|
|
+ */
|
6549 |
|
|
+
|
6550 |
|
|
+/* FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE,COMPARISON) ... This macro should return
|
6551 |
|
|
+ * true if the library routine that implements the floating point comparison
|
6552 |
|
|
+ * operator comparison in mode mode will return a boolean and false if it will
|
6553 |
|
|
+ * return a tristate.
|
6554 |
|
|
+ *
|
6555 |
|
|
+ * Most ports don't need to define this macro, so Zip CPU won't either.
|
6556 |
|
|
+ */
|
6557 |
|
|
+
|
6558 |
|
|
+/* TARGET_HAS_NO_HW_DIVIDE ... This macro should be defined if the target has no
|
6559 |
|
|
+ * hardware divide instructions. If this macro is defined, GCC will use an
|
6560 |
|
|
+ * algorithm which makes use of simple logical and arithmetic operations for
|
6561 |
|
|
+ * 64-bit division. If the macro is not defined, GCC will use an algorithm
|
6562 |
|
|
+ * which makes use of a 64-bit by 32-bit divide primitive.
|
6563 |
|
|
+ *
|
6564 |
|
|
+ * Zip CPU, though, doesn't have the 64-bit by 32-bit divide primitive, thus
|
6565 |
|
|
+ * we have no HW DIVIDE (for now).
|
6566 |
|
|
+ */
|
6567 |
|
|
+#define TARGET_HAS_NO_HW_DIVIDE
|
6568 |
|
|
+
|
6569 |
|
|
+/* TARGET_EDOM ... The value of EDOM on the target machine, as a C integer
|
6570 |
|
|
+ * expression. If you don't define this macro, GCC does not attempt to deposit
|
6571 |
|
|
+ * the value of EDOM into errno directly. Look in /usr/include/errno.h to find
|
6572 |
|
|
+ * the value of EDOM on your system.
|
6573 |
|
|
+ *
|
6574 |
|
|
+ * EDOM is the error created when a math argument is out of the domain of the
|
6575 |
|
|
+ * function.
|
6576 |
|
|
+ *
|
6577 |
|
|
+ * ZipCPU: Don't need it---I don't think.
|
6578 |
|
|
+ */
|
6579 |
|
|
+
|
6580 |
|
|
+/* GEN_ERRNO_RTX ... Define this macro as a C exrpession to create an rtl
|
6581 |
|
|
+ * expression that refers to the global "variable" errno. (On certain
|
6582 |
|
|
+ * systems, errno may not actually be a variable.) If you don't define this
|
6583 |
|
|
+ * macro, a reasonable default is used.
|
6584 |
|
|
+ *
|
6585 |
|
|
+ * ZipCPU --- if a reasonable default is used, we'll use that--especially since
|
6586 |
|
|
+ * I doubt we'll be using errno for a while.
|
6587 |
|
|
+ */
|
6588 |
|
|
+
|
6589 |
|
|
+/* NEXT_OBJC_RUNTIME ... Set this macro to 1 to use the "NeXT" Objective-C
|
6590 |
|
|
+ * message sending conventions by default. This calling convention involves
|
6591 |
|
|
+ * passing the object, the selector and the method arguments all at once to the
|
6592 |
|
|
+ * method-lookup library function. This is the usual setting when targetting
|
6593 |
|
|
+ * Darwin/Mac OS X systems, which have the NeXT runtime installed.
|
6594 |
|
|
+ *
|
6595 |
|
|
+ * If the macro is set to 0, ...
|
6596 |
|
|
+ *
|
6597 |
|
|
+ * Doesn't look relevant (yet) for the Zip CPU--especially since we don't have
|
6598 |
|
|
+ * an O/S yet.
|
6599 |
|
|
+ */
|
6600 |
|
|
+
|
6601 |
|
|
+
|
6602 |
|
|
+
|
6603 |
|
|
+/* 17.13 Addressing Modes */
|
6604 |
|
|
+
|
6605 |
|
|
+/* C expressions that are nonzero if the machine supports pre-increment,
|
6606 |
|
|
+ * pre-decrement, post-increment, or post-decrement addressing respectively.
|
6607 |
|
|
+ */
|
6608 |
|
|
+#define HAVE_PRE_INCREMENT (0)
|
6609 |
|
|
+#define HAVE_PRE_DECREMENT (0)
|
6610 |
|
|
+#define HAVE_POST_INCREMENT (0)
|
6611 |
|
|
+#define HAVE_POST_DECREMENT (0)
|
6612 |
|
|
+
|
6613 |
|
|
+/* C expression that is nonzero if the machine supports pre- or post- address
|
6614 |
|
|
+ * side-effect generation involving constants other than the size of the memory
|
6615 |
|
|
+ * operand.
|
6616 |
|
|
+ */
|
6617 |
|
|
+#define HAVE_PRE_MODIFY_DISP (0)
|
6618 |
|
|
+#define HAVE_POST_MODIFY_DISP (0)
|
6619 |
|
|
+
|
6620 |
|
|
+/* C expression that is non-zero if the machine supports pre- or post-address
|
6621 |
|
|
+ * side-effect generation involving a register displacement.
|
6622 |
|
|
+ */
|
6623 |
|
|
+#define HAVE_PRE_MODIFY_REG (0)
|
6624 |
|
|
+#define HAVE_POST_MODIFY_REG (0)
|
6625 |
|
|
+
|
6626 |
|
|
+/* CONSTANT_ADDRESS_P(X) ... A C expression that is 1 if the RTX X is a constant
|
6627 |
|
|
+ * which is a valid address. On most machines the default definition ... is
|
6628 |
|
|
+ * acceptable, but a few machines are more restrictive as to which constant
|
6629 |
|
|
+ * addresses are supported.
|
6630 |
|
|
+ *
|
6631 |
|
|
+ * Zip CPU is designed for offset addresses, not constant addresses. Although
|
6632 |
|
|
+ * the CPU will support 18-bit signed constant addresses, the assembler and
|
6633 |
|
|
+ * general programming model do not. Further, without knowing where the final
|
6634 |
|
|
+ * address will be located, this is an unusable model. Therefore we will
|
6635 |
|
|
+ * define this as not supported.
|
6636 |
|
|
+ *
|
6637 |
|
|
+ * In hindsight, this isn't true--labels and symbols are valid addresses, and
|
6638 |
|
|
+ * they are also constant addresses. Hence, we leave this at its default.
|
6639 |
|
|
+ */
|
6640 |
|
|
+// #undef CONSTANT_ADDRESS_P
|
6641 |
|
|
+// #define CONSTANT_ADDRESS_P(X) (0)
|
6642 |
|
|
+
|
6643 |
111 |
dgisselq |
+/* CONSTANT_P(X) ... CONSTANT_P, which is defined by target-independent code,
|
6644 |
|
|
+ * accepts integer values expressions whose values are not explicitly known,
|
6645 |
|
|
+ * such as symbol_ref, label_ref, and high expressions and const arithmetic
|
6646 |
|
|
+ * expressions, in addition to const_int and const_double expressions.
|
6647 |
102 |
dgisselq |
+ *
|
6648 |
|
|
+ * Huh???
|
6649 |
|
|
+ */
|
6650 |
|
|
+// #define CONSTANT_P(X) ???
|
6651 |
|
|
+
|
6652 |
111 |
dgisselq |
+/* MAX_REGS_PER_ADDRESS ... A number, the maximum number of registers that can
|
6653 |
|
|
+ * appear in a valid memory address. Note that it is up to you to specify a
|
6654 |
|
|
+ * value equal to the maximum number that TARGET_LEGITIMATE_ADDRESS_P would
|
6655 |
|
|
+ * ever accept.
|
6656 |
102 |
dgisselq |
+ */
|
6657 |
|
|
+#define MAX_REGS_PER_ADDRESS 1
|
6658 |
|
|
+
|
6659 |
|
|
+/* TARGET_LEGITIMATE_ADDRESS_P(MODE,RTX,STRICT) ... A function that returns
|
6660 |
|
|
+ * whether RTX is a legitimate memory address on the target machine for a
|
6661 |
|
|
+ * memory operation of mode MODE.
|
6662 |
|
|
+ */
|
6663 |
|
|
+#undef TARGET_LEGITIMATE_ADDRESS_P
|
6664 |
|
|
+#define TARGET_LEGITIMATE_ADDRESS_P zip_legitimate_address_p
|
6665 |
|
|
+
|
6666 |
|
|
+/* TARGET_MEM_CONSTRAINT ... A single character to be used instead of the
|
6667 |
|
|
+ * default 'm' character for general memory addresses. This defines the
|
6668 |
|
|
+ * constraint letter which matches the memory addresses accepted by
|
6669 |
|
|
+ * TARGET_LEGITIMATE_ADDRESS_P. Define this macro if you want to support new
|
6670 |
|
|
+ * address format in your back end without changing the semantics of the 'm'
|
6671 |
|
|
+ * constraint. This is necessary in order to preserve functionality of inline
|
6672 |
|
|
+ * assembly constructs using the 'm' constraint.
|
6673 |
|
|
+ *
|
6674 |
|
|
+ * ZipCPU--doesn't look like we need to define this at all.
|
6675 |
|
|
+ */
|
6676 |
|
|
+
|
6677 |
|
|
+/* FIND_BASE_TERM(X) ... A C expression to determine the base term of address
|
6678 |
|
|
+ * X or to provide a simplified version of X from which alias.c can easily find
|
6679 |
|
|
+ * the base term. This macro is used in only two places: find_base_value and
|
6680 |
|
|
+ * find_base_term in alias.c.
|
6681 |
|
|
+ *
|
6682 |
|
|
+ * It is always safe for this macro to not be defined. It exists so that
|
6683 |
|
|
+ * alias analysis can understand machine-dependent addresses.
|
6684 |
|
|
+ *
|
6685 |
|
|
+ * ZipCPU: We'll skip this then.
|
6686 |
|
|
+ */
|
6687 |
|
|
+
|
6688 |
|
|
+/* TARGET_LEGITIMIZE_ADDRESS(RTX,OLD,MODE) ... This hook is given an invalid
|
6689 |
|
|
+ * memory address RTX for an operand of mode MODE and should try to return a
|
6690 |
|
|
+ * valid memory address. RTX will always be the result of a call to
|
6691 |
|
|
+ * break_out_memory_refs, and OLD will be the operand that was given to that
|
6692 |
|
|
+ * function to produce RTX.
|
6693 |
|
|
+ *
|
6694 |
111 |
dgisselq |
+ * ZipCPU --
|
6695 |
102 |
dgisselq |
+ */
|
6696 |
111 |
dgisselq |
+#undef TARGET_LEGITIMIZE_ADDRESS
|
6697 |
|
|
+#define TARGET_LEGITIMIZE_ADDRESS zip_legitimize_address
|
6698 |
102 |
dgisselq |
+
|
6699 |
|
|
+/* LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OP,TYPE,IND,WIN) ... A C compound statement
|
6700 |
|
|
+ * that attempts to replace X, which is an address that needs reloading, with
|
6701 |
|
|
+ * a valid memory address for an operand of mode MODE. WIN will be a C
|
6702 |
|
|
+ * statement label elsewhere in the code. It is not necessary to define this
|
6703 |
|
|
+ * macro, but it might be useful for performance reasons.
|
6704 |
|
|
+ *
|
6705 |
|
|
+ * ZipCPU: This is worth coming back to, according to the notes page, but it
|
6706 |
|
|
+ * may also be a difficult macro to use. Look at other implementations before
|
6707 |
|
|
+ * we dive into this.
|
6708 |
|
|
+ */
|
6709 |
|
|
+// #undef LEGITIMIZE_RELOAD_ADDRESS
|
6710 |
|
|
+// #define LEGITIMIZE_RELOAD_ADDRESS
|
6711 |
|
|
+
|
6712 |
|
|
+/* TARGET_MODE_DEPENDENT_ADDRESS_P(ADDR,SPACE) ... This hook returns true
|
6713 |
|
|
+ * if memory address addr in address space addrspace can have different meanings
|
6714 |
|
|
+ * depending on the machine mode of the memory reference it is used for or if
|
6715 |
|
|
+ * the address is valid for some modes but not others.
|
6716 |
|
|
+ */
|
6717 |
|
|
+#undef TARGET_MODE_DEPENDENT_ADDRESS_P
|
6718 |
|
|
+#define TARGET_MODE_DEPENDENT_ADDRESS_P zip_mode_dependent_address_p
|
6719 |
|
|
+
|
6720 |
111 |
dgisselq |
+/* TARGET_LEGITIMATE_CONSTANT_P(MODE,RTX) ... This hook returns true if x is a
|
6721 |
|
|
+ * legitimate constant for a MODE-mode immediate operand on the target machine.
|
6722 |
|
|
+ * You can assume the RTX satisfies CONSTANT_P, so you need not check this.
|
6723 |
|
|
+ *
|
6724 |
|
|
+ * The default definition returns true.
|
6725 |
102 |
dgisselq |
+ */
|
6726 |
|
|
+
|
6727 |
|
|
+/* TARGET_DELIGITIMIZE_ADDRESS(RTX)
|
6728 |
|
|
+ */
|
6729 |
|
|
+
|
6730 |
|
|
+/* TARGET_CONST_NOT_OK_FOR_DEBUG_P(RTX) ... This hook should return true if RTX
|
6731 |
|
|
+ * should not be emitted into debug sections.
|
6732 |
|
|
+ */
|
6733 |
|
|
+
|
6734 |
|
|
+/* TARGET_CANNOT_FORCE_CONST_MEM(MODE,RTX) ... This hook should return true if
|
6735 |
|
|
+ * RTX is a form that cannot (or should not) be spilled to the constant pool.
|
6736 |
|
|
+ * MODE is the mode of X. The default version returns false.
|
6737 |
|
|
+ */
|
6738 |
111 |
dgisselq |
+// #define TARGET_CANNOT_FORCE_CONST_MEM hook_bool_mode_rtx_false
|
6739 |
102 |
dgisselq |
+
|
6740 |
|
|
+/* TARGET_USE_BLOCKS_FOR_CONSTANT_P(MODE,RTX) ... This hook should return true
|
6741 |
|
|
+ * if pool entries for constant RTX can be placed in an object_block structure.
|
6742 |
|
|
+ * MODE is the mode of X. The default version returns false for all constants.
|
6743 |
|
|
+ *
|
6744 |
|
|
+ *????
|
6745 |
|
|
+ */
|
6746 |
|
|
+// #warning "Huh?"
|
6747 |
|
|
+
|
6748 |
|
|
+/* TARGET_USE_BLOCKS_FOR_DECL_P(DECL) ... This hook should return true if pool
|
6749 |
|
|
+ * entries for DECL should be placed in an object_block structure. The default
|
6750 |
|
|
+ * version returns true for all DECL's.
|
6751 |
|
|
+ *
|
6752 |
|
|
+ * Sounds good.
|
6753 |
|
|
+ */
|
6754 |
|
|
+
|
6755 |
|
|
+/* TARGET_BUILTIN_RECIPROCAL(TREE) ... This hook should return the DECL of a
|
6756 |
|
|
+ * function that implements the reciprocal of the machine specific builtin
|
6757 |
|
|
+ * function fndecl, or NULL_TREE if such a function is not available.
|
6758 |
|
|
+ */
|
6759 |
|
|
+
|
6760 |
|
|
+/* TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD(VOID) ... This hook should return the
|
6761 |
|
|
+ * DECL of a function f that given an address addr as an argument returns a mask
|
6762 |
|
|
+ * m that can be used to extrract from two vectors the relevant data that
|
6763 |
|
|
+ * resides in addr in case addr is not properly aligned.
|
6764 |
|
|
+ *
|
6765 |
|
|
+ * Zip CPU does not support vectorization.
|
6766 |
|
|
+ */
|
6767 |
|
|
+
|
6768 |
|
|
+/* Other vector, SIMD, and GOACC macros skipped as Zip CPU doesn't support
|
6769 |
|
|
+ * such data accesses and manipulation.
|
6770 |
|
|
+ */
|
6771 |
|
|
+
|
6772 |
|
|
+/* 17.14 Anchored Addresses */
|
6773 |
|
|
+
|
6774 |
|
|
+/* TARGET_MIN_ANCHOR_OFFSET ... The minimum offset that should be applied to
|
6775 |
|
|
+ * a section anchor. On most targets, it should be the smallest offset that
|
6776 |
|
|
+ * can be applied to a base register while still giving a legitimate address for
|
6777 |
|
|
+ * every mode. The default value is 0.
|
6778 |
|
|
+ *
|
6779 |
202 |
dgisselq |
+ * On the Zip CPU, this is the minimum operand B offset to a LW or SW
|
6780 |
102 |
dgisselq |
+ * operation, which would be a signed 14 bit number.
|
6781 |
|
|
+ */
|
6782 |
|
|
+#undef TARGET_MIN_ANCHOR_OFFSET
|
6783 |
|
|
+#define TARGET_MIN_ANCHOR_OFFSET zip_min_anchor_offset
|
6784 |
|
|
+
|
6785 |
|
|
+/* TARGET_MAX_ANCHOR_OFFSET ... Like TARGET_MIN_ANCHOR_OFFSET, but the maximum
|
6786 |
|
|
+ * (inclusive) offset that should be applied to section anchors. The default
|
6787 |
|
|
+ * value is 0.
|
6788 |
|
|
+ */
|
6789 |
|
|
+#undef TARGET_MAX_ANCHOR_OFFSET
|
6790 |
|
|
+#define TARGET_MAX_ANCHOR_OFFSET zip_max_anchor_offset
|
6791 |
|
|
+
|
6792 |
|
|
+/* TARGET_ASM_OUTPUT_ANCHOR(RTX) ... Write the assembly code to define section
|
6793 |
|
|
+ * anchor RTX, which is a SYMBOL_REF for which 'SYMBOL_REF_ANCHOR_P(RTL) is
|
6794 |
|
|
+ * true. The hook is called with the assembly output position set to the
|
6795 |
|
|
+ * beginning of SYMBOL_REF_BLOCK(X).
|
6796 |
|
|
+ *
|
6797 |
|
|
+ * If ASM_OUTPUT_DEF is available, the hook's default definition uses it to
|
6798 |
|
|
+ * define the symbol as '. + SYMBOL_REF_BLOCK_OFFSET(RTL)'. If ASM_OUTPUT_DEF
|
6799 |
|
|
+ * is not available, the hook's default definition is NULL, which disables the
|
6800 |
|
|
+ * use of section anchors altogether.
|
6801 |
|
|
+ *
|
6802 |
202 |
dgisselq |
+ * Section anchors would be very valuable in Zip CPU assembly, therefore we
|
6803 |
|
|
+ * must define this hook. However ... no one else seems to ever define these
|
6804 |
|
|
+ * hooks, so I really dont have much of an example to work with
|
6805 |
102 |
dgisselq |
+ */
|
6806 |
202 |
dgisselq |
+// #warning "Come back to this"
|
6807 |
102 |
dgisselq |
+// #undef TARGET_ASM_OUTPUT_ANCHOR
|
6808 |
|
|
+// #define TARGET_ASM_OUTPUT_ANCHOR zip_asm_output_anchor
|
6809 |
|
|
+
|
6810 |
|
|
+/* TARGET_USE_ANCHORS_FOR_SYMBOL_P(RTX) ... Return true if GCC should attempt
|
6811 |
202 |
dgisselq |
+ * to use anchors to access SYMBOL_REF X. You can assume
|
6812 |
|
|
+ * SYMBOL_REF_HAS_BLOCK_INFO_P(X) and !SYMBOL_REF_ANCHOR_P(X).
|
6813 |
102 |
dgisselq |
+ *
|
6814 |
202 |
dgisselq |
+ * The default version is correct for most targets, but you might need to
|
6815 |
|
|
+ * intercept this hook to handle things like target specific attributes or
|
6816 |
|
|
+ * target-specific sections.
|
6817 |
102 |
dgisselq |
+ *
|
6818 |
|
|
+ * Not knowing anything more, we'll leave the default as is for the Zip CPU.
|
6819 |
|
|
+ */
|
6820 |
|
|
+// #undef TARGET_USE_ANCHORS_FOR_SYMBOL_P
|
6821 |
|
|
+// #define TARGET_USE_ANCHORS_FOR_SYMBOL_P zip_use_anchors_for_symbol_p
|
6822 |
|
|
+
|
6823 |
|
|
+/* 17.15 Condition Code Status */
|
6824 |
|
|
+
|
6825 |
|
|
+/* 17.15.1 Representation of condition codes using (cc0) --- that's us */
|
6826 |
|
|
+
|
6827 |
|
|
+/* CC_STATUS_MDEP ... C code for a data type which is used for declaring
|
6828 |
|
|
+ * the mdep component of cc_status. It defaults to int.
|
6829 |
|
|
+ *
|
6830 |
|
|
+ * ZipCPU---Int is good for us.
|
6831 |
|
|
+ */
|
6832 |
|
|
+
|
6833 |
|
|
+/* CC_STATUS_MDEP_INIT ... A C expression to initialize the mdep field to
|
6834 |
|
|
+ * "empty". The default definition does nothing, since most machines don't
|
6835 |
|
|
+ * use the field anyway. If you want to use the field, you should probably
|
6836 |
|
|
+ * define this macro to initialize it.
|
6837 |
|
|
+ */
|
6838 |
|
|
+
|
6839 |
|
|
+/* NOTICE_UPDATE_CC(EXP, INSN) ... A C compound statement to set the components
|
6840 |
|
|
+ * of cc_status appropriately for an insn insn whose body is exp. It is this
|
6841 |
|
|
+ * macro's responsibility to recognize insns that set the condition code as
|
6842 |
|
|
+ * a byproduct of other activity as well as those that explicitly set (cc0).
|
6843 |
|
|
+ *
|
6844 |
|
|
+ * ZipCPU --- We need this, as not all expressions set (cc0).
|
6845 |
|
|
+ *
|
6846 |
191 |
dgisselq |
+ * In hind sight, this is the *old* and unsupported way of doing business within
|
6847 |
|
|
+ * GCC. To switch to the new way, all instruction definitions within our .md
|
6848 |
|
|
+ * file have been adjusted to either change or clobber the CC register.
|
6849 |
|
|
+ *
|
6850 |
102 |
dgisselq |
+ */
|
6851 |
122 |
dgisselq |
+#ifdef HAVE_cc0
|
6852 |
191 |
dgisselq |
+// #define NOTICE_UPDATE_CC(EXP, INSN) zip_update_cc_notice(EXP, INSN)
|
6853 |
|
|
+#error "ZipCPU no longer has CC0"
|
6854 |
122 |
dgisselq |
+#endif
|
6855 |
102 |
dgisselq |
+
|
6856 |
|
|
+
|
6857 |
|
|
+/* 17.15.2 Representation of condition codes using registers */
|
6858 |
|
|
+/* ... which the ZipCPU doesn't have. The ZipCPU has a CC0 register, and hence
|
6859 |
|
|
+ * this section isn't supposed to apply.
|
6860 |
|
|
+ */
|
6861 |
|
|
+
|
6862 |
122 |
dgisselq |
+/* SELECT_CC_MODE(op, x, y) ... On many machines, the condition code may be
|
6863 |
|
|
+ * produced by other instructions than compares, for example the branch can use
|
6864 |
|
|
+ * directyl the condition code set by a subtract instruction. However, on some
|
6865 |
|
|
+ * machines when the condition code is set this way some bits (such as the
|
6866 |
|
|
+ * overflow bit) are not set in the same way as a test instruction, so that a
|
6867 |
|
|
+ * different branch instruction must be used for some conditional branches.
|
6868 |
|
|
+ * When this happens, use the machinemode of the condition code register to
|
6869 |
|
|
+ * record different formats of the condition code register. Modes can also be
|
6870 |
|
|
+ * used to reccord which compare instruction (e.g. a signed or an unsigned
|
6871 |
|
|
+ * comparison) produced the condition codes.
|
6872 |
|
|
+ *
|
6873 |
|
|
+ * If other modes than CCmode are required, add them to 'machine-modes.def' and
|
6874 |
|
|
+ * define SELECT_CC_MODE to choose a mode given an operand of a compare. This
|
6875 |
|
|
+ * is needed because the modes have to be chosen not only during RTL generation
|
6876 |
|
|
+ * but also, for example, by instruction combination. The result of
|
6877 |
|
|
+ * SELECT_CC_MODE should be consistent with the mode used in the patterns; ...
|
6878 |
|
|
+ *
|
6879 |
|
|
+ * ZipCPU ... We have only one CC Mode, so we'll use the CCmode defined in
|
6880 |
|
|
+ * machine-modes.def and should be fine with it. Hence, this doesn't need
|
6881 |
|
|
+ * to be defined.
|
6882 |
102 |
dgisselq |
+ */
|
6883 |
|
|
+
|
6884 |
|
|
+/* TARGET_CANONICALIZE_COMPARISON(int,rtx *, rtx *, bool) ... On some machines
|
6885 |
|
|
+ * (such as the ZipCPU) not all possible comparisons are defined, but you can
|
6886 |
|
|
+ * convert an invalid comparison into a valid one. For example, the Alpha
|
6887 |
|
|
+ * does not have a GT comparison, but you can use an LT comparison instead and
|
6888 |
|
|
+ * swap the order of the operands.
|
6889 |
|
|
+ *
|
6890 |
|
|
+ * On such machines, implement this hook to do any required conversions: code
|
6891 |
|
|
+ * is the initial comparison code and op0 and op1 are the left and right
|
6892 |
|
|
+ * operands of the comparison, respectively. If op0_preserve_value is true the
|
6893 |
|
|
+ * implementation is not allowed to change the value of op0 since the value
|
6894 |
|
|
+ * might be used in RTXs which aren't comparisons. E.g. the implementation is
|
6895 |
|
|
+ * not allowed to swap operands in that case.
|
6896 |
|
|
+ *
|
6897 |
|
|
+ * GCC will not assume that the comparison resulting from this macro is valid
|
6898 |
|
|
+ * but will see if the resulting insn matches a pattern in the 'md' file.
|
6899 |
|
|
+ *
|
6900 |
|
|
+ * You need not implement this hook if it would never change the comparison
|
6901 |
|
|
+ * code or operands.
|
6902 |
|
|
+ *
|
6903 |
|
|
+ * In the case of the ZipCPU, the ZipCPU only keeps track of 8 possible
|
6904 |
|
|
+ * comparisons, and bastardizing other comparisons into those 8 is extremely
|
6905 |
|
|
+ * painful. Therefore, we *need* this capability to make certain we can use
|
6906 |
|
|
+ * our comparisons successfully.
|
6907 |
|
|
+ *
|
6908 |
|
|
+ * The only problem is ... this hook appears to only be called on non-CC0
|
6909 |
|
|
+ * machines. Hence, defining it hasn't done anything for us.
|
6910 |
|
|
+ */
|
6911 |
122 |
dgisselq |
+#define TARGET_CANONICALIZE_COMPARISON zip_canonicalize_comparison
|
6912 |
102 |
dgisselq |
+
|
6913 |
122 |
dgisselq |
+/* REVERSIBLE_CC_MODE(MODE) ... A C expression whose value is one if it is
|
6914 |
|
|
+ * always safe to reverse a comparison whose mode is MODE. If SELECT_CC_MODE
|
6915 |
|
|
+ * can ever return MODE for a floating-point inequality comparison, than
|
6916 |
|
|
+ * REVERSIBLE_CC_MODE(MODE) must be zero.
|
6917 |
|
|
+ *
|
6918 |
|
|
+ * You need not define this macro if it would always return zero or if the
|
6919 |
|
|
+ * floating-point format is anything other than IEEE_FLOAT_FORMAT. For example,
|
6920 |
|
|
+ * here ...
|
6921 |
|
|
+ *
|
6922 |
|
|
+ * ZipCPU -- We'll always return zero, so this need not be defined.
|
6923 |
|
|
+ */
|
6924 |
|
|
+
|
6925 |
|
|
+/* REVERSE_CONDITION(CODE,MODE) ... A C expression whose value is reversed
|
6926 |
|
|
+ * condition code of thecode for comparison done in CC_MODE MODE. This macro
|
6927 |
|
|
+ * is used only in case REVERSIBLE_CC_MODE(MODE) is nonzero. ...
|
6928 |
|
|
+ *
|
6929 |
|
|
+ * ZipCPU ... Since REVERSIBLE_CC_MODE(MODE) will always be zero, we'll leave
|
6930 |
|
|
+ * this undefined.
|
6931 |
|
|
+ */
|
6932 |
|
|
+
|
6933 |
|
|
+/* bool TARGET_FIXED_CONDITION_CODE_REGS(int *, int *) ... On targets which do
|
6934 |
|
|
+ * not use (cc0), and which use a hard register rather than a pseudo-register
|
6935 |
|
|
+ * to hold condition codes, the regular CSE passes are often not able to
|
6936 |
|
|
+ * identify cases in which the hard register is set to a common value. Use this
|
6937 |
|
|
+ * hook to enable a small pass which optimizes such cases. This hook should
|
6938 |
|
|
+ * return true to enable this pass, and it should set the integers to which its
|
6939 |
|
|
+ * arguments point to the hard register numbers used for condition codes. When
|
6940 |
|
|
+ * there is only one such register, as is true on most systems, the integer
|
6941 |
|
|
+ * pointed to by p2 should be set to INVALID_REGNUM.
|
6942 |
|
|
+ *
|
6943 |
|
|
+ * The default version of this hook returns false.
|
6944 |
|
|
+ *
|
6945 |
|
|
+ * ZipCPU --- I like the idea of enabling optimizations. Let's return
|
6946 |
|
|
+ * something other than false.
|
6947 |
|
|
+ */
|
6948 |
|
|
+#define TARGET_FIXED_CONDITION_CODE_REGS zip_fixed_condition_code_regs
|
6949 |
|
|
+
|
6950 |
|
|
+/* machine_mode TARGET_CC_MODES_COMPATIBLE(M1,M2) .. On targets which use
|
6951 |
|
|
+ * multiple condition code modes in class MODE_CC, it is sometimes the case
|
6952 |
|
|
+ * that a comparison can be validly done in more than one mode. On such a
|
6953 |
|
|
+ * system, define this target hook to take two mode arguments and to return a
|
6954 |
|
|
+ * mode in which both comparisons may be validly done. If there is no such
|
6955 |
|
|
+ * mode, return VOIDmode.
|
6956 |
|
|
+ *
|
6957 |
|
|
+ * The default version of this hook checks whether the modes are the same. If
|
6958 |
|
|
+ * they are, it returns that mode. If they are different, it returns VOIDmode.
|
6959 |
|
|
+ *
|
6960 |
|
|
+ * ZipCPU--Given that we only have the one CCmode, the default definition works
|
6961 |
|
|
+ * well enough for us.
|
6962 |
|
|
+ */
|
6963 |
|
|
+
|
6964 |
|
|
+/* unsigned int TARGET_FLAGS_REGNUM ... If the target has a dedicated flags
|
6965 |
|
|
+ * register, and it needs to use the post-reload comparison elimination pass,
|
6966 |
|
|
+ * then this value should be set appropriately.
|
6967 |
|
|
+ *
|
6968 |
|
|
+ * ZipCPU---Looks like we can set this easily enough without any problems.
|
6969 |
|
|
+ */
|
6970 |
|
|
+#undef TARGET_FLAGS_REGNUM
|
6971 |
|
|
+#define TARGET_FLAGS_REGNUM zip_CC
|
6972 |
|
|
+
|
6973 |
102 |
dgisselq |
+/* 17.16 Relative costs of operations */
|
6974 |
|
|
+
|
6975 |
|
|
+
|
6976 |
|
|
+// #define REGISTER_MOVE_COST(MODE,FROM,TO) ((MODE==DImode)||(MODE==DFmode))?4:2
|
6977 |
|
|
+// #define TARGET_REGISTER_MOVE_COST
|
6978 |
|
|
+// #define MEMORY_MOVE_COST(MODE, CLASS, IN) ((MODE==DImode)||(MODE==DFmode))?8:7
|
6979 |
|
|
+/* TARGET_REGISTER_MOVE_COST(M,FRM,TO) ... This target hook should return the
|
6980 |
|
|
+ * cost of moving data of mode M from a register in class FRM to one in class
|
6981 |
|
|
+ * TO. The classes are expressed using the enumeration values such as
|
6982 |
|
|
+ * GENERAL_REGS. A value of 2 is the default; other values are interpreted
|
6983 |
|
|
+ * relative to that.
|
6984 |
|
|
+ *
|
6985 |
|
|
+ * It is not required that the cost always equal 2 when FROM is the same as TO;
|
6986 |
|
|
+ * on some machines it is expensive to move between registers if they are not
|
6987 |
|
|
+ * general registers.
|
6988 |
|
|
+ *
|
6989 |
|
|
+ * If reload sees ...
|
6990 |
|
|
+ *
|
6991 |
|
|
+ * ZipCPU ... We can leave this at its default value of 2.
|
6992 |
|
|
+ */
|
6993 |
|
|
+
|
6994 |
|
|
+/* TARGET_MEMORY_MOVE_COST(MOD,CL,IN) ... This target hook should return the
|
6995 |
|
|
+ * cost of moving data of mode MOD between a register of class CL and memory.
|
6996 |
|
|
+ * IN is false if the value is to be written to memory, true if it is to be
|
6997 |
|
|
+ * read in. This cost is relative to those in TARGET_REGISTER_MOVE_COST.
|
6998 |
|
|
+ * If moving between registers and memory is more expensive that between two
|
6999 |
|
|
+ * registers, you should add this target hook to express the relative cost.
|
7000 |
|
|
+ *
|
7001 |
|
|
+ * If you do not add this target hook, GCC uses a default cost of 4 plus the
|
7002 |
|
|
+ * cost of copying via a secondary reload register, if one is needed. If your
|
7003 |
|
|
+ * machine requires a secondary reload register to copy between memory and a
|
7004 |
|
|
+ * register of CL but the reload mechanism is more complex than copying via
|
7005 |
|
|
+ * an intermediate, use this target hook to reflect the actual cost of the
|
7006 |
|
|
+ * move.
|
7007 |
|
|
+ *
|
7008 |
|
|
+ * ZipCPU --- Memory moves are more expensive than twice the cost of register
|
7009 |
|
|
+ * moves, so let's make certain this is defined.
|
7010 |
|
|
+ */
|
7011 |
|
|
+#define TARGET_MEMORY_MOVE_COST zip_memory_move_cost
|
7012 |
|
|
+
|
7013 |
|
|
+// #warning "This needs to be double checked, and annotated"
|
7014 |
111 |
dgisselq |
+#define BRANCH_COST(SPEED,PREDICTABLE) ((PREDICTABLE)?2:5)
|
7015 |
102 |
dgisselq |
+
|
7016 |
|
|
+/* Define this macro as a C expression which is nonzero if accessing less than
|
7017 |
|
|
+ * a word of memory (i.e. a 'char' or a 'short') is no faster than accessing
|
7018 |
|
|
+ * a word of memory.
|
7019 |
|
|
+ */
|
7020 |
|
|
+#define SLOW_BYTE_ACCESS 1
|
7021 |
|
|
+
|
7022 |
|
|
+/* MOVE_RATIO(SPD) ... The threshold of number of scalar memory-to-memory move
|
7023 |
|
|
+ * instructions, below which a sequence of instructions should be generated
|
7024 |
|
|
+ * instead of a string move instruction or a library call. Increasing the
|
7025 |
|
|
+ * value will always make code faster, but eventually incurs high cost in
|
7026 |
|
|
+ * increased code size.
|
7027 |
|
|
+ */
|
7028 |
|
|
+#define MOVE_RATIO(SPD) 5
|
7029 |
|
|
+
|
7030 |
|
|
+/* TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(SZ,ALGN,OP,SPD) ...
|
7031 |
|
|
+ */
|
7032 |
|
|
+// #undef TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)
|
7033 |
|
|
+// #define TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)// needs hook
|
7034 |
|
|
+
|
7035 |
|
|
+/* CLEAR_RATIO(SPD) ... The threshold number of scalar move instructions, below
|
7036 |
|
|
+ * which a sequence of instructions should be generated to clear memory instead
|
7037 |
|
|
+ * of a string clear instruction or a library call. Increasing the value will
|
7038 |
|
|
+ * always make the code faster, but eventually incurs high cost in increased
|
7039 |
|
|
+ * code size.
|
7040 |
|
|
+ */
|
7041 |
|
|
+#define CLEAR_RATIO(SPD) MOVE_RATIO(SPD)
|
7042 |
|
|
+
|
7043 |
|
|
+/* NO_FUNCTION_CSE ... Define this macro to be true if it is as good or better
|
7044 |
|
|
+ * to call a constant function address than to call an address kept in a
|
7045 |
|
|
+ * register.
|
7046 |
|
|
+ *
|
7047 |
|
|
+ * On the Zip CPU, constant function addresses--especially relative ones,
|
7048 |
|
|
+ * can be optimized into a single cycle delay. Register jumps will always
|
7049 |
|
|
+ * stall the whole (5-stage) pipeline.
|
7050 |
|
|
+ */
|
7051 |
202 |
dgisselq |
+#define NO_FUNCTION_CSE true
|
7052 |
102 |
dgisselq |
+
|
7053 |
111 |
dgisselq |
+/* TARGET_RTX_COSTS(X,CODE,OUTER,OPNO,TOTAL,SPD) ... This target hook describes
|
7054 |
|
|
+ * the relative costs of RTL expressions.
|
7055 |
|
|
+ *
|
7056 |
|
|
+ * The cost may depend on the precise form of the expression, which is avaialble
|
7057 |
|
|
+ * for examination in X, and the fact that X appears as operand OPNO of an
|
7058 |
|
|
+ * expression with rtx code OUTER. That is, the hook can assume that there is
|
7059 |
|
|
+ * some RTX Y such that GET_CODE(Y)==OUTER and such that either (a) XEXP(Y,OPNO)
|
7060 |
|
|
+ * == X or (b) XVEC(Y,OPNO) contains X.
|
7061 |
|
|
+ *
|
7062 |
|
|
+ * ...
|
7063 |
|
|
+ * The hook returns true when all subexpressions of x have been processed and
|
7064 |
|
|
+ * false when rtx_cost should recurse.
|
7065 |
102 |
dgisselq |
+ */
|
7066 |
111 |
dgisselq |
+
|
7067 |
102 |
dgisselq |
+/* TARGET_ADDRESS_COST(ADDR,MODE,AS, SPD) ... This hook computes the cost of an
|
7068 |
|
|
+ * addressing mode that contains ADDR. If not defined, the cost is computed
|
7069 |
|
|
+ * from the ADDR expression and the TARGET_RTX_COST hook. In cases where more
|
7070 |
|
|
+ * than one form of an address is known, the form with the lowest cost will be
|
7071 |
|
|
+ * used. If multiple forms have the same, lowest, cost, the one that is the
|
7072 |
|
|
+ * most complex will be used.
|
7073 |
|
|
+ *
|
7074 |
|
|
+ * ZipCPU really has only one address cost, the only type of address it
|
7075 |
|
|
+ * supports. Sure, index addressing would cost us more, but we don't support
|
7076 |
|
|
+ * that so ... I think we're okay defining this as a constant. Indeed, the
|
7077 |
|
|
+ * docs state that, "On RISC amchines, all instructions normally have the same
|
7078 |
|
|
+ * length and execution time. Hence all addresses will have equal costs."
|
7079 |
|
|
+ */
|
7080 |
|
|
+#undef TARGET_ADDRESS_COST
|
7081 |
|
|
+#define TARGET_ADDRESS_COST zip_address_cost
|
7082 |
|
|
+
|
7083 |
|
|
+
|
7084 |
|
|
+/* TARGET_NO_SPECULATION_IN_DELAY_SLOTS_P ... This predicate controls the use
|
7085 |
|
|
+ * of the eager delay slot filler to disallow speculatively executed
|
7086 |
|
|
+ * instructions being placed in delay slots. Targets such as certain MIPS
|
7087 |
|
|
+ * architectures posess both branches with and without delay slots. As the
|
7088 |
|
|
+ * eager delay slot filler can decrease performance, disabling it is beneficial
|
7089 |
|
|
+ * when ordinary branches are available. Use of delay slot branches filled
|
7090 |
|
|
+ * using basic filler is often still desirable as the delay slot can hide a
|
7091 |
|
|
+ * pipeline bubble.
|
7092 |
|
|
+ */
|
7093 |
|
|
+// How should Zip CPU define this--we have no delay slots.
|
7094 |
|
|
+
|
7095 |
|
|
+
|
7096 |
|
|
+/* 17.17 Instruction Scheduler */
|
7097 |
|
|
+
|
7098 |
|
|
+#define TARGET_SCHED_ISSUE_RATE zip_sched_issue_rate
|
7099 |
|
|
+
|
7100 |
|
|
+/* 17.18 Dividing the Output into Sections */
|
7101 |
|
|
+
|
7102 |
|
|
+/* Switch to the text or data segment. */
|
7103 |
|
|
+#define TEXT_SECTION_ASM_OP "\t.text"
|
7104 |
|
|
+#define DATA_SECTION_ASM_OP "\t.data"
|
7105 |
|
|
+
|
7106 |
|
|
+// #undef TARGET_LIBGCC_SDATA_SECTION
|
7107 |
|
|
+// #define TARGET_LIBGCC_SDATA_SECTION ".sdata"
|
7108 |
|
|
+
|
7109 |
|
|
+
|
7110 |
|
|
+/* 17.19 Position Independent Code */
|
7111 |
|
|
+
|
7112 |
|
|
+#define PIC_OFFSET_TABLE_REGNUM zip_GOT
|
7113 |
|
|
+#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED 0
|
7114 |
|
|
+// #define LEGITIMATE_PIC_OPERAND_P(X) should evaluate to X(GOT) only
|
7115 |
|
|
+
|
7116 |
|
|
+/* 17.20 Defining the Output Assembler Language */
|
7117 |
|
|
+
|
7118 |
202 |
dgisselq |
+/* 17.20.2 Output of Data */
|
7119 |
146 |
dgisselq |
+
|
7120 |
|
|
+/* These hooks (above) specify assembly directives for creating certain kinds
|
7121 |
|
|
+ * of integer objects. The TARGET_ASM_BYTE_OP directive creates a byte-sized
|
7122 |
|
|
+ * object. The TARGET_ASMALIGNED_HI_OP one creates an aligned two-byte object
|
7123 |
|
|
+ * and so on. Any of the hookd may be NULL, indicating that no suitable
|
7124 |
|
|
+ * directive is available.
|
7125 |
|
|
+ *
|
7126 |
|
|
+ * The compiler will print these strings at the start of a new line, followed
|
7127 |
|
|
+ * immediately by the object's initial value. In most cases, the string should
|
7128 |
|
|
+ * contain a tab, a pseudo op, and then another tab.
|
7129 |
|
|
+ */
|
7130 |
|
|
+
|
7131 |
202 |
dgisselq |
+#undef TARGET_ASM_ALIGNED_HI_OP
|
7132 |
|
|
+#undef TARGET_ASM_ALIGNED_SI_OP
|
7133 |
|
|
+// #undef TARGET_ASM_ALIGNED_DI_OP
|
7134 |
|
|
+#define TARGET_ASM_ALIGNED_HI_OP ".short"
|
7135 |
|
|
+// The assembler is set up to call a 4-byte integer a long. This definition of
|
7136 |
|
|
+// a long isn't consistent with the compilers definition. For this reason,
|
7137 |
|
|
+// the ZipCPU backend for the GNU Assembler defines a long as a 64-bit number,
|
7138 |
|
|
+// and an int as a 32-bit number.
|
7139 |
|
|
+#define TARGET_ASM_ALIGNED_SI_OP ".int"
|
7140 |
|
|
+// #define TARGET_ASM_ALIGNED_DI_OP ".long"
|
7141 |
|
|
+
|
7142 |
|
|
+
|
7143 |
102 |
dgisselq |
+/* 17.20.4 Output and Generation of Labels */
|
7144 |
|
|
+
|
7145 |
|
|
+/* ASM_OUTPUT_LABEL
|
7146 |
|
|
+ * ... A default definition of this macro is provided which is correct for
|
7147 |
|
|
+ * most systems.
|
7148 |
|
|
+ */
|
7149 |
|
|
+
|
7150 |
|
|
+/* ASM_OUTPUT_FUNCTION_LABEL
|
7151 |
|
|
+ * ... if not defined, then the function name is defined in the usual manner
|
7152 |
|
|
+ * as a label.
|
7153 |
|
|
+ */
|
7154 |
|
|
+
|
7155 |
|
|
+/* ASM_OUTPUT_INTERNAL_LABEL ... Identical to ASM_OUTPUT_LABEL, except that name
|
7156 |
|
|
+ * is known to refer to a compiler-generated label. The default definition
|
7157 |
|
|
+ * uses assemble_name_raw, which is like assemble_name except that it is more
|
7158 |
|
|
+ * efficient.
|
7159 |
|
|
+ */
|
7160 |
|
|
+
|
7161 |
|
|
+/* SIZE_ASM_OP ... A C string containing the appropriate assembler directive
|
7162 |
|
|
+ * to specify the size of a symbol, without any arguments. ON systems that
|
7163 |
|
|
+ * use ELF, the dfault is "\t.size\t"; on other systems, the default is not to
|
7164 |
|
|
+ * define this macro.
|
7165 |
|
|
+ *
|
7166 |
|
|
+ * Define this amcro only if it is correct to use the default definitions of
|
7167 |
|
|
+ * ASM_OUTPUT_SIZE_DERECTIVE and ASM_OUTPUT_MEASURED_SIZE for your system.
|
7168 |
|
|
+ * If you need your own custom definitions of those macros, or if you do not
|
7169 |
|
|
+ * need explicit symbol sizes at all, do not define this macro.
|
7170 |
|
|
+ */
|
7171 |
|
|
+
|
7172 |
|
|
+/* ASM_OUTPUT_SIZE_DIRECTIVE
|
7173 |
|
|
+ * ASM_OUTPUT_MEASURED_SIZE
|
7174 |
|
|
+ */
|
7175 |
|
|
+
|
7176 |
|
|
+/* NO_DOLLAR_IN_LABEL ... Define this macro if the assembler does not accept
|
7177 |
|
|
+ * the character '$' in label names. By default constructors and destructors
|
7178 |
|
|
+ * in G++ have "$" in the identifiers. If this label is defined, '.' is
|
7179 |
|
|
+ * used instead.
|
7180 |
|
|
+ */
|
7181 |
|
|
+
|
7182 |
|
|
+/* NO_DOT_IN_LABEL ... Define this macro if the assembler does not accept the
|
7183 |
|
|
+ * character '.' in label names. By default constructors and destructors in
|
7184 |
|
|
+ * G++ have names that use '.'. If this macro is defined, these names are
|
7185 |
|
|
+ * rewritten to avoid '.'.
|
7186 |
|
|
+ */
|
7187 |
|
|
+
|
7188 |
|
|
+/* TYPE_ASM_OP ... A C string containing the appropriate assembler directive to
|
7189 |
|
|
+ * specify the type of a symbol, without any arguments. On systems that use
|
7190 |
|
|
+ * ELF the default in config/elfos.h is "\t.type\t"; on other systems, the default is not to define this macro.
|
7191 |
|
|
+ *
|
7192 |
|
|
+ * Define this macro only if it is correct to use the default definition of
|
7193 |
|
|
+ * ASM_OUTPUT_TYPE_DIRECTIVE forr your system. If you need your own custom
|
7194 |
|
|
+ * definition of this macr, or if you do not need explicit symbol types at all,
|
7195 |
|
|
+ * do not define this macro.
|
7196 |
|
|
+ */
|
7197 |
|
|
+
|
7198 |
|
|
+/* TYPE OPERAND_FMD ... A
|
7199 |
|
|
+ */
|
7200 |
|
|
+
|
7201 |
|
|
+/* ASM_OUTPUT_TYPE_DIRECTIVE
|
7202 |
|
|
+ */
|
7203 |
|
|
+
|
7204 |
|
|
+/* ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) ...
|
7205 |
|
|
+ * if this macro is not defined, then the function name is defined in the usual
|
7206 |
|
|
+ * manner as a label (by means of ASM_OUTPUT_FUNCTION_LABEL).
|
7207 |
|
|
+ */
|
7208 |
|
|
+
|
7209 |
|
|
+/* ASM_DECLARE_FUNCTION_SIZE
|
7210 |
|
|
+ * ASM_DECLARE_COLD_FUNCTION_NAME
|
7211 |
|
|
+ * ASM_DECLARE_COLD_FUNCTION_SIZE
|
7212 |
|
|
+ * ASM_DECLARE_OBJECT_NAME
|
7213 |
|
|
+ * TARGET_ASM_DECLARE_CONSTANT_NAME
|
7214 |
|
|
+ */
|
7215 |
|
|
+/* ASM_DECLARE_REGISTER_GLOBAL(STREAM, DECL, REGNO, NAME) ... A C statement
|
7216 |
|
|
+ * (sans semicolon) to output to the stdio stream STREAM any text necessary for
|
7217 |
|
|
+ * claiming a register REGNO for a global variable DECL with name NAME.
|
7218 |
|
|
+ *
|
7219 |
|
|
+ * If you don't defin this macro, that is equivalent to dfining it to do
|
7220 |
|
|
+ * nothing.
|
7221 |
|
|
+ */
|
7222 |
|
|
+
|
7223 |
|
|
+/* ASM_FINISH_DECLARE_OBJECT
|
7224 |
|
|
+ * TARGET_ASM_GLOBALIZE_LABEL
|
7225 |
|
|
+ * TARGET_ASM_GLOBALIZE_DECL_NAME
|
7226 |
|
|
+ * TARGET_ASM_ASSEMBLE_UNDEFINED_DECL
|
7227 |
|
|
+ * ASM_WEAKEN_LABEL
|
7228 |
|
|
+ * ASM_WEAKEN_DECL
|
7229 |
|
|
+ * ASM_OUTPUT_WEAKREF
|
7230 |
|
|
+ * SUPPORTS_WEAK
|
7231 |
|
|
+ * TARGET_SUPPORTS_WEAK
|
7232 |
|
|
+ * MAKE_DECL_ONE_ONLY
|
7233 |
|
|
+ * SUPPORTS_ONE_ONLY
|
7234 |
|
|
+ * TARGTE_ASM_ASSEMBLE_VISIBILITY
|
7235 |
|
|
+ * TARGET_WEAK_NOT_IN_ARCHIVE_TOC
|
7236 |
|
|
+ * ASM_OUTPUT_EXTERNAL
|
7237 |
|
|
+ * TARGET_ASM_EXTERNAL_LIBCALL
|
7238 |
|
|
+ * TARGET_ASM_MARK_DECLPRESERVED
|
7239 |
|
|
+ * ASM_OUTPUT_LABELREF
|
7240 |
|
|
+ * TARGET_MANGLE_ASSEMBLER_NAME
|
7241 |
|
|
+ * ASM_OUTPUT_SYMBOL_REF
|
7242 |
|
|
+ * ASM_OUTPUT_LABEL_REF
|
7243 |
|
|
+ * TARGET_ASM_INTERNAL_LABEL
|
7244 |
|
|
+ * ASM_OUTPUT_DEBUG_LABEL
|
7245 |
|
|
+ * ASM_GENERATE_INTERNAL_LABEL
|
7246 |
|
|
+ * ASM_FORMAT_PRIVATE_NAME
|
7247 |
|
|
+ */
|
7248 |
|
|
+
|
7249 |
|
|
+/* ASM_OUTPUT_DEF ... A C statement to output to the stdio stream STREAM
|
7250 |
|
|
+ * assembler code which defines (equates) the symbol NAME to have the value
|
7251 |
|
|
+ * VALUE.
|
7252 |
|
|
+ *
|
7253 |
|
|
+ * ZipCPU---So many other things that we need depend upon this, that we need
|
7254 |
|
|
+ * to implement a non-default version.
|
7255 |
|
|
+ */
|
7256 |
|
|
+#define ASM_OUTPUT_DEF zip_asm_output_def
|
7257 |
|
|
+
|
7258 |
|
|
+/* ASM_OUTPUT_DEF_FROM_DECLS
|
7259 |
|
|
+ * TARGET_DEFERRED_OUTPUT_DEFS
|
7260 |
|
|
+ * ASM_OUTPUT_WEAK_ALIAS
|
7261 |
|
|
+ * OBJ_GEN_METHOD_LABEL
|
7262 |
|
|
+ */
|
7263 |
|
|
+
|
7264 |
|
|
+
|
7265 |
|
|
+/* 17.20.7 Output of Assembler Instructions */
|
7266 |
|
|
+
|
7267 |
171 |
dgisselq |
+#define REGISTER_NAMES { \
|
7268 |
|
|
+ "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", \
|
7269 |
|
|
+ "R8", "R9", "R10", "R11", "R12", "SP", "CC", "PC", \
|
7270 |
|
|
+ "uR0","uR1","uR2", "uR3", "uR4", "uR5","uR6","uR7", \
|
7271 |
|
|
+ "uR8","uR9","uR10","uR11","uR12","uSP","uCC","uPC", \
|
7272 |
|
|
+ "PSEUDO-AP" }
|
7273 |
102 |
dgisselq |
+
|
7274 |
|
|
+/* REGISTER_PREFIX (Undefined by default)
|
7275 |
|
|
+ * LOCAL_LABEL_PREFIX (Undefined by default)
|
7276 |
|
|
+ * USER_LABEL_PREFIX defaults to "*"
|
7277 |
|
|
+ * IMMEDIATE_PREFIX (Undefined by default)
|
7278 |
|
|
+ *
|
7279 |
|
|
+ * If defined, C string expressions to be used for the '%R', '%L', '%U', and
|
7280 |
|
|
+ * '%I' options of asm_fprintf (see 'final.c'). These are useful when a single
|
7281 |
|
|
+ * 'md' file must support multiple assembler formats. In that case, the various
|
7282 |
|
|
+ * 'tm.h' files can define these macros differently.
|
7283 |
|
|
+ */
|
7284 |
|
|
+// #define USER_LABEL_PREFIX "*"
|
7285 |
|
|
+
|
7286 |
|
|
+/* Defining memory operand address formats is in this section. */
|
7287 |
|
|
+
|
7288 |
|
|
+/* 17.20.10 Assembler Commands for Alignment */
|
7289 |
|
|
+
|
7290 |
|
|
+/* JUMP_ALIGN(label) ... The alignment (log base 2) to put in front of label,
|
7291 |
|
|
+ * which is a common destination of jumps and has no fallthru incoming
|
7292 |
|
|
+ * edge. This macro need not be defined if you don't want any special alignment
|
7293 |
|
|
+ * to be done at such a time. Most machine descriptions do not currently define
|
7294 |
|
|
+ * this macro.
|
7295 |
|
|
+ *
|
7296 |
|
|
+ * ZipCPU---The assembler should automatically deal with label alignment, so
|
7297 |
|
|
+ * let's not do anything about it here.
|
7298 |
|
|
+ */
|
7299 |
|
|
+
|
7300 |
|
|
+/* TARGET_ASM_JUMP_ALIGN_MAX_SKIP
|
7301 |
|
|
+ */
|
7302 |
|
|
+
|
7303 |
|
|
+/* LABEL_ALIGN_AFTER_BARRIER
|
7304 |
|
|
+ * TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
|
7305 |
|
|
+ */
|
7306 |
|
|
+
|
7307 |
|
|
+/* LOOP_ALIGN(label)
|
7308 |
|
|
+ * TARGET_ASM_LOOP_ALIGN_MAX_SKIP
|
7309 |
|
|
+ * LABEL_ALIGN
|
7310 |
|
|
+ * TARGET_ASM_LABEL_ALIGN_MAX_SKIP
|
7311 |
|
|
+ */
|
7312 |
|
|
+
|
7313 |
|
|
+/* ASM_OUTPUT_SKIP(STREAM, NBYTES) A C statement to output to the stdio
|
7314 |
|
|
+ * stream an assembler instruction to advance the location counter by nbytes
|
7315 |
|
|
+ * bytes.
|
7316 |
|
|
+ */
|
7317 |
|
|
+
|
7318 |
|
|
+/* TARGET_ASM_LABEL_ALIGN */
|
7319 |
|
|
+/* Assembler Commands for Alignment */
|
7320 |
|
|
+#define ASM_OUTPUT_ALIGN(STREAM,POWER) \
|
7321 |
202 |
dgisselq |
+ do { fprintf(STREAM, "\t.align\t%d\n", POWER); } while (0)
|
7322 |
102 |
dgisselq |
+
|
7323 |
|
|
+
|
7324 |
|
|
+/* 17.21 Controlling Debugging Information Format */
|
7325 |
|
|
+/* 17.22 Cross Compilation and Floating Point */
|
7326 |
111 |
dgisselq |
+
|
7327 |
|
|
+// REAL_VALUE_TYPE
|
7328 |
|
|
+// REAL_VALUES_EQUAL
|
7329 |
|
|
+// REAL_VALUES_LESS ... Tess whether x is less than y
|
7330 |
|
|
+/* REAL_VALUE_FIX ... Truncates x to an unsigned integer, rouding toward zero.
|
7331 |
|
|
+ * If x is negative, returns zero.
|
7332 |
|
|
+ */
|
7333 |
|
|
+// REAL_VALUE_ATOF
|
7334 |
|
|
+// REAL_VALUE_NEGATIVE
|
7335 |
|
|
+// REAL_VALUE_ISINF
|
7336 |
|
|
+// REAL_VALUE_ISNAN
|
7337 |
|
|
+/* REAL_ARITHMETIC(OUT,CODE,X,Y) ... (Macro) Calculates an arithmetic operation
|
7338 |
|
|
+ * on two floating point values X and Y, storing the result in OUT (which must
|
7339 |
|
|
+ * be a variable).
|
7340 |
|
|
+ *
|
7341 |
|
|
+ * The operation to be performed is specified by CODE. Only the following
|
7342 |
|
|
+ * codes are supported: PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, MAX_EXPR,
|
7343 |
|
|
+ * MIN_EXPR.
|
7344 |
|
|
+ *
|
7345 |
|
|
+ * If REAL_ARITHMETIC is asked to evaluate division by zero and the target's
|
7346 |
|
|
+ * floating point format cannot represent infinity, it will call abort().
|
7347 |
|
|
+ * Callers shoudl check for this situation first, using MODE_HAS_INFINITIES.
|
7348 |
|
|
+ */
|
7349 |
|
|
+/* REAL_VALUE_NEGATE(X) ... [Macro] Returns the negative of the floating point
|
7350 |
|
|
+ * value X.
|
7351 |
|
|
+ */
|
7352 |
|
|
+/* REAL_VALUE_ABS(X) ... [Macro] Returns the absolute value of X.
|
7353 |
|
|
+ */
|
7354 |
102 |
dgisselq |
+/* 17.23 Mode switching instructions */
|
7355 |
|
|
+/* 17.24 Defining target-specific uses of __attribute__ */
|
7356 |
|
|
+#undef TARGET_OPTION_OVERRIDE
|
7357 |
|
|
+#define TARGET_OPTION_OVERRIDE zip_override_options
|
7358 |
|
|
+
|
7359 |
|
|
+/* 17.25 Emulating TLS */
|
7360 |
|
|
+/* 17.26 Defining coprocessor specifics for MIPS targets*/
|
7361 |
|
|
+
|
7362 |
|
|
+ // ZipCPU isn't MIPS.
|
7363 |
|
|
+
|
7364 |
|
|
+/* 17.27 Parameters for Precompiled Header Validity Checking */
|
7365 |
|
|
+/* 17.28 C++ ABI parameters */
|
7366 |
|
|
+/* 17.29 Adding support for named address spaces */
|
7367 |
|
|
+/* 17.30 Miscellaneous Parameters */
|
7368 |
|
|
+
|
7369 |
|
|
+/* HAS_LONG_COND_BRANCH ... Define this boolean macro to indicate whether or
|
7370 |
|
|
+ * not your architecture has conditional branches that can span all of memory.
|
7371 |
|
|
+ * It is used in conjunction with an optimization that partitions hot and
|
7372 |
|
|
+ * cold basic blocks into separate sections of the executable. If this macro
|
7373 |
|
|
+ * is set to false, gcc will convert any conditional branches that attempt to
|
7374 |
|
|
+ * cross between sections into unconditional branches or indirect jumps.
|
7375 |
|
|
+ *
|
7376 |
|
|
+ * ZipCPU --- The assembler renders long unconditional branch code without
|
7377 |
|
|
+ * problems, so we can pretend that such long branches exist.
|
7378 |
|
|
+ */
|
7379 |
|
|
+#define HAS_LONG_COND_BRANCH true
|
7380 |
|
|
+
|
7381 |
|
|
+/* HAS_LONG_UNCOND_BRANCH ... Define this boolean macro to indicate whether
|
7382 |
|
|
+ * or not your architecture has unconditional branches that can span all of
|
7383 |
202 |
dgisselq |
+ * memory. (ZipCPU does ... via the LW (PC),PC instruction.) It is used in
|
7384 |
102 |
dgisselq |
+ * conjunction with an optimization that partitions hot and cold basic blocks
|
7385 |
|
|
+ * into separate sections of the executable. If this macro is set to false,
|
7386 |
|
|
+ * gcc will convert any unconditional branches that attempt to cross between
|
7387 |
|
|
+ * sections into indirect jumps.
|
7388 |
|
|
+ *
|
7389 |
202 |
dgisselq |
+ * ZipCPU has the LW (PC),PC instruction which can be used to implement a long
|
7390 |
102 |
dgisselq |
+ * jump.
|
7391 |
|
|
+ */
|
7392 |
|
|
+#define HAS_LONG_UNCOND_BRANCH true
|
7393 |
|
|
+
|
7394 |
|
|
+/* CASE_VECTOR_MODE ... An alias for a machine mode name. This is the machine
|
7395 |
202 |
dgisselq |
+ * mode that elements of a jump-table should have.
|
7396 |
102 |
dgisselq |
+ *
|
7397 |
|
|
+ */
|
7398 |
|
|
+#define CASE_VECTOR_MODE SImode
|
7399 |
|
|
+
|
7400 |
|
|
+/* CASE_VECTOR_SHORTEN_MODE(MIN,MAX,BODY) ... Optional: return the preferred
|
7401 |
|
|
+ * mode for an addr_diff_vec when the minimum and maximum offset are known.
|
7402 |
|
|
+ * If you define this, it enables extra code in branch shortening to deal with
|
7403 |
|
|
+ * addr_diff_vec. To make this work, you also have to define INSN_ALIGN and
|
7404 |
|
|
+ * make the alignment for addr_diff_vec explicit. The body argument is provided so that the offset_unsigned and scale flags can be updated.
|
7405 |
|
|
+ *
|
7406 |
|
|
+ * ZipCPU---No advantage here.
|
7407 |
|
|
+ */
|
7408 |
|
|
+
|
7409 |
|
|
+/* CASE_VECTOR_PC_RELATIVE ... Define this exrpession to indicate when
|
7410 |
|
|
+ * jump-tables should contain relative addresses. You need not define this
|
7411 |
|
|
+ * macro if jump-tables never contain relative addresses, or jump-tables
|
7412 |
|
|
+ * should contain relative addresses only when -fPIC or -FPIC is in effect.
|
7413 |
|
|
+ *
|
7414 |
|
|
+ * ZipCPU---No advantage in PC-Relative jump tables--except in PIC relative
|
7415 |
|
|
+ * code.
|
7416 |
|
|
+ */
|
7417 |
|
|
+
|
7418 |
|
|
+/* TARGET_CASE_VALUES_THRESHOLD(VOID) ... This function returns the smallest
|
7419 |
|
|
+ * number of different values for which it is best to use a jump-table instead
|
7420 |
|
|
+ * of a tree of conditional branches. The default is four for machines with a
|
7421 |
|
|
+ * casesi instruction and five otherwise. This is best for most machines.
|
7422 |
|
|
+ *
|
7423 |
|
|
+ * ZipCPU---Leave at the default.
|
7424 |
|
|
+ */
|
7425 |
|
|
+
|
7426 |
|
|
+/* WORD_REGISTER_OPERATIONS ... Define this macro to 1 if operations between
|
7427 |
|
|
+ * registers with integral mode smaller than a word are always performed on the
|
7428 |
|
|
+ * entire register. Most RISC machines have this property and most CISC
|
7429 |
|
|
+ * machines do not.
|
7430 |
|
|
+ *
|
7431 |
202 |
dgisselq |
+ * ZipCPU---We have the property, 'cause we're fairly risc.
|
7432 |
102 |
dgisselq |
+ */
|
7433 |
|
|
+#undef WORD_REGISTER_OPERATIONS
|
7434 |
|
|
+#define WORD_REGISTER_OPERATIONS 1
|
7435 |
|
|
+
|
7436 |
|
|
+/* LOAD_EXTEND_OP(MEMODE) ... Define this macro to be a C expression indicating
|
7437 |
|
|
+ * when insns that read memory in MEMMODE, an integral mode narrower than a
|
7438 |
|
|
+ * word, set the bits outside of MEMMODE to be either the sign extension or
|
7439 |
|
|
+ * zero-extension of the data read. Return SIGN_EXTEND for values of MEMMODE
|
7440 |
|
|
+ * for which the insn sign-extends, ZERO_EXTEND for which it zero-extends, and
|
7441 |
|
|
+ * UNKNOWN for other modes.
|
7442 |
|
|
+ *
|
7443 |
|
|
+ * Do not define this macro if it would always return UNKNOWN.
|
7444 |
|
|
+ *
|
7445 |
202 |
dgisselq |
+ * ZipCPU---Our memory unit zero extends registers, so we'll zero extend here.
|
7446 |
102 |
dgisselq |
+ */
|
7447 |
|
|
+#undef LOAD_EXTEND_OP
|
7448 |
202 |
dgisselq |
+#define LOAD_EXTEND_OP(MEM) ZERO_EXTEND
|
7449 |
102 |
dgisselq |
+
|
7450 |
202 |
dgisselq |
+/* SHORT_IMMEDIATES_SIGN_EXTEND ... Define this macro to 1 if loading short
|
7451 |
|
|
+ * immediate values into registers sign extends.
|
7452 |
102 |
dgisselq |
+ *
|
7453 |
|
|
+ * ZipCPU---All immediates are sign extended, so yes.
|
7454 |
|
|
+ */
|
7455 |
|
|
+#undef SHORT_IMMEDIATES_SIGN_EXTEND
|
7456 |
|
|
+#define SHORT_IMMEDIATES_SIGN_EXTEND 1
|
7457 |
|
|
+
|
7458 |
|
|
+/* TARGET_MIN_DIVISIONS_FOR_RECIP_MUL
|
7459 |
|
|
+ */
|
7460 |
|
|
+
|
7461 |
|
|
+/* MOVE_MAX ... The maximum number of bytes that a single instruction can move
|
7462 |
|
|
+ * quickly between memory and registers or between two memory locations.
|
7463 |
|
|
+ *
|
7464 |
|
|
+ * ZipCPU --- Although we can move 32-bits at a time, and most people would call
|
7465 |
|
|
+ * this 4-bytes, the compiler defines a byte as the minimum addressable unit.
|
7466 |
|
|
+ * Therefore, this is defined to be one.
|
7467 |
|
|
+ */
|
7468 |
202 |
dgisselq |
+#define MOVE_MAX UNITS_PER_WORD
|
7469 |
102 |
dgisselq |
+
|
7470 |
|
|
+/* MAX_MOVE_MAX ... The maximum number of bytes that a single instruction can
|
7471 |
|
|
+ * move quickly between memory and registers or between two memory ...
|
7472 |
|
|
+ *
|
7473 |
|
|
+ * ZipCPU --- this sounds just the same as MOVE_MAX, which is the default
|
7474 |
|
|
+ * definition of this.
|
7475 |
|
|
+ */
|
7476 |
|
|
+
|
7477 |
|
|
+/* SHIFT_COUNT_TRUNCATED ... A C expression that is nonzero if on this machine
|
7478 |
|
|
+ * the number of bits actually used for the count of a shift operation is equal
|
7479 |
|
|
+ * to the number of bits needed to represent the size of the object being
|
7480 |
|
|
+ * shifted.
|
7481 |
|
|
+ *
|
7482 |
|
|
+ * You need not define this macro if it would have the value of zero.
|
7483 |
|
|
+ *
|
7484 |
|
|
+ * ZipCPU---A shift of 33 (or more) in either direction will wipe out the
|
7485 |
|
|
+ * value in the register, therefore this value should be zero, the default.
|
7486 |
|
|
+ */
|
7487 |
|
|
+
|
7488 |
|
|
+/* TARGET_SHIFT_TRUNCATION_MASK(MODE) ... This function describes how the
|
7489 |
|
|
+ * standard shift patterns for MODE deal with shifts by negative amounts or by
|
7490 |
|
|
+ * more than the width of the mode.
|
7491 |
|
|
+ *
|
7492 |
|
|
+ * ZipCPU---The default is zero, since we didn't define SHIFT_COUNT_TRUNCATED.
|
7493 |
|
|
+ * This is the case for the ZipCPU as well.
|
7494 |
|
|
+ */
|
7495 |
|
|
+
|
7496 |
|
|
+/* TRULY_NOOP_TRUNCATION(OUTPREC,INPREC) ... A C expression which is nonzero
|
7497 |
|
|
+ * if on this machine it is safe to "convert" an integer of INPREC bits to one
|
7498 |
|
|
+ * of OUTPREC bits (where OUTPREC is smaller than INPREC) by merely operating on
|
7499 |
|
|
+ * it as if it had OUTPREC bist. On many machines, this expression can be 1.
|
7500 |
|
|
+ *
|
7501 |
202 |
dgisselq |
+ * ZiPCPU ...
|
7502 |
102 |
dgisselq |
+ */
|
7503 |
|
|
+#undef TRULY_NOOP_TRUNCATION
|
7504 |
|
|
+#define TRULY_NOOP_TRUNCATION(O,I) 1
|
7505 |
|
|
+
|
7506 |
|
|
+/* TARGET_MODE_REP_EXTENDED(MODE,REPMODE) ... The representation of an integral
|
7507 |
|
|
+ * mode can be such that the values are always extended to a wider integral
|
7508 |
|
|
+ * mode. Return SIGN_EXTEND if values of MODE are represented in sign-extended
|
7509 |
|
|
+ * form to REPMODE. Return UNKNOWN otherwise. (Currently none of the targets
|
7510 |
202 |
dgisselq |
+ * use zero-extended this way so unlike LOAD_EXTEND_OP, TARGET_MODE_REP_EXTENDED
|
7511 |
|
|
+ * is expected to return either SIGN_EXTEND or UNKNOWN. Also, no target extends
|
7512 |
|
|
+ * MODE to REP_MODE so that REP_MODE is not the next widest integral mode and
|
7513 |
|
|
+ * we currently take advantage of this fact.)
|
7514 |
102 |
dgisselq |
+ *
|
7515 |
202 |
dgisselq |
+ * Similarly to LOAD_EXTEND_OP you may return a non_UNKNOWN value even if the
|
7516 |
|
|
+ * extension is not performed on certain hard registers as long as for the
|
7517 |
|
|
+ * REGNO_REG_CLASS of tehsse hard registers CANNOT_CHANGE_MODE_CLASS returns
|
7518 |
|
|
+ * zero.
|
7519 |
|
|
+ *
|
7520 |
|
|
+ * Not that TARGET_MODE_REP_EXTENDED and LOAD_EXTEND_OP describe two related
|
7521 |
|
|
+ * properties. If you define TARGET_MODE_REP_EXTENDED(mode,wordmode) you
|
7522 |
|
|
+ * probably also want to define LOAD_EXTEND_OP(mode) to return the same type
|
7523 |
|
|
+ * of extension.
|
7524 |
|
|
+ *
|
7525 |
|
|
+ * In order to enforce the representation of mode, TRULY_NOOP_TRUNCATION should
|
7526 |
|
|
+ * return false when truncating to MODE.
|
7527 |
|
|
+ *
|
7528 |
|
|
+ * ZipCPU ... ???
|
7529 |
102 |
dgisselq |
+ */
|
7530 |
|
|
+// #undef TARGET_MODE_REP_EXTENDED
|
7531 |
202 |
dgisselq |
+// #define TARGET_MODE_REP_EXTENDED(R,M) UNKNOWN
|
7532 |
102 |
dgisselq |
+
|
7533 |
|
|
+/* STORE_FLAG_VALUE ... A C expression describing the value returned by a
|
7534 |
|
|
+ * comparison operator with an integral mode and stored by a store-flag
|
7535 |
|
|
+ * instruction (cstoremode4) when the condition is true. This description
|
7536 |
|
|
+ * must apply to all the cstoremode4 patterns and all the comparison operators
|
7537 |
|
|
+ * whose results have MODE_INT mode.
|
7538 |
|
|
+ *
|
7539 |
|
|
+ * ZipCPU---Doesn't really have a STORE_FLAG_VALUE instruction ...
|
7540 |
|
|
+ */
|
7541 |
|
|
+
|
7542 |
|
|
+/* FLOAT_STORE_FLAG_VALUE
|
7543 |
|
|
+ *
|
7544 |
|
|
+ * ZipCPU
|
7545 |
|
|
+ */
|
7546 |
|
|
+
|
7547 |
|
|
+/* VECTOR_STORE_FLAG_VALUE ... define this macro on machines that have vector
|
7548 |
|
|
+ * comparison operations that return a vector result ...
|
7549 |
|
|
+ *
|
7550 |
|
|
+ * ZipCPU---Doesn't support vector operations.
|
7551 |
|
|
+ */
|
7552 |
|
|
+
|
7553 |
|
|
+/* CLZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
|
7554 |
|
|
+ * CTZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
|
7555 |
|
|
+ *
|
7556 |
|
|
+ * A C expression that indicates whetther the architecture defines a value for
|
7557 |
|
|
+ * clz or ctz with a zero operand. A result of 0 indicates the value is
|
7558 |
202 |
dgisselq |
+ * undefined. If the value is defined for only the RTL expression, the macro
|
7559 |
|
|
+ * should evaluate to 1. If the value also applies to the corresponding optab
|
7560 |
102 |
dgisselq |
+ * entry, then the macro should evaluate to 2. In cases where the value is
|
7561 |
|
|
+ * defined, value should be set to this value.
|
7562 |
|
|
+ * If this macro is not defined, the value of clz or ctz at zero is assumed to
|
7563 |
|
|
+ * be undefined.
|
7564 |
|
|
+ *
|
7565 |
|
|
+ * ZipCPU---Has neither clz nor ctz instructions, so we don't need this.
|
7566 |
|
|
+ */
|
7567 |
|
|
+
|
7568 |
|
|
+/* Pmode ... An alias for the machine mode for pointers. On most machines,
|
7569 |
|
|
+ * define this to be the integer mode corresponding to the width of a
|
7570 |
|
|
+ * hardware pointer. SImode on 32-bits machines, or DImode on 64-bit machines.
|
7571 |
|
|
+ * On some machines you must define this to be one of the partial
|
7572 |
|
|
+ * integer modes, such as PSImode.
|
7573 |
202 |
dgisselq |
+ *
|
7574 |
|
|
+ * ZipCPU--the machine mode for pointers is one word (32-bits). The one word
|
7575 |
|
|
+ * mode is the SImode, so that's what we use here.
|
7576 |
102 |
dgisselq |
+ */
|
7577 |
|
|
+#undef Pmode
|
7578 |
|
|
+#define Pmode SImode
|
7579 |
|
|
+
|
7580 |
202 |
dgisselq |
+/* FUNCTION_MODE ... An alias for the machine mode used for memory references to
|
7581 |
102 |
dgisselq |
+ * function being called, in call RTL expressions. On most CISC machines, where
|
7582 |
|
|
+ * an instruction can begin at any byte address, this should be QImode. On most
|
7583 |
|
|
+ * RISC machines, where all instructions have fixed size and alignment, this
|
7584 |
|
|
+ * should be a mode with the same size and alignment as the machine instruction
|
7585 |
|
|
+ * words--typically SImode or HImode.
|
7586 |
|
|
+ *
|
7587 |
|
|
+ * ZipCPU---Definitely SImode, as with Pmode. (All words are 32-bits, including
|
7588 |
|
|
+ * addresses on the ZipCPU.
|
7589 |
|
|
+ */
|
7590 |
|
|
+#undef FUNCTION_MODE
|
7591 |
|
|
+#define FUNCTION_MODE SImode
|
7592 |
|
|
+
|
7593 |
|
|
+/* STDC_0_IN_SYSTEM_HEADERS
|
7594 |
|
|
+ */
|
7595 |
|
|
+
|
7596 |
|
|
+/* TARGET_C_PREINCLUDE(V) ... Define this hook to return the name of a header
|
7597 |
|
|
+ * file to be included at the start of all compilations, as if it had been
|
7598 |
|
|
+ * included with #include <file>. If this hook returns NULL, or is not defined,
|
7599 |
|
|
+ * or if the header is not found, or if the user specifies -ffreestanding or
|
7600 |
|
|
+ * -nostdinc, no header is included.
|
7601 |
|
|
+ *
|
7602 |
|
|
+ * ZipCPU --- We don't have a standard library defined yet, so we'll leave this
|
7603 |
|
|
+ * as NULL.
|
7604 |
|
|
+ */
|
7605 |
|
|
+#undef TARGET_C_PREINCLUDE
|
7606 |
|
|
+#define TARGET_C_PREINCLUDE NULL
|
7607 |
|
|
+
|
7608 |
|
|
+/* TARGET_CXX_IMPLICIT_EXTERN_C(CONST CHAR *) ... Define this hook to add target
|
7609 |
|
|
+ * specific C++ implicit extern C functions. If this function returns true
|
7610 |
|
|
+ * for the name of a file-scope function, that function implicitly gets extern
|
7611 |
|
|
+ * "C" linkage rather than whatever linkage the declaration would normally have.
|
7612 |
|
|
+ * An example of such function is WinMain on Win32 targets.
|
7613 |
|
|
+ *
|
7614 |
|
|
+ * ZipCPU---Not ready to deal with this yet.
|
7615 |
|
|
+ */
|
7616 |
|
|
+
|
7617 |
|
|
+/* NO_IMPLICIT_EXTERN_C ... Define this macro if the system header files
|
7618 |
|
|
+ * support C++ as well as C. This macro inhibits the usual method of using
|
7619 |
|
|
+ * system header files in C++, which is to pretend that the file's contents
|
7620 |
|
|
+ * are enclosed in 'extern "C" {...}'.
|
7621 |
|
|
+ *
|
7622 |
|
|
+ *
|
7623 |
|
|
+ * ZipCPU --- Don't have either C or C++ headers, so let's skip this for now.
|
7624 |
|
|
+ * Eventually, though, I think ZipCPU and C++ would go very well together.
|
7625 |
|
|
+ */
|
7626 |
|
|
+
|
7627 |
|
|
+/* REGISTER_TARGET_PRAGMAS ... Define this macro if you want to implement any
|
7628 |
|
|
+ * target specific pragmas.
|
7629 |
|
|
+ *
|
7630 |
|
|
+ * ZipCPU --- let's not.
|
7631 |
|
|
+ */
|
7632 |
|
|
+
|
7633 |
|
|
+/* HANDLE_PRAGMA_PACK_WITH_EXPANSION ... Define this macro if macros should be
|
7634 |
|
|
+ * expanded in the arguments of #pragma pack().
|
7635 |
|
|
+ *
|
7636 |
|
|
+ * ZipCPU ... why?
|
7637 |
|
|
+ */
|
7638 |
|
|
+
|
7639 |
|
|
+/* TARGET_DEFAULT_PACK_STRUCT ... If your target requires a struct packing
|
7640 |
|
|
+ * default other than 0 (meaning the machine default), define this macro to
|
7641 |
|
|
+ * the necessary value (in bytes). This must be a value that would also be
|
7642 |
|
|
+ * valid to use with #pragma pack() (that is a small power of two.
|
7643 |
|
|
+ */
|
7644 |
|
|
+
|
7645 |
|
|
+/* DOLLARS_IN_IDENTIFIERS
|
7646 |
|
|
+ * ZipCPU --- Default (not changing C)
|
7647 |
|
|
+ */
|
7648 |
|
|
+
|
7649 |
|
|
+/* INSN_SETS_ARE_DELAYED(INSN) ... Define this macro as a C expression that
|
7650 |
|
|
+ * is nonzero if it is safe for the delay slot schedule to place instructions
|
7651 |
|
|
+ * in the delay slot of INSN, even if they appear to use a resource set or
|
7652 |
|
|
+ * clobbered in INSN. INSN is always a ...
|
7653 |
|
|
+ *
|
7654 |
|
|
+ * ZipCPU --- You need not define this macro if it would always return zero.
|
7655 |
|
|
+ */
|
7656 |
|
|
+
|
7657 |
|
|
+/* INSN_REFERENCES_ARE_DELAYED(INSN) ... Define this macro as a C expression
|
7658 |
|
|
+ * that is nonzero if it is safe for the delay slot schedule to place
|
7659 |
|
|
+ * instructions in the delay slot of INSN, even if they appear to set or clobber
|
7660 |
|
|
+ * a resource referenced in INSN. INSN is always a jump_insn or an insn. On
|
7661 |
|
|
+ * machines where some insn or jump_insn is really a function call and ...
|
7662 |
|
|
+ *
|
7663 |
|
|
+ * ZipCPU --- You need not define this macro if it would always return zero.
|
7664 |
|
|
+ */
|
7665 |
|
|
+
|
7666 |
|
|
+/* MULTIPLE_SYMBOL_SPACES ... Define this macro as a C expression that is
|
7667 |
|
|
+ * nonzero if, in some cases, global symbols from one translation unit may not
|
7668 |
|
|
+ * be bound to undefined symbols in another translation unit without user
|
7669 |
|
|
+ * intervention. For instance, under Microsoft Windows symbols must be
|
7670 |
|
|
+ * explicitly imported from shared libraries (DLLs).
|
7671 |
|
|
+ *
|
7672 |
|
|
+ * ZipCPU---You need not define this macro if it would always evaluate to zero,
|
7673 |
|
|
+ * so we won't.
|
7674 |
|
|
+ */
|
7675 |
|
|
+
|
7676 |
|
|
+/* TARGET_MD_ASM_ADJUST
|
7677 |
|
|
+ */
|
7678 |
|
|
+/* MATH_LIBRARY ... Define this macro as a C constant ... you only need to
|
7679 |
|
|
+ * define this macro if the default of "m" is wrong.
|
7680 |
|
|
+ *
|
7681 |
|
|
+ * ZipCPU --- as we don't have a math library yet, building one such that "m"
|
7682 |
|
|
+ * works doesn't sound like a problem. Let's not define this.
|
7683 |
|
|
+ */
|
7684 |
|
|
+
|
7685 |
|
|
+/* LIBRARY_PATH_ENV ... Define this as a C string constant for the environment
|
7686 |
|
|
+ * variable that specifies where the linker should look for libraries.
|
7687 |
|
|
+ *
|
7688 |
|
|
+ * Just in case we want to add libraries for ZipCPU, let's place them in
|
7689 |
|
|
+ * /usr/local/zip/lib, so as not to confuse them with our local systems
|
7690 |
|
|
+ * libraries.
|
7691 |
|
|
+ */
|
7692 |
|
|
+#define LIBRARY_PATH_ENV "/usr/local/zip/lib"
|
7693 |
|
|
+
|
7694 |
|
|
+/* TARGET_POSIX_IO ... Define this macro if the target supports the following
|
7695 |
|
|
+ * POSIX file fucntions: access, mkdir, and file locking with fcntl/F_SETLKW.
|
7696 |
|
|
+ *
|
7697 |
|
|
+ * ZipCPU does not.
|
7698 |
|
|
+ */
|
7699 |
|
|
+
|
7700 |
|
|
+/* MAX_CONDITIONAL_EXECUTE ... A C expression for the maximum number of
|
7701 |
|
|
+ * instructions to execute via conditional execution instructions instead of a
|
7702 |
|
|
+ * branch. A value of BRANCH_COST+1 is the default if the machine does not use
|
7703 |
|
|
+ * cc0 and 1 if it does use cc0.
|
7704 |
|
|
+ *
|
7705 |
|
|
+ * ZipCPU---This sounds good enough for the ZipCPU as well--as long as we have
|
7706 |
|
|
+ * BRANCH_COST defined. However, BRANCH_COST is defined as conditionally to
|
7707 |
|
|
+ * something else, so let's keep looking into this.
|
7708 |
|
|
+ */
|
7709 |
|
|
+
|
7710 |
|
|
+/* IFCVT_MODIFY_TESTS(CEINFO,TRUE,FALSE) ... Used if the target needs to
|
7711 |
103 |
dgisselq |
+ * perform machine-dependent modifications on the conditionals used for turning
|
7712 |
102 |
dgisselq |
+ * basic blocks into conditionally executed code. CEINFO points to a data
|
7713 |
|
|
+ * structure, struct ce_if_block, which contains information about the currently
|
7714 |
|
|
+ * processed blocks. TRUE and FALSE are the tests that are used for
|
7715 |
|
|
+ * converting the then-block and the else-block, respectively. Set either TRUE
|
7716 |
|
|
+ * or FALSE to a null pointer if the tests cannot be converted.
|
7717 |
|
|
+ *
|
7718 |
|
|
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
|
7719 |
|
|
+ * execution and conditional testing capabilities.
|
7720 |
|
|
+ */
|
7721 |
122 |
dgisselq |
+#define IFCVT_MODIFY_TESTS(CI,TR,FL) zip_ifcvt_modify_tests(CI,&TR,&FL)
|
7722 |
102 |
dgisselq |
+
|
7723 |
|
|
+/* IFCVT_MODIFY_MULTIPLE_TESTS(CEINFO, BB, TRUE, FALSE) ... Like
|
7724 |
|
|
+ * IFCVT_MODIFY_TESTS, but used when converting more complicated if-statements
|
7725 |
|
|
+ * into conditions combined by and and or operations. BB contains the basic
|
7726 |
|
|
+ * block that contains the test that is currently being processed and about to
|
7727 |
|
|
+ * be turned into a condition.
|
7728 |
|
|
+ *
|
7729 |
|
|
+ *
|
7730 |
|
|
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
|
7731 |
|
|
+ * execution and conditional testing capabilities.
|
7732 |
|
|
+ */
|
7733 |
|
|
+// #warning "Need to come back to this."
|
7734 |
122 |
dgisselq |
+#define IFCVT_MODIFY_MULTIPLE_TESTS(CI,BB,TR,FL) TR=NULL_RTX
|
7735 |
102 |
dgisselq |
+
|
7736 |
|
|
+
|
7737 |
|
|
+/* IFCVT_MODIFY_INSN(CEINFO, PATTERN, INSN) ... A C expression to modify the
|
7738 |
|
|
+ * PATTERN of an INSN that is to be converted to conditional execution format.
|
7739 |
|
|
+ * CEINFO points to a data structure, struct ce_if_block, which contains
|
7740 |
|
|
+ * information about the currently processed blocks.
|
7741 |
|
|
+ *
|
7742 |
|
|
+ *
|
7743 |
|
|
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
|
7744 |
|
|
+ * execution and conditional testing capabilities.
|
7745 |
|
|
+ */
|
7746 |
142 |
dgisselq |
+#define IFCVT_MODIFY_INSN(CE,PATRN,INSN) zip_ifcvt_modify_insn(CE,PATRN,INSN)
|
7747 |
102 |
dgisselq |
+
|
7748 |
|
|
+
|
7749 |
|
|
+/* IFCVT_MODIFY_FINAL(CEINFO) ... A C expression to perform any final
|
7750 |
|
|
+ * machine dependent modifications in converting code to conditional
|
7751 |
|
|
+ * execution. The involved basic blocks can be found in struct ce_if_block
|
7752 |
|
|
+ * structure pointed to be CEINFO.
|
7753 |
|
|
+ *
|
7754 |
|
|
+ *
|
7755 |
|
|
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
|
7756 |
|
|
+ * execution and conditional testing capabilities.
|
7757 |
|
|
+ */
|
7758 |
|
|
+// #warning "Need to come back to this."
|
7759 |
122 |
dgisselq |
+#define IFCVT_MODIFY_FINAL(CEINFO) zip_ifcvt_modify_final(CEINFO)
|
7760 |
102 |
dgisselq |
+
|
7761 |
|
|
+
|
7762 |
|
|
+/* IFCVT_MODIFY_CANCEL(CEINFO) ... A C expression to cancel any machine
|
7763 |
|
|
+ * dependent modifications in converting code to conditional execution. The
|
7764 |
|
|
+ * involved basic blocks can be found in the struct ce_if_block structure that
|
7765 |
|
|
+ * is pointed to by CEINFO.
|
7766 |
|
|
+ *
|
7767 |
|
|
+ *
|
7768 |
|
|
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
|
7769 |
|
|
+ * execution and conditional testing capabilities.
|
7770 |
|
|
+ */
|
7771 |
|
|
+// #warning "Need to come back to this."
|
7772 |
122 |
dgisselq |
+#define IFCVT_MODIFY_CANCEL(CEINFO) zip_ifcvt_modify_cancel(CEINFO)
|
7773 |
102 |
dgisselq |
+
|
7774 |
|
|
+
|
7775 |
|
|
+/* IFCVT_MACHDEP_INIT(CEINFO) ... A C expression to initialize any machine
|
7776 |
|
|
+ * specific data for if-conversion of the if-block in the CEINFO block structure
|
7777 |
|
|
+ * that is pointed by CEINFO.
|
7778 |
|
|
+ *
|
7779 |
|
|
+ *
|
7780 |
|
|
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
|
7781 |
|
|
+ * execution and conditional testing capabilities.
|
7782 |
|
|
+ */
|
7783 |
|
|
+// #warning "Need to come back to this."
|
7784 |
122 |
dgisselq |
+#define IFCVT_MACHDEP_INIT(CEINFO) zip_ifcvt_machdep_init(CEINFO)
|
7785 |
102 |
dgisselq |
+
|
7786 |
|
|
+
|
7787 |
|
|
+/* TARGET_MACHINE_DEPENDENT_REORG(VOID) ... If non-null, this hook performs a
|
7788 |
|
|
+ * target specific pass over the instruction stream. The compiler will run it
|
7789 |
|
|
+ * at all optimization levels, just before the point at which it normally does
|
7790 |
|
|
+ * delayed branch scheduling.
|
7791 |
|
|
+ *
|
7792 |
|
|
+ * You need not implement the hook if it has nothing to do.
|
7793 |
|
|
+ *
|
7794 |
|
|
+ * ZipCPU---This may be part of a later upgrade, but shouldn't be needed to
|
7795 |
|
|
+ * just get us started.
|
7796 |
|
|
+ */
|
7797 |
|
|
+
|
7798 |
|
|
+
|
7799 |
|
|
+/* TARGET_INIT_BUILTINS(VOID) ... Define this hook if you ahve any machine
|
7800 |
|
|
+ * specific builtin functions that need to be defined. It should be a function
|
7801 |
|
|
+ * that performs the necessary setup. Machine specific builtin functions can be
|
7802 |
|
|
+ * useful to expand special machine instructions that would otherwise not
|
7803 |
|
|
+ * normally be generated because they have no equivalent in the source language.
|
7804 |
|
|
+ *
|
7805 |
|
|
+ * To create a built in function, call the function lang_hooks.builtin_function
|
7806 |
|
|
+ * which is defined by the language front end. You can use any type nodes
|
7807 |
|
|
+ * set up by build_common_tree_nodes; only language front ends that use those
|
7808 |
|
|
+ * two functions will call "TARGET_INIT_BUILTINS".
|
7809 |
|
|
+ *
|
7810 |
|
|
+ * ZipCPU---We need to come back to this. We should have several built-ins
|
7811 |
|
|
+ * defined: rtu(), wait(), halt(), save_context(cstackregno), and
|
7812 |
|
|
+ * restore_context(cstackregno).
|
7813 |
|
|
+ *
|
7814 |
|
|
+ */
|
7815 |
|
|
+#undef TARGET_INIT_BUILTINS
|
7816 |
|
|
+#define TARGET_INIT_BUILTINS zip_init_builtins
|
7817 |
|
|
+
|
7818 |
|
|
+/* TARGET_BUILTIN_DECL(CODE,INITP) ... Define this hook if you have any
|
7819 |
|
|
+ * machine specific builtin functions that need to be defined. It should be a
|
7820 |
|
|
+ * function that returns the builtin function declaration for the builtin
|
7821 |
|
|
+ * function code code. If there is no such builtin and it cannot be initialized
|
7822 |
|
|
+ * at this time if INITP is true the function should return NULL_TREE. If
|
7823 |
|
|
+ * CODE is out of range the fucntion should return error-mark_node.
|
7824 |
|
|
+ *
|
7825 |
|
|
+ * ZipCPU ... needs to be done, don't know how to do it yet.
|
7826 |
|
|
+ */
|
7827 |
|
|
+#undef TARGET_BUILTIN_DECL
|
7828 |
|
|
+#define TARGET_BUILTIN_DECL zip_builtin_decl
|
7829 |
|
|
+
|
7830 |
|
|
+
|
7831 |
|
|
+/* TARGET_EXPAND_BUILTIN(TREE,TGT,SUB,MODE,IGNORE) ... Expand a call to a
|
7832 |
|
|
+ * machine specific built-in function that was set up by TARGET_INIT_BUILTINS.
|
7833 |
|
|
+ * TREE is the expression for the function call; the result should go to
|
7834 |
|
|
+ * TGT if that is convenient, and have mode MODE if that is convenient. SUB
|
7835 |
|
|
+ * may be used as the target for computing one of EXP's operands. IGNORE is
|
7836 |
|
|
+ * non-zero if the value is to be ignored. This function should return the
|
7837 |
|
|
+ * result of the call to the built-in function.
|
7838 |
|
|
+ *
|
7839 |
|
|
+ * ZipCPU ... needs to do it, just to get our special intrinsic functions
|
7840 |
|
|
+ */
|
7841 |
|
|
+#define TARGET_EXPAND_BUILTIN zip_expand_builtin
|
7842 |
|
|
+
|
7843 |
|
|
+
|
7844 |
|
|
+/* TARGET_BUILTIN_CHKP_FUNCTION(FCODE) ... Allows the target to redefine
|
7845 |
|
|
+ * builtin functions used by Pointer Bounds Checker for code instrumentation.
|
7846 |
|
|
+ *
|
7847 |
|
|
+ * ZipCPU --- not interested.
|
7848 |
|
|
+ */
|
7849 |
|
|
+/* TARGET_CHKP_BOUND_TYPE
|
7850 |
|
|
+ * TARGET_CHKP_MAKE_BOUNDS_CONSTANT
|
7851 |
|
|
+ * TARGET_CHKP_INITIALIZE_BOUNDS
|
7852 |
|
|
+ *
|
7853 |
|
|
+ * ZipCPU --- Same as last one.
|
7854 |
|
|
+ */
|
7855 |
|
|
+
|
7856 |
|
|
+
|
7857 |
|
|
+/* TARGET_RESOLVE_OVERLOADED_BUILTIN(LOC, FN, ARGS) ... Select a replacement
|
7858 |
|
|
+ * for a machine specific built-in function that was set up by
|
7859 |
|
|
+ * TARGET_INIT_BUILTINS.
|
7860 |
|
|
+ *
|
7861 |
|
|
+ * ZipCPU --- If I go to the trouble to create a builtin, why would I want
|
7862 |
|
|
+ * to then overload it?
|
7863 |
|
|
+ */
|
7864 |
|
|
+
|
7865 |
|
|
+/* TARGET_FOLD_BUILTIN(FN,NARGS,ARGP,IGNORE) ... Fold a call to a machine
|
7866 |
|
|
+ * specific built-in function that was set up by 'TARGET_INIT_BUILTINS' FN
|
7867 |
|
|
+ * is the declaration of the built-in function. NARGS is the number of
|
7868 |
|
|
+ * arguments passed to the function; the arguments themselves are pointed to by
|
7869 |
|
|
+ * ARGP. The result is another tree, valid for both GIMPLE and GENERIC,
|
7870 |
|
|
+ * containing as simplified expression for the call's result. If IGNORE is
|
7871 |
|
|
+ * true the value will be ignored.
|
7872 |
|
|
+ *
|
7873 |
|
|
+ * ZipCPU --- You know, this and the previous couple sound like something
|
7874 |
|
|
+ * whereby I might be able replace bit-reversal code with my bit reverse
|
7875 |
|
|
+ * instruction. That would be very useful, but not necessary to get me
|
7876 |
|
|
+ * started.
|
7877 |
|
|
+ */
|
7878 |
|
|
+
|
7879 |
|
|
+/* TARGET_GIMPLE_FOLD_BUILTIN
|
7880 |
|
|
+ * TARGET_COMPARE_VERSION_PRIORITY
|
7881 |
|
|
+ * TARGET_GET_FUNCTION_VERSIONS_DISPATCHER
|
7882 |
|
|
+ * TARGET_GENERATE_VERSION_DISPATCHER_BODY
|
7883 |
|
|
+ * TARGET_CAN_USE_DOLOOP_P
|
7884 |
|
|
+ * TARGET_INVALID_WITHIN_DOOLOOP
|
7885 |
|
|
+ * TARGET_LEGITIMATE_COMBINED_INSN
|
7886 |
|
|
+ * TARGET_CAN_FOLLOW_JUMP
|
7887 |
|
|
+ * TARGET_COMMUTATIVE_P
|
7888 |
|
|
+ */
|
7889 |
|
|
+
|
7890 |
|
|
+/* TARGET_ALLOCATE_INITIAL_VALUE(REGNO) ... When the initial value of a hard
|
7891 |
|
|
+ * register has been copied in a pseudo register, it is often not necessary
|
7892 |
|
|
+ * ...
|
7893 |
|
|
+ */
|
7894 |
|
|
+/* TARGET_UNSPEC_MAY_TRAP_P(RTX,FLAGS) ... This target hook returns nonzero in
|
7895 |
|
|
+ * RTX, un unspec or unspec_volatile operation, might cause a trap. Targets
|
7896 |
|
|
+ * can use this hook to enhance precision of analysis for unspec and
|
7897 |
|
|
+ * unspec_volatile operations. You may call may_trap_p_1 to analyze inner
|
7898 |
|
|
+ * elements of RTX in which case flags should be passed along.
|
7899 |
|
|
+ */
|
7900 |
|
|
+
|
7901 |
|
|
+/* TARGET_SET_CURRENT_FUNCTION(TREE) The compiler invokes this hook whenever
|
7902 |
|
|
+ * it changes its current function context (CFUN). You can define this
|
7903 |
|
|
+ * function if the back end needs to perform any initialization or reset
|
7904 |
|
|
+ * actions on a per-function basis. For example, it may be used to implement
|
7905 |
|
|
+ * function attributes that affect register usage or code generation patterns.
|
7906 |
|
|
+ */
|
7907 |
|
|
+
|
7908 |
|
|
+/* TARGET_OBJECT_SUFFIX ... Define this macro to be a C string representing the
|
7909 |
|
|
+ * suffix for object files on your target machine. If you do not define this
|
7910 |
|
|
+ * macro, GCC will use ".o" as the suffix for object files.
|
7911 |
|
|
+ */
|
7912 |
|
|
+#define TARGET_OBJECT_SUFFIX ".o"
|
7913 |
|
|
+
|
7914 |
|
|
+/* TARGET_EXECUTABLE_SUFFIX
|
7915 |
|
|
+ */
|
7916 |
|
|
+#define TARGET_EXECUTABLE_SUFFIX ""
|
7917 |
|
|
+
|
7918 |
|
|
+/* COLLECT_EXPORT_LIST ... If defined, collect2 will scan the individual object
|
7919 |
|
|
+ * files specified on its command line and create an export list for the linker.
|
7920 |
|
|
+ * Define this macro for systems like AIX, where the linker discards object
|
7921 |
|
|
+ * files that are not referenced from main and uses export lists.
|
7922 |
|
|
+ *
|
7923 |
|
|
+ * ZipCPU --- shoudln't need this.
|
7924 |
|
|
+ */
|
7925 |
|
|
+
|
7926 |
|
|
+/* MODIFY_JNI_METHOD_CALL(MDECL) ... Define this macro to a C expression
|
7927 |
|
|
+ * representing a variant of the method call mdecl, if Java Native Interface
|
7928 |
|
|
+ * (JNI) methods must be invoked differently from other methods on your
|
7929 |
|
|
+ * target. For example, on 32-bit MSWindows, JNI methods must be invoked
|
7930 |
|
|
+ * using the stdcall calling convention and this macro is then ...
|
7931 |
|
|
+ *
|
7932 |
|
|
+ * ZipCPU----Don't need this. (yet)
|
7933 |
|
|
+ */
|
7934 |
|
|
+
|
7935 |
|
|
+
|
7936 |
|
|
+/* TARGET_CANNOT_MODIFY_JUMPS_P ... This target hook returns true past the
|
7937 |
|
|
+ * point in which a new jump instructions could be created. On machines that
|
7938 |
|
|
+ * require a register for every jump such as the SHmedia ISA of SH5, this point
|
7939 |
|
|
+ * would typically be reload, so thiss target hook should be defined to a
|
7940 |
|
|
+ * function such as:
|
7941 |
|
|
+ *
|
7942 |
117 |
dgisselq |
+ * ZipCPU --- I don't get what this is for.
|
7943 |
|
|
+ * Actually, in hind sight, ZipCPU needs this. Without this, the
|
7944 |
|
|
+ * compiler will try to reorder basic blocks, shuffling logic around and so
|
7945 |
|
|
+ * fortch, preventing our comparison optimizations from being used. By setting
|
7946 |
|
|
+ * this function appropriately, we can prevent it from reversing conditions into
|
7947 |
|
|
+ * conditions we don't support.
|
7948 |
102 |
dgisselq |
+ */
|
7949 |
117 |
dgisselq |
+#define TARGET_CANNOT_MODIFY_JUMPS_P zip_cannot_modify_jumps_p
|
7950 |
102 |
dgisselq |
+
|
7951 |
|
|
+/* TARGET_BRANCH_TARGET_REGISTER_CLASS ... This target hook returns a register
|
7952 |
|
|
+ * class for which branch target register optimizations should be applied. All
|
7953 |
|
|
+ * registers in this class should be usable interchangably. After reload,
|
7954 |
|
|
+ * registers in this class will be re-allocated and loads will be hoisted out of
|
7955 |
|
|
+ * loops and be subjected to inter-block scheduling.
|
7956 |
|
|
+ *
|
7957 |
|
|
+ * ZipCPU---GENERAL_REGS, but this should be a default already ...
|
7958 |
|
|
+ */
|
7959 |
|
|
+
|
7960 |
|
|
+
|
7961 |
|
|
+/* TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED ... Branch target register
|
7962 |
|
|
+ * optimization will by default exclude callee-saved registers that are not
|
7963 |
|
|
+ * already live during the current function. If this target hook returns true,
|
7964 |
|
|
+ * they will be included. The target code must then make sure that all target
|
7965 |
|
|
+ * registers in the class returned by TARGET_BRANCH_REGISTER_CLASS that might
|
7966 |
|
|
+ * be saved are saaved.
|
7967 |
|
|
+ *
|
7968 |
|
|
+ * ZipCPU---
|
7969 |
|
|
+ */
|
7970 |
|
|
+
|
7971 |
|
|
+
|
7972 |
|
|
+/* TARGET_HAVE_CONDITIONAL_EXECUTION(VOID) ... This target hook returns true
|
7973 |
|
|
+ * if the target supports conditional execution. This target hook is required
|
7974 |
|
|
+ * only when the target has several different modes and they have different
|
7975 |
|
|
+ * conditional execution capability, such as ARM.
|
7976 |
|
|
+ *
|
7977 |
|
|
+ * ZipCPU---Yes! All instructions may be conditionally executed (except the
|
7978 |
|
|
+ * long version load immediate ...)
|
7979 |
|
|
+ */
|
7980 |
|
|
+#define TARGET_HAVE_CONDITIONAL_EXECUTION hook_bool_void_true
|
7981 |
|
|
+
|
7982 |
|
|
+/* TARGET_GEN_CCMP_FIRST(PREP,GEN,CODE,OP0,OP1) .. This function prepares to
|
7983 |
|
|
+ * emit a comparison instruction for the first compare in a sequence of
|
7984 |
|
|
+ * conditional comparisons. It returns an appropriate comparison with CC for
|
7985 |
|
|
+ * passing to gen_ccmp_next or cbranch_optab. The instructions to prepare the
|
7986 |
|
|
+ * compare are saved in prep_seq and the compare instructions are saved in
|
7987 |
|
|
+ * gen_seq. They will be emitted when all the compares in the conditional
|
7988 |
|
|
+ * comparison are generated without error. CODE is the rtx_code of the compare
|
7989 |
|
|
+ * for op0 and op1.
|
7990 |
|
|
+ *
|
7991 |
|
|
+ *
|
7992 |
|
|
+ * ZipCPU---???
|
7993 |
|
|
+ */
|
7994 |
|
|
+
|
7995 |
|
|
+/* TARGET_GEN_CCMP_NEXT(PREP,GEN,PREV,CMP,OP0,OP1,BITCODE) ... This function
|
7996 |
|
|
+ * prepares to emit a conditional comparison within a sequence of conditional
|
7997 |
|
|
+ * comparisons. It returns an appropriate comparison with CC for passing to
|
7998 |
|
|
+ * gen_ccmp_next or cbranch_optab. The insn to prepare the compare are saved
|
7999 |
|
|
+ * in prep_seq and the compare instructions are saved in gen_seq. They will be
|
8000 |
|
|
+ * emitted when all the compares in the conditional comparison are generated
|
8001 |
|
|
+ * without error. The pPREV expression is the result of a prior call to either
|
8002 |
|
|
+ * gen_ccmp_first or gen_ccmp_next. It may return NULL if the combination of
|
8003 |
|
|
+ * PREV and this comparison is not supported, otherwise the result must be the
|
8004 |
|
|
+ * appropriate for passing to gen_ccmp_next or cbranch_optab. CODE is the RTX
|
8005 |
|
|
+ * code of the compare for op0 and op1. BITCODE is AND or IOR, which is the op
|
8006 |
|
|
+ * on the compares.
|
8007 |
|
|
+ *
|
8008 |
|
|
+ *
|
8009 |
|
|
+ * ZipCPU --- ???
|
8010 |
|
|
+ */
|
8011 |
|
|
+
|
8012 |
|
|
+/* TARGET_LOOP_UNROLL_ADJUST(NUNROLL, LOOP) ... This target hook returns a new
|
8013 |
|
|
+ * value for the number of times loop should be unrolled. The parameter NUNROLL
|
8014 |
|
|
+ * is the number of times the loop is to be unrolled. The parameter loop is a
|
8015 |
|
|
+ * pointer to the loop, which is going to be checked for unrolling. The target
|
8016 |
|
|
+ * hook is required only when the target has special constraints like maximum number of memory accesses.
|
8017 |
|
|
+ *
|
8018 |
|
|
+ *
|
8019 |
|
|
+ * ZipCPU -- ???
|
8020 |
|
|
+ */
|
8021 |
|
|
+
|
8022 |
|
|
+
|
8023 |
|
|
+/* POWI_MAX_MULTS ... If defined, this macro is interpreted as a signed integer
|
8024 |
|
|
+ * C expression that specifies the maximum number of floating point
|
8025 |
|
|
+ * multiplications that should be emitted when expanding exponentiation by an
|
8026 |
|
|
+ * integer constant inline. When this value is defined, exponentiation
|
8027 |
|
|
+ * requiring more than this number of multiplications is implemented by calling
|
8028 |
|
|
+ * the system library's pow, powf, or powl routines. The default value
|
8029 |
|
|
+ places no upper bound on the multiplication count.
|
8030 |
|
|
+ *
|
8031 |
|
|
+ * ZipCPU---As we have no system library pow() routine (yet) ... we're not
|
8032 |
|
|
+ * ready for this macro.
|
8033 |
|
|
+ */
|
8034 |
|
|
+
|
8035 |
|
|
+
|
8036 |
|
|
+/* TARGET_EXTRA_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
|
8037 |
|
|
+ * register any extra include files for the target. The parameter stdinc
|
8038 |
|
|
+ * indicates if normal include files are present. The parameter SYSROOT is the
|
8039 |
|
|
+ * system root directory. The parameter PFX is the prefix for the GCC
|
8040 |
|
|
+ * directoiry.
|
8041 |
|
|
+ *
|
8042 |
|
|
+ *
|
8043 |
|
|
+ * ZipCPU---None yet.
|
8044 |
|
|
+ */
|
8045 |
|
|
+
|
8046 |
|
|
+/* TARGET_EXTRA_PRE_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
|
8047 |
|
|
+ * register any extrra include files for the target before any standard headers.
|
8048 |
|
|
+ * The parameter stdinc indicates if normal include files are present.
|
8049 |
|
|
+ *
|
8050 |
|
|
+ * ZipCPU --- None.
|
8051 |
|
|
+ */
|
8052 |
|
|
+
|
8053 |
|
|
+/* TARGET_OPTF(PATH) ... This target hook should register special include paths
|
8054 |
|
|
+ * for the target. The parameter path is the integer to register. On Darwin
|
8055 |
|
|
+ * systems, this is used for Framework includes, which have semantics that are
|
8056 |
|
|
+ * different from -I.
|
8057 |
|
|
+ *
|
8058 |
|
|
+ *
|
8059 |
|
|
+ * ZipCPU --- None.
|
8060 |
|
|
+ */
|
8061 |
|
|
+
|
8062 |
|
|
+/* TARGET_USE_LOCAL_THUNK_ALIAS_P(FN) ... This target macro returns if it is
|
8063 |
|
|
+ * safe to use a local alias for a virtual function FN when constructing
|
8064 |
|
|
+ * thunks, false otherwise. By default, the macro returns true for all
|
8065 |
|
|
+ * functions, if a target supports aliases (i.e. defines ASM_OUTPUT_DEF),
|
8066 |
|
|
+ * false otherwise.
|
8067 |
|
|
+ *
|
8068 |
|
|
+ *
|
8069 |
|
|
+ * ZipCPU --- ???
|
8070 |
|
|
+ */
|
8071 |
|
|
+// #warning "ASM_OUTPUT_DEF's definition has not been considered"
|
8072 |
|
|
+
|
8073 |
|
|
+
|
8074 |
|
|
+/* TARGET_FORMAT_TYPES ... If defined, this macro is the name of a global
|
8075 |
|
|
+ * variable containing target-specific format checking information for the
|
8076 |
|
|
+ * -Wformat option. The default is to have no target-specific format checks.
|
8077 |
|
|
+ *
|
8078 |
|
|
+ * ZipCPU --- Default
|
8079 |
|
|
+ */
|
8080 |
|
|
+
|
8081 |
|
|
+/* TARGET_N_FORMAT_TYPES
|
8082 |
|
|
+ *
|
8083 |
|
|
+ * ZipCPU --- Default
|
8084 |
|
|
+ */
|
8085 |
|
|
+
|
8086 |
|
|
+/* TARGET_OVERRIDES_FORMAT_ATTRIBUTES ... If defined, this macro is the name of
|
8087 |
|
|
+ * a global variable containing target-specific format overrides for the
|
8088 |
|
|
+ * -Wformat option. The default is to have no target specific format overrides.
|
8089 |
|
|
+ *
|
8090 |
|
|
+ * ZipCPU --- Default
|
8091 |
|
|
+ */
|
8092 |
|
|
+
|
8093 |
|
|
+/* TARGET_OVERRIDEES_FORMAT_ATTRIBUTES
|
8094 |
|
|
+ * TARGET_OVERRIDEES_FORMAT_ATTRIBUTES_COUNT
|
8095 |
|
|
+ *
|
8096 |
|
|
+ * If defined, the (first) macro is the name of a global variable containing
|
8097 |
|
|
+ * target-specific format overrides for the -Wformat option.
|
8098 |
|
|
+ */
|
8099 |
|
|
+/* TARGET_OVERRIDES_FORMAT_INIT ... If defined, this macro specifies the
|
8100 |
|
|
+ * optional initialization routine for target specific customizations of the
|
8101 |
|
|
+* system printf and scanf formatter settings.
|
8102 |
|
|
+ */
|
8103 |
|
|
+
|
8104 |
|
|
+/* TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN(TLIST,FN,VAL) ... If defined, this
|
8105 |
|
|
+ * macro returns the diagnostic message when it is illegal to pass an argument
|
8106 |
|
|
+ * VAL to function FN with prototype TLIST.
|
8107 |
|
|
+ *
|
8108 |
|
|
+ * ZipCPU---Default.
|
8109 |
|
|
+ */
|
8110 |
|
|
+
|
8111 |
|
|
+/* TARGET_INVALID_CONVERSION
|
8112 |
|
|
+ * TARGET_INVALID_UNARY_OP
|
8113 |
|
|
+ * TARGET_INVALID_BINARY_OP
|
8114 |
|
|
+ * TARGET_INVALID_PARAMETER_TYPE
|
8115 |
|
|
+ * TARGET_INVALID_RETURN_TYPE
|
8116 |
|
|
+ * TARGET_PROMOTED_TYPE
|
8117 |
|
|
+ * TARGET_CONVERT_TO_TYPE
|
8118 |
|
|
+ * TARGET_USE_JCR_SECTION_TYPE
|
8119 |
|
|
+ * OBJC_JBLEN
|
8120 |
|
|
+ * LIBGCC2_UNWIND_ATTRIBUTE
|
8121 |
|
|
+ * TARGET_UPDATE_STACK_BOUNDARY
|
8122 |
|
|
+ * TARGET_GET_DRAP_RTX
|
8123 |
|
|
+ * TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS
|
8124 |
|
|
+ */
|
8125 |
|
|
+/* TARGET_CONST_ANCHOR ... On some architectures it can take multiple
|
8126 |
|
|
+ * instructions to synthesize a constant. If there is another constant already
|
8127 |
|
|
+ * in a register that is close enough in value then it is preferable that the
|
8128 |
|
|
+ * new constant is computed from the register using immediate addition or
|
8129 |
|
|
+ * subtraction. We accomplish this through CSE. Besides the value of the
|
8130 |
|
|
+ * constant we also add a lower and an upper constant anchor to the available
|
8131 |
|
|
+ * expressions. These are then queried when encountering new constants. The
|
8132 |
|
|
+ * anchors are computed by rounding the constant up and down to a multiple of
|
8133 |
|
|
+ * the value of TARGET_CONST_ANCHOR. TARGET_CONST_ANCHOR should be the maximum
|
8134 |
|
|
+ * positive value accepted by immediate-add plus one. We currently assume that
|
8135 |
|
|
+ * the value of TARGET_CONST_ANCHOR is a poewr of 2. For example, on MIPS,
|
8136 |
|
|
+ * where add-immediate takes a 16-bit signed value, TARGET_CONST_ANCHOR is set
|
8137 |
|
|
+ * to 0x8000. The default value is zero, which disables this optimization.
|
8138 |
|
|
+ *
|
8139 |
|
|
+ * ZipCPU---One of the great strengths of the ZipCPU ISA is its ability to
|
8140 |
|
|
+ * access registers plus immediates. To use this, we *need* this capability.
|
8141 |
|
|
+ * So, we define it here. (to 0x20000, or 2^17 because we can handle 18-bits of
|
8142 |
|
|
+ * signed immediate offsets)
|
8143 |
|
|
+ *
|
8144 |
|
|
+ * On ZipCPU---2^17
|
8145 |
|
|
+ */
|
8146 |
|
|
+#define TARGET_CONST_ANCHOR zip_const_anchor
|
8147 |
|
|
+
|
8148 |
|
|
+/* TARGET_ASAN_SHADOW_OFFSET ... Return the offset bitwise ored into shifted
|
8149 |
|
|
+ * address to get corresponding Address Sanitizer shadow memory address. NULL
|
8150 |
|
|
+ * if address Sanitizer is not supported by the target.
|
8151 |
|
|
+ */
|
8152 |
|
|
+#define TARGET_ASAN_SHADOW_OFFSET NULL
|
8153 |
|
|
+
|
8154 |
|
|
+/* TARGET_MEMMODEL_CHECK
|
8155 |
|
|
+ */
|
8156 |
|
|
+/* TARGET_ATOMIC_TEST_AND_SET_TRUEVAL ... This value should be set if the result
|
8157 |
|
|
+ * written by atomic test and set is not exactly 1, i.e. the bool true.
|
8158 |
|
|
+ */
|
8159 |
|
|
+/* TARGET_HAS_IFUNC_P ... It returns true if the target supports GNU indirect
|
8160 |
|
|
+ * functions. The support includes the assembler, linker, and dynamic linker.
|
8161 |
|
|
+ * The default value of this hook is based on target's libc.
|
8162 |
|
|
+ */
|
8163 |
|
|
+#define TARGET_HAS_IFUNC_P hook_bool_void_true
|
8164 |
|
|
+
|
8165 |
|
|
+/* TARGET_ATOMIC_ALIGN_FOR_MODE(MODE) ... If defined, this function returns
|
8166 |
|
|
+ * an appropriate alignment in bits for an atomic object of machine mode
|
8167 |
|
|
+ * MODE. If 0 is returned then the default alignment for the specified mode
|
8168 |
|
|
+ * is used.
|
8169 |
|
|
+ *
|
8170 |
|
|
+ * ZipCPU---Both default and 2 would be valid. We'll stick to the default.
|
8171 |
|
|
+ */
|
8172 |
|
|
+
|
8173 |
|
|
+/* TARGET_ATOMIC_ASSIGN_EXPAND_FENV --- ISO C11 requires atomic compound
|
8174 |
|
|
+ * assignments that may raise floating-point exceptions to raise exceptions
|
8175 |
|
|
+ * corresponding to the arithmetic operation whose result was successfully
|
8176 |
|
|
+ * stored in a compare-and-exchange sequence. This requires code equivalent to
|
8177 |
|
|
+ * calls to feholdexcept, feclearexcept and feupdateenv to be generated at
|
8178 |
|
|
+ * appropriate points in the compare-and-exchange sequence. This hook should
|
8179 |
|
|
+ * set *hold to an expression equivalent
|
8180 |
|
|
+ *
|
8181 |
|
|
+ * ZipCPU --- ???
|
8182 |
|
|
+ */
|
8183 |
|
|
+
|
8184 |
|
|
+/* TARGET_RECORD_OFFLOAD_SYMBOL ... Used when offloaded functions are seen in
|
8185 |
|
|
+ * the compilation unit and no named sections are available. It is called once
|
8186 |
|
|
+ * for each symbol that must be recorded in the offload function and variable
|
8187 |
|
|
+ * table.
|
8188 |
|
|
+ *
|
8189 |
|
|
+ * ZipCPU --- Offloaded functions?
|
8190 |
|
|
+ */
|
8191 |
|
|
+
|
8192 |
|
|
+/* TARGET_OFFLOAD_OPTIONS
|
8193 |
|
|
+ *
|
8194 |
|
|
+ * ZipCPU---none defined
|
8195 |
|
|
+ */
|
8196 |
|
|
+
|
8197 |
|
|
+/* TARGET_SUPPORTS_WIDE_INT ... On older ports, large integers are stored
|
8198 |
|
|
+ * in CONST_DOUBLE rtl objects. Newer ports define TARGET_SUPPORTS_WIDE_INT
|
8199 |
|
|
+ * to be nonzero to indicate that large integers are stored in CONST_WIDE_INT
|
8200 |
|
|
+ * rtl objects. The CONST_WIDE_INT allows very large integer constants to be
|
8201 |
|
|
+ * represented. CONST_DOUBLE is limited to twice the size of the hosts
|
8202 |
|
|
+ * HOST_WIDE_INT representation.
|
8203 |
|
|
+ *
|
8204 |
|
|
+ * ZipCPU---We don't need these yet, so this isn't yet relevant. (These ints
|
8205 |
|
|
+ * are wider than DImode ...)
|
8206 |
|
|
+ */
|
8207 |
|
|
+#define TARGET_SUPPORTS_WIDE_INT 0
|
8208 |
|
|
+
|
8209 |
|
|
+
|
8210 |
|
|
+/* Now, for the prototype functions ...*/
|
8211 |
|
|
+// These have been moved to zip-protos.h
|
8212 |
|
|
+
|
8213 |
|
|
+// extern void zip_init_builtins(void);
|
8214 |
|
|
+// extern void zip_asm_output_anchor(rtx x);
|
8215 |
|
|
+// extern bool zip_legitimate_address_p(enum machine_mode mode, rtx x, bool string);
|
8216 |
|
|
+// extern void zip_asm_trampoline_template(FILE *);
|
8217 |
|
|
+// extern void zip_initial_elimination_offset(int from, int to);
|
8218 |
|
|
+// extern void zip_print_operand(FILE *stream, rtx *x, int code);
|
8219 |
|
|
+// extern void zip_print_operand_address(FILE *stream, rtx *x);
|
8220 |
|
|
+// extern void zip_asm_output_def(FILE *s, const char *n, const char *v);
|
8221 |
|
|
+// extern void zip_update_cc_notice(rtx exp, rtx_insn *insn);
|
8222 |
|
|
+// extern int zip_address_operand(rtx op);
|
8223 |
|
|
+// extern int zip_const_address_operand(rtx op);
|
8224 |
|
|
+// extern void zip_expand_prologue(void);
|
8225 |
|
|
+// extern void zip_expand_epilogue(void);
|
8226 |
|
|
+// extern bool zip_gen_move_rtl(rtx, rtx);
|
8227 |
|
|
+// extern bool zip_load_address_lod(rtx, rtx);
|
8228 |
|
|
+// extern bool zip_load_address_sto(rtx, rtx);
|
8229 |
|
|
+// extern void zip_print_operand(FILE *fp, rtx x, int code);
|
8230 |
|
|
+// extern void zip_print_operand_address(FILE *fp, rtx x);
|
8231 |
202 |
dgisselq |
+extern int zip_use_return_insn(void);
|
8232 |
102 |
dgisselq |
+
|
8233 |
|
|
+#include "insn-modes.h"
|
8234 |
200 |
dgisselq |
+// #include "zip-protos.h" // Cant include this here!
|
8235 |
102 |
dgisselq |
+
|
8236 |
|
|
+#endif /* GCC_ZIP_H */
|
8237 |
|
|
+
|
8238 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/config/zip/zip.md gcc-6.2.0-zip/gcc/config/zip/zip.md
|
8239 |
|
|
--- gcc-6.2.0/gcc/config/zip/zip.md 1969-12-31 19:00:00.000000000 -0500
|
8240 |
|
|
+++ gcc-6.2.0-zip/gcc/config/zip/zip.md 2017-03-07 12:02:29.862582673 -0500
|
8241 |
|
|
@@ -0,0 +1,1968 @@
|
8242 |
102 |
dgisselq |
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8243 |
|
|
+;;
|
8244 |
|
|
+;; Filename: zip.md
|
8245 |
|
|
+;;
|
8246 |
|
|
+;; Project: Zip CPU -- a small, lightweight, RISC CPU soft core
|
8247 |
|
|
+;;
|
8248 |
|
|
+;; Purpose: This is the machine description of the Zip CPU as needed by the
|
8249 |
|
|
+;; GNU compiler collection (GCC).
|
8250 |
|
|
+;;
|
8251 |
|
|
+;;
|
8252 |
|
|
+;; Creator: Dan Gisselquist, Ph.D.
|
8253 |
|
|
+;; Gisselquist Technology, LLC
|
8254 |
|
|
+;;
|
8255 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8256 |
|
|
+;;
|
8257 |
202 |
dgisselq |
+;; Copyright (C) 2015-2017, Gisselquist Technology, LLC
|
8258 |
102 |
dgisselq |
+;;
|
8259 |
|
|
+;; This program is free software (firmware): you can redistribute it and/or
|
8260 |
|
|
+;; modify it under the terms of the GNU General Public License as published
|
8261 |
|
|
+;; by the Free Software Foundation, either version 3 of the License, or (at
|
8262 |
|
|
+;; your option) any later version.
|
8263 |
|
|
+;;
|
8264 |
|
|
+;; This program is distributed in the hope that it will be useful, but WITHOUT
|
8265 |
|
|
+;; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
8266 |
|
|
+;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
8267 |
|
|
+;; for more details.
|
8268 |
|
|
+;;
|
8269 |
|
|
+;; License: GPL, v3, as defined and found on www.gnu.org,
|
8270 |
|
|
+;; http://www.gnu.org/licenses/gpl.html
|
8271 |
|
|
+;;
|
8272 |
|
|
+;;
|
8273 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8274 |
|
|
+;;
|
8275 |
|
|
+;;
|
8276 |
|
|
+;; - Immediate integer operand constraints
|
8277 |
|
|
+;; 'I' -2^22 ... 2^22-1, or -4194304 .. 4194303 (LDI insn)
|
8278 |
202 |
dgisselq |
+;; 'x' -2^17 ... 2^17-1, (DI const)
|
8279 |
|
|
+;; 'K' 0...2^17-2 (ucmp offset)
|
8280 |
102 |
dgisselq |
+;; 'M' -2^12 ... 2^12-1, or -4096 ... 4095 (MOV offset)
|
8281 |
|
|
+;; 'N' -2^14 ... 2^14-1, or -16384 ... 16383 (OpB offset)
|
8282 |
|
|
+;; 'O' -2^17 ... 2^17-1, or -131072 ... 131071 (OpB Immediate)
|
8283 |
|
|
+;; 'R' 0...31 (Shift value)
|
8284 |
|
|
+;; - Memory constraints
|
8285 |
111 |
dgisselq |
+;; "Q" Op-B capable references to memory
|
8286 |
|
|
+;; "S" References to constant memory
|
8287 |
102 |
dgisselq |
+;; - Address constraints
|
8288 |
111 |
dgisselq |
+;; "U" Op-B capable address that references to memory
|
8289 |
|
|
+;; "T" Constant memory addresses
|
8290 |
202 |
dgisselq |
+(define_constraint "x"
|
8291 |
|
|
+ "An 17-bit signed immediate such as a CMP:DI instruction can handle"
|
8292 |
|
|
+ (and (match_code "const_wide_int")
|
8293 |
|
|
+ (match_test "(ival < 0x20000l) && (ival >= -0x20000l)")))
|
8294 |
|
|
+(define_constraint "K"
|
8295 |
|
|
+ "An 17-bit signed immediate such as a CMP:DI instruction can handle"
|
8296 |
|
|
+ (and (match_code "const_int")
|
8297 |
|
|
+ (match_test "(ival < 0x20000) && (ival >= -0x20000)")))
|
8298 |
102 |
dgisselq |
+(define_constraint "M"
|
8299 |
|
|
+ "An 13-bit signed immediate such as a MOV instruction can handle"
|
8300 |
|
|
+ (and (match_code "const_int")
|
8301 |
|
|
+ (match_test "(ival < 0x1000) && (ival >= -0x1000)")))
|
8302 |
|
|
+(define_constraint "N"
|
8303 |
|
|
+ "An 14-bit signed immediate offset such as an Op-B register offset"
|
8304 |
|
|
+ (and (match_code "const_int")
|
8305 |
|
|
+ (match_test "(ival < 0x2000) && (ival >= -0x2000)")))
|
8306 |
|
|
+(define_constraint "O"
|
8307 |
|
|
+ "An 18-bit signed immediate such as an Op-B Immediate can handle"
|
8308 |
|
|
+ (and (match_code "const_int")
|
8309 |
|
|
+ (match_test "(ival < 0x20000) && (ival >= -0x20000)")))
|
8310 |
|
|
+(define_constraint "R"
|
8311 |
|
|
+ "Bits that a value may be shifted"
|
8312 |
|
|
+ (and (match_code "const_int")
|
8313 |
|
|
+ (match_test "(ival < 32) && (ival >= 0)")))
|
8314 |
|
|
+;;
|
8315 |
|
|
+;
|
8316 |
|
|
+;
|
8317 |
|
|
+; Our builtin functions, by identifier
|
8318 |
|
|
+;
|
8319 |
|
|
+(define_constants
|
8320 |
117 |
dgisselq |
+ [(UNSPEC_RTU 1)
|
8321 |
|
|
+ (UNSPEC_HALT 2)
|
8322 |
|
|
+ (UNSPEC_IDLE 3)
|
8323 |
|
|
+ (UNSPEC_SYSCALL 4)
|
8324 |
|
|
+ (UNSPEC_SAVE_CONTEXT 5)
|
8325 |
|
|
+ (UNSPEC_RESTORE_CONTEXT 6)
|
8326 |
|
|
+ (UNSPEC_BITREV 7)
|
8327 |
|
|
+ (UNSPEC_GETUCC 8)
|
8328 |
|
|
+ (UNSPEC_GETCC 9)
|
8329 |
|
|
+ (UNSPEC_LDILO 10)
|
8330 |
127 |
dgisselq |
+ ; (UNSPEC_RAW_CALL 11)
|
8331 |
102 |
dgisselq |
+ ])
|
8332 |
|
|
+;
|
8333 |
|
|
+;
|
8334 |
|
|
+; Registers by name
|
8335 |
|
|
+(define_constants
|
8336 |
|
|
+ [(RTN_REG 0) ; Return address register
|
8337 |
|
|
+ (RTNV_REG 1) ; Subroutine return value register
|
8338 |
|
|
+ (AP_REG 10) ; Hopefully never used
|
8339 |
|
|
+ (GBL_REG 11) ; Hopefully never used, but just in case ...
|
8340 |
|
|
+ (FP_REG 12)
|
8341 |
|
|
+ (SP_REG 13)
|
8342 |
|
|
+ (CC_REG 14)
|
8343 |
|
|
+ (PC_REG 15)
|
8344 |
|
|
+ ])
|
8345 |
|
|
+;
|
8346 |
|
|
+;
|
8347 |
|
|
+;
|
8348 |
200 |
dgisselq |
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8349 |
|
|
+;;
|
8350 |
202 |
dgisselq |
+;; Mode iterator
|
8351 |
|
|
+;;
|
8352 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8353 |
|
|
+;
|
8354 |
|
|
+;
|
8355 |
|
|
+(define_mode_iterator ZI [QI HI SI])
|
8356 |
|
|
+(define_mode_attr sz [(QI "B") (HI "H") (SI "W")])
|
8357 |
|
|
+;
|
8358 |
|
|
+;
|
8359 |
|
|
+;
|
8360 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8361 |
|
|
+;;
|
8362 |
102 |
dgisselq |
+;; Predicates
|
8363 |
200 |
dgisselq |
+;;
|
8364 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8365 |
|
|
+;
|
8366 |
|
|
+;
|
8367 |
|
|
+;
|
8368 |
102 |
dgisselq |
+(define_predicate "zip_const_address_operand_p"
|
8369 |
|
|
+ (match_code "symbol_ref,const,label_ref,code_label")
|
8370 |
|
|
+{
|
8371 |
|
|
+ return zip_const_address_operand(op);
|
8372 |
|
|
+})
|
8373 |
|
|
+
|
8374 |
|
|
+(define_predicate "zip_address_operand_p"
|
8375 |
|
|
+ (match_code "reg,plus")
|
8376 |
|
|
+{
|
8377 |
111 |
dgisselq |
+ return zip_pd_opb_operand(op);
|
8378 |
102 |
dgisselq |
+})
|
8379 |
|
|
+
|
8380 |
111 |
dgisselq |
+(define_predicate "zip_opb_operand_p"
|
8381 |
122 |
dgisselq |
+ (match_code "reg,plus,const_int,subreg")
|
8382 |
111 |
dgisselq |
+{
|
8383 |
|
|
+ return zip_pd_opb_operand(op);
|
8384 |
|
|
+})
|
8385 |
|
|
+
|
8386 |
122 |
dgisselq |
+(define_predicate "zip_opb_immv_p"
|
8387 |
|
|
+ (match_code "const_int")
|
8388 |
|
|
+{
|
8389 |
|
|
+ return (INTVAL(op)<((1<<13)-1))&&(INTVAL(op)>=-((1<<13)));
|
8390 |
|
|
+})
|
8391 |
|
|
+
|
8392 |
111 |
dgisselq |
+(define_predicate "zip_opb_single_operand_p"
|
8393 |
122 |
dgisselq |
+ (match_code "reg,subreg,const_int")
|
8394 |
111 |
dgisselq |
+{
|
8395 |
|
|
+ return zip_pd_opb_operand(op);
|
8396 |
|
|
+})
|
8397 |
|
|
+
|
8398 |
102 |
dgisselq |
+(define_predicate "zip_mov_operand_p"
|
8399 |
|
|
+ (match_code "reg,plus")
|
8400 |
|
|
+{
|
8401 |
|
|
+ return zip_pd_mov_operand(op);
|
8402 |
|
|
+})
|
8403 |
|
|
+
|
8404 |
|
|
+(define_predicate "zip_memory_operand_p"
|
8405 |
|
|
+ (match_code "mem")
|
8406 |
|
|
+{
|
8407 |
111 |
dgisselq |
+ return zip_pd_opb_operand(XEXP(op,0));
|
8408 |
102 |
dgisselq |
+})
|
8409 |
|
|
+
|
8410 |
111 |
dgisselq |
+(define_predicate "zip_imm_operand_p"
|
8411 |
|
|
+ (match_code "const_int")
|
8412 |
|
|
+{
|
8413 |
|
|
+ return zip_pd_imm_operand(op);
|
8414 |
|
|
+})
|
8415 |
|
|
+
|
8416 |
|
|
+(define_predicate "zip_mvimm_operand_p"
|
8417 |
|
|
+ (match_code "const_int")
|
8418 |
|
|
+{
|
8419 |
|
|
+ return zip_pd_mvimm_operand(op);
|
8420 |
|
|
+})
|
8421 |
|
|
+
|
8422 |
202 |
dgisselq |
+;
|
8423 |
|
|
+; zip_movdst_operand_p and zip_movsrc_operand_p are no longer necessary, and
|
8424 |
|
|
+; are being deprecated.
|
8425 |
|
|
+;
|
8426 |
|
|
+;(define_predicate "zip_movdst_operand_p"
|
8427 |
|
|
+; (match_code "mem,reg,subreg")
|
8428 |
|
|
+;{
|
8429 |
|
|
+; if (MEM_P(op)) // Check for valid store address
|
8430 |
|
|
+; return zip_pd_opb_operand(XEXP(op,0));
|
8431 |
|
|
+; else if ((SUBREG_P(op))&&(REG_P(XEXP(op,0))))
|
8432 |
|
|
+; return 1;
|
8433 |
|
|
+; else if (REG_P(op))
|
8434 |
|
|
+; return register_operand(op, GET_MODE(op));
|
8435 |
|
|
+; return 1;
|
8436 |
|
|
+;})
|
8437 |
111 |
dgisselq |
+
|
8438 |
202 |
dgisselq |
+;(define_predicate "zip_movsrc_operand_p"
|
8439 |
|
|
+; (match_code "mem,reg,subreg,const_int,const,symbol_ref,label_ref,code_label")
|
8440 |
|
|
+;{
|
8441 |
|
|
+; if (MEM_P(op))
|
8442 |
|
|
+; return zip_pd_opb_operand(XEXP(op,0));
|
8443 |
|
|
+; else if (GET_CODE(op)==PLUS)
|
8444 |
|
|
+; return zip_pd_opb_operand(op);
|
8445 |
|
|
+; else if ((SUBREG_P(op))&&(REG_P(XEXP(op,0)))) {
|
8446 |
|
|
+; //; As far as predicates are concerned, subregs must be valid.
|
8447 |
|
|
+; //; The details of them are settled within the constraints.
|
8448 |
|
|
+; return 1;
|
8449 |
|
|
+; } else if ((REG_P(op))||(SUBREG_P(op)))
|
8450 |
|
|
+; return register_operand(op,SImode);
|
8451 |
|
|
+; else if (CONST_INT_P(op))
|
8452 |
|
|
+; return 1;
|
8453 |
|
|
+; return 1;
|
8454 |
|
|
+;})
|
8455 |
111 |
dgisselq |
+
|
8456 |
200 |
dgisselq |
+;
|
8457 |
|
|
+;
|
8458 |
|
|
+;
|
8459 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8460 |
|
|
+;;
|
8461 |
102 |
dgisselq |
+;; Constraints
|
8462 |
200 |
dgisselq |
+;;
|
8463 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8464 |
102 |
dgisselq |
+;
|
8465 |
200 |
dgisselq |
+;
|
8466 |
|
|
+;
|
8467 |
102 |
dgisselq |
+(define_memory_constraint "S"
|
8468 |
|
|
+ "Any memory referenced by a constant address, possibly unknown at compile time"
|
8469 |
|
|
+ (and (match_code "mem")
|
8470 |
|
|
+ (match_test "zip_ct_const_address_operand(XEXP(op,0))")))
|
8471 |
|
|
+(define_memory_constraint "Q"
|
8472 |
|
|
+ "Any memory addressed suitably for a load or store instruction"
|
8473 |
|
|
+ (and (match_code "mem")
|
8474 |
|
|
+ (match_test "zip_ct_address_operand(XEXP(op,0))")))
|
8475 |
|
|
+(define_address_constraint "U"
|
8476 |
|
|
+ "An address suitable for a load or store instruction"
|
8477 |
|
|
+ (and (match_code "reg,plus")
|
8478 |
|
|
+ (match_test "zip_ct_address_operand(op)")))
|
8479 |
|
|
+(define_address_constraint "T"
|
8480 |
|
|
+ "Any constant address, to include those made by symbols unknown at compile time"
|
8481 |
|
|
+ (and (match_code "label_ref,code_label,symbol_ref,const")
|
8482 |
|
|
+ (match_test "zip_ct_const_address_operand(op)")))
|
8483 |
|
|
+;
|
8484 |
|
|
+;
|
8485 |
200 |
dgisselq |
+;
|
8486 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8487 |
|
|
+;;
|
8488 |
102 |
dgisselq |
+;; Attributes
|
8489 |
200 |
dgisselq |
+;;
|
8490 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8491 |
102 |
dgisselq |
+;
|
8492 |
200 |
dgisselq |
+;
|
8493 |
|
|
+;
|
8494 |
|
|
+;
|
8495 |
|
|
+;
|
8496 |
102 |
dgisselq |
+(define_attr "predicable" "no,yes" (const_string "yes"))
|
8497 |
|
|
+(define_attr "ccresult" "set,unknown,unchanged,validzn" (const_string "set"))
|
8498 |
|
|
+;
|
8499 |
|
|
+;
|
8500 |
|
|
+;
|
8501 |
|
|
+;
|
8502 |
200 |
dgisselq |
+;
|
8503 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8504 |
|
|
+;;
|
8505 |
102 |
dgisselq |
+;; Instructions
|
8506 |
200 |
dgisselq |
+;;
|
8507 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8508 |
102 |
dgisselq |
+;
|
8509 |
200 |
dgisselq |
+;
|
8510 |
|
|
+;
|
8511 |
|
|
+;; Instructions
|
8512 |
|
|
+;
|
8513 |
102 |
dgisselq |
+; (define_insn
|
8514 |
|
|
+; optional name
|
8515 |
|
|
+; RTL template -- a vector of incomplete RTL expressions describing the
|
8516 |
|
|
+; semantics of the instruction. It is incomplete because it may
|
8517 |
|
|
+; contain match_operand, match_operator, and match_dup expressions
|
8518 |
|
|
+; The condition --- contains a C expression, may be an empty string
|
8519 |
|
|
+; output template or output statement--fragment of C code returning a str
|
8520 |
|
|
+; Attributes --
|
8521 |
|
|
+; )
|
8522 |
|
|
+;
|
8523 |
|
|
+; (match_operand:m n predicate constraint)
|
8524 |
|
|
+; Placeholder for operand #n of the instruction
|
8525 |
|
|
+; Predicate string that is the name of a fucntion w/ 2 arguments:
|
8526 |
|
|
+; (expression, machine mode)
|
8527 |
|
|
+; we can build functions:
|
8528 |
|
|
+; "isregister" to describe a register
|
8529 |
|
|
+; "isimmediate" to describe an immediate
|
8530 |
|
|
+; "offsetreg" to describe a register plus offset
|
8531 |
|
|
+; "anyregister" to describe *ANY* register (uRx or Rx)
|
8532 |
|
|
+; But ... functions "address_operand", "immediate_operand",
|
8533 |
|
|
+; "register_operand", "indirect_operand"
|
8534 |
|
|
+; "comparison_operatot" and "ordered_comparison_operator"
|
8535 |
|
|
+; are also available--be aware, they include more comparisons
|
8536 |
|
|
+; than Zip CPU can do.
|
8537 |
|
|
+;
|
8538 |
|
|
+;
|
8539 |
|
|
+;
|
8540 |
|
|
+;
|
8541 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8542 |
|
|
+;;
|
8543 |
|
|
+;; Move instructions: both
|
8544 |
200 |
dgisselq |
+;; (arbitrary) from variables to variables, but this gets
|
8545 |
|
|
+;; expanded into:
|
8546 |
|
|
+;; from registers to registers
|
8547 |
|
|
+;; from immediates to registers
|
8548 |
102 |
dgisselq |
+;;
|
8549 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8550 |
|
|
+;
|
8551 |
|
|
+;
|
8552 |
|
|
+;
|
8553 |
|
|
+(define_expand "mov<mode>"
|
8554 |
111 |
dgisselq |
+ [(set (match_operand:ZI 0 "nonimmediate_operand" "")
|
8555 |
|
|
+ (match_operand:ZI 1 "general_operand" ""))]
|
8556 |
102 |
dgisselq |
+ ""
|
8557 |
111 |
dgisselq |
+ {//; Everything except mem=const or mem=mem can be done easily
|
8558 |
|
|
+ //; extern void zip_debug_rtx_pfx(const char *, const_rtx);
|
8559 |
|
|
+ //; fprintf(stderr, "ZIP-GEN-MOVE\n");
|
8560 |
|
|
+ //; zip_debug_rtx_pfx("FROM: ", operands[1]);
|
8561 |
|
|
+ //; zip_debug_rtx_pfx("TO : ", operands[0]);
|
8562 |
|
|
+
|
8563 |
|
|
+ //; Need to load into a register between memory slots
|
8564 |
|
|
+ if ((MEM_P(operands[0]))&&(MEM_P(operands[1]))) {
|
8565 |
|
|
+ //; fprintf(stderr, "GEN-MOVSI: MEM -> MEM\n");
|
8566 |
|
|
+ if (can_create_pseudo_p()) {
|
8567 |
|
|
+ rtx tmp = gen_reg_rtx(GET_MODE(operands[1]));
|
8568 |
202 |
dgisselq |
+ if (GET_MODE(operands[1])==QImode)
|
8569 |
|
|
+ emit_insn(gen_movqi(tmp,operands[1]));
|
8570 |
|
|
+ else if (GET_MODE(operands[1])==HImode)
|
8571 |
|
|
+ emit_insn(gen_movhi(tmp,operands[1]));
|
8572 |
|
|
+ else
|
8573 |
|
|
+ emit_insn(gen_movsi(tmp,operands[1]));
|
8574 |
111 |
dgisselq |
+ operands[1] = tmp;
|
8575 |
|
|
+ }
|
8576 |
202 |
dgisselq |
+ }}
|
8577 |
102 |
dgisselq |
+ [(set_attr "ccresult" "unchanged")])
|
8578 |
202 |
dgisselq |
+(define_insn "mov<mode>_raw"
|
8579 |
|
|
+ [(set (match_operand:ZI 0 "nonimmediate_operand" "=r,Q,r,r")
|
8580 |
|
|
+ (match_operand:ZI 1 "general_operand" "r,r,Q,i"))]
|
8581 |
|
|
+ ""
|
8582 |
111 |
dgisselq |
+ "@
|
8583 |
|
|
+ MOV\t%1,%0
|
8584 |
202 |
dgisselq |
+ S<sz>\t%1,%0
|
8585 |
|
|
+ L<sz>\t%1,%0
|
8586 |
111 |
dgisselq |
+ LDI\t%1,%0"
|
8587 |
|
|
+ [(set_attr "ccresult" "unchanged")])
|
8588 |
202 |
dgisselq |
+(define_insn "movsi_reg_off" ; Register to register move, used by prologue
|
8589 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
8590 |
|
|
+ (plus:SI (match_operand:SI 1 "register_operand" "r")
|
8591 |
|
|
+ (match_operand:SI 2 "zip_mvimm_operand_p" "M")))
|
8592 |
111 |
dgisselq |
+ ]
|
8593 |
102 |
dgisselq |
+ ""
|
8594 |
|
|
+ "MOV %2(%1),%0"
|
8595 |
|
|
+ [(set_attr "ccresult" "unchanged")])
|
8596 |
202 |
dgisselq |
+(define_insn "mov<mode>_lod" ; Load from memory
|
8597 |
102 |
dgisselq |
+ [(set (match_operand:ZI 0 "register_operand" "=r")
|
8598 |
|
|
+ (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
|
8599 |
|
|
+ ""
|
8600 |
202 |
dgisselq |
+ "L<sz>\t%1,%0"
|
8601 |
103 |
dgisselq |
+ [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
|
8602 |
202 |
dgisselq |
+(define_insn "mov<mode>_lod_off" ; used by epilogue code
|
8603 |
|
|
+ [(set (match_operand:ZI 0 "register_operand" "=r")
|
8604 |
|
|
+ (mem:ZI (plus:SI (match_operand:SI 1 "register_operand" "r")
|
8605 |
|
|
+ (match_operand:SI 2 "zip_opb_immv_p" "N"))))]
|
8606 |
124 |
dgisselq |
+ ""
|
8607 |
202 |
dgisselq |
+ "L<sz>\t%2(%1),%0"
|
8608 |
124 |
dgisselq |
+ [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
|
8609 |
202 |
dgisselq |
+(define_insn "mov<mode>_sto" ; Store into memory
|
8610 |
102 |
dgisselq |
+ [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
|
8611 |
|
|
+ (match_operand:ZI 1 "register_operand" "r"))]
|
8612 |
|
|
+ ""
|
8613 |
202 |
dgisselq |
+ "S<sz>\t%1,%0"
|
8614 |
103 |
dgisselq |
+ [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
|
8615 |
202 |
dgisselq |
+(define_insn "mov<mode>_sto_off" ; used by prologue code
|
8616 |
|
|
+ [(set (mem:ZI (plus:SI
|
8617 |
124 |
dgisselq |
+ (match_operand:SI 0 "register_operand" "r")
|
8618 |
202 |
dgisselq |
+ (match_operand:SI 1 "zip_opb_immv_p" "N")))
|
8619 |
|
|
+ (match_operand:ZI 2 "register_operand" "r"))]
|
8620 |
124 |
dgisselq |
+ ""
|
8621 |
202 |
dgisselq |
+ "S<sz>\t%2,%1(%0)"
|
8622 |
124 |
dgisselq |
+ [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
|
8623 |
102 |
dgisselq |
+(define_insn "mov<mode>_ldi" ; Load immediate
|
8624 |
|
|
+ [(set (match_operand:ZI 0 "register_operand" "=r")
|
8625 |
|
|
+ (match_operand:ZI 1 "immediate_operand" "ipU"))]
|
8626 |
|
|
+ ""
|
8627 |
|
|
+ "LDI %1,%0"
|
8628 |
|
|
+ [(set_attr "ccresult" "unchanged")])
|
8629 |
|
|
+;
|
8630 |
|
|
+;
|
8631 |
|
|
+;
|
8632 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8633 |
|
|
+;;
|
8634 |
|
|
+;; Load and store multiple values
|
8635 |
|
|
+;;
|
8636 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8637 |
|
|
+;
|
8638 |
|
|
+; So far, from the code I've seen from GCC's output,
|
8639 |
|
|
+; these instructions do not appear to be necessary.
|
8640 |
|
|
+;
|
8641 |
|
|
+;(define_insn "load_multiple"
|
8642 |
|
|
+; for(a=0; a<%2; a++)
|
8643 |
202 |
dgisselq |
+; LW a(%1),%0+a
|
8644 |
102 |
dgisselq |
+;(define_insn "store_multiple"
|
8645 |
|
|
+; for(a=0; a<%2; a++)
|
8646 |
202 |
dgisselq |
+; SW %0+a,a(%1)
|
8647 |
102 |
dgisselq |
+; pushsi -- Do not define, compiler will work around it nicely w/o our help
|
8648 |
|
|
+;
|
8649 |
|
|
+;
|
8650 |
|
|
+;
|
8651 |
|
|
+;
|
8652 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8653 |
|
|
+;;
|
8654 |
127 |
dgisselq |
+;; Substitution Pattern
|
8655 |
|
|
+;;
|
8656 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8657 |
|
|
+;
|
8658 |
|
|
+;
|
8659 |
|
|
+(define_subst "cc_substitution"
|
8660 |
|
|
+ ; The pattern may not have any match_dup expressions.
|
8661 |
|
|
+ [(set (match_operand:SI 0 "" "") (match_operand:SI 1 "" ""))
|
8662 |
|
|
+ (clobber (reg:CC CC_REG))]
|
8663 |
|
|
+ ""
|
8664 |
|
|
+ [(set (match_dup 0) (match_dup 1))
|
8665 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))
|
8666 |
|
|
+ ])
|
8667 |
|
|
+;
|
8668 |
|
|
+(define_subst_attr "cc_subst" "cc_substitution" "_raw" "_clobber")
|
8669 |
|
|
+;
|
8670 |
|
|
+;
|
8671 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8672 |
|
|
+;;
|
8673 |
202 |
dgisselq |
+;; Mode conversions
|
8674 |
102 |
dgisselq |
+;;
|
8675 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8676 |
|
|
+;
|
8677 |
|
|
+;
|
8678 |
202 |
dgisselq |
+(define_insn "zero_extendqisi2"
|
8679 |
122 |
dgisselq |
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
8680 |
202 |
dgisselq |
+ (zero_extend:SI
|
8681 |
|
|
+ (match_operand:QI 1 "register_operand" "0")))
|
8682 |
127 |
dgisselq |
+ (clobber (reg:CC CC_REG))]
|
8683 |
|
|
+ ""
|
8684 |
202 |
dgisselq |
+ "AND\t255,%0 ; zero_extendqisi2 ... reg"
|
8685 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "set")])
|
8686 |
|
|
+
|
8687 |
|
|
+(define_insn "zero_extendqisi2_raw"
|
8688 |
127 |
dgisselq |
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
8689 |
202 |
dgisselq |
+ (zero_extend:SI
|
8690 |
|
|
+ (match_operand:QI 1 "register_operand" "0")))
|
8691 |
122 |
dgisselq |
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
|
8692 |
102 |
dgisselq |
+ ""
|
8693 |
202 |
dgisselq |
+ "AND\t255,%0 ; zero_extendqisi2 ... raw/set CC"
|
8694 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "set")])
|
8695 |
|
|
+
|
8696 |
|
|
+(define_insn "zero_extendqisi2_mem"
|
8697 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
8698 |
|
|
+ (zero_extend:SI
|
8699 |
|
|
+ (match_operand:QI 1 "memory_operand" "Q")))]
|
8700 |
102 |
dgisselq |
+ ""
|
8701 |
202 |
dgisselq |
+ "LB\t%1,%0\t; Zero-Extend:QI"
|
8702 |
|
|
+ [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
|
8703 |
102 |
dgisselq |
+;
|
8704 |
|
|
+;
|
8705 |
|
|
+;
|
8706 |
202 |
dgisselq |
+;
|
8707 |
|
|
+(define_insn "zero_extendhisi2"
|
8708 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
8709 |
|
|
+ (zero_extend:SI
|
8710 |
|
|
+ (match_operand:HI 1 "register_operand" "0")))
|
8711 |
127 |
dgisselq |
+ (clobber (reg:CC CC_REG))]
|
8712 |
|
|
+ ""
|
8713 |
202 |
dgisselq |
+ "AND\t65535,%0 ; zero_extendhisi2 ... reg"
|
8714 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "set")])
|
8715 |
|
|
+(define_insn "zero_extendhisi2_raw"
|
8716 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
8717 |
|
|
+ (zero_extend:SI
|
8718 |
|
|
+ (match_operand:HI 1 "register_operand" "0")))
|
8719 |
122 |
dgisselq |
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
|
8720 |
102 |
dgisselq |
+ ""
|
8721 |
202 |
dgisselq |
+ "AND\t65535,%0 ; zero_extendhisi2 ... reg"
|
8722 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "set")])
|
8723 |
|
|
+(define_insn "zero_extendhisi2_mem"
|
8724 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
8725 |
|
|
+ (zero_extend:SI
|
8726 |
|
|
+ (match_operand:HI 1 "memory_operand" "Q")))
|
8727 |
|
|
+ ]
|
8728 |
127 |
dgisselq |
+ ""
|
8729 |
202 |
dgisselq |
+ "LH\t%1,%0\t; Zero-Extend:HI"
|
8730 |
|
|
+ [(set_attr "predicable" "yes") (set_attr "ccresult" "set")])
|
8731 |
138 |
dgisselq |
+;
|
8732 |
|
|
+;
|
8733 |
|
|
+;
|
8734 |
|
|
+;
|
8735 |
202 |
dgisselq |
+(define_insn "extendqisi2"
|
8736 |
138 |
dgisselq |
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
8737 |
202 |
dgisselq |
+ (sign_extend:SI
|
8738 |
|
|
+ (match_operand:QI 1 "register_operand" "0")))
|
8739 |
|
|
+ (clobber (reg:CC CC_REG))]
|
8740 |
138 |
dgisselq |
+ ""
|
8741 |
202 |
dgisselq |
+ "SEXTB\t%0\t; SEXTB"
|
8742 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
8743 |
|
|
+(define_insn "extendhisi2"
|
8744 |
138 |
dgisselq |
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
8745 |
202 |
dgisselq |
+ (sign_extend:SI
|
8746 |
|
|
+ (match_operand:HI 1 "register_operand" "0")))
|
8747 |
|
|
+ (clobber (reg:CC CC_REG))]
|
8748 |
138 |
dgisselq |
+ ""
|
8749 |
202 |
dgisselq |
+ "SEXTH\t%0\t; SEXTH"
|
8750 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
8751 |
138 |
dgisselq |
+;
|
8752 |
|
|
+;
|
8753 |
202 |
dgisselq |
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8754 |
|
|
+;;
|
8755 |
|
|
+;; General arithmetic instructions
|
8756 |
|
|
+;;
|
8757 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8758 |
138 |
dgisselq |
+;
|
8759 |
|
|
+;
|
8760 |
202 |
dgisselq |
+;
|
8761 |
102 |
dgisselq |
+;;
|
8762 |
|
|
+;; modsi3
|
8763 |
|
|
+;; umodsi3
|
8764 |
|
|
+;;
|
8765 |
202 |
dgisselq |
+(define_insn "uminsi3"
|
8766 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
8767 |
|
|
+ (umin:SI (match_operand:SI 1 "register_operand" "%0")
|
8768 |
|
|
+ (match_operand:SI 2 "register_operand" "r")))
|
8769 |
122 |
dgisselq |
+ (clobber (reg:CC CC_REG))
|
8770 |
102 |
dgisselq |
+ ]
|
8771 |
|
|
+ ""
|
8772 |
|
|
+ "CMP %0,%2
|
8773 |
|
|
+ MOV.C %2,%0"
|
8774 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
8775 |
202 |
dgisselq |
+(define_insn "umaxsi3"
|
8776 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
8777 |
|
|
+ (umax:SI (match_operand:SI 1 "register_operand" "%0")
|
8778 |
|
|
+ (match_operand:SI 2 "register_operand" "r")))
|
8779 |
122 |
dgisselq |
+ (clobber (reg:CC CC_REG))
|
8780 |
102 |
dgisselq |
+ ]
|
8781 |
|
|
+ ""
|
8782 |
|
|
+ "CMP %2,%0
|
8783 |
|
|
+ MOV.C %2,%0"
|
8784 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
8785 |
202 |
dgisselq |
+(define_insn "sminsi3"
|
8786 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
8787 |
|
|
+ (smin:SI (match_operand:SI 1 "register_operand" "%0")
|
8788 |
|
|
+ (match_operand:SI 2 "register_operand" "r")))
|
8789 |
122 |
dgisselq |
+ (clobber (reg:CC CC_REG))
|
8790 |
102 |
dgisselq |
+ ]
|
8791 |
|
|
+ ""
|
8792 |
|
|
+ "CMP %2,%0
|
8793 |
202 |
dgisselq |
+ MOV.GE %2,%0"
|
8794 |
102 |
dgisselq |
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
8795 |
202 |
dgisselq |
+(define_insn "smaxsi3"
|
8796 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
8797 |
|
|
+ (smax:SI (match_operand:SI 1 "register_operand" "%0")
|
8798 |
|
|
+ (match_operand:SI 2 "register_operand" "r")))
|
8799 |
122 |
dgisselq |
+ (clobber (reg:CC CC_REG))
|
8800 |
102 |
dgisselq |
+ ]
|
8801 |
|
|
+ ""
|
8802 |
202 |
dgisselq |
+ "CMP %2,%0
|
8803 |
102 |
dgisselq |
+ MOV.LT %2,%0"
|
8804 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
8805 |
127 |
dgisselq |
+;
|
8806 |
|
|
+;
|
8807 |
200 |
dgisselq |
+; AND
|
8808 |
|
|
+; iOR
|
8809 |
|
|
+; XOR
|
8810 |
|
|
+;
|
8811 |
|
|
+;
|
8812 |
|
|
+;
|
8813 |
202 |
dgisselq |
+;(define_insn "addvsi4"
|
8814 |
|
|
+ ;[(set (match_operand:SI 0 "register_operand" "=r")
|
8815 |
|
|
+ ;(plus:SI (match_operand:SI 1 "register_operand" "%r")
|
8816 |
|
|
+ ;(match_operand:SI 2 "general_operand" "rO")))
|
8817 |
122 |
dgisselq |
+ ;(set (pc) (if_then_else (eq (reg:CC CC_REG) (const_int 0))
|
8818 |
102 |
dgisselq |
+ ;(label_ref (match_operand 3))
|
8819 |
|
|
+ ;(pc)))]
|
8820 |
|
|
+ ;""
|
8821 |
|
|
+ ;"MOV %1,%0
|
8822 |
|
|
+ ;ADD %2,%0
|
8823 |
|
|
+ ;BV %3"
|
8824 |
|
|
+ ;[(set_attr "predicable" "no") (set_attr "ccresult" "set")])
|
8825 |
|
|
+;;(define_insn "subvsi4"
|
8826 |
|
|
+;; MOV %1,%0
|
8827 |
|
|
+;; SUB %2,%0
|
8828 |
|
|
+;; BV %3
|
8829 |
|
|
+;;(mulvsi4)
|
8830 |
|
|
+;;(define_insn "uaddvsi4"
|
8831 |
|
|
+;; ADD %2,%0
|
8832 |
|
|
+;; BC %3
|
8833 |
|
|
+;;(define_insn "usubvsi4"
|
8834 |
|
|
+;; MOV %1,%0
|
8835 |
|
|
+;; SUB %2,%0
|
8836 |
|
|
+;; BC %3
|
8837 |
|
|
+;;
|
8838 |
|
|
+;; (define_insn "umulvsi4"
|
8839 |
|
|
+;; ... ???)
|
8840 |
|
|
+;;
|
8841 |
200 |
dgisselq |
+;
|
8842 |
|
|
+;
|
8843 |
|
|
+; ASR
|
8844 |
|
|
+; LSL
|
8845 |
|
|
+; LSR
|
8846 |
|
|
+;
|
8847 |
|
|
+;
|
8848 |
|
|
+;
|
8849 |
127 |
dgisselq |
+;
|
8850 |
|
|
+;
|
8851 |
200 |
dgisselq |
+; Others: NEG, TEST, POPC, NOT
|
8852 |
|
|
+;
|
8853 |
|
|
+;
|
8854 |
202 |
dgisselq |
+(define_insn "negsi2"
|
8855 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
8856 |
|
|
+ (neg:SI (match_operand:SI 1 "register_operand" "r")))
|
8857 |
122 |
dgisselq |
+ (clobber (reg:CC CC_REG))]
|
8858 |
102 |
dgisselq |
+ ""
|
8859 |
202 |
dgisselq |
+ "NEG %1,%0" ;//; = MOV -1(%1),%0, XOR -1,%0
|
8860 |
102 |
dgisselq |
+ [(set_attr "ccresult" "validzn")])
|
8861 |
202 |
dgisselq |
+(define_insn "abssi2"
|
8862 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
8863 |
|
|
+ (abs:SI (match_operand:SI 1 "register_operand" "0")))
|
8864 |
122 |
dgisselq |
+ (clobber (reg:CC CC_REG))]
|
8865 |
102 |
dgisselq |
+ ""
|
8866 |
202 |
dgisselq |
+ "TEST\t%0\n\tNEG.LT\t%0"
|
8867 |
102 |
dgisselq |
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
8868 |
202 |
dgisselq |
+(define_insn_and_split "one_cmplsi2"
|
8869 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
8870 |
|
|
+ (not:SI (match_operand:SI 1 "register_operand" "0")))
|
8871 |
|
|
+ (clobber (reg:CC CC_REG))]
|
8872 |
102 |
dgisselq |
+ ""
|
8873 |
202 |
dgisselq |
+ "#"
|
8874 |
102 |
dgisselq |
+ ""
|
8875 |
202 |
dgisselq |
+ [(parallel [(set (match_dup 0) (xor:SI (match_dup 1) (const_int -1)))
|
8876 |
|
|
+ (clobber (reg:CC CC_REG))])]
|
8877 |
|
|
+ ""
|
8878 |
102 |
dgisselq |
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
8879 |
|
|
+;
|
8880 |
200 |
dgisselq |
+;
|
8881 |
|
|
+;
|
8882 |
|
|
+;
|
8883 |
|
|
+;
|
8884 |
102 |
dgisselq |
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8885 |
|
|
+;;
|
8886 |
|
|
+;; Conditional arithmetic instructions
|
8887 |
|
|
+;;
|
8888 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8889 |
|
|
+;
|
8890 |
|
|
+;
|
8891 |
|
|
+;
|
8892 |
|
|
+;
|
8893 |
|
|
+;
|
8894 |
|
|
+;
|
8895 |
|
|
+;
|
8896 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8897 |
|
|
+;;
|
8898 |
|
|
+;; Comparison instructions, both compare and test
|
8899 |
|
|
+;;
|
8900 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8901 |
|
|
+;
|
8902 |
|
|
+;
|
8903 |
|
|
+;
|
8904 |
|
|
+;; This will only work so well, since the direction of the compare is
|
8905 |
|
|
+;; important in unsigned compares.
|
8906 |
|
|
+;;
|
8907 |
202 |
dgisselq |
+(define_expand "cmpsi"
|
8908 |
122 |
dgisselq |
+ [(set (reg:CC CC_REG) (compare:CC
|
8909 |
202 |
dgisselq |
+ (match_operand:SI 0 "register_operand" "r")
|
8910 |
|
|
+ (match_operand:SI 1 "nonmemory_operand" "")))]
|
8911 |
102 |
dgisselq |
+ ""
|
8912 |
122 |
dgisselq |
+ {
|
8913 |
|
|
+ if (!zip_opb_operand_p(operands[1],SImode)) {
|
8914 |
|
|
+ if (can_create_pseudo_p()) {
|
8915 |
|
|
+ //; fprintf(stderr, "Generating pseudo register for compare\n");
|
8916 |
|
|
+ rtx tmp = gen_reg_rtx(SImode);
|
8917 |
|
|
+ emit_insn(gen_movsi(tmp,operands[1]));
|
8918 |
|
|
+ operands[1] = tmp;
|
8919 |
|
|
+ } else FAIL;
|
8920 |
|
|
+ }
|
8921 |
|
|
+ })
|
8922 |
202 |
dgisselq |
+(define_insn "cmpsi_reg"
|
8923 |
122 |
dgisselq |
+ [(set (reg:CC CC_REG) (compare:CC
|
8924 |
202 |
dgisselq |
+ (match_operand:SI 0 "register_operand" "r")
|
8925 |
|
|
+ (match_operand:SI 1 "zip_opb_single_operand_p" "rO")))]
|
8926 |
122 |
dgisselq |
+ ""
|
8927 |
102 |
dgisselq |
+ "CMP\t%1,%0"
|
8928 |
|
|
+ [(set_attr "ccresult" "set")])
|
8929 |
202 |
dgisselq |
+(define_insn "cmpsi_off"
|
8930 |
122 |
dgisselq |
+ [(set (reg:CC CC_REG) (compare:CC
|
8931 |
202 |
dgisselq |
+ (match_operand:SI 0 "register_operand" "r")
|
8932 |
|
|
+ (plus:SI (match_operand:SI 1 "register_operand" "r")
|
8933 |
122 |
dgisselq |
+ (match_operand 2 "zip_opb_immv_p" "N"))))]
|
8934 |
102 |
dgisselq |
+ ""
|
8935 |
|
|
+ "CMP\t%2+%1,%0"
|
8936 |
|
|
+ [(set_attr "ccresult" "set")])
|
8937 |
202 |
dgisselq |
+(define_insn "testsi"
|
8938 |
|
|
+ [(set (reg:CC CC_REG) (compare:CC (and:SI (match_operand:SI 0 "register_operand" "r")
|
8939 |
|
|
+ (match_operand:SI 1 "zip_opb_single_operand_p" "rO"))
|
8940 |
102 |
dgisselq |
+ (const_int 0)))]
|
8941 |
|
|
+ ""
|
8942 |
|
|
+ "TEST %1,%0"
|
8943 |
|
|
+ [(set_attr "ccresult" "set")])
|
8944 |
202 |
dgisselq |
+(define_insn "testsi_off"
|
8945 |
122 |
dgisselq |
+ [(set (reg:CC CC_REG) (compare:CC
|
8946 |
202 |
dgisselq |
+ (and:SI (match_operand:SI 0 "register_operand" "r")
|
8947 |
|
|
+ (plus:SI
|
8948 |
|
|
+ (match_operand:SI 1 "register_operand" "r")
|
8949 |
|
|
+ (match_operand:SI 2 "zip_opb_immv_p" "N")))
|
8950 |
122 |
dgisselq |
+ (const_int 0)))]
|
8951 |
102 |
dgisselq |
+ ""
|
8952 |
|
|
+ "TEST %2+%1,%0"
|
8953 |
|
|
+ [(set_attr "ccresult" "set")])
|
8954 |
|
|
+(define_insn "nop"
|
8955 |
|
|
+ [(const_int 0)]
|
8956 |
|
|
+ ""
|
8957 |
|
|
+ "NOOP"
|
8958 |
|
|
+ [(set_attr "ccresult" "unchanged")])
|
8959 |
|
|
+;
|
8960 |
|
|
+;
|
8961 |
|
|
+;
|
8962 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8963 |
|
|
+;;
|
8964 |
|
|
+;; Conditional execution predicates
|
8965 |
|
|
+;;
|
8966 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8967 |
|
|
+;
|
8968 |
|
|
+; Sadly, these aren't complete like they should be. Although these are all of
|
8969 |
|
|
+; the conditional execution prefixes that the Zip CPU supports, GCC looks for
|
8970 |
|
|
+; other conditions then these. That is, (cond_exec ...) is not as well
|
8971 |
|
|
+; recognized as (if_then_else ...). So we have to duplicate things to support
|
8972 |
|
|
+; both methods.
|
8973 |
|
|
+;
|
8974 |
|
|
+(define_cond_exec
|
8975 |
202 |
dgisselq |
+ [(eq (reg:CC CC_REG) (const_int 0))] "" "[Z]")
|
8976 |
102 |
dgisselq |
+(define_cond_exec
|
8977 |
202 |
dgisselq |
+ [(ne (reg:CC CC_REG) (const_int 0))] "" "[NZ]")
|
8978 |
102 |
dgisselq |
+(define_cond_exec
|
8979 |
202 |
dgisselq |
+ [(lt (reg:CC CC_REG) (const_int 0))] "" "[LT]")
|
8980 |
102 |
dgisselq |
+(define_cond_exec
|
8981 |
202 |
dgisselq |
+ [(ge (reg:CC CC_REG) (const_int 0))] "" "[GE]")
|
8982 |
102 |
dgisselq |
+(define_cond_exec
|
8983 |
202 |
dgisselq |
+ [(ltu (reg:CC CC_REG) (const_int 0))] "" "[C]")
|
8984 |
200 |
dgisselq |
+(define_cond_exec
|
8985 |
202 |
dgisselq |
+ [(geu (reg:CC CC_REG) (const_int 0))] "" "[NC]")
|
8986 |
102 |
dgisselq |
+;
|
8987 |
|
|
+;
|
8988 |
|
|
+;
|
8989 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8990 |
|
|
+;;
|
8991 |
|
|
+;; Conditional move instructions, since these won't accept conditional
|
8992 |
|
|
+;; execution RTL
|
8993 |
|
|
+;;
|
8994 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
8995 |
|
|
+;
|
8996 |
|
|
+; // Look for #define HAVE_conditional_move to understand how these might be
|
8997 |
|
|
+; // used.
|
8998 |
|
|
+;
|
8999 |
202 |
dgisselq |
+; set_zero_or_one_si
|
9000 |
|
|
+; movsicc
|
9001 |
|
|
+(define_expand "movsicc"
|
9002 |
|
|
+ [(set (match_operand:SI 0 "nonimmediate_operand" "")
|
9003 |
|
|
+ (if_then_else:SI (match_operand 1 "comparison_operator")
|
9004 |
|
|
+ (match_operand:SI 2 "general_operand" "")
|
9005 |
|
|
+ (match_operand:SI 3 "general_operand" "")))]
|
9006 |
102 |
dgisselq |
+ ""
|
9007 |
202 |
dgisselq |
+ {
|
9008 |
|
|
+ //; extern void zip_debug_rtx_pfx(const char *, const_rtx);
|
9009 |
|
|
+ //; fprintf(stderr, "MOVSICC\n");
|
9010 |
|
|
+ //; zip_debug_rtx_pfx("- DST: ", operands[0]);
|
9011 |
|
|
+ //; zip_debug_rtx_pfx("- CMP: ", operands[1]);
|
9012 |
|
|
+ //; zip_debug_rtx_pfx("- NEW: ", operands[2]);
|
9013 |
|
|
+ //; zip_debug_rtx_pfx("- DEF: ", operands[3]);
|
9014 |
|
|
+
|
9015 |
|
|
+ if (!REG_P(operands[2]))
|
9016 |
|
|
+ operands[2] = force_reg(SImode, operands[2]);
|
9017 |
|
|
+
|
9018 |
|
|
+ if ((!REG_P(operands[3]))||(REGNO(operands[0]) != REGNO(operands[3])))
|
9019 |
|
|
+ emit_insn(gen_movsi(operands[0], operands[3]));
|
9020 |
|
|
+ operands[3] = operands[0];
|
9021 |
|
|
+
|
9022 |
|
|
+
|
9023 |
|
|
+ rtx_code ccode = GET_CODE(operands[1]);
|
9024 |
|
|
+ rtx cmpop0 = copy_rtx(XEXP(operands[1], 0));
|
9025 |
|
|
+ rtx cmpop1 = copy_rtx(XEXP(operands[1], 1));
|
9026 |
|
|
+
|
9027 |
|
|
+ zip_canonicalize_comparison((int *)&ccode, &cmpop0, &cmpop1, true);
|
9028 |
|
|
+ emit_insn(gen_cmpsi(cmpop0, cmpop1));
|
9029 |
|
|
+
|
9030 |
|
|
+ operands[1] = gen_rtx_fmt_ee(ccode, VOIDmode,
|
9031 |
|
|
+ gen_rtx_REG(CCmode, 14), const0_rtx);
|
9032 |
|
|
+ })
|
9033 |
|
|
+;
|
9034 |
|
|
+;
|
9035 |
|
|
+;
|
9036 |
|
|
+(define_expand "addsicc"
|
9037 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
9038 |
|
|
+ (if_then_else:SI (match_operand 1 "comparison_operator")
|
9039 |
|
|
+ (plus:SI (match_operand:SI 2 "register_operand" "0")
|
9040 |
|
|
+ (match_operand:SI 3 "zip_opb_single_operand_p" "rO"))
|
9041 |
|
|
+ (match_dup 2)))]
|
9042 |
|
|
+ ""
|
9043 |
|
|
+ {
|
9044 |
|
|
+ //; extern void zip_debug_rtx_pfx(const char *, const_rtx);
|
9045 |
|
|
+ //; fprintf(stderr, "ADDSICC\n");
|
9046 |
|
|
+ //; zip_debug_rtx_pfx("- DST: ", operands[0]);
|
9047 |
|
|
+ //; zip_debug_rtx_pfx("- CMP: ", operands[1]);
|
9048 |
|
|
+ //; zip_debug_rtx_pfx("- OLD: ", operands[2]);
|
9049 |
|
|
+ //; zip_debug_rtx_pfx("- INC: ", operands[3]);
|
9050 |
|
|
+
|
9051 |
|
|
+ if (!REG_P(operands[2]))
|
9052 |
|
|
+ operands[2] = force_reg(SImode, operands[2]);
|
9053 |
|
|
+ if (REGNO(operands[0]) != REGNO(operands[2]))
|
9054 |
|
|
+ emit_insn(gen_movsi(operands[0], operands[2]));
|
9055 |
|
|
+ operands[2] = operands[0];
|
9056 |
|
|
+
|
9057 |
|
|
+ rtx_code ccode = GET_CODE(operands[1]);
|
9058 |
|
|
+ rtx cmpop0 = copy_rtx(XEXP(operands[1], 0));
|
9059 |
|
|
+ rtx cmpop1 = copy_rtx(XEXP(operands[1], 1));
|
9060 |
|
|
+
|
9061 |
|
|
+ zip_canonicalize_comparison((int *)&ccode, &cmpop0, &cmpop1, true);
|
9062 |
|
|
+ emit_insn(gen_cmpsi(cmpop0, cmpop1));
|
9063 |
|
|
+
|
9064 |
|
|
+ operands[1] = gen_rtx_fmt_ee(ccode, VOIDmode,
|
9065 |
|
|
+ gen_rtx_REG(CCmode, 14), const0_rtx);
|
9066 |
102 |
dgisselq |
+ }
|
9067 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
|
9068 |
202 |
dgisselq |
+;
|
9069 |
|
|
+;
|
9070 |
|
|
+;
|
9071 |
|
|
+(define_expand "notsicc"
|
9072 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
9073 |
|
|
+ (if_then_else:SI (match_operand 1 "comparison_operator")
|
9074 |
|
|
+ (xor:SI (match_operand:SI 2 "register_operand" "0")
|
9075 |
|
|
+ (const_int -1))
|
9076 |
|
|
+ (match_dup 2)))]
|
9077 |
102 |
dgisselq |
+ ""
|
9078 |
|
|
+ {
|
9079 |
202 |
dgisselq |
+ extern void zip_debug_rtx_pfx(const char *, const_rtx);
|
9080 |
|
|
+ //; fprintf(stderr, "NOTSICC\n");
|
9081 |
|
|
+ //; zip_debug_rtx_pfx("- DST: ", operands[0]);
|
9082 |
|
|
+ //; zip_debug_rtx_pfx("- CMP: ", operands[1]);
|
9083 |
|
|
+ //; zip_debug_rtx_pfx("- NOT: ", operands[2]);
|
9084 |
|
|
+ //; zip_debug_rtx_pfx("- OLD: ", operands[3]);
|
9085 |
|
|
+
|
9086 |
|
|
+ if (!REG_P(operands[2]))
|
9087 |
|
|
+ operands[2] = force_reg(SImode, operands[2]);
|
9088 |
|
|
+ if (REGNO(operands[0]) != REGNO(operands[2]))
|
9089 |
|
|
+ emit_insn(gen_movsi(operands[0], operands[2]));
|
9090 |
|
|
+
|
9091 |
|
|
+ rtx_code ccode = GET_CODE(operands[1]);
|
9092 |
|
|
+ rtx cmpop0 = copy_rtx(XEXP(operands[1], 0));
|
9093 |
|
|
+ rtx cmpop1 = copy_rtx(XEXP(operands[1], 1));
|
9094 |
|
|
+
|
9095 |
|
|
+ zip_canonicalize_comparison((int *)&ccode,&cmpop0,&cmpop1,true);
|
9096 |
|
|
+ emit_insn(gen_cmpsi(cmpop0, cmpop1));
|
9097 |
|
|
+
|
9098 |
|
|
+ operands[1] = gen_rtx_fmt_ee(ccode, VOIDmode,
|
9099 |
|
|
+ gen_rtx_REG(CCmode, 14), const0_rtx);
|
9100 |
|
|
+ }
|
9101 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
|
9102 |
102 |
dgisselq |
+;
|
9103 |
|
|
+;
|
9104 |
202 |
dgisselq |
+(define_expand "negsicc"
|
9105 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "+r")
|
9106 |
|
|
+ (if_then_else:SI (match_operand 1 "comparison_operator")
|
9107 |
|
|
+ (neg:SI (match_operand:SI 2 "register_operand" "0"))
|
9108 |
|
|
+ (match_operand:SI 3 "register_operand" "0")))]
|
9109 |
|
|
+ ""
|
9110 |
|
|
+ {
|
9111 |
|
|
+ //; extern void zip_debug_rtx_pfx(const char *, const_rtx);
|
9112 |
|
|
+ //; fprintf(stderr, "NEGSICC\n");
|
9113 |
|
|
+ //; zip_debug_rtx_pfx("- DST: ", operands[0]);
|
9114 |
|
|
+ //; zip_debug_rtx_pfx("- CMP: ", operands[1]);
|
9115 |
|
|
+ //; zip_debug_rtx_pfx("- NOT: ", operands[2]);
|
9116 |
|
|
+
|
9117 |
|
|
+ if (!REG_P(operands[2]))
|
9118 |
|
|
+ operands[2] = force_reg(SImode, operands[2]);
|
9119 |
|
|
+ if (REGNO(operands[0]) != REGNO(operands[3]))
|
9120 |
|
|
+ emit_insn(gen_movsi(operands[0], operands[3]));
|
9121 |
|
|
+
|
9122 |
|
|
+ rtx_code ccode = GET_CODE(operands[1]);
|
9123 |
|
|
+ rtx cmpop0 = copy_rtx(XEXP(operands[1], 0));
|
9124 |
|
|
+ rtx cmpop1 = copy_rtx(XEXP(operands[1], 1));
|
9125 |
|
|
+
|
9126 |
|
|
+ zip_canonicalize_comparison((int *)&ccode,&cmpop0,&cmpop1,true);
|
9127 |
|
|
+ emit_insn(gen_cmpsi(cmpop0, cmpop1));
|
9128 |
|
|
+
|
9129 |
|
|
+ operands[1] = gen_rtx_fmt_ee(ccode, VOIDmode,
|
9130 |
|
|
+ gen_rtx_REG(CCmode, 14), const0_rtx);
|
9131 |
|
|
+
|
9132 |
|
|
+ if (REGNO(operands[0]) != REGNO(operands[2]))
|
9133 |
|
|
+ emit_insn(gen_movsicc(operands[0], operands[1], operands[2], operands[0]));
|
9134 |
|
|
+ }
|
9135 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
|
9136 |
102 |
dgisselq |
+;
|
9137 |
192 |
dgisselq |
+;
|
9138 |
202 |
dgisselq |
+(define_expand "cstoresi4"
|
9139 |
|
|
+ [(set (reg:CC CC_REG) (compare:CC (match_operand:SI 2 "register_operand" "r")
|
9140 |
|
|
+ (match_operand:SI 3 "zip_opb_operand_p" "rO")))
|
9141 |
|
|
+ (set (match_operand:SI 0 "register_operand" "=r")
|
9142 |
|
|
+ (if_then_else:SI
|
9143 |
|
|
+ (match_operator 1 "ordered_comparison_operator"
|
9144 |
|
|
+ [(reg:CC CC_REG) (const_int 0)])
|
9145 |
|
|
+ (const_int 1) (const_int 0)))]
|
9146 |
|
|
+ ""
|
9147 |
|
|
+ {
|
9148 |
|
|
+ //; extern void zip_debug_rtx_pfx(const char *, const_rtx);
|
9149 |
|
|
+ //; fprintf(stderr, "CSTORESI4\n");
|
9150 |
|
|
+ //; zip_debug_rtx_pfx("- DST: ", operands[0]);
|
9151 |
|
|
+ //; zip_debug_rtx_pfx("- TST: ", operands[1]);
|
9152 |
|
|
+ //; zip_debug_rtx_pfx("- A : ", operands[2]);
|
9153 |
|
|
+ //; zip_debug_rtx_pfx("- -B: ", operands[3]);
|
9154 |
192 |
dgisselq |
+
|
9155 |
202 |
dgisselq |
+ rtx_code ccode = GET_CODE(operands[1]);
|
9156 |
|
|
+
|
9157 |
|
|
+ zip_canonicalize_comparison((int *)&ccode,&operands[2],&operands[3],true);
|
9158 |
|
|
+ emit_insn(gen_cmpsi(operands[2], operands[3]));
|
9159 |
|
|
+ emit_insn(gen_movsi(operands[0], const0_rtx));
|
9160 |
|
|
+ switch(ccode) {
|
9161 |
|
|
+ case EQ:
|
9162 |
|
|
+ emit_insn(gen_cmov_eq(operands[0], const1_rtx));
|
9163 |
|
|
+ break;
|
9164 |
|
|
+ case NE:
|
9165 |
|
|
+ emit_insn(gen_cmov_ne(operands[0], const1_rtx));
|
9166 |
|
|
+ break;
|
9167 |
|
|
+ case LT:
|
9168 |
|
|
+ emit_insn(gen_cmov_lt(operands[0], const1_rtx));
|
9169 |
|
|
+ break;
|
9170 |
|
|
+ case GE:
|
9171 |
|
|
+ emit_insn(gen_cmov_ge(operands[0], const1_rtx));
|
9172 |
|
|
+ break;
|
9173 |
|
|
+ case LTU:
|
9174 |
|
|
+ emit_insn(gen_cmov_ltu(operands[0], const1_rtx));
|
9175 |
|
|
+ break;
|
9176 |
|
|
+ case GEU:
|
9177 |
|
|
+ emit_insn(gen_cmov_geu(operands[0], const1_rtx));
|
9178 |
|
|
+ break;
|
9179 |
|
|
+ default:
|
9180 |
|
|
+ FAIL;
|
9181 |
|
|
+ } DONE;
|
9182 |
|
|
+ }
|
9183 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
|
9184 |
192 |
dgisselq |
+;
|
9185 |
|
|
+;
|
9186 |
102 |
dgisselq |
+;
|
9187 |
|
|
+;
|
9188 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
9189 |
|
|
+;;
|
9190 |
|
|
+;; Control flow instructions
|
9191 |
|
|
+;;
|
9192 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
9193 |
|
|
+;
|
9194 |
|
|
+;
|
9195 |
|
|
+;
|
9196 |
|
|
+(define_expand "jump"
|
9197 |
|
|
+ [(set (pc)
|
9198 |
202 |
dgisselq |
+ (label_ref (match_operand 0 "" "")))])
|
9199 |
127 |
dgisselq |
+(define_insn "jump_const"
|
9200 |
|
|
+ [(set (pc)
|
9201 |
102 |
dgisselq |
+ (match_operand:SI 0 "zip_const_address_operand_p" ""))]
|
9202 |
|
|
+ ""
|
9203 |
|
|
+ "BRA %0"
|
9204 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
|
9205 |
|
|
+(define_insn "jump_label" ; Must be modeless, VOIDmode, not SI or any othr
|
9206 |
|
|
+ [(set (pc) ; Otherwise it won't accept jumps to labels
|
9207 |
|
|
+ (label_ref (match_operand 0 "" "")))]
|
9208 |
|
|
+ ""
|
9209 |
|
|
+ "BRA %0"
|
9210 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
|
9211 |
|
|
+;
|
9212 |
|
|
+; This is really the same thing as an indirect jump ... the big difference
|
9213 |
|
|
+; is that the zip_address_operand_p checks for an "N" type condition, not an
|
9214 |
|
|
+; "M" type condition ... a bug, but one that works for now. (The assembler
|
9215 |
|
|
+; should be able to catch and except on it ...)
|
9216 |
|
|
+;
|
9217 |
|
|
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
|
9218 |
|
|
+(define_insn "jump_variable"
|
9219 |
|
|
+ [(set (pc)
|
9220 |
|
|
+ (match_operand:SI 0 "zip_address_operand_p" ""))]
|
9221 |
|
|
+ ""
|
9222 |
|
|
+ "JMP %0"
|
9223 |
|
|
+ [(set_attr "ccresult" "unchanged")])
|
9224 |
|
|
+;
|
9225 |
|
|
+; Indirect jumps ... both to registers, and registers plus offsets
|
9226 |
|
|
+;
|
9227 |
|
|
+(define_insn "indirect_jump"
|
9228 |
|
|
+ [(set (pc)
|
9229 |
|
|
+ (match_operand:SI 0 "register_operand" "r"))]
|
9230 |
|
|
+ ""
|
9231 |
|
|
+ "JMP %0"
|
9232 |
|
|
+ [(set_attr "ccresult" "unchanged")])
|
9233 |
|
|
+(define_insn "indirect_jump_mem"
|
9234 |
|
|
+ [(set (pc) (match_operand:SI 0 "zip_memory_operand_p" "o"))]
|
9235 |
|
|
+ ""
|
9236 |
202 |
dgisselq |
+ "LW %0,PC"
|
9237 |
102 |
dgisselq |
+ [(set_attr "ccresult" "unchanged")])
|
9238 |
|
|
+(define_insn "indirect_jump_off"
|
9239 |
|
|
+ [(set (pc)
|
9240 |
|
|
+ (plus:SI (match_operand:SI 0 "register_operand" "r")
|
9241 |
|
|
+ (match_operand:SI 1 "const_int_operand" "M")))]
|
9242 |
|
|
+ ""
|
9243 |
|
|
+ "JMP %1(%0)"
|
9244 |
|
|
+ [(set_attr "ccresult" "unchanged")])
|
9245 |
|
|
+;;
|
9246 |
|
|
+; cbranchsi4
|
9247 |
|
|
+;; Op 0 = the comparison operator (le,lt,eq,ne,gt,ge,and usgn ltu,geu,etc.)
|
9248 |
|
|
+;; Op 1&2 the operands of the compare instruction
|
9249 |
|
|
+;; Op 3 is the jump label
|
9250 |
|
|
+;;
|
9251 |
|
|
+;;
|
9252 |
|
|
+;;
|
9253 |
202 |
dgisselq |
+(define_expand "cbranchsi4"
|
9254 |
|
|
+ [(set (reg:CC CC_REG) (compare:CC (match_operand:SI 1 "register_operand" "r")
|
9255 |
|
|
+ (match_operand:SI 2 "zip_opb_operand_p" "rO")))
|
9256 |
102 |
dgisselq |
+ (set (pc) (if_then_else (match_operator 0 "ordered_comparison_operator"
|
9257 |
122 |
dgisselq |
+ [(reg:CC CC_REG) (const_int 0)])
|
9258 |
102 |
dgisselq |
+ (label_ref (match_operand 3 "" ""))
|
9259 |
|
|
+ (pc)))]
|
9260 |
|
|
+ ""
|
9261 |
|
|
+ {
|
9262 |
125 |
dgisselq |
+ if (true) {
|
9263 |
202 |
dgisselq |
+ //; extern void zip_debug_rtx_pfx(const char *, const_rtx);
|
9264 |
102 |
dgisselq |
+ //; Two branches give us no end of difficulty when implementing.
|
9265 |
|
|
+ //; Let's check for these two branch codes, and swap the
|
9266 |
|
|
+ //; comparison to simplify them.
|
9267 |
122 |
dgisselq |
+ //; fprintf(stderr, "CBRANCH\n");
|
9268 |
|
|
+ //; zip_debug_rtx_pfx("- CMP: ", operands[0]);
|
9269 |
|
|
+ //; zip_debug_rtx_pfx("- A : ", operands[1]);
|
9270 |
|
|
+ //; zip_debug_rtx_pfx("- B : ", operands[2]);
|
9271 |
|
|
+ //; zip_debug_rtx_pfx("- JMP: ", operands[3]);
|
9272 |
117 |
dgisselq |
+ //; Can we do better if we reverse some compares?
|
9273 |
202 |
dgisselq |
+ //;
|
9274 |
|
|
+ //; We have GE, LT, LTU, and GEU conditions
|
9275 |
|
|
+ //; Figure out how to create the other conditions from
|
9276 |
|
|
+ //; these.
|
9277 |
|
|
+ if (GET_CODE(operands[0])==GTU) {
|
9278 |
|
|
+ if (REG_P(operands[2])) {
|
9279 |
|
|
+ //; Reverse the comparison
|
9280 |
|
|
+ emit_insn(gen_cmpsi(operands[2],operands[1]));
|
9281 |
|
|
+ emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
|
9282 |
|
|
+ DONE;
|
9283 |
|
|
+ } else if ((CONST_INT_P(operands[2]))
|
9284 |
|
|
+ &&(INTVAL(operands[2])>-(1<<17)+2)) {
|
9285 |
|
|
+ //; A > B
|
9286 |
|
|
+ //; A >= B+1
|
9287 |
|
|
+ //; Add one to the integer constant,
|
9288 |
|
|
+ //; And use a GEU comparison
|
9289 |
|
|
+ emit_insn(gen_cmpsi(operands[1],
|
9290 |
|
|
+ GEN_INT(INTVAL(operands[2])+1)));
|
9291 |
200 |
dgisselq |
+ emit_jump_insn(gen_cbranch_jmp_geu(operands[3]));
|
9292 |
202 |
dgisselq |
+ DONE;
|
9293 |
|
|
+ } else if ((CONST_INT_P(operands[2]))
|
9294 |
|
|
+ &&(can_create_pseudo_p())) {
|
9295 |
|
|
+ rtx tmp = gen_reg_rtx(GET_MODE(operands[1]));
|
9296 |
|
|
+ emit_insn(gen_movsi(tmp,operands[2]));
|
9297 |
|
|
+ emit_insn(gen_cmpsi(tmp,operands[1]));
|
9298 |
|
|
+ emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
|
9299 |
|
|
+
|
9300 |
|
|
+ DONE;
|
9301 |
|
|
+
|
9302 |
200 |
dgisselq |
+ }
|
9303 |
202 |
dgisselq |
+ } else if (GET_CODE(operands[0]) == LEU) {
|
9304 |
|
|
+ if (REG_P(operands[2])) {
|
9305 |
|
|
+ //; Reverse the comparison
|
9306 |
|
|
+ emit_insn(gen_cmpsi(operands[2],operands[1]));
|
9307 |
|
|
+ emit_jump_insn(gen_cbranch_jmp_geu(operands[3]));
|
9308 |
|
|
+ DONE;
|
9309 |
|
|
+ } else if ((CONST_INT_P(operands[2]))
|
9310 |
117 |
dgisselq |
+ &&(INTVAL(operands[2])<(1<<17)-2)) {
|
9311 |
202 |
dgisselq |
+ //; A <= B
|
9312 |
|
|
+ //; A < B+1
|
9313 |
|
|
+ //; Add one to the integer constant,
|
9314 |
|
|
+ //; And use a GTU comparison
|
9315 |
122 |
dgisselq |
+ emit_insn(gen_cmpsi(operands[1],
|
9316 |
202 |
dgisselq |
+ GEN_INT(INTVAL(operands[2])+1)));
|
9317 |
|
|
+ emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
|
9318 |
122 |
dgisselq |
+ DONE;
|
9319 |
202 |
dgisselq |
+ } else if ((CONST_INT_P(operands[2]))
|
9320 |
|
|
+ &&(can_create_pseudo_p())) {
|
9321 |
|
|
+ rtx tmp = gen_reg_rtx(GET_MODE(operands[1]));
|
9322 |
|
|
+ emit_insn(gen_movsi(tmp,operands[2]));
|
9323 |
|
|
+ emit_insn(gen_cmpsi(tmp,operands[1]));
|
9324 |
|
|
+ emit_jump_insn(gen_cbranch_jmp_geu(operands[3]));
|
9325 |
122 |
dgisselq |
+ DONE;
|
9326 |
202 |
dgisselq |
+
|
9327 |
|
|
+ }
|
9328 |
|
|
+ } else if (GET_CODE(operands[0]) == LE) {
|
9329 |
|
|
+ if (REG_P(operands[2])) {
|
9330 |
|
|
+ //; Reverse the comparison
|
9331 |
|
|
+ emit_insn(gen_cmpsi(operands[2],operands[1]));
|
9332 |
|
|
+ emit_jump_insn(gen_cbranch_jmp_gte(operands[3]));
|
9333 |
122 |
dgisselq |
+ DONE;
|
9334 |
202 |
dgisselq |
+ } else if ((CONST_INT_P(operands[2]))
|
9335 |
200 |
dgisselq |
+ &&(INTVAL(operands[2])<(1<<17)-2)) {
|
9336 |
202 |
dgisselq |
+ //; A <= B
|
9337 |
|
|
+ //; A < B+1
|
9338 |
|
|
+ //; Add one to the integer constant,
|
9339 |
|
|
+ //; And use a GTU comparison
|
9340 |
200 |
dgisselq |
+ emit_insn(gen_cmpsi(operands[1],
|
9341 |
202 |
dgisselq |
+ GEN_INT(INTVAL(operands[2])+1)));
|
9342 |
|
|
+ emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
|
9343 |
200 |
dgisselq |
+ DONE;
|
9344 |
202 |
dgisselq |
+ } else if ((CONST_INT_P(operands[2]))
|
9345 |
|
|
+ &&(can_create_pseudo_p())) {
|
9346 |
|
|
+ rtx tmp = gen_reg_rtx(GET_MODE(operands[1]));
|
9347 |
|
|
+ emit_insn(gen_movsi(tmp,operands[2]));
|
9348 |
|
|
+ emit_insn(gen_cmpsi(tmp,operands[1]));
|
9349 |
|
|
+ emit_jump_insn(gen_cbranch_jmp_gte(operands[3]));
|
9350 |
200 |
dgisselq |
+ DONE;
|
9351 |
202 |
dgisselq |
+
|
9352 |
|
|
+ }
|
9353 |
|
|
+ } else if (GET_CODE(operands[0]) == GT) {
|
9354 |
|
|
+ if (REG_P(operands[2])) {
|
9355 |
|
|
+ //; Reverse the comparison
|
9356 |
|
|
+ emit_insn(gen_cmpsi(operands[2],operands[1]));
|
9357 |
|
|
+ emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
|
9358 |
200 |
dgisselq |
+ DONE;
|
9359 |
202 |
dgisselq |
+ } else if ((CONST_INT_P(operands[2]))
|
9360 |
102 |
dgisselq |
+ &&(INTVAL(operands[2])<(1<<17)-2)) {
|
9361 |
202 |
dgisselq |
+ //; A > B
|
9362 |
|
|
+ //; A >= B+1
|
9363 |
|
|
+ //; Add one to the integer constant,
|
9364 |
|
|
+ //; And use a GTU comparison
|
9365 |
122 |
dgisselq |
+ emit_insn(gen_cmpsi(operands[1],
|
9366 |
202 |
dgisselq |
+ GEN_INT(INTVAL(operands[2])+1)));
|
9367 |
|
|
+ emit_jump_insn(gen_cbranch_jmp_gte(operands[3]));
|
9368 |
122 |
dgisselq |
+ DONE;
|
9369 |
202 |
dgisselq |
+ } else if ((CONST_INT_P(operands[2]))
|
9370 |
|
|
+ &&(can_create_pseudo_p())) {
|
9371 |
|
|
+ rtx tmp = gen_reg_rtx(GET_MODE(operands[1]));
|
9372 |
|
|
+ emit_insn(gen_movsi(tmp,operands[2]));
|
9373 |
|
|
+ emit_insn(gen_cmpsi(tmp,operands[1]));
|
9374 |
|
|
+ emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
|
9375 |
|
|
+
|
9376 |
122 |
dgisselq |
+ DONE;
|
9377 |
|
|
+ }
|
9378 |
202 |
dgisselq |
+ }
|
9379 |
|
|
+ }})
|
9380 |
102 |
dgisselq |
+(define_insn "cbranch_jmp_eq"
|
9381 |
122 |
dgisselq |
+ [(set (pc) (if_then_else (eq (reg:CC CC_REG) (const_int 0))
|
9382 |
102 |
dgisselq |
+ (label_ref (match_operand 0 "" ""))
|
9383 |
|
|
+ (pc)))]
|
9384 |
|
|
+ ""
|
9385 |
|
|
+ "BZ\t%0"
|
9386 |
|
|
+ [(set_attr "predicable" "no")
|
9387 |
|
|
+ (set_attr "ccresult" "unchanged")])
|
9388 |
|
|
+(define_insn "cbranch_jmp_neq"
|
9389 |
122 |
dgisselq |
+ [(set (pc) (if_then_else (ne (reg:CC CC_REG) (const_int 0))
|
9390 |
102 |
dgisselq |
+ (label_ref (match_operand 0 "" ""))
|
9391 |
|
|
+ (pc)))]
|
9392 |
|
|
+ ""
|
9393 |
|
|
+ "BNZ\t%0"
|
9394 |
|
|
+ [(set_attr "predicable" "no")
|
9395 |
|
|
+ (set_attr "ccresult" "unchanged")])
|
9396 |
|
|
+(define_insn "cbranch_jmp_lt"
|
9397 |
122 |
dgisselq |
+ [(set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
|
9398 |
102 |
dgisselq |
+ (label_ref (match_operand 0 "" ""))
|
9399 |
|
|
+ (pc)))]
|
9400 |
|
|
+ ""
|
9401 |
|
|
+ "BLT\t%0"
|
9402 |
|
|
+ [(set_attr "predicable" "no")
|
9403 |
|
|
+ (set_attr "ccresult" "unchanged")])
|
9404 |
|
|
+(define_insn "cbranch_jmp_le"
|
9405 |
122 |
dgisselq |
+ [(set (pc) (if_then_else (le (reg:CC CC_REG) (const_int 0))
|
9406 |
102 |
dgisselq |
+ (label_ref (match_operand 0 "" ""))
|
9407 |
|
|
+ (pc)))]
|
9408 |
|
|
+ ""
|
9409 |
202 |
dgisselq |
+ "BLT\t%0\n\tBZ\t%0"
|
9410 |
102 |
dgisselq |
+ [(set_attr "predicable" "no")
|
9411 |
|
|
+ (set_attr "ccresult" "unchanged")])
|
9412 |
|
|
+(define_insn "cbranch_jmp_gt"
|
9413 |
122 |
dgisselq |
+ [(set (pc) (if_then_else (gt (reg:CC CC_REG) (const_int 0))
|
9414 |
102 |
dgisselq |
+ (label_ref (match_operand 0 "" ""))
|
9415 |
|
|
+ (pc)))]
|
9416 |
|
|
+ ""
|
9417 |
202 |
dgisselq |
+ "BZ\t.Lgt%=\n\tBGE\t%0\n\t.Lgt%=:"
|
9418 |
102 |
dgisselq |
+ [(set_attr "predicable" "no")
|
9419 |
|
|
+ (set_attr "ccresult" "unchanged")])
|
9420 |
202 |
dgisselq |
+(define_insn "cbranch_jmp_gte"
|
9421 |
122 |
dgisselq |
+ [(set (pc) (if_then_else (ge (reg:CC CC_REG) (const_int 0))
|
9422 |
102 |
dgisselq |
+ (label_ref (match_operand 0 "" ""))
|
9423 |
|
|
+ (pc)))]
|
9424 |
202 |
dgisselq |
+ ""
|
9425 |
102 |
dgisselq |
+ "BGE\t%0"
|
9426 |
|
|
+ [(set_attr "predicable" "no")
|
9427 |
|
|
+ (set_attr "ccresult" "unchanged")])
|
9428 |
|
|
+(define_insn "cbranch_jmp_ltu"
|
9429 |
122 |
dgisselq |
+ [(set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
|
9430 |
102 |
dgisselq |
+ (label_ref (match_operand 0 "" ""))
|
9431 |
|
|
+ (pc)))]
|
9432 |
|
|
+ ""
|
9433 |
|
|
+ "BC\t%0"
|
9434 |
|
|
+ [(set_attr "predicable" "no")
|
9435 |
|
|
+ (set_attr "ccresult" "unchanged")])
|
9436 |
202 |
dgisselq |
+(define_insn "cbranch_jmp_gtu"
|
9437 |
122 |
dgisselq |
+ [(set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
|
9438 |
102 |
dgisselq |
+ (label_ref (match_operand 0 "" ""))
|
9439 |
200 |
dgisselq |
+ (pc)))]
|
9440 |
202 |
dgisselq |
+ ""
|
9441 |
200 |
dgisselq |
+ ;// We could flip the condition code, and then be able to jump.
|
9442 |
|
|
+ ;// The problem is that doing this adjusts the condition code, and
|
9443 |
|
|
+ ;// we aren't allowed to do that here.
|
9444 |
|
|
+ ;//
|
9445 |
|
|
+ ;// The problem here is the equals. What do you do if A=B? Our new
|
9446 |
|
|
+ ;// condition tests for A>=B, not A>B. So ... how do you get rid of
|
9447 |
|
|
+ ;// the equals? We do so here by branching around. (sigh)
|
9448 |
|
|
+ "BZ\t.Lgtu%=\n\tBNC\t%0\n.Lgtu%=:"
|
9449 |
|
|
+ [(set_attr "predicable" "no")
|
9450 |
|
|
+ (set_attr "ccresult" "unknown")])
|
9451 |
102 |
dgisselq |
+(define_insn "cbranch_jmp_leu"
|
9452 |
122 |
dgisselq |
+ [(set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
|
9453 |
102 |
dgisselq |
+ (label_ref (match_operand 0 "" ""))
|
9454 |
|
|
+ (pc)))]
|
9455 |
|
|
+ "" ; Need to check for both LTU (i.e. C) and Z
|
9456 |
|
|
+ "BC\t%0
|
9457 |
|
|
+ BZ\t%0"
|
9458 |
|
|
+ [(set_attr "predicable" "no")
|
9459 |
|
|
+ (set_attr "ccresult" "unchanged")])
|
9460 |
202 |
dgisselq |
+(define_insn "cbranch_jmp_geu"
|
9461 |
122 |
dgisselq |
+ [(set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
|
9462 |
102 |
dgisselq |
+ (label_ref (match_operand 0 "" ""))
|
9463 |
200 |
dgisselq |
+ (pc)))]
|
9464 |
202 |
dgisselq |
+ ""
|
9465 |
200 |
dgisselq |
+ "BNC\t%0"
|
9466 |
|
|
+ [(set_attr "predicable" "no")
|
9467 |
|
|
+ (set_attr "ccresult" "unchanged")])
|
9468 |
102 |
dgisselq |
+;
|
9469 |
|
|
+;
|
9470 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
9471 |
|
|
+;;
|
9472 |
191 |
dgisselq |
+;; Looping constructs
|
9473 |
|
|
+;;
|
9474 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
9475 |
|
|
+;
|
9476 |
|
|
+;
|
9477 |
|
|
+;
|
9478 |
|
|
+(define_insn "decrement_and_branch_until_zero"
|
9479 |
202 |
dgisselq |
+ [(set (pc) (if_then_else
|
9480 |
|
|
+ (ge (plus:SI (match_operand:SI 0 "register_operand" "+r,Q")
|
9481 |
|
|
+ (const_int -1)) (const_int 0))
|
9482 |
|
|
+ (label_ref (match_operand 1 "" ""))
|
9483 |
|
|
+ (pc)))
|
9484 |
191 |
dgisselq |
+ (set (match_dup 0) (plus:SI (match_dup 0) (const_int -1)))
|
9485 |
|
|
+ ;(set (reg:CC CC_REG)
|
9486 |
|
|
+ ;(compare:CC (minus:SI (match_dup 0) (const_int 1))
|
9487 |
|
|
+ ;(const_int 0)))
|
9488 |
202 |
dgisselq |
+ (clobber (match_scratch:SI 2 "=r,r"))
|
9489 |
191 |
dgisselq |
+ (clobber (reg:CC CC_REG))]
|
9490 |
|
|
+ ""
|
9491 |
202 |
dgisselq |
+ {
|
9492 |
|
|
+ if (MEM_P(operands[0])) {
|
9493 |
|
|
+ //; We could also go searching for dead regs if
|
9494 |
|
|
+ //; necessary
|
9495 |
|
|
+ return "LW %0,%2"
|
9496 |
|
|
+ "\t; decrement_and_branch_until_zero(MEM)\n"
|
9497 |
|
|
+ "\tADD\t-1,%2\t\n"
|
9498 |
|
|
+ "\tSW %2,%0\n"
|
9499 |
|
|
+ "\tBLT\t.Ldec%=\n"
|
9500 |
|
|
+ "\tBRA\t%1\n"
|
9501 |
|
|
+ ".Ldec%=:";
|
9502 |
|
|
+ }
|
9503 |
|
|
+ return "ADD\t-1,%0\t; decrement_and_branch_until_zero (REG)\n"
|
9504 |
|
|
+ "\tBLT\t.Ldec%=\n"
|
9505 |
|
|
+ "\tBRA\t%1\n"
|
9506 |
|
|
+ ".Ldec%=:";
|
9507 |
|
|
+ }
|
9508 |
191 |
dgisselq |
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
9509 |
|
|
+;
|
9510 |
|
|
+;
|
9511 |
202 |
dgisselq |
+; Requires TARGET_CAN_USE_DOLOOP_P to be set appropriately in order to use
|
9512 |
191 |
dgisselq |
+;
|
9513 |
202 |
dgisselq |
+;
|
9514 |
|
|
+;(define_insn "doloop_end"
|
9515 |
|
|
+ ;[(set (pc)
|
9516 |
|
|
+ ;(if_then_else
|
9517 |
|
|
+ ;(ne (plus:SI (match_operand:SI 0 "register_operand" "+r")
|
9518 |
|
|
+ ;;(const_int -1)) (const_int 0))
|
9519 |
|
|
+ ;(label_ref (match_operand 1 "" ""))
|
9520 |
|
|
+ ;(pc)))
|
9521 |
|
|
+ ;(set (match_dup 0) (plus:SI (match_dup 0) (const_int -1)))
|
9522 |
|
|
+ ;; (set (reg:CC CC_REG)
|
9523 |
|
|
+ ;; (compare:CC (minus:SI (match_dup 0) (const_int 1))
|
9524 |
|
|
+ ;; (const_int 0)))
|
9525 |
|
|
+ ;(clobber (reg:CC CC_REG))]
|
9526 |
|
|
+ ;"(reload_completed)"
|
9527 |
|
|
+ ;"ADD\t-1,%0\t; doloop_end\n\tBZ\t.Lloop%=\n\tBRA\t%1\n.Lloop%=:"
|
9528 |
|
|
+ ;[(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
9529 |
|
|
+;
|
9530 |
191 |
dgisselq |
+; Since we have a doloop_end, we must also have a doloop_begin. Since the
|
9531 |
|
|
+; ZipCPU has no special begin looping instruction, we'll simply define this
|
9532 |
|
|
+; as a null instruction.
|
9533 |
|
|
+;
|
9534 |
202 |
dgisselq |
+; (define_expand "doloop_begin" [(const_int 0)] "(0)")
|
9535 |
191 |
dgisselq |
+;
|
9536 |
|
|
+;
|
9537 |
|
|
+;
|
9538 |
202 |
dgisselq |
+;
|
9539 |
191 |
dgisselq |
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
9540 |
|
|
+;;
|
9541 |
102 |
dgisselq |
+;; Subroutine call
|
9542 |
|
|
+;;
|
9543 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
9544 |
|
|
+;
|
9545 |
|
|
+;
|
9546 |
|
|
+; There are two types of calls: "call" and "call_value".
|
9547 |
|
|
+;
|
9548 |
|
|
+; Each of these types of calls are then expanded into one of:
|
9549 |
|
|
+;
|
9550 |
|
|
+; _const - A call to a constant address, such as a symbol
|
9551 |
|
|
+; reference or a fixed location
|
9552 |
|
|
+;
|
9553 |
|
|
+; _label - This should be the same as _const, except that for
|
9554 |
|
|
+; some reason the RTL and matching rules are separate.
|
9555 |
|
|
+; Hence we have a separate rule for this.
|
9556 |
|
|
+;
|
9557 |
|
|
+; _mem - The memory address we wish to jump to is stored in
|
9558 |
|
|
+; memory somewhere, and we have only a pointer. In this
|
9559 |
|
|
+; case, we load that pointer straight to the PC and go.
|
9560 |
|
|
+;
|
9561 |
|
|
+; _var - The address to jump to is given as an offset to a
|
9562 |
|
|
+; register, such as X+R3. This is an indirect jump.
|
9563 |
|
|
+; Although we support it, it does require different RTL
|
9564 |
|
|
+; code.
|
9565 |
|
|
+;
|
9566 |
|
|
+(define_expand "call"
|
9567 |
|
|
+ [(call (match_operand 0 "" "")
|
9568 |
|
|
+ (match_operand 1 "" ""))]
|
9569 |
|
|
+ ""
|
9570 |
|
|
+ {
|
9571 |
|
|
+ if (MEM_P(operands[0])) {
|
9572 |
202 |
dgisselq |
+ ;// extern void zip_debug_rtx(const_rtx);
|
9573 |
|
|
+ ;//
|
9574 |
|
|
+ ;// fprintf(stderr, "CALL: ");
|
9575 |
|
|
+ ;// zip_debug_rtx(operands[0]);
|
9576 |
|
|
+ ;//
|
9577 |
|
|
+ ;//
|
9578 |
|
|
+ ;// This should always be the case
|
9579 |
102 |
dgisselq |
+ rtx addr = XEXP(operands[0],0);
|
9580 |
|
|
+ if (zip_const_address_operand_p(addr, SImode)) {
|
9581 |
122 |
dgisselq |
+ //; fprintf(stderr, "Generating gen_void_call_const()\n");
|
9582 |
102 |
dgisselq |
+ emit_call_insn(gen_void_call_const(addr,
|
9583 |
|
|
+ operands[1]));
|
9584 |
|
|
+ } else if ((MEM_P(addr))&&(zip_address_operand(
|
9585 |
|
|
+ XEXP(addr,0)))) {
|
9586 |
202 |
dgisselq |
+ fprintf(stderr, "ERR: ZIP.MD::CALL INDIRECT\n");
|
9587 |
102 |
dgisselq |
+ emit_call_insn(gen_void_call_mem(XEXP(addr,0),
|
9588 |
|
|
+ operands[1]));
|
9589 |
202 |
dgisselq |
+ gcc_assert(0);
|
9590 |
102 |
dgisselq |
+ } else {
|
9591 |
202 |
dgisselq |
+ emit_call_insn(gen_void_call_var(operands[0],
|
9592 |
102 |
dgisselq |
+ operands[1]));
|
9593 |
|
|
+ }
|
9594 |
|
|
+ DONE;
|
9595 |
202 |
dgisselq |
+ } else FAIL;
|
9596 |
102 |
dgisselq |
+ })
|
9597 |
|
|
+;
|
9598 |
191 |
dgisselq |
+(define_expand "sibcall"
|
9599 |
|
|
+ [(call (mem:SI (match_operand 0 "zip_const_address_operand_p" ""))
|
9600 |
|
|
+ (match_operand 1 "" ""))
|
9601 |
|
|
+ (use (match_operand 2 "" ""))
|
9602 |
|
|
+ (use (reg:SI RTN_REG))
|
9603 |
|
|
+ (simple_return)]
|
9604 |
|
|
+ ""
|
9605 |
|
|
+ {
|
9606 |
|
|
+ if (MEM_P(operands[0])) {
|
9607 |
202 |
dgisselq |
+ ;// extern void zip_debug_rtx(const_rtx);
|
9608 |
|
|
+ ;//
|
9609 |
|
|
+ ;// fprintf(stderr, "CALL: ");
|
9610 |
|
|
+ ;// zip_debug_rtx(operands[0]);
|
9611 |
|
|
+ ;//
|
9612 |
|
|
+ ;//
|
9613 |
|
|
+ ;// This should always be the case
|
9614 |
191 |
dgisselq |
+ rtx addr = XEXP(operands[0],0);
|
9615 |
|
|
+ if (zip_const_address_operand_p(addr, SImode)) {
|
9616 |
|
|
+ //; fprintf(stderr, "Generating gen_void_call_const()\n");
|
9617 |
|
|
+ emit_call_insn(gen_void_sibcall_const(addr,
|
9618 |
|
|
+ operands[1]));
|
9619 |
|
|
+ } else if ((MEM_P(addr))&&(zip_address_operand(
|
9620 |
|
|
+ XEXP(addr,0)))) {
|
9621 |
202 |
dgisselq |
+ fprintf(stderr, "ERR: ZIP.MD::SIBCALL INDIRECT\n");
|
9622 |
191 |
dgisselq |
+ emit_call_insn(gen_void_sibcall_mem(XEXP(addr,0),
|
9623 |
|
|
+ operands[1]));
|
9624 |
202 |
dgisselq |
+ gcc_assert(0);
|
9625 |
191 |
dgisselq |
+ } else {
|
9626 |
202 |
dgisselq |
+ emit_call_insn(gen_void_sibcall_var(operands[0],
|
9627 |
191 |
dgisselq |
+ operands[1]));
|
9628 |
|
|
+ }
|
9629 |
|
|
+ DONE;
|
9630 |
202 |
dgisselq |
+ } else FAIL;
|
9631 |
191 |
dgisselq |
+ }) ; "BAR\t%0\n"
|
9632 |
102 |
dgisselq |
+;
|
9633 |
191 |
dgisselq |
+(define_insn "void_sibcall_const"
|
9634 |
|
|
+ [(call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
|
9635 |
|
|
+ (match_operand 1 "const_int_operand" "n"))
|
9636 |
|
|
+ (use (reg:SI RTN_REG))
|
9637 |
|
|
+ (clobber (reg:CC CC_REG))
|
9638 |
|
|
+ (simple_return)]
|
9639 |
|
|
+ ""
|
9640 |
|
|
+ "BRA\t%0"
|
9641 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
9642 |
|
|
+(define_insn "void_sibcall_mem"
|
9643 |
|
|
+ [(call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
|
9644 |
|
|
+ (match_operand 1 "const_int_operand" "n"))
|
9645 |
|
|
+ (use (reg:SI RTN_REG))
|
9646 |
|
|
+ (clobber (reg:CC CC_REG))
|
9647 |
|
|
+ (simple_return)]
|
9648 |
|
|
+ ""
|
9649 |
202 |
dgisselq |
+ "LW\t%0,PC"
|
9650 |
191 |
dgisselq |
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
9651 |
102 |
dgisselq |
+;
|
9652 |
191 |
dgisselq |
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
|
9653 |
|
|
+(define_insn "void_sibcall_var"
|
9654 |
202 |
dgisselq |
+ [(call (match_operand:SI 0 "zip_memory_operand_p" "")
|
9655 |
191 |
dgisselq |
+ (match_operand 1 "const_int_operand" "n"))
|
9656 |
|
|
+ (use (reg:SI RTN_REG))
|
9657 |
|
|
+ (clobber (reg:CC CC_REG))
|
9658 |
|
|
+ (simple_return)]
|
9659 |
|
|
+ ""
|
9660 |
|
|
+ "JMP\t%0"
|
9661 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
9662 |
|
|
+;
|
9663 |
|
|
+(define_expand "sibcall_value"
|
9664 |
|
|
+ [(set (match_operand 0 "register_operand" "")
|
9665 |
|
|
+ (call (mem:SI
|
9666 |
|
|
+ (match_operand 1 "zip_const_address_operand_p" ""))
|
9667 |
|
|
+ (match_operand 2 "" "")))
|
9668 |
|
|
+ (use (match_operand 3 "" ""))
|
9669 |
|
|
+ (use (reg:SI RTN_REG))
|
9670 |
|
|
+ (clobber (reg:CC CC_REG))
|
9671 |
|
|
+ (simple_return)]
|
9672 |
|
|
+ ""
|
9673 |
|
|
+ {
|
9674 |
|
|
+ if (MEM_P(operands[1])) {
|
9675 |
202 |
dgisselq |
+ ;// extern void zip_debug_rtx(const_rtx);
|
9676 |
|
|
+ ;//
|
9677 |
|
|
+ ;// fprintf(stderr, "SIBCALL/V: ");
|
9678 |
|
|
+ ;// zip_debug_rtx(operands[1]);
|
9679 |
|
|
+ ;//
|
9680 |
|
|
+ ;//
|
9681 |
|
|
+ ;// This should always be the case
|
9682 |
191 |
dgisselq |
+ rtx addr = XEXP(operands[1],0);
|
9683 |
|
|
+ if (zip_const_address_operand_p(addr, SImode)) {
|
9684 |
202 |
dgisselq |
+ emit_call_insn(gen_reg_sibcall_const(operands[0], addr, operands[2]));
|
9685 |
191 |
dgisselq |
+ } else if ((MEM_P(addr))&&(zip_address_operand(XEXP(addr,0)))) {
|
9686 |
202 |
dgisselq |
+ fprintf(stderr, "ERR: ZIP.MD::SIBCALL-VALUE() INDIRECT\n");
|
9687 |
|
|
+ emit_call_insn(gen_reg_sibcall_mem(operands[0], XEXP(addr,0), operands[2]));
|
9688 |
|
|
+ gcc_assert(0);
|
9689 |
191 |
dgisselq |
+ } else {
|
9690 |
202 |
dgisselq |
+ emit_call_insn(gen_reg_sibcall_var(operands[0], operands[1], operands[2]));
|
9691 |
191 |
dgisselq |
+ }
|
9692 |
|
|
+ DONE;
|
9693 |
202 |
dgisselq |
+ } else FAIL;
|
9694 |
191 |
dgisselq |
+ })
|
9695 |
|
|
+;
|
9696 |
|
|
+;
|
9697 |
|
|
+;
|
9698 |
|
|
+;
|
9699 |
102 |
dgisselq |
+; How do we want to do this better?
|
9700 |
|
|
+; Replace the RTL w/
|
9701 |
|
|
+; return_label= gen_label_rtx();
|
9702 |
|
|
+; emit_movsi(gen_rtx_REG(zip_R0),plus_constant(
|
9703 |
|
|
+; gen_rtx_REG(zip_PC),return_label));
|
9704 |
|
|
+; emit_jump(label_rtx(
|
9705 |
|
|
+;
|
9706 |
|
|
+; emit_label(return_label);
|
9707 |
|
|
+;
|
9708 |
|
|
+; The problem is: we can't! GCC distinguishes between jumps and calls when
|
9709 |
|
|
+; optimizing, and it doesn't see the need to keep the label around. Thus, the
|
9710 |
|
|
+; label gets removed and the call gets lost. Hence we do it this way (below).
|
9711 |
|
|
+; I'll probably bastardize a means of getting a new codelabel that GCC doesn't
|
9712 |
|
|
+; recognize as such, but for now we'll use .Lcall# as our label.
|
9713 |
|
|
+;
|
9714 |
|
|
+(define_insn "void_call_const"
|
9715 |
122 |
dgisselq |
+ [(call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
|
9716 |
111 |
dgisselq |
+ (match_operand 1 "const_int_operand" "n"))
|
9717 |
122 |
dgisselq |
+ (clobber (reg:SI RTN_REG))
|
9718 |
|
|
+ (clobber (reg:CC CC_REG))]
|
9719 |
102 |
dgisselq |
+ ""
|
9720 |
202 |
dgisselq |
+ "JSR\t%0"
|
9721 |
102 |
dgisselq |
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
9722 |
|
|
+(define_insn "void_call_mem"
|
9723 |
122 |
dgisselq |
+ [(call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
|
9724 |
111 |
dgisselq |
+ (match_operand 1 "const_int_operand" "n"))
|
9725 |
122 |
dgisselq |
+ (clobber (reg:SI RTN_REG))
|
9726 |
|
|
+ (clobber (reg:CC CC_REG))]
|
9727 |
102 |
dgisselq |
+ ""
|
9728 |
202 |
dgisselq |
+ "MOV .Lcall%=(PC),R0\;LW\t%0,PC\n.Lcall%=:"
|
9729 |
102 |
dgisselq |
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
9730 |
|
|
+;
|
9731 |
|
|
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
|
9732 |
|
|
+(define_insn "void_call_var"
|
9733 |
202 |
dgisselq |
+ [(call (match_operand:SI 0 "zip_memory_operand_p" "")
|
9734 |
111 |
dgisselq |
+ (match_operand 1 "const_int_operand" "n"))
|
9735 |
122 |
dgisselq |
+ (clobber (reg:SI RTN_REG))
|
9736 |
|
|
+ (clobber (reg:CC CC_REG))]
|
9737 |
102 |
dgisselq |
+ ""
|
9738 |
202 |
dgisselq |
+ {
|
9739 |
|
|
+ if (REG_P(operands[0]))
|
9740 |
|
|
+ return "JSR\t(%0)";
|
9741 |
|
|
+ else
|
9742 |
|
|
+ return "JSR\t%0";
|
9743 |
|
|
+ }
|
9744 |
102 |
dgisselq |
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
9745 |
191 |
dgisselq |
+;
|
9746 |
|
|
+;
|
9747 |
102 |
dgisselq |
+(define_expand "call_value"
|
9748 |
202 |
dgisselq |
+ [(parallel [(set (match_operand 0 "register_operand")
|
9749 |
102 |
dgisselq |
+ (call (match_operand:SI 1 "" "")
|
9750 |
111 |
dgisselq |
+ (match_operand 2 "const_int_operand" "n")))
|
9751 |
202 |
dgisselq |
+ (clobber (reg:SI RTN_REG))
|
9752 |
122 |
dgisselq |
+ (clobber (reg:CC CC_REG))])]
|
9753 |
102 |
dgisselq |
+ ""
|
9754 |
|
|
+ {
|
9755 |
|
|
+ if (MEM_P(operands[1])) {
|
9756 |
202 |
dgisselq |
+ ;// extern void zip_debug_rtx(const_rtx);
|
9757 |
|
|
+ ;//
|
9758 |
|
|
+ ;// fprintf(stderr, "CALL/V: ");
|
9759 |
|
|
+ ;// zip_debug_rtx(operands[1]);
|
9760 |
|
|
+ ;//
|
9761 |
|
|
+ ;//
|
9762 |
122 |
dgisselq |
+ //; This should always be the case
|
9763 |
102 |
dgisselq |
+ rtx addr = XEXP(operands[1],0);
|
9764 |
|
|
+ if (zip_const_address_operand_p(addr, SImode)) {
|
9765 |
122 |
dgisselq |
+ //; fprintf(stderr, "Generating gen_reg_call_const()\n");
|
9766 |
202 |
dgisselq |
+ emit_call_insn(gen_reg_call_const(operands[0], addr, operands[2]));
|
9767 |
102 |
dgisselq |
+ } else if ((MEM_P(addr))&&(zip_address_operand(XEXP(addr,0)))) {
|
9768 |
202 |
dgisselq |
+ fprintf(stderr, "ERR: ZIP.MD::CALL-VALUE() INDIRECT\n");
|
9769 |
|
|
+ emit_call_insn(gen_reg_call_mem(operands[0], XEXP(addr,0), operands[2]));
|
9770 |
|
|
+ gcc_assert(0);
|
9771 |
102 |
dgisselq |
+ } else {
|
9772 |
122 |
dgisselq |
+ //; fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
|
9773 |
202 |
dgisselq |
+ emit_call_insn(gen_reg_call_var(operands[0], operands[1], operands[2]));
|
9774 |
102 |
dgisselq |
+ }
|
9775 |
|
|
+ DONE;
|
9776 |
202 |
dgisselq |
+ } else FAIL;
|
9777 |
102 |
dgisselq |
+ })
|
9778 |
|
|
+(define_insn "reg_call_const"
|
9779 |
202 |
dgisselq |
+ [(set (match_operand 0 "register_operand" "")
|
9780 |
|
|
+ (call (mem:SI (match_operand:SI 1 "zip_const_address_operand_p" ""))
|
9781 |
|
|
+ (match_operand 2 "const_int_operand" "n")))
|
9782 |
122 |
dgisselq |
+ (clobber (reg:SI RTN_REG))
|
9783 |
|
|
+ (clobber (reg:CC CC_REG))]
|
9784 |
102 |
dgisselq |
+ ""
|
9785 |
202 |
dgisselq |
+ "JSR\t%1"
|
9786 |
102 |
dgisselq |
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
9787 |
|
|
+(define_insn "reg_call_mem"
|
9788 |
202 |
dgisselq |
+ [(set (match_operand 0 "register_operand" "")
|
9789 |
|
|
+ (call (mem:SI (match_operand:SI 1 "zip_memory_operand_p" "Q"))
|
9790 |
|
|
+ (match_operand 2 "const_int_operand" "n")))
|
9791 |
122 |
dgisselq |
+ (clobber (reg:SI RTN_REG))
|
9792 |
|
|
+ (clobber (reg:CC CC_REG))]
|
9793 |
102 |
dgisselq |
+ ""
|
9794 |
202 |
dgisselq |
+ "MOV .Lcall%=(PC),R0\t; CALL MEM (untested)\n\tLW\t%1,PC\n.Lcall%=:"
|
9795 |
102 |
dgisselq |
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
9796 |
111 |
dgisselq |
+;
|
9797 |
102 |
dgisselq |
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
|
9798 |
|
|
+(define_insn "reg_call_var"
|
9799 |
202 |
dgisselq |
+ [(set (match_operand 0 "register_operand" "")
|
9800 |
|
|
+ (call (match_operand:SI 1 "zip_memory_operand_p" "")
|
9801 |
|
|
+ (match_operand 2 "const_int_operand" "n")))
|
9802 |
122 |
dgisselq |
+ (clobber (reg:SI RTN_REG))
|
9803 |
|
|
+ (clobber (reg:CC CC_REG))]
|
9804 |
102 |
dgisselq |
+ ""
|
9805 |
202 |
dgisselq |
+ {
|
9806 |
|
|
+ ;// extern void zip_debug_rtx(const_rtx);
|
9807 |
|
|
+
|
9808 |
|
|
+ ;// fprintf(stderr, "CALL-V/REG: ");
|
9809 |
|
|
+ ;// zip_debug_rtx(operands[0]);
|
9810 |
|
|
+
|
9811 |
|
|
+ if (REG_P(operands[1]))
|
9812 |
|
|
+ return "JSR\t(%1)";
|
9813 |
|
|
+ else
|
9814 |
|
|
+ return "JSR\t%1";
|
9815 |
|
|
+ }
|
9816 |
102 |
dgisselq |
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
9817 |
|
|
+;
|
9818 |
|
|
+;
|
9819 |
|
|
+;
|
9820 |
191 |
dgisselq |
+(define_insn "reg_sibcall_const"
|
9821 |
202 |
dgisselq |
+ [(set (match_operand 0 "register_operand" "")
|
9822 |
|
|
+ (call (mem:SI (match_operand:SI 1 "zip_const_address_operand_p" ""))
|
9823 |
|
|
+ (match_operand 2 "const_int_operand" "n")))
|
9824 |
191 |
dgisselq |
+ (use (reg:SI RTN_REG))
|
9825 |
|
|
+ (clobber (reg:CC CC_REG))
|
9826 |
|
|
+ (simple_return)]
|
9827 |
|
|
+ ""
|
9828 |
202 |
dgisselq |
+ "BRA\t%1"
|
9829 |
191 |
dgisselq |
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
9830 |
|
|
+(define_insn "reg_sibcall_mem"
|
9831 |
202 |
dgisselq |
+ [(set (match_operand 0 "register_operand" "")
|
9832 |
|
|
+ (call (mem:SI (match_operand:SI 1 "zip_memory_operand_p" "Q"))
|
9833 |
|
|
+ (match_operand 2 "const_int_operand" "n")))
|
9834 |
191 |
dgisselq |
+ (use (reg:SI RTN_REG))
|
9835 |
|
|
+ (clobber (reg:CC CC_REG))
|
9836 |
|
|
+ (simple_return)]
|
9837 |
|
|
+ ""
|
9838 |
202 |
dgisselq |
+ "LW\t%1,PC"
|
9839 |
191 |
dgisselq |
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
9840 |
|
|
+;
|
9841 |
|
|
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
|
9842 |
|
|
+(define_insn "reg_sibcall_var"
|
9843 |
202 |
dgisselq |
+ [(set (match_operand 0 "register_operand" "")
|
9844 |
|
|
+ (call (match_operand:SI 1 "zip_memory_operand_p" "")
|
9845 |
|
|
+ (match_operand 2 "const_int_operand" "n")))
|
9846 |
191 |
dgisselq |
+ (use (reg:SI RTN_REG))
|
9847 |
|
|
+ (clobber (reg:CC CC_REG))
|
9848 |
|
|
+ (simple_return)]
|
9849 |
|
|
+ ""
|
9850 |
202 |
dgisselq |
+ {
|
9851 |
|
|
+ if (REG_P(operands[1]))
|
9852 |
|
|
+ return "JMP\t(%1); REG_SIBCALL_VAR";
|
9853 |
|
|
+ else
|
9854 |
|
|
+ return "JMP\t%1";
|
9855 |
|
|
+ }
|
9856 |
191 |
dgisselq |
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
9857 |
|
|
+;
|
9858 |
|
|
+;
|
9859 |
|
|
+;
|
9860 |
102 |
dgisselq |
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
9861 |
|
|
+;;
|
9862 |
|
|
+;; Frame manipulation RTX
|
9863 |
|
|
+;;
|
9864 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
9865 |
|
|
+;
|
9866 |
|
|
+;
|
9867 |
|
|
+;
|
9868 |
|
|
+(define_expand "prologue"
|
9869 |
|
|
+ [(const_int 0)]
|
9870 |
|
|
+ ""
|
9871 |
|
|
+ "{ zip_expand_prologue(); DONE; }")
|
9872 |
191 |
dgisselq |
+(define_expand "sibcall_epilogue"
|
9873 |
|
|
+ [(return)]
|
9874 |
|
|
+ ""
|
9875 |
|
|
+ "{ zip_sibcall_epilogue(); DONE; }")
|
9876 |
102 |
dgisselq |
+(define_expand "epilogue"
|
9877 |
|
|
+ [(return)]
|
9878 |
|
|
+ ""
|
9879 |
|
|
+ "{ zip_expand_epilogue(); DONE; }")
|
9880 |
|
|
+(define_expand "return" ; In order to use the function predicate, this *must*
|
9881 |
|
|
+ [(return)] ; be a define_expand
|
9882 |
|
|
+ "zip_use_return_insn()")
|
9883 |
|
|
+ ; "JMP R0"
|
9884 |
|
|
+ ; [(set_attr "ccresult" "unchanged")])
|
9885 |
|
|
+(define_insn "*return" ; A "*" -- means it cannot be called from C
|
9886 |
|
|
+ [(return)]
|
9887 |
|
|
+ ""
|
9888 |
200 |
dgisselq |
+ "RETN"
|
9889 |
102 |
dgisselq |
+ [(set_attr "ccresult" "unchanged")])
|
9890 |
|
|
+(define_insn "simple_return" ; A "*" -- means it cannot be called from C
|
9891 |
|
|
+ [(simple_return)]
|
9892 |
|
|
+ ""
|
9893 |
200 |
dgisselq |
+ "RETN"
|
9894 |
102 |
dgisselq |
+ [(set_attr "ccresult" "unchanged")])
|
9895 |
191 |
dgisselq |
+(define_insn "return_if_eq"
|
9896 |
|
|
+ [(set (pc) (if_then_else (eq (reg:CC CC_REG) (const_int 0))
|
9897 |
|
|
+ (return) (pc)))]
|
9898 |
|
|
+ "zip_use_return_insn()"
|
9899 |
200 |
dgisselq |
+ "RETN.Z"
|
9900 |
191 |
dgisselq |
+ [(set_attr "ccresult" "unchanged") (set_attr "predicable" "no")])
|
9901 |
|
|
+(define_insn "return_if_ne"
|
9902 |
|
|
+ [(set (pc) (if_then_else (ne (reg:CC CC_REG) (const_int 0))
|
9903 |
|
|
+ (return) (pc)))]
|
9904 |
|
|
+ "zip_use_return_insn()"
|
9905 |
200 |
dgisselq |
+ "RETN.NZ"
|
9906 |
191 |
dgisselq |
+ [(set_attr "ccresult" "unchanged") (set_attr "predicable" "no")])
|
9907 |
|
|
+(define_insn "return_if_lt"
|
9908 |
|
|
+ [(set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
|
9909 |
|
|
+ (return) (pc)))]
|
9910 |
|
|
+ "zip_use_return_insn()"
|
9911 |
200 |
dgisselq |
+ "RETN.LT"
|
9912 |
191 |
dgisselq |
+ [(set_attr "ccresult" "unchanged") (set_attr "predicable" "no")])
|
9913 |
|
|
+(define_insn "return_if_gte"
|
9914 |
|
|
+ [(set (pc) (if_then_else (ge (reg:CC CC_REG) (const_int 0))
|
9915 |
|
|
+ (return) (pc)))]
|
9916 |
202 |
dgisselq |
+ "(zip_use_return_insn())"
|
9917 |
200 |
dgisselq |
+ "RETN.GTE"
|
9918 |
191 |
dgisselq |
+ [(set_attr "ccresult" "unchanged") (set_attr "predicable" "no")])
|
9919 |
|
|
+(define_insn "return_if_ltu"
|
9920 |
|
|
+ [(set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
|
9921 |
|
|
+ (return) (pc)))]
|
9922 |
|
|
+ "zip_use_return_insn()"
|
9923 |
200 |
dgisselq |
+ "RETN.C"
|
9924 |
191 |
dgisselq |
+ [(set_attr "ccresult" "unchanged") (set_attr "predicable" "no")])
|
9925 |
200 |
dgisselq |
+(define_insn "return_if_geu"
|
9926 |
|
|
+ [(set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
|
9927 |
|
|
+ (return) (pc)))]
|
9928 |
202 |
dgisselq |
+ "(zip_use_return_insn())"
|
9929 |
200 |
dgisselq |
+ "RETN.NC"
|
9930 |
|
|
+ [(set_attr "ccresult" "unchanged") (set_attr "predicable" "no")])
|
9931 |
102 |
dgisselq |
+;
|
9932 |
|
|
+;
|
9933 |
|
|
+;
|
9934 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;
|
9935 |
|
|
+;;
|
9936 |
|
|
+;; Zip Builtin Functions
|
9937 |
|
|
+;;
|
9938 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;
|
9939 |
|
|
+;
|
9940 |
|
|
+;
|
9941 |
|
|
+;
|
9942 |
|
|
+(define_insn "zip_rtu"
|
9943 |
|
|
+ [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_RTU)
|
9944 |
122 |
dgisselq |
+ (clobber (reg:CC CC_REG))]
|
9945 |
102 |
dgisselq |
+ "(!ZIP_USER)"
|
9946 |
|
|
+ "RTU"
|
9947 |
|
|
+ [(set_attr "ccresult" "unknown")])
|
9948 |
171 |
dgisselq |
+(define_insn "zip_busy"
|
9949 |
|
|
+ [(set (pc) (minus:SI (pc) (const_int 1)))]
|
9950 |
|
|
+ ""
|
9951 |
|
|
+ "BUSY"
|
9952 |
|
|
+ [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
|
9953 |
102 |
dgisselq |
+(define_insn "zip_halt" ; Needs to be unspec_volatile, or optimizer will opt out
|
9954 |
|
|
+ [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_HALT)
|
9955 |
122 |
dgisselq |
+ (clobber (reg:CC CC_REG))]
|
9956 |
102 |
dgisselq |
+ "(!ZIP_USER)"
|
9957 |
|
|
+ "HALT"
|
9958 |
|
|
+ [(set_attr "ccresult" "unknown")])
|
9959 |
|
|
+(define_insn "zip_idle"
|
9960 |
|
|
+ [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_IDLE)
|
9961 |
122 |
dgisselq |
+ (clobber (reg:CC CC_REG))]
|
9962 |
102 |
dgisselq |
+ ""
|
9963 |
|
|
+ "WAIT"
|
9964 |
|
|
+ [(set_attr "ccresult" "unknown")])
|
9965 |
|
|
+(define_insn "zip_syscall"
|
9966 |
|
|
+ [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_SYSCALL)]
|
9967 |
|
|
+ ""
|
9968 |
|
|
+ "CLR\tCC"
|
9969 |
|
|
+ [(set_attr "ccresult" "unknown")])
|
9970 |
|
|
+;
|
9971 |
|
|
+;
|
9972 |
|
|
+; Operator "save_context"
|
9973 |
|
|
+;
|
9974 |
117 |
dgisselq |
+; Okay, so we're not really reading and writing operand 0, %0, however
|
9975 |
|
|
+; if we don't list it as a "+r" register, the compiler may allocate it
|
9976 |
|
|
+; among the other registers, thus we clobber it in the middle of the
|
9977 |
|
|
+; operation before the task is complete.
|
9978 |
102 |
dgisselq |
+;
|
9979 |
|
|
+(define_insn "zip_save_context"
|
9980 |
117 |
dgisselq |
+ [(unspec_volatile
|
9981 |
|
|
+ [ (match_operand:SI 0 "register_operand" "+r") ]
|
9982 |
102 |
dgisselq |
+ UNSPEC_SAVE_CONTEXT)
|
9983 |
|
|
+ (clobber (match_scratch:SI 1 "=r"))
|
9984 |
|
|
+ (clobber (match_scratch:SI 2 "=r"))
|
9985 |
|
|
+ (clobber (match_scratch:SI 3 "=r"))
|
9986 |
117 |
dgisselq |
+ (clobber (match_scratch:SI 4 "=r"))]
|
9987 |
102 |
dgisselq |
+ "(!ZIP_USER)"
|
9988 |
|
|
+ "MOV\tuR0,%1
|
9989 |
|
|
+ MOV\tuR1,%2
|
9990 |
|
|
+ MOV\tuR2,%3
|
9991 |
|
|
+ MOV\tuR3,%4
|
9992 |
202 |
dgisselq |
+ SW\t%1,%0
|
9993 |
|
|
+ SW\t%2,4(%0)
|
9994 |
|
|
+ SW\t%3,8(%0)
|
9995 |
|
|
+ SW\t%4,12(%0)
|
9996 |
102 |
dgisselq |
+ MOV\tuR4,%1
|
9997 |
|
|
+ MOV\tuR5,%2
|
9998 |
|
|
+ MOV\tuR6,%3
|
9999 |
|
|
+ MOV\tuR7,%4
|
10000 |
202 |
dgisselq |
+ SW\t%1,16(%0)
|
10001 |
|
|
+ SW\t%2,20(%0)
|
10002 |
|
|
+ SW\t%3,24(%0)
|
10003 |
|
|
+ SW\t%4,28(%0)
|
10004 |
102 |
dgisselq |
+ MOV\tuR8,%1
|
10005 |
|
|
+ MOV\tuR9,%2
|
10006 |
|
|
+ MOV\tuR10,%3
|
10007 |
|
|
+ MOV\tuR11,%4
|
10008 |
202 |
dgisselq |
+ SW\t%1,32(%0)
|
10009 |
|
|
+ SW\t%2,36(%0)
|
10010 |
|
|
+ SW\t%3,40(%0)
|
10011 |
|
|
+ SW\t%4,44(%0)
|
10012 |
102 |
dgisselq |
+ MOV\tuR12,%1
|
10013 |
|
|
+ MOV\tuSP,%2
|
10014 |
|
|
+ MOV\tuCC,%3
|
10015 |
|
|
+ MOV\tuPC,%4
|
10016 |
202 |
dgisselq |
+ SW\t%1,48(%0)
|
10017 |
|
|
+ SW\t%2,52(%0)
|
10018 |
|
|
+ SW\t%3,56(%0)
|
10019 |
|
|
+ SW\t%4,60(%0)"
|
10020 |
122 |
dgisselq |
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
|
10021 |
117 |
dgisselq |
+;
|
10022 |
|
|
+; See the comment above about why operand 0, %0, *must* be a "+r" operand,
|
10023 |
|
|
+; even though we don't really read (or change) its value throughout this
|
10024 |
|
|
+; operation.
|
10025 |
|
|
+;
|
10026 |
102 |
dgisselq |
+(define_insn "zip_restore_context"
|
10027 |
|
|
+ [(unspec_volatile [
|
10028 |
117 |
dgisselq |
+ (match_operand:SI 0 "register_operand" "+r")] UNSPEC_RESTORE_CONTEXT)
|
10029 |
102 |
dgisselq |
+ (clobber (match_scratch:SI 1 "=r"))
|
10030 |
|
|
+ (clobber (match_scratch:SI 2 "=r"))
|
10031 |
|
|
+ (clobber (match_scratch:SI 3 "=r"))
|
10032 |
117 |
dgisselq |
+ (clobber (match_scratch:SI 4 "=r"))]
|
10033 |
102 |
dgisselq |
+ "(!ZIP_USER)"
|
10034 |
202 |
dgisselq |
+ "LW\t0(%0),%1
|
10035 |
|
|
+ LW\t4(%0),%2
|
10036 |
|
|
+ LW\t8(%0),%3
|
10037 |
|
|
+ LW\t12(%0),%4
|
10038 |
102 |
dgisselq |
+ MOV\t%1,uR0
|
10039 |
|
|
+ MOV\t%2,uR1
|
10040 |
|
|
+ MOV\t%3,uR2
|
10041 |
|
|
+ MOV\t%4,uR3
|
10042 |
202 |
dgisselq |
+ LW\t16(%0),%1
|
10043 |
|
|
+ LW\t20(%0),%2
|
10044 |
|
|
+ LW\t24(%0),%3
|
10045 |
|
|
+ LW\t28(%0),%4
|
10046 |
102 |
dgisselq |
+ MOV\t%1,uR4
|
10047 |
|
|
+ MOV\t%2,uR5
|
10048 |
|
|
+ MOV\t%3,uR6
|
10049 |
|
|
+ MOV\t%4,uR7
|
10050 |
202 |
dgisselq |
+ LW\t32(%0),%1
|
10051 |
|
|
+ LW\t36(%0),%2
|
10052 |
|
|
+ LW\t40(%0),%3
|
10053 |
|
|
+ LW\t44(%0),%4
|
10054 |
102 |
dgisselq |
+ MOV\t%1,uR8
|
10055 |
|
|
+ MOV\t%2,uR9
|
10056 |
|
|
+ MOV\t%3,uR10
|
10057 |
|
|
+ MOV\t%4,uR11
|
10058 |
202 |
dgisselq |
+ LW\t48(%0),%1
|
10059 |
|
|
+ LW\t52(%0),%2
|
10060 |
|
|
+ LW\t56(%0),%3
|
10061 |
|
|
+ LW\t60(%0),%4
|
10062 |
102 |
dgisselq |
+ MOV\t%1,uR12
|
10063 |
|
|
+ MOV\t%2,uSP
|
10064 |
|
|
+ MOV\t%3,uCC
|
10065 |
|
|
+ MOV\t%4,uPC"
|
10066 |
122 |
dgisselq |
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
|
10067 |
102 |
dgisselq |
+(define_insn "zip_bitrev"
|
10068 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
10069 |
|
|
+ (unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_BITREV))
|
10070 |
|
|
+ ]
|
10071 |
|
|
+ ""
|
10072 |
|
|
+ "BREV\t%1,%0"
|
10073 |
122 |
dgisselq |
+ [(set_attr "ccresult" "unchanged")])
|
10074 |
102 |
dgisselq |
+(define_insn "zip_cc"
|
10075 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
10076 |
|
|
+ (unspec:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
|
10077 |
|
|
+ ""
|
10078 |
|
|
+ "MOV\tCC,%0"
|
10079 |
|
|
+ [(set_attr "ccresult" "unchanged")])
|
10080 |
117 |
dgisselq |
+(define_insn "zip_ucc"
|
10081 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
10082 |
|
|
+ (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETUCC))]
|
10083 |
|
|
+ ""
|
10084 |
|
|
+ "MOV\tuCC,%0"
|
10085 |
|
|
+ [(set_attr "ccresult" "unchanged")])
|
10086 |
111 |
dgisselq |
+(define_insn "zip_cc_sto"
|
10087 |
|
|
+ [(set (mem:SI (match_operand:SI 0 "register_operand" "r"))
|
10088 |
117 |
dgisselq |
+ (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
|
10089 |
111 |
dgisselq |
+ ""
|
10090 |
202 |
dgisselq |
+ "SW\tCC,(%0)"
|
10091 |
111 |
dgisselq |
+ [(set_attr "ccresult" "unchanged")])
|
10092 |
|
|
+(define_insn "zip_cc_sto_off"
|
10093 |
|
|
+ [(set (mem:SI (plus:SI
|
10094 |
|
|
+ (match_operand:SI 0 "register_operand" "r")
|
10095 |
|
|
+ (match_operand:SI 1 "const_int_operand" "N")))
|
10096 |
117 |
dgisselq |
+ (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
|
10097 |
111 |
dgisselq |
+ ""
|
10098 |
202 |
dgisselq |
+ "SW\tCC,%1(%0)"
|
10099 |
111 |
dgisselq |
+ [(set_attr "ccresult" "unchanged")])
|
10100 |
102 |
dgisselq |
+(define_insn "ldilo"
|
10101 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
10102 |
|
|
+ (unspec:SI [(match_operand:SI 1 "immediate_operand" "")] UNSPEC_LDILO))]
|
10103 |
|
|
+ ""
|
10104 |
|
|
+ "LDILO %1,%0"
|
10105 |
|
|
+ [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
|
10106 |
|
|
+
|
10107 |
|
|
+;
|
10108 |
|
|
+;
|
10109 |
171 |
dgisselq |
+; Missing still: zip_break(idno)
|
10110 |
|
|
+; Would also be nice to have a zip_reg builtin, allowing us to read or write
|
10111 |
|
|
+; a register, as in zip_reg(5)=40;. Not sure what this means, though, when the
|
10112 |
|
|
+; number placed into this is not constant, or how to specify that it must *only*
|
10113 |
|
|
+; be constant. Thats actually the problem with both proposals, zip_break(id)
|
10114 |
|
|
+; and zip_reg(regno)--both depend upon a compile time constant to work.
|
10115 |
102 |
dgisselq |
+;
|
10116 |
171 |
dgisselq |
+;
|
10117 |
|
|
+;
|
10118 |
|
|
+;
|
10119 |
|
|
+;
|
10120 |
102 |
dgisselq |
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
10121 |
|
|
+;;
|
10122 |
|
|
+;; Trap Instruction
|
10123 |
|
|
+;;
|
10124 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
10125 |
|
|
+;
|
10126 |
|
|
+;
|
10127 |
|
|
+; The ZipCPU doesn't really have a "trap" instruction per se. The goal is that
|
10128 |
|
|
+; *nothing* should ever trap, and so we should never get here. However, the
|
10129 |
|
|
+; compiler seems to want a trap instruction for some reason. (It keeps us
|
10130 |
|
|
+; from calling the abort() function, if we don't define these ...) So let's
|
10131 |
|
|
+; just grab onto the break instruction and declare it to be a trap instruction
|
10132 |
|
|
+; for our purposes. Alternatively, we might've used a syscall, but ... this
|
10133 |
|
|
+; will work for both user and system instructions.
|
10134 |
|
|
+;
|
10135 |
|
|
+(define_insn "trap"
|
10136 |
|
|
+ [(trap_if (const_int 1) (const_int 0))]
|
10137 |
|
|
+ ""
|
10138 |
|
|
+ "BREAK"
|
10139 |
|
|
+ [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
|
10140 |
|
|
+;
|
10141 |
202 |
dgisselq |
+(define_expand "ctrapsi4"
|
10142 |
122 |
dgisselq |
+ [(set (reg:CC CC_REG) (compare:CC
|
10143 |
202 |
dgisselq |
+ (match_operand:SI 1 "register_operand" "r")
|
10144 |
|
|
+ (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
|
10145 |
102 |
dgisselq |
+ (trap_if (match_operator 0 "ordered_comparison_operator"
|
10146 |
122 |
dgisselq |
+ [(reg:CC CC_REG) (const_int 0)])
|
10147 |
102 |
dgisselq |
+ (match_operand 3 "const_int_operand" "O"))]
|
10148 |
|
|
+ ""
|
10149 |
|
|
+ )
|
10150 |
|
|
+(define_insn "trapif"
|
10151 |
|
|
+ [(trap_if (match_operator 0 "ordered_comparison_operator"
|
10152 |
122 |
dgisselq |
+ [(reg:CC CC_REG) (const_int 0)])
|
10153 |
102 |
dgisselq |
+ (match_operand 1 "const_int_operand" "O"))]
|
10154 |
|
|
+ ""
|
10155 |
|
|
+ "BREAK\t%1"
|
10156 |
|
|
+ [(set_attr "predicable" "no")])
|
10157 |
|
|
+;
|
10158 |
|
|
+;
|
10159 |
|
|
+;
|
10160 |
200 |
dgisselq |
+;
|
10161 |
202 |
dgisselq |
+(include "zip-di.md")
|
10162 |
|
|
+(include "zip-ops.md")
|
10163 |
200 |
dgisselq |
+(include "zip-float.md")
|
10164 |
|
|
+(include "zip-sync.md")
|
10165 |
|
|
+(include "zip-peephole.md")
|
10166 |
|
|
+;
|
10167 |
|
|
+;
|
10168 |
102 |
dgisselq |
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
10169 |
|
|
+;;
|
10170 |
|
|
+;; Unimplemented (or not yet implemented) RTL Codes
|
10171 |
|
|
+;;
|
10172 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
10173 |
|
|
+;
|
10174 |
|
|
+;
|
10175 |
|
|
+;
|
10176 |
|
|
+;
|
10177 |
200 |
dgisselq |
+;(define_insn "addvsi4"
|
10178 |
|
|
+; )
|
10179 |
|
|
+;(define_insn "subvsi4"
|
10180 |
|
|
+; )
|
10181 |
|
|
+;(define_insn "mulvsi4"
|
10182 |
|
|
+; )
|
10183 |
|
|
+;(define_insn "umulvsi4"
|
10184 |
|
|
+; )
|
10185 |
|
|
+;(define_insn "umulvsi4"
|
10186 |
|
|
+; )
|
10187 |
102 |
dgisselq |
+;(define_insn "negvsi3"
|
10188 |
|
|
+; "MOV %1,%0
|
10189 |
|
|
+; XOR -1,%0
|
10190 |
|
|
+; ADD 1,%0
|
10191 |
|
|
+; BV %2"
|
10192 |
200 |
dgisselq |
+; )
|
10193 |
124 |
dgisselq |
+;
|
10194 |
200 |
dgisselq |
+;(define_insn "ssum_widen
|
10195 |
|
|
+;(define_insn "usum_widen
|
10196 |
|
|
+;(define_insn "udot_prod"
|
10197 |
|
|
+;(define_insn "maddsidi4"
|
10198 |
|
|
+;(define_insn "umaddsidi4"
|
10199 |
|
|
+;(define_insn "msubsidi4"
|
10200 |
|
|
+;(define_insn "umsubsidi4"
|
10201 |
|
|
+;
|
10202 |
|
|
+;
|
10203 |
|
|
+; STILL MISSING:
|
10204 |
|
|
+; SYSCALL(ID)
|
10205 |
|
|
+; MOV %ID,R0
|
10206 |
|
|
+; CLR CC
|
10207 |
|
|
+; cmove ... the conditional move, created from a
|
10208 |
|
|
+; (set (match_op 0 "" "r") (if_then_else (condition) (a) (reg X))))
|
10209 |
|
|
+; pattern
|
10210 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/config/zip/zip-modes.def gcc-6.2.0-zip/gcc/config/zip/zip-modes.def
|
10211 |
|
|
--- gcc-6.2.0/gcc/config/zip/zip-modes.def 1969-12-31 19:00:00.000000000 -0500
|
10212 |
|
|
+++ gcc-6.2.0-zip/gcc/config/zip/zip-modes.def 2017-01-10 12:46:54.791966242 -0500
|
10213 |
|
|
@@ -0,0 +1 @@
|
10214 |
|
|
+#define BITS_PER_UNIT 8
|
10215 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/config/zip/zip-peephole.md gcc-6.2.0-zip/gcc/config/zip/zip-peephole.md
|
10216 |
|
|
--- gcc-6.2.0/gcc/config/zip/zip-peephole.md 1969-12-31 19:00:00.000000000 -0500
|
10217 |
|
|
+++ gcc-6.2.0-zip/gcc/config/zip/zip-peephole.md 2017-03-01 15:46:02.440221158 -0500
|
10218 |
|
|
@@ -0,0 +1,768 @@
|
10219 |
200 |
dgisselq |
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
10220 |
|
|
+;;
|
10221 |
|
|
+;; Filename: zip-peephole.md
|
10222 |
|
|
+;;
|
10223 |
|
|
+;; Project: Zip CPU -- a small, lightweight, RISC CPU soft core
|
10224 |
|
|
+;;
|
10225 |
|
|
+;; Purpose: This is a machine description of a variety of peephole
|
10226 |
|
|
+;; optimizations which can be applied to the ZipCPU RTL
|
10227 |
|
|
+;; representation.
|
10228 |
|
|
+;;
|
10229 |
|
|
+;;
|
10230 |
|
|
+;; Creator: Dan Gisselquist, Ph.D.
|
10231 |
|
|
+;; Gisselquist Technology, LLC
|
10232 |
|
|
+;;
|
10233 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
10234 |
|
|
+;;
|
10235 |
202 |
dgisselq |
+;; Copyright (C) 2015,2017, Gisselquist Technology, LLC
|
10236 |
200 |
dgisselq |
+;;
|
10237 |
|
|
+;; This program is free software (firmware): you can redistribute it and/or
|
10238 |
|
|
+;; modify it under the terms of the GNU General Public License as published
|
10239 |
|
|
+;; by the Free Software Foundation, either version 3 of the License, or (at
|
10240 |
|
|
+;; your option) any later version.
|
10241 |
|
|
+;;
|
10242 |
|
|
+;; This program is distributed in the hope that it will be useful, but WITHOUT
|
10243 |
|
|
+;; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
10244 |
|
|
+;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
10245 |
|
|
+;; for more details.
|
10246 |
|
|
+;;
|
10247 |
|
|
+;; License: GPL, v3, as defined and found on www.gnu.org,
|
10248 |
|
|
+;; http://www.gnu.org/licenses/gpl.html
|
10249 |
|
|
+;;
|
10250 |
|
|
+;;
|
10251 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
10252 |
|
|
+;;
|
10253 |
|
|
+;
|
10254 |
|
|
+;
|
10255 |
|
|
+;
|
10256 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
10257 |
|
|
+;;
|
10258 |
|
|
+;; Peephole optimizations
|
10259 |
|
|
+;;
|
10260 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
10261 |
|
|
+;
|
10262 |
|
|
+;
|
10263 |
|
|
+;
|
10264 |
|
|
+;
|
10265 |
|
|
+;
|
10266 |
124 |
dgisselq |
+; Match:
|
10267 |
|
|
+; CMP R1,R0
|
10268 |
|
|
+; BGTU lbl
|
10269 |
|
|
+; Transform to:
|
10270 |
|
|
+; CMP R0,R1
|
10271 |
|
|
+; BC lbl
|
10272 |
|
|
+;
|
10273 |
117 |
dgisselq |
+(define_peephole2
|
10274 |
122 |
dgisselq |
+ [(set (reg:CC CC_REG) (compare:CC
|
10275 |
|
|
+ (match_operand:SI 0 "register_operand")
|
10276 |
|
|
+ (match_operand:SI 1 "register_operand")))
|
10277 |
|
|
+ (set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
|
10278 |
|
|
+ (label_ref (match_operand 2 ""))
|
10279 |
117 |
dgisselq |
+ (pc)))]
|
10280 |
127 |
dgisselq |
+ "(ZIP_PEEPHOLE)"
|
10281 |
122 |
dgisselq |
+ [(set (reg:CC CC_REG) (compare:CC (match_dup 1) (match_dup 0)))
|
10282 |
|
|
+ (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
|
10283 |
117 |
dgisselq |
+ (label_ref (match_dup 2))
|
10284 |
|
|
+ (pc)))]
|
10285 |
|
|
+ "")
|
10286 |
127 |
dgisselq |
+(define_peephole2
|
10287 |
|
|
+ [(match_scratch:SI 3 "=r")
|
10288 |
|
|
+ (set (reg:CC CC_REG) (compare:CC
|
10289 |
|
|
+ (match_operand:SI 0 "register_operand")
|
10290 |
|
|
+ (match_operand 1 "const_int_operand")))
|
10291 |
|
|
+ (match_dup 3)
|
10292 |
|
|
+ (set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
|
10293 |
|
|
+ (label_ref (match_operand 2 ""))
|
10294 |
|
|
+ (pc)))]
|
10295 |
|
|
+ "(ZIP_PEEPHOLE)"
|
10296 |
|
|
+ [(set (match_dup 3) (match_dup 1))
|
10297 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 3) (match_dup 0)))
|
10298 |
|
|
+ (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
|
10299 |
|
|
+ (label_ref (match_dup 2))
|
10300 |
|
|
+ (pc)))]
|
10301 |
|
|
+ "")
|
10302 |
|
|
+;(define_peephole2
|
10303 |
|
|
+; [(set (reg:CC CC_REG) (compare:CC
|
10304 |
|
|
+; (match_operand:SI 0 "register_operand")
|
10305 |
|
|
+; (match_operand 1 "const_int_operand")))
|
10306 |
|
|
+; (set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
|
10307 |
|
|
+; (label_ref (match_operand 2 ""))
|
10308 |
|
|
+; (pc)))]
|
10309 |
|
|
+; ""
|
10310 |
|
|
+; [(set (reg:CC CC_REG) (compare:CC (match_dup 0) (match_dup 1)))
|
10311 |
|
|
+; (set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
|
10312 |
|
|
+; (label_ref (match_dup 2))
|
10313 |
|
|
+; (pc)))]
|
10314 |
|
|
+; "operands[1] = GEN_INT(INTVAL(operands[1])-1);")
|
10315 |
124 |
dgisselq |
+;
|
10316 |
|
|
+;
|
10317 |
|
|
+; Match:
|
10318 |
|
|
+; CMP R1,R0
|
10319 |
|
|
+; BGEU lbl
|
10320 |
|
|
+; Transform to:
|
10321 |
|
|
+; CMP 1(R0),R1
|
10322 |
|
|
+; BC lbl
|
10323 |
|
|
+;
|
10324 |
117 |
dgisselq |
+(define_peephole2
|
10325 |
122 |
dgisselq |
+ [(set (reg:CC CC_REG) (compare:CC
|
10326 |
|
|
+ (match_operand:SI 0 "register_operand")
|
10327 |
|
|
+ (match_operand:SI 1 "register_operand")))
|
10328 |
|
|
+ (set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
|
10329 |
|
|
+ (label_ref (match_operand 2 ""))
|
10330 |
117 |
dgisselq |
+ (pc)))]
|
10331 |
127 |
dgisselq |
+ "(ZIP_PEEPHOLE)"
|
10332 |
122 |
dgisselq |
+ [(set (reg:CC CC_REG) (compare:CC
|
10333 |
146 |
dgisselq |
+ (match_dup 1) (plus:SI (match_dup 0) (const_int 1))))
|
10334 |
122 |
dgisselq |
+ (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
|
10335 |
117 |
dgisselq |
+ (label_ref (match_dup 2))
|
10336 |
|
|
+ (pc)))]
|
10337 |
|
|
+ "")
|
10338 |
124 |
dgisselq |
+;
|
10339 |
|
|
+;
|
10340 |
|
|
+; Match:
|
10341 |
|
|
+; CMP R1,R0
|
10342 |
|
|
+; BGE lbl
|
10343 |
|
|
+; Transform to:
|
10344 |
|
|
+; CMP 1(R0),R1
|
10345 |
|
|
+; BLT lbl
|
10346 |
142 |
dgisselq |
+; ... why? when we support a BGE instruction?
|
10347 |
|
|
+;(define_peephole2
|
10348 |
|
|
+ ;[(set (reg:CC CC_REG) (compare:CC
|
10349 |
|
|
+ ;(match_operand:SI 0 "register_operand")
|
10350 |
|
|
+ ;(match_operand:SI 1 "register_operand")))
|
10351 |
|
|
+ ;(set (pc) (if_then_else (ge (reg:CC CC_REG) (const_int 0))
|
10352 |
|
|
+ ;(label_ref (match_operand 2 ""))
|
10353 |
|
|
+ ;(pc)))]
|
10354 |
|
|
+ ;"(ZIP_PEEPHOLE)"
|
10355 |
|
|
+ ;[(set (reg:CC CC_REG) (compare:CC (match_dup 1)
|
10356 |
|
|
+ ;(plus:SI (match_dup 0) (const_int 1))))
|
10357 |
|
|
+ ;(set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
|
10358 |
|
|
+ ;(label_ref (match_dup 2))
|
10359 |
|
|
+ ;(pc)))]
|
10360 |
|
|
+ ;"")
|
10361 |
124 |
dgisselq |
+;
|
10362 |
|
|
+;
|
10363 |
|
|
+; Match:
|
10364 |
|
|
+; CMP R1,R0
|
10365 |
|
|
+; BLEU lbl
|
10366 |
|
|
+; Transform to:
|
10367 |
|
|
+; CMP 1(R1),R0
|
10368 |
142 |
dgisselq |
+; BC lbl
|
10369 |
124 |
dgisselq |
+;
|
10370 |
117 |
dgisselq |
+(define_peephole2
|
10371 |
122 |
dgisselq |
+ [(set (reg:CC CC_REG) (compare:CC
|
10372 |
|
|
+ (match_operand:SI 0 "register_operand" "")
|
10373 |
117 |
dgisselq |
+ (match_operand:SI 1 "register_operand" "")))
|
10374 |
122 |
dgisselq |
+ (set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
|
10375 |
117 |
dgisselq |
+ (label_ref (match_operand 2 "" ""))
|
10376 |
|
|
+ (pc)))]
|
10377 |
127 |
dgisselq |
+ "(ZIP_PEEPHOLE)"
|
10378 |
122 |
dgisselq |
+ [(set (reg:CC CC_REG) (compare:CC (match_dup 0)
|
10379 |
146 |
dgisselq |
+ (plus:SI (match_dup 1) (const_int 1))))
|
10380 |
122 |
dgisselq |
+ (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
|
10381 |
117 |
dgisselq |
+ (label_ref (match_dup 2))
|
10382 |
|
|
+ (pc)))]
|
10383 |
|
|
+ "")
|
10384 |
|
|
+;
|
10385 |
142 |
dgisselq |
+;
|
10386 |
|
|
+;
|
10387 |
|
|
+; Match:
|
10388 |
|
|
+; CMP R1,R0
|
10389 |
|
|
+; BLE lbl
|
10390 |
|
|
+; Transform to:
|
10391 |
|
|
+; CMP 1(R1),R0
|
10392 |
|
|
+; BLT lbl
|
10393 |
|
|
+;
|
10394 |
127 |
dgisselq |
+(define_peephole2
|
10395 |
|
|
+ [(set (reg:CC CC_REG)
|
10396 |
|
|
+ (compare:CC (match_operand:SI 0 "register_operand" "")
|
10397 |
|
|
+ (match_operand:SI 1 "const_int_operand" "")))
|
10398 |
|
|
+ (set (pc) (if_then_else (le (reg:CC CC_REG) (const_int 0))
|
10399 |
|
|
+ (label_ref (match_operand 2 "" ""))
|
10400 |
|
|
+ (pc)))]
|
10401 |
|
|
+ "(ZIP_PEEPHOLE)&&(INTVAL(operands[1])<((1<<17)-2))"
|
10402 |
|
|
+ [(set (reg:CC CC_REG) (compare:CC (match_dup 0) (match_dup 1)))
|
10403 |
|
|
+ (set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
|
10404 |
|
|
+ (label_ref (match_dup 2))
|
10405 |
|
|
+ (pc)))]
|
10406 |
|
|
+ "operands[1] = GEN_INT(INTVAL(operands[1])+1);")
|
10407 |
142 |
dgisselq |
+;
|
10408 |
|
|
+; Match:
|
10409 |
|
|
+; CMP R1,R0
|
10410 |
|
|
+; BLEU lbl
|
10411 |
|
|
+; Transform to:
|
10412 |
|
|
+; CMP 1(R1),R0
|
10413 |
|
|
+; BC(LTU) lbl
|
10414 |
|
|
+;
|
10415 |
127 |
dgisselq |
+(define_peephole2
|
10416 |
|
|
+ [(set (reg:CC CC_REG)
|
10417 |
|
|
+ (compare:CC (match_operand:SI 0 "register_operand" "")
|
10418 |
|
|
+ (match_operand:SI 1 "const_int_operand" "")))
|
10419 |
|
|
+ (set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
|
10420 |
|
|
+ (label_ref (match_operand 2 "" ""))
|
10421 |
|
|
+ (pc)))]
|
10422 |
|
|
+ "(ZIP_PEEPHOLE)&&(INTVAL(operands[1])<((1<<17)-2))"
|
10423 |
|
|
+ [(set (reg:CC CC_REG) (compare:CC (match_dup 0) (match_dup 1)))
|
10424 |
142 |
dgisselq |
+ (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
|
10425 |
127 |
dgisselq |
+ (label_ref (match_dup 2))
|
10426 |
|
|
+ (pc)))]
|
10427 |
|
|
+ "operands[1] = GEN_INT(INTVAL(operands[1])+1);")
|
10428 |
102 |
dgisselq |
+;
|
10429 |
117 |
dgisselq |
+;
|
10430 |
|
|
+;
|
10431 |
|
|
+;
|
10432 |
127 |
dgisselq |
+; Match:
|
10433 |
|
|
+; (parallel [(set () ()) (clobber (CC))])
|
10434 |
|
|
+; (compare () ())
|
10435 |
|
|
+; Transform to:
|
10436 |
|
|
+; (parallel [(set () ()) (set (CC) (0))]
|
10437 |
|
|
+; (compare () ())
|
10438 |
117 |
dgisselq |
+;
|
10439 |
127 |
dgisselq |
+(define_peephole2
|
10440 |
|
|
+ [(parallel [(set (match_operand:SI 0 "") (match_operand:SI 1 ""))
|
10441 |
|
|
+ (clobber (reg:CC CC_REG))])
|
10442 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_operand:SI 2 "")
|
10443 |
|
|
+ (match_operand:SI 3 "")))]
|
10444 |
|
|
+ "(ZIP_PEEPHOLE)&&zip_insn_sets_cc(insn)"
|
10445 |
|
|
+ [(parallel [(set (match_dup 0) (match_dup 1))
|
10446 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10447 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 2) (match_dup 3)))]
|
10448 |
|
|
+ "")
|
10449 |
|
|
+;
|
10450 |
|
|
+;
|
10451 |
|
|
+;
|
10452 |
122 |
dgisselq |
+; Match:
|
10453 |
127 |
dgisselq |
+; (parallel [(set () ()) (clobber (CC))])
|
10454 |
|
|
+; (set () ())
|
10455 |
|
|
+; (compare () ())
|
10456 |
|
|
+; Transform to:
|
10457 |
|
|
+; (parallel [(set () ()) (set (CC) (0))]
|
10458 |
|
|
+; (set () ())
|
10459 |
|
|
+; (compare () ())
|
10460 |
|
|
+;
|
10461 |
|
|
+(define_peephole2
|
10462 |
|
|
+ [(parallel [(set (match_operand:SI 0 "") (match_operand:SI 1 ""))
|
10463 |
|
|
+ (clobber (reg:CC CC_REG))])
|
10464 |
|
|
+ (set (match_operand 2 "") (match_operand 3 ""))
|
10465 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_operand:SI 4 "")
|
10466 |
|
|
+ (match_operand:SI 5 "")))]
|
10467 |
|
|
+ "(ZIP_PEEPHOLE)&&(zip_insn_sets_cc(insn))&&((!REG_P(operands[2]))||(REGNO(operands[2])!=CC_REG))"
|
10468 |
|
|
+ [(parallel [(set (match_dup 0) (match_dup 1))
|
10469 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10470 |
|
|
+ (set (match_dup 2) (match_dup 3))
|
10471 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 4) (match_dup 5)))]
|
10472 |
|
|
+ "")
|
10473 |
|
|
+;
|
10474 |
|
|
+;
|
10475 |
|
|
+;
|
10476 |
|
|
+; Match:
|
10477 |
122 |
dgisselq |
+; MOV A(R1),R3
|
10478 |
|
|
+; CMP R3,R0
|
10479 |
|
|
+; (R3 is dead)
|
10480 |
|
|
+; Transform to:
|
10481 |
|
|
+; CMP A(R1),R0
|
10482 |
|
|
+;
|
10483 |
|
|
+(define_peephole2
|
10484 |
|
|
+ [(set (match_operand:SI 3 "register_operand")
|
10485 |
|
|
+ (plus:SI (match_operand:SI 1 "register_operand")
|
10486 |
|
|
+ (match_operand:SI 2 "zip_mvimm_operand_p")))
|
10487 |
|
|
+ (set (reg:CC CC_REG)
|
10488 |
|
|
+ (compare:CC (match_operand:SI 0 "register_operand")
|
10489 |
|
|
+ (match_dup 3)))]
|
10490 |
127 |
dgisselq |
+ "(ZIP_PEEPHOLE)&&peep2_regno_dead_p(2, REGNO(operands[3]))"
|
10491 |
122 |
dgisselq |
+ [(set (reg:CC CC_REG) (compare:CC (match_dup 0)
|
10492 |
|
|
+ (plus:SI (match_dup 1) (match_dup 2))))]
|
10493 |
|
|
+ "")
|
10494 |
|
|
+;
|
10495 |
|
|
+;
|
10496 |
|
|
+; Match:
|
10497 |
|
|
+; ALU OpB,R0
|
10498 |
|
|
+; CMP 0,R0
|
10499 |
|
|
+; Transform to:
|
10500 |
|
|
+; ALU OpB,R0
|
10501 |
|
|
+;
|
10502 |
|
|
+(define_peephole2
|
10503 |
124 |
dgisselq |
+ [(parallel [(set (match_operand:SI 0 "register_operand")
|
10504 |
|
|
+ (match_operand:SI 1 ""))
|
10505 |
122 |
dgisselq |
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10506 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
|
10507 |
127 |
dgisselq |
+ "(ZIP_PEEPHOLE)"
|
10508 |
122 |
dgisselq |
+ [(parallel [(set (match_dup 0) (match_dup 1))
|
10509 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10510 |
|
|
+ ])
|
10511 |
|
|
+;
|
10512 |
|
|
+;
|
10513 |
|
|
+; Match:
|
10514 |
|
|
+; ALU OpB,R0
|
10515 |
|
|
+; MOV R1,R2 // Can be LDI, LOD, STO, etc.
|
10516 |
127 |
dgisselq |
+; CMP 0,R0
|
10517 |
122 |
dgisselq |
+; Transform to:
|
10518 |
|
|
+; ALU OpB,R0
|
10519 |
|
|
+; MOV R0,R1
|
10520 |
|
|
+;
|
10521 |
|
|
+(define_peephole2
|
10522 |
124 |
dgisselq |
+ [(parallel [(set (match_operand:SI 0 "register_operand")
|
10523 |
|
|
+ (match_operand:SI 1 ""))
|
10524 |
122 |
dgisselq |
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10525 |
124 |
dgisselq |
+ (set (match_operand:SI 2 "nonimmediate_operand") (match_operand:SI 3 ""))
|
10526 |
122 |
dgisselq |
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
|
10527 |
127 |
dgisselq |
+ "(ZIP_PEEPHOLE)&&((!REG_P(operands[2]))||((REGNO(operands[2])!=REGNO(operands[0]))&&((REGNO(operands[2])>=FIRST_PSEUDO_REGISTER)||(REGNO(operands[2])<CC_REG))))"
|
10528 |
122 |
dgisselq |
+ [(parallel [(set (match_dup 0) (match_dup 1))
|
10529 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10530 |
|
|
+ (set (match_dup 2) (match_dup 3))
|
10531 |
|
|
+ ])
|
10532 |
|
|
+;
|
10533 |
|
|
+;
|
10534 |
|
|
+; Match:
|
10535 |
|
|
+; ALU OpB,R0
|
10536 |
|
|
+; MOV R0,R1
|
10537 |
|
|
+; CMP 0,R1
|
10538 |
|
|
+; Transform to:
|
10539 |
|
|
+; ALU OpB,R0
|
10540 |
|
|
+; MOV R0,R1
|
10541 |
|
|
+;
|
10542 |
|
|
+(define_peephole2
|
10543 |
124 |
dgisselq |
+ [(parallel [(set (match_operand:SI 0 "register_operand")
|
10544 |
|
|
+ (match_operand:SI 1 ""))
|
10545 |
122 |
dgisselq |
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10546 |
124 |
dgisselq |
+ (set (match_operand:SI 2 "register_operand") (match_dup 0))
|
10547 |
122 |
dgisselq |
+ (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))]
|
10548 |
127 |
dgisselq |
+ "(ZIP_PEEPHOLE)"
|
10549 |
122 |
dgisselq |
+ [(parallel [(set (match_dup 0) (match_dup 1))
|
10550 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10551 |
|
|
+ (set (match_dup 2) (match_dup 3))
|
10552 |
|
|
+ ])
|
10553 |
|
|
+;
|
10554 |
124 |
dgisselq |
+;
|
10555 |
|
|
+; Match:
|
10556 |
|
|
+; MOV R1,R0
|
10557 |
|
|
+; ADD $x,R0
|
10558 |
|
|
+; (CCREG is dead, and x is within range ...)
|
10559 |
|
|
+; Transform to:
|
10560 |
127 |
dgisselq |
+; MOV $x(R1),R0
|
10561 |
124 |
dgisselq |
+(define_peephole2
|
10562 |
|
|
+ [(set (match_operand:SI 0 "register_operand")
|
10563 |
|
|
+ (match_operand:SI 1 "register_operand"))
|
10564 |
|
|
+ (parallel [(set (match_dup 0) (plus:SI (match_dup 0)
|
10565 |
|
|
+ (match_operand 2 "zip_mvimm_operand_p")))
|
10566 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10567 |
|
|
+ ]
|
10568 |
127 |
dgisselq |
+ "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2,CC_REG))"
|
10569 |
124 |
dgisselq |
+ [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])
|
10570 |
|
|
+;
|
10571 |
127 |
dgisselq |
+; Match:
|
10572 |
|
|
+; MOV A(R0),R0
|
10573 |
|
|
+; ADD $x,R1
|
10574 |
|
|
+; (CCREG is dead, and (A+x) is within range ...)
|
10575 |
|
|
+; Transform to:
|
10576 |
|
|
+; MOV $x(R1),R0
|
10577 |
124 |
dgisselq |
+;
|
10578 |
127 |
dgisselq |
+(define_peephole2
|
10579 |
|
|
+ [(set (match_operand:SI 0 "register_operand")
|
10580 |
|
|
+ (plus:SI (match_operand:SI 1 "register_operand")
|
10581 |
|
|
+ (match_operand 2 "zip_mvimm_operand_p")))
|
10582 |
|
|
+ (parallel [(set (match_dup 0) (plus:SI (match_dup 0)
|
10583 |
|
|
+ (match_operand 3 "zip_mvimm_operand_p")))
|
10584 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10585 |
|
|
+ ]
|
10586 |
|
|
+ "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2,CC_REG))
|
10587 |
|
|
+ &&(INTVAL(operands[2])+INTVAL(operands[3])<((1<<17)))
|
10588 |
|
|
+ &&(INTVAL(operands[2])+INTVAL(operands[3])>=-(1<<17))"
|
10589 |
|
|
+ [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
|
10590 |
|
|
+ "operands[2]=GEN_INT(INTVAL(operands[2])+INTVAL(operands[3]));")
|
10591 |
124 |
dgisselq |
+;
|
10592 |
127 |
dgisselq |
+;
|
10593 |
|
|
+;
|
10594 |
124 |
dgisselq |
+; Match:
|
10595 |
|
|
+; ADD $x,R0
|
10596 |
|
|
+; MOV R0,R1
|
10597 |
|
|
+; (CCREG is dead, and R0 is dead)
|
10598 |
|
|
+; Transform to:
|
10599 |
|
|
+; MOV (A+$x)(R0),R1
|
10600 |
|
|
+; ... again, how do I build this plus?
|
10601 |
|
|
+;
|
10602 |
|
|
+(define_peephole2
|
10603 |
|
|
+ [(parallel [(set (match_operand:SI 0 "register_operand")
|
10604 |
|
|
+ (plus:SI (match_dup 0)
|
10605 |
|
|
+ (match_operand 1 "zip_mvimm_operand_p")))
|
10606 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10607 |
|
|
+ (set (match_operand:SI 2 "register_operand") (match_dup 0))]
|
10608 |
127 |
dgisselq |
+ "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2, REGNO(operands[0])))&&(peep2_regno_dead_p(2,CC_REG))"
|
10609 |
124 |
dgisselq |
+ [(set (match_dup 2) (plus:SI (match_dup 0) (match_dup 1)))])
|
10610 |
|
|
+;
|
10611 |
|
|
+;
|
10612 |
127 |
dgisselq |
+;
|
10613 |
124 |
dgisselq |
+; Match:
|
10614 |
127 |
dgisselq |
+; ADD $x,R0
|
10615 |
|
|
+; MOV A(R0),R1
|
10616 |
|
|
+; (CCREG is dead, and R0 is dead)
|
10617 |
|
|
+; Transform to:
|
10618 |
|
|
+; MOV (A+$x)(R0),R1
|
10619 |
|
|
+;
|
10620 |
|
|
+(define_peephole2
|
10621 |
|
|
+ [(parallel [
|
10622 |
|
|
+ (set (match_operand:SI 0 "register_operand")
|
10623 |
|
|
+ (plus:SI (match_dup 0)
|
10624 |
|
|
+ (match_operand 1 "zip_mvimm_operand_p")))
|
10625 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10626 |
|
|
+ (set (match_operand:SI 2 "register_operand")
|
10627 |
|
|
+ (plus:SI (match_dup 0)
|
10628 |
|
|
+ (match_operand 3 "zip_mvimm_operand_p")))
|
10629 |
|
|
+ ]
|
10630 |
|
|
+ "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2,CC_REG))
|
10631 |
|
|
+ &&(peep2_regno_dead_p(1,REGNO(operands[0])))
|
10632 |
|
|
+ &&(INTVAL(operands[1])+INTVAL(operands[3])<((1<<17)))
|
10633 |
|
|
+ &&(INTVAL(operands[1])+INTVAL(operands[3])>=-(1<<17))"
|
10634 |
|
|
+ [(set (match_dup 0) (plus:SI (match_dup 2) (match_dup 3)))]
|
10635 |
|
|
+ "operands[3]=GEN_INT(INTVAL(operands[1])+INTVAL(operands[3]));")
|
10636 |
|
|
+;
|
10637 |
|
|
+;
|
10638 |
|
|
+;
|
10639 |
|
|
+; Match:
|
10640 |
124 |
dgisselq |
+; ADD $x,R0
|
10641 |
|
|
+; ADD R0,Rn
|
10642 |
|
|
+; (R0 is dead, if R0 is not Rn)
|
10643 |
|
|
+; Transform to:
|
10644 |
|
|
+; ADD $x(R0),Rn
|
10645 |
|
|
+;
|
10646 |
|
|
+(define_peephole2
|
10647 |
|
|
+ [(parallel [(set (match_operand:SI 0 "register_operand")
|
10648 |
|
|
+ (plus:SI (match_dup 0)
|
10649 |
|
|
+ (match_operand 1 "zip_opb_immv_p")))
|
10650 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10651 |
|
|
+ (parallel [(set (match_operand:SI 2 "register_operand")
|
10652 |
|
|
+ (plus:SI (match_dup 2) (match_dup 0)))
|
10653 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))])
|
10654 |
|
|
+ ]
|
10655 |
127 |
dgisselq |
+ "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[2]))&&(peep2_regno_dead_p(2, REGNO(operands[0])))"
|
10656 |
124 |
dgisselq |
+ [(parallel [(set (match_dup 2)
|
10657 |
|
|
+ (plus:SI (match_dup 2)
|
10658 |
|
|
+ (plus:SI (match_dup 0)
|
10659 |
|
|
+ (match_dup 1))))
|
10660 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))])
|
10661 |
|
|
+ ])
|
10662 |
|
|
+;
|
10663 |
|
|
+; Match:
|
10664 |
|
|
+; ADD $x,R0
|
10665 |
|
|
+; LOD -x(R0),R1
|
10666 |
|
|
+; Transform to:
|
10667 |
|
|
+; LOD (R0),R1
|
10668 |
|
|
+; ADD $x,R0
|
10669 |
|
|
+;
|
10670 |
|
|
+(define_peephole2
|
10671 |
|
|
+ [(parallel [(set (match_operand:SI 0 "register_operand")
|
10672 |
|
|
+ (plus:SI (match_dup 0)
|
10673 |
|
|
+ (match_operand 1 "zip_opb_immv_p")))
|
10674 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10675 |
|
|
+ (set (match_operand:SI 3 "register_operand")
|
10676 |
|
|
+ (mem:SI (plus:SI (match_dup 0)
|
10677 |
|
|
+ (match_operand 2 "zip_opb_immv_p"))))
|
10678 |
|
|
+ ]
|
10679 |
127 |
dgisselq |
+ "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
|
10680 |
124 |
dgisselq |
+ [(set (match_dup 3) (mem:SI (match_dup 0)))
|
10681 |
|
|
+ (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
|
10682 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10683 |
|
|
+ ])
|
10684 |
127 |
dgisselq |
+(define_peephole2
|
10685 |
|
|
+ [(parallel [(set (match_operand:SI 0 "register_operand")
|
10686 |
|
|
+ (plus:SI (match_dup 0)
|
10687 |
|
|
+ (match_operand 1 "zip_opb_immv_p")))
|
10688 |
|
|
+ (clobber (reg:CC CC_REG))])
|
10689 |
|
|
+ (set (match_operand:SI 3 "register_operand")
|
10690 |
|
|
+ (mem:SI (plus:SI (match_dup 0)
|
10691 |
|
|
+ (match_operand 2 "zip_opb_immv_p"))))
|
10692 |
|
|
+ ]
|
10693 |
|
|
+ "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
|
10694 |
|
|
+ [(set (match_dup 3) (mem:SI (match_dup 0)))
|
10695 |
|
|
+ (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
|
10696 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10697 |
|
|
+ ])
|
10698 |
124 |
dgisselq |
+;
|
10699 |
|
|
+;
|
10700 |
|
|
+;
|
10701 |
|
|
+; Match:
|
10702 |
|
|
+; ADD $x,R0
|
10703 |
|
|
+; STO R1,-x(R0)
|
10704 |
|
|
+; Transform to:
|
10705 |
|
|
+; STO R1,(R0)
|
10706 |
|
|
+; ADD $x,R0
|
10707 |
|
|
+;
|
10708 |
|
|
+(define_peephole2
|
10709 |
|
|
+ [(parallel [(set (match_operand:SI 0 "register_operand")
|
10710 |
|
|
+ (plus:SI (match_dup 0)
|
10711 |
|
|
+ (match_operand 1 "zip_opb_immv_p")))
|
10712 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10713 |
|
|
+ (set (mem:SI (plus:SI (match_dup 0) (match_operand 2 "zip_opb_immv_p")))
|
10714 |
|
|
+ (match_operand:SI 3 "register_operand"))
|
10715 |
|
|
+ ]
|
10716 |
127 |
dgisselq |
+ "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
|
10717 |
124 |
dgisselq |
+ [(set (mem:SI (match_dup 0)) (match_dup 3))
|
10718 |
|
|
+ (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
|
10719 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10720 |
|
|
+ ])
|
10721 |
127 |
dgisselq |
+(define_peephole2
|
10722 |
|
|
+ [(parallel [(set (match_operand:SI 0 "register_operand")
|
10723 |
|
|
+ (plus:SI (match_dup 0)
|
10724 |
|
|
+ (match_operand 1 "zip_opb_immv_p")))
|
10725 |
|
|
+ (clobber (reg:CC CC_REG))])
|
10726 |
|
|
+ (set (mem:SI (plus:SI (match_dup 0) (match_operand 2 "zip_opb_immv_p")))
|
10727 |
|
|
+ (match_operand:SI 3 "register_operand"))
|
10728 |
|
|
+ ]
|
10729 |
|
|
+ "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
|
10730 |
|
|
+ [(set (mem:SI (match_dup 0)) (match_dup 3))
|
10731 |
|
|
+ (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
|
10732 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10733 |
|
|
+ ])
|
10734 |
124 |
dgisselq |
+;
|
10735 |
|
|
+;
|
10736 |
|
|
+; Match:
|
10737 |
|
|
+; ADD $x,R0
|
10738 |
|
|
+; ANY R1,R2 (destination is not R0, source does not reference R0)
|
10739 |
|
|
+; ADD R0,Rn (could be 1 or 2, not 0)
|
10740 |
|
|
+; (R0 is dead)
|
10741 |
|
|
+; Transform to:
|
10742 |
|
|
+; ANY R1,R2
|
10743 |
|
|
+; ADD $x(R0),Rn
|
10744 |
|
|
+;
|
10745 |
|
|
+;
|
10746 |
|
|
+;
|
10747 |
127 |
dgisselq |
+; Match:
|
10748 |
|
|
+; MOV R1,R0
|
10749 |
|
|
+; AND #/R2,R0
|
10750 |
|
|
+; (Ry dead ...)
|
10751 |
|
|
+; Transform to:
|
10752 |
|
|
+; TEST #/Rz,Rx
|
10753 |
124 |
dgisselq |
+;
|
10754 |
127 |
dgisselq |
+(define_peephole2
|
10755 |
|
|
+ [(set (match_operand:SI 0 "register_operand")
|
10756 |
|
|
+ (match_operand:SI 1 "register_operand"))
|
10757 |
202 |
dgisselq |
+ (parallel [(set (match_operand:SI 3 "register_operand")
|
10758 |
127 |
dgisselq |
+ (and:SI (match_dup 0)
|
10759 |
|
|
+ (match_operand:SI 2 "zip_opb_single_operand_p")))
|
10760 |
|
|
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
|
10761 |
|
|
+ ]
|
10762 |
202 |
dgisselq |
+ "((1)||(ZIP_PEEPHOLE))&&(peep2_regno_dead_p(2, REGNO(operands[0])))&&(peep2_regno_dead_p(2, REGNO(operands[3])))"
|
10763 |
|
|
+ [(set (reg:CC CC_REG) (compare:CC (and:SI (match_dup 1) (match_dup 2))
|
10764 |
127 |
dgisselq |
+ (const_int 0)))])
|
10765 |
|
|
+;
|
10766 |
202 |
dgisselq |
+;
|
10767 |
127 |
dgisselq |
+; Match:
|
10768 |
202 |
dgisselq |
+; LB OpB,Rx
|
10769 |
|
|
+; AND 255,Rx (in form of zero_extend)
|
10770 |
|
|
+; Transform to:
|
10771 |
|
|
+; LB OpB,Rx
|
10772 |
|
|
+;
|
10773 |
|
|
+;
|
10774 |
|
|
+(define_peephole2
|
10775 |
|
|
+ [(set (match_operand:QI 0 "register_operand")
|
10776 |
|
|
+ (match_operand:QI 1 "memory_operand"))
|
10777 |
|
|
+ (parallel [(set (match_operand:SI 2 "register_operand")
|
10778 |
|
|
+ (zero_extend:SI (match_dup 0)))
|
10779 |
|
|
+ (clobber (reg:CC CC_REG))])]
|
10780 |
|
|
+ "((1)||(ZIP_PEEPHOLE))"
|
10781 |
|
|
+ [(parallel [(set (match_dup 2) (zero_extend:SI (match_dup 1)))
|
10782 |
|
|
+ (clobber (reg:CC CC_REG))])])
|
10783 |
|
|
+;
|
10784 |
|
|
+;
|
10785 |
|
|
+;
|
10786 |
|
|
+; Match:
|
10787 |
|
|
+; LW OpB,Rx
|
10788 |
|
|
+; AND 65535,Rx
|
10789 |
|
|
+; Transform to:
|
10790 |
|
|
+; LW OpB,Rx
|
10791 |
|
|
+;
|
10792 |
|
|
+;
|
10793 |
|
|
+(define_peephole2
|
10794 |
|
|
+ [(set (match_operand:HI 0 "register_operand")
|
10795 |
|
|
+ (match_operand:HI 1 "memory_operand"))
|
10796 |
|
|
+ (parallel [(set (match_operand:SI 2 "register_operand")
|
10797 |
|
|
+ (zero_extend:SI (match_dup 0)))
|
10798 |
|
|
+ (clobber (reg:CC CC_REG))])]
|
10799 |
|
|
+ "((1)||(ZIP_PEEPHOLE))
|
10800 |
|
|
+ &&(REG_P(operands[0]))
|
10801 |
|
|
+ &&(REG_P(operands[2]))
|
10802 |
|
|
+ &&(REGNO(operands[0])==REGNO(operands[2]))"
|
10803 |
|
|
+ [(parallel [(set (match_dup 2) (zero_extend:SI (match_dup 1)))
|
10804 |
|
|
+ (clobber (reg:CC CC_REG))])])
|
10805 |
|
|
+;
|
10806 |
|
|
+;
|
10807 |
|
|
+;
|
10808 |
|
|
+; Match:
|
10809 |
|
|
+; LDI 0,Rx
|
10810 |
|
|
+; LDI.y #,Rx
|
10811 |
|
|
+; Add Rx,Ry
|
10812 |
|
|
+; Transform to:
|
10813 |
|
|
+; Add.y #,Ry
|
10814 |
|
|
+;
|
10815 |
|
|
+;
|
10816 |
|
|
+(define_peephole2
|
10817 |
|
|
+ [(set (match_operand:SI 0 "register_operand") (const_int 0))
|
10818 |
|
|
+ (set (match_dup 0)
|
10819 |
|
|
+ (if_then_else:SI
|
10820 |
|
|
+ (match_operator 1 "ordered_comparison_operator"
|
10821 |
|
|
+ [(reg:CC CC_REG) (const_int 0)])
|
10822 |
|
|
+ (match_operand:SI 2 "zip_opb_single_operand_p") (match_dup 0)))
|
10823 |
|
|
+ (parallel [
|
10824 |
|
|
+ (set (match_operand:SI 3 "register_operand")
|
10825 |
|
|
+ (plus:SI (match_dup 3) (match_dup 0)))
|
10826 |
|
|
+ (clobber (reg:CC CC_REG))
|
10827 |
|
|
+ ])]
|
10828 |
|
|
+ "((1)||(ZIP_PEEPHOLE))
|
10829 |
|
|
+ &&(peep2_regno_dead_p(3, REGNO(operands[0])))"
|
10830 |
|
|
+ [(set (match_dup 3)
|
10831 |
|
|
+ (if_then_else:SI
|
10832 |
|
|
+ (match_op_dup 1 [(reg:CC CC_REG) (const_int 0)])
|
10833 |
|
|
+ (plus:SI (match_dup 3) (match_dup 2))
|
10834 |
|
|
+ (match_dup 3)))])
|
10835 |
|
|
+;
|
10836 |
|
|
+;
|
10837 |
|
|
+; Match:
|
10838 |
|
|
+; LDI 0,Rx
|
10839 |
|
|
+; LDI.y #,Rx
|
10840 |
|
|
+; XOR Rx,Rc
|
10841 |
|
|
+; Transform to:
|
10842 |
|
|
+; XOR.y #,Ry
|
10843 |
|
|
+;
|
10844 |
|
|
+;
|
10845 |
|
|
+(define_peephole2
|
10846 |
|
|
+ [(set (match_operand:SI 0 "register_operand") (const_int 0))
|
10847 |
|
|
+ (set (match_dup 0)
|
10848 |
|
|
+ (if_then_else:SI
|
10849 |
|
|
+ (match_operator 1 "ordered_comparison_operator"
|
10850 |
|
|
+ [(reg:CC CC_REG) (const_int 0)])
|
10851 |
|
|
+ (match_operand:SI 2 "zip_opb_single_operand_p") (match_dup 0)))
|
10852 |
|
|
+ (parallel [
|
10853 |
|
|
+ (set (match_operand:SI 3 "register_operand")
|
10854 |
|
|
+ (xor:SI (match_dup 3) (match_dup 0)))
|
10855 |
|
|
+ (clobber (reg:CC CC_REG))
|
10856 |
|
|
+ ])]
|
10857 |
|
|
+ "((1)||(ZIP_PEEPHOLE))
|
10858 |
|
|
+ &&(peep2_regno_dead_p(3, REGNO(operands[0])))"
|
10859 |
|
|
+ [(set (match_dup 3)
|
10860 |
|
|
+ (if_then_else:SI
|
10861 |
|
|
+ (match_op_dup 1 [(reg:CC CC_REG) (const_int 0)])
|
10862 |
|
|
+ (xor:SI (match_dup 3) (match_dup 2))
|
10863 |
|
|
+ (match_dup 3)))])
|
10864 |
|
|
+;
|
10865 |
|
|
+;
|
10866 |
|
|
+;
|
10867 |
|
|
+;
|
10868 |
|
|
+;
|
10869 |
|
|
+; Match:
|
10870 |
|
|
+; LDI 0,Rx
|
10871 |
|
|
+; LDI.y #,Rx
|
10872 |
|
|
+; OR Rx,Rc
|
10873 |
|
|
+; Transform to:
|
10874 |
|
|
+; OR.y #,Ry
|
10875 |
|
|
+;
|
10876 |
|
|
+;
|
10877 |
|
|
+;
|
10878 |
|
|
+(define_peephole2
|
10879 |
|
|
+ [(set (match_operand:SI 0 "register_operand") (const_int 0))
|
10880 |
|
|
+ (set (match_dup 0)
|
10881 |
|
|
+ (if_then_else:SI (match_operator 1 "ordered_comparison_operator"
|
10882 |
|
|
+ [(reg:CC CC_REG) (const_int 0)])
|
10883 |
|
|
+ (match_operand:SI 2 "zip_opb_single_operand_p") (match_dup 0)))
|
10884 |
|
|
+ (parallel [(set (match_operand:SI 3 "register_operand")
|
10885 |
|
|
+ (ior:SI (match_dup 3) (match_dup 0)))
|
10886 |
|
|
+ (clobber (reg:CC CC_REG))])]
|
10887 |
|
|
+ "((1)||(ZIP_PEEPHOLE))
|
10888 |
|
|
+ &&(peep2_regno_dead_p(3, REGNO(operands[0])))"
|
10889 |
|
|
+ [(set (match_dup 3)
|
10890 |
|
|
+ (if_then_else:SI
|
10891 |
|
|
+ (match_op_dup 1 [(reg:CC CC_REG) (const_int 0)])
|
10892 |
|
|
+ (ior:SI (match_dup 3) (match_dup 2))
|
10893 |
|
|
+ (match_dup 3)))])
|
10894 |
|
|
+;
|
10895 |
|
|
+;
|
10896 |
|
|
+;
|
10897 |
|
|
+; Match:
|
10898 |
|
|
+; AND 255,Rx
|
10899 |
|
|
+; SB OpB,Rx
|
10900 |
|
|
+; (AND Rx is DEAD)
|
10901 |
|
|
+; Transform to:
|
10902 |
|
|
+; SB OpB,Rx
|
10903 |
|
|
+;
|
10904 |
|
|
+;
|
10905 |
|
|
+;(define_peephole2
|
10906 |
|
|
+ ;[(set (match_operand:SI 2 "register_operand")
|
10907 |
|
|
+ ;(zero_extend:SI (match_operand:SI 0)))
|
10908 |
|
|
+ ;[(set (match_operand:QI 0 "memory_operand")
|
10909 |
|
|
+ ;(match_operand:QI 1 "memory_operand"))
|
10910 |
|
|
+ ;"((1)||(ZIP_PEEPHOLE))"
|
10911 |
|
|
+ ;[(set (match_dup 2) (zero_extend:SI (match_dup 1)))])
|
10912 |
|
|
+;
|
10913 |
|
|
+;
|
10914 |
|
|
+;
|
10915 |
|
|
+;
|
10916 |
|
|
+;
|
10917 |
|
|
+; Match:
|
10918 |
127 |
dgisselq |
+; (call ...
|
10919 |
|
|
+; (set (pc) (label))
|
10920 |
|
|
+; or (in asm)
|
10921 |
|
|
+; MOV .Lcallx(PC),R0
|
10922 |
|
|
+; BRA (somewhere)
|
10923 |
|
|
+; .Lcallx
|
10924 |
|
|
+; BRA (somewhere-else)
|
10925 |
|
|
+; Transform to:
|
10926 |
|
|
+;
|
10927 |
|
|
+; (sequence [(call ...
|
10928 |
|
|
+; (set (pc) (label))])
|
10929 |
|
|
+; or (in asm)
|
10930 |
|
|
+; "LDI (somewhere-else),R0
|
10931 |
|
|
+; BRA subroutine"
|
10932 |
|
|
+;
|
10933 |
|
|
+; While the following looks good, it doesnt work. My guess is that the reason
|
10934 |
|
|
+; why it doesnt work is that the jump at the end crosses basic block boundaries.
|
10935 |
|
|
+;
|
10936 |
|
|
+;(define_insn "void_call_mem_unspec"
|
10937 |
|
|
+; [(call (unspec:SI [(mem:SI (match_operand:VOID 0 "zip_const_address_operand_p" ""))] UNSPEC_RAW_CALL)
|
10938 |
|
|
+; (match_operand 1 "const_int_operand" "n"))
|
10939 |
|
|
+; (clobber (reg:SI RTN_REG))
|
10940 |
|
|
+; (clobber (reg:CC CC_REG))]
|
10941 |
|
|
+; ""
|
10942 |
|
|
+; "BRA\t%0,PC"
|
10943 |
|
|
+; [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
10944 |
|
|
+;(define_peephole2
|
10945 |
|
|
+; [(parallel [(call (mem:SI (match_operand:VOID 0 "zip_const_address_operand_p"))
|
10946 |
|
|
+; (match_operand 1 "const_int_operand"))
|
10947 |
|
|
+; (clobber (reg:SI RTN_REG))
|
10948 |
|
|
+; (clobber (reg:CC CC_REG))])
|
10949 |
|
|
+; ; The match operand for the (set (pc) ...) cannot have anything but
|
10950 |
|
|
+; ; VOIDmode, or it wont match.
|
10951 |
|
|
+; (set (pc) (match_operand:VOID 2 "zip_const_address_operand_p"))]
|
10952 |
|
|
+; ""
|
10953 |
|
|
+; [(set (reg:SI RTN_REG) (match_dup 2))
|
10954 |
|
|
+; (call (unspec:SI [(mem:SI (match_operand:VOID 0 "zip_const_address_operand_p"))] UNSPEC_RAW_CALL)
|
10955 |
|
|
+; (match_operand 1 "const_int_operand"))
|
10956 |
|
|
+; (use (reg:SI RTN_REG))
|
10957 |
|
|
+; (clobber (reg:SI RTN_REG))
|
10958 |
|
|
+; (clobber (reg:CC CC_REG))]
|
10959 |
|
|
+; "fprintf(stderr, \"CALL-JUMP Matched\");")
|
10960 |
|
|
+;
|
10961 |
|
|
+;
|
10962 |
|
|
+;
|
10963 |
|
|
+; So, the following *should* have worked as well. However, this falls apart
|
10964 |
|
|
+; because the 'final' routine can't tell if we are calling a subroutine in this
|
10965 |
|
|
+; function or not.
|
10966 |
|
|
+;
|
10967 |
|
|
+;(define_peephole
|
10968 |
|
|
+ ;[(parallel [(call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p"))
|
10969 |
|
|
+ ;(match_operand 1 "const_int_operand"))
|
10970 |
|
|
+ ;(clobber (reg:SI RTN_REG))
|
10971 |
|
|
+ ;(clobber (reg:CC CC_REG))])
|
10972 |
|
|
+ ;(set (pc) (label_ref (match_operand 2 "")))]
|
10973 |
|
|
+ ;""
|
10974 |
|
|
+ ;"LDI\t%2,R0\;BRA\t%0"
|
10975 |
|
|
+ ;[(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
|
10976 |
|
|
+;
|
10977 |
124 |
dgisselq |
+; and for
|
10978 |
|
|
+; BRA target
|
10979 |
|
|
+; BRA target ; two branches to the same identical target in a row ...
|
10980 |
|
|
+;
|
10981 |
|
|
+;
|
10982 |
|
|
+;
|
10983 |
102 |
dgisselq |
+; STILL MISSING:
|
10984 |
200 |
dgisselq |
+;
|
10985 |
|
|
+;
|
10986 |
|
|
+;
|
10987 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/config/zip/zip-protos.h gcc-6.2.0-zip/gcc/config/zip/zip-protos.h
|
10988 |
|
|
--- gcc-6.2.0/gcc/config/zip/zip-protos.h 1969-12-31 19:00:00.000000000 -0500
|
10989 |
|
|
+++ gcc-6.2.0-zip/gcc/config/zip/zip-protos.h 2017-02-17 16:45:53.264117439 -0500
|
10990 |
|
|
@@ -0,0 +1,82 @@
|
10991 |
102 |
dgisselq |
+////////////////////////////////////////////////////////////////////////////////
|
10992 |
|
|
+//
|
10993 |
|
|
+// Filename: zip-protos.h
|
10994 |
|
|
+//
|
10995 |
|
|
+// Project: Zip CPU backend for the GNU Compiler Collection
|
10996 |
|
|
+//
|
10997 |
|
|
+// Purpose:
|
10998 |
|
|
+//
|
10999 |
|
|
+// Creator: Dan Gisselquist, Ph.D.
|
11000 |
|
|
+// Gisselquist Technology, LLC
|
11001 |
|
|
+//
|
11002 |
|
|
+////////////////////////////////////////////////////////////////////////////////
|
11003 |
|
|
+//
|
11004 |
|
|
+// Copyright (C) 2016, Gisselquist Technology, LLC
|
11005 |
|
|
+//
|
11006 |
|
|
+// This program is free software (firmware): you can redistribute it and/or
|
11007 |
|
|
+// modify it under the terms of the GNU General Public License as published
|
11008 |
|
|
+// by the Free Software Foundation, either version 3 of the License, or (at
|
11009 |
|
|
+// your option) any later version.
|
11010 |
|
|
+//
|
11011 |
|
|
+// This program is distributed in the hope that it will be useful, but WITHOUT
|
11012 |
|
|
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
11013 |
|
|
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
11014 |
|
|
+// for more details.
|
11015 |
|
|
+//
|
11016 |
|
|
+// You should have received a copy of the GNU General Public License along
|
11017 |
|
|
+// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
11018 |
|
|
+// target there if the PDF file isn't present.) If not, see
|
11019 |
|
|
+// <http://www.gnu.org/licenses/> for a copy.
|
11020 |
|
|
+//
|
11021 |
|
|
+// License: GPL, v3, as defined and found on www.gnu.org,
|
11022 |
|
|
+// http://www.gnu.org/licenses/gpl.html
|
11023 |
|
|
+//
|
11024 |
|
|
+//
|
11025 |
|
|
+////////////////////////////////////////////////////////////////////////////////
|
11026 |
|
|
+#ifndef ZIP_PROTOS_H
|
11027 |
|
|
+#define ZIP_PROTOS_H
|
11028 |
|
|
+
|
11029 |
200 |
dgisselq |
+extern int zip_supported_condition(int c);
|
11030 |
102 |
dgisselq |
+extern void zip_expand_prologue(void);
|
11031 |
|
|
+extern void zip_expand_epilogue(void);
|
11032 |
191 |
dgisselq |
+extern void zip_sibcall_epilogue(void);
|
11033 |
202 |
dgisselq |
+extern int zip_expand_movdi(rtx,rtx);
|
11034 |
200 |
dgisselq |
+extern int zip_expand_movsicc(rtx,rtx,rtx,rtx);
|
11035 |
102 |
dgisselq |
+extern int zip_initial_elimination_offset(int, int);
|
11036 |
|
|
+extern void zip_print_operand(FILE *, rtx, int);
|
11037 |
|
|
+extern void zip_print_operand_address(FILE *, rtx);
|
11038 |
|
|
+extern enum reg_class zip_reg_class(int);
|
11039 |
|
|
+extern rtx zip_return_addr_rtx(int, rtx);
|
11040 |
|
|
+extern int zip_num_arg_regs(enum machine_mode, tree);
|
11041 |
|
|
+
|
11042 |
|
|
+extern void zip_asm_output_def(FILE *s, const char *n, const char *v);
|
11043 |
122 |
dgisselq |
+
|
11044 |
|
|
+extern void zip_canonicalize_comparison(int *, rtx *, rtx *, bool);
|
11045 |
191 |
dgisselq |
+extern bool zip_function_ok_for_sibcall(tree, tree);
|
11046 |
102 |
dgisselq |
+extern int zip_address_operand(rtx op);
|
11047 |
|
|
+extern int zip_const_address_operand(rtx op);
|
11048 |
200 |
dgisselq |
+extern int zip_use_return_insn(void);
|
11049 |
102 |
dgisselq |
+extern const char *zip_set_zero_or_one(rtx, rtx);
|
11050 |
|
|
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
|
11051 |
|
|
+
|
11052 |
127 |
dgisselq |
+extern int zip_insn_sets_cc(rtx_insn *insn);
|
11053 |
|
|
+extern int zip_is_conditional(rtx_insn *insn);
|
11054 |
102 |
dgisselq |
+extern int zip_ct_address_operand(rtx op);
|
11055 |
111 |
dgisselq |
+extern int zip_pd_opb_operand(rtx op);
|
11056 |
102 |
dgisselq |
+extern int zip_pd_mov_operand(rtx op);
|
11057 |
111 |
dgisselq |
+extern int zip_pd_imm_operand(rtx op);
|
11058 |
|
|
+extern int zip_pd_mvimm_operand(rtx op);
|
11059 |
102 |
dgisselq |
+extern int zip_ct_const_address_operand(rtx op);
|
11060 |
|
|
+extern int zip_pd_const_address_operand(rtx op);
|
11061 |
|
|
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
|
11062 |
202 |
dgisselq |
+extern const char *zip_addqics(rtx, rtx, rtx, rtx);
|
11063 |
|
|
+extern const char *zip_cbranchdi(rtx, rtx, rtx, rtx);
|
11064 |
102 |
dgisselq |
+
|
11065 |
122 |
dgisselq |
+extern void zip_ifcvt_machdep_init(struct ce_if_block *ceinfo);
|
11066 |
|
|
+extern void zip_ifcvt_modify_cancel(struct ce_if_block *ceinfo);
|
11067 |
|
|
+extern void zip_ifcvt_modify_final(struct ce_if_block *ceinfo);
|
11068 |
|
|
+extern void zip_ifcvt_modify_tests(struct ce_if_block *ceinfo, rtx *true_expr, rtx *false_expr);
|
11069 |
142 |
dgisselq |
+extern void zip_ifcvt_modify_insn(struct ce_if_block *ceinfo, rtx pattern, rtx_insn *insn);
|
11070 |
122 |
dgisselq |
+
|
11071 |
102 |
dgisselq |
+#endif
|
11072 |
|
|
+
|
11073 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/config/zip/zip-sync.md gcc-6.2.0-zip/gcc/config/zip/zip-sync.md
|
11074 |
|
|
--- gcc-6.2.0/gcc/config/zip/zip-sync.md 1969-12-31 19:00:00.000000000 -0500
|
11075 |
|
|
+++ gcc-6.2.0-zip/gcc/config/zip/zip-sync.md 2017-02-22 18:03:26.740198685 -0500
|
11076 |
|
|
@@ -0,0 +1,415 @@
|
11077 |
200 |
dgisselq |
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
11078 |
|
|
+;;
|
11079 |
|
|
+;; Filename: zip-sync.md
|
11080 |
|
|
+;;
|
11081 |
|
|
+;; Project: Zip CPU -- a small, lightweight, RISC CPU soft core
|
11082 |
|
|
+;;
|
11083 |
|
|
+;; Purpose: This is that portion of the machine description of the Zip CPU
|
11084 |
|
|
+;; which is focused on atomic operations.
|
11085 |
|
|
+;;
|
11086 |
|
|
+;;
|
11087 |
|
|
+;; Creator: Dan Gisselquist, Ph.D.
|
11088 |
|
|
+;; Gisselquist Technology, LLC
|
11089 |
|
|
+;;
|
11090 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
11091 |
|
|
+;;
|
11092 |
202 |
dgisselq |
+;; Copyright (C) 2015,2017, Gisselquist Technology, LLC
|
11093 |
200 |
dgisselq |
+;;
|
11094 |
|
|
+;; This program is free software (firmware): you can redistribute it and/or
|
11095 |
|
|
+;; modify it under the terms of the GNU General Public License as published
|
11096 |
|
|
+;; by the Free Software Foundation, either version 3 of the License, or (at
|
11097 |
|
|
+;; your option) any later version.
|
11098 |
|
|
+;;
|
11099 |
|
|
+;; This program is distributed in the hope that it will be useful, but WITHOUT
|
11100 |
|
|
+;; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
11101 |
|
|
+;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
11102 |
|
|
+;; for more details.
|
11103 |
|
|
+;;
|
11104 |
|
|
+;; License: GPL, v3, as defined and found on www.gnu.org,
|
11105 |
|
|
+;; http://www.gnu.org/licenses/gpl.html
|
11106 |
|
|
+;;
|
11107 |
|
|
+;;
|
11108 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
11109 |
|
|
+;;
|
11110 |
|
|
+;;
|
11111 |
|
|
+;
|
11112 |
|
|
+;
|
11113 |
|
|
+;
|
11114 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
11115 |
|
|
+;;
|
11116 |
|
|
+;; Atomic access Op-codes
|
11117 |
|
|
+;;
|
11118 |
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
11119 |
|
|
+;
|
11120 |
|
|
+;
|
11121 |
|
|
+;
|
11122 |
|
|
+; First, the basic atomic_ operators, add, sub, ior, and, and xor
|
11123 |
|
|
+;
|
11124 |
|
|
+(define_insn "atomic_addsi"
|
11125 |
202 |
dgisselq |
+ [(set (match_operand:SI 0 "memory_operand" "+Q")
|
11126 |
200 |
dgisselq |
+ (plus:SI (match_dup 0)
|
11127 |
|
|
+ (match_operand:SI 1 "zip_opb_single_operand_p" "rO")))
|
11128 |
202 |
dgisselq |
+ (match_operand 2 "const_int_operand" "") ; Memory model used
|
11129 |
200 |
dgisselq |
+ (clobber (match_scratch:SI 3 "=r")) ; Scratch register
|
11130 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11131 |
|
|
+ "(ZIP_ATOMIC)"
|
11132 |
202 |
dgisselq |
+ "LOCK\n\tLW %0,%3\n\tADD %1,%3\n\tSW %3,%0"
|
11133 |
200 |
dgisselq |
+ [(set_attr "predicable" "no")])
|
11134 |
|
|
+(define_insn "atomic_subsi"
|
11135 |
202 |
dgisselq |
+ [(set (match_operand:SI 0 "memory_operand" "+Q")
|
11136 |
200 |
dgisselq |
+ (minus:SI (match_dup 0)
|
11137 |
|
|
+ (match_operand:SI 1 "zip_opb_single_operand_p" "rO")))
|
11138 |
202 |
dgisselq |
+ (match_operand 2 "const_int_operand" "") ; Memory model used
|
11139 |
200 |
dgisselq |
+ (clobber (match_scratch:SI 3 "=r")) ; Scratch register
|
11140 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11141 |
|
|
+ "(ZIP_ATOMIC)"
|
11142 |
202 |
dgisselq |
+ "LOCK\n\tLW %0,%3\n\tSUB %1,%3\n\tSW %3,%0"
|
11143 |
200 |
dgisselq |
+ [(set_attr "predicable" "no")])
|
11144 |
|
|
+(define_insn "atomic_iorsi"
|
11145 |
202 |
dgisselq |
+ [(set (match_operand:SI 0 "memory_operand" "+Q")
|
11146 |
200 |
dgisselq |
+ (ior:SI (match_dup 0)
|
11147 |
|
|
+ (match_operand:SI 1 "zip_opb_single_operand_p" "rO")))
|
11148 |
202 |
dgisselq |
+ (match_operand 2 "const_int_operand" "") ; Memory model used
|
11149 |
200 |
dgisselq |
+ (clobber (match_scratch:SI 3 "=r")) ; Scratch register
|
11150 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11151 |
|
|
+ "(ZIP_ATOMIC)"
|
11152 |
202 |
dgisselq |
+ "LOCK\n\tLW %0,%3\n\tOR %1,%3\n\tSW %3,%0"
|
11153 |
200 |
dgisselq |
+ [(set_attr "predicable" "no")])
|
11154 |
202 |
dgisselq |
+(define_expand "atomic_andsi"
|
11155 |
|
|
+ [(match_operand:SI 0 "memory_operand" "+Q")
|
11156 |
|
|
+ (match_operand:SI 1 "zip_opb_single_operand_p" "rO")
|
11157 |
|
|
+ (match_operand 2 "" "") ; Memory model used
|
11158 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11159 |
|
|
+ "(ZIP_ATOMIC)"
|
11160 |
|
|
+ {
|
11161 |
|
|
+ emit_insn(gen_reissue_atomic_andsi(operands[0], operands[1]));
|
11162 |
|
|
+ DONE;
|
11163 |
|
|
+ })
|
11164 |
|
|
+(define_insn "reissue_atomic_andsi"
|
11165 |
|
|
+ [(set (match_operand:SI 0 "memory_operand" "+Q")
|
11166 |
200 |
dgisselq |
+ (and:SI (match_dup 0)
|
11167 |
|
|
+ (match_operand:SI 1 "zip_opb_single_operand_p" "rO")))
|
11168 |
202 |
dgisselq |
+ (clobber (match_scratch:SI 2 "=r")) ; Scratch register
|
11169 |
200 |
dgisselq |
+ (clobber (reg:CC CC_REG))]
|
11170 |
|
|
+ "(ZIP_ATOMIC)"
|
11171 |
202 |
dgisselq |
+ "LOCK\n\tLW %0,%2\n\tAND %1,%2\n\tSW %2,%0"
|
11172 |
200 |
dgisselq |
+ [(set_attr "predicable" "no")])
|
11173 |
202 |
dgisselq |
+(define_expand "atomic_xorsi"
|
11174 |
|
|
+ [(match_operand:SI 0 "memory_operand" "+Q")
|
11175 |
|
|
+ (match_operand:SI 1 "zip_opb_single_operand_p" "rO")
|
11176 |
|
|
+ (match_operand 2 "" "") ; Memory model used
|
11177 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11178 |
|
|
+ "(ZIP_ATOMIC)"
|
11179 |
|
|
+ {
|
11180 |
|
|
+ emit_insn(gen_reissue_atomic_xorsi(operands[0], operands[1]));
|
11181 |
|
|
+ DONE;
|
11182 |
|
|
+ })
|
11183 |
|
|
+(define_insn "reissue_atomic_xorsi"
|
11184 |
|
|
+ [(set (match_operand:SI 0 "memory_operand" "+Q")
|
11185 |
200 |
dgisselq |
+ (xor:SI (match_dup 0)
|
11186 |
|
|
+ (match_operand:SI 1 "zip_opb_single_operand_p" "rO")))
|
11187 |
202 |
dgisselq |
+ (clobber (match_scratch:SI 2 "=r")) ; Scratch register
|
11188 |
200 |
dgisselq |
+ (clobber (reg:CC CC_REG))]
|
11189 |
|
|
+ "(ZIP_ATOMIC)"
|
11190 |
202 |
dgisselq |
+ "LOCK\n\tLW %0,%2\n\tXOR %1,%2\n\tSW %2,%0"
|
11191 |
200 |
dgisselq |
+ [(set_attr "predicable" "no")])
|
11192 |
|
|
+;
|
11193 |
|
|
+;
|
11194 |
202 |
dgisselq |
+; Given how the ZipCPU is put together, all SI LODs and STOs are atomic. DI
|
11195 |
|
|
+; loads and stores need the LOCK command, to keep from breaking within them.
|
11196 |
|
|
+; Further, GCC expects that anything <= the word size can use a normal load
|
11197 |
|
|
+; or store instruction. Hence we don't need anything but the DI load and
|
11198 |
|
|
+; stores.
|
11199 |
200 |
dgisselq |
+;
|
11200 |
202 |
dgisselq |
+(define_insn "atomic_loaddi"
|
11201 |
|
|
+ [(set (match_operand:DI 0 "register_operand" "=r")
|
11202 |
|
|
+ (match_operand:DI 1 "memory_operand" "Q"))
|
11203 |
|
|
+ (match_operand 2 "const_int_operand" "")]
|
11204 |
|
|
+ "(ZIP_HAS_DI)&&(ZIP_ATOMIC)"
|
11205 |
|
|
+ "LOCK\n\tLW %1,%H0\t; Atomic Load:DI\n\tLW 4+%1,%L0"
|
11206 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
|
11207 |
200 |
dgisselq |
+;
|
11208 |
202 |
dgisselq |
+(define_insn "atomic_storedi"
|
11209 |
|
|
+ [(set (match_operand:DI 0 "memory_operand" "=Q")
|
11210 |
|
|
+ (match_operand:DI 1 "register_operand" "r"))
|
11211 |
|
|
+ (match_operand 2 "const_int_operand" "")]
|
11212 |
|
|
+ "(ZIP_HAS_DI)&&(ZIP_ATOMIC)"
|
11213 |
|
|
+ "LOCK\n\tSW %H1,%0\t; Atomic Store:DI\n\tSW %L1,4+%0"
|
11214 |
|
|
+ [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
|
11215 |
200 |
dgisselq |
+;
|
11216 |
|
|
+;
|
11217 |
|
|
+;
|
11218 |
202 |
dgisselq |
+;
|
11219 |
200 |
dgisselq |
+(define_insn "atomic_exchangesi"
|
11220 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
11221 |
202 |
dgisselq |
+ (match_operand:SI 1 "memory_operand" "+Q"))
|
11222 |
|
|
+ (set (match_dup 1) (match_operand:SI 2 "register_operand" "r"))
|
11223 |
|
|
+ (match_operand 3 "const_int_operand" "")]
|
11224 |
200 |
dgisselq |
+ "(ZIP_ATOMIC)"
|
11225 |
202 |
dgisselq |
+ "LOCK\n\tLW %1,%0\n\tSW %2,%1"
|
11226 |
200 |
dgisselq |
+ [(set_attr "predicable" "no")])
|
11227 |
|
|
+;
|
11228 |
|
|
+;
|
11229 |
|
|
+;
|
11230 |
|
|
+; Here's another set of the atomic operators, this time those that leave their
|
11231 |
|
|
+; result in operand zero.
|
11232 |
|
|
+;
|
11233 |
202 |
dgisselq |
+(define_expand "atomic_add_fetchsi"
|
11234 |
|
|
+ [(match_operand:SI 0 "register_operand" "=r")
|
11235 |
|
|
+ (match_operand:SI 1 "memory_operand" "+Q")
|
11236 |
|
|
+ (match_operand:SI 2 "zip_opb_single_operand_p" "rO")
|
11237 |
|
|
+ (match_operand 3 "const_int_operand" "") ;// Memory model used
|
11238 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11239 |
|
|
+ "(ZIP_ATOMIC)"
|
11240 |
|
|
+ {
|
11241 |
|
|
+ emit_insn(gen_reissue_atomic_add_fetchsi(operands[0],
|
11242 |
|
|
+ operands[1], operands[2]));
|
11243 |
|
|
+ DONE;
|
11244 |
|
|
+ })
|
11245 |
|
|
+(define_insn "reissue_atomic_add_fetchsi"
|
11246 |
200 |
dgisselq |
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
11247 |
202 |
dgisselq |
+ (plus:SI (match_operand:SI 1 "memory_operand" "+Q")
|
11248 |
200 |
dgisselq |
+ (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
|
11249 |
|
|
+ (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))
|
11250 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11251 |
|
|
+ "(ZIP_ATOMIC)"
|
11252 |
202 |
dgisselq |
+ "LOCK\n\tLW %1,%0\n\tADD %2,%0\n\tSW %0,%1"
|
11253 |
200 |
dgisselq |
+ [(set_attr "predicable" "no")])
|
11254 |
202 |
dgisselq |
+(define_expand "atomic_sub_fetchsi"
|
11255 |
|
|
+ [(match_operand:SI 0 "register_operand" "=r")
|
11256 |
|
|
+ (match_operand:SI 1 "memory_operand" "+Q")
|
11257 |
|
|
+ (match_operand:SI 2 "zip_opb_single_operand_p" "rO")
|
11258 |
|
|
+ (match_operand 3 "const_int_operand" "")
|
11259 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11260 |
|
|
+ "(ZIP_ATOMIC)"
|
11261 |
|
|
+ {
|
11262 |
|
|
+ emit_insn(gen_reissue_atomic_sub_fetchsi(
|
11263 |
|
|
+ operands[0], operands[1], operands[2]));
|
11264 |
|
|
+ DONE;
|
11265 |
|
|
+ })
|
11266 |
|
|
+(define_insn "reissue_atomic_sub_fetchsi"
|
11267 |
200 |
dgisselq |
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
11268 |
202 |
dgisselq |
+ (minus:SI (match_operand:SI 1 "memory_operand" "+Q")
|
11269 |
200 |
dgisselq |
+ (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
|
11270 |
|
|
+ (set (match_dup 1) (minus:SI (match_dup 1) (match_dup 2)))
|
11271 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11272 |
|
|
+ "(ZIP_ATOMIC)"
|
11273 |
202 |
dgisselq |
+ "LOCK\n\tLW %1,%0\n\tSUB %2,%0\n\tSW %0,%1"
|
11274 |
200 |
dgisselq |
+ [(set_attr "predicable" "no")])
|
11275 |
202 |
dgisselq |
+(define_expand "atomic_or_fetchsi"
|
11276 |
|
|
+ [(match_operand:SI 0 "register_operand" "=r")
|
11277 |
|
|
+ (match_operand:SI 1 "memory_operand" "+Q")
|
11278 |
|
|
+ (match_operand:SI 2 "zip_opb_single_operand_p" "rO")
|
11279 |
|
|
+ (match_operand 3 "const_int_operand" "")
|
11280 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11281 |
|
|
+ "(ZIP_ATOMIC)"
|
11282 |
|
|
+ {
|
11283 |
|
|
+ emit_insn(gen_reissue_atomic_or_fetchsi(
|
11284 |
|
|
+ operands[0], operands[1], operands[2]));
|
11285 |
|
|
+ DONE;
|
11286 |
|
|
+ })
|
11287 |
|
|
+(define_insn "reissue_atomic_or_fetchsi"
|
11288 |
200 |
dgisselq |
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
11289 |
202 |
dgisselq |
+ (ior:SI (match_operand:SI 1 "memory_operand" "+Q")
|
11290 |
200 |
dgisselq |
+ (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
|
11291 |
|
|
+ (set (match_dup 1) (ior:SI (match_dup 1) (match_dup 2)))
|
11292 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11293 |
|
|
+ "(ZIP_ATOMIC)"
|
11294 |
202 |
dgisselq |
+ "LOCK\n\tLW %1,%0\n\tOR %2,%0\n\tSW %0,%1"
|
11295 |
200 |
dgisselq |
+ [(set_attr "predicable" "no")])
|
11296 |
202 |
dgisselq |
+(define_expand "atomic_and_fetchsi"
|
11297 |
|
|
+ [(match_operand:SI 0 "register_operand" "=r")
|
11298 |
|
|
+ (match_operand:SI 1 "memory_operand" "+Q")
|
11299 |
|
|
+ (match_operand:SI 2 "zip_opb_single_operand_p" "rO")
|
11300 |
|
|
+ (match_operand 3 "const_int_operand" "")
|
11301 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11302 |
|
|
+ "(ZIP_ATOMIC)"
|
11303 |
|
|
+ {
|
11304 |
|
|
+ emit_insn(gen_reissue_atomic_and_fetchsi(
|
11305 |
|
|
+ operands[0], operands[1], operands[2]));
|
11306 |
|
|
+ DONE;
|
11307 |
|
|
+ })
|
11308 |
|
|
+(define_insn "reissue_atomic_and_fetchsi"
|
11309 |
200 |
dgisselq |
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
11310 |
202 |
dgisselq |
+ (and:SI (match_operand:SI 1 "memory_operand" "+Q")
|
11311 |
200 |
dgisselq |
+ (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
|
11312 |
|
|
+ (set (match_dup 1) (and:SI (match_dup 1) (match_dup 2)))
|
11313 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11314 |
|
|
+ "(ZIP_ATOMIC)"
|
11315 |
202 |
dgisselq |
+ "LOCK\n\tLW %1,%0\n\tAND %2,%0\n\tSW %0,%1"
|
11316 |
200 |
dgisselq |
+ [(set_attr "predicable" "no")])
|
11317 |
202 |
dgisselq |
+(define_expand "atomic_xor_fetchsi"
|
11318 |
|
|
+ [(match_operand:SI 0 "register_operand" "=r")
|
11319 |
|
|
+ (match_operand:SI 1 "memory_operand" "+Q")
|
11320 |
|
|
+ (match_operand:SI 2 "zip_opb_single_operand_p" "rO")
|
11321 |
|
|
+ (match_operand 3 "const_int_operand" "") ;// Memory model
|
11322 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11323 |
|
|
+ "(ZIP_ATOMIC)"
|
11324 |
|
|
+ {
|
11325 |
|
|
+ emit_insn(gen_reissue_atomic_xor_fetchsi(
|
11326 |
|
|
+ operands[0], operands[1], operands[2]));
|
11327 |
|
|
+ DONE;
|
11328 |
|
|
+ })
|
11329 |
|
|
+(define_insn "reissue_atomic_xor_fetchsi"
|
11330 |
200 |
dgisselq |
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
11331 |
202 |
dgisselq |
+ (xor:SI (match_operand:SI 1 "memory_operand" "+Q")
|
11332 |
200 |
dgisselq |
+ (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
|
11333 |
|
|
+ (set (match_dup 1) (xor:SI (match_dup 1) (match_dup 2)))
|
11334 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11335 |
|
|
+ "(ZIP_ATOMIC)"
|
11336 |
202 |
dgisselq |
+ "LOCK\n\tLW %1,%0\n\tXOR %2,%0\n\tSW %0,%1"
|
11337 |
200 |
dgisselq |
+ [(set_attr "predicable" "no")])
|
11338 |
|
|
+;
|
11339 |
|
|
+;
|
11340 |
|
|
+;
|
11341 |
|
|
+;
|
11342 |
202 |
dgisselq |
+(define_expand "atomic_fetch_addsi"
|
11343 |
|
|
+ [(set (match_operand:SI 1 "memory_operand" "+Q")
|
11344 |
200 |
dgisselq |
+ (plus:SI (match_dup 1)
|
11345 |
|
|
+ (match_operand:SI 2 "register_operand" "=r")))
|
11346 |
|
|
+ (set (match_operand:SI 0 "register_operand" "=r")
|
11347 |
|
|
+ (match_dup 1))
|
11348 |
|
|
+ (set (match_dup 2) (plus:SI (match_dup 1) (match_dup 2)))
|
11349 |
202 |
dgisselq |
+ (match_operand 3 "const_int_operand" "") ; Memory model used
|
11350 |
200 |
dgisselq |
+ (clobber (reg:CC CC_REG))]
|
11351 |
|
|
+ "(ZIP_ATOMIC)"
|
11352 |
202 |
dgisselq |
+ {
|
11353 |
|
|
+ emit_insn(gen_reissue_atomic_fetch_addsi(
|
11354 |
|
|
+ operands[0], operands[1], operands[2]));
|
11355 |
|
|
+ DONE;
|
11356 |
|
|
+ })
|
11357 |
|
|
+(define_insn "reissue_atomic_fetch_addsi"
|
11358 |
|
|
+ [(set (match_operand:SI 1 "memory_operand" "+Q")
|
11359 |
|
|
+ (plus:SI (match_dup 1)
|
11360 |
|
|
+ (match_operand:SI 2 "register_operand" "=r")))
|
11361 |
|
|
+ (set (match_operand:SI 0 "register_operand" "=r")
|
11362 |
|
|
+ (match_dup 1))
|
11363 |
|
|
+ (set (match_dup 2) (plus:SI (match_dup 1) (match_dup 2)))
|
11364 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11365 |
|
|
+ "(ZIP_ATOMIC)"
|
11366 |
|
|
+ "LOCK\n\tLW %1,%0\n\tADD %0,%2\n\tSW %2,%1"
|
11367 |
200 |
dgisselq |
+ [(set_attr "predicable" "no")])
|
11368 |
202 |
dgisselq |
+(define_expand "atomic_fetch_subsi"
|
11369 |
|
|
+ [(match_operand:SI 0 "register_operand" "=r")
|
11370 |
|
|
+ (match_operand:SI 1 "memory_operand" "+Q")
|
11371 |
|
|
+ (match_operand:SI 2 "zip_opb_single_operand_p" "rO")
|
11372 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11373 |
|
|
+ "(ZIP_ATOMIC)"
|
11374 |
|
|
+ {
|
11375 |
|
|
+ emit_insn(gen_reissue_atomic_fetch_subsi(
|
11376 |
|
|
+ operands[0], operands[1], operands[2]));
|
11377 |
|
|
+ DONE;
|
11378 |
|
|
+ })
|
11379 |
|
|
+(define_insn "reissue_atomic_fetch_subsi"
|
11380 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
11381 |
|
|
+ (minus:SI (match_operand:SI 1 "memory_operand" "+Q")
|
11382 |
|
|
+ (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
|
11383 |
|
|
+ (set (match_dup 1) (minus:SI (match_dup 1) (match_dup 2)))
|
11384 |
|
|
+ (clobber (match_scratch:SI 3 "=r")) ; Scratch register
|
11385 |
|
|
+ (clobber (reg:CC CC_REG))]
|
11386 |
|
|
+ "(ZIP_ATOMIC)"
|
11387 |
|
|
+ "NEG %2,%3\n\tLOCK\n\tLW %1,%0\n\tADD %0,%3\n\tSW %3,%1"
|
11388 |
|
|
+ [(set_attr "predicable" "no")])
|
11389 |
200 |
dgisselq |
+(define_insn "atomic_fetch_orsi"
|
11390 |
202 |
dgisselq |
+ [(set (match_operand:SI 1 "memory_operand" "+Q")
|
11391 |
200 |
dgisselq |
+ (ior:SI (match_dup 1)
|
11392 |
|
|
+ (match_operand:SI 2 "register_operand" "=r")))
|
11393 |
|
|
+ (set (match_operand:SI 0 "register_operand" "=r")
|
11394 |
|
|
+ (match_dup 1))
|
11395 |
|
|
+ (set (match_dup 2) (ior:SI (match_dup 1) (match_dup 2)))
|
11396 |
202 |
dgisselq |
+ (match_operand 3 "const_int_operand" "") ; Memory model used
|
11397 |
200 |
dgisselq |
+ (clobber (reg:CC CC_REG))]
|
11398 |
|
|
+ "(ZIP_ATOMIC)"
|
11399 |
202 |
dgisselq |
+ "LOCK\n\tLW %1,%0\n\tOR %0,%2\n\tSW %2,%1"
|
11400 |
200 |
dgisselq |
+ [(set_attr "predicable" "no")])
|
11401 |
|
|
+(define_insn "atomic_fetch_andsi"
|
11402 |
202 |
dgisselq |
+ [(set (match_operand:SI 1 "memory_operand" "+Q")
|
11403 |
200 |
dgisselq |
+ (and:SI (match_dup 1)
|
11404 |
|
|
+ (match_operand:SI 2 "register_operand" "=r")))
|
11405 |
|
|
+ (set (match_operand:SI 0 "register_operand" "=r")
|
11406 |
|
|
+ (match_dup 1))
|
11407 |
|
|
+ (set (match_dup 2) (and:SI (match_dup 1) (match_dup 2)))
|
11408 |
202 |
dgisselq |
+ (match_operand 3 "const_int_operand" "") ; Memory model used
|
11409 |
200 |
dgisselq |
+ (clobber (reg:CC CC_REG))]
|
11410 |
|
|
+ "(ZIP_ATOMIC)"
|
11411 |
202 |
dgisselq |
+ "LOCK\n\tLW %1,%0\n\tAND %0,%2\n\tSW %2,%1"
|
11412 |
200 |
dgisselq |
+ [(set_attr "predicable" "no")])
|
11413 |
|
|
+(define_insn "atomic_fetch_xorsi"
|
11414 |
202 |
dgisselq |
+ [(set (match_operand:SI 1 "memory_operand" "+Q")
|
11415 |
200 |
dgisselq |
+ (xor:SI (match_dup 1)
|
11416 |
|
|
+ (match_operand:SI 2 "register_operand" "=r")))
|
11417 |
|
|
+ (set (match_operand:SI 0 "register_operand" "=r")
|
11418 |
|
|
+ (match_dup 1))
|
11419 |
|
|
+ (set (match_dup 2) (xor:SI (match_dup 1) (match_dup 2)))
|
11420 |
202 |
dgisselq |
+ (match_operand 3 "const_int_operand" "") ; Memory model used
|
11421 |
200 |
dgisselq |
+ (clobber (reg:CC CC_REG))]
|
11422 |
|
|
+ "(ZIP_ATOMIC)"
|
11423 |
202 |
dgisselq |
+ "LOCK\n\tLW %1,%0\n\tXOR %0,%2\n\tSW %2,%1"
|
11424 |
200 |
dgisselq |
+ [(set_attr "predicable" "no")])
|
11425 |
|
|
+;
|
11426 |
|
|
+;
|
11427 |
|
|
+;
|
11428 |
|
|
+;
|
11429 |
|
|
+(define_insn "atomic_test_and_set"
|
11430 |
|
|
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
11431 |
202 |
dgisselq |
+ (zero_extend:SI
|
11432 |
|
|
+ (match_operand:QI 1 "memory_operand" "+Q")))
|
11433 |
|
|
+ (set (match_dup 1) (const_int 1))
|
11434 |
|
|
+ (match_operand 2 "const_int_operand" "") ; Memory model used
|
11435 |
|
|
+ (clobber (match_scratch:SI 3 "=r"))] ; Scratch register
|
11436 |
200 |
dgisselq |
+ "(ZIP_ATOMIC)"
|
11437 |
|
|
+ "LDI 1,%3
|
11438 |
|
|
+ LOCK
|
11439 |
202 |
dgisselq |
+ LB %1,%0
|
11440 |
|
|
+ SB %3,%1"
|
11441 |
200 |
dgisselq |
+ [(set_attr "predicable" "no")])
|
11442 |
|
|
+;
|
11443 |
|
|
+;
|
11444 |
|
|
+;
|
11445 |
202 |
dgisselq |
+(define_expand "atomic_compare_and_swapsi"
|
11446 |
|
|
+ [(match_operand:SI 0 "register_operand" "=r") ;; bool output
|
11447 |
|
|
+ (match_operand:SI 1 "register_operand" "=r") ;; val output
|
11448 |
|
|
+ (match_operand:SI 2 "memory_operand" "+Q") ;; memory
|
11449 |
|
|
+ (match_operand:SI 3 "zip_opb_single_operand_p" "rO") ;; Expected
|
11450 |
|
|
+ (match_operand:SI 4 "register_operand" "r") ;; Desired
|
11451 |
|
|
+ (match_operand 5 "const_int_operand" "") ; is_weak
|
11452 |
|
|
+ (match_operand 6 "const_int_operand" "") ; mem model on success
|
11453 |
|
|
+ (match_operand 7 "const_int_operand" "") ; mem model on failure
|
11454 |
|
|
+ ]
|
11455 |
|
|
+ "(ZIP_ATOMIC)"
|
11456 |
|
|
+ {
|
11457 |
|
|
+ emit_insn(gen_reissue_atomic_compare_and_swapsi(
|
11458 |
|
|
+ operands[0], operands[1],
|
11459 |
|
|
+ operands[2], operands[3],
|
11460 |
|
|
+ operands[4]));
|
11461 |
|
|
+ DONE;
|
11462 |
|
|
+ })
|
11463 |
|
|
+
|
11464 |
|
|
+(define_insn "reissue_atomic_compare_and_swapsi"
|
11465 |
200 |
dgisselq |
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
11466 |
|
|
+ (if_then_else
|
11467 |
202 |
dgisselq |
+ (eq (match_operand:SI 2 "memory_operand" "+Q")
|
11468 |
200 |
dgisselq |
+ (match_operand:SI 3 "zip_opb_single_operand_p" "rO"))
|
11469 |
|
|
+ (const_int 1)
|
11470 |
|
|
+ (const_int 0)))
|
11471 |
|
|
+ (set (match_operand:SI 1 "register_operand" "=r") (match_dup 2))
|
11472 |
|
|
+ (set (match_dup 2) (if_then_else
|
11473 |
|
|
+ (eq (match_dup 2) (match_dup 3))
|
11474 |
|
|
+ (match_operand:SI 4 "register_operand" "r")
|
11475 |
|
|
+ (match_dup 0)))]
|
11476 |
|
|
+ "(ZIP_ATOMIC)"
|
11477 |
|
|
+ "CLR %0
|
11478 |
|
|
+ LOCK
|
11479 |
202 |
dgisselq |
+ LW %2,%1
|
11480 |
200 |
dgisselq |
+ CMP %3,%1
|
11481 |
202 |
dgisselq |
+ SW %4,%1
|
11482 |
200 |
dgisselq |
+ LDI.Z 1,%0"
|
11483 |
|
|
+ [(set_attr "predicable" "no")])
|
11484 |
|
|
+;
|
11485 |
|
|
+;
|
11486 |
|
|
+;
|
11487 |
|
|
+;
|
11488 |
|
|
+; STILL MISSING:
|
11489 |
|
|
+;
|
11490 |
|
|
+; deprecated sync_* atomic functions
|
11491 |
|
|
+;
|
11492 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/config.gcc gcc-6.2.0-zip/gcc/config.gcc
|
11493 |
|
|
--- gcc-6.2.0/gcc/config.gcc 2016-06-08 09:34:25.000000000 -0400
|
11494 |
|
|
+++ gcc-6.2.0-zip/gcc/config.gcc 2016-12-31 16:41:06.258602919 -0500
|
11495 |
|
|
@@ -493,6 +493,10 @@
|
11496 |
102 |
dgisselq |
tilepro*-*-*)
|
11497 |
|
|
cpu_type=tilepro
|
11498 |
|
|
;;
|
11499 |
|
|
+zip*)
|
11500 |
|
|
+ cpu_type=zip
|
11501 |
|
|
+ tmake_file=zip/t-zip
|
11502 |
|
|
+ ;;
|
11503 |
|
|
esac
|
11504 |
|
|
|
11505 |
|
|
tm_file=${cpu_type}/${cpu_type}.h
|
11506 |
202 |
dgisselq |
@@ -3042,6 +3046,11 @@
|
11507 |
102 |
dgisselq |
c_target_objs="m32c-pragma.o"
|
11508 |
|
|
cxx_target_objs="m32c-pragma.o"
|
11509 |
|
|
;;
|
11510 |
|
|
+zip*)
|
11511 |
|
|
+ target_has_targetm_common=yes
|
11512 |
|
|
+ tm_file="elfos.h newlib-stdint.h ${tm_file}"
|
11513 |
|
|
+ tmake_file="${tmake_file} zip/t-zip"
|
11514 |
|
|
+ ;;
|
11515 |
|
|
*)
|
11516 |
|
|
echo "*** Configuration ${target} not supported" 1>&2
|
11517 |
|
|
exit 1
|
11518 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/cse.c gcc-6.2.0-zip/gcc/cse.c
|
11519 |
|
|
--- gcc-6.2.0/gcc/cse.c 2016-02-04 04:56:13.000000000 -0500
|
11520 |
|
|
+++ gcc-6.2.0-zip/gcc/cse.c 2017-02-06 21:46:10.525049918 -0500
|
11521 |
|
|
@@ -42,6 +42,16 @@
|
11522 |
138 |
dgisselq |
#include "dbgcnt.h"
|
11523 |
|
|
#include "rtl-iter.h"
|
11524 |
|
|
|
11525 |
|
|
+
|
11526 |
111 |
dgisselq |
+// #define DO_ZIP_DEBUGS
|
11527 |
102 |
dgisselq |
+#ifdef DO_ZIP_DEBUGS
|
11528 |
|
|
+#include <stdio.h>
|
11529 |
202 |
dgisselq |
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s;%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX);} while(0)
|
11530 |
138 |
dgisselq |
+extern void zip_debug_rtx(const_rtx);
|
11531 |
102 |
dgisselq |
+#else
|
11532 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX)
|
11533 |
|
|
+#endif
|
11534 |
|
|
+
|
11535 |
202 |
dgisselq |
#ifndef LOAD_EXTEND_OP
|
11536 |
|
|
#define LOAD_EXTEND_OP(M) UNKNOWN
|
11537 |
|
|
#endif
|
11538 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/defaults.h gcc-6.2.0-zip/gcc/defaults.h
|
11539 |
|
|
--- gcc-6.2.0/gcc/defaults.h 2016-01-04 09:30:50.000000000 -0500
|
11540 |
|
|
+++ gcc-6.2.0-zip/gcc/defaults.h 2016-12-31 16:42:29.094087738 -0500
|
11541 |
|
|
@@ -495,6 +495,8 @@
|
11542 |
102 |
dgisselq |
#define LOG2_BITS_PER_UNIT 3
|
11543 |
|
|
#elif BITS_PER_UNIT == 16
|
11544 |
|
|
#define LOG2_BITS_PER_UNIT 4
|
11545 |
|
|
+#elif BITS_PER_UNIT == 32
|
11546 |
|
|
+#define LOG2_BITS_PER_UNIT 5
|
11547 |
|
|
#else
|
11548 |
|
|
#error Unknown BITS_PER_UNIT
|
11549 |
|
|
#endif
|
11550 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/df-scan.c gcc-6.2.0-zip/gcc/df-scan.c
|
11551 |
|
|
--- gcc-6.2.0/gcc/df-scan.c 2016-01-04 09:30:50.000000000 -0500
|
11552 |
|
|
+++ gcc-6.2.0-zip/gcc/df-scan.c 2016-12-31 16:43:04.557867015 -0500
|
11553 |
|
|
@@ -35,6 +35,14 @@
|
11554 |
|
|
#include "dumpfile.h"
|
11555 |
127 |
dgisselq |
|
11556 |
|
|
|
11557 |
|
|
+#ifdef DO_ZIP_DEBUGS
|
11558 |
202 |
dgisselq |
+#include <stdio.h>
|
11559 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s;%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX);} while(0)
|
11560 |
127 |
dgisselq |
+extern void zip_debug_rtx(const_rtx);
|
11561 |
|
|
+#else
|
11562 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX)
|
11563 |
|
|
+#endif
|
11564 |
|
|
+
|
11565 |
202 |
dgisselq |
/* The set of hard registers in eliminables[i].from. */
|
11566 |
127 |
dgisselq |
|
11567 |
202 |
dgisselq |
static HARD_REG_SET elim_reg_set;
|
11568 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/emit-rtl.c gcc-6.2.0-zip/gcc/emit-rtl.c
|
11569 |
|
|
--- gcc-6.2.0/gcc/emit-rtl.c 2016-02-16 18:12:19.000000000 -0500
|
11570 |
|
|
+++ gcc-6.2.0-zip/gcc/emit-rtl.c 2016-12-31 16:43:35.065677060 -0500
|
11571 |
|
|
@@ -59,6 +59,15 @@
|
11572 |
|
|
#include "stor-layout.h"
|
11573 |
|
|
#include "opts.h"
|
11574 |
|
|
|
11575 |
102 |
dgisselq |
+
|
11576 |
202 |
dgisselq |
+#ifdef DO_ZIP_DEBUGS
|
11577 |
117 |
dgisselq |
+#include <stdio.h>
|
11578 |
202 |
dgisselq |
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s;%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX);} while(0)
|
11579 |
117 |
dgisselq |
+extern void zip_debug_rtx(const_rtx);
|
11580 |
|
|
+#else
|
11581 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX)
|
11582 |
|
|
+#endif
|
11583 |
|
|
+
|
11584 |
|
|
struct target_rtl default_target_rtl;
|
11585 |
|
|
#if SWITCHABLE_TARGET
|
11586 |
|
|
struct target_rtl *this_target_rtl = &default_target_rtl;
|
11587 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/final.c gcc-6.2.0-zip/gcc/final.c
|
11588 |
|
|
--- gcc-6.2.0/gcc/final.c 2016-01-22 11:44:10.000000000 -0500
|
11589 |
|
|
+++ gcc-6.2.0-zip/gcc/final.c 2017-02-06 15:35:15.410085646 -0500
|
11590 |
|
|
@@ -79,6 +79,16 @@
|
11591 |
|
|
#include "rtl-iter.h"
|
11592 |
|
|
#include "print-rtl.h"
|
11593 |
117 |
dgisselq |
|
11594 |
|
|
+
|
11595 |
122 |
dgisselq |
+// #define DO_ZIP_DEBUGS
|
11596 |
111 |
dgisselq |
+#ifdef DO_ZIP_DEBUGS
|
11597 |
202 |
dgisselq |
+#include <stdio.h>
|
11598 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX);} while(0)
|
11599 |
|
|
+extern void zip_debug_rtx(const_rtx);
|
11600 |
111 |
dgisselq |
+#else
|
11601 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX)
|
11602 |
|
|
+#endif
|
11603 |
|
|
+
|
11604 |
|
|
#ifdef XCOFF_DEBUGGING_INFO
|
11605 |
202 |
dgisselq |
#include "xcoffout.h" /* Needed for external data declarations. */
|
11606 |
|
|
#endif
|
11607 |
|
|
@@ -2944,6 +2954,8 @@
|
11608 |
102 |
dgisselq |
|
11609 |
202 |
dgisselq |
current_output_insn = debug_insn = insn;
|
11610 |
102 |
dgisselq |
|
11611 |
202 |
dgisselq |
+ZIP_DEBUG_LINE("FINAL-INSN", insn);
|
11612 |
|
|
+
|
11613 |
|
|
/* Find the proper template for this insn. */
|
11614 |
|
|
templ = get_insn_template (insn_code_number, insn);
|
11615 |
102 |
dgisselq |
|
11616 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/fold-const.c gcc-6.2.0-zip/gcc/fold-const.c
|
11617 |
|
|
--- gcc-6.2.0/gcc/fold-const.c 2016-07-08 16:20:23.000000000 -0400
|
11618 |
|
|
+++ gcc-6.2.0-zip/gcc/fold-const.c 2016-12-31 16:47:49.000093249 -0500
|
11619 |
|
|
@@ -1247,7 +1247,7 @@
|
11620 |
|
|
wide_int w2 = arg2;
|
11621 |
|
|
f2.data.high = w2.elt (1);
|
11622 |
|
|
f2.data.low = w2.elt (0);
|
11623 |
|
|
- f2.mode = SImode;
|
11624 |
|
|
+ f2.mode = word_mode;
|
11625 |
|
|
}
|
11626 |
|
|
break;
|
11627 |
102 |
dgisselq |
|
11628 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/jump.c gcc-6.2.0-zip/gcc/jump.c
|
11629 |
|
|
--- gcc-6.2.0/gcc/jump.c 2016-01-04 09:30:50.000000000 -0500
|
11630 |
|
|
+++ gcc-6.2.0-zip/gcc/jump.c 2016-12-31 16:49:10.675582836 -0500
|
11631 |
|
|
@@ -50,6 +50,15 @@
|
11632 |
|
|
#include "cfgrtl.h"
|
11633 |
117 |
dgisselq |
#include "rtl-iter.h"
|
11634 |
|
|
|
11635 |
202 |
dgisselq |
+
|
11636 |
117 |
dgisselq |
+#ifdef DO_ZIP_DEBUGS
|
11637 |
|
|
+#include <stdio.h>
|
11638 |
202 |
dgisselq |
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s;%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX);} while(0)
|
11639 |
|
|
+extern void zip_debug_rtx(const_rtx);
|
11640 |
117 |
dgisselq |
+#else
|
11641 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX)
|
11642 |
|
|
+#endif
|
11643 |
202 |
dgisselq |
+
|
11644 |
117 |
dgisselq |
/* Optimize jump y; x: ... y: jumpif... x?
|
11645 |
|
|
Don't know if it is worth bothering with. */
|
11646 |
|
|
/* Optimize two cases of conditional jump to conditional jump?
|
11647 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/loop-doloop.c gcc-6.2.0-zip/gcc/loop-doloop.c
|
11648 |
|
|
--- gcc-6.2.0/gcc/loop-doloop.c 2016-01-14 18:12:53.000000000 -0500
|
11649 |
|
|
+++ gcc-6.2.0-zip/gcc/loop-doloop.c 2016-12-31 16:50:27.099104820 -0500
|
11650 |
|
|
@@ -37,6 +37,15 @@
|
11651 |
|
|
#include "regs.h"
|
11652 |
|
|
#include "df.h"
|
11653 |
117 |
dgisselq |
|
11654 |
|
|
+
|
11655 |
191 |
dgisselq |
+#ifdef DO_ZIP_DEBUGS
|
11656 |
202 |
dgisselq |
+#include <stdio.h>
|
11657 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s;%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX);} while(0)
|
11658 |
191 |
dgisselq |
+extern void zip_debug_rtx(const_rtx);
|
11659 |
|
|
+#else
|
11660 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX)
|
11661 |
|
|
+#endif
|
11662 |
202 |
dgisselq |
+
|
11663 |
191 |
dgisselq |
/* This module is used to modify loops with a determinable number of
|
11664 |
|
|
iterations to use special low-overhead looping instructions.
|
11665 |
|
|
|
11666 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/loop-iv.c gcc-6.2.0-zip/gcc/loop-iv.c
|
11667 |
|
|
--- gcc-6.2.0/gcc/loop-iv.c 2016-01-04 09:30:50.000000000 -0500
|
11668 |
|
|
+++ gcc-6.2.0-zip/gcc/loop-iv.c 2016-12-31 16:52:42.034259845 -0500
|
11669 |
|
|
@@ -1715,8 +1715,8 @@
|
11670 |
|
|
if (op0 != XEXP (cond, 0)
|
11671 |
|
|
|| op1 != XEXP (cond, 1)
|
11672 |
|
|
|| code != GET_CODE (cond)
|
11673 |
|
|
- || GET_MODE (cond) != SImode)
|
11674 |
|
|
- cond = gen_rtx_fmt_ee (code, SImode, op0, op1);
|
11675 |
|
|
+ || GET_MODE (cond) != word_mode)
|
11676 |
|
|
+ cond = gen_rtx_fmt_ee (code, word_mode, op0, op1);
|
11677 |
191 |
dgisselq |
|
11678 |
202 |
dgisselq |
return cond;
|
11679 |
|
|
}
|
11680 |
|
|
@@ -2083,9 +2083,9 @@
|
11681 |
|
|
rtx mmin, mmax, cond_over, cond_under;
|
11682 |
191 |
dgisselq |
|
11683 |
202 |
dgisselq |
get_mode_bounds (mode, signed_p, iv->extend_mode, &mmin, &mmax);
|
11684 |
|
|
- cond_under = simplify_gen_relational (LT, SImode, iv->extend_mode,
|
11685 |
|
|
+ cond_under = simplify_gen_relational (LT, word_mode, iv->extend_mode,
|
11686 |
|
|
iv->base, mmin);
|
11687 |
|
|
- cond_over = simplify_gen_relational (GT, SImode, iv->extend_mode,
|
11688 |
|
|
+ cond_over = simplify_gen_relational (GT, word_mode, iv->extend_mode,
|
11689 |
|
|
iv->base, mmax);
|
11690 |
191 |
dgisselq |
|
11691 |
202 |
dgisselq |
switch (cond)
|
11692 |
|
|
@@ -2464,7 +2464,7 @@
|
11693 |
|
|
if (iv0.step == const0_rtx)
|
11694 |
|
|
{
|
11695 |
|
|
tmp = lowpart_subreg (mode, iv0.base, comp_mode);
|
11696 |
|
|
- assumption = simplify_gen_relational (EQ, SImode, mode, tmp,
|
11697 |
|
|
+ assumption = simplify_gen_relational (EQ, word_mode, mode, tmp,
|
11698 |
|
|
mode_mmax);
|
11699 |
|
|
if (assumption == const_true_rtx)
|
11700 |
|
|
goto zero_iter_simplify;
|
11701 |
|
|
@@ -2474,7 +2474,7 @@
|
11702 |
|
|
else
|
11703 |
|
|
{
|
11704 |
|
|
tmp = lowpart_subreg (mode, iv1.base, comp_mode);
|
11705 |
|
|
- assumption = simplify_gen_relational (EQ, SImode, mode, tmp,
|
11706 |
|
|
+ assumption = simplify_gen_relational (EQ, word_mode, mode, tmp,
|
11707 |
|
|
mode_mmin);
|
11708 |
|
|
if (assumption == const_true_rtx)
|
11709 |
|
|
goto zero_iter_simplify;
|
11710 |
|
|
@@ -2561,10 +2561,10 @@
|
11711 |
|
|
bound = simplify_gen_binary (MINUS, comp_mode, bound, delta);
|
11712 |
|
|
bound = lowpart_subreg (mode, bound, comp_mode);
|
11713 |
|
|
tmp = lowpart_subreg (mode, iv0.base, comp_mode);
|
11714 |
|
|
- may_xform = simplify_gen_relational (cond, SImode, mode,
|
11715 |
|
|
+ may_xform = simplify_gen_relational (cond, word_mode, mode,
|
11716 |
|
|
bound, tmp);
|
11717 |
|
|
may_not_xform = simplify_gen_relational (reverse_condition (cond),
|
11718 |
|
|
- SImode, mode,
|
11719 |
|
|
+ word_mode, mode,
|
11720 |
|
|
bound, tmp);
|
11721 |
|
|
}
|
11722 |
|
|
else
|
11723 |
|
|
@@ -2573,10 +2573,10 @@
|
11724 |
|
|
bound = simplify_gen_binary (PLUS, comp_mode, bound, delta);
|
11725 |
|
|
bound = lowpart_subreg (mode, bound, comp_mode);
|
11726 |
|
|
tmp = lowpart_subreg (mode, iv1.base, comp_mode);
|
11727 |
|
|
- may_xform = simplify_gen_relational (cond, SImode, mode,
|
11728 |
|
|
+ may_xform = simplify_gen_relational (cond, word_mode, mode,
|
11729 |
|
|
tmp, bound);
|
11730 |
|
|
may_not_xform = simplify_gen_relational (reverse_condition (cond),
|
11731 |
|
|
- SImode, mode,
|
11732 |
|
|
+ word_mode, mode,
|
11733 |
|
|
tmp, bound);
|
11734 |
|
|
}
|
11735 |
|
|
}
|
11736 |
|
|
@@ -2629,7 +2629,7 @@
|
11737 |
|
|
tmp0 = lowpart_subreg (mode, iv0.base, comp_mode);
|
11738 |
|
|
tmp1 = lowpart_subreg (mode, iv1.base, comp_mode);
|
11739 |
|
|
assumption = simplify_gen_relational (reverse_condition (cond),
|
11740 |
|
|
- SImode, mode, tmp0, tmp1);
|
11741 |
|
|
+ word_mode, mode, tmp0, tmp1);
|
11742 |
|
|
if (assumption == const_true_rtx)
|
11743 |
|
|
goto zero_iter_simplify;
|
11744 |
|
|
else if (assumption != const0_rtx)
|
11745 |
|
|
@@ -2671,7 +2671,7 @@
|
11746 |
191 |
dgisselq |
|
11747 |
202 |
dgisselq |
tmp1 = lowpart_subreg (mode, iv1.base, comp_mode);
|
11748 |
|
|
tmp = simplify_gen_binary (UMOD, mode, tmp1, gen_int_mode (d, mode));
|
11749 |
|
|
- assumption = simplify_gen_relational (NE, SImode, mode, tmp, const0_rtx);
|
11750 |
|
|
+ assumption = simplify_gen_relational (NE, word_mode, mode, tmp, const0_rtx);
|
11751 |
|
|
desc->infinite = alloc_EXPR_LIST (0, assumption, desc->infinite);
|
11752 |
191 |
dgisselq |
|
11753 |
202 |
dgisselq |
tmp = simplify_gen_binary (UDIV, mode, tmp1, gen_int_mode (d, mode));
|
11754 |
|
|
@@ -2703,19 +2703,19 @@
|
11755 |
|
|
/* If s is power of 2, we know that the loop is infinite if
|
11756 |
|
|
a % s <= b % s and b + s overflows. */
|
11757 |
|
|
assumption = simplify_gen_relational (reverse_condition (cond),
|
11758 |
|
|
- SImode, mode,
|
11759 |
|
|
+ word_mode, mode,
|
11760 |
|
|
tmp1, bound);
|
11761 |
191 |
dgisselq |
|
11762 |
202 |
dgisselq |
t0 = simplify_gen_binary (UMOD, mode, copy_rtx (tmp0), step);
|
11763 |
|
|
t1 = simplify_gen_binary (UMOD, mode, copy_rtx (tmp1), step);
|
11764 |
|
|
- tmp = simplify_gen_relational (cond, SImode, mode, t0, t1);
|
11765 |
|
|
- assumption = simplify_gen_binary (AND, SImode, assumption, tmp);
|
11766 |
|
|
+ tmp = simplify_gen_relational (cond, word_mode, mode, t0, t1);
|
11767 |
|
|
+ assumption = simplify_gen_binary (AND, word_mode, assumption, tmp);
|
11768 |
|
|
desc->infinite =
|
11769 |
|
|
alloc_EXPR_LIST (0, assumption, desc->infinite);
|
11770 |
|
|
}
|
11771 |
|
|
else
|
11772 |
|
|
{
|
11773 |
|
|
- assumption = simplify_gen_relational (cond, SImode, mode,
|
11774 |
|
|
+ assumption = simplify_gen_relational (cond, word_mode, mode,
|
11775 |
|
|
tmp1, bound);
|
11776 |
|
|
desc->assumptions =
|
11777 |
|
|
alloc_EXPR_LIST (0, assumption, desc->assumptions);
|
11778 |
|
|
@@ -2724,7 +2724,7 @@
|
11779 |
|
|
tmp = simplify_gen_binary (PLUS, comp_mode, iv1.base, iv0.step);
|
11780 |
|
|
tmp = lowpart_subreg (mode, tmp, comp_mode);
|
11781 |
|
|
assumption = simplify_gen_relational (reverse_condition (cond),
|
11782 |
|
|
- SImode, mode, tmp0, tmp);
|
11783 |
|
|
+ word_mode, mode, tmp0, tmp);
|
11784 |
191 |
dgisselq |
|
11785 |
202 |
dgisselq |
delta = simplify_gen_binary (PLUS, mode, tmp1, step);
|
11786 |
|
|
delta = simplify_gen_binary (MINUS, mode, delta, tmp0);
|
11787 |
|
|
@@ -2747,19 +2747,19 @@
|
11788 |
|
|
/* If s is power of 2, we know that the loop is infinite if
|
11789 |
|
|
a % s <= b % s and a - s overflows. */
|
11790 |
|
|
assumption = simplify_gen_relational (reverse_condition (cond),
|
11791 |
|
|
- SImode, mode,
|
11792 |
|
|
+ word_mode, mode,
|
11793 |
|
|
bound, tmp0);
|
11794 |
191 |
dgisselq |
|
11795 |
202 |
dgisselq |
t0 = simplify_gen_binary (UMOD, mode, copy_rtx (tmp0), step);
|
11796 |
|
|
t1 = simplify_gen_binary (UMOD, mode, copy_rtx (tmp1), step);
|
11797 |
|
|
- tmp = simplify_gen_relational (cond, SImode, mode, t0, t1);
|
11798 |
|
|
- assumption = simplify_gen_binary (AND, SImode, assumption, tmp);
|
11799 |
|
|
+ tmp = simplify_gen_relational (cond, word_mode, mode, t0, t1);
|
11800 |
|
|
+ assumption = simplify_gen_binary (AND, word_mode, assumption, tmp);
|
11801 |
|
|
desc->infinite =
|
11802 |
|
|
alloc_EXPR_LIST (0, assumption, desc->infinite);
|
11803 |
|
|
}
|
11804 |
|
|
else
|
11805 |
|
|
{
|
11806 |
|
|
- assumption = simplify_gen_relational (cond, SImode, mode,
|
11807 |
|
|
+ assumption = simplify_gen_relational (cond, word_mode, mode,
|
11808 |
|
|
bound, tmp0);
|
11809 |
|
|
desc->assumptions =
|
11810 |
|
|
alloc_EXPR_LIST (0, assumption, desc->assumptions);
|
11811 |
|
|
@@ -2768,7 +2768,7 @@
|
11812 |
|
|
tmp = simplify_gen_binary (PLUS, comp_mode, iv0.base, iv1.step);
|
11813 |
|
|
tmp = lowpart_subreg (mode, tmp, comp_mode);
|
11814 |
|
|
assumption = simplify_gen_relational (reverse_condition (cond),
|
11815 |
|
|
- SImode, mode,
|
11816 |
|
|
+ word_mode, mode,
|
11817 |
|
|
tmp, tmp1);
|
11818 |
|
|
delta = simplify_gen_binary (MINUS, mode, tmp0, step);
|
11819 |
|
|
delta = simplify_gen_binary (MINUS, mode, tmp1, delta);
|
11820 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/optabs.c gcc-6.2.0-zip/gcc/optabs.c
|
11821 |
|
|
--- gcc-6.2.0/gcc/optabs.c 2016-02-16 10:15:40.000000000 -0500
|
11822 |
|
|
+++ gcc-6.2.0-zip/gcc/optabs.c 2017-03-01 15:46:15.660221429 -0500
|
11823 |
|
|
@@ -43,6 +43,17 @@
|
11824 |
|
|
#include "optabs-tree.h"
|
11825 |
|
|
#include "libfuncs.h"
|
11826 |
102 |
dgisselq |
|
11827 |
111 |
dgisselq |
+
|
11828 |
|
|
+// #define DO_ZIP_DEBUGS
|
11829 |
102 |
dgisselq |
+#ifdef DO_ZIP_DEBUGS
|
11830 |
202 |
dgisselq |
+#include <stdio.h>
|
11831 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX);} while(0)
|
11832 |
|
|
+extern void zip_debug_rtx(const_rtx);
|
11833 |
|
|
+extern void zip_debug_rtx_pfx(const char *,const_rtx);
|
11834 |
102 |
dgisselq |
+#else
|
11835 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX)
|
11836 |
|
|
+#endif
|
11837 |
|
|
+
|
11838 |
202 |
dgisselq |
static void prepare_float_lib_cmp (rtx, rtx, enum rtx_code, rtx *,
|
11839 |
|
|
machine_mode *);
|
11840 |
|
|
static rtx expand_unop_direct (machine_mode, optab, rtx, rtx, int);
|
11841 |
|
|
@@ -6985,6 +6996,15 @@
|
11842 |
|
|
maybe_gen_insn (enum insn_code icode, unsigned int nops,
|
11843 |
|
|
struct expand_operand *ops)
|
11844 |
|
|
{
|
11845 |
|
|
+#ifdef DO_ZIP_DEBUGS
|
11846 |
|
|
+fprintf(stderr, "ICODE = %d\n", icode);
|
11847 |
|
|
+fprintf(stderr, "NOPS = %d\n", nops);
|
11848 |
|
|
+for(int i=0; i<nops; i++) {
|
11849 |
|
|
+ char str[10];
|
11850 |
|
|
+ sprintf(str, "Op %d: ", i);
|
11851 |
|
|
+ zip_debug_rtx_pfx(str, ops[i].value);
|
11852 |
|
|
+}
|
11853 |
|
|
+#endif
|
11854 |
|
|
gcc_assert (nops == (unsigned int) insn_data[(int) icode].n_generator_args);
|
11855 |
|
|
if (!maybe_legitimize_operands (icode, 0, nops, ops))
|
11856 |
|
|
return NULL;
|
11857 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/recog.c gcc-6.2.0-zip/gcc/recog.c
|
11858 |
|
|
--- gcc-6.2.0/gcc/recog.c 2016-01-29 13:47:17.000000000 -0500
|
11859 |
|
|
+++ gcc-6.2.0-zip/gcc/recog.c 2017-02-06 15:47:48.493946049 -0500
|
11860 |
|
|
@@ -40,6 +40,16 @@
|
11861 |
|
|
#include "reload.h"
|
11862 |
|
|
#include "tree-pass.h"
|
11863 |
102 |
dgisselq |
|
11864 |
|
|
+
|
11865 |
117 |
dgisselq |
+// #define DO_ZIP_DEBUGS
|
11866 |
|
|
+#ifdef DO_ZIP_DEBUGS
|
11867 |
202 |
dgisselq |
+#include <stdio.h>
|
11868 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX);} while(0)
|
11869 |
117 |
dgisselq |
+extern void zip_debug_rtx(const_rtx);
|
11870 |
|
|
+#else
|
11871 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX)
|
11872 |
|
|
+#endif
|
11873 |
|
|
+
|
11874 |
202 |
dgisselq |
#ifndef STACK_POP_CODE
|
11875 |
|
|
#if STACK_GROWS_DOWNWARD
|
11876 |
|
|
#define STACK_POP_CODE POST_INC
|
11877 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/reload1.c gcc-6.2.0-zip/gcc/reload1.c
|
11878 |
|
|
--- gcc-6.2.0/gcc/reload1.c 2016-03-18 04:25:57.000000000 -0400
|
11879 |
|
|
+++ gcc-6.2.0-zip/gcc/reload1.c 2017-02-06 15:54:21.067740343 -0500
|
11880 |
|
|
@@ -42,6 +42,15 @@
|
11881 |
117 |
dgisselq |
#include "dumpfile.h"
|
11882 |
|
|
#include "rtl-iter.h"
|
11883 |
|
|
|
11884 |
|
|
+#ifdef DO_ZIP_DEBUGS
|
11885 |
202 |
dgisselq |
+#include <stdio.h>
|
11886 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX);} while(0)
|
11887 |
117 |
dgisselq |
+extern void zip_debug_rtx(const_rtx);
|
11888 |
|
|
+#else
|
11889 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX)
|
11890 |
|
|
+#endif
|
11891 |
|
|
+
|
11892 |
202 |
dgisselq |
+
|
11893 |
117 |
dgisselq |
/* This file contains the reload pass of the compiler, which is
|
11894 |
|
|
run after register allocation has been done. It checks that
|
11895 |
|
|
each insn is valid (operands required to be in registers really
|
11896 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/reload.c gcc-6.2.0-zip/gcc/reload.c
|
11897 |
|
|
--- gcc-6.2.0/gcc/reload.c 2016-02-13 20:37:40.000000000 -0500
|
11898 |
|
|
+++ gcc-6.2.0-zip/gcc/reload.c 2017-03-01 15:46:26.784221658 -0500
|
11899 |
|
|
@@ -106,6 +106,15 @@
|
11900 |
|
|
#include "addresses.h"
|
11901 |
|
|
#include "params.h"
|
11902 |
117 |
dgisselq |
|
11903 |
122 |
dgisselq |
+// #define DO_ZIP_DEBUGS
|
11904 |
|
|
+#ifdef DO_ZIP_DEBUGS
|
11905 |
202 |
dgisselq |
+#include <stdio.h>
|
11906 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX);} while(0)
|
11907 |
|
|
+extern void zip_debug_rtx(const_rtx);
|
11908 |
122 |
dgisselq |
+#else
|
11909 |
|
|
+#define ZIP_DEBUG_LINE(STR,RTX)
|
11910 |
|
|
+#endif
|
11911 |
|
|
+
|
11912 |
|
|
/* True if X is a constant that can be forced into the constant pool.
|
11913 |
|
|
MODE is the mode of the operand, or VOIDmode if not known. */
|
11914 |
|
|
#define CONST_POOL_OK_P(MODE, X) \
|
11915 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/testsuite/lib/target-supports.exp gcc-6.2.0-zip/gcc/testsuite/lib/target-supports.exp
|
11916 |
|
|
--- gcc-6.2.0/gcc/testsuite/lib/target-supports.exp 2016-07-05 13:54:02.000000000 -0400
|
11917 |
|
|
+++ gcc-6.2.0-zip/gcc/testsuite/lib/target-supports.exp 2016-12-31 16:59:52.719091392 -0500
|
11918 |
|
|
@@ -545,6 +545,11 @@
|
11919 |
102 |
dgisselq |
return 0
|
11920 |
|
|
}
|
11921 |
|
|
|
11922 |
202 |
dgisselq |
+ # ZipCPU doesnt support profiling (yet).
|
11923 |
|
|
+ if { [istarget zip*] } {
|
11924 |
|
|
+ return 0
|
11925 |
102 |
dgisselq |
+ }
|
11926 |
|
|
+
|
11927 |
202 |
dgisselq |
# cygwin does not support -p.
|
11928 |
|
|
if { [istarget *-*-cygwin*] && $test_what == "-p" } {
|
11929 |
102 |
dgisselq |
return 0
|
11930 |
202 |
dgisselq |
@@ -1090,6 +1095,12 @@
|
11931 |
102 |
dgisselq |
}]
|
11932 |
|
|
}
|
11933 |
|
|
|
11934 |
202 |
dgisselq |
+ # No real hardware FPU support for ZipCPU yet --- even though the
|
11935 |
|
|
+ # instruction set supports it, the CPU just isn't ready (yet).
|
11936 |
|
|
+ if { [istarget zip*] } {
|
11937 |
102 |
dgisselq |
+ return 0
|
11938 |
|
|
+ }
|
11939 |
|
|
+
|
11940 |
|
|
# This proc is actually checking the availabilty of FPU
|
11941 |
|
|
# support for doubles, so on the RX we must fail if the
|
11942 |
|
|
# 64-bit double multilib has been selected.
|
11943 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/tree-ssa-math-opts.c gcc-6.2.0-zip/gcc/tree-ssa-math-opts.c
|
11944 |
|
|
--- gcc-6.2.0/gcc/tree-ssa-math-opts.c 2016-04-04 11:42:19.000000000 -0400
|
11945 |
|
|
+++ gcc-6.2.0-zip/gcc/tree-ssa-math-opts.c 2016-12-31 17:02:24.405602214 -0500
|
11946 |
|
|
@@ -983,7 +983,7 @@
|
11947 |
102 |
dgisselq |
{
|
11948 |
|
|
if (val & 1)
|
11949 |
|
|
{
|
11950 |
|
|
- digit = val & ((1 << POWI_WINDOW_SIZE) - 1);
|
11951 |
|
|
+ digit = val & ((1l << POWI_WINDOW_SIZE) - 1);
|
11952 |
|
|
result += powi_lookup_cost (digit, cache)
|
11953 |
|
|
+ POWI_WINDOW_SIZE + 1;
|
11954 |
|
|
val >>= POWI_WINDOW_SIZE;
|
11955 |
202 |
dgisselq |
@@ -1023,7 +1023,7 @@
|
11956 |
102 |
dgisselq |
}
|
11957 |
|
|
else if (n & 1)
|
11958 |
|
|
{
|
11959 |
|
|
- digit = n & ((1 << POWI_WINDOW_SIZE) - 1);
|
11960 |
|
|
+ digit = n & ((1l << POWI_WINDOW_SIZE) - 1);
|
11961 |
|
|
op0 = powi_as_mults_1 (gsi, loc, type, n - digit, cache);
|
11962 |
|
|
op1 = powi_as_mults_1 (gsi, loc, type, digit, cache);
|
11963 |
|
|
}
|
11964 |
202 |
dgisselq |
@@ -1957,7 +1957,7 @@
|
11965 |
102 |
dgisselq |
};
|
11966 |
|
|
|
11967 |
|
|
#define BITS_PER_MARKER 8
|
11968 |
|
|
-#define MARKER_MASK ((1 << BITS_PER_MARKER) - 1)
|
11969 |
|
|
+#define MARKER_MASK ((1l << BITS_PER_MARKER) - 1)
|
11970 |
|
|
#define MARKER_BYTE_UNKNOWN MARKER_MASK
|
11971 |
|
|
#define HEAD_MARKER(n, size) \
|
11972 |
|
|
((n) & ((uint64_t) MARKER_MASK << (((size) - 1) * BITS_PER_MARKER)))
|
11973 |
202 |
dgisselq |
@@ -1993,7 +1993,7 @@
|
11974 |
102 |
dgisselq |
/* Zero out the extra bits of N in order to avoid them being shifted
|
11975 |
|
|
into the significant bits. */
|
11976 |
|
|
if (size < 64 / BITS_PER_MARKER)
|
11977 |
|
|
- n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
|
11978 |
|
|
+ n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
|
11979 |
|
|
|
11980 |
|
|
switch (code)
|
11981 |
|
|
{
|
11982 |
202 |
dgisselq |
@@ -2020,7 +2020,7 @@
|
11983 |
102 |
dgisselq |
}
|
11984 |
|
|
/* Zero unused bits for size. */
|
11985 |
|
|
if (size < 64 / BITS_PER_MARKER)
|
11986 |
|
|
- n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
|
11987 |
|
|
+ n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
|
11988 |
|
|
return true;
|
11989 |
|
|
}
|
11990 |
|
|
|
11991 |
202 |
dgisselq |
@@ -2067,7 +2067,7 @@
|
11992 |
102 |
dgisselq |
n->n = CMPNOP;
|
11993 |
|
|
|
11994 |
|
|
if (size < 64 / BITS_PER_MARKER)
|
11995 |
|
|
- n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
|
11996 |
|
|
+ n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
|
11997 |
|
|
|
11998 |
|
|
return true;
|
11999 |
|
|
}
|
12000 |
202 |
dgisselq |
@@ -2372,7 +2372,7 @@
|
12001 |
102 |
dgisselq |
{
|
12002 |
|
|
/* If STMT casts to a smaller type mask out the bits not
|
12003 |
|
|
belonging to the target type. */
|
12004 |
|
|
- n->n &= ((uint64_t) 1 << (type_size * BITS_PER_MARKER)) - 1;
|
12005 |
|
|
+ n->n &= ((uint64_t) 1l << (type_size * BITS_PER_MARKER)) - 1;
|
12006 |
|
|
}
|
12007 |
|
|
n->type = type;
|
12008 |
|
|
if (!n->base_addr)
|
12009 |
202 |
dgisselq |
@@ -2489,7 +2489,7 @@
|
12010 |
102 |
dgisselq |
{
|
12011 |
|
|
uint64_t mask;
|
12012 |
|
|
|
12013 |
|
|
- mask = ((uint64_t) 1 << (n->range * BITS_PER_MARKER)) - 1;
|
12014 |
|
|
+ mask = ((uint64_t) 1l << (n->range * BITS_PER_MARKER)) - 1;
|
12015 |
|
|
cmpxchg >>= (64 / BITS_PER_MARKER - n->range) * BITS_PER_MARKER;
|
12016 |
|
|
cmpnop &= mask;
|
12017 |
|
|
}
|
12018 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/gcc/varasm.c gcc-6.2.0-zip/gcc/varasm.c
|
12019 |
|
|
--- gcc-6.2.0/gcc/varasm.c 2016-03-31 11:30:33.000000000 -0400
|
12020 |
|
|
+++ gcc-6.2.0-zip/gcc/varasm.c 2016-12-31 17:03:08.629193673 -0500
|
12021 |
|
|
@@ -2771,7 +2771,7 @@
|
12022 |
102 |
dgisselq |
|
12023 |
202 |
dgisselq |
/* Put out the first word with the specified alignment. */
|
12024 |
|
|
if (reverse)
|
12025 |
|
|
- elt = flip_storage_order (SImode, gen_int_mode (data[nelts - 1], SImode));
|
12026 |
|
|
+ elt = flip_storage_order (word_mode, gen_int_mode (data[nelts - 1], SImode));
|
12027 |
|
|
else
|
12028 |
|
|
elt = GEN_INT (data[0]);
|
12029 |
|
|
assemble_integer (elt, MIN (nunits, units_per), align, 1);
|
12030 |
|
|
@@ -2783,7 +2783,7 @@
|
12031 |
|
|
for (int i = 1; i < nelts; i++)
|
12032 |
|
|
{
|
12033 |
|
|
if (reverse)
|
12034 |
|
|
- elt = flip_storage_order (SImode,
|
12035 |
|
|
+ elt = flip_storage_order (word_mode,
|
12036 |
|
|
gen_int_mode (data[nelts - 1 - i], SImode));
|
12037 |
|
|
else
|
12038 |
|
|
elt = GEN_INT (data[i]);
|
12039 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/libgcc/config/zip/sfp-machine.h gcc-6.2.0-zip/libgcc/config/zip/sfp-machine.h
|
12040 |
|
|
--- gcc-6.2.0/libgcc/config/zip/sfp-machine.h 1969-12-31 19:00:00.000000000 -0500
|
12041 |
|
|
+++ gcc-6.2.0-zip/libgcc/config/zip/sfp-machine.h 2017-01-27 12:27:05.094921759 -0500
|
12042 |
|
|
@@ -0,0 +1,53 @@
|
12043 |
|
|
+#ifndef ZIP_SFP_MACHINE_H
|
12044 |
|
|
+#define ZIP_SFP_MACHINE_H
|
12045 |
|
|
+
|
12046 |
|
|
+#define __BIG_ENDIAN 4321
|
12047 |
|
|
+#define __BYTE_ORDER __BIG_ENDIAN
|
12048 |
|
|
+
|
12049 |
|
|
+#define _FP_W_TYPE_SIZE 32
|
12050 |
|
|
+#define _FP_W_TYPE unsigned int
|
12051 |
|
|
+#define _FP_WS_TYPE signed int
|
12052 |
|
|
+#define _FP_I_TYPE long
|
12053 |
|
|
+
|
12054 |
|
|
+#define _FP_MUL_MEAT_S(R,X,Y) _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
|
12055 |
|
|
+#define _FP_MUL_MEAT_D(R,X,Y) _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
|
12056 |
|
|
+
|
12057 |
|
|
+#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_loop(S,R,X,Y)
|
12058 |
|
|
+#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
|
12059 |
|
|
+
|
12060 |
|
|
+#define _FP_NANFRAC_S ((_FP_QNANBIT_S<<1)-1)
|
12061 |
|
|
+#define _FP_NANFRAC_D ((_FP_QNANBIT_D<<1)-1), -1
|
12062 |
|
|
+
|
12063 |
|
|
+#define _FP_QNANNEGATEDP 0
|
12064 |
|
|
+#define _FP_NANSIGN_S 0
|
12065 |
|
|
+#define _FP_NANSIGN_D 0
|
12066 |
|
|
+#define _FP_KEEPNANFRACP 1
|
12067 |
|
|
+
|
12068 |
|
|
+/* Someone please check this. --- copied from one of many other places */
|
12069 |
|
|
+#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
|
12070 |
|
|
+ do { \
|
12071 |
|
|
+ if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \
|
12072 |
|
|
+ && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \
|
12073 |
|
|
+ { \
|
12074 |
|
|
+ R##_s = Y##_s; \
|
12075 |
|
|
+ _FP_FRAC_COPY_##wc(R,Y); \
|
12076 |
|
|
+ } \
|
12077 |
|
|
+ else \
|
12078 |
|
|
+ { \
|
12079 |
|
|
+ R##_s = X##_s; \
|
12080 |
|
|
+ _FP_FRAC_COPY_##wc(R,X); \
|
12081 |
|
|
+ } \
|
12082 |
|
|
+ R##_c = FP_CLS_NAN; \
|
12083 |
|
|
+ } while (0)
|
12084 |
|
|
+
|
12085 |
|
|
+/* Not checked. */
|
12086 |
|
|
+#define _FP_TININESS_AFTER_ROUNDING 0
|
12087 |
|
|
+
|
12088 |
|
|
+#ifndef __BYTE_ORDER
|
12089 |
|
|
+#define __BYTE_ORDER __BIG_ENDIAN
|
12090 |
102 |
dgisselq |
+#endif
|
12091 |
202 |
dgisselq |
+
|
12092 |
|
|
+#define strong_alias(name, aliasname) _stong_alias(name, aliasname)
|
12093 |
|
|
+#define _strong_alias(name, aliasname) \
|
12094 |
|
|
+ extern __typeof(name) aliasname __attribute__ ((alias (#name)));
|
12095 |
|
|
+#endif
|
12096 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/libgcc/config.host gcc-6.2.0-zip/libgcc/config.host
|
12097 |
|
|
--- gcc-6.2.0/libgcc/config.host 2016-05-17 02:15:52.000000000 -0400
|
12098 |
|
|
+++ gcc-6.2.0-zip/libgcc/config.host 2017-01-27 12:28:31.470410459 -0500
|
12099 |
|
|
@@ -197,6 +197,9 @@
|
12100 |
102 |
dgisselq |
tic6x-*-*)
|
12101 |
|
|
cpu_type=c6x
|
12102 |
|
|
;;
|
12103 |
|
|
+zip*)
|
12104 |
|
|
+ cpu_type=zip
|
12105 |
|
|
+ ;;
|
12106 |
|
|
esac
|
12107 |
|
|
|
12108 |
|
|
# Common parts for widely ported systems.
|
12109 |
202 |
dgisselq |
@@ -1328,6 +1331,10 @@
|
12110 |
200 |
dgisselq |
tmake_file="$tmake_file nvptx/t-nvptx"
|
12111 |
|
|
extra_parts="crt0.o"
|
12112 |
102 |
dgisselq |
;;
|
12113 |
|
|
+zip*)
|
12114 |
202 |
dgisselq |
+ tmake_file="$tmake_file t-softfp-sfdf t-softfp-excl t-softfp"
|
12115 |
|
|
+ # extra_parts="crt0.o"
|
12116 |
102 |
dgisselq |
+ ;;
|
12117 |
200 |
dgisselq |
*)
|
12118 |
|
|
echo "*** Configuration ${host} not supported" 1>&2
|
12119 |
|
|
exit 1
|
12120 |
202 |
dgisselq |
diff -Naur '--exclude=*.swp' gcc-6.2.0/libgcc/configure gcc-6.2.0-zip/libgcc/configure
|
12121 |
|
|
--- gcc-6.2.0/libgcc/configure 2016-04-11 15:45:35.000000000 -0400
|
12122 |
|
|
+++ gcc-6.2.0-zip/libgcc/configure 2017-01-27 15:53:43.141531475 -0500
|
12123 |
|
|
@@ -3805,13 +3805,13 @@
|
12124 |
|
|
CFLAGS=$ac_save_CFLAGS
|
12125 |
|
|
elif test $ac_cv_prog_cc_g = yes; then
|
12126 |
|
|
if test "$GCC" = yes; then
|
12127 |
|
|
- CFLAGS="-g -O2"
|
12128 |
|
|
+ CFLAGS="-O3"
|
12129 |
|
|
else
|
12130 |
|
|
CFLAGS="-g"
|
12131 |
|
|
fi
|
12132 |
|
|
else
|
12133 |
|
|
if test "$GCC" = yes; then
|
12134 |
|
|
- CFLAGS="-O2"
|
12135 |
|
|
+ CFLAGS="-O3"
|
12136 |
|
|
else
|
12137 |
|
|
CFLAGS=
|
12138 |
|
|
fi
|
12139 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/libgcc/Makefile.in gcc-6.2.0-zip/libgcc/Makefile.in
|
12140 |
|
|
--- gcc-6.2.0/libgcc/Makefile.in 2016-02-25 07:23:52.000000000 -0500
|
12141 |
|
|
+++ gcc-6.2.0-zip/libgcc/Makefile.in 2017-01-27 15:54:32.241240828 -0500
|
12142 |
|
|
@@ -229,8 +229,8 @@
|
12143 |
102 |
dgisselq |
|
12144 |
202 |
dgisselq |
# Options to use when compiling libgcc2.a.
|
12145 |
|
|
#
|
12146 |
|
|
-LIBGCC2_DEBUG_CFLAGS = -g
|
12147 |
|
|
-LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
|
12148 |
|
|
+LIBGCC2_DEBUG_CFLAGS =
|
12149 |
|
|
+LIBGCC2_CFLAGS = -O3 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
|
12150 |
|
|
$(LIBGCC2_DEBUG_CFLAGS) -DIN_LIBGCC2 \
|
12151 |
|
|
-fbuilding-libgcc -fno-stack-protector \
|
12152 |
|
|
$(INHIBIT_LIBC_CFLAGS)
|
12153 |
|
|
@@ -284,7 +284,7 @@
|
12154 |
|
|
$(INCLUDES) @set_have_cc_tls@ @set_use_emutls@
|
12155 |
|
|
|
12156 |
|
|
# Options to use when compiling crtbegin/end.
|
12157 |
|
|
-CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
|
12158 |
|
|
+CRTSTUFF_CFLAGS = -O3 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
|
12159 |
|
|
$(NO_PIE_CFLAGS) -finhibit-size-directive -fno-inline -fno-exceptions \
|
12160 |
|
|
-fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
|
12161 |
|
|
-fbuilding-libgcc -fno-stack-protector $(FORCE_EXPLICIT_EH_REGISTRY) \
|
12162 |
|
|
diff -Naur '--exclude=*.swp' gcc-6.2.0/libgomp/configure.tgt gcc-6.2.0-zip/libgomp/configure.tgt
|
12163 |
|
|
--- gcc-6.2.0/libgomp/configure.tgt 2015-09-03 12:20:35.000000000 -0400
|
12164 |
|
|
+++ gcc-6.2.0-zip/libgomp/configure.tgt 2016-12-31 17:06:26.795473062 -0500
|
12165 |
|
|
@@ -161,6 +161,9 @@
|
12166 |
|
|
config_path="rtems posix"
|
12167 |
|
|
fi
|
12168 |
102 |
dgisselq |
;;
|
12169 |
|
|
+ zip*)
|
12170 |
202 |
dgisselq |
+ config_path="bsd posix"
|
12171 |
|
|
+ ;;
|
12172 |
102 |
dgisselq |
|
12173 |
|
|
*)
|
12174 |
|
|
;;
|