1 |
709 |
jeremybenn |
/* Definitions of target machine for GNU compiler, Renesas M32R cpu.
|
2 |
|
|
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
3 |
|
|
2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
4 |
|
|
|
5 |
|
|
This file is part of GCC.
|
6 |
|
|
|
7 |
|
|
GCC is free software; you can redistribute it and/or modify it
|
8 |
|
|
under the terms of the GNU General Public License as published
|
9 |
|
|
by the Free Software Foundation; either version 3, or (at your
|
10 |
|
|
option) any later version.
|
11 |
|
|
|
12 |
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT
|
13 |
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
14 |
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
15 |
|
|
License for more details.
|
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License
|
18 |
|
|
along with GCC; see the file COPYING3. If not see
|
19 |
|
|
<http://www.gnu.org/licenses/>. */
|
20 |
|
|
|
21 |
|
|
/* Things to do:
|
22 |
|
|
- longlong.h?
|
23 |
|
|
*/
|
24 |
|
|
|
25 |
|
|
#undef SIZE_TYPE
|
26 |
|
|
#undef PTRDIFF_TYPE
|
27 |
|
|
#undef WCHAR_TYPE
|
28 |
|
|
#undef WCHAR_TYPE_SIZE
|
29 |
|
|
#undef CPP_SPEC
|
30 |
|
|
#undef ASM_SPEC
|
31 |
|
|
#undef LINK_SPEC
|
32 |
|
|
#undef STARTFILE_SPEC
|
33 |
|
|
#undef ENDFILE_SPEC
|
34 |
|
|
|
35 |
|
|
#undef ASM_APP_ON
|
36 |
|
|
#undef ASM_APP_OFF
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
/* M32R/X overrides. */
|
40 |
|
|
|
41 |
|
|
/* Additional flags for the preprocessor. */
|
42 |
|
|
#define CPP_CPU_SPEC "%{m32rx:-D__M32RX__ -D__m32rx__ -U__M32R2__ -U__m32r2__} \
|
43 |
|
|
%{m32r2:-D__M32R2__ -D__m32r2__ -U__M32RX__ -U__m32rx__} \
|
44 |
|
|
%{m32r:-U__M32RX__ -U__m32rx__ -U__M32R2__ -U__m32r2__} \
|
45 |
|
|
"
|
46 |
|
|
|
47 |
|
|
/* Assembler switches. */
|
48 |
|
|
#define ASM_CPU_SPEC \
|
49 |
|
|
"%{m32r} %{m32rx} %{m32r2} %{!O0: %{O*: -O}} --no-warn-explicit-parallel-conflicts"
|
50 |
|
|
|
51 |
|
|
/* Use m32rx specific crt0/crtinit/crtfini files. */
|
52 |
|
|
#define STARTFILE_CPU_SPEC "%{!shared:crt0.o%s} %{m32rx:m32rx/crtinit.o%s} %{!m32rx:crtinit.o%s}"
|
53 |
|
|
#define ENDFILE_CPU_SPEC "-lgloss %{m32rx:m32rx/crtfini.o%s} %{!m32rx:crtfini.o%s}"
|
54 |
|
|
|
55 |
|
|
/* Define this macro as a C expression for the initializer of an array of
|
56 |
|
|
strings to tell the driver program which options are defaults for this
|
57 |
|
|
target and thus do not need to be handled specially when using
|
58 |
|
|
`MULTILIB_OPTIONS'. */
|
59 |
|
|
#define SUBTARGET_MULTILIB_DEFAULTS , "m32r"
|
60 |
|
|
|
61 |
|
|
/* Number of additional registers the subtarget defines. */
|
62 |
|
|
#define SUBTARGET_NUM_REGISTERS 1
|
63 |
|
|
|
64 |
|
|
/* 1 for registers that cannot be allocated. */
|
65 |
|
|
#define SUBTARGET_FIXED_REGISTERS , 1
|
66 |
|
|
|
67 |
|
|
/* 1 for registers that are not available across function calls. */
|
68 |
|
|
#define SUBTARGET_CALL_USED_REGISTERS , 1
|
69 |
|
|
|
70 |
|
|
/* Order to allocate model specific registers. */
|
71 |
|
|
#define SUBTARGET_REG_ALLOC_ORDER , 19
|
72 |
|
|
|
73 |
|
|
/* Registers which are accumulators. */
|
74 |
|
|
#define SUBTARGET_REG_CLASS_ACCUM 0x80000
|
75 |
|
|
|
76 |
|
|
/* All registers added. */
|
77 |
|
|
#define SUBTARGET_REG_CLASS_ALL SUBTARGET_REG_CLASS_ACCUM
|
78 |
|
|
|
79 |
|
|
/* Additional accumulator registers. */
|
80 |
|
|
#define SUBTARGET_ACCUM_P(REGNO) ((REGNO) == 19)
|
81 |
|
|
|
82 |
|
|
/* Define additional register names. */
|
83 |
|
|
#define SUBTARGET_REGISTER_NAMES , "a1"
|
84 |
|
|
/* end M32R/X overrides. */
|
85 |
|
|
|
86 |
|
|
/* Names to predefine in the preprocessor for this target machine. */
|
87 |
|
|
/* __M32R__ is defined by the existing compiler so we use that. */
|
88 |
|
|
#define TARGET_CPU_CPP_BUILTINS() \
|
89 |
|
|
do \
|
90 |
|
|
{ \
|
91 |
|
|
builtin_define ("__M32R__"); \
|
92 |
|
|
builtin_define ("__m32r__"); \
|
93 |
|
|
builtin_assert ("cpu=m32r"); \
|
94 |
|
|
builtin_assert ("machine=m32r"); \
|
95 |
|
|
builtin_define (TARGET_BIG_ENDIAN \
|
96 |
|
|
? "__BIG_ENDIAN__" : "__LITTLE_ENDIAN__"); \
|
97 |
|
|
} \
|
98 |
|
|
while (0)
|
99 |
|
|
|
100 |
|
|
/* This macro defines names of additional specifications to put in the specs
|
101 |
|
|
that can be used in various specifications like CC1_SPEC. Its definition
|
102 |
|
|
is an initializer with a subgrouping for each command option.
|
103 |
|
|
|
104 |
|
|
Each subgrouping contains a string constant, that defines the
|
105 |
|
|
specification name, and a string constant that used by the GCC driver
|
106 |
|
|
program.
|
107 |
|
|
|
108 |
|
|
Do not define this macro if it does not need to do anything. */
|
109 |
|
|
|
110 |
|
|
#ifndef SUBTARGET_EXTRA_SPECS
|
111 |
|
|
#define SUBTARGET_EXTRA_SPECS
|
112 |
|
|
#endif
|
113 |
|
|
|
114 |
|
|
#ifndef ASM_CPU_SPEC
|
115 |
|
|
#define ASM_CPU_SPEC ""
|
116 |
|
|
#endif
|
117 |
|
|
|
118 |
|
|
#ifndef CPP_CPU_SPEC
|
119 |
|
|
#define CPP_CPU_SPEC ""
|
120 |
|
|
#endif
|
121 |
|
|
|
122 |
|
|
#ifndef CC1_CPU_SPEC
|
123 |
|
|
#define CC1_CPU_SPEC ""
|
124 |
|
|
#endif
|
125 |
|
|
|
126 |
|
|
#ifndef LINK_CPU_SPEC
|
127 |
|
|
#define LINK_CPU_SPEC ""
|
128 |
|
|
#endif
|
129 |
|
|
|
130 |
|
|
#ifndef STARTFILE_CPU_SPEC
|
131 |
|
|
#define STARTFILE_CPU_SPEC "%{!shared:crt0.o%s} crtinit.o%s"
|
132 |
|
|
#endif
|
133 |
|
|
|
134 |
|
|
#ifndef ENDFILE_CPU_SPEC
|
135 |
|
|
#define ENDFILE_CPU_SPEC "-lgloss crtfini.o%s"
|
136 |
|
|
#endif
|
137 |
|
|
|
138 |
|
|
#ifndef RELAX_SPEC
|
139 |
|
|
#if 0 /* Not supported yet. */
|
140 |
|
|
#define RELAX_SPEC "%{mrelax:-relax}"
|
141 |
|
|
#else
|
142 |
|
|
#define RELAX_SPEC ""
|
143 |
|
|
#endif
|
144 |
|
|
#endif
|
145 |
|
|
|
146 |
|
|
#define EXTRA_SPECS \
|
147 |
|
|
{ "asm_cpu", ASM_CPU_SPEC }, \
|
148 |
|
|
{ "cpp_cpu", CPP_CPU_SPEC }, \
|
149 |
|
|
{ "cc1_cpu", CC1_CPU_SPEC }, \
|
150 |
|
|
{ "link_cpu", LINK_CPU_SPEC }, \
|
151 |
|
|
{ "startfile_cpu", STARTFILE_CPU_SPEC }, \
|
152 |
|
|
{ "endfile_cpu", ENDFILE_CPU_SPEC }, \
|
153 |
|
|
{ "relax", RELAX_SPEC }, \
|
154 |
|
|
SUBTARGET_EXTRA_SPECS
|
155 |
|
|
|
156 |
|
|
#define CPP_SPEC "%(cpp_cpu)"
|
157 |
|
|
|
158 |
|
|
#undef CC1_SPEC
|
159 |
|
|
#define CC1_SPEC "%{G*} %(cc1_cpu)"
|
160 |
|
|
|
161 |
|
|
/* Options to pass on to the assembler. */
|
162 |
|
|
#undef ASM_SPEC
|
163 |
|
|
#define ASM_SPEC "%(asm_cpu) %(relax) %{fpic|fpie:-K PIC} %{fPIC|fPIE:-K PIC}"
|
164 |
|
|
|
165 |
|
|
#define LINK_SPEC "%{v} %(link_cpu) %(relax)"
|
166 |
|
|
|
167 |
|
|
#undef STARTFILE_SPEC
|
168 |
|
|
#define STARTFILE_SPEC "%(startfile_cpu)"
|
169 |
|
|
|
170 |
|
|
#undef ENDFILE_SPEC
|
171 |
|
|
#define ENDFILE_SPEC "%(endfile_cpu)"
|
172 |
|
|
|
173 |
|
|
#undef LIB_SPEC
|
174 |
|
|
|
175 |
|
|
/* Run-time compilation parameters selecting different hardware subsets. */
|
176 |
|
|
|
177 |
|
|
#define TARGET_M32R (! TARGET_M32RX && ! TARGET_M32R2)
|
178 |
|
|
|
179 |
|
|
#ifndef TARGET_LITTLE_ENDIAN
|
180 |
|
|
#define TARGET_LITTLE_ENDIAN 0
|
181 |
|
|
#endif
|
182 |
|
|
#define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
|
183 |
|
|
|
184 |
|
|
/* This defaults us to m32r. */
|
185 |
|
|
#ifndef TARGET_CPU_DEFAULT
|
186 |
|
|
#define TARGET_CPU_DEFAULT 0
|
187 |
|
|
#endif
|
188 |
|
|
|
189 |
|
|
#ifndef M32R_OPTS_H
|
190 |
|
|
#include "config/m32r/m32r-opts.h"
|
191 |
|
|
#endif
|
192 |
|
|
|
193 |
|
|
/* Define this macro as a C expression for the initializer of an array of
|
194 |
|
|
strings to tell the driver program which options are defaults for this
|
195 |
|
|
target and thus do not need to be handled specially when using
|
196 |
|
|
`MULTILIB_OPTIONS'. */
|
197 |
|
|
#ifndef SUBTARGET_MULTILIB_DEFAULTS
|
198 |
|
|
#define SUBTARGET_MULTILIB_DEFAULTS
|
199 |
|
|
#endif
|
200 |
|
|
|
201 |
|
|
#ifndef MULTILIB_DEFAULTS
|
202 |
|
|
#define MULTILIB_DEFAULTS { "mmodel=small" SUBTARGET_MULTILIB_DEFAULTS }
|
203 |
|
|
#endif
|
204 |
|
|
|
205 |
|
|
#ifndef SUBTARGET_OVERRIDE_OPTIONS
|
206 |
|
|
#define SUBTARGET_OVERRIDE_OPTIONS
|
207 |
|
|
#endif
|
208 |
|
|
|
209 |
|
|
/* Target machine storage layout. */
|
210 |
|
|
|
211 |
|
|
/* Define this if most significant bit is lowest numbered
|
212 |
|
|
in instructions that operate on numbered bit-fields. */
|
213 |
|
|
#define BITS_BIG_ENDIAN 1
|
214 |
|
|
|
215 |
|
|
/* Define this if most significant byte of a word is the lowest numbered. */
|
216 |
|
|
#define BYTES_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0)
|
217 |
|
|
|
218 |
|
|
/* Define this if most significant word of a multiword number is the lowest
|
219 |
|
|
numbered. */
|
220 |
|
|
#define WORDS_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0)
|
221 |
|
|
|
222 |
|
|
/* Width of a word, in units (bytes). */
|
223 |
|
|
#define UNITS_PER_WORD 4
|
224 |
|
|
|
225 |
|
|
/* Define this macro if it is advisable to hold scalars in registers
|
226 |
|
|
in a wider mode than that declared by the program. In such cases,
|
227 |
|
|
the value is constrained to be within the bounds of the declared
|
228 |
|
|
type, but kept valid in the wider mode. The signedness of the
|
229 |
|
|
extension may differ from that of the type. */
|
230 |
|
|
#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
|
231 |
|
|
if (GET_MODE_CLASS (MODE) == MODE_INT \
|
232 |
|
|
&& GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
|
233 |
|
|
{ \
|
234 |
|
|
(MODE) = SImode; \
|
235 |
|
|
}
|
236 |
|
|
|
237 |
|
|
/* Allocation boundary (in *bits*) for storing arguments in argument list. */
|
238 |
|
|
#define PARM_BOUNDARY 32
|
239 |
|
|
|
240 |
|
|
/* Boundary (in *bits*) on which stack pointer should be aligned. */
|
241 |
|
|
#define STACK_BOUNDARY 32
|
242 |
|
|
|
243 |
|
|
/* ALIGN FRAMES on word boundaries */
|
244 |
|
|
#define M32R_STACK_ALIGN(LOC) (((LOC) + 3) & ~ 3)
|
245 |
|
|
|
246 |
|
|
/* Allocation boundary (in *bits*) for the code of a function. */
|
247 |
|
|
#define FUNCTION_BOUNDARY 32
|
248 |
|
|
|
249 |
|
|
/* Alignment of field after `int : 0' in a structure. */
|
250 |
|
|
#define EMPTY_FIELD_BOUNDARY 32
|
251 |
|
|
|
252 |
|
|
/* Every structure's size must be a multiple of this. */
|
253 |
|
|
#define STRUCTURE_SIZE_BOUNDARY 8
|
254 |
|
|
|
255 |
|
|
/* A bit-field declared as `int' forces `int' alignment for the struct. */
|
256 |
|
|
#define PCC_BITFIELD_TYPE_MATTERS 1
|
257 |
|
|
|
258 |
|
|
/* No data type wants to be aligned rounder than this. */
|
259 |
|
|
#define BIGGEST_ALIGNMENT 32
|
260 |
|
|
|
261 |
|
|
/* The best alignment to use in cases where we have a choice. */
|
262 |
|
|
#define FASTEST_ALIGNMENT 32
|
263 |
|
|
|
264 |
|
|
/* Make strings word-aligned so strcpy from constants will be faster. */
|
265 |
|
|
#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
|
266 |
|
|
((TREE_CODE (EXP) == STRING_CST \
|
267 |
|
|
&& (ALIGN) < FASTEST_ALIGNMENT) \
|
268 |
|
|
? FASTEST_ALIGNMENT : (ALIGN))
|
269 |
|
|
|
270 |
|
|
/* Make arrays of chars word-aligned for the same reasons. */
|
271 |
|
|
#define DATA_ALIGNMENT(TYPE, ALIGN) \
|
272 |
|
|
(TREE_CODE (TYPE) == ARRAY_TYPE \
|
273 |
|
|
&& TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
|
274 |
|
|
&& (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
|
275 |
|
|
|
276 |
|
|
/* Set this nonzero if move instructions will actually fail to work
|
277 |
|
|
when given unaligned data. */
|
278 |
|
|
#define STRICT_ALIGNMENT 1
|
279 |
|
|
|
280 |
|
|
/* Define LAVEL_ALIGN to calculate code length of PNOP at labels. */
|
281 |
|
|
#define LABEL_ALIGN(insn) 2
|
282 |
|
|
|
283 |
|
|
/* Layout of source language data types. */
|
284 |
|
|
|
285 |
|
|
#define SHORT_TYPE_SIZE 16
|
286 |
|
|
#define INT_TYPE_SIZE 32
|
287 |
|
|
#define LONG_TYPE_SIZE 32
|
288 |
|
|
#define LONG_LONG_TYPE_SIZE 64
|
289 |
|
|
#define FLOAT_TYPE_SIZE 32
|
290 |
|
|
#define DOUBLE_TYPE_SIZE 64
|
291 |
|
|
#define LONG_DOUBLE_TYPE_SIZE 64
|
292 |
|
|
|
293 |
|
|
/* Define this as 1 if `char' should by default be signed; else as 0. */
|
294 |
|
|
#define DEFAULT_SIGNED_CHAR 1
|
295 |
|
|
|
296 |
|
|
#define SIZE_TYPE "long unsigned int"
|
297 |
|
|
#define PTRDIFF_TYPE "long int"
|
298 |
|
|
#define WCHAR_TYPE "short unsigned int"
|
299 |
|
|
#define WCHAR_TYPE_SIZE 16
|
300 |
|
|
|
301 |
|
|
/* Standard register usage. */
|
302 |
|
|
|
303 |
|
|
/* Number of actual hardware registers.
|
304 |
|
|
The hardware registers are assigned numbers for the compiler
|
305 |
|
|
from 0 to just below FIRST_PSEUDO_REGISTER.
|
306 |
|
|
All registers that the compiler knows about must be given numbers,
|
307 |
|
|
even those that are not normally considered general registers. */
|
308 |
|
|
|
309 |
|
|
#define M32R_NUM_REGISTERS 19
|
310 |
|
|
|
311 |
|
|
#ifndef SUBTARGET_NUM_REGISTERS
|
312 |
|
|
#define SUBTARGET_NUM_REGISTERS 0
|
313 |
|
|
#endif
|
314 |
|
|
|
315 |
|
|
#define FIRST_PSEUDO_REGISTER (M32R_NUM_REGISTERS + SUBTARGET_NUM_REGISTERS)
|
316 |
|
|
|
317 |
|
|
/* 1 for registers that have pervasive standard uses
|
318 |
|
|
and are not available for the register allocator.
|
319 |
|
|
|
320 |
|
|
0-3 - arguments/results
|
321 |
|
|
4-5 - call used [4 is used as a tmp during prologue/epilogue generation]
|
322 |
|
|
6 - call used, gptmp
|
323 |
|
|
7 - call used, static chain pointer
|
324 |
|
|
8-11 - call saved
|
325 |
|
|
12 - call saved [reserved for global pointer]
|
326 |
|
|
13 - frame pointer
|
327 |
|
|
14 - subroutine link register
|
328 |
|
|
15 - stack pointer
|
329 |
|
|
16 - arg pointer
|
330 |
|
|
17 - carry flag
|
331 |
|
|
18 - accumulator
|
332 |
|
|
19 - accumulator 1 in the m32r/x
|
333 |
|
|
By default, the extension registers are not available. */
|
334 |
|
|
|
335 |
|
|
#ifndef SUBTARGET_FIXED_REGISTERS
|
336 |
|
|
#define SUBTARGET_FIXED_REGISTERS
|
337 |
|
|
#endif
|
338 |
|
|
|
339 |
|
|
#define FIXED_REGISTERS \
|
340 |
|
|
{ \
|
341 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, \
|
342 |
|
|
0, 0, 0, 0, 0, 0, 0, 1, \
|
343 |
|
|
1, 1, 1 \
|
344 |
|
|
SUBTARGET_FIXED_REGISTERS \
|
345 |
|
|
}
|
346 |
|
|
|
347 |
|
|
/* 1 for registers not available across function calls.
|
348 |
|
|
These must include the FIXED_REGISTERS and also any
|
349 |
|
|
registers that can be used without being saved.
|
350 |
|
|
The latter must include the registers where values are returned
|
351 |
|
|
and the register where structure-value addresses are passed.
|
352 |
|
|
Aside from that, you can include as many other registers as you like. */
|
353 |
|
|
|
354 |
|
|
#ifndef SUBTARGET_CALL_USED_REGISTERS
|
355 |
|
|
#define SUBTARGET_CALL_USED_REGISTERS
|
356 |
|
|
#endif
|
357 |
|
|
|
358 |
|
|
#define CALL_USED_REGISTERS \
|
359 |
|
|
{ \
|
360 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, \
|
361 |
|
|
0, 0, 0, 0, 0, 0, 1, 1, \
|
362 |
|
|
1, 1, 1 \
|
363 |
|
|
SUBTARGET_CALL_USED_REGISTERS \
|
364 |
|
|
}
|
365 |
|
|
|
366 |
|
|
#define CALL_REALLY_USED_REGISTERS CALL_USED_REGISTERS
|
367 |
|
|
|
368 |
|
|
/* If defined, an initializer for a vector of integers, containing the
|
369 |
|
|
numbers of hard registers in the order in which GCC should
|
370 |
|
|
prefer to use them (from most preferred to least). */
|
371 |
|
|
|
372 |
|
|
#ifndef SUBTARGET_REG_ALLOC_ORDER
|
373 |
|
|
#define SUBTARGET_REG_ALLOC_ORDER
|
374 |
|
|
#endif
|
375 |
|
|
|
376 |
|
|
#if 1 /* Better for int code. */
|
377 |
|
|
#define REG_ALLOC_ORDER \
|
378 |
|
|
{ \
|
379 |
|
|
4, 5, 6, 7, 2, 3, 8, 9, 10, \
|
380 |
|
|
11, 12, 13, 14, 0, 1, 15, 16, 17, 18 \
|
381 |
|
|
SUBTARGET_REG_ALLOC_ORDER \
|
382 |
|
|
}
|
383 |
|
|
|
384 |
|
|
#else /* Better for fp code at expense of int code. */
|
385 |
|
|
#define REG_ALLOC_ORDER \
|
386 |
|
|
{ \
|
387 |
|
|
0, 1, 2, 3, 4, 5, 6, 7, 8, \
|
388 |
|
|
9, 10, 11, 12, 13, 14, 15, 16, 17, 18 \
|
389 |
|
|
SUBTARGET_REG_ALLOC_ORDER \
|
390 |
|
|
}
|
391 |
|
|
#endif
|
392 |
|
|
|
393 |
|
|
/* Return number of consecutive hard regs needed starting at reg REGNO
|
394 |
|
|
to hold something of mode MODE.
|
395 |
|
|
This is ordinarily the length in words of a value of mode MODE
|
396 |
|
|
but can be less for certain modes in special long registers. */
|
397 |
|
|
#define HARD_REGNO_NREGS(REGNO, MODE) \
|
398 |
|
|
((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
|
399 |
|
|
|
400 |
|
|
/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
|
401 |
|
|
extern const unsigned int m32r_hard_regno_mode_ok[FIRST_PSEUDO_REGISTER];
|
402 |
|
|
extern unsigned int m32r_mode_class[];
|
403 |
|
|
#define HARD_REGNO_MODE_OK(REGNO, MODE) \
|
404 |
|
|
((m32r_hard_regno_mode_ok[REGNO] & m32r_mode_class[MODE]) != 0)
|
405 |
|
|
|
406 |
|
|
/* A C expression that is nonzero if it is desirable to choose
|
407 |
|
|
register allocation so as to avoid move instructions between a
|
408 |
|
|
value of mode MODE1 and a value of mode MODE2.
|
409 |
|
|
|
410 |
|
|
If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
|
411 |
|
|
MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1,
|
412 |
|
|
MODE2)' must be zero. */
|
413 |
|
|
|
414 |
|
|
/* Tie QI/HI/SI modes together. */
|
415 |
|
|
#define MODES_TIEABLE_P(MODE1, MODE2) \
|
416 |
|
|
( GET_MODE_CLASS (MODE1) == MODE_INT \
|
417 |
|
|
&& GET_MODE_CLASS (MODE2) == MODE_INT \
|
418 |
|
|
&& GET_MODE_SIZE (MODE1) <= UNITS_PER_WORD \
|
419 |
|
|
&& GET_MODE_SIZE (MODE2) <= UNITS_PER_WORD)
|
420 |
|
|
|
421 |
|
|
#define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \
|
422 |
|
|
m32r_hard_regno_rename_ok (OLD_REG, NEW_REG)
|
423 |
|
|
|
424 |
|
|
/* Register classes and constants. */
|
425 |
|
|
|
426 |
|
|
/* Define the classes of registers for register constraints in the
|
427 |
|
|
machine description. Also define ranges of constants.
|
428 |
|
|
|
429 |
|
|
One of the classes must always be named ALL_REGS and include all hard regs.
|
430 |
|
|
If there is more than one class, another class must be named NO_REGS
|
431 |
|
|
and contain no registers.
|
432 |
|
|
|
433 |
|
|
The name GENERAL_REGS must be the name of a class (or an alias for
|
434 |
|
|
another name such as ALL_REGS). This is the class of registers
|
435 |
|
|
that is allowed by "g" or "r" in a register constraint.
|
436 |
|
|
Also, registers outside this class are allocated only when
|
437 |
|
|
instructions express preferences for them.
|
438 |
|
|
|
439 |
|
|
The classes must be numbered in nondecreasing order; that is,
|
440 |
|
|
a larger-numbered class must never be contained completely
|
441 |
|
|
in a smaller-numbered class.
|
442 |
|
|
|
443 |
|
|
For any two classes, it is very desirable that there be another
|
444 |
|
|
class that represents their union.
|
445 |
|
|
|
446 |
|
|
It is important that any condition codes have class NO_REGS.
|
447 |
|
|
See `register_operand'. */
|
448 |
|
|
|
449 |
|
|
enum reg_class
|
450 |
|
|
{
|
451 |
|
|
NO_REGS, CARRY_REG, ACCUM_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES
|
452 |
|
|
};
|
453 |
|
|
|
454 |
|
|
#define N_REG_CLASSES ((int) LIM_REG_CLASSES)
|
455 |
|
|
|
456 |
|
|
/* Give names of register classes as strings for dump file. */
|
457 |
|
|
#define REG_CLASS_NAMES \
|
458 |
|
|
{ "NO_REGS", "CARRY_REG", "ACCUM_REGS", "GENERAL_REGS", "ALL_REGS" }
|
459 |
|
|
|
460 |
|
|
/* Define which registers fit in which classes.
|
461 |
|
|
This is an initializer for a vector of HARD_REG_SET
|
462 |
|
|
of length N_REG_CLASSES. */
|
463 |
|
|
|
464 |
|
|
#ifndef SUBTARGET_REG_CLASS_CARRY
|
465 |
|
|
#define SUBTARGET_REG_CLASS_CARRY 0
|
466 |
|
|
#endif
|
467 |
|
|
|
468 |
|
|
#ifndef SUBTARGET_REG_CLASS_ACCUM
|
469 |
|
|
#define SUBTARGET_REG_CLASS_ACCUM 0
|
470 |
|
|
#endif
|
471 |
|
|
|
472 |
|
|
#ifndef SUBTARGET_REG_CLASS_GENERAL
|
473 |
|
|
#define SUBTARGET_REG_CLASS_GENERAL 0
|
474 |
|
|
#endif
|
475 |
|
|
|
476 |
|
|
#ifndef SUBTARGET_REG_CLASS_ALL
|
477 |
|
|
#define SUBTARGET_REG_CLASS_ALL 0
|
478 |
|
|
#endif
|
479 |
|
|
|
480 |
|
|
#define REG_CLASS_CONTENTS \
|
481 |
|
|
{ \
|
482 |
|
|
{ 0x00000 }, \
|
483 |
|
|
{ 0x20000 | SUBTARGET_REG_CLASS_CARRY }, \
|
484 |
|
|
{ 0x40000 | SUBTARGET_REG_CLASS_ACCUM }, \
|
485 |
|
|
{ 0x1ffff | SUBTARGET_REG_CLASS_GENERAL }, \
|
486 |
|
|
{ 0x7ffff | SUBTARGET_REG_CLASS_ALL }, \
|
487 |
|
|
}
|
488 |
|
|
|
489 |
|
|
/* The same information, inverted:
|
490 |
|
|
Return the class number of the smallest class containing
|
491 |
|
|
reg number REGNO. This could be a conditional expression
|
492 |
|
|
or could index an array. */
|
493 |
|
|
extern enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER];
|
494 |
|
|
#define REGNO_REG_CLASS(REGNO) (m32r_regno_reg_class[REGNO])
|
495 |
|
|
|
496 |
|
|
/* The class value for index registers, and the one for base regs. */
|
497 |
|
|
#define INDEX_REG_CLASS GENERAL_REGS
|
498 |
|
|
#define BASE_REG_CLASS GENERAL_REGS
|
499 |
|
|
|
500 |
|
|
/* These assume that REGNO is a hard or pseudo reg number.
|
501 |
|
|
They give nonzero only if REGNO is a hard reg of the suitable class
|
502 |
|
|
or a pseudo reg currently allocated to a suitable hard reg.
|
503 |
|
|
Since they use reg_renumber, they are safe only once reg_renumber
|
504 |
|
|
has been allocated, which happens in local-alloc.c. */
|
505 |
|
|
#define REGNO_OK_FOR_BASE_P(REGNO) \
|
506 |
|
|
((REGNO) < FIRST_PSEUDO_REGISTER \
|
507 |
|
|
? GPR_P (REGNO) || (REGNO) == ARG_POINTER_REGNUM \
|
508 |
|
|
: GPR_P (reg_renumber[REGNO]))
|
509 |
|
|
|
510 |
|
|
#define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_BASE_P(REGNO)
|
511 |
|
|
|
512 |
|
|
/* Return true if a value is inside a range. */
|
513 |
|
|
#define IN_RANGE_P(VALUE, LOW, HIGH) \
|
514 |
|
|
(((unsigned HOST_WIDE_INT)((VALUE) - (LOW))) \
|
515 |
|
|
<= ((unsigned HOST_WIDE_INT)((HIGH) - (LOW))))
|
516 |
|
|
|
517 |
|
|
/* Some range macros. */
|
518 |
|
|
#define INT16_P(X) ((X) >= - 0x8000 && (X) <= 0x7fff)
|
519 |
|
|
#define CMP_INT16_P(X) ((X) >= - 0x7fff && (X) <= 0x8000)
|
520 |
|
|
#define UINT16_P(X) (((unsigned HOST_WIDE_INT) (X)) <= 0x0000ffff)
|
521 |
|
|
#define UINT24_P(X) (((unsigned HOST_WIDE_INT) (X)) <= 0x00ffffff)
|
522 |
|
|
|
523 |
|
|
/* Stack layout and stack pointer usage. */
|
524 |
|
|
|
525 |
|
|
/* Define this macro if pushing a word onto the stack moves the stack
|
526 |
|
|
pointer to a smaller address. */
|
527 |
|
|
#define STACK_GROWS_DOWNWARD
|
528 |
|
|
|
529 |
|
|
/* Offset from frame pointer to start allocating local variables at.
|
530 |
|
|
If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
|
531 |
|
|
first local allocated. Otherwise, it is the offset to the BEGINNING
|
532 |
|
|
of the first local allocated. */
|
533 |
|
|
/* The frame pointer points at the same place as the stack pointer, except if
|
534 |
|
|
alloca has been called. */
|
535 |
|
|
#define STARTING_FRAME_OFFSET \
|
536 |
|
|
M32R_STACK_ALIGN (crtl->outgoing_args_size)
|
537 |
|
|
|
538 |
|
|
/* Offset from the stack pointer register to the first location at which
|
539 |
|
|
outgoing arguments are placed. */
|
540 |
|
|
#define STACK_POINTER_OFFSET 0
|
541 |
|
|
|
542 |
|
|
/* Offset of first parameter from the argument pointer register value. */
|
543 |
|
|
#define FIRST_PARM_OFFSET(FNDECL) 0
|
544 |
|
|
|
545 |
|
|
/* Register to use for pushing function arguments. */
|
546 |
|
|
#define STACK_POINTER_REGNUM 15
|
547 |
|
|
|
548 |
|
|
/* Base register for access to local variables of the function. */
|
549 |
|
|
#define FRAME_POINTER_REGNUM 13
|
550 |
|
|
|
551 |
|
|
/* Base register for access to arguments of the function. */
|
552 |
|
|
#define ARG_POINTER_REGNUM 16
|
553 |
|
|
|
554 |
|
|
/* Register in which static-chain is passed to a function.
|
555 |
|
|
This must not be a register used by the prologue. */
|
556 |
|
|
#define STATIC_CHAIN_REGNUM 7
|
557 |
|
|
|
558 |
|
|
/* These aren't official macros. */
|
559 |
|
|
#define PROLOGUE_TMP_REGNUM 4
|
560 |
|
|
#define RETURN_ADDR_REGNUM 14
|
561 |
|
|
/* #define GP_REGNUM 12 */
|
562 |
|
|
#define CARRY_REGNUM 17
|
563 |
|
|
#define ACCUM_REGNUM 18
|
564 |
|
|
#define M32R_MAX_INT_REGS 16
|
565 |
|
|
|
566 |
|
|
#ifndef SUBTARGET_GPR_P
|
567 |
|
|
#define SUBTARGET_GPR_P(REGNO) 0
|
568 |
|
|
#endif
|
569 |
|
|
|
570 |
|
|
#ifndef SUBTARGET_ACCUM_P
|
571 |
|
|
#define SUBTARGET_ACCUM_P(REGNO) 0
|
572 |
|
|
#endif
|
573 |
|
|
|
574 |
|
|
#ifndef SUBTARGET_CARRY_P
|
575 |
|
|
#define SUBTARGET_CARRY_P(REGNO) 0
|
576 |
|
|
#endif
|
577 |
|
|
|
578 |
|
|
#define GPR_P(REGNO) (IN_RANGE_P ((REGNO), 0, 15) || SUBTARGET_GPR_P (REGNO))
|
579 |
|
|
#define ACCUM_P(REGNO) ((REGNO) == ACCUM_REGNUM || SUBTARGET_ACCUM_P (REGNO))
|
580 |
|
|
#define CARRY_P(REGNO) ((REGNO) == CARRY_REGNUM || SUBTARGET_CARRY_P (REGNO))
|
581 |
|
|
|
582 |
|
|
/* Eliminating the frame and arg pointers. */
|
583 |
|
|
|
584 |
|
|
#if 0
|
585 |
|
|
/* C statement to store the difference between the frame pointer
|
586 |
|
|
and the stack pointer values immediately after the function prologue.
|
587 |
|
|
If `ELIMINABLE_REGS' is defined, this macro will be not be used and
|
588 |
|
|
need not be defined. */
|
589 |
|
|
#define INITIAL_FRAME_POINTER_OFFSET(VAR) \
|
590 |
|
|
((VAR) = m32r_compute_frame_size (get_frame_size ()))
|
591 |
|
|
#endif
|
592 |
|
|
|
593 |
|
|
/* If defined, this macro specifies a table of register pairs used to
|
594 |
|
|
eliminate unneeded registers that point into the stack frame. If
|
595 |
|
|
it is not defined, the only elimination attempted by the compiler
|
596 |
|
|
is to replace references to the frame pointer with references to
|
597 |
|
|
the stack pointer.
|
598 |
|
|
|
599 |
|
|
Note that the elimination of the argument pointer with the stack
|
600 |
|
|
pointer is specified first since that is the preferred elimination. */
|
601 |
|
|
|
602 |
|
|
#define ELIMINABLE_REGS \
|
603 |
|
|
{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
|
604 |
|
|
{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
|
605 |
|
|
{ ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }}
|
606 |
|
|
|
607 |
|
|
/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
|
608 |
|
|
specifies the initial difference between the specified pair of
|
609 |
|
|
registers. This macro must be defined if `ELIMINABLE_REGS' is
|
610 |
|
|
defined. */
|
611 |
|
|
|
612 |
|
|
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
|
613 |
|
|
do \
|
614 |
|
|
{ \
|
615 |
|
|
int size = m32r_compute_frame_size (get_frame_size ()); \
|
616 |
|
|
\
|
617 |
|
|
if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
|
618 |
|
|
(OFFSET) = 0; \
|
619 |
|
|
else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
|
620 |
|
|
(OFFSET) = size - crtl->args.pretend_args_size; \
|
621 |
|
|
else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
|
622 |
|
|
(OFFSET) = size - crtl->args.pretend_args_size; \
|
623 |
|
|
else \
|
624 |
|
|
gcc_unreachable (); \
|
625 |
|
|
} \
|
626 |
|
|
while (0)
|
627 |
|
|
|
628 |
|
|
/* Function argument passing. */
|
629 |
|
|
|
630 |
|
|
/* If defined, the maximum amount of space required for outgoing
|
631 |
|
|
arguments will be computed and placed into the variable
|
632 |
|
|
`crtl->outgoing_args_size'. No space will be pushed
|
633 |
|
|
onto the stack for each call; instead, the function prologue should
|
634 |
|
|
increase the stack frame size by this amount. */
|
635 |
|
|
#define ACCUMULATE_OUTGOING_ARGS 1
|
636 |
|
|
|
637 |
|
|
/* Define a data type for recording info about an argument list
|
638 |
|
|
during the scan of that argument list. This data type should
|
639 |
|
|
hold all necessary information about the function itself
|
640 |
|
|
and about the args processed so far, enough to enable macros
|
641 |
|
|
such as FUNCTION_ARG to determine where the next arg should go. */
|
642 |
|
|
#define CUMULATIVE_ARGS int
|
643 |
|
|
|
644 |
|
|
/* Initialize a variable CUM of type CUMULATIVE_ARGS
|
645 |
|
|
for a call to a function whose data type is FNTYPE.
|
646 |
|
|
For a library call, FNTYPE is 0. */
|
647 |
|
|
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
|
648 |
|
|
((CUM) = 0)
|
649 |
|
|
|
650 |
|
|
/* The number of registers used for parameter passing. Local to this file. */
|
651 |
|
|
#define M32R_MAX_PARM_REGS 4
|
652 |
|
|
|
653 |
|
|
/* 1 if N is a possible register number for function argument passing. */
|
654 |
|
|
#define FUNCTION_ARG_REGNO_P(N) \
|
655 |
|
|
((unsigned) (N) < M32R_MAX_PARM_REGS)
|
656 |
|
|
|
657 |
|
|
|
658 |
|
|
/* Function results. */
|
659 |
|
|
|
660 |
|
|
/* Tell GCC to use TARGET_RETURN_IN_MEMORY. */
|
661 |
|
|
#define DEFAULT_PCC_STRUCT_RETURN 0
|
662 |
|
|
|
663 |
|
|
/* Function entry and exit. */
|
664 |
|
|
|
665 |
|
|
/* Initialize data used by insn expanders. This is called from
|
666 |
|
|
init_emit, once for each function, before code is generated. */
|
667 |
|
|
#define INIT_EXPANDERS m32r_init_expanders ()
|
668 |
|
|
|
669 |
|
|
/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
|
670 |
|
|
the stack pointer does not matter. The value is tested only in
|
671 |
|
|
functions that have frame pointers.
|
672 |
|
|
No definition is equivalent to always zero. */
|
673 |
|
|
#define EXIT_IGNORE_STACK 1
|
674 |
|
|
|
675 |
|
|
/* Output assembler code to FILE to increment profiler label # LABELNO
|
676 |
|
|
for profiling a function entry. */
|
677 |
|
|
#undef FUNCTION_PROFILER
|
678 |
|
|
#define FUNCTION_PROFILER(FILE, LABELNO) \
|
679 |
|
|
do \
|
680 |
|
|
{ \
|
681 |
|
|
if (flag_pic) \
|
682 |
|
|
{ \
|
683 |
|
|
fprintf (FILE, "\tld24 r14,#mcount\n"); \
|
684 |
|
|
fprintf (FILE, "\tadd r14,r12\n"); \
|
685 |
|
|
fprintf (FILE, "\tld r14,@r14\n"); \
|
686 |
|
|
fprintf (FILE, "\tjl r14\n"); \
|
687 |
|
|
} \
|
688 |
|
|
else \
|
689 |
|
|
{ \
|
690 |
|
|
if (TARGET_ADDR24) \
|
691 |
|
|
fprintf (FILE, "\tbl mcount\n"); \
|
692 |
|
|
else \
|
693 |
|
|
{ \
|
694 |
|
|
fprintf (FILE, "\tseth r14,#high(mcount)\n"); \
|
695 |
|
|
fprintf (FILE, "\tor3 r14,r14,#low(mcount)\n"); \
|
696 |
|
|
fprintf (FILE, "\tjl r14\n"); \
|
697 |
|
|
} \
|
698 |
|
|
} \
|
699 |
|
|
fprintf (FILE, "\taddi sp,#4\n"); \
|
700 |
|
|
} \
|
701 |
|
|
while (0)
|
702 |
|
|
|
703 |
|
|
/* Trampolines. */
|
704 |
|
|
|
705 |
|
|
/* On the M32R, the trampoline is:
|
706 |
|
|
|
707 |
|
|
mv r7, lr -> bl L1 ; 178e 7e01
|
708 |
|
|
L1: add3 r6, lr, #L2-L1 ; 86ae 000c (L2 - L1 = 12)
|
709 |
|
|
mv lr, r7 -> ld r7,@r6+ ; 1e87 27e6
|
710 |
|
|
ld r6, @r6 -> jmp r6 ; 26c6 1fc6
|
711 |
|
|
L2: .word STATIC
|
712 |
|
|
.word FUNCTION */
|
713 |
|
|
|
714 |
|
|
#ifndef CACHE_FLUSH_FUNC
|
715 |
|
|
#define CACHE_FLUSH_FUNC "_flush_cache"
|
716 |
|
|
#endif
|
717 |
|
|
#ifndef CACHE_FLUSH_TRAP
|
718 |
|
|
#define CACHE_FLUSH_TRAP 12
|
719 |
|
|
#endif
|
720 |
|
|
|
721 |
|
|
/* Length in bytes of the trampoline for entering a nested function. */
|
722 |
|
|
#define TRAMPOLINE_SIZE 24
|
723 |
|
|
|
724 |
|
|
|
725 |
|
|
#define RETURN_ADDR_RTX(COUNT, FRAME) m32r_return_addr (COUNT)
|
726 |
|
|
|
727 |
|
|
#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM)
|
728 |
|
|
|
729 |
|
|
/* Addressing modes, and classification of registers for them. */
|
730 |
|
|
|
731 |
|
|
/* Maximum number of registers that can appear in a valid memory address. */
|
732 |
|
|
#define MAX_REGS_PER_ADDRESS 1
|
733 |
|
|
|
734 |
|
|
/* We have post-inc load and pre-dec,pre-inc store,
|
735 |
|
|
but only for 4 byte vals. */
|
736 |
|
|
#define HAVE_PRE_DECREMENT 1
|
737 |
|
|
#define HAVE_PRE_INCREMENT 1
|
738 |
|
|
#define HAVE_POST_INCREMENT 1
|
739 |
|
|
|
740 |
|
|
/* Recognize any constant value that is a valid address. */
|
741 |
|
|
#define CONSTANT_ADDRESS_P(X) \
|
742 |
|
|
( GET_CODE (X) == LABEL_REF \
|
743 |
|
|
|| GET_CODE (X) == SYMBOL_REF \
|
744 |
|
|
|| CONST_INT_P (X) \
|
745 |
|
|
|| (GET_CODE (X) == CONST \
|
746 |
|
|
&& ! (flag_pic && ! m32r_legitimate_pic_operand_p (X))))
|
747 |
|
|
|
748 |
|
|
/* Condition code usage. */
|
749 |
|
|
|
750 |
|
|
/* Return nonzero if SELECT_CC_MODE will never return MODE for a
|
751 |
|
|
floating point inequality comparison. */
|
752 |
|
|
#define REVERSIBLE_CC_MODE(MODE) 1 /*???*/
|
753 |
|
|
|
754 |
|
|
/* Costs. */
|
755 |
|
|
|
756 |
|
|
/* The cost of a branch insn. */
|
757 |
|
|
/* A value of 2 here causes GCC to avoid using branches in comparisons like
|
758 |
|
|
while (a < N && a). Branches aren't that expensive on the M32R so
|
759 |
|
|
we define this as 1. Defining it as 2 had a heavy hit in fp-bit.c. */
|
760 |
|
|
#define BRANCH_COST(speed_p, predictable_p) ((TARGET_BRANCH_COST) ? 2 : 1)
|
761 |
|
|
|
762 |
|
|
/* Nonzero if access to memory by bytes is slow and undesirable.
|
763 |
|
|
For RISC chips, it means that access to memory by bytes is no
|
764 |
|
|
better than access by words when possible, so grab a whole word
|
765 |
|
|
and maybe make use of that. */
|
766 |
|
|
#define SLOW_BYTE_ACCESS 1
|
767 |
|
|
|
768 |
|
|
/* Define this macro if it is as good or better to call a constant
|
769 |
|
|
function address than to call an address kept in a register. */
|
770 |
|
|
#define NO_FUNCTION_CSE
|
771 |
|
|
|
772 |
|
|
/* Section selection. */
|
773 |
|
|
|
774 |
|
|
#define TEXT_SECTION_ASM_OP "\t.section .text"
|
775 |
|
|
#define DATA_SECTION_ASM_OP "\t.section .data"
|
776 |
|
|
#define BSS_SECTION_ASM_OP "\t.section .bss"
|
777 |
|
|
|
778 |
|
|
/* Define this macro if jump tables (for tablejump insns) should be
|
779 |
|
|
output in the text section, along with the assembler instructions.
|
780 |
|
|
Otherwise, the readonly data section is used.
|
781 |
|
|
This macro is irrelevant if there is no separate readonly data section. */
|
782 |
|
|
#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
|
783 |
|
|
|
784 |
|
|
/* Position Independent Code. */
|
785 |
|
|
|
786 |
|
|
/* The register number of the register used to address a table of static
|
787 |
|
|
data addresses in memory. In some cases this register is defined by a
|
788 |
|
|
processor's ``application binary interface'' (ABI). When this macro
|
789 |
|
|
is defined, RTL is generated for this register once, as with the stack
|
790 |
|
|
pointer and frame pointer registers. If this macro is not defined, it
|
791 |
|
|
is up to the machine-dependent files to allocate such a register (if
|
792 |
|
|
necessary). */
|
793 |
|
|
#define PIC_OFFSET_TABLE_REGNUM 12
|
794 |
|
|
|
795 |
|
|
/* Define this macro if the register defined by PIC_OFFSET_TABLE_REGNUM is
|
796 |
|
|
clobbered by calls. Do not define this macro if PIC_OFFSET_TABLE_REGNUM
|
797 |
|
|
is not defined. */
|
798 |
|
|
/* This register is call-saved on the M32R. */
|
799 |
|
|
/*#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED*/
|
800 |
|
|
|
801 |
|
|
/* A C expression that is nonzero if X is a legitimate immediate
|
802 |
|
|
operand on the target machine when generating position independent code.
|
803 |
|
|
You can assume that X satisfies CONSTANT_P, so you need not
|
804 |
|
|
check this. You can also assume `flag_pic' is true, so you need not
|
805 |
|
|
check it either. You need not define this macro if all constants
|
806 |
|
|
(including SYMBOL_REF) can be immediate operands when generating
|
807 |
|
|
position independent code. */
|
808 |
|
|
#define LEGITIMATE_PIC_OPERAND_P(X) m32r_legitimate_pic_operand_p (X)
|
809 |
|
|
|
810 |
|
|
/* Control the assembler format that we output. */
|
811 |
|
|
|
812 |
|
|
/* A C string constant describing how to begin a comment in the target
|
813 |
|
|
assembler language. The compiler assumes that the comment will
|
814 |
|
|
end at the end of the line. */
|
815 |
|
|
#define ASM_COMMENT_START ";"
|
816 |
|
|
|
817 |
|
|
/* Output to assembler file text saying following lines
|
818 |
|
|
may contain character constants, extra white space, comments, etc. */
|
819 |
|
|
#define ASM_APP_ON ""
|
820 |
|
|
|
821 |
|
|
/* Output to assembler file text saying following lines
|
822 |
|
|
no longer contain unusual constructs. */
|
823 |
|
|
#define ASM_APP_OFF ""
|
824 |
|
|
|
825 |
|
|
/* Globalizing directive for a label. */
|
826 |
|
|
#define GLOBAL_ASM_OP "\t.global\t"
|
827 |
|
|
|
828 |
|
|
/* We do not use DBX_LINES_FUNCTION_RELATIVE or
|
829 |
|
|
dbxout_stab_value_internal_label_diff here because
|
830 |
|
|
we need to use .debugsym for the line label. */
|
831 |
|
|
|
832 |
|
|
#define DBX_OUTPUT_SOURCE_LINE(file, line, counter) \
|
833 |
|
|
do \
|
834 |
|
|
{ \
|
835 |
|
|
const char * begin_label = \
|
836 |
|
|
XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0); \
|
837 |
|
|
char label[64]; \
|
838 |
|
|
ASM_GENERATE_INTERNAL_LABEL (label, "LM", counter); \
|
839 |
|
|
\
|
840 |
|
|
dbxout_begin_stabn_sline (line); \
|
841 |
|
|
assemble_name (file, label); \
|
842 |
|
|
putc ('-', file); \
|
843 |
|
|
assemble_name (file, begin_label); \
|
844 |
|
|
fputs ("\n\t.debugsym ", file); \
|
845 |
|
|
assemble_name (file, label); \
|
846 |
|
|
putc ('\n', file); \
|
847 |
|
|
counter += 1; \
|
848 |
|
|
} \
|
849 |
|
|
while (0)
|
850 |
|
|
|
851 |
|
|
/* How to refer to registers in assembler output.
|
852 |
|
|
This sequence is indexed by compiler's hard-register-number (see above). */
|
853 |
|
|
#ifndef SUBTARGET_REGISTER_NAMES
|
854 |
|
|
#define SUBTARGET_REGISTER_NAMES
|
855 |
|
|
#endif
|
856 |
|
|
|
857 |
|
|
#define REGISTER_NAMES \
|
858 |
|
|
{ \
|
859 |
|
|
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
|
860 |
|
|
"r8", "r9", "r10", "r11", "r12", "fp", "lr", "sp", \
|
861 |
|
|
"ap", "cbit", "a0" \
|
862 |
|
|
SUBTARGET_REGISTER_NAMES \
|
863 |
|
|
}
|
864 |
|
|
|
865 |
|
|
/* If defined, a C initializer for an array of structures containing
|
866 |
|
|
a name and a register number. This macro defines additional names
|
867 |
|
|
for hard registers, thus allowing the `asm' option in declarations
|
868 |
|
|
to refer to registers using alternate names. */
|
869 |
|
|
#ifndef SUBTARGET_ADDITIONAL_REGISTER_NAMES
|
870 |
|
|
#define SUBTARGET_ADDITIONAL_REGISTER_NAMES
|
871 |
|
|
#endif
|
872 |
|
|
|
873 |
|
|
#define ADDITIONAL_REGISTER_NAMES \
|
874 |
|
|
{ \
|
875 |
|
|
/*{ "gp", GP_REGNUM },*/ \
|
876 |
|
|
{ "r13", FRAME_POINTER_REGNUM }, \
|
877 |
|
|
{ "r14", RETURN_ADDR_REGNUM }, \
|
878 |
|
|
{ "r15", STACK_POINTER_REGNUM }, \
|
879 |
|
|
SUBTARGET_ADDITIONAL_REGISTER_NAMES \
|
880 |
|
|
}
|
881 |
|
|
|
882 |
|
|
/* If defined, C string expressions to be used for the `%R', `%L',
|
883 |
|
|
`%U', and `%I' options of `asm_fprintf' (see `final.c'). These
|
884 |
|
|
are useful when a single `md' file must support multiple assembler
|
885 |
|
|
formats. In that case, the various `tm.h' files can define these
|
886 |
|
|
macros differently. */
|
887 |
|
|
#define REGISTER_PREFIX ""
|
888 |
|
|
#define LOCAL_LABEL_PREFIX ".L"
|
889 |
|
|
#define USER_LABEL_PREFIX ""
|
890 |
|
|
#define IMMEDIATE_PREFIX "#"
|
891 |
|
|
|
892 |
|
|
/* This is how to output an element of a case-vector that is absolute. */
|
893 |
|
|
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
|
894 |
|
|
do \
|
895 |
|
|
{ \
|
896 |
|
|
char label[30]; \
|
897 |
|
|
ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
|
898 |
|
|
fprintf (FILE, "\t.word\t"); \
|
899 |
|
|
assemble_name (FILE, label); \
|
900 |
|
|
fprintf (FILE, "\n"); \
|
901 |
|
|
} \
|
902 |
|
|
while (0)
|
903 |
|
|
|
904 |
|
|
/* This is how to output an element of a case-vector that is relative. */
|
905 |
|
|
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL)\
|
906 |
|
|
do \
|
907 |
|
|
{ \
|
908 |
|
|
char label[30]; \
|
909 |
|
|
ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
|
910 |
|
|
fprintf (FILE, "\t.word\t"); \
|
911 |
|
|
assemble_name (FILE, label); \
|
912 |
|
|
fprintf (FILE, "-"); \
|
913 |
|
|
ASM_GENERATE_INTERNAL_LABEL (label, "L", REL); \
|
914 |
|
|
assemble_name (FILE, label); \
|
915 |
|
|
fprintf (FILE, "\n"); \
|
916 |
|
|
} \
|
917 |
|
|
while (0)
|
918 |
|
|
|
919 |
|
|
/* The desired alignment for the location counter at the beginning
|
920 |
|
|
of a loop. */
|
921 |
|
|
/* On the M32R, align loops to 32 byte boundaries (cache line size)
|
922 |
|
|
if -malign-loops. */
|
923 |
|
|
#define LOOP_ALIGN(LABEL) (TARGET_ALIGN_LOOPS ? 5 : 0)
|
924 |
|
|
|
925 |
|
|
/* Define this to be the maximum number of insns to move around when moving
|
926 |
|
|
a loop test from the top of a loop to the bottom
|
927 |
|
|
and seeing whether to duplicate it. The default is thirty.
|
928 |
|
|
|
929 |
|
|
Loop unrolling currently doesn't like this optimization, so
|
930 |
|
|
disable doing if we are unrolling loops and saving space. */
|
931 |
|
|
#define LOOP_TEST_THRESHOLD (optimize_size \
|
932 |
|
|
&& !flag_unroll_loops \
|
933 |
|
|
&& !flag_unroll_all_loops ? 2 : 30)
|
934 |
|
|
|
935 |
|
|
/* This is how to output an assembler line
|
936 |
|
|
that says to advance the location counter
|
937 |
|
|
to a multiple of 2**LOG bytes. */
|
938 |
|
|
/* .balign is used to avoid confusion. */
|
939 |
|
|
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
|
940 |
|
|
do \
|
941 |
|
|
{ \
|
942 |
|
|
if ((LOG) != 0) \
|
943 |
|
|
fprintf (FILE, "\t.balign %d\n", 1 << (LOG)); \
|
944 |
|
|
} \
|
945 |
|
|
while (0)
|
946 |
|
|
|
947 |
|
|
/* Like `ASM_OUTPUT_COMMON' except takes the required alignment as a
|
948 |
|
|
separate, explicit argument. If you define this macro, it is used in
|
949 |
|
|
place of `ASM_OUTPUT_COMMON', and gives you more flexibility in
|
950 |
|
|
handling the required alignment of the variable. The alignment is
|
951 |
|
|
specified as the number of bits. */
|
952 |
|
|
|
953 |
|
|
#define SCOMMON_ASM_OP "\t.scomm\t"
|
954 |
|
|
|
955 |
|
|
#undef ASM_OUTPUT_ALIGNED_COMMON
|
956 |
|
|
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
|
957 |
|
|
do \
|
958 |
|
|
{ \
|
959 |
|
|
if (! TARGET_SDATA_NONE \
|
960 |
|
|
&& (SIZE) > 0 \
|
961 |
|
|
&& (SIZE) <= (unsigned HOST_WIDE_INT) g_switch_value) \
|
962 |
|
|
fprintf ((FILE), "%s", SCOMMON_ASM_OP); \
|
963 |
|
|
else \
|
964 |
|
|
fprintf ((FILE), "%s", COMMON_ASM_OP); \
|
965 |
|
|
assemble_name ((FILE), (NAME)); \
|
966 |
|
|
fprintf ((FILE), ",%u,%u\n", (int)(SIZE), (ALIGN) / BITS_PER_UNIT);\
|
967 |
|
|
} \
|
968 |
|
|
while (0)
|
969 |
|
|
|
970 |
|
|
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
|
971 |
|
|
do \
|
972 |
|
|
{ \
|
973 |
|
|
if (! TARGET_SDATA_NONE \
|
974 |
|
|
&& (SIZE) > 0 \
|
975 |
|
|
&& (SIZE) <= (unsigned HOST_WIDE_INT) g_switch_value) \
|
976 |
|
|
switch_to_section (get_named_section (NULL, ".sbss", 0)); \
|
977 |
|
|
else \
|
978 |
|
|
switch_to_section (bss_section); \
|
979 |
|
|
ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \
|
980 |
|
|
last_assemble_variable_decl = DECL; \
|
981 |
|
|
ASM_DECLARE_OBJECT_NAME (FILE, NAME, DECL); \
|
982 |
|
|
ASM_OUTPUT_SKIP (FILE, SIZE ? SIZE : 1); \
|
983 |
|
|
} \
|
984 |
|
|
while (0)
|
985 |
|
|
|
986 |
|
|
/* Debugging information. */
|
987 |
|
|
|
988 |
|
|
/* Generate DBX and DWARF debugging information. */
|
989 |
|
|
#define DBX_DEBUGGING_INFO 1
|
990 |
|
|
#define DWARF2_DEBUGGING_INFO 1
|
991 |
|
|
|
992 |
|
|
/* Use DWARF2 debugging info by default. */
|
993 |
|
|
#undef PREFERRED_DEBUGGING_TYPE
|
994 |
|
|
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
|
995 |
|
|
|
996 |
|
|
/* Turn off splitting of long stabs. */
|
997 |
|
|
#define DBX_CONTIN_LENGTH 0
|
998 |
|
|
|
999 |
|
|
/* Miscellaneous. */
|
1000 |
|
|
|
1001 |
|
|
/* Specify the machine mode that this machine uses
|
1002 |
|
|
for the index in the tablejump instruction. */
|
1003 |
|
|
#define CASE_VECTOR_MODE (flag_pic ? SImode : Pmode)
|
1004 |
|
|
|
1005 |
|
|
/* Define if operations between registers always perform the operation
|
1006 |
|
|
on the full register even if a narrower mode is specified. */
|
1007 |
|
|
#define WORD_REGISTER_OPERATIONS
|
1008 |
|
|
|
1009 |
|
|
/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
|
1010 |
|
|
will either zero-extend or sign-extend. The value of this macro should
|
1011 |
|
|
be the code that says which one of the two operations is implicitly
|
1012 |
|
|
done, UNKNOWN if none. */
|
1013 |
|
|
#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
|
1014 |
|
|
|
1015 |
|
|
/* Max number of bytes we can move from memory
|
1016 |
|
|
to memory in one reasonably fast instruction. */
|
1017 |
|
|
#define MOVE_MAX 4
|
1018 |
|
|
|
1019 |
|
|
/* Define this to be nonzero if shift instructions ignore all but the low-order
|
1020 |
|
|
few bits. */
|
1021 |
|
|
#define SHIFT_COUNT_TRUNCATED 1
|
1022 |
|
|
|
1023 |
|
|
/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
|
1024 |
|
|
is done just by pretending it is already truncated. */
|
1025 |
|
|
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
|
1026 |
|
|
|
1027 |
|
|
/* Specify the machine mode that pointers have.
|
1028 |
|
|
After generation of rtl, the compiler makes no further distinction
|
1029 |
|
|
between pointers and any other objects of this machine mode. */
|
1030 |
|
|
/* ??? The M32R doesn't have full 32-bit pointers, but making this PSImode has
|
1031 |
|
|
its own problems (you have to add extendpsisi2 and truncsipsi2).
|
1032 |
|
|
Try to avoid it. */
|
1033 |
|
|
#define Pmode SImode
|
1034 |
|
|
|
1035 |
|
|
/* A function address in a call instruction. */
|
1036 |
|
|
#define FUNCTION_MODE SImode
|
1037 |
|
|
|
1038 |
|
|
/* M32R function types. */
|
1039 |
|
|
enum m32r_function_type
|
1040 |
|
|
{
|
1041 |
|
|
M32R_FUNCTION_UNKNOWN, M32R_FUNCTION_NORMAL, M32R_FUNCTION_INTERRUPT
|
1042 |
|
|
};
|
1043 |
|
|
|
1044 |
|
|
#define M32R_INTERRUPT_P(TYPE) ((TYPE) == M32R_FUNCTION_INTERRUPT)
|
1045 |
|
|
|
1046 |
|
|
/* The maximum number of bytes to copy using pairs of load/store instructions.
|
1047 |
|
|
If a block is larger than this then a loop will be generated to copy
|
1048 |
|
|
MAX_MOVE_BYTES chunks at a time. The value of 32 is a semi-arbitrary choice.
|
1049 |
|
|
A customer uses Dhrystome as their benchmark, and Dhrystone has a 31 byte
|
1050 |
|
|
string copy in it. */
|
1051 |
|
|
#define MAX_MOVE_BYTES 32
|