]>
Commit | Line | Data |
---|---|---|
956d6950 | 1 | /* Definitions of target machine for GNU compiler. NEC V850 series |
2f83c7d6 | 2 | Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, |
fac0f722 | 3 | 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
ae180d84 JL |
4 | Contributed by Jeff Law (law@cygnus.com). |
5 | ||
301ee2f3 | 6 | This file is part of GCC. |
ae180d84 | 7 | |
301ee2f3 | 8 | GCC is free software; you can redistribute it and/or modify |
8376061d | 9 | it under the terms of the GNU General Public License as published by |
2f83c7d6 | 10 | the Free Software Foundation; either version 3, or (at your option) |
8376061d | 11 | any later version. |
ae180d84 | 12 | |
301ee2f3 | 13 | GCC is distributed in the hope that it will be useful, |
8376061d CM |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
ae180d84 | 17 | |
8376061d | 18 | You should have received a copy of the GNU General Public License |
2f83c7d6 NC |
19 | along with GCC; see the file COPYING3. If not see |
20 | <http://www.gnu.org/licenses/>. */ | |
ae180d84 | 21 | |
8b97c5f8 ZW |
22 | #ifndef GCC_V850_H |
23 | #define GCC_V850_H | |
24 | ||
223a9d64 N |
25 | extern GTY(()) rtx v850_compare_op0; |
26 | extern GTY(()) rtx v850_compare_op1; | |
27 | ||
ae180d84 | 28 | #undef LIB_SPEC |
223a9d64 N |
29 | #define LIB_SPEC "%{!shared:%{!symbolic:--start-group -lc -lgcc --end-group}}" |
30 | ||
ae180d84 JL |
31 | #undef ENDFILE_SPEC |
32 | #undef LINK_SPEC | |
33 | #undef STARTFILE_SPEC | |
7a846a6c | 34 | #undef ASM_SPEC |
ae180d84 | 35 | |
7a846a6c | 36 | #define TARGET_CPU_generic 1 |
b4378319 | 37 | #define TARGET_CPU_v850e 2 |
223a9d64 N |
38 | #define TARGET_CPU_v850e1 3 |
39 | #define TARGET_CPU_v850e2 4 | |
40 | #define TARGET_CPU_v850e2v3 5 | |
41 | ||
74aca74b | 42 | |
7a846a6c NC |
43 | #ifndef TARGET_CPU_DEFAULT |
44 | #define TARGET_CPU_DEFAULT TARGET_CPU_generic | |
74aca74b | 45 | #endif |
ae180d84 | 46 | |
7a846a6c NC |
47 | #define MASK_DEFAULT MASK_V850 |
48 | #define SUBTARGET_ASM_SPEC "%{!mv*:-mv850}" | |
49 | #define SUBTARGET_CPP_SPEC "%{!mv*:-D__v850__}" | |
50 | #define TARGET_VERSION fprintf (stderr, " (NEC V850)"); | |
51 | ||
b4378319 NC |
52 | /* Choose which processor will be the default. |
53 | We must pass a -mv850xx option to the assembler if no explicit -mv* option | |
54 | is given, because the assembler's processor default may not be correct. */ | |
55 | #if TARGET_CPU_DEFAULT == TARGET_CPU_v850e | |
56 | #undef MASK_DEFAULT | |
57 | #define MASK_DEFAULT MASK_V850E | |
58 | #undef SUBTARGET_ASM_SPEC | |
59 | #define SUBTARGET_ASM_SPEC "%{!mv*:-mv850e}" | |
60 | #undef SUBTARGET_CPP_SPEC | |
61 | #define SUBTARGET_CPP_SPEC "%{!mv*:-D__v850e__}" | |
62 | #undef TARGET_VERSION | |
63 | #define TARGET_VERSION fprintf (stderr, " (NEC V850E)"); | |
64 | #endif | |
7a846a6c | 65 | |
232830b7 NC |
66 | #if TARGET_CPU_DEFAULT == TARGET_CPU_v850e1 |
67 | #undef MASK_DEFAULT | |
223a9d64 N |
68 | #define MASK_DEFAULT MASK_V850E /* No practical difference. */ |
69 | #undef SUBTARGET_ASM_SPEC | |
70 | #define SUBTARGET_ASM_SPEC "%{!mv*:-mv850e1}" | |
71 | #undef SUBTARGET_CPP_SPEC | |
72 | #define SUBTARGET_CPP_SPEC "%{!mv*:-D__v850e1__} %{mv850e1:-D__v850e1__}" | |
73 | #undef TARGET_VERSION | |
74 | #define TARGET_VERSION fprintf (stderr, " (NEC V850E1)"); | |
75 | #endif | |
76 | ||
77 | #if TARGET_CPU_DEFAULT == TARGET_CPU_v850e2 | |
78 | #undef MASK_DEFAULT | |
79 | #define MASK_DEFAULT MASK_V850E2 | |
80 | #undef SUBTARGET_ASM_SPEC | |
81 | #define SUBTARGET_ASM_SPEC "%{!mv*:-mv850e2}" | |
82 | #undef SUBTARGET_CPP_SPEC | |
83 | #define SUBTARGET_CPP_SPEC "%{!mv*:-D__v850e2__} %{mv850e2:-D__v850e2__}" | |
84 | #undef TARGET_VERSION | |
85 | #define TARGET_VERSION fprintf (stderr, " (NEC V850E2)"); | |
86 | #endif | |
87 | ||
88 | #if TARGET_CPU_DEFAULT == TARGET_CPU_v850e2v3 | |
89 | #undef MASK_DEFAULT | |
90 | #define MASK_DEFAULT MASK_V850E2V3 | |
232830b7 | 91 | #undef SUBTARGET_ASM_SPEC |
223a9d64 | 92 | #define SUBTARGET_ASM_SPEC "%{!mv*:-mv850e2v3}" |
232830b7 | 93 | #undef SUBTARGET_CPP_SPEC |
223a9d64 | 94 | #define SUBTARGET_CPP_SPEC "%{!mv*:-D__v850e2v3__} %{mv850e2v3:-D__v850e2v3__}" |
232830b7 | 95 | #undef TARGET_VERSION |
223a9d64 | 96 | #define TARGET_VERSION fprintf (stderr, " (NEC V850E2V3)"); |
232830b7 NC |
97 | #endif |
98 | ||
223a9d64 N |
99 | #define TARGET_V850E2_ALL (TARGET_V850E2 || TARGET_V850E2V3) |
100 | ||
a40d79d7 NC |
101 | #define ASM_SPEC "%{mv850es:-mv850e1}%{!mv850es:%{mv*:-mv%*}}" |
102 | #define CPP_SPEC "\ | |
103 | %{mv850e2v3:-D__v850e2v3__} \ | |
104 | %{mv850e2:-D__v850e2__} \ | |
105 | %{mv850es:-D__v850e1__} \ | |
106 | %{mv850e1:-D__v850e1__} \ | |
107 | %{mv850:-D__v850__} \ | |
108 | %(subtarget_cpp_spec)" \ | |
109 | " %{mep:-D__EP__}" | |
7a846a6c NC |
110 | |
111 | #define EXTRA_SPECS \ | |
112 | { "subtarget_asm_spec", SUBTARGET_ASM_SPEC }, \ | |
113 | { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC } | |
114 | ||
115 | /* Names to predefine in the preprocessor for this target machine. */ | |
cc956ba2 | 116 | #define TARGET_CPU_CPP_BUILTINS() do { \ |
223a9d64 | 117 | builtin_define( "__v851__" ); \ |
cc956ba2 NB |
118 | builtin_define( "__v850" ); \ |
119 | builtin_assert( "machine=v850" ); \ | |
120 | builtin_assert( "cpu=v850" ); \ | |
2ec6cd51 NC |
121 | if (TARGET_EP) \ |
122 | builtin_define ("__EP__"); \ | |
cc956ba2 | 123 | } while(0) |
ae180d84 | 124 | |
0a0da1bc | 125 | #define MASK_CPU (MASK_V850 | MASK_V850E) |
ae180d84 JL |
126 | |
127 | /* Information about the various small memory areas. */ | |
128 | struct small_memory_info { | |
8b97c5f8 | 129 | const char *name; |
ae180d84 JL |
130 | long max; |
131 | long physical_max; | |
132 | }; | |
133 | ||
134 | enum small_memory_type { | |
135 | /* tiny data area, using EP as base register */ | |
136 | SMALL_MEMORY_TDA = 0, | |
137 | /* small data area using dp as base register */ | |
138 | SMALL_MEMORY_SDA, | |
139 | /* zero data area using r0 as base register */ | |
140 | SMALL_MEMORY_ZDA, | |
141 | SMALL_MEMORY_max | |
142 | }; | |
143 | ||
144 | extern struct small_memory_info small_memory[(int)SMALL_MEMORY_max]; | |
ae180d84 JL |
145 | \f |
146 | /* Target machine storage layout */ | |
147 | ||
148 | /* Define this if most significant bit is lowest numbered | |
149 | in instructions that operate on numbered bit-fields. | |
150 | This is not true on the NEC V850. */ | |
151 | #define BITS_BIG_ENDIAN 0 | |
152 | ||
153 | /* Define this if most significant byte of a word is the lowest numbered. */ | |
154 | /* This is not true on the NEC V850. */ | |
155 | #define BYTES_BIG_ENDIAN 0 | |
156 | ||
157 | /* Define this if most significant word of a multiword number is lowest | |
158 | numbered. | |
159 | This is not true on the NEC V850. */ | |
160 | #define WORDS_BIG_ENDIAN 0 | |
161 | ||
ae180d84 JL |
162 | /* Width of a word, in units (bytes). */ |
163 | #define UNITS_PER_WORD 4 | |
164 | ||
ae180d84 JL |
165 | /* Define this macro if it is advisable to hold scalars in registers |
166 | in a wider mode than that declared by the program. In such cases, | |
167 | the value is constrained to be within the bounds of the declared | |
168 | type, but kept valid in the wider mode. The signedness of the | |
169 | extension may differ from that of the type. | |
170 | ||
171 | Some simple experiments have shown that leaving UNSIGNEDP alone | |
172 | generates the best overall code. */ | |
173 | ||
174 | #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \ | |
175 | if (GET_MODE_CLASS (MODE) == MODE_INT \ | |
176 | && GET_MODE_SIZE (MODE) < 4) \ | |
177 | { (MODE) = SImode; } | |
178 | ||
179 | /* Allocation boundary (in *bits*) for storing arguments in argument list. */ | |
180 | #define PARM_BOUNDARY 32 | |
181 | ||
22f23985 | 182 | /* The stack goes in 32-bit lumps. */ |
ae180d84 JL |
183 | #define STACK_BOUNDARY 32 |
184 | ||
185 | /* Allocation boundary (in *bits*) for the code of a function. | |
186 | 16 is the minimum boundary; 32 would give better performance. */ | |
187 | #define FUNCTION_BOUNDARY 16 | |
188 | ||
189 | /* No data type wants to be aligned rounder than this. */ | |
190 | #define BIGGEST_ALIGNMENT 32 | |
191 | ||
192 | /* Alignment of field after `int : 0' in a structure. */ | |
193 | #define EMPTY_FIELD_BOUNDARY 32 | |
194 | ||
195 | /* No structure field wants to be aligned rounder than this. */ | |
196 | #define BIGGEST_FIELD_ALIGNMENT 32 | |
197 | ||
198 | /* Define this if move instructions will actually fail to work | |
199 | when given unaligned data. */ | |
223a9d64 | 200 | #define STRICT_ALIGNMENT (!TARGET_NO_STRICT_ALIGN) |
ae180d84 JL |
201 | |
202 | /* Define this as 1 if `char' should by default be signed; else as 0. | |
203 | ||
d4de0221 | 204 | On the NEC V850, loads do sign extension, so make this default. */ |
ae180d84 | 205 | #define DEFAULT_SIGNED_CHAR 1 |
fcbf5a00 JM |
206 | |
207 | #undef SIZE_TYPE | |
208 | #define SIZE_TYPE "unsigned int" | |
209 | ||
210 | #undef PTRDIFF_TYPE | |
211 | #define PTRDIFF_TYPE "int" | |
212 | ||
213 | #undef WCHAR_TYPE | |
214 | #define WCHAR_TYPE "long int" | |
215 | ||
216 | #undef WCHAR_TYPE_SIZE | |
217 | #define WCHAR_TYPE_SIZE BITS_PER_WORD | |
ae180d84 JL |
218 | \f |
219 | /* Standard register usage. */ | |
220 | ||
221 | /* Number of actual hardware registers. | |
222 | The hardware registers are assigned numbers for the compiler | |
223 | from 0 to just below FIRST_PSEUDO_REGISTER. | |
224 | ||
225 | All registers that the compiler knows about must be given numbers, | |
226 | even those that are not normally considered general registers. */ | |
227 | ||
223a9d64 | 228 | #define FIRST_PSEUDO_REGISTER 36 |
ae180d84 JL |
229 | |
230 | /* 1 for registers that have pervasive standard uses | |
231 | and are not available for the register allocator. */ | |
232 | ||
233 | #define FIXED_REGISTERS \ | |
223a9d64 | 234 | { 1, 1, 1, 1, 1, 1, 0, 0, \ |
ae180d84 JL |
235 | 0, 0, 0, 0, 0, 0, 0, 0, \ |
236 | 0, 0, 0, 0, 0, 0, 0, 0, \ | |
237 | 0, 0, 0, 0, 0, 0, 1, 0, \ | |
223a9d64 | 238 | 1, 1, \ |
ae180d84 JL |
239 | 1, 1} |
240 | ||
241 | /* 1 for registers not available across function calls. | |
242 | These must include the FIXED_REGISTERS and also any | |
243 | registers that can be used without being saved. | |
244 | The latter must include the registers where values are returned | |
245 | and the register where structure-value addresses are passed. | |
246 | Aside from that, you can include as many other registers as you | |
247 | like. */ | |
248 | ||
249 | #define CALL_USED_REGISTERS \ | |
223a9d64 | 250 | { 1, 1, 1, 1, 1, 1, 1, 1, \ |
ae180d84 JL |
251 | 1, 1, 1, 1, 1, 1, 1, 1, \ |
252 | 1, 1, 1, 1, 0, 0, 0, 0, \ | |
253 | 0, 0, 0, 0, 0, 0, 1, 1, \ | |
223a9d64 | 254 | 1, 1, \ |
ae180d84 JL |
255 | 1, 1} |
256 | ||
257 | /* List the order in which to allocate registers. Each register must be | |
258 | listed once, even those in FIXED_REGISTERS. | |
259 | ||
260 | On the 850, we make the return registers first, then all of the volatile | |
261 | registers, then the saved registers in reverse order to better save the | |
956d6950 | 262 | registers with an out of line function, and finally the fixed |
ae180d84 JL |
263 | registers. */ |
264 | ||
265 | #define REG_ALLOC_ORDER \ | |
266 | { \ | |
267 | 10, 11, /* return registers */ \ | |
268 | 12, 13, 14, 15, 16, 17, 18, 19, /* scratch registers */ \ | |
269 | 6, 7, 8, 9, 31, /* argument registers */ \ | |
270 | 29, 28, 27, 26, 25, 24, 23, 22, /* saved registers */ \ | |
271 | 21, 20, 2, \ | |
223a9d64 N |
272 | 0, 1, 3, 4, 5, 30, 32, 33, /* fixed registers */ \ |
273 | 34, 35 \ | |
ae180d84 JL |
274 | } |
275 | ||
276 | /* Return number of consecutive hard regs needed starting at reg REGNO | |
277 | to hold something of mode MODE. | |
278 | ||
279 | This is ordinarily the length in words of a value of mode MODE | |
280 | but can be less for certain modes in special long registers. */ | |
281 | ||
282 | #define HARD_REGNO_NREGS(REGNO, MODE) \ | |
283 | ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) | |
284 | ||
285 | /* Value is 1 if hard register REGNO can hold a value of machine-mode | |
286 | MODE. */ | |
287 | ||
288 | #define HARD_REGNO_MODE_OK(REGNO, MODE) \ | |
223a9d64 | 289 | ((GET_MODE_SIZE (MODE) <= 4) || (((REGNO) & 1) == 0 && (REGNO) != 0)) |
ae180d84 JL |
290 | |
291 | /* Value is 1 if it is a good idea to tie two pseudo registers | |
292 | when one has mode MODE1 and one has mode MODE2. | |
293 | If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, | |
294 | for any hard reg, then this must be 0 for correct output. */ | |
295 | #define MODES_TIEABLE_P(MODE1, MODE2) \ | |
674fdc14 | 296 | (MODE1 == MODE2 || (GET_MODE_SIZE (MODE1) <= 4 && GET_MODE_SIZE (MODE2) <= 4)) |
ae180d84 JL |
297 | |
298 | \f | |
299 | /* Define the classes of registers for register constraints in the | |
300 | machine description. Also define ranges of constants. | |
301 | ||
302 | One of the classes must always be named ALL_REGS and include all hard regs. | |
303 | If there is more than one class, another class must be named NO_REGS | |
304 | and contain no registers. | |
305 | ||
306 | The name GENERAL_REGS must be the name of a class (or an alias for | |
307 | another name such as ALL_REGS). This is the class of registers | |
308 | that is allowed by "g" or "r" in a register constraint. | |
309 | Also, registers outside this class are allocated only when | |
310 | instructions express preferences for them. | |
311 | ||
312 | The classes must be numbered in nondecreasing order; that is, | |
313 | a larger-numbered class must never be contained completely | |
314 | in a smaller-numbered class. | |
315 | ||
316 | For any two classes, it is very desirable that there be another | |
317 | class that represents their union. */ | |
318 | ||
3ce15347 NC |
319 | enum reg_class |
320 | { | |
223a9d64 | 321 | NO_REGS, GENERAL_REGS, EVEN_REGS, ALL_REGS, LIM_REG_CLASSES |
ae180d84 JL |
322 | }; |
323 | ||
324 | #define N_REG_CLASSES (int) LIM_REG_CLASSES | |
325 | ||
724df8d2 NC |
326 | #define IRA_COVER_CLASSES \ |
327 | { \ | |
328 | GENERAL_REGS, LIM_REG_CLASSES \ | |
329 | } | |
330 | ||
d4de0221 | 331 | /* Give names of register classes as strings for dump file. */ |
ae180d84 JL |
332 | |
333 | #define REG_CLASS_NAMES \ | |
223a9d64 | 334 | { "NO_REGS", "GENERAL_REGS", "EVEN_REGS", "ALL_REGS", "LIM_REGS" } |
ae180d84 JL |
335 | |
336 | /* Define which registers fit in which classes. | |
337 | This is an initializer for a vector of HARD_REG_SET | |
338 | of length N_REG_CLASSES. */ | |
339 | ||
223a9d64 N |
340 | #define REG_CLASS_CONTENTS \ |
341 | { \ | |
342 | { 0x00000000,0x0 }, /* NO_REGS */ \ | |
343 | { 0xffffffff,0x0 }, /* GENERAL_REGS */ \ | |
344 | { 0x55555554,0x0 }, /* EVEN_REGS */ \ | |
345 | { 0xffffffff,0x0 }, /* ALL_REGS */ \ | |
ae180d84 JL |
346 | } |
347 | ||
348 | /* The same information, inverted: | |
349 | Return the class number of the smallest class containing | |
350 | reg number REGNO. This could be a conditional expression | |
351 | or could index an array. */ | |
352 | ||
223a9d64 | 353 | #define REGNO_REG_CLASS(REGNO) ((REGNO == CC_REGNUM || REGNO == FCC_REGNUM) ? NO_REGS : GENERAL_REGS) |
ae180d84 JL |
354 | |
355 | /* The class value for index registers, and the one for base regs. */ | |
356 | ||
357 | #define INDEX_REG_CLASS NO_REGS | |
358 | #define BASE_REG_CLASS GENERAL_REGS | |
359 | ||
360 | /* Get reg_class from a letter such as appears in the machine description. */ | |
361 | ||
223a9d64 N |
362 | #define REG_CLASS_FROM_LETTER(C) \ |
363 | (C == 'e' ? EVEN_REGS : (NO_REGS)) | |
ae180d84 JL |
364 | |
365 | /* Macros to check register numbers against specific register classes. */ | |
366 | ||
367 | /* These assume that REGNO is a hard or pseudo reg number. | |
368 | They give nonzero only if REGNO is a hard reg of the suitable class | |
369 | or a pseudo reg currently allocated to a suitable hard reg. | |
370 | Since they use reg_renumber, they are safe only once reg_renumber | |
371 | has been allocated, which happens in local-alloc.c. */ | |
372 | ||
223a9d64 N |
373 | #define REGNO_OK_FOR_BASE_P(regno) \ |
374 | (((regno) < FIRST_PSEUDO_REGISTER \ | |
375 | && (regno) != CC_REGNUM \ | |
376 | && (regno) != FCC_REGNUM) \ | |
377 | || reg_renumber[regno] >= 0) | |
ae180d84 JL |
378 | |
379 | #define REGNO_OK_FOR_INDEX_P(regno) 0 | |
380 | ||
ae180d84 JL |
381 | /* Return the maximum number of consecutive registers |
382 | needed to represent mode MODE in a register of class CLASS. */ | |
383 | ||
384 | #define CLASS_MAX_NREGS(CLASS, MODE) \ | |
385 | ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) | |
386 | ||
387 | /* The letters I, J, K, L, M, N, O, P in a register constraint string | |
388 | can be used to stand for particular ranges of immediate operands. | |
389 | This macro defines what the ranges are. | |
390 | C is the letter, and VALUE is a constant value. | |
391 | Return 1 if VALUE is in the range specified by C. */ | |
392 | ||
393 | #define INT_7_BITS(VALUE) ((unsigned) (VALUE) + 0x40 < 0x80) | |
394 | #define INT_8_BITS(VALUE) ((unsigned) (VALUE) + 0x80 < 0x100) | |
1933ec7e | 395 | /* zero */ |
ae180d84 | 396 | #define CONST_OK_FOR_I(VALUE) ((VALUE) == 0) |
22f23985 | 397 | /* 5-bit signed immediate */ |
ae180d84 | 398 | #define CONST_OK_FOR_J(VALUE) ((unsigned) (VALUE) + 0x10 < 0x20) |
22f23985 | 399 | /* 16-bit signed immediate */ |
ae180d84 | 400 | #define CONST_OK_FOR_K(VALUE) ((unsigned) (VALUE) + 0x8000 < 0x10000) |
1933ec7e | 401 | /* valid constant for movhi instruction. */ |
ae180d84 JL |
402 | #define CONST_OK_FOR_L(VALUE) \ |
403 | (((unsigned) ((int) (VALUE) >> 16) + 0x8000 < 0x10000) \ | |
404 | && CONST_OK_FOR_I ((VALUE & 0xffff))) | |
22f23985 | 405 | /* 16-bit unsigned immediate */ |
1933ec7e | 406 | #define CONST_OK_FOR_M(VALUE) ((unsigned)(VALUE) < 0x10000) |
22f23985 | 407 | /* 5-bit unsigned immediate in shift instructions */ |
1933ec7e | 408 | #define CONST_OK_FOR_N(VALUE) ((unsigned) (VALUE) <= 31) |
22f23985 | 409 | /* 9-bit signed immediate for word multiply instruction. */ |
b4378319 | 410 | #define CONST_OK_FOR_O(VALUE) ((unsigned) (VALUE) + 0x100 < 0x200) |
ae180d84 | 411 | |
ae180d84 JL |
412 | #define CONST_OK_FOR_P(VALUE) 0 |
413 | ||
414 | #define CONST_OK_FOR_LETTER_P(VALUE, C) \ | |
415 | ((C) == 'I' ? CONST_OK_FOR_I (VALUE) : \ | |
416 | (C) == 'J' ? CONST_OK_FOR_J (VALUE) : \ | |
417 | (C) == 'K' ? CONST_OK_FOR_K (VALUE) : \ | |
418 | (C) == 'L' ? CONST_OK_FOR_L (VALUE) : \ | |
419 | (C) == 'M' ? CONST_OK_FOR_M (VALUE) : \ | |
420 | (C) == 'N' ? CONST_OK_FOR_N (VALUE) : \ | |
421 | (C) == 'O' ? CONST_OK_FOR_O (VALUE) : \ | |
422 | (C) == 'P' ? CONST_OK_FOR_P (VALUE) : \ | |
423 | 0) | |
424 | ||
425 | /* Similar, but for floating constants, and defining letters G and H. | |
426 | Here VALUE is the CONST_DOUBLE rtx itself. | |
427 | ||
428 | `G' is a zero of some form. */ | |
429 | ||
430 | #define CONST_DOUBLE_OK_FOR_G(VALUE) \ | |
431 | ((GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \ | |
432 | && (VALUE) == CONST0_RTX (GET_MODE (VALUE))) \ | |
433 | || (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_INT \ | |
434 | && CONST_DOUBLE_LOW (VALUE) == 0 \ | |
435 | && CONST_DOUBLE_HIGH (VALUE) == 0)) | |
436 | ||
437 | #define CONST_DOUBLE_OK_FOR_H(VALUE) 0 | |
438 | ||
439 | #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \ | |
440 | ((C) == 'G' ? CONST_DOUBLE_OK_FOR_G (VALUE) \ | |
441 | : (C) == 'H' ? CONST_DOUBLE_OK_FOR_H (VALUE) \ | |
442 | : 0) | |
443 | ||
444 | \f | |
445 | /* Stack layout; function entry, exit and calling. */ | |
446 | ||
447 | /* Define this if pushing a word on the stack | |
448 | makes the stack pointer a smaller address. */ | |
449 | ||
450 | #define STACK_GROWS_DOWNWARD | |
451 | ||
a4d05547 | 452 | /* Define this to nonzero if the nominal address of the stack frame |
ae180d84 JL |
453 | is at the high-address end of the local variables; |
454 | that is, each additional local variable allocated | |
455 | goes at a more negative offset in the frame. */ | |
456 | ||
f62c8a5c | 457 | #define FRAME_GROWS_DOWNWARD 1 |
ae180d84 JL |
458 | |
459 | /* Offset within stack frame to start allocating local variables at. | |
460 | If FRAME_GROWS_DOWNWARD, this is the offset to the END of the | |
461 | first local allocated. Otherwise, it is the offset to the BEGINNING | |
462 | of the first local allocated. */ | |
463 | ||
464 | #define STARTING_FRAME_OFFSET 0 | |
465 | ||
466 | /* Offset of first parameter from the argument pointer register value. */ | |
467 | /* Is equal to the size of the saved fp + pc, even if an fp isn't | |
468 | saved since the value is used before we know. */ | |
469 | ||
470 | #define FIRST_PARM_OFFSET(FNDECL) 0 | |
471 | ||
472 | /* Specify the registers used for certain standard purposes. | |
473 | The values of these macros are register numbers. */ | |
474 | ||
475 | /* Register to use for pushing function arguments. */ | |
223a9d64 | 476 | #define STACK_POINTER_REGNUM SP_REGNUM |
ae180d84 JL |
477 | |
478 | /* Base register for access to local variables of the function. */ | |
223a9d64 | 479 | #define FRAME_POINTER_REGNUM 34 |
ae180d84 | 480 | |
29a65e3d | 481 | /* Register containing return address from latest function call. */ |
223a9d64 | 482 | #define LINK_POINTER_REGNUM LP_REGNUM |
29a65e3d | 483 | |
ae180d84 JL |
484 | /* On some machines the offset between the frame pointer and starting |
485 | offset of the automatic variables is not known until after register | |
486 | allocation has been done (for example, because the saved registers | |
487 | are between these two locations). On those machines, define | |
488 | `FRAME_POINTER_REGNUM' the number of a special, fixed register to | |
489 | be used internally until the offset is known, and define | |
490 | `HARD_FRAME_POINTER_REGNUM' to be actual the hard register number | |
491 | used for the frame pointer. | |
492 | ||
493 | You should define this macro only in the very rare circumstances | |
494 | when it is not possible to calculate the offset between the frame | |
495 | pointer and the automatic variables until after register | |
496 | allocation has been completed. When this macro is defined, you | |
497 | must also indicate in your definition of `ELIMINABLE_REGS' how to | |
498 | eliminate `FRAME_POINTER_REGNUM' into either | |
499 | `HARD_FRAME_POINTER_REGNUM' or `STACK_POINTER_REGNUM'. | |
500 | ||
501 | Do not define this macro if it would be the same as | |
d4de0221 | 502 | `FRAME_POINTER_REGNUM'. */ |
3ce15347 | 503 | #undef HARD_FRAME_POINTER_REGNUM |
ae180d84 JL |
504 | #define HARD_FRAME_POINTER_REGNUM 29 |
505 | ||
506 | /* Base register for access to arguments of the function. */ | |
223a9d64 | 507 | #define ARG_POINTER_REGNUM 35 |
ae180d84 JL |
508 | |
509 | /* Register in which static-chain is passed to a function. */ | |
3ce15347 | 510 | #define STATIC_CHAIN_REGNUM 20 |
ae180d84 | 511 | |
ae180d84 JL |
512 | /* If defined, this macro specifies a table of register pairs used to |
513 | eliminate unneeded registers that point into the stack frame. If | |
514 | it is not defined, the only elimination attempted by the compiler | |
515 | is to replace references to the frame pointer with references to | |
516 | the stack pointer. | |
517 | ||
518 | The definition of this macro is a list of structure | |
519 | initializations, each of which specifies an original and | |
520 | replacement register. | |
521 | ||
522 | On some machines, the position of the argument pointer is not | |
523 | known until the compilation is completed. In such a case, a | |
524 | separate hard register must be used for the argument pointer. | |
525 | This register can be eliminated by replacing it with either the | |
526 | frame pointer or the argument pointer, depending on whether or not | |
527 | the frame pointer has been eliminated. | |
528 | ||
529 | In this case, you might specify: | |
530 | #define ELIMINABLE_REGS \ | |
531 | {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ | |
532 | {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \ | |
533 | {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}} | |
534 | ||
535 | Note that the elimination of the argument pointer with the stack | |
d4de0221 | 536 | pointer is specified first since that is the preferred elimination. */ |
ae180d84 JL |
537 | |
538 | #define ELIMINABLE_REGS \ | |
539 | {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \ | |
540 | { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \ | |
541 | { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \ | |
542 | { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }} \ | |
543 | ||
ae180d84 JL |
544 | /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It |
545 | specifies the initial difference between the specified pair of | |
546 | registers. This macro must be defined if `ELIMINABLE_REGS' is | |
d4de0221 | 547 | defined. */ |
ae180d84 JL |
548 | |
549 | #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ | |
550 | { \ | |
551 | if ((FROM) == FRAME_POINTER_REGNUM) \ | |
38173d38 | 552 | (OFFSET) = get_frame_size () + crtl->outgoing_args_size; \ |
ae180d84 JL |
553 | else if ((FROM) == ARG_POINTER_REGNUM) \ |
554 | (OFFSET) = compute_frame_size (get_frame_size (), (long *)0); \ | |
555 | else \ | |
f2f84cba | 556 | gcc_unreachable (); \ |
ae180d84 JL |
557 | } |
558 | ||
ae180d84 | 559 | /* Keep the stack pointer constant throughout the function. */ |
f73ad30e | 560 | #define ACCUMULATE_OUTGOING_ARGS 1 |
ae180d84 | 561 | |
a64761a3 | 562 | #define RETURN_ADDR_RTX(COUNT, FP) v850_return_addr (COUNT) |
ae180d84 JL |
563 | \f |
564 | /* Define a data type for recording info about an argument list | |
565 | during the scan of that argument list. This data type should | |
566 | hold all necessary information about the function itself | |
567 | and about the args processed so far, enough to enable macros | |
568 | such as FUNCTION_ARG to determine where the next arg should go. */ | |
569 | ||
570 | #define CUMULATIVE_ARGS struct cum_arg | |
66a0dfeb | 571 | struct cum_arg { int nbytes; int anonymous_args; }; |
ae180d84 | 572 | |
ae180d84 JL |
573 | /* Initialize a variable CUM of type CUMULATIVE_ARGS |
574 | for a call to a function whose data type is FNTYPE. | |
575 | For a library call, FNTYPE is 0. */ | |
576 | ||
0f6937fe | 577 | #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \ |
66a0dfeb | 578 | ((CUM).nbytes = 0, (CUM).anonymous_args = 0) |
ae180d84 | 579 | |
ae180d84 JL |
580 | /* When a parameter is passed in a register, stack space is still |
581 | allocated for it. */ | |
223a9d64 | 582 | #define REG_PARM_STACK_SPACE(DECL) 0 |
ae180d84 | 583 | |
ae180d84 JL |
584 | /* 1 if N is a possible register number for function argument passing. */ |
585 | ||
586 | #define FUNCTION_ARG_REGNO_P(N) (N >= 6 && N <= 9) | |
587 | ||
ae180d84 JL |
588 | /* Define how to find the value returned by a library function |
589 | assuming the value has mode MODE. */ | |
590 | ||
591 | #define LIBCALL_VALUE(MODE) \ | |
c5c76735 | 592 | gen_rtx_REG (MODE, 10) |
ae180d84 | 593 | |
ae180d84 | 594 | #define DEFAULT_PCC_STRUCT_RETURN 0 |
ae180d84 JL |
595 | |
596 | /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, | |
597 | the stack pointer does not matter. The value is tested only in | |
598 | functions that have frame pointers. | |
599 | No definition is equivalent to always zero. */ | |
600 | ||
601 | #define EXIT_IGNORE_STACK 1 | |
602 | ||
bc9ec51b JW |
603 | /* Define this macro as a C expression that is nonzero for registers |
604 | used by the epilogue or the `return' pattern. */ | |
605 | ||
606 | #define EPILOGUE_USES(REGNO) \ | |
607 | (reload_completed && (REGNO) == LINK_POINTER_REGNUM) | |
608 | ||
ae180d84 JL |
609 | /* Output assembler code to FILE to increment profiler label # LABELNO |
610 | for profiling a function entry. */ | |
611 | ||
612 | #define FUNCTION_PROFILER(FILE, LABELNO) ; | |
613 | ||
ae180d84 JL |
614 | /* Length in units of the trampoline for entering a nested function. */ |
615 | ||
616 | #define TRAMPOLINE_SIZE 24 | |
617 | ||
ae180d84 JL |
618 | /* Addressing modes, and classification of registers for them. */ |
619 | ||
620 | \f | |
621 | /* 1 if X is an rtx for a constant that is a valid address. */ | |
622 | ||
1933ec7e JW |
623 | /* ??? This seems too exclusive. May get better code by accepting more |
624 | possibilities here, in particular, should accept ZDA_NAME SYMBOL_REFs. */ | |
625 | ||
ae180d84 JL |
626 | #define CONSTANT_ADDRESS_P(X) \ |
627 | (GET_CODE (X) == CONST_INT \ | |
628 | && CONST_OK_FOR_K (INTVAL (X))) | |
629 | ||
630 | /* Maximum number of registers that can appear in a valid memory address. */ | |
631 | ||
632 | #define MAX_REGS_PER_ADDRESS 1 | |
633 | ||
634 | /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx | |
635 | and check its validity for a certain class. | |
636 | We have two alternate definitions for each of them. | |
637 | The usual definition accepts all pseudo regs; the other rejects | |
638 | them unless they have been allocated suitable hard regs. | |
639 | The symbol REG_OK_STRICT causes the latter definition to be used. | |
640 | ||
641 | Most source files want to accept pseudo regs in the hope that | |
642 | they will get allocated to the class that the insn wants them to be in. | |
643 | Source files for reload pass need to be strict. | |
644 | After reload, it makes no difference, since pseudo regs have | |
645 | been eliminated by then. */ | |
646 | ||
647 | #ifndef REG_OK_STRICT | |
648 | ||
649 | /* Nonzero if X is a hard reg that can be used as an index | |
650 | or if it is a pseudo reg. */ | |
651 | #define REG_OK_FOR_INDEX_P(X) 0 | |
652 | /* Nonzero if X is a hard reg that can be used as a base reg | |
653 | or if it is a pseudo reg. */ | |
654 | #define REG_OK_FOR_BASE_P(X) 1 | |
655 | #define REG_OK_FOR_INDEX_P_STRICT(X) 0 | |
656 | #define REG_OK_FOR_BASE_P_STRICT(X) REGNO_OK_FOR_BASE_P (REGNO (X)) | |
657 | #define STRICT 0 | |
658 | ||
659 | #else | |
660 | ||
661 | /* Nonzero if X is a hard reg that can be used as an index. */ | |
662 | #define REG_OK_FOR_INDEX_P(X) 0 | |
663 | /* Nonzero if X is a hard reg that can be used as a base reg. */ | |
664 | #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) | |
665 | #define STRICT 1 | |
666 | ||
667 | #endif | |
668 | ||
669 | /* A C expression that defines the optional machine-dependent | |
670 | constraint letters that can be used to segregate specific types of | |
671 | operands, usually memory references, for the target machine. | |
672 | Normally this macro will not be defined. If it is required for a | |
673 | particular target machine, it should return 1 if VALUE corresponds | |
674 | to the operand type represented by the constraint letter C. If C | |
675 | is not defined as an extra constraint, the value returned should | |
676 | be 0 regardless of VALUE. | |
677 | ||
678 | For example, on the ROMP, load instructions cannot have their | |
679 | output in r0 if the memory reference contains a symbolic address. | |
680 | Constraint letter `Q' is defined as representing a memory address | |
681 | that does *not* contain a symbolic address. An alternative is | |
682 | specified with a `Q' constraint on the input and `r' on the | |
683 | output. The next alternative specifies `m' on the input and a | |
684 | register class that does not include r0 on the output. */ | |
685 | ||
686 | #define EXTRA_CONSTRAINT(OP, C) \ | |
2ec6cd51 | 687 | ((C) == 'Q' ? ep_memory_operand (OP, GET_MODE (OP), FALSE) \ |
ae180d84 | 688 | : (C) == 'R' ? special_symbolref_operand (OP, VOIDmode) \ |
50d1ff6a RH |
689 | : (C) == 'S' ? (GET_CODE (OP) == SYMBOL_REF \ |
690 | && !SYMBOL_REF_ZDA_P (OP)) \ | |
2ec6cd51 | 691 | : (C) == 'T' ? ep_memory_operand (OP, GET_MODE (OP), TRUE) \ |
50d1ff6a RH |
692 | : (C) == 'U' ? ((GET_CODE (OP) == SYMBOL_REF \ |
693 | && SYMBOL_REF_ZDA_P (OP)) \ | |
1933ec7e JW |
694 | || (GET_CODE (OP) == CONST \ |
695 | && GET_CODE (XEXP (OP, 0)) == PLUS \ | |
223a9d64 | 696 | && GET_CODE (XEXP (XEXP (OP, 0), 0)) == SYMBOL_REF\ |
50d1ff6a | 697 | && SYMBOL_REF_ZDA_P (XEXP (XEXP (OP, 0), 0)))) \ |
223a9d64 N |
698 | : (C) == 'W' ? (GET_CODE (OP) == CONST_INT \ |
699 | && ((unsigned)(INTVAL (OP)) >= 0x8000) \ | |
700 | && ((unsigned)(INTVAL (OP)) < 0x400000)) \ | |
ae180d84 JL |
701 | : 0) |
702 | \f | |
703 | /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression | |
704 | that is a valid memory address for an instruction. | |
705 | The MODE argument is the machine mode for the MEM expression | |
706 | that wants to use this address. | |
707 | ||
708 | The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS, | |
709 | except for CONSTANT_ADDRESS_P which is actually | |
710 | machine-independent. */ | |
711 | ||
712 | /* Accept either REG or SUBREG where a register is valid. */ | |
713 | ||
714 | #define RTX_OK_FOR_BASE_P(X) \ | |
715 | ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \ | |
716 | || (GET_CODE (X) == SUBREG && REG_P (SUBREG_REG (X)) \ | |
717 | && REG_OK_FOR_BASE_P (SUBREG_REG (X)))) | |
718 | ||
719 | #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ | |
720 | do { \ | |
7d866c52 NC |
721 | if (RTX_OK_FOR_BASE_P (X)) \ |
722 | goto ADDR; \ | |
ae180d84 | 723 | if (CONSTANT_ADDRESS_P (X) \ |
7a846a6c NC |
724 | && (MODE == QImode || INTVAL (X) % 2 == 0) \ |
725 | && (GET_MODE_SIZE (MODE) <= 4 || INTVAL (X) % 4 == 0)) \ | |
ae180d84 JL |
726 | goto ADDR; \ |
727 | if (GET_CODE (X) == LO_SUM \ | |
7d866c52 | 728 | && REG_P (XEXP (X, 0)) \ |
ae180d84 JL |
729 | && REG_OK_FOR_BASE_P (XEXP (X, 0)) \ |
730 | && CONSTANT_P (XEXP (X, 1)) \ | |
731 | && (GET_CODE (XEXP (X, 1)) != CONST_INT \ | |
732 | || ((MODE == QImode || INTVAL (XEXP (X, 1)) % 2 == 0) \ | |
733 | && CONST_OK_FOR_K (INTVAL (XEXP (X, 1))))) \ | |
734 | && GET_MODE_SIZE (MODE) <= GET_MODE_SIZE (word_mode)) \ | |
735 | goto ADDR; \ | |
736 | if (special_symbolref_operand (X, MODE) \ | |
737 | && (GET_MODE_SIZE (MODE) <= GET_MODE_SIZE (word_mode))) \ | |
738 | goto ADDR; \ | |
739 | if (GET_CODE (X) == PLUS \ | |
7d866c52 | 740 | && RTX_OK_FOR_BASE_P (XEXP (X, 0)) \ |
223a9d64 | 741 | && (GET_CODE (XEXP (X,1)) == CONST_INT && CONST_OK_FOR_K (INTVAL(XEXP (X,1)) + GET_MODE_NUNITS(MODE) * UNITS_PER_WORD)) \ |
7d866c52 NC |
742 | && ((MODE == QImode || INTVAL (XEXP (X, 1)) % 2 == 0) \ |
743 | && CONST_OK_FOR_K (INTVAL (XEXP (X, 1)) \ | |
744 | + (GET_MODE_NUNITS (MODE) * UNITS_PER_WORD)))) \ | |
745 | goto ADDR; \ | |
ae180d84 JL |
746 | } while (0) |
747 | ||
748 | \f | |
ae180d84 JL |
749 | /* Nonzero if the constant value X is a legitimate general operand. |
750 | It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ | |
751 | ||
752 | #define LEGITIMATE_CONSTANT_P(X) \ | |
753 | (GET_CODE (X) == CONST_DOUBLE \ | |
754 | || !(GET_CODE (X) == CONST \ | |
755 | && GET_CODE (XEXP (X, 0)) == PLUS \ | |
756 | && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF \ | |
757 | && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \ | |
758 | && ! CONST_OK_FOR_K (INTVAL (XEXP (XEXP (X, 0), 1))))) | |
223a9d64 N |
759 | |
760 | /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, | |
761 | return the mode to be used for the comparison. | |
762 | ||
763 | For floating-point equality comparisons, CCFPEQmode should be used. | |
764 | VOIDmode should be used in all other cases. | |
765 | ||
766 | For integer comparisons against zero, reduce to CCNOmode or CCZmode if | |
767 | possible, to allow for more combinations. */ | |
768 | ||
769 | #define SELECT_CC_MODE(OP, X, Y) v850_select_cc_mode (OP, X, Y) | |
770 | ||
ae180d84 JL |
771 | /* Tell final.c how to eliminate redundant test instructions. */ |
772 | ||
773 | /* Here we define machine-dependent flags and fields in cc_status | |
8aeea6e6 | 774 | (see `conditions.h'). No extra ones are needed for the VAX. */ |
ae180d84 JL |
775 | |
776 | /* Store in cc_status the expressions | |
777 | that the condition codes will describe | |
778 | after execution of an instruction whose pattern is EXP. | |
779 | Do not alter them if the instruction would not alter the cc's. */ | |
780 | ||
781 | #define CC_OVERFLOW_UNUSABLE 0x200 | |
782 | #define CC_NO_CARRY CC_NO_OVERFLOW | |
783 | #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN) | |
784 | ||
ae180d84 JL |
785 | /* Nonzero if access to memory by bytes or half words is no faster |
786 | than accessing full words. */ | |
787 | #define SLOW_BYTE_ACCESS 1 | |
788 | ||
ae180d84 JL |
789 | /* According expr.c, a value of around 6 should minimize code size, and |
790 | for the V850 series, that's our primary concern. */ | |
e04ad03d | 791 | #define MOVE_RATIO(speed) 6 |
ae180d84 JL |
792 | |
793 | /* Indirect calls are expensive, never turn a direct call | |
794 | into an indirect call. */ | |
795 | #define NO_FUNCTION_CSE | |
796 | ||
3ce15347 NC |
797 | /* The four different data regions on the v850. */ |
798 | typedef enum | |
799 | { | |
800 | DATA_AREA_NORMAL, | |
801 | DATA_AREA_SDA, | |
802 | DATA_AREA_TDA, | |
803 | DATA_AREA_ZDA | |
804 | } v850_data_area; | |
805 | ||
3ce15347 NC |
806 | #define TEXT_SECTION_ASM_OP "\t.section .text" |
807 | #define DATA_SECTION_ASM_OP "\t.section .data" | |
808 | #define BSS_SECTION_ASM_OP "\t.section .bss" | |
ae180d84 | 809 | #define SDATA_SECTION_ASM_OP "\t.section .sdata,\"aw\"" |
3ce15347 | 810 | #define SBSS_SECTION_ASM_OP "\t.section .sbss,\"aw\"" |
3ce15347 | 811 | |
471b6f1b HPN |
812 | #define SCOMMON_ASM_OP "\t.scomm\t" |
813 | #define ZCOMMON_ASM_OP "\t.zcomm\t" | |
814 | #define TCOMMON_ASM_OP "\t.tcomm\t" | |
ae180d84 | 815 | |
ae180d84 JL |
816 | #define ASM_COMMENT_START "#" |
817 | ||
818 | /* Output to assembler file text saying following lines | |
819 | may contain character constants, extra white space, comments, etc. */ | |
820 | ||
821 | #define ASM_APP_ON "#APP\n" | |
822 | ||
823 | /* Output to assembler file text saying following lines | |
824 | no longer contain unusual constructs. */ | |
825 | ||
826 | #define ASM_APP_OFF "#NO_APP\n" | |
827 | ||
61db4608 NC |
828 | #undef USER_LABEL_PREFIX |
829 | #define USER_LABEL_PREFIX "_" | |
830 | ||
b4378319 NC |
831 | #define OUTPUT_ADDR_CONST_EXTRA(FILE, X, FAIL) \ |
832 | if (! v850_output_addr_const_extra (FILE, X)) \ | |
833 | goto FAIL | |
73a697d9 | 834 | |
ae180d84 | 835 | /* This says how to output the assembler to define a global |
6db34dd4 | 836 | uninitialized but not common symbol. */ |
ae180d84 | 837 | |
f7620587 | 838 | #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ |
6db34dd4 | 839 | asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN)) |
ae180d84 | 840 | |
3ce15347 NC |
841 | #undef ASM_OUTPUT_ALIGNED_BSS |
842 | #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ | |
843 | v850_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) | |
844 | ||
845 | /* This says how to output the assembler to define a global | |
d4de0221 | 846 | uninitialized, common symbol. */ |
3ce15347 NC |
847 | #undef ASM_OUTPUT_ALIGNED_COMMON |
848 | #undef ASM_OUTPUT_COMMON | |
849 | #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \ | |
850 | v850_output_common (FILE, DECL, NAME, SIZE, ALIGN) | |
851 | ||
852 | /* This says how to output the assembler to define a local | |
d4de0221 | 853 | uninitialized symbol. */ |
3ce15347 NC |
854 | #undef ASM_OUTPUT_ALIGNED_LOCAL |
855 | #undef ASM_OUTPUT_LOCAL | |
856 | #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \ | |
857 | v850_output_local (FILE, DECL, NAME, SIZE, ALIGN) | |
858 | ||
506a61b1 KG |
859 | /* Globalizing directive for a label. */ |
860 | #define GLOBAL_ASM_OP "\t.global " | |
ae180d84 | 861 | |
4977bab6 | 862 | #define ASM_PN_FORMAT "%s___%lu" |
ae180d84 JL |
863 | |
864 | /* This is how we tell the assembler that two symbols have the same value. */ | |
865 | ||
866 | #define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \ | |
867 | do { assemble_name(FILE, NAME1); \ | |
868 | fputs(" = ", FILE); \ | |
869 | assemble_name(FILE, NAME2); \ | |
870 | fputc('\n', FILE); } while (0) | |
871 | ||
872 | ||
873 | /* How to refer to registers in assembler output. | |
874 | This sequence is indexed by compiler's hard-register-number (see above). */ | |
875 | ||
223a9d64 N |
876 | #define REGISTER_NAMES \ |
877 | { "r0", "r1", "r2", "sp", "gp", "r5", "r6" , "r7", \ | |
878 | "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ | |
879 | "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \ | |
880 | "r24", "r25", "r26", "r27", "r28", "r29", "ep", "r31", \ | |
881 | "psw", "fcc", \ | |
ae180d84 JL |
882 | ".fp", ".ap"} |
883 | ||
223a9d64 N |
884 | /* Register numbers */ |
885 | ||
886 | #define ADDITIONAL_REGISTER_NAMES \ | |
887 | { { "zero", ZERO_REGNUM }, \ | |
888 | { "hp", 2 }, \ | |
889 | { "r3", 3 }, \ | |
890 | { "r4", 4 }, \ | |
891 | { "tp", 5 }, \ | |
892 | { "fp", 29 }, \ | |
893 | { "r30", 30 }, \ | |
894 | { "lp", LP_REGNUM} } | |
ae180d84 | 895 | |
ae180d84 JL |
896 | /* This is how to output an element of a case-vector that is absolute. */ |
897 | ||
898 | #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ | |
761c70aa KG |
899 | fprintf (FILE, "\t%s .L%d\n", \ |
900 | (TARGET_BIG_SWITCH ? ".long" : ".short"), VALUE) | |
ae180d84 JL |
901 | |
902 | /* This is how to output an element of a case-vector that is relative. */ | |
903 | ||
df5c71ac DD |
904 | /* Disable the shift, which is for the currently disabled "switch" |
905 | opcode. Se casesi in v850.md. */ | |
223a9d64 | 906 | |
b4378319 NC |
907 | #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ |
908 | fprintf (FILE, "\t%s %s.L%d-.L%d%s\n", \ | |
1933ec7e | 909 | (TARGET_BIG_SWITCH ? ".long" : ".short"), \ |
223a9d64 | 910 | (0 && ! TARGET_BIG_SWITCH && (TARGET_V850E || TARGET_V850E2_ALL) ? "(" : ""), \ |
b4378319 | 911 | VALUE, REL, \ |
223a9d64 | 912 | (0 && ! TARGET_BIG_SWITCH && (TARGET_V850E || TARGET_V850E2_ALL) ? ")>>1" : "")) |
ae180d84 | 913 | |
674fdc14 | 914 | #define ASM_OUTPUT_ALIGN(FILE, LOG) \ |
ae180d84 JL |
915 | if ((LOG) != 0) \ |
916 | fprintf (FILE, "\t.align %d\n", (LOG)) | |
917 | ||
956d6950 | 918 | /* We don't have to worry about dbx compatibility for the v850. */ |
ae180d84 JL |
919 | #define DEFAULT_GDB_EXTENSIONS 1 |
920 | ||
921 | /* Use stabs debugging info by default. */ | |
922 | #undef PREFERRED_DEBUGGING_TYPE | |
923 | #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG | |
924 | ||
ae180d84 JL |
925 | /* Specify the machine mode that this machine uses |
926 | for the index in the tablejump instruction. */ | |
1933ec7e | 927 | #define CASE_VECTOR_MODE (TARGET_BIG_SWITCH ? SImode : HImode) |
ae180d84 | 928 | |
18543a22 ILT |
929 | /* Define as C expression which evaluates to nonzero if the tablejump |
930 | instruction expects the table to contain offsets from the address of the | |
931 | table. | |
d4de0221 | 932 | Do not define this if the table should contain absolute addresses. */ |
18543a22 | 933 | #define CASE_VECTOR_PC_RELATIVE 1 |
1933ec7e JW |
934 | |
935 | /* The switch instruction requires that the jump table immediately follow | |
d4de0221 | 936 | it. */ |
223a9d64 | 937 | #define JUMP_TABLES_IN_TEXT_SECTION (!TARGET_JUMP_TABLES_IN_DATA_SECTION) |
1933ec7e | 938 | |
1933ec7e JW |
939 | #undef ASM_OUTPUT_BEFORE_CASE_LABEL |
940 | #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \ | |
941 | ASM_OUTPUT_ALIGN ((FILE), (TARGET_BIG_SWITCH ? 2 : 1)); | |
ae180d84 JL |
942 | |
943 | #define WORD_REGISTER_OPERATIONS | |
944 | ||
945 | /* Byte and short loads sign extend the value to a word. */ | |
946 | #define LOAD_EXTEND_OP(MODE) SIGN_EXTEND | |
947 | ||
ae180d84 JL |
948 | /* This flag, if defined, says the same insns that convert to a signed fixnum |
949 | also convert validly to an unsigned one. */ | |
950 | #define FIXUNS_TRUNC_LIKE_FIX_TRUNC | |
951 | ||
ae180d84 JL |
952 | /* Max number of bytes we can move from memory to memory |
953 | in one reasonably fast instruction. */ | |
954 | #define MOVE_MAX 4 | |
955 | ||
956 | /* Define if shifts truncate the shift count | |
957 | which implies one can omit a sign-extension or zero-extension | |
958 | of a shift count. */ | |
959 | #define SHIFT_COUNT_TRUNCATED 1 | |
960 | ||
961 | /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits | |
962 | is done just by pretending it is already truncated. */ | |
963 | #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 | |
964 | ||
ae180d84 JL |
965 | /* Specify the machine mode that pointers have. |
966 | After generation of rtl, the compiler makes no further distinction | |
967 | between pointers and any other objects of this machine mode. */ | |
968 | #define Pmode SImode | |
969 | ||
970 | /* A function address in a call instruction | |
971 | is a byte address (for indexing purposes) | |
972 | so give the MEM rtx a byte's mode. */ | |
973 | #define FUNCTION_MODE QImode | |
974 | ||
ae180d84 | 975 | /* Tell compiler we want to support GHS pragmas */ |
c58b209a NB |
976 | #define REGISTER_TARGET_PRAGMAS() do { \ |
977 | c_register_pragma ("ghs", "interrupt", ghs_pragma_interrupt); \ | |
978 | c_register_pragma ("ghs", "section", ghs_pragma_section); \ | |
979 | c_register_pragma ("ghs", "starttda", ghs_pragma_starttda); \ | |
980 | c_register_pragma ("ghs", "startsda", ghs_pragma_startsda); \ | |
981 | c_register_pragma ("ghs", "startzda", ghs_pragma_startzda); \ | |
982 | c_register_pragma ("ghs", "endtda", ghs_pragma_endtda); \ | |
983 | c_register_pragma ("ghs", "endsda", ghs_pragma_endsda); \ | |
984 | c_register_pragma ("ghs", "endzda", ghs_pragma_endzda); \ | |
8b97c5f8 | 985 | } while (0) |
3ce15347 NC |
986 | |
987 | /* enum GHS_SECTION_KIND is an enumeration of the kinds of sections that | |
988 | can appear in the "ghs section" pragma. These names are used to index | |
989 | into the GHS_default_section_names[] and GHS_current_section_names[] | |
990 | that are defined in v850.c, and so the ordering of each must remain | |
839a4992 | 991 | consistent. |
3ce15347 NC |
992 | |
993 | These arrays give the default and current names for each kind of | |
994 | section defined by the GHS pragmas. The current names can be changed | |
995 | by the "ghs section" pragma. If the current names are null, use | |
996 | the default names. Note that the two arrays have different types. | |
997 | ||
998 | For the *normal* section kinds (like .data, .text, etc.) we do not | |
999 | want to explicitly force the name of these sections, but would rather | |
1000 | let the linker (or at least the back end) choose the name of the | |
1001 | section, UNLESS the user has force a specific name for these section | |
1002 | kinds. To accomplish this set the name in ghs_default_section_names | |
1003 | to null. */ | |
1004 | ||
1005 | enum GHS_section_kind | |
1006 | { | |
1007 | GHS_SECTION_KIND_DEFAULT, | |
1008 | ||
1009 | GHS_SECTION_KIND_TEXT, | |
1010 | GHS_SECTION_KIND_DATA, | |
1011 | GHS_SECTION_KIND_RODATA, | |
1012 | GHS_SECTION_KIND_BSS, | |
1013 | GHS_SECTION_KIND_SDATA, | |
1014 | GHS_SECTION_KIND_ROSDATA, | |
1015 | GHS_SECTION_KIND_TDATA, | |
1016 | GHS_SECTION_KIND_ZDATA, | |
1017 | GHS_SECTION_KIND_ROZDATA, | |
1018 | ||
1019 | COUNT_OF_GHS_SECTION_KINDS /* must be last */ | |
1020 | }; | |
ae180d84 | 1021 | |
c3edd394 NC |
1022 | /* The following code is for handling pragmas supported by the |
1023 | v850 compiler produced by Green Hills Software. This is at | |
1024 | the specific request of a customer. */ | |
1025 | ||
1026 | typedef struct data_area_stack_element | |
1027 | { | |
1028 | struct data_area_stack_element * prev; | |
1029 | v850_data_area data_area; /* Current default data area. */ | |
1030 | } data_area_stack_element; | |
1031 | ||
1032 | /* Track the current data area set by the | |
1033 | data area pragma (which can be nested). */ | |
1034 | extern data_area_stack_element * data_area_stack; | |
1035 | ||
1036 | /* Names of the various data areas used on the v850. */ | |
1037 | extern union tree_node * GHS_default_section_names [(int) COUNT_OF_GHS_SECTION_KINDS]; | |
1038 | extern union tree_node * GHS_current_section_names [(int) COUNT_OF_GHS_SECTION_KINDS]; | |
1039 | ||
38e01259 | 1040 | /* The assembler op to start the file. */ |
ae180d84 JL |
1041 | |
1042 | #define FILE_ASM_OP "\t.file\n" | |
1043 | ||
1044 | /* Enable the register move pass to improve code. */ | |
1045 | #define ENABLE_REGMOVE_PASS | |
1046 | ||
1047 | ||
1048 | /* Implement ZDA, TDA, and SDA */ | |
1049 | ||
1050 | #define EP_REGNUM 30 /* ep register number */ | |
1051 | ||
50d1ff6a RH |
1052 | #define SYMBOL_FLAG_ZDA (SYMBOL_FLAG_MACH_DEP << 0) |
1053 | #define SYMBOL_FLAG_TDA (SYMBOL_FLAG_MACH_DEP << 1) | |
1054 | #define SYMBOL_FLAG_SDA (SYMBOL_FLAG_MACH_DEP << 2) | |
1055 | #define SYMBOL_REF_ZDA_P(X) ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_ZDA) != 0) | |
1056 | #define SYMBOL_REF_TDA_P(X) ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_TDA) != 0) | |
1057 | #define SYMBOL_REF_SDA_P(X) ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_SDA) != 0) | |
ae180d84 | 1058 | |
d6b5193b RS |
1059 | #define TARGET_ASM_INIT_SECTIONS v850_asm_init_sections |
1060 | ||
122603fa N |
1061 | /* Define this so that the cc1plus will not think that system header files |
1062 | need an implicit 'extern "C" { ... }' assumed. This breaks testing C++ | |
1063 | in a build directory where the libstdc++ header files are found via a | |
1064 | -isystem <path-to-build-dir>. */ | |
1065 | #define NO_IMPLICIT_EXTERN_C | |
223a9d64 | 1066 | |
122603fa | 1067 | #endif /* ! GCC_V850_H */ |