1 |
282 |
jeremybenn |
/* GCC backend definitions for the Renesas RX processor.
|
2 |
|
|
Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
|
3 |
|
|
Contributed by Red Hat.
|
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 |
|
|
|
22 |
|
|
#define TARGET_CPU_CPP_BUILTINS() \
|
23 |
|
|
do \
|
24 |
|
|
{ \
|
25 |
|
|
builtin_define ("__RX__"); \
|
26 |
|
|
builtin_assert ("cpu=RX"); \
|
27 |
|
|
if (rx_cpu_type == RX610) \
|
28 |
|
|
builtin_assert ("machine=RX610"); \
|
29 |
|
|
else \
|
30 |
|
|
builtin_assert ("machine=RX600"); \
|
31 |
|
|
\
|
32 |
|
|
if (TARGET_BIG_ENDIAN_DATA) \
|
33 |
|
|
builtin_define ("__RX_BIG_ENDIAN__"); \
|
34 |
|
|
else \
|
35 |
|
|
builtin_define ("__RX_LITTLE_ENDIAN__");\
|
36 |
|
|
\
|
37 |
|
|
if (TARGET_64BIT_DOUBLES) \
|
38 |
|
|
builtin_define ("__RX_64BIT_DOUBLES__");\
|
39 |
|
|
else \
|
40 |
|
|
builtin_define ("__RX_32BIT_DOUBLES__");\
|
41 |
|
|
\
|
42 |
|
|
if (ALLOW_RX_FPU_INSNS) \
|
43 |
|
|
builtin_define ("__RX_FPU_INSNS__"); \
|
44 |
|
|
\
|
45 |
|
|
if (TARGET_AS100_SYNTAX) \
|
46 |
|
|
builtin_define ("__RX_AS100_SYNTAX__"); \
|
47 |
|
|
else \
|
48 |
|
|
builtin_define ("__RX_GAS_SYNTAX__"); \
|
49 |
|
|
} \
|
50 |
|
|
while (0)
|
51 |
|
|
|
52 |
|
|
enum rx_cpu_types
|
53 |
|
|
{
|
54 |
|
|
RX600,
|
55 |
|
|
RX610,
|
56 |
|
|
RX200
|
57 |
|
|
};
|
58 |
|
|
|
59 |
|
|
extern enum rx_cpu_types rx_cpu_type;
|
60 |
|
|
|
61 |
|
|
#undef CC1_SPEC
|
62 |
|
|
#define CC1_SPEC "\
|
63 |
|
|
%{mas100-syntax:%{gdwarf*:%e-mas100-syntax is incompatible with -gdwarf}} \
|
64 |
|
|
%{mcpu=rx200:%{fpu:%erx200 cpu does not have FPU hardware}}"
|
65 |
|
|
|
66 |
|
|
#undef STARTFILE_SPEC
|
67 |
|
|
#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:crt0.o%s} crtbegin.o%s"
|
68 |
|
|
|
69 |
|
|
#undef ENDFILE_SPEC
|
70 |
|
|
#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
|
71 |
|
|
|
72 |
|
|
#undef ASM_SPEC
|
73 |
|
|
#define ASM_SPEC "\
|
74 |
|
|
%{mbig-endian-data:-mbig-endian-data} \
|
75 |
|
|
%{m64bit-doubles:-m64bit-doubles} \
|
76 |
|
|
%{!m64bit-doubles:-m32bit-doubles} \
|
77 |
|
|
%{msmall-data-limit*:-msmall-data-limit} \
|
78 |
|
|
%{mrelax:-relax} \
|
79 |
|
|
"
|
80 |
|
|
|
81 |
|
|
#undef LIB_SPEC
|
82 |
|
|
#define LIB_SPEC " \
|
83 |
|
|
--start-group \
|
84 |
|
|
-lc \
|
85 |
|
|
%{msim*:-lsim}%{!msim*:-lnosys} \
|
86 |
|
|
%{fprofile-arcs|fprofile-generate|coverage:-lgcov} \
|
87 |
|
|
--end-group \
|
88 |
|
|
%{!T*: %{msim*:%Trx-sim.ld}%{!msim*:%Trx.ld}} \
|
89 |
|
|
"
|
90 |
|
|
|
91 |
|
|
#undef LINK_SPEC
|
92 |
|
|
#define LINK_SPEC "%{mbig-endian-data:--oformat elf32-rx-be} %{mrelax:-relax}"
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
#define BITS_BIG_ENDIAN 0
|
96 |
|
|
#define BYTES_BIG_ENDIAN TARGET_BIG_ENDIAN_DATA
|
97 |
|
|
#define WORDS_BIG_ENDIAN TARGET_BIG_ENDIAN_DATA
|
98 |
|
|
|
99 |
|
|
#ifdef __RX_BIG_ENDIAN__
|
100 |
|
|
#define LIBGCC2_WORDS_BIG_ENDIAN 1
|
101 |
|
|
#else
|
102 |
|
|
#define LIBGCC2_WORDS_BIG_ENDIAN 0
|
103 |
|
|
#endif
|
104 |
|
|
|
105 |
|
|
#define UNITS_PER_WORD 4
|
106 |
|
|
|
107 |
|
|
#define INT_TYPE_SIZE 32
|
108 |
|
|
#define LONG_TYPE_SIZE 32
|
109 |
|
|
#define LONG_LONG_TYPE_SIZE 64
|
110 |
|
|
|
111 |
|
|
#define FLOAT_TYPE_SIZE 32
|
112 |
|
|
#define DOUBLE_TYPE_SIZE (TARGET_64BIT_DOUBLES ? 64 : 32)
|
113 |
|
|
#define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE
|
114 |
|
|
|
115 |
|
|
#ifdef __RX_32BIT_DOUBLES__
|
116 |
|
|
#define LIBGCC2_HAS_DF_MODE 0
|
117 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 32
|
118 |
|
|
#define LIBGCC2_DOUBLE_TYPE_SIZE 32
|
119 |
|
|
#else
|
120 |
|
|
#define LIBGCC2_HAS_DF_MODE 1
|
121 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
|
122 |
|
|
#define LIBGCC2_DOUBLE_TYPE_SIZE 64
|
123 |
|
|
#endif
|
124 |
|
|
|
125 |
|
|
#define DEFAULT_SIGNED_CHAR 0
|
126 |
|
|
|
127 |
|
|
#define STRICT_ALIGNMENT 1
|
128 |
|
|
#define FUNCTION_BOUNDARY 8
|
129 |
|
|
#define BIGGEST_ALIGNMENT 32
|
130 |
|
|
#define STACK_BOUNDARY 32
|
131 |
|
|
#define PARM_BOUNDARY 8
|
132 |
|
|
|
133 |
|
|
#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) 32
|
134 |
|
|
|
135 |
|
|
#define STACK_GROWS_DOWNWARD 1
|
136 |
|
|
#define FRAME_GROWS_DOWNWARD 0
|
137 |
|
|
#define FIRST_PARM_OFFSET(FNDECL) 0
|
138 |
|
|
|
139 |
|
|
#define MAX_REGS_PER_ADDRESS 2
|
140 |
|
|
|
141 |
|
|
#define Pmode SImode
|
142 |
|
|
#define POINTER_SIZE 32
|
143 |
|
|
#undef SIZE_TYPE
|
144 |
|
|
#define SIZE_TYPE "long unsigned int"
|
145 |
|
|
#undef PTRDIFF_TYPE
|
146 |
|
|
#define PTRDIFF_TYPE "long int"
|
147 |
|
|
#define POINTERS_EXTEND_UNSIGNED 1
|
148 |
|
|
#define FUNCTION_MODE QImode
|
149 |
|
|
#define CASE_VECTOR_MODE Pmode
|
150 |
|
|
#define WORD_REGISTER_OPERATIONS 1
|
151 |
|
|
#define HAS_LONG_COND_BRANCH 0
|
152 |
|
|
#define HAS_LONG_UNCOND_BRANCH 0
|
153 |
|
|
|
154 |
|
|
#define MOVE_MAX 4
|
155 |
|
|
#define STARTING_FRAME_OFFSET 0
|
156 |
|
|
|
157 |
|
|
#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, SIZE) 0
|
158 |
|
|
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
|
159 |
|
|
|
160 |
|
|
#define LEGITIMATE_CONSTANT_P(X) rx_is_legitimate_constant (X)
|
161 |
|
|
|
162 |
|
|
#define HANDLE_PRAGMA_PACK_PUSH_POP 1
|
163 |
|
|
|
164 |
|
|
#define HAVE_PRE_DECCREMENT 1
|
165 |
|
|
#define HAVE_POST_INCREMENT 1
|
166 |
|
|
|
167 |
|
|
#define MOVE_RATIO(SPEED) ((SPEED) ? 4 : 2)
|
168 |
|
|
#define SLOW_BYTE_ACCESS 1
|
169 |
|
|
|
170 |
|
|
#define STORE_FLAG_VALUE 1
|
171 |
|
|
#define LOAD_EXTEND_OP(MODE) SIGN_EXTEND
|
172 |
|
|
#define SHORT_IMMEDIATES_SIGN_EXTEND 1
|
173 |
|
|
|
174 |
|
|
enum reg_class
|
175 |
|
|
{
|
176 |
|
|
NO_REGS, /* No registers in set. */
|
177 |
|
|
GR_REGS, /* Integer registers. */
|
178 |
|
|
ALL_REGS, /* All registers. */
|
179 |
|
|
LIM_REG_CLASSES /* Max value + 1. */
|
180 |
|
|
};
|
181 |
|
|
|
182 |
|
|
#define REG_CLASS_NAMES \
|
183 |
|
|
{ \
|
184 |
|
|
"NO_REGS", \
|
185 |
|
|
"GR_REGS", \
|
186 |
|
|
"ALL_REGS" \
|
187 |
|
|
}
|
188 |
|
|
|
189 |
|
|
#define REG_CLASS_CONTENTS \
|
190 |
|
|
{ \
|
191 |
|
|
{ 0x00000000 }, /* No registers, */ \
|
192 |
|
|
{ 0x0000ffff }, /* Integer registers. */ \
|
193 |
|
|
{ 0x0000ffff } /* All registers. */ \
|
194 |
|
|
}
|
195 |
|
|
|
196 |
|
|
#define IRA_COVER_CLASSES \
|
197 |
|
|
{ \
|
198 |
|
|
GR_REGS, LIM_REG_CLASSES \
|
199 |
|
|
}
|
200 |
|
|
|
201 |
|
|
#define SMALL_REGISTER_CLASSES 0
|
202 |
|
|
#define N_REG_CLASSES (int) LIM_REG_CLASSES
|
203 |
|
|
#define CLASS_MAX_NREGS(CLASS, MODE) ((GET_MODE_SIZE (MODE) \
|
204 |
|
|
+ UNITS_PER_WORD - 1) \
|
205 |
|
|
/ UNITS_PER_WORD)
|
206 |
|
|
|
207 |
|
|
#define GENERAL_REGS GR_REGS
|
208 |
|
|
#define BASE_REG_CLASS GR_REGS
|
209 |
|
|
#define INDEX_REG_CLASS GR_REGS
|
210 |
|
|
|
211 |
|
|
#define FIRST_PSEUDO_REGISTER 17
|
212 |
|
|
|
213 |
|
|
#define REGNO_REG_CLASS(REGNO) ((REGNO) < FIRST_PSEUDO_REGISTER \
|
214 |
|
|
? GR_REGS : NO_REGS)
|
215 |
|
|
|
216 |
|
|
#define STACK_POINTER_REGNUM 0
|
217 |
|
|
#define FUNC_RETURN_REGNUM 1
|
218 |
|
|
#define FRAME_POINTER_REGNUM 6
|
219 |
|
|
#define ARG_POINTER_REGNUM 7
|
220 |
|
|
#define STATIC_CHAIN_REGNUM 8
|
221 |
|
|
#define TRAMPOLINE_TEMP_REGNUM 9
|
222 |
|
|
#define STRUCT_VAL_REGNUM 15
|
223 |
|
|
#define CC_REGNUM 16
|
224 |
|
|
|
225 |
|
|
/* This is the register which is used to hold the address of the start
|
226 |
|
|
of the small data area, if that feature is being used. Note - this
|
227 |
|
|
register must not be call_used because otherwise library functions
|
228 |
|
|
that are compiled without small data support might clobber it.
|
229 |
|
|
|
230 |
|
|
FIXME: The function gcc/config/rx/rx.c:rx_gen_move_template() has a
|
231 |
|
|
built in copy of this register's name, rather than constructing the
|
232 |
|
|
name from this #define. */
|
233 |
|
|
#define GP_BASE_REGNUM 13
|
234 |
|
|
|
235 |
|
|
#define ELIMINABLE_REGS \
|
236 |
|
|
{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
|
237 |
|
|
{ ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }, \
|
238 |
|
|
{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }}
|
239 |
|
|
|
240 |
|
|
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
|
241 |
|
|
(OFFSET) = rx_initial_elimination_offset ((FROM), (TO))
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
#define FUNCTION_ARG_REGNO_P(N) (((N) >= 1) && ((N) <= 4))
|
245 |
|
|
#define FUNCTION_VALUE_REGNO_P(N) ((N) == FUNC_RETURN_REGNUM)
|
246 |
|
|
#define DEFAULT_PCC_STRUCT_RETURN 0
|
247 |
|
|
|
248 |
|
|
#define FIXED_REGISTERS \
|
249 |
|
|
{ \
|
250 |
|
|
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 \
|
251 |
|
|
}
|
252 |
|
|
|
253 |
|
|
#define CALL_USED_REGISTERS \
|
254 |
|
|
{ \
|
255 |
|
|
1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1 \
|
256 |
|
|
}
|
257 |
|
|
|
258 |
|
|
#define CONDITIONAL_REGISTER_USAGE \
|
259 |
|
|
rx_conditional_register_usage ()
|
260 |
|
|
|
261 |
|
|
#define LIBCALL_VALUE(MODE) \
|
262 |
|
|
gen_rtx_REG (((GET_MODE_CLASS (MODE) != MODE_INT \
|
263 |
|
|
|| GET_MODE_SIZE (MODE) >= 4) \
|
264 |
|
|
? (MODE) \
|
265 |
|
|
: SImode), \
|
266 |
|
|
FUNC_RETURN_REGNUM)
|
267 |
|
|
|
268 |
|
|
/* Order of allocation of registers. */
|
269 |
|
|
|
270 |
|
|
#define REG_ALLOC_ORDER \
|
271 |
|
|
{ 7, 10, 11, 12, 13, 14, 4, 3, 2, 1, 9, 8, 6, 5, 15 \
|
272 |
|
|
}
|
273 |
|
|
|
274 |
|
|
#define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
|
275 |
|
|
|
276 |
|
|
#define REGNO_IN_RANGE(REGNO, MIN, MAX) \
|
277 |
|
|
(IN_RANGE ((REGNO), (MIN), (MAX)) \
|
278 |
|
|
|| (reg_renumber != NULL \
|
279 |
|
|
&& reg_renumber[(REGNO)] >= (MIN) \
|
280 |
|
|
&& reg_renumber[(REGNO)] <= (MAX)))
|
281 |
|
|
|
282 |
|
|
#ifdef REG_OK_STRICT
|
283 |
|
|
#define REGNO_OK_FOR_BASE_P(regno) REGNO_IN_RANGE (regno, 0, 15)
|
284 |
|
|
#else
|
285 |
|
|
#define REGNO_OK_FOR_BASE_P(regno) 1
|
286 |
|
|
#endif
|
287 |
|
|
|
288 |
|
|
#define REGNO_OK_FOR_INDEX_P(regno) REGNO_OK_FOR_BASE_P (regno)
|
289 |
|
|
|
290 |
|
|
#define RTX_OK_FOR_BASE(X, STRICT) \
|
291 |
|
|
((STRICT) ? \
|
292 |
|
|
( (REG_P (X) \
|
293 |
|
|
&& REGNO_IN_RANGE (REGNO (X), 0, 15)) \
|
294 |
|
|
|| (GET_CODE (X) == SUBREG \
|
295 |
|
|
&& REG_P (SUBREG_REG (X)) \
|
296 |
|
|
&& REGNO_IN_RANGE (REGNO (SUBREG_REG (X)), 0, 15))) \
|
297 |
|
|
: \
|
298 |
|
|
( (REG_P (X) \
|
299 |
|
|
|| (GET_CODE (X) == SUBREG \
|
300 |
|
|
&& REG_P (SUBREG_REG (X))))))
|
301 |
|
|
|
302 |
|
|
#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) \
|
303 |
|
|
do \
|
304 |
|
|
{ \
|
305 |
|
|
if (rx_is_mode_dependent_addr (ADDR)) \
|
306 |
|
|
goto LABEL; \
|
307 |
|
|
} \
|
308 |
|
|
while (0)
|
309 |
|
|
|
310 |
|
|
|
311 |
|
|
#define RETURN_ADDR_RTX(COUNT, FRAMEADDR) \
|
312 |
|
|
((COUNT) == 0 \
|
313 |
|
|
? gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, arg_pointer_rtx, GEN_INT (-4))) \
|
314 |
|
|
: NULL_RTX)
|
315 |
|
|
|
316 |
|
|
#define INCOMING_RETURN_ADDR_RTX gen_rtx_MEM (Pmode, stack_pointer_rtx)
|
317 |
|
|
|
318 |
|
|
#define ACCUMULATE_OUTGOING_ARGS 1
|
319 |
|
|
|
320 |
|
|
typedef unsigned int CUMULATIVE_ARGS;
|
321 |
|
|
|
322 |
|
|
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
|
323 |
|
|
(CUM) = 0
|
324 |
|
|
|
325 |
|
|
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
|
326 |
|
|
rx_function_arg (& CUM, MODE, TYPE, NAMED)
|
327 |
|
|
|
328 |
|
|
#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
|
329 |
|
|
(CUM) += rx_function_arg_size (MODE, TYPE)
|
330 |
|
|
|
331 |
|
|
#define TRAMPOLINE_SIZE (! TARGET_BIG_ENDIAN_DATA ? 14 : 20)
|
332 |
|
|
#define TRAMPOLINE_ALIGNMENT 32
|
333 |
|
|
|
334 |
|
|
#define NO_PROFILE_COUNTERS 1
|
335 |
|
|
#define PROFILE_BEFORE_PROLOGUE 1
|
336 |
|
|
|
337 |
|
|
#define FUNCTION_PROFILER(FILE, LABELNO) \
|
338 |
|
|
fprintf (FILE, "\tbsr\t__mcount\n");
|
339 |
|
|
|
340 |
|
|
|
341 |
|
|
#define HARD_REGNO_NREGS(REGNO, MODE) CLASS_MAX_NREGS (0, MODE)
|
342 |
|
|
|
343 |
|
|
#define HARD_REGNO_MODE_OK(REGNO, MODE) \
|
344 |
|
|
REGNO_REG_CLASS (REGNO) == GR_REGS
|
345 |
|
|
|
346 |
|
|
#define MODES_TIEABLE_P(MODE1, MODE2) \
|
347 |
|
|
( ( GET_MODE_CLASS (MODE1) == MODE_FLOAT \
|
348 |
|
|
|| GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT) \
|
349 |
|
|
== ( GET_MODE_CLASS (MODE2) == MODE_FLOAT \
|
350 |
|
|
|| GET_MODE_CLASS (MODE2) == MODE_COMPLEX_FLOAT))
|
351 |
|
|
|
352 |
|
|
|
353 |
|
|
#define REGISTER_NAMES \
|
354 |
|
|
{ \
|
355 |
|
|
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
|
356 |
|
|
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "cc" \
|
357 |
|
|
};
|
358 |
|
|
|
359 |
|
|
#define ADDITIONAL_REGISTER_NAMES \
|
360 |
|
|
{ \
|
361 |
|
|
{ "sp", STACK_POINTER_REGNUM } \
|
362 |
|
|
, { "fp", FRAME_POINTER_REGNUM } \
|
363 |
|
|
, { "arg", ARG_POINTER_REGNUM } \
|
364 |
|
|
, { "chain", STATIC_CHAIN_REGNUM } \
|
365 |
|
|
}
|
366 |
|
|
|
367 |
|
|
#define DATA_SECTION_ASM_OP \
|
368 |
|
|
(TARGET_AS100_SYNTAX ? "\t.SECTION D,DATA" \
|
369 |
|
|
: "\t.section D,\"aw\",@progbits\n\t.p2align 2")
|
370 |
|
|
|
371 |
|
|
#define SDATA_SECTION_ASM_OP \
|
372 |
|
|
(TARGET_AS100_SYNTAX ? "\t.SECTION D_2,DATA,ALIGN=2" \
|
373 |
|
|
: "\t.section D_2,\"aw\",@progbits\n\t.p2align 1")
|
374 |
|
|
|
375 |
|
|
#undef READONLY_DATA_SECTION_ASM_OP
|
376 |
|
|
#define READONLY_DATA_SECTION_ASM_OP \
|
377 |
|
|
(TARGET_AS100_SYNTAX ? "\t.SECTION C,ROMDATA,ALIGN=4" \
|
378 |
|
|
: "\t.section C,\"a\",@progbits\n\t.p2align 2")
|
379 |
|
|
|
380 |
|
|
#define BSS_SECTION_ASM_OP \
|
381 |
|
|
(TARGET_AS100_SYNTAX ? "\t.SECTION B,DATA,ALIGN=4" \
|
382 |
|
|
: "\t.section B,\"w\",@nobits\n\t.p2align 2")
|
383 |
|
|
|
384 |
|
|
#define SBSS_SECTION_ASM_OP \
|
385 |
|
|
(TARGET_AS100_SYNTAX ? "\t.SECTION B_2,DATA,ALIGN=2" \
|
386 |
|
|
: "\t.section B_2,\"w\",@nobits\n\t.p2align 1")
|
387 |
|
|
|
388 |
|
|
/* The following definitions are conditional depending upon whether the
|
389 |
|
|
compiler is being built or crtstuff.c is being compiled by the built
|
390 |
|
|
compiler. */
|
391 |
|
|
#if defined CRT_BEGIN || defined CRT_END
|
392 |
|
|
# ifdef __RX_AS100_SYNTAX
|
393 |
|
|
# define TEXT_SECTION_ASM_OP "\t.SECTION P,CODE"
|
394 |
|
|
# define CTORS_SECTION_ASM_OP "\t.SECTION init_array,CODE"
|
395 |
|
|
# define DTORS_SECTION_ASM_OP "\t.SECTION fini_array,CODE"
|
396 |
|
|
# define INIT_ARRAY_SECTION_ASM_OP "\t.SECTION init_array,CODE"
|
397 |
|
|
# define FINI_ARRAY_SECTION_ASM_OP "\t.SECTION fini_array,CODE"
|
398 |
|
|
# else
|
399 |
|
|
# define TEXT_SECTION_ASM_OP "\t.section P,\"ax\""
|
400 |
|
|
# define CTORS_SECTION_ASM_OP \
|
401 |
|
|
"\t.section\t.init_array,\"aw\",@init_array"
|
402 |
|
|
# define DTORS_SECTION_ASM_OP \
|
403 |
|
|
"\t.section\t.fini_array,\"aw\",@fini_array"
|
404 |
|
|
# define INIT_ARRAY_SECTION_ASM_OP \
|
405 |
|
|
"\t.section\t.init_array,\"aw\",@init_array"
|
406 |
|
|
# define FINI_ARRAY_SECTION_ASM_OP \
|
407 |
|
|
"\t.section\t.fini_array,\"aw\",@fini_array"
|
408 |
|
|
# endif
|
409 |
|
|
#else
|
410 |
|
|
# define TEXT_SECTION_ASM_OP \
|
411 |
|
|
(TARGET_AS100_SYNTAX ? "\t.SECTION P,CODE" : "\t.section P,\"ax\"")
|
412 |
|
|
|
413 |
|
|
# define CTORS_SECTION_ASM_OP \
|
414 |
|
|
(TARGET_AS100_SYNTAX ? "\t.SECTION init_array,CODE" \
|
415 |
|
|
: "\t.section\t.init_array,\"aw\",@init_array")
|
416 |
|
|
|
417 |
|
|
# define DTORS_SECTION_ASM_OP \
|
418 |
|
|
(TARGET_AS100_SYNTAX ? "\t.SECTION fini_array,CODE" \
|
419 |
|
|
: "\t.section\t.fini_array,\"aw\",@fini_array")
|
420 |
|
|
|
421 |
|
|
# define INIT_ARRAY_SECTION_ASM_OP \
|
422 |
|
|
(TARGET_AS100_SYNTAX ? "\t.SECTION init_array,CODE" \
|
423 |
|
|
: "\t.section\t.init_array,\"aw\",@init_array")
|
424 |
|
|
|
425 |
|
|
# define FINI_ARRAY_SECTION_ASM_OP \
|
426 |
|
|
(TARGET_AS100_SYNTAX ? "\t.SECTION fini_array,CODE" \
|
427 |
|
|
: "\t.section\t.fini_array,\"aw\",@fini_array")
|
428 |
|
|
#endif
|
429 |
|
|
|
430 |
|
|
#define GLOBAL_ASM_OP \
|
431 |
|
|
(TARGET_AS100_SYNTAX ? "\t.GLB\t" : "\t.global\t")
|
432 |
|
|
#define ASM_COMMENT_START " ;"
|
433 |
|
|
#define ASM_APP_ON ""
|
434 |
|
|
#define ASM_APP_OFF ""
|
435 |
|
|
#define LOCAL_LABEL_PREFIX "L"
|
436 |
|
|
#undef USER_LABEL_PREFIX
|
437 |
|
|
#define USER_LABEL_PREFIX "_"
|
438 |
|
|
|
439 |
|
|
#define ASM_OUTPUT_ALIGN(STREAM, LOG) \
|
440 |
|
|
do \
|
441 |
|
|
{ \
|
442 |
|
|
if ((LOG) == 0) \
|
443 |
|
|
break; \
|
444 |
|
|
if (TARGET_AS100_SYNTAX) \
|
445 |
|
|
{ \
|
446 |
|
|
if ((LOG) >= 2) \
|
447 |
|
|
fprintf (STREAM, "\t.ALIGN 4\t; %d alignment actually requested\n", 1 << (LOG)); \
|
448 |
|
|
else \
|
449 |
|
|
fprintf (STREAM, "\t.ALIGN 2\n"); \
|
450 |
|
|
} \
|
451 |
|
|
else \
|
452 |
|
|
fprintf (STREAM, "\t.balign %d\n", 1 << (LOG)); \
|
453 |
|
|
} \
|
454 |
|
|
while (0)
|
455 |
|
|
|
456 |
|
|
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
|
457 |
|
|
fprintf (FILE, TARGET_AS100_SYNTAX ? "\t.LWORD L%d\n" : "\t.long .L%d\n", \
|
458 |
|
|
VALUE)
|
459 |
|
|
|
460 |
|
|
/* This is how to output an element of a case-vector that is relative.
|
461 |
|
|
Note: The local label referenced by the "3b" below is emitted by
|
462 |
|
|
the tablejump insn. */
|
463 |
|
|
|
464 |
|
|
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
|
465 |
|
|
fprintf (FILE, TARGET_AS100_SYNTAX \
|
466 |
|
|
? "\t.LWORD L%d - ?-\n" : "\t.long .L%d - 1b\n", VALUE)
|
467 |
|
|
|
468 |
|
|
#define ASM_OUTPUT_SIZE_DIRECTIVE(STREAM, NAME, SIZE) \
|
469 |
|
|
do \
|
470 |
|
|
{ \
|
471 |
|
|
HOST_WIDE_INT size_ = (SIZE); \
|
472 |
|
|
\
|
473 |
|
|
/* The as100 assembler does not have an equivalent of the SVR4 \
|
474 |
|
|
.size pseudo-op. */ \
|
475 |
|
|
if (TARGET_AS100_SYNTAX) \
|
476 |
|
|
break; \
|
477 |
|
|
\
|
478 |
|
|
fputs (SIZE_ASM_OP, STREAM); \
|
479 |
|
|
assemble_name (STREAM, NAME); \
|
480 |
|
|
fprintf (STREAM, ", " HOST_WIDE_INT_PRINT_DEC "\n", size_); \
|
481 |
|
|
} \
|
482 |
|
|
while (0)
|
483 |
|
|
|
484 |
|
|
#define ASM_OUTPUT_MEASURED_SIZE(STREAM, NAME) \
|
485 |
|
|
do \
|
486 |
|
|
{ \
|
487 |
|
|
/* The as100 assembler does not have an equivalent of the SVR4 \
|
488 |
|
|
.size pseudo-op. */ \
|
489 |
|
|
if (TARGET_AS100_SYNTAX) \
|
490 |
|
|
break; \
|
491 |
|
|
fputs (SIZE_ASM_OP, STREAM); \
|
492 |
|
|
assemble_name (STREAM, NAME); \
|
493 |
|
|
fputs (", .-", STREAM); \
|
494 |
|
|
assemble_name (STREAM, NAME); \
|
495 |
|
|
putc ('\n', STREAM); \
|
496 |
|
|
} \
|
497 |
|
|
while (0)
|
498 |
|
|
|
499 |
|
|
#define ASM_OUTPUT_TYPE_DIRECTIVE(STREAM, NAME, TYPE) \
|
500 |
|
|
do \
|
501 |
|
|
{ \
|
502 |
|
|
/* The as100 assembler does not have an equivalent of the SVR4 \
|
503 |
|
|
.size pseudo-op. */ \
|
504 |
|
|
if (TARGET_AS100_SYNTAX) \
|
505 |
|
|
break; \
|
506 |
|
|
fputs (TYPE_ASM_OP, STREAM); \
|
507 |
|
|
assemble_name (STREAM, NAME); \
|
508 |
|
|
fputs (", ", STREAM); \
|
509 |
|
|
fprintf (STREAM, TYPE_OPERAND_FMT, TYPE); \
|
510 |
|
|
putc ('\n', STREAM); \
|
511 |
|
|
} \
|
512 |
|
|
while (0)
|
513 |
|
|
|
514 |
|
|
#undef ASM_GENERATE_INTERNAL_LABEL
|
515 |
|
|
#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
|
516 |
|
|
do \
|
517 |
|
|
{ \
|
518 |
|
|
sprintf (LABEL, TARGET_AS100_SYNTAX ? "*%s%u" : "*.%s%u", \
|
519 |
|
|
PREFIX, (unsigned) (NUM)); \
|
520 |
|
|
} \
|
521 |
|
|
while (0)
|
522 |
|
|
|
523 |
|
|
#undef ASM_OUTPUT_EXTERNAL
|
524 |
|
|
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
|
525 |
|
|
do \
|
526 |
|
|
{ \
|
527 |
|
|
if (TARGET_AS100_SYNTAX) \
|
528 |
|
|
targetm.asm_out.globalize_label (FILE, NAME); \
|
529 |
|
|
default_elf_asm_output_external (FILE, DECL, NAME); \
|
530 |
|
|
} \
|
531 |
|
|
while (0)
|
532 |
|
|
|
533 |
|
|
#undef ASM_OUTPUT_ALIGNED_COMMON
|
534 |
|
|
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
|
535 |
|
|
do \
|
536 |
|
|
{ \
|
537 |
|
|
if (TARGET_AS100_SYNTAX) \
|
538 |
|
|
{ \
|
539 |
|
|
fprintf ((FILE), "\t.GLB\t"); \
|
540 |
|
|
assemble_name ((FILE), (NAME)); \
|
541 |
|
|
fprintf ((FILE), "\n"); \
|
542 |
|
|
assemble_name ((FILE), (NAME)); \
|
543 |
|
|
switch ((ALIGN) / BITS_PER_UNIT) \
|
544 |
|
|
{ \
|
545 |
|
|
case 4: \
|
546 |
|
|
fprintf ((FILE), ":\t.BLKL\t"HOST_WIDE_INT_PRINT_UNSIGNED"\n",\
|
547 |
|
|
(SIZE) / 4); \
|
548 |
|
|
break; \
|
549 |
|
|
case 2: \
|
550 |
|
|
fprintf ((FILE), ":\t.BLKW\t"HOST_WIDE_INT_PRINT_UNSIGNED"\n",\
|
551 |
|
|
(SIZE) / 2); \
|
552 |
|
|
break; \
|
553 |
|
|
default: \
|
554 |
|
|
fprintf ((FILE), ":\t.BLKB\t"HOST_WIDE_INT_PRINT_UNSIGNED"\n",\
|
555 |
|
|
(SIZE)); \
|
556 |
|
|
break; \
|
557 |
|
|
} \
|
558 |
|
|
} \
|
559 |
|
|
else \
|
560 |
|
|
{ \
|
561 |
|
|
fprintf ((FILE), "%s", COMMON_ASM_OP); \
|
562 |
|
|
assemble_name ((FILE), (NAME)); \
|
563 |
|
|
fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
|
564 |
|
|
(SIZE), (ALIGN) / BITS_PER_UNIT); \
|
565 |
|
|
} \
|
566 |
|
|
} \
|
567 |
|
|
while (0)
|
568 |
|
|
|
569 |
|
|
#undef SKIP_ASM_OP
|
570 |
|
|
#define SKIP_ASM_OP (TARGET_AS100_SYNTAX ? "\t.BLKB\t" : "\t.zero\t")
|
571 |
|
|
|
572 |
|
|
#undef ASM_OUTPUT_LIMITED_STRING
|
573 |
|
|
#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
|
574 |
|
|
do \
|
575 |
|
|
{ \
|
576 |
|
|
const unsigned char *_limited_str = \
|
577 |
|
|
(const unsigned char *) (STR); \
|
578 |
|
|
unsigned ch; \
|
579 |
|
|
\
|
580 |
|
|
fprintf ((FILE), TARGET_AS100_SYNTAX \
|
581 |
|
|
? "\t.BYTE\t\"" : "\t.string\t\""); \
|
582 |
|
|
\
|
583 |
|
|
for (; (ch = *_limited_str); _limited_str++) \
|
584 |
|
|
{ \
|
585 |
|
|
int escape; \
|
586 |
|
|
\
|
587 |
|
|
switch (escape = ESCAPES[ch]) \
|
588 |
|
|
{ \
|
589 |
|
|
case 0: \
|
590 |
|
|
putc (ch, (FILE)); \
|
591 |
|
|
break; \
|
592 |
|
|
case 1: \
|
593 |
|
|
fprintf ((FILE), "\\%03o", ch); \
|
594 |
|
|
break; \
|
595 |
|
|
default: \
|
596 |
|
|
putc ('\\', (FILE)); \
|
597 |
|
|
putc (escape, (FILE)); \
|
598 |
|
|
break; \
|
599 |
|
|
} \
|
600 |
|
|
} \
|
601 |
|
|
\
|
602 |
|
|
fprintf ((FILE), TARGET_AS100_SYNTAX ? "\"\n\t.BYTE\t0\n" : "\"\n");\
|
603 |
|
|
} \
|
604 |
|
|
while (0)
|
605 |
|
|
|
606 |
|
|
#undef IDENT_ASM_OP
|
607 |
|
|
#define IDENT_ASM_OP (TARGET_AS100_SYNTAX \
|
608 |
|
|
? "\t.END\t; Built by: ": "\t.ident\t")
|
609 |
|
|
|
610 |
|
|
/* For PIC put jump tables into the text section so that the offsets that
|
611 |
|
|
they contain are always computed between two same-section symbols. */
|
612 |
|
|
#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
|
613 |
|
|
|
614 |
|
|
#define PRINT_OPERAND(FILE, X, CODE) \
|
615 |
|
|
rx_print_operand (FILE, X, CODE)
|
616 |
|
|
#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
|
617 |
|
|
rx_print_operand_address (FILE, ADDR)
|
618 |
|
|
|
619 |
|
|
extern int rx_float_compare_mode;
|
620 |
|
|
|
621 |
|
|
/* This is a version of REG_P that also returns TRUE for SUBREGs. */
|
622 |
|
|
#define RX_REG_P(rtl) (REG_P (rtl) || GET_CODE (rtl) == SUBREG)
|
623 |
|
|
|
624 |
|
|
/* Like REG_P except that this macro is true for SET expressions. */
|
625 |
|
|
#define SET_P(rtl) (GET_CODE (rtl) == SET)
|
626 |
|
|
|
627 |
|
|
#define CAN_DEBUG_WITHOUT_FP 1
|
628 |
|
|
|
629 |
|
|
/* The AS100 assembler does not support .leb128 and .uleb128, but
|
630 |
|
|
the compiler-build-time configure tests will have enabled their
|
631 |
|
|
use because GAS supports them. So default to generating STABS
|
632 |
|
|
debug information instead of DWARF2 when generating AS100
|
633 |
|
|
compatible output. */
|
634 |
|
|
#undef PREFERRED_DEBUGGING_TYPE
|
635 |
|
|
#define PREFERRED_DEBUGGING_TYPE (TARGET_AS100_SYNTAX \
|
636 |
|
|
? DBX_DEBUG : DWARF2_DEBUG)
|
637 |
|
|
|
638 |
|
|
#define INCOMING_FRAME_SP_OFFSET 4
|
639 |
|
|
#define ARG_POINTER_CFA_OFFSET(FNDECL) 4
|
640 |
|
|
#define FRAME_POINTER_CFA_OFFSET(FNDECL) 4
|
641 |
|
|
|
642 |
|
|
/* Translate -nofpu into -mnofpu so that it gets passed from gcc to cc1. */
|
643 |
|
|
#define TARGET_OPTION_TRANSLATE_TABLE \
|
644 |
|
|
{"-nofpu", "-mnofpu" }
|
645 |
|
|
|
646 |
|
|
#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \
|
647 |
|
|
rx_set_optimization_options ()
|
648 |
|
|
|
649 |
|
|
#define TARGET_USE_FPU (! TARGET_NO_USE_FPU)
|
650 |
|
|
|
651 |
|
|
/* This macro is used to decide when RX FPU instructions can be used. */
|
652 |
|
|
#define ALLOW_RX_FPU_INSNS (TARGET_USE_FPU)
|
653 |
|
|
|
654 |
|
|
#define BRANCH_COST(SPEED, PREDICT) 1
|
655 |
|
|
#define REGISTER_MOVE_COST(MODE, FROM, TO) 2
|
656 |
|
|
#define MEMORY_MOVE_COST(MODE, REGCLASS, IN) (2 + memory_move_secondary_cost (MODE, REGCLASS, IN))
|
657 |
|
|
|
658 |
|
|
#define SELECT_CC_MODE(OP,X,Y) \
|
659 |
|
|
(GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT ? CC_ZSmode : \
|
660 |
|
|
(GET_CODE (X) == PLUS || GET_CODE (X) == MINUS ? CC_ZSCmode : \
|
661 |
|
|
(GET_CODE (X) == ABS ? CC_ZSOmode : \
|
662 |
|
|
(GET_CODE (X) == AND || GET_CODE (X) == NOT || GET_CODE (X) == IOR \
|
663 |
|
|
|| GET_CODE (X) == XOR || GET_CODE (X) == ROTATE \
|
664 |
|
|
|| GET_CODE (X) == ROTATERT || GET_CODE (X) == ASHIFTRT \
|
665 |
|
|
|| GET_CODE (X) == LSHIFTRT || GET_CODE (X) == ASHIFT ? CC_ZSmode : \
|
666 |
|
|
CCmode))))
|