1 |
38 |
julius |
/* Definitions of target machine for GNU compiler, Argonaut ARC cpu.
|
2 |
|
|
Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005,
|
3 |
|
|
2007 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
|
8 |
|
|
it under the terms of the GNU General Public License as published by
|
9 |
|
|
the Free Software Foundation; either version 3, or (at your option)
|
10 |
|
|
any later version.
|
11 |
|
|
|
12 |
|
|
GCC is distributed in the hope that it will be useful,
|
13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
GNU General Public 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 |
|
|
/* ??? This is an old port, and is undoubtedly suffering from bit rot. */
|
22 |
|
|
|
23 |
|
|
/* Things to do:
|
24 |
|
|
|
25 |
|
|
- incscc, decscc?
|
26 |
|
|
- print active compiler options in assembler output
|
27 |
|
|
*/
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
#undef ASM_SPEC
|
31 |
|
|
#undef LINK_SPEC
|
32 |
|
|
#undef STARTFILE_SPEC
|
33 |
|
|
#undef ENDFILE_SPEC
|
34 |
|
|
#undef SIZE_TYPE
|
35 |
|
|
#undef PTRDIFF_TYPE
|
36 |
|
|
#undef WCHAR_TYPE
|
37 |
|
|
#undef WCHAR_TYPE_SIZE
|
38 |
|
|
#undef ASM_OUTPUT_LABELREF
|
39 |
|
|
|
40 |
|
|
/* Print subsidiary information on the compiler version in use. */
|
41 |
|
|
#define TARGET_VERSION fprintf (stderr, " (arc)")
|
42 |
|
|
|
43 |
|
|
/* Names to predefine in the preprocessor for this target machine. */
|
44 |
|
|
#define TARGET_CPU_CPP_BUILTINS() \
|
45 |
|
|
do \
|
46 |
|
|
{ \
|
47 |
|
|
builtin_define ("__arc__"); \
|
48 |
|
|
if (TARGET_BIG_ENDIAN) \
|
49 |
|
|
builtin_define ("__big_endian__"); \
|
50 |
|
|
if (arc_cpu_type == 0) \
|
51 |
|
|
builtin_define ("__base__"); \
|
52 |
|
|
builtin_assert ("cpu=arc"); \
|
53 |
|
|
builtin_assert ("machine=arc"); \
|
54 |
|
|
} while (0)
|
55 |
|
|
|
56 |
|
|
/* Pass -mmangle-cpu if we get -mcpu=*.
|
57 |
|
|
Doing it this way lets one have it on as default with -mcpu=*,
|
58 |
|
|
but also lets one turn it off with -mno-mangle-cpu. */
|
59 |
|
|
#define CC1_SPEC "\
|
60 |
|
|
%{mcpu=*:-mmangle-cpu} \
|
61 |
|
|
%{EB:%{EL:%emay not use both -EB and -EL}} \
|
62 |
|
|
%{EB:-mbig-endian} %{EL:-mlittle-endian} \
|
63 |
|
|
"
|
64 |
|
|
|
65 |
|
|
#define ASM_SPEC "%{v} %{EB} %{EL}"
|
66 |
|
|
|
67 |
|
|
#define LINK_SPEC "%{v} %{EB} %{EL}"
|
68 |
|
|
|
69 |
|
|
#define STARTFILE_SPEC "%{!shared:crt0.o%s} crtinit.o%s"
|
70 |
|
|
|
71 |
|
|
#define ENDFILE_SPEC "crtfini.o%s"
|
72 |
|
|
|
73 |
|
|
/* Instruction set characteristics.
|
74 |
|
|
These are internal macros, set by the appropriate -mcpu= option. */
|
75 |
|
|
|
76 |
|
|
/* Nonzero means the cpu has a barrel shifter. */
|
77 |
|
|
#define TARGET_SHIFTER 0
|
78 |
|
|
|
79 |
|
|
/* Which cpu we're compiling for. */
|
80 |
|
|
extern int arc_cpu_type;
|
81 |
|
|
|
82 |
|
|
/* Check if CPU is an extension and set `arc_cpu_type' and `arc_mangle_cpu'
|
83 |
|
|
appropriately. The result should be nonzero if the cpu is recognized,
|
84 |
|
|
otherwise zero. This is intended to be redefined in a cover file.
|
85 |
|
|
This is used by arc_init. */
|
86 |
|
|
#define ARC_EXTENSION_CPU(cpu) 0
|
87 |
|
|
|
88 |
|
|
/* Sometimes certain combinations of command options do not make
|
89 |
|
|
sense on a particular target machine. You can define a macro
|
90 |
|
|
`OVERRIDE_OPTIONS' to take account of this. This macro, if
|
91 |
|
|
defined, is executed once just after all the command options have
|
92 |
|
|
been parsed.
|
93 |
|
|
|
94 |
|
|
Don't use this macro to turn on various extra optimizations for
|
95 |
|
|
`-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
#define OVERRIDE_OPTIONS \
|
99 |
|
|
do { \
|
100 |
|
|
/* These need to be done at start up. It's convenient to do them here. */ \
|
101 |
|
|
arc_init (); \
|
102 |
|
|
} while (0)
|
103 |
|
|
|
104 |
|
|
/* Target machine storage layout. */
|
105 |
|
|
|
106 |
|
|
/* Define this if most significant bit is lowest numbered
|
107 |
|
|
in instructions that operate on numbered bit-fields. */
|
108 |
|
|
#define BITS_BIG_ENDIAN 1
|
109 |
|
|
|
110 |
|
|
/* Define this if most significant byte of a word is the lowest numbered. */
|
111 |
|
|
#define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
|
112 |
|
|
|
113 |
|
|
/* Define this if most significant word of a multiword number is the lowest
|
114 |
|
|
numbered. */
|
115 |
|
|
#define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
|
116 |
|
|
|
117 |
|
|
/* Define this to set the endianness to use in libgcc2.c, which can
|
118 |
|
|
not depend on target_flags. */
|
119 |
|
|
#ifdef __big_endian__
|
120 |
|
|
#define LIBGCC2_WORDS_BIG_ENDIAN 1
|
121 |
|
|
#else
|
122 |
|
|
#define LIBGCC2_WORDS_BIG_ENDIAN 0
|
123 |
|
|
#endif
|
124 |
|
|
|
125 |
|
|
/* Width of a word, in units (bytes). */
|
126 |
|
|
#define UNITS_PER_WORD 4
|
127 |
|
|
|
128 |
|
|
/* Define this macro if it is advisable to hold scalars in registers
|
129 |
|
|
in a wider mode than that declared by the program. In such cases,
|
130 |
|
|
the value is constrained to be within the bounds of the declared
|
131 |
|
|
type, but kept valid in the wider mode. The signedness of the
|
132 |
|
|
extension may differ from that of the type. */
|
133 |
|
|
#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
|
134 |
|
|
if (GET_MODE_CLASS (MODE) == MODE_INT \
|
135 |
|
|
&& GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
|
136 |
|
|
{ \
|
137 |
|
|
(MODE) = SImode; \
|
138 |
|
|
}
|
139 |
|
|
|
140 |
|
|
/* Allocation boundary (in *bits*) for storing arguments in argument list. */
|
141 |
|
|
#define PARM_BOUNDARY 32
|
142 |
|
|
|
143 |
|
|
/* Boundary (in *bits*) on which stack pointer should be aligned. */
|
144 |
|
|
#define STACK_BOUNDARY 64
|
145 |
|
|
|
146 |
|
|
/* ALIGN FRAMES on word boundaries */
|
147 |
|
|
#define ARC_STACK_ALIGN(LOC) (((LOC)+7) & ~7)
|
148 |
|
|
|
149 |
|
|
/* Allocation boundary (in *bits*) for the code of a function. */
|
150 |
|
|
#define FUNCTION_BOUNDARY 32
|
151 |
|
|
|
152 |
|
|
/* Alignment of field after `int : 0' in a structure. */
|
153 |
|
|
#define EMPTY_FIELD_BOUNDARY 32
|
154 |
|
|
|
155 |
|
|
/* Every structure's size must be a multiple of this. */
|
156 |
|
|
#define STRUCTURE_SIZE_BOUNDARY 8
|
157 |
|
|
|
158 |
|
|
/* A bit-field declared as `int' forces `int' alignment for the struct. */
|
159 |
|
|
#define PCC_BITFIELD_TYPE_MATTERS 1
|
160 |
|
|
|
161 |
|
|
/* No data type wants to be aligned rounder than this. */
|
162 |
|
|
/* This is bigger than currently necessary for the ARC. If 8 byte floats are
|
163 |
|
|
ever added it's not clear whether they'll need such alignment or not. For
|
164 |
|
|
now we assume they will. We can always relax it if necessary but the
|
165 |
|
|
reverse isn't true. */
|
166 |
|
|
#define BIGGEST_ALIGNMENT 64
|
167 |
|
|
|
168 |
|
|
/* The best alignment to use in cases where we have a choice. */
|
169 |
|
|
#define FASTEST_ALIGNMENT 32
|
170 |
|
|
|
171 |
|
|
/* Make strings word-aligned so strcpy from constants will be faster. */
|
172 |
|
|
#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
|
173 |
|
|
((TREE_CODE (EXP) == STRING_CST \
|
174 |
|
|
&& (ALIGN) < FASTEST_ALIGNMENT) \
|
175 |
|
|
? FASTEST_ALIGNMENT : (ALIGN))
|
176 |
|
|
|
177 |
|
|
/* Make arrays of chars word-aligned for the same reasons. */
|
178 |
|
|
#define DATA_ALIGNMENT(TYPE, ALIGN) \
|
179 |
|
|
(TREE_CODE (TYPE) == ARRAY_TYPE \
|
180 |
|
|
&& TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
|
181 |
|
|
&& (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
|
182 |
|
|
|
183 |
|
|
/* Set this nonzero if move instructions will actually fail to work
|
184 |
|
|
when given unaligned data. */
|
185 |
|
|
/* On the ARC the lower address bits are masked to 0 as necessary. The chip
|
186 |
|
|
won't croak when given an unaligned address, but the insn will still fail
|
187 |
|
|
to produce the correct result. */
|
188 |
|
|
#define STRICT_ALIGNMENT 1
|
189 |
|
|
|
190 |
|
|
/* Layout of source language data types. */
|
191 |
|
|
|
192 |
|
|
#define SHORT_TYPE_SIZE 16
|
193 |
|
|
#define INT_TYPE_SIZE 32
|
194 |
|
|
#define LONG_TYPE_SIZE 32
|
195 |
|
|
#define LONG_LONG_TYPE_SIZE 64
|
196 |
|
|
#define FLOAT_TYPE_SIZE 32
|
197 |
|
|
#define DOUBLE_TYPE_SIZE 64
|
198 |
|
|
#define LONG_DOUBLE_TYPE_SIZE 64
|
199 |
|
|
|
200 |
|
|
/* Define this as 1 if `char' should by default be signed; else as 0. */
|
201 |
|
|
#define DEFAULT_SIGNED_CHAR 1
|
202 |
|
|
|
203 |
|
|
#define SIZE_TYPE "long unsigned int"
|
204 |
|
|
#define PTRDIFF_TYPE "long int"
|
205 |
|
|
#define WCHAR_TYPE "short unsigned int"
|
206 |
|
|
#define WCHAR_TYPE_SIZE 16
|
207 |
|
|
|
208 |
|
|
/* Standard register usage. */
|
209 |
|
|
|
210 |
|
|
/* Number of actual hardware registers.
|
211 |
|
|
The hardware registers are assigned numbers for the compiler
|
212 |
|
|
from 0 to just below FIRST_PSEUDO_REGISTER.
|
213 |
|
|
All registers that the compiler knows about must be given numbers,
|
214 |
|
|
even those that are not normally considered general registers. */
|
215 |
|
|
/* Registers 61, 62, and 63 are not really registers and we needn't treat
|
216 |
|
|
them as such. We still need a register for the condition code. */
|
217 |
|
|
#define FIRST_PSEUDO_REGISTER 62
|
218 |
|
|
|
219 |
|
|
/* 1 for registers that have pervasive standard uses
|
220 |
|
|
and are not available for the register allocator.
|
221 |
|
|
|
222 |
|
|
0-28 - general purpose registers
|
223 |
|
|
29 - ilink1 (interrupt link register)
|
224 |
|
|
30 - ilink2 (interrupt link register)
|
225 |
|
|
31 - blink (branch link register)
|
226 |
|
|
32-59 - reserved for extensions
|
227 |
|
|
60 - LP_COUNT
|
228 |
|
|
61 - condition code
|
229 |
|
|
|
230 |
|
|
For doc purposes:
|
231 |
|
|
61 - short immediate data indicator (setting flags)
|
232 |
|
|
62 - long immediate data indicator
|
233 |
|
|
63 - short immediate data indicator (not setting flags).
|
234 |
|
|
|
235 |
|
|
The general purpose registers are further broken down into:
|
236 |
|
|
0-7 - arguments/results
|
237 |
|
|
8-15 - call used
|
238 |
|
|
16-23 - call saved
|
239 |
|
|
24 - call used, static chain pointer
|
240 |
|
|
25 - call used, gptmp
|
241 |
|
|
26 - global pointer
|
242 |
|
|
27 - frame pointer
|
243 |
|
|
28 - stack pointer
|
244 |
|
|
|
245 |
|
|
By default, the extension registers are not available. */
|
246 |
|
|
|
247 |
|
|
#define FIXED_REGISTERS \
|
248 |
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, \
|
249 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, \
|
250 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, \
|
251 |
|
|
0, 0, 0, 1, 1, 1, 1, 0, \
|
252 |
|
|
\
|
253 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, \
|
254 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, \
|
255 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, \
|
256 |
|
|
1, 1, 1, 1, 1, 1 }
|
257 |
|
|
|
258 |
|
|
/* 1 for registers not available across function calls.
|
259 |
|
|
These must include the FIXED_REGISTERS and also any
|
260 |
|
|
registers that can be used without being saved.
|
261 |
|
|
The latter must include the registers where values are returned
|
262 |
|
|
and the register where structure-value addresses are passed.
|
263 |
|
|
Aside from that, you can include as many other registers as you like. */
|
264 |
|
|
|
265 |
|
|
#define CALL_USED_REGISTERS \
|
266 |
|
|
{ 1, 1, 1, 1, 1, 1, 1, 1, \
|
267 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, \
|
268 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, \
|
269 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, \
|
270 |
|
|
\
|
271 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, \
|
272 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, \
|
273 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, \
|
274 |
|
|
1, 1, 1, 1, 1, 1 }
|
275 |
|
|
|
276 |
|
|
/* If defined, an initializer for a vector of integers, containing the
|
277 |
|
|
numbers of hard registers in the order in which GCC should
|
278 |
|
|
prefer to use them (from most preferred to least). */
|
279 |
|
|
#define REG_ALLOC_ORDER \
|
280 |
|
|
{ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, \
|
281 |
|
|
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 31, \
|
282 |
|
|
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, \
|
283 |
|
|
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, \
|
284 |
|
|
27, 28, 29, 30 }
|
285 |
|
|
|
286 |
|
|
/* Macro to conditionally modify fixed_regs/call_used_regs. */
|
287 |
|
|
#define CONDITIONAL_REGISTER_USAGE \
|
288 |
|
|
do { \
|
289 |
|
|
if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) \
|
290 |
|
|
{ \
|
291 |
|
|
fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
|
292 |
|
|
call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
|
293 |
|
|
} \
|
294 |
|
|
} while (0)
|
295 |
|
|
|
296 |
|
|
/* Return number of consecutive hard regs needed starting at reg REGNO
|
297 |
|
|
to hold something of mode MODE.
|
298 |
|
|
This is ordinarily the length in words of a value of mode MODE
|
299 |
|
|
but can be less for certain modes in special long registers. */
|
300 |
|
|
#define HARD_REGNO_NREGS(REGNO, MODE) \
|
301 |
|
|
((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
|
302 |
|
|
|
303 |
|
|
/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
|
304 |
|
|
extern const unsigned int arc_hard_regno_mode_ok[];
|
305 |
|
|
extern unsigned int arc_mode_class[];
|
306 |
|
|
#define HARD_REGNO_MODE_OK(REGNO, MODE) \
|
307 |
|
|
((arc_hard_regno_mode_ok[REGNO] & arc_mode_class[MODE]) != 0)
|
308 |
|
|
|
309 |
|
|
/* A C expression that is nonzero if it is desirable to choose
|
310 |
|
|
register allocation so as to avoid move instructions between a
|
311 |
|
|
value of mode MODE1 and a value of mode MODE2.
|
312 |
|
|
|
313 |
|
|
If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
|
314 |
|
|
MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1,
|
315 |
|
|
MODE2)' must be zero. */
|
316 |
|
|
|
317 |
|
|
/* Tie QI/HI/SI modes together. */
|
318 |
|
|
#define MODES_TIEABLE_P(MODE1, MODE2) \
|
319 |
|
|
(GET_MODE_CLASS (MODE1) == MODE_INT \
|
320 |
|
|
&& GET_MODE_CLASS (MODE2) == MODE_INT \
|
321 |
|
|
&& GET_MODE_SIZE (MODE1) <= UNITS_PER_WORD \
|
322 |
|
|
&& GET_MODE_SIZE (MODE2) <= UNITS_PER_WORD)
|
323 |
|
|
|
324 |
|
|
/* Register classes and constants. */
|
325 |
|
|
|
326 |
|
|
/* Define the classes of registers for register constraints in the
|
327 |
|
|
machine description. Also define ranges of constants.
|
328 |
|
|
|
329 |
|
|
One of the classes must always be named ALL_REGS and include all hard regs.
|
330 |
|
|
If there is more than one class, another class must be named NO_REGS
|
331 |
|
|
and contain no registers.
|
332 |
|
|
|
333 |
|
|
The name GENERAL_REGS must be the name of a class (or an alias for
|
334 |
|
|
another name such as ALL_REGS). This is the class of registers
|
335 |
|
|
that is allowed by "g" or "r" in a register constraint.
|
336 |
|
|
Also, registers outside this class are allocated only when
|
337 |
|
|
instructions express preferences for them.
|
338 |
|
|
|
339 |
|
|
The classes must be numbered in nondecreasing order; that is,
|
340 |
|
|
a larger-numbered class must never be contained completely
|
341 |
|
|
in a smaller-numbered class.
|
342 |
|
|
|
343 |
|
|
For any two classes, it is very desirable that there be another
|
344 |
|
|
class that represents their union.
|
345 |
|
|
|
346 |
|
|
It is important that any condition codes have class NO_REGS.
|
347 |
|
|
See `register_operand'. */
|
348 |
|
|
|
349 |
|
|
enum reg_class {
|
350 |
|
|
NO_REGS, LPCOUNT_REG, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES
|
351 |
|
|
};
|
352 |
|
|
|
353 |
|
|
#define N_REG_CLASSES (int) LIM_REG_CLASSES
|
354 |
|
|
|
355 |
|
|
/* Give names of register classes as strings for dump file. */
|
356 |
|
|
#define REG_CLASS_NAMES \
|
357 |
|
|
{ "NO_REGS", "LPCOUNT_REG", "GENERAL_REGS", "ALL_REGS" }
|
358 |
|
|
|
359 |
|
|
/* Define which registers fit in which classes.
|
360 |
|
|
This is an initializer for a vector of HARD_REG_SET
|
361 |
|
|
of length N_REG_CLASSES. */
|
362 |
|
|
|
363 |
|
|
#define REG_CLASS_CONTENTS \
|
364 |
|
|
{ {0, 0}, {0, 0x10000000}, {0xffffffff, 0xfffffff}, \
|
365 |
|
|
{0xffffffff, 0x1fffffff} }
|
366 |
|
|
|
367 |
|
|
/* The same information, inverted:
|
368 |
|
|
Return the class number of the smallest class containing
|
369 |
|
|
reg number REGNO. This could be a conditional expression
|
370 |
|
|
or could index an array. */
|
371 |
|
|
extern enum reg_class arc_regno_reg_class[FIRST_PSEUDO_REGISTER];
|
372 |
|
|
#define REGNO_REG_CLASS(REGNO) \
|
373 |
|
|
(arc_regno_reg_class[REGNO])
|
374 |
|
|
|
375 |
|
|
/* The class value for index registers, and the one for base regs. */
|
376 |
|
|
#define INDEX_REG_CLASS GENERAL_REGS
|
377 |
|
|
#define BASE_REG_CLASS GENERAL_REGS
|
378 |
|
|
|
379 |
|
|
/* Get reg_class from a letter such as appears in the machine description. */
|
380 |
|
|
#define REG_CLASS_FROM_LETTER(C) \
|
381 |
|
|
((C) == 'l' ? LPCOUNT_REG /* ??? needed? */ \
|
382 |
|
|
: NO_REGS)
|
383 |
|
|
|
384 |
|
|
/* These assume that REGNO is a hard or pseudo reg number.
|
385 |
|
|
They give nonzero only if REGNO is a hard reg of the suitable class
|
386 |
|
|
or a pseudo reg currently allocated to a suitable hard reg.
|
387 |
|
|
Since they use reg_renumber, they are safe only once reg_renumber
|
388 |
|
|
has been allocated, which happens in local-alloc.c. */
|
389 |
|
|
#define REGNO_OK_FOR_BASE_P(REGNO) \
|
390 |
|
|
((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
|
391 |
|
|
#define REGNO_OK_FOR_INDEX_P(REGNO) \
|
392 |
|
|
((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
|
393 |
|
|
|
394 |
|
|
/* Given an rtx X being reloaded into a reg required to be
|
395 |
|
|
in class CLASS, return the class of reg to actually use.
|
396 |
|
|
In general this is just CLASS; but on some machines
|
397 |
|
|
in some cases it is preferable to use a more restrictive class. */
|
398 |
|
|
#define PREFERRED_RELOAD_CLASS(X,CLASS) \
|
399 |
|
|
(CLASS)
|
400 |
|
|
|
401 |
|
|
/* Return the maximum number of consecutive registers
|
402 |
|
|
needed to represent mode MODE in a register of class CLASS. */
|
403 |
|
|
#define CLASS_MAX_NREGS(CLASS, MODE) \
|
404 |
|
|
((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
|
405 |
|
|
|
406 |
|
|
/* The letters I, J, K, L, M, N, O, P in a register constraint string
|
407 |
|
|
can be used to stand for particular ranges of immediate operands.
|
408 |
|
|
This macro defines what the ranges are.
|
409 |
|
|
C is the letter, and VALUE is a constant value.
|
410 |
|
|
Return 1 if VALUE is in the range specified by C. */
|
411 |
|
|
/* 'I' is used for short immediates (always signed).
|
412 |
|
|
'J' is used for long immediates.
|
413 |
|
|
'K' is used for any constant up to 64 bits (for 64x32 situations?). */
|
414 |
|
|
|
415 |
|
|
/* local to this file */
|
416 |
|
|
#define SMALL_INT(X) ((unsigned) ((X) + 0x100) < 0x200)
|
417 |
|
|
/* local to this file */
|
418 |
|
|
#define LARGE_INT(X) \
|
419 |
|
|
((X) >= (-(HOST_WIDE_INT) 0x7fffffff - 1) \
|
420 |
|
|
&& (unsigned HOST_WIDE_INT)(X) <= (unsigned HOST_WIDE_INT) 0xffffffff)
|
421 |
|
|
|
422 |
|
|
#define CONST_OK_FOR_LETTER_P(VALUE, C) \
|
423 |
|
|
((C) == 'I' ? SMALL_INT (VALUE) \
|
424 |
|
|
: (C) == 'J' ? LARGE_INT (VALUE) \
|
425 |
|
|
: (C) == 'K' ? 1 \
|
426 |
|
|
: 0)
|
427 |
|
|
|
428 |
|
|
/* Similar, but for floating constants, and defining letters G and H.
|
429 |
|
|
Here VALUE is the CONST_DOUBLE rtx itself. */
|
430 |
|
|
/* 'G' is used for integer values for the multiplication insns where the
|
431 |
|
|
operands are extended from 4 bytes to 8 bytes.
|
432 |
|
|
'H' is used when any 64 bit constant is allowed. */
|
433 |
|
|
#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
|
434 |
|
|
((C) == 'G' ? arc_double_limm_p (VALUE) \
|
435 |
|
|
: (C) == 'H' ? 1 \
|
436 |
|
|
: 0)
|
437 |
|
|
|
438 |
|
|
/* A C expression that defines the optional machine-dependent constraint
|
439 |
|
|
letters that can be used to segregate specific types of operands,
|
440 |
|
|
usually memory references, for the target machine. It should return 1 if
|
441 |
|
|
VALUE corresponds to the operand type represented by the constraint letter
|
442 |
|
|
C. If C is not defined as an extra constraint, the value returned should
|
443 |
|
|
be 0 regardless of VALUE. */
|
444 |
|
|
/* ??? This currently isn't used. Waiting for PIC. */
|
445 |
|
|
#if 0
|
446 |
|
|
#define EXTRA_CONSTRAINT(VALUE, C) \
|
447 |
|
|
((C) == 'R' ? (SYMBOL_REF_FUNCTION_P (VALUE) || GET_CODE (VALUE) == LABEL_REF) \
|
448 |
|
|
: 0)
|
449 |
|
|
#endif
|
450 |
|
|
|
451 |
|
|
/* Stack layout and stack pointer usage. */
|
452 |
|
|
|
453 |
|
|
/* Define this macro if pushing a word onto the stack moves the stack
|
454 |
|
|
pointer to a smaller address. */
|
455 |
|
|
#define STACK_GROWS_DOWNWARD
|
456 |
|
|
|
457 |
|
|
/* Define this to nonzero if the nominal address of the stack frame
|
458 |
|
|
is at the high-address end of the local variables;
|
459 |
|
|
that is, each additional local variable allocated
|
460 |
|
|
goes at a more negative offset in the frame. */
|
461 |
|
|
#define FRAME_GROWS_DOWNWARD 1
|
462 |
|
|
|
463 |
|
|
/* Offset within stack frame to start allocating local variables at.
|
464 |
|
|
If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
|
465 |
|
|
first local allocated. Otherwise, it is the offset to the BEGINNING
|
466 |
|
|
of the first local allocated. */
|
467 |
|
|
#define STARTING_FRAME_OFFSET 0
|
468 |
|
|
|
469 |
|
|
/* Offset from the stack pointer register to the first location at which
|
470 |
|
|
outgoing arguments are placed. */
|
471 |
|
|
#define STACK_POINTER_OFFSET FIRST_PARM_OFFSET (0)
|
472 |
|
|
|
473 |
|
|
/* Offset of first parameter from the argument pointer register value. */
|
474 |
|
|
/* 4 bytes for each of previous fp, return address, and previous gp.
|
475 |
|
|
4 byte reserved area for future considerations. */
|
476 |
|
|
#define FIRST_PARM_OFFSET(FNDECL) 16
|
477 |
|
|
|
478 |
|
|
/* A C expression whose value is RTL representing the address in a
|
479 |
|
|
stack frame where the pointer to the caller's frame is stored.
|
480 |
|
|
Assume that FRAMEADDR is an RTL expression for the address of the
|
481 |
|
|
stack frame itself.
|
482 |
|
|
|
483 |
|
|
If you don't define this macro, the default is to return the value
|
484 |
|
|
of FRAMEADDR--that is, the stack frame address is also the address
|
485 |
|
|
of the stack word that points to the previous frame. */
|
486 |
|
|
/* ??? unfinished */
|
487 |
|
|
/*define DYNAMIC_CHAIN_ADDRESS (FRAMEADDR)*/
|
488 |
|
|
|
489 |
|
|
/* A C expression whose value is RTL representing the value of the
|
490 |
|
|
return address for the frame COUNT steps up from the current frame.
|
491 |
|
|
FRAMEADDR is the frame pointer of the COUNT frame, or the frame
|
492 |
|
|
pointer of the COUNT - 1 frame if `RETURN_ADDR_IN_PREVIOUS_FRAME'
|
493 |
|
|
is defined. */
|
494 |
|
|
/* The current return address is in r31. The return address of anything
|
495 |
|
|
farther back is at [%fp,4]. */
|
496 |
|
|
#if 0 /* The default value should work. */
|
497 |
|
|
#define RETURN_ADDR_RTX(COUNT, FRAME) \
|
498 |
|
|
(((COUNT) == -1) \
|
499 |
|
|
? gen_rtx_REG (Pmode, 31) \
|
500 |
|
|
: copy_to_reg (gen_rtx_MEM (Pmode, \
|
501 |
|
|
memory_address (Pmode, \
|
502 |
|
|
plus_constant ((FRAME), \
|
503 |
|
|
UNITS_PER_WORD)))))
|
504 |
|
|
#endif
|
505 |
|
|
|
506 |
|
|
/* Register to use for pushing function arguments. */
|
507 |
|
|
#define STACK_POINTER_REGNUM 28
|
508 |
|
|
|
509 |
|
|
/* Base register for access to local variables of the function. */
|
510 |
|
|
#define FRAME_POINTER_REGNUM 27
|
511 |
|
|
|
512 |
|
|
/* Base register for access to arguments of the function. */
|
513 |
|
|
#define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM
|
514 |
|
|
|
515 |
|
|
/* Register in which static-chain is passed to a function. This must
|
516 |
|
|
not be a register used by the prologue. */
|
517 |
|
|
#define STATIC_CHAIN_REGNUM 24
|
518 |
|
|
|
519 |
|
|
/* A C expression which is nonzero if a function must have and use a
|
520 |
|
|
frame pointer. This expression is evaluated in the reload pass.
|
521 |
|
|
If its value is nonzero the function will have a frame pointer. */
|
522 |
|
|
#define FRAME_POINTER_REQUIRED \
|
523 |
|
|
(current_function_calls_alloca)
|
524 |
|
|
|
525 |
|
|
/* C statement to store the difference between the frame pointer
|
526 |
|
|
and the stack pointer values immediately after the function prologue. */
|
527 |
|
|
#define INITIAL_FRAME_POINTER_OFFSET(VAR) \
|
528 |
|
|
((VAR) = arc_compute_frame_size (get_frame_size ()))
|
529 |
|
|
|
530 |
|
|
/* Function argument passing. */
|
531 |
|
|
|
532 |
|
|
/* If defined, the maximum amount of space required for outgoing
|
533 |
|
|
arguments will be computed and placed into the variable
|
534 |
|
|
`current_function_outgoing_args_size'. No space will be pushed
|
535 |
|
|
onto the stack for each call; instead, the function prologue should
|
536 |
|
|
increase the stack frame size by this amount. */
|
537 |
|
|
#define ACCUMULATE_OUTGOING_ARGS 1
|
538 |
|
|
|
539 |
|
|
/* Value is the number of bytes of arguments automatically
|
540 |
|
|
popped when returning from a subroutine call.
|
541 |
|
|
FUNDECL is the declaration node of the function (as a tree),
|
542 |
|
|
FUNTYPE is the data type of the function (as a tree),
|
543 |
|
|
or for a library call it is an identifier node for the subroutine name.
|
544 |
|
|
SIZE is the number of bytes of arguments passed on the stack. */
|
545 |
|
|
#define RETURN_POPS_ARGS(DECL, FUNTYPE, SIZE) 0
|
546 |
|
|
|
547 |
|
|
/* Define a data type for recording info about an argument list
|
548 |
|
|
during the scan of that argument list. This data type should
|
549 |
|
|
hold all necessary information about the function itself
|
550 |
|
|
and about the args processed so far, enough to enable macros
|
551 |
|
|
such as FUNCTION_ARG to determine where the next arg should go. */
|
552 |
|
|
#define CUMULATIVE_ARGS int
|
553 |
|
|
|
554 |
|
|
/* Initialize a variable CUM of type CUMULATIVE_ARGS
|
555 |
|
|
for a call to a function whose data type is FNTYPE.
|
556 |
|
|
For a library call, FNTYPE is 0. */
|
557 |
|
|
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
|
558 |
|
|
((CUM) = 0)
|
559 |
|
|
|
560 |
|
|
/* The number of registers used for parameter passing. Local to this file. */
|
561 |
|
|
#define MAX_ARC_PARM_REGS 8
|
562 |
|
|
|
563 |
|
|
/* 1 if N is a possible register number for function argument passing. */
|
564 |
|
|
#define FUNCTION_ARG_REGNO_P(N) \
|
565 |
|
|
((unsigned) (N) < MAX_ARC_PARM_REGS)
|
566 |
|
|
|
567 |
|
|
/* The ROUND_ADVANCE* macros are local to this file. */
|
568 |
|
|
/* Round SIZE up to a word boundary. */
|
569 |
|
|
#define ROUND_ADVANCE(SIZE) \
|
570 |
|
|
(((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
|
571 |
|
|
|
572 |
|
|
/* Round arg MODE/TYPE up to the next word boundary. */
|
573 |
|
|
#define ROUND_ADVANCE_ARG(MODE, TYPE) \
|
574 |
|
|
((MODE) == BLKmode \
|
575 |
|
|
? ROUND_ADVANCE (int_size_in_bytes (TYPE)) \
|
576 |
|
|
: ROUND_ADVANCE (GET_MODE_SIZE (MODE)))
|
577 |
|
|
|
578 |
|
|
/* Round CUM up to the necessary point for argument MODE/TYPE. */
|
579 |
|
|
#define ROUND_ADVANCE_CUM(CUM, MODE, TYPE) \
|
580 |
|
|
((((MODE) == BLKmode ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) \
|
581 |
|
|
> BITS_PER_WORD) \
|
582 |
|
|
? (((CUM) + 1) & ~1) \
|
583 |
|
|
: (CUM))
|
584 |
|
|
|
585 |
|
|
/* Return boolean indicating arg of type TYPE and mode MODE will be passed in
|
586 |
|
|
a reg. This includes arguments that have to be passed by reference as the
|
587 |
|
|
pointer to them is passed in a reg if one is available (and that is what
|
588 |
|
|
we're given).
|
589 |
|
|
This macro is only used in this file. */
|
590 |
|
|
#define PASS_IN_REG_P(CUM, MODE, TYPE) \
|
591 |
|
|
((CUM) < MAX_ARC_PARM_REGS \
|
592 |
|
|
&& ((ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) \
|
593 |
|
|
+ ROUND_ADVANCE_ARG ((MODE), (TYPE)) \
|
594 |
|
|
<= MAX_ARC_PARM_REGS)))
|
595 |
|
|
|
596 |
|
|
/* Determine where to put an argument to a function.
|
597 |
|
|
Value is zero to push the argument on the stack,
|
598 |
|
|
or a hard register in which to store the argument.
|
599 |
|
|
|
600 |
|
|
MODE is the argument's machine mode.
|
601 |
|
|
TYPE is the data type of the argument (as a tree).
|
602 |
|
|
This is null for libcalls where that information may
|
603 |
|
|
not be available.
|
604 |
|
|
CUM is a variable of type CUMULATIVE_ARGS which gives info about
|
605 |
|
|
the preceding args and about the function being called.
|
606 |
|
|
NAMED is nonzero if this argument is a named parameter
|
607 |
|
|
(otherwise it is an extra parameter matching an ellipsis). */
|
608 |
|
|
/* On the ARC the first MAX_ARC_PARM_REGS args are normally in registers
|
609 |
|
|
and the rest are pushed. */
|
610 |
|
|
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
|
611 |
|
|
(PASS_IN_REG_P ((CUM), (MODE), (TYPE)) \
|
612 |
|
|
? gen_rtx_REG ((MODE), ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE))) \
|
613 |
|
|
: 0)
|
614 |
|
|
|
615 |
|
|
/* Update the data in CUM to advance over an argument
|
616 |
|
|
of mode MODE and data type TYPE.
|
617 |
|
|
(TYPE is null for libcalls where that information may not be available.) */
|
618 |
|
|
#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
|
619 |
|
|
((CUM) = (ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) \
|
620 |
|
|
+ ROUND_ADVANCE_ARG ((MODE), (TYPE))))
|
621 |
|
|
|
622 |
|
|
/* If defined, a C expression that gives the alignment boundary, in bits,
|
623 |
|
|
of an argument with the specified mode and type. If it is not defined,
|
624 |
|
|
PARM_BOUNDARY is used for all arguments. */
|
625 |
|
|
#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
|
626 |
|
|
(((TYPE) ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) <= PARM_BOUNDARY \
|
627 |
|
|
? PARM_BOUNDARY \
|
628 |
|
|
: 2 * PARM_BOUNDARY)
|
629 |
|
|
|
630 |
|
|
/* Function results. */
|
631 |
|
|
|
632 |
|
|
/* Define how to find the value returned by a function.
|
633 |
|
|
VALTYPE is the data type of the value (as a tree).
|
634 |
|
|
If the precise function being called is known, FUNC is its FUNCTION_DECL;
|
635 |
|
|
otherwise, FUNC is 0. */
|
636 |
|
|
#define FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx_REG (TYPE_MODE (VALTYPE), 0)
|
637 |
|
|
|
638 |
|
|
/* Define how to find the value returned by a library function
|
639 |
|
|
assuming the value has mode MODE. */
|
640 |
|
|
#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, 0)
|
641 |
|
|
|
642 |
|
|
/* 1 if N is a possible register number for a function value
|
643 |
|
|
as seen by the caller. */
|
644 |
|
|
/* ??? What about r1 in DI/DF values. */
|
645 |
|
|
#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
|
646 |
|
|
|
647 |
|
|
/* Tell GCC to use TARGET_RETURN_IN_MEMORY. */
|
648 |
|
|
#define DEFAULT_PCC_STRUCT_RETURN 0
|
649 |
|
|
|
650 |
|
|
/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
|
651 |
|
|
the stack pointer does not matter. The value is tested only in
|
652 |
|
|
functions that have frame pointers.
|
653 |
|
|
No definition is equivalent to always zero. */
|
654 |
|
|
#define EXIT_IGNORE_STACK 0
|
655 |
|
|
|
656 |
|
|
/* Epilogue delay slots. */
|
657 |
|
|
#define DELAY_SLOTS_FOR_EPILOGUE arc_delay_slots_for_epilogue ()
|
658 |
|
|
|
659 |
|
|
#define ELIGIBLE_FOR_EPILOGUE_DELAY(TRIAL, SLOTS_FILLED) \
|
660 |
|
|
arc_eligible_for_epilogue_delay (TRIAL, SLOTS_FILLED)
|
661 |
|
|
|
662 |
|
|
/* Output assembler code to FILE to increment profiler label # LABELNO
|
663 |
|
|
for profiling a function entry. */
|
664 |
|
|
#define FUNCTION_PROFILER(FILE, LABELNO)
|
665 |
|
|
|
666 |
|
|
/* Trampolines. */
|
667 |
|
|
/* ??? This doesn't work yet because GCC will use as the address of a nested
|
668 |
|
|
function the address of the trampoline. We need to use that address
|
669 |
|
|
right shifted by 2. It looks like we'll need PSImode after all. :-( */
|
670 |
|
|
|
671 |
|
|
/* Output assembler code for a block containing the constant parts
|
672 |
|
|
of a trampoline, leaving space for the variable parts. */
|
673 |
|
|
/* On the ARC, the trampoline is quite simple as we have 32 bit immediate
|
674 |
|
|
constants.
|
675 |
|
|
|
676 |
|
|
mov r24,STATIC
|
677 |
|
|
j.nd FUNCTION
|
678 |
|
|
*/
|
679 |
|
|
#define TRAMPOLINE_TEMPLATE(FILE) \
|
680 |
|
|
do { \
|
681 |
|
|
assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x631f7c00)); \
|
682 |
|
|
assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \
|
683 |
|
|
assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x381f0000)); \
|
684 |
|
|
assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \
|
685 |
|
|
} while (0)
|
686 |
|
|
|
687 |
|
|
/* Length in units of the trampoline for entering a nested function. */
|
688 |
|
|
#define TRAMPOLINE_SIZE 16
|
689 |
|
|
|
690 |
|
|
/* Emit RTL insns to initialize the variable parts of a trampoline.
|
691 |
|
|
FNADDR is an RTX for the address of the function's pure code.
|
692 |
|
|
CXT is an RTX for the static chain value for the function. */
|
693 |
|
|
#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
|
694 |
|
|
do { \
|
695 |
|
|
emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 4)), CXT); \
|
696 |
|
|
emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 12)), FNADDR); \
|
697 |
|
|
emit_insn (gen_flush_icache (validize_mem (gen_rtx_MEM (SImode, TRAMP)))); \
|
698 |
|
|
} while (0)
|
699 |
|
|
|
700 |
|
|
/* Addressing modes, and classification of registers for them. */
|
701 |
|
|
|
702 |
|
|
/* Maximum number of registers that can appear in a valid memory address. */
|
703 |
|
|
/* The `ld' insn allows 2, but the `st' insn only allows 1. */
|
704 |
|
|
#define MAX_REGS_PER_ADDRESS 1
|
705 |
|
|
|
706 |
|
|
/* We have pre inc/dec (load/store with update). */
|
707 |
|
|
#define HAVE_PRE_INCREMENT 1
|
708 |
|
|
#define HAVE_PRE_DECREMENT 1
|
709 |
|
|
|
710 |
|
|
/* Recognize any constant value that is a valid address. */
|
711 |
|
|
#define CONSTANT_ADDRESS_P(X) \
|
712 |
|
|
(GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
|
713 |
|
|
|| GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST)
|
714 |
|
|
|
715 |
|
|
/* Nonzero if the constant value X is a legitimate general operand.
|
716 |
|
|
We can handle any 32 or 64 bit constant. */
|
717 |
|
|
/* "1" should work since the largest constant should be a 64 bit critter. */
|
718 |
|
|
/* ??? Not sure what to do for 64x32 compiler. */
|
719 |
|
|
#define LEGITIMATE_CONSTANT_P(X) 1
|
720 |
|
|
|
721 |
|
|
/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
|
722 |
|
|
and check its validity for a certain class.
|
723 |
|
|
We have two alternate definitions for each of them.
|
724 |
|
|
The usual definition accepts all pseudo regs; the other rejects
|
725 |
|
|
them unless they have been allocated suitable hard regs.
|
726 |
|
|
The symbol REG_OK_STRICT causes the latter definition to be used.
|
727 |
|
|
|
728 |
|
|
Most source files want to accept pseudo regs in the hope that
|
729 |
|
|
they will get allocated to the class that the insn wants them to be in.
|
730 |
|
|
Source files for reload pass need to be strict.
|
731 |
|
|
After reload, it makes no difference, since pseudo regs have
|
732 |
|
|
been eliminated by then. */
|
733 |
|
|
|
734 |
|
|
#ifndef REG_OK_STRICT
|
735 |
|
|
|
736 |
|
|
/* Nonzero if X is a hard reg that can be used as an index
|
737 |
|
|
or if it is a pseudo reg. */
|
738 |
|
|
#define REG_OK_FOR_INDEX_P(X) \
|
739 |
|
|
((unsigned) REGNO (X) - 32 >= FIRST_PSEUDO_REGISTER - 32)
|
740 |
|
|
/* Nonzero if X is a hard reg that can be used as a base reg
|
741 |
|
|
or if it is a pseudo reg. */
|
742 |
|
|
#define REG_OK_FOR_BASE_P(X) \
|
743 |
|
|
((unsigned) REGNO (X) - 32 >= FIRST_PSEUDO_REGISTER - 32)
|
744 |
|
|
|
745 |
|
|
#else
|
746 |
|
|
|
747 |
|
|
/* Nonzero if X is a hard reg that can be used as an index. */
|
748 |
|
|
#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
|
749 |
|
|
/* Nonzero if X is a hard reg that can be used as a base reg. */
|
750 |
|
|
#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
|
751 |
|
|
|
752 |
|
|
#endif
|
753 |
|
|
|
754 |
|
|
/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
|
755 |
|
|
that is a valid memory address for an instruction.
|
756 |
|
|
The MODE argument is the machine mode for the MEM expression
|
757 |
|
|
that wants to use this address. */
|
758 |
|
|
/* The `ld' insn allows [reg],[reg+shimm],[reg+limm],[reg+reg],[limm]
|
759 |
|
|
but the `st' insn only allows [reg],[reg+shimm],[limm].
|
760 |
|
|
The only thing we can do is only allow the most strict case `st' and hope
|
761 |
|
|
other parts optimize out the restrictions for `ld'. */
|
762 |
|
|
|
763 |
|
|
/* local to this file */
|
764 |
|
|
#define RTX_OK_FOR_BASE_P(X) \
|
765 |
|
|
(REG_P (X) && REG_OK_FOR_BASE_P (X))
|
766 |
|
|
|
767 |
|
|
/* local to this file */
|
768 |
|
|
#define RTX_OK_FOR_INDEX_P(X) \
|
769 |
|
|
(0 && /*???*/ REG_P (X) && REG_OK_FOR_INDEX_P (X))
|
770 |
|
|
|
771 |
|
|
/* local to this file */
|
772 |
|
|
/* ??? Loads can handle any constant, stores can only handle small ones. */
|
773 |
|
|
#define RTX_OK_FOR_OFFSET_P(X) \
|
774 |
|
|
(GET_CODE (X) == CONST_INT && SMALL_INT (INTVAL (X)))
|
775 |
|
|
|
776 |
|
|
#define LEGITIMATE_OFFSET_ADDRESS_P(MODE, X) \
|
777 |
|
|
(GET_CODE (X) == PLUS \
|
778 |
|
|
&& RTX_OK_FOR_BASE_P (XEXP (X, 0)) \
|
779 |
|
|
&& (RTX_OK_FOR_INDEX_P (XEXP (X, 1)) \
|
780 |
|
|
|| RTX_OK_FOR_OFFSET_P (XEXP (X, 1))))
|
781 |
|
|
|
782 |
|
|
#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
|
783 |
|
|
{ if (RTX_OK_FOR_BASE_P (X)) \
|
784 |
|
|
goto ADDR; \
|
785 |
|
|
if (LEGITIMATE_OFFSET_ADDRESS_P ((MODE), (X))) \
|
786 |
|
|
goto ADDR; \
|
787 |
|
|
if (GET_CODE (X) == CONST_INT && LARGE_INT (INTVAL (X))) \
|
788 |
|
|
goto ADDR; \
|
789 |
|
|
if (GET_CODE (X) == SYMBOL_REF \
|
790 |
|
|
|| GET_CODE (X) == LABEL_REF \
|
791 |
|
|
|| GET_CODE (X) == CONST) \
|
792 |
|
|
goto ADDR; \
|
793 |
|
|
if ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == PRE_INC) \
|
794 |
|
|
/* We're restricted here by the `st' insn. */ \
|
795 |
|
|
&& RTX_OK_FOR_BASE_P (XEXP ((X), 0))) \
|
796 |
|
|
goto ADDR; \
|
797 |
|
|
}
|
798 |
|
|
|
799 |
|
|
/* Go to LABEL if ADDR (a legitimate address expression)
|
800 |
|
|
has an effect that depends on the machine mode it is used for. */
|
801 |
|
|
#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) \
|
802 |
|
|
{ if (GET_CODE (ADDR) == PRE_DEC) \
|
803 |
|
|
goto LABEL; \
|
804 |
|
|
if (GET_CODE (ADDR) == PRE_INC) \
|
805 |
|
|
goto LABEL; \
|
806 |
|
|
}
|
807 |
|
|
|
808 |
|
|
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
|
809 |
|
|
return the mode to be used for the comparison. */
|
810 |
|
|
#define SELECT_CC_MODE(OP, X, Y) \
|
811 |
|
|
arc_select_cc_mode (OP, X, Y)
|
812 |
|
|
|
813 |
|
|
/* Return nonzero if SELECT_CC_MODE will never return MODE for a
|
814 |
|
|
floating point inequality comparison. */
|
815 |
|
|
#define REVERSIBLE_CC_MODE(MODE) 1 /*???*/
|
816 |
|
|
|
817 |
|
|
/* Costs. */
|
818 |
|
|
|
819 |
|
|
/* Compute extra cost of moving data between one register class
|
820 |
|
|
and another. */
|
821 |
|
|
#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) 2
|
822 |
|
|
|
823 |
|
|
/* Compute the cost of moving data between registers and memory. */
|
824 |
|
|
/* Memory is 3 times as expensive as registers.
|
825 |
|
|
??? Is that the right way to look at it? */
|
826 |
|
|
#define MEMORY_MOVE_COST(MODE,CLASS,IN) \
|
827 |
|
|
(GET_MODE_SIZE (MODE) <= UNITS_PER_WORD ? 6 : 12)
|
828 |
|
|
|
829 |
|
|
/* The cost of a branch insn. */
|
830 |
|
|
/* ??? What's the right value here? Branches are certainly more
|
831 |
|
|
expensive than reg->reg moves. */
|
832 |
|
|
#define BRANCH_COST 2
|
833 |
|
|
|
834 |
|
|
/* Nonzero if access to memory by bytes is slow and undesirable.
|
835 |
|
|
For RISC chips, it means that access to memory by bytes is no
|
836 |
|
|
better than access by words when possible, so grab a whole word
|
837 |
|
|
and maybe make use of that. */
|
838 |
|
|
#define SLOW_BYTE_ACCESS 1
|
839 |
|
|
|
840 |
|
|
/* Define this macro if it is as good or better to call a constant
|
841 |
|
|
function address than to call an address kept in a register. */
|
842 |
|
|
/* On the ARC, calling through registers is slow. */
|
843 |
|
|
#define NO_FUNCTION_CSE
|
844 |
|
|
|
845 |
|
|
/* Section selection. */
|
846 |
|
|
/* WARNING: These section names also appear in dwarfout.c. */
|
847 |
|
|
|
848 |
|
|
/* The names of the text, data, and readonly-data sections are runtime
|
849 |
|
|
selectable. */
|
850 |
|
|
|
851 |
|
|
#define ARC_SECTION_FORMAT "\t.section %s"
|
852 |
|
|
#define ARC_DEFAULT_TEXT_SECTION ".text"
|
853 |
|
|
#define ARC_DEFAULT_DATA_SECTION ".data"
|
854 |
|
|
#define ARC_DEFAULT_RODATA_SECTION ".rodata"
|
855 |
|
|
|
856 |
|
|
extern const char *arc_text_section, *arc_data_section, *arc_rodata_section;
|
857 |
|
|
|
858 |
|
|
/* initfini.c uses this in an asm. */
|
859 |
|
|
#if defined (CRT_INIT) || defined (CRT_FINI)
|
860 |
|
|
#define TEXT_SECTION_ASM_OP "\t.section .text"
|
861 |
|
|
#else
|
862 |
|
|
#define TEXT_SECTION_ASM_OP arc_text_section
|
863 |
|
|
#endif
|
864 |
|
|
#define DATA_SECTION_ASM_OP arc_data_section
|
865 |
|
|
|
866 |
|
|
#undef READONLY_DATA_SECTION_ASM_OP
|
867 |
|
|
#define READONLY_DATA_SECTION_ASM_OP arc_rodata_section
|
868 |
|
|
|
869 |
|
|
#define BSS_SECTION_ASM_OP "\t.section .bss"
|
870 |
|
|
|
871 |
|
|
/* Define this macro if jump tables (for tablejump insns) should be
|
872 |
|
|
output in the text section, along with the assembler instructions.
|
873 |
|
|
Otherwise, the readonly data section is used.
|
874 |
|
|
This macro is irrelevant if there is no separate readonly data section. */
|
875 |
|
|
/*#define JUMP_TABLES_IN_TEXT_SECTION*/
|
876 |
|
|
|
877 |
|
|
/* For DWARF. Marginally different than default so output is "prettier"
|
878 |
|
|
(and consistent with above). */
|
879 |
|
|
#define PUSHSECTION_ASM_OP "\t.section "
|
880 |
|
|
|
881 |
|
|
/* Tell crtstuff.c we're using ELF. */
|
882 |
|
|
#define OBJECT_FORMAT_ELF
|
883 |
|
|
|
884 |
|
|
/* PIC */
|
885 |
|
|
|
886 |
|
|
/* The register number of the register used to address a table of static
|
887 |
|
|
data addresses in memory. In some cases this register is defined by a
|
888 |
|
|
processor's ``application binary interface'' (ABI). When this macro
|
889 |
|
|
is defined, RTL is generated for this register once, as with the stack
|
890 |
|
|
pointer and frame pointer registers. If this macro is not defined, it
|
891 |
|
|
is up to the machine-dependent files to allocate such a register (if
|
892 |
|
|
necessary). */
|
893 |
|
|
#define PIC_OFFSET_TABLE_REGNUM (flag_pic ? 26 : INVALID_REGNUM)
|
894 |
|
|
|
895 |
|
|
/* Define this macro if the register defined by PIC_OFFSET_TABLE_REGNUM is
|
896 |
|
|
clobbered by calls. Do not define this macro if PIC_OFFSET_TABLE_REGNUM
|
897 |
|
|
is not defined. */
|
898 |
|
|
/* This register is call-saved on the ARC. */
|
899 |
|
|
/*#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED*/
|
900 |
|
|
|
901 |
|
|
/* A C expression that is nonzero if X is a legitimate immediate
|
902 |
|
|
operand on the target machine when generating position independent code.
|
903 |
|
|
You can assume that X satisfies CONSTANT_P, so you need not
|
904 |
|
|
check this. You can also assume `flag_pic' is true, so you need not
|
905 |
|
|
check it either. You need not define this macro if all constants
|
906 |
|
|
(including SYMBOL_REF) can be immediate operands when generating
|
907 |
|
|
position independent code. */
|
908 |
|
|
/*#define LEGITIMATE_PIC_OPERAND_P(X)*/
|
909 |
|
|
|
910 |
|
|
/* Control the assembler format that we output. */
|
911 |
|
|
|
912 |
|
|
/* A C string constant describing how to begin a comment in the target
|
913 |
|
|
assembler language. The compiler assumes that the comment will
|
914 |
|
|
end at the end of the line. */
|
915 |
|
|
#define ASM_COMMENT_START ";"
|
916 |
|
|
|
917 |
|
|
/* Output to assembler file text saying following lines
|
918 |
|
|
may contain character constants, extra white space, comments, etc. */
|
919 |
|
|
#define ASM_APP_ON ""
|
920 |
|
|
|
921 |
|
|
/* Output to assembler file text saying following lines
|
922 |
|
|
no longer contain unusual constructs. */
|
923 |
|
|
#define ASM_APP_OFF ""
|
924 |
|
|
|
925 |
|
|
/* Globalizing directive for a label. */
|
926 |
|
|
#define GLOBAL_ASM_OP "\t.global\t"
|
927 |
|
|
|
928 |
|
|
/* This is how to output a reference to a user-level label named NAME.
|
929 |
|
|
`assemble_name' uses this. */
|
930 |
|
|
/* We mangle all user labels to provide protection from linking code
|
931 |
|
|
compiled for different cpus. */
|
932 |
|
|
/* We work around a dwarfout.c deficiency by watching for labels from it and
|
933 |
|
|
not adding the '_' prefix nor the cpu suffix. There is a comment in
|
934 |
|
|
dwarfout.c that says it should be using (*targetm.asm_out.internal_label). */
|
935 |
|
|
extern const char *arc_mangle_cpu;
|
936 |
|
|
#define ASM_OUTPUT_LABELREF(FILE, NAME) \
|
937 |
|
|
do { \
|
938 |
|
|
if ((NAME)[0] == '.' && (NAME)[1] == 'L') \
|
939 |
|
|
fprintf (FILE, "%s", NAME); \
|
940 |
|
|
else \
|
941 |
|
|
{ \
|
942 |
|
|
fputc ('_', FILE); \
|
943 |
|
|
if (TARGET_MANGLE_CPU && arc_mangle_cpu != NULL) \
|
944 |
|
|
fprintf (FILE, "%s_", arc_mangle_cpu); \
|
945 |
|
|
fprintf (FILE, "%s", NAME); \
|
946 |
|
|
} \
|
947 |
|
|
} while (0)
|
948 |
|
|
|
949 |
|
|
/* Assembler pseudo-op to equate one value with another. */
|
950 |
|
|
/* ??? This is needed because dwarfout.c provides a default definition too
|
951 |
|
|
late for defaults.h (which contains the default definition of ASM_OUTPUT_DEF
|
952 |
|
|
that we use). */
|
953 |
|
|
#define SET_ASM_OP "\t.set\t"
|
954 |
|
|
|
955 |
|
|
/* How to refer to registers in assembler output.
|
956 |
|
|
This sequence is indexed by compiler's hard-register-number (see above). */
|
957 |
|
|
#define REGISTER_NAMES \
|
958 |
|
|
{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
|
959 |
|
|
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
|
960 |
|
|
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
|
961 |
|
|
"r24", "r25", "r26", "fp", "sp", "ilink1", "ilink2", "blink", \
|
962 |
|
|
"r32", "r33", "r34", "r35", "r36", "r37", "r38", "r39", \
|
963 |
|
|
"r40", "r41", "r42", "r43", "r44", "r45", "r46", "r47", \
|
964 |
|
|
"r48", "r49", "r50", "r51", "r52", "r53", "r54", "r55", \
|
965 |
|
|
"r56", "r57", "r58", "r59", "lp_count", "cc"}
|
966 |
|
|
|
967 |
|
|
/* Entry to the insn conditionalizer. */
|
968 |
|
|
#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
|
969 |
|
|
arc_final_prescan_insn (INSN, OPVEC, NOPERANDS)
|
970 |
|
|
|
971 |
|
|
/* A C expression which evaluates to true if CODE is a valid
|
972 |
|
|
punctuation character for use in the `PRINT_OPERAND' macro. */
|
973 |
|
|
extern char arc_punct_chars[256];
|
974 |
|
|
#define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
|
975 |
|
|
arc_punct_chars[(unsigned char) (CHAR)]
|
976 |
|
|
|
977 |
|
|
/* Print operand X (an rtx) in assembler syntax to file FILE.
|
978 |
|
|
CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
|
979 |
|
|
For `%' followed by punctuation, CODE is the punctuation and X is null. */
|
980 |
|
|
#define PRINT_OPERAND(FILE, X, CODE) \
|
981 |
|
|
arc_print_operand (FILE, X, CODE)
|
982 |
|
|
|
983 |
|
|
/* A C compound statement to output to stdio stream STREAM the
|
984 |
|
|
assembler syntax for an instruction operand that is a memory
|
985 |
|
|
reference whose address is ADDR. ADDR is an RTL expression. */
|
986 |
|
|
#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
|
987 |
|
|
arc_print_operand_address (FILE, ADDR)
|
988 |
|
|
|
989 |
|
|
/* This is how to output an element of a case-vector that is absolute. */
|
990 |
|
|
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
|
991 |
|
|
do { \
|
992 |
|
|
char label[30]; \
|
993 |
|
|
ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
|
994 |
|
|
fprintf (FILE, "\t.word %%st("); \
|
995 |
|
|
assemble_name (FILE, label); \
|
996 |
|
|
fprintf (FILE, ")\n"); \
|
997 |
|
|
} while (0)
|
998 |
|
|
|
999 |
|
|
/* This is how to output an element of a case-vector that is relative. */
|
1000 |
|
|
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
|
1001 |
|
|
do { \
|
1002 |
|
|
char label[30]; \
|
1003 |
|
|
ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
|
1004 |
|
|
fprintf (FILE, "\t.word %%st("); \
|
1005 |
|
|
assemble_name (FILE, label); \
|
1006 |
|
|
fprintf (FILE, "-"); \
|
1007 |
|
|
ASM_GENERATE_INTERNAL_LABEL (label, "L", REL); \
|
1008 |
|
|
assemble_name (FILE, label); \
|
1009 |
|
|
fprintf (FILE, ")\n"); \
|
1010 |
|
|
} while (0)
|
1011 |
|
|
|
1012 |
|
|
/* The desired alignment for the location counter at the beginning
|
1013 |
|
|
of a loop. */
|
1014 |
|
|
/* On the ARC, align loops to 32 byte boundaries (cache line size)
|
1015 |
|
|
if -malign-loops. */
|
1016 |
|
|
#define LOOP_ALIGN(LABEL) (TARGET_ALIGN_LOOPS ? 5 : 0)
|
1017 |
|
|
|
1018 |
|
|
/* This is how to output an assembler line
|
1019 |
|
|
that says to advance the location counter
|
1020 |
|
|
to a multiple of 2**LOG bytes. */
|
1021 |
|
|
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
|
1022 |
|
|
do { if ((LOG) != 0) fprintf (FILE, "\t.align %d\n", 1 << (LOG)); } while (0)
|
1023 |
|
|
|
1024 |
|
|
/* Debugging information. */
|
1025 |
|
|
|
1026 |
|
|
/* Generate DBX and DWARF debugging information. */
|
1027 |
|
|
#define DBX_DEBUGGING_INFO 1
|
1028 |
|
|
|
1029 |
|
|
/* Prefer STABS (for now). */
|
1030 |
|
|
#undef PREFERRED_DEBUGGING_TYPE
|
1031 |
|
|
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
1032 |
|
|
|
1033 |
|
|
/* Turn off splitting of long stabs. */
|
1034 |
|
|
#define DBX_CONTIN_LENGTH 0
|
1035 |
|
|
|
1036 |
|
|
/* Miscellaneous. */
|
1037 |
|
|
|
1038 |
|
|
/* Specify the machine mode that this machine uses
|
1039 |
|
|
for the index in the tablejump instruction. */
|
1040 |
|
|
#define CASE_VECTOR_MODE Pmode
|
1041 |
|
|
|
1042 |
|
|
/* Define if operations between registers always perform the operation
|
1043 |
|
|
on the full register even if a narrower mode is specified. */
|
1044 |
|
|
#define WORD_REGISTER_OPERATIONS
|
1045 |
|
|
|
1046 |
|
|
/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
|
1047 |
|
|
will either zero-extend or sign-extend. The value of this macro should
|
1048 |
|
|
be the code that says which one of the two operations is implicitly
|
1049 |
|
|
done, UNKNOWN if none. */
|
1050 |
|
|
#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
|
1051 |
|
|
|
1052 |
|
|
/* Max number of bytes we can move from memory to memory
|
1053 |
|
|
in one reasonably fast instruction. */
|
1054 |
|
|
#define MOVE_MAX 4
|
1055 |
|
|
|
1056 |
|
|
/* Define this to be nonzero if shift instructions ignore all but the low-order
|
1057 |
|
|
few bits. */
|
1058 |
|
|
#define SHIFT_COUNT_TRUNCATED 1
|
1059 |
|
|
|
1060 |
|
|
/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
|
1061 |
|
|
is done just by pretending it is already truncated. */
|
1062 |
|
|
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
|
1063 |
|
|
|
1064 |
|
|
/* Specify the machine mode that pointers have.
|
1065 |
|
|
After generation of rtl, the compiler makes no further distinction
|
1066 |
|
|
between pointers and any other objects of this machine mode. */
|
1067 |
|
|
/* ??? The arc doesn't have full 32 bit pointers, but making this PSImode has
|
1068 |
|
|
its own problems (you have to add extendpsisi2 and trucnsipsi2 but how does
|
1069 |
|
|
one do it without getting excess code?). Try to avoid it. */
|
1070 |
|
|
#define Pmode SImode
|
1071 |
|
|
|
1072 |
|
|
/* A function address in a call instruction. */
|
1073 |
|
|
#define FUNCTION_MODE SImode
|
1074 |
|
|
|
1075 |
|
|
/* alloca should avoid clobbering the old register save area. */
|
1076 |
|
|
/* ??? Not defined in tm.texi. */
|
1077 |
|
|
#define SETJMP_VIA_SAVE_AREA
|
1078 |
|
|
|
1079 |
|
|
/* Define the information needed to generate branch and scc insns. This is
|
1080 |
|
|
stored from the compare operation. Note that we can't use "rtx" here
|
1081 |
|
|
since it hasn't been defined! */
|
1082 |
|
|
extern struct rtx_def *arc_compare_op0, *arc_compare_op1;
|
1083 |
|
|
|
1084 |
|
|
/* ARC function types. */
|
1085 |
|
|
enum arc_function_type {
|
1086 |
|
|
ARC_FUNCTION_UNKNOWN, ARC_FUNCTION_NORMAL,
|
1087 |
|
|
/* These are interrupt handlers. The name corresponds to the register
|
1088 |
|
|
name that contains the return address. */
|
1089 |
|
|
ARC_FUNCTION_ILINK1, ARC_FUNCTION_ILINK2
|
1090 |
|
|
};
|
1091 |
|
|
#define ARC_INTERRUPT_P(TYPE) \
|
1092 |
|
|
((TYPE) == ARC_FUNCTION_ILINK1 || (TYPE) == ARC_FUNCTION_ILINK2)
|
1093 |
|
|
/* Compute the type of a function from its DECL. */
|
1094 |
|
|
|
1095 |
|
|
|
1096 |
|
|
/* Implement `va_start' for varargs and stdarg. */
|
1097 |
|
|
#define EXPAND_BUILTIN_VA_START(valist, nextarg) \
|
1098 |
|
|
arc_va_start (valist, nextarg)
|