]>
Commit | Line | Data |
---|---|---|
956d6950 | 1 | /* Definitions of target machine for GNU compiler. NEC V850 series |
16c484c7 JM |
2 | Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 |
3 | Free Software Foundation, Inc. | |
ae180d84 JL |
4 | Contributed by Jeff Law (law@cygnus.com). |
5 | ||
6 | This file is part of GNU CC. | |
7 | ||
8 | GNU CC is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 2, or (at your option) | |
11 | any later version. | |
12 | ||
13 | GNU CC is distributed in the hope that it will be useful, | |
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. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with GNU CC; see the file COPYING. If not, write to | |
20 | the Free Software Foundation, 59 Temple Place - Suite 330, | |
21 | Boston, MA 02111-1307, USA. */ | |
22 | ||
8b97c5f8 ZW |
23 | #ifndef GCC_V850_H |
24 | #define GCC_V850_H | |
25 | ||
7a846a6c | 26 | /* These are defiend in svr4.h but we want to override them. */ |
ae180d84 JL |
27 | #undef ASM_FINAL_SPEC |
28 | #undef LIB_SPEC | |
29 | #undef ENDFILE_SPEC | |
30 | #undef LINK_SPEC | |
31 | #undef STARTFILE_SPEC | |
7a846a6c | 32 | #undef ASM_SPEC |
ae180d84 | 33 | |
74aca74b | 34 | |
7a846a6c | 35 | #define TARGET_CPU_generic 1 |
74aca74b | 36 | |
7a846a6c NC |
37 | #ifndef TARGET_CPU_DEFAULT |
38 | #define TARGET_CPU_DEFAULT TARGET_CPU_generic | |
74aca74b | 39 | #endif |
ae180d84 | 40 | |
7a846a6c NC |
41 | #define MASK_DEFAULT MASK_V850 |
42 | #define SUBTARGET_ASM_SPEC "%{!mv*:-mv850}" | |
43 | #define SUBTARGET_CPP_SPEC "%{!mv*:-D__v850__}" | |
44 | #define TARGET_VERSION fprintf (stderr, " (NEC V850)"); | |
45 | ||
46 | ||
47 | #define ASM_SPEC "%{mv*:-mv%*}" | |
48 | #define CPP_SPEC "%{mv850ea:-D__v850ea__} %{mv850e:-D__v850e__} %{mv850:-D__v850__} %(subtarget_cpp_spec)" | |
49 | ||
50 | #define EXTRA_SPECS \ | |
51 | { "subtarget_asm_spec", SUBTARGET_ASM_SPEC }, \ | |
52 | { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC } | |
53 | ||
54 | /* Names to predefine in the preprocessor for this target machine. */ | |
55 | #define CPP_PREDEFINES "-D__v851__ -D__v850" | |
ae180d84 JL |
56 | |
57 | /* Run-time compilation parameters selecting different hardware subsets. */ | |
58 | ||
59 | extern int target_flags; | |
60 | ||
61 | /* Target flags bits, see below for an explanation of the bits. */ | |
62 | #define MASK_GHS 0x00000001 | |
63 | #define MASK_LONG_CALLS 0x00000002 | |
64 | #define MASK_EP 0x00000004 | |
65 | #define MASK_PROLOG_FUNCTION 0x00000008 | |
66 | #define MASK_DEBUG 0x40000000 | |
67 | ||
145870b5 NC |
68 | #define MASK_CPU 0x00000030 |
69 | #define MASK_V850 0x00000010 | |
70 | ||
1933ec7e JW |
71 | #define MASK_BIG_SWITCH 0x00000100 |
72 | ||
ae180d84 JL |
73 | /* Macros used in the machine description to test the flags. */ |
74 | ||
75 | /* The GHS calling convention support doesn't really work, | |
76 | mostly due to a lack of documentation. Outstanding issues: | |
77 | ||
78 | * How do varargs & stdarg really work. How to they handle | |
79 | passing structures (if at all). | |
80 | ||
81 | * Doubles are normally 4 byte aligned, except in argument | |
82 | lists where they are 8 byte aligned. Is the alignment | |
83 | in the argument list based on the first parameter, | |
3ce15347 | 84 | first stack parameter, etc etc. |
ae180d84 JL |
85 | |
86 | * Passing/returning of large structures probably isn't the same | |
87 | as GHS. We don't have enough documentation on their conventions | |
956d6950 | 88 | to be compatible. |
ae180d84 JL |
89 | |
90 | * Tests of SETUP_INCOMING_VARARGS need to be made runtime checks | |
91 | since it depends on TARGET_GHS. */ | |
92 | #define TARGET_GHS (target_flags & MASK_GHS) | |
93 | ||
94 | /* Don't do PC-relative calls, instead load the address of the target | |
95 | function into a register and perform a register indirect call. */ | |
96 | #define TARGET_LONG_CALLS (target_flags & MASK_LONG_CALLS) | |
97 | ||
98 | /* Whether to optimize space by using ep (r30) for pointers with small offsets | |
99 | in basic blocks. */ | |
100 | #define TARGET_EP (target_flags & MASK_EP) | |
101 | ||
102 | /* Whether to call out-of-line functions to save registers or not. */ | |
103 | #define TARGET_PROLOG_FUNCTION (target_flags & MASK_PROLOG_FUNCTION) | |
104 | ||
7a846a6c NC |
105 | #define TARGET_V850 ((target_flags & MASK_CPU) == MASK_V850) |
106 | ||
1933ec7e JW |
107 | /* Whether to emit 2 byte per entry or 4 byte per entry switch tables. */ |
108 | #define TARGET_BIG_SWITCH (target_flags & MASK_BIG_SWITCH) | |
109 | ||
ae180d84 JL |
110 | /* General debug flag */ |
111 | #define TARGET_DEBUG (target_flags & MASK_DEBUG) | |
112 | ||
113 | /* Macro to define tables used to set the flags. | |
114 | This is a list in braces of pairs in braces, | |
115 | each pair being { "NAME", VALUE } | |
116 | where VALUE is the bits to set or minus the bits to clear. | |
117 | An empty string NAME is used to identify the default VALUE. */ | |
118 | ||
119 | #define TARGET_SWITCHES \ | |
047142d3 | 120 | {{ "ghs", MASK_GHS, N_("Support Green Hills ABI") }, \ |
3ce15347 NC |
121 | { "no-ghs", -MASK_GHS, "" }, \ |
122 | { "long-calls", MASK_LONG_CALLS, \ | |
047142d3 | 123 | N_("Prohibit PC relative function calls") },\ |
3ce15347 NC |
124 | { "no-long-calls", -MASK_LONG_CALLS, "" }, \ |
125 | { "ep", MASK_EP, \ | |
047142d3 | 126 | N_("Reuse r30 on a per function basis") }, \ |
3ce15347 NC |
127 | { "no-ep", -MASK_EP, "" }, \ |
128 | { "prolog-function", MASK_PROLOG_FUNCTION, \ | |
047142d3 | 129 | N_("Use stubs for function prologues") }, \ |
3ce15347 NC |
130 | { "no-prolog-function", -MASK_PROLOG_FUNCTION, "" }, \ |
131 | { "space", MASK_EP | MASK_PROLOG_FUNCTION, \ | |
047142d3 PT |
132 | N_("Same as: -mep -mprolog-function") }, \ |
133 | { "debug", MASK_DEBUG, N_("Enable backend debugging") }, \ | |
3ce15347 | 134 | { "v850", MASK_V850, \ |
047142d3 | 135 | N_("Compile for the v850 processor") }, \ |
3ce15347 NC |
136 | { "v850", -(MASK_V850 ^ MASK_CPU), "" }, \ |
137 | { "big-switch", MASK_BIG_SWITCH, \ | |
047142d3 | 138 | N_("Use 4 byte entries in switch tables") },\ |
7a846a6c | 139 | { "", MASK_DEFAULT, ""}} |
ae180d84 JL |
140 | |
141 | /* Information about the various small memory areas. */ | |
142 | struct small_memory_info { | |
8b97c5f8 | 143 | const char *name; |
b54480a7 | 144 | const char *value; |
ae180d84 JL |
145 | long max; |
146 | long physical_max; | |
147 | }; | |
148 | ||
149 | enum small_memory_type { | |
150 | /* tiny data area, using EP as base register */ | |
151 | SMALL_MEMORY_TDA = 0, | |
152 | /* small data area using dp as base register */ | |
153 | SMALL_MEMORY_SDA, | |
154 | /* zero data area using r0 as base register */ | |
155 | SMALL_MEMORY_ZDA, | |
156 | SMALL_MEMORY_max | |
157 | }; | |
158 | ||
159 | extern struct small_memory_info small_memory[(int)SMALL_MEMORY_max]; | |
160 | ||
ae180d84 JL |
161 | #define TARGET_OPTIONS \ |
162 | { \ | |
3ce15347 | 163 | { "tda=", &small_memory[ (int)SMALL_MEMORY_TDA ].value, \ |
047142d3 | 164 | N_("Set the max size of data eligible for the TDA area") }, \ |
3ce15347 NC |
165 | { "tda-", &small_memory[ (int)SMALL_MEMORY_TDA ].value, "" }, \ |
166 | { "sda=", &small_memory[ (int)SMALL_MEMORY_SDA ].value, \ | |
047142d3 | 167 | N_("Set the max size of data eligible for the SDA area") }, \ |
3ce15347 NC |
168 | { "sda-", &small_memory[ (int)SMALL_MEMORY_SDA ].value, "" }, \ |
169 | { "zda=", &small_memory[ (int)SMALL_MEMORY_ZDA ].value, \ | |
047142d3 | 170 | N_("Set the max size of data eligible for the ZDA area") }, \ |
3ce15347 | 171 | { "zda-", &small_memory[ (int)SMALL_MEMORY_ZDA ].value, "" }, \ |
ae180d84 JL |
172 | } |
173 | ||
ae180d84 JL |
174 | /* Sometimes certain combinations of command options do not make |
175 | sense on a particular target machine. You can define a macro | |
176 | `OVERRIDE_OPTIONS' to take account of this. This macro, if | |
177 | defined, is executed once just after all the command options have | |
178 | been parsed. | |
179 | ||
180 | Don't use this macro to turn on various extra optimizations for | |
181 | `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */ | |
182 | #define OVERRIDE_OPTIONS override_options () | |
183 | ||
184 | ||
185 | /* Show we can debug even without a frame pointer. */ | |
186 | #define CAN_DEBUG_WITHOUT_FP | |
187 | ||
188 | /* Some machines may desire to change what optimizations are | |
189 | performed for various optimization levels. This macro, if | |
190 | defined, is executed once just after the optimization level is | |
191 | determined and before the remainder of the command options have | |
192 | been parsed. Values set in this macro are used as the default | |
193 | values for the other command line options. | |
194 | ||
195 | LEVEL is the optimization level specified; 2 if `-O2' is | |
196 | specified, 1 if `-O' is specified, and 0 if neither is specified. | |
197 | ||
c6aded7c AG |
198 | SIZE is non-zero if `-Os' is specified, 0 otherwise. |
199 | ||
ae180d84 JL |
200 | You should not use this macro to change options that are not |
201 | machine-specific. These should uniformly selected by the same | |
202 | optimization level on all supported machines. Use this macro to | |
203 | enable machine-specific optimizations. | |
204 | ||
205 | *Do not examine `write_symbols' in this macro!* The debugging | |
206 | options are not supposed to alter the generated code. */ | |
207 | ||
c6aded7c | 208 | #define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \ |
ae180d84 JL |
209 | { \ |
210 | if (LEVEL) \ | |
211 | target_flags |= (MASK_EP | MASK_PROLOG_FUNCTION); \ | |
212 | } | |
213 | ||
214 | \f | |
215 | /* Target machine storage layout */ | |
216 | ||
217 | /* Define this if most significant bit is lowest numbered | |
218 | in instructions that operate on numbered bit-fields. | |
219 | This is not true on the NEC V850. */ | |
220 | #define BITS_BIG_ENDIAN 0 | |
221 | ||
222 | /* Define this if most significant byte of a word is the lowest numbered. */ | |
223 | /* This is not true on the NEC V850. */ | |
224 | #define BYTES_BIG_ENDIAN 0 | |
225 | ||
226 | /* Define this if most significant word of a multiword number is lowest | |
227 | numbered. | |
228 | This is not true on the NEC V850. */ | |
229 | #define WORDS_BIG_ENDIAN 0 | |
230 | ||
ae180d84 JL |
231 | /* Width of a word, in units (bytes). */ |
232 | #define UNITS_PER_WORD 4 | |
233 | ||
ae180d84 JL |
234 | /* Define this macro if it is advisable to hold scalars in registers |
235 | in a wider mode than that declared by the program. In such cases, | |
236 | the value is constrained to be within the bounds of the declared | |
237 | type, but kept valid in the wider mode. The signedness of the | |
238 | extension may differ from that of the type. | |
239 | ||
240 | Some simple experiments have shown that leaving UNSIGNEDP alone | |
241 | generates the best overall code. */ | |
242 | ||
243 | #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \ | |
244 | if (GET_MODE_CLASS (MODE) == MODE_INT \ | |
245 | && GET_MODE_SIZE (MODE) < 4) \ | |
246 | { (MODE) = SImode; } | |
247 | ||
248 | /* Allocation boundary (in *bits*) for storing arguments in argument list. */ | |
249 | #define PARM_BOUNDARY 32 | |
250 | ||
251 | /* The stack goes in 32 bit lumps. */ | |
252 | #define STACK_BOUNDARY 32 | |
253 | ||
254 | /* Allocation boundary (in *bits*) for the code of a function. | |
255 | 16 is the minimum boundary; 32 would give better performance. */ | |
256 | #define FUNCTION_BOUNDARY 16 | |
257 | ||
258 | /* No data type wants to be aligned rounder than this. */ | |
259 | #define BIGGEST_ALIGNMENT 32 | |
260 | ||
261 | /* Alignment of field after `int : 0' in a structure. */ | |
262 | #define EMPTY_FIELD_BOUNDARY 32 | |
263 | ||
264 | /* No structure field wants to be aligned rounder than this. */ | |
265 | #define BIGGEST_FIELD_ALIGNMENT 32 | |
266 | ||
267 | /* Define this if move instructions will actually fail to work | |
268 | when given unaligned data. */ | |
b201442f | 269 | #define STRICT_ALIGNMENT 1 |
ae180d84 JL |
270 | |
271 | /* Define this as 1 if `char' should by default be signed; else as 0. | |
272 | ||
273 | On the NEC V850, loads do sign extension, so make this default. */ | |
274 | #define DEFAULT_SIGNED_CHAR 1 | |
ae180d84 JL |
275 | \f |
276 | /* Standard register usage. */ | |
277 | ||
278 | /* Number of actual hardware registers. | |
279 | The hardware registers are assigned numbers for the compiler | |
280 | from 0 to just below FIRST_PSEUDO_REGISTER. | |
281 | ||
282 | All registers that the compiler knows about must be given numbers, | |
283 | even those that are not normally considered general registers. */ | |
284 | ||
285 | #define FIRST_PSEUDO_REGISTER 34 | |
286 | ||
287 | /* 1 for registers that have pervasive standard uses | |
288 | and are not available for the register allocator. */ | |
289 | ||
290 | #define FIXED_REGISTERS \ | |
291 | { 1, 1, 0, 1, 1, 0, 0, 0, \ | |
292 | 0, 0, 0, 0, 0, 0, 0, 0, \ | |
293 | 0, 0, 0, 0, 0, 0, 0, 0, \ | |
294 | 0, 0, 0, 0, 0, 0, 1, 0, \ | |
295 | 1, 1} | |
296 | ||
297 | /* 1 for registers not available across function calls. | |
298 | These must include the FIXED_REGISTERS and also any | |
299 | registers that can be used without being saved. | |
300 | The latter must include the registers where values are returned | |
301 | and the register where structure-value addresses are passed. | |
302 | Aside from that, you can include as many other registers as you | |
303 | like. */ | |
304 | ||
305 | #define CALL_USED_REGISTERS \ | |
306 | { 1, 1, 0, 1, 1, 1, 1, 1, \ | |
307 | 1, 1, 1, 1, 1, 1, 1, 1, \ | |
308 | 1, 1, 1, 1, 0, 0, 0, 0, \ | |
309 | 0, 0, 0, 0, 0, 0, 1, 1, \ | |
310 | 1, 1} | |
311 | ||
312 | /* List the order in which to allocate registers. Each register must be | |
313 | listed once, even those in FIXED_REGISTERS. | |
314 | ||
315 | On the 850, we make the return registers first, then all of the volatile | |
316 | registers, then the saved registers in reverse order to better save the | |
956d6950 | 317 | registers with an out of line function, and finally the fixed |
ae180d84 JL |
318 | registers. */ |
319 | ||
320 | #define REG_ALLOC_ORDER \ | |
321 | { \ | |
322 | 10, 11, /* return registers */ \ | |
323 | 12, 13, 14, 15, 16, 17, 18, 19, /* scratch registers */ \ | |
324 | 6, 7, 8, 9, 31, /* argument registers */ \ | |
325 | 29, 28, 27, 26, 25, 24, 23, 22, /* saved registers */ \ | |
326 | 21, 20, 2, \ | |
327 | 0, 1, 3, 4, 5, 30, 32, 33 /* fixed registers */ \ | |
328 | } | |
329 | ||
330 | /* Return number of consecutive hard regs needed starting at reg REGNO | |
331 | to hold something of mode MODE. | |
332 | ||
333 | This is ordinarily the length in words of a value of mode MODE | |
334 | but can be less for certain modes in special long registers. */ | |
335 | ||
336 | #define HARD_REGNO_NREGS(REGNO, MODE) \ | |
337 | ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) | |
338 | ||
339 | /* Value is 1 if hard register REGNO can hold a value of machine-mode | |
340 | MODE. */ | |
341 | ||
342 | #define HARD_REGNO_MODE_OK(REGNO, MODE) \ | |
343 | ((((REGNO) & 1) == 0) || (GET_MODE_SIZE (MODE) <= 4)) | |
344 | ||
345 | /* Value is 1 if it is a good idea to tie two pseudo registers | |
346 | when one has mode MODE1 and one has mode MODE2. | |
347 | If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, | |
348 | for any hard reg, then this must be 0 for correct output. */ | |
349 | #define MODES_TIEABLE_P(MODE1, MODE2) \ | |
674fdc14 | 350 | (MODE1 == MODE2 || (GET_MODE_SIZE (MODE1) <= 4 && GET_MODE_SIZE (MODE2) <= 4)) |
ae180d84 JL |
351 | |
352 | \f | |
353 | /* Define the classes of registers for register constraints in the | |
354 | machine description. Also define ranges of constants. | |
355 | ||
356 | One of the classes must always be named ALL_REGS and include all hard regs. | |
357 | If there is more than one class, another class must be named NO_REGS | |
358 | and contain no registers. | |
359 | ||
360 | The name GENERAL_REGS must be the name of a class (or an alias for | |
361 | another name such as ALL_REGS). This is the class of registers | |
362 | that is allowed by "g" or "r" in a register constraint. | |
363 | Also, registers outside this class are allocated only when | |
364 | instructions express preferences for them. | |
365 | ||
366 | The classes must be numbered in nondecreasing order; that is, | |
367 | a larger-numbered class must never be contained completely | |
368 | in a smaller-numbered class. | |
369 | ||
370 | For any two classes, it is very desirable that there be another | |
371 | class that represents their union. */ | |
372 | ||
3ce15347 NC |
373 | enum reg_class |
374 | { | |
ae180d84 JL |
375 | NO_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES |
376 | }; | |
377 | ||
378 | #define N_REG_CLASSES (int) LIM_REG_CLASSES | |
379 | ||
380 | /* Give names of register classes as strings for dump file. */ | |
381 | ||
382 | #define REG_CLASS_NAMES \ | |
383 | { "NO_REGS", "GENERAL_REGS", "ALL_REGS", "LIM_REGS" } | |
384 | ||
385 | /* Define which registers fit in which classes. | |
386 | This is an initializer for a vector of HARD_REG_SET | |
387 | of length N_REG_CLASSES. */ | |
388 | ||
674fdc14 NC |
389 | #define REG_CLASS_CONTENTS \ |
390 | { \ | |
391 | { 0x00000000 }, /* NO_REGS */ \ | |
392 | { 0xffffffff }, /* GENERAL_REGS */ \ | |
393 | { 0xffffffff }, /* ALL_REGS */ \ | |
ae180d84 JL |
394 | } |
395 | ||
396 | /* The same information, inverted: | |
397 | Return the class number of the smallest class containing | |
398 | reg number REGNO. This could be a conditional expression | |
399 | or could index an array. */ | |
400 | ||
401 | #define REGNO_REG_CLASS(REGNO) GENERAL_REGS | |
402 | ||
403 | /* The class value for index registers, and the one for base regs. */ | |
404 | ||
405 | #define INDEX_REG_CLASS NO_REGS | |
406 | #define BASE_REG_CLASS GENERAL_REGS | |
407 | ||
408 | /* Get reg_class from a letter such as appears in the machine description. */ | |
409 | ||
410 | #define REG_CLASS_FROM_LETTER(C) (NO_REGS) | |
411 | ||
412 | /* Macros to check register numbers against specific register classes. */ | |
413 | ||
414 | /* These assume that REGNO is a hard or pseudo reg number. | |
415 | They give nonzero only if REGNO is a hard reg of the suitable class | |
416 | or a pseudo reg currently allocated to a suitable hard reg. | |
417 | Since they use reg_renumber, they are safe only once reg_renumber | |
418 | has been allocated, which happens in local-alloc.c. */ | |
419 | ||
420 | #define REGNO_OK_FOR_BASE_P(regno) \ | |
421 | ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0) | |
422 | ||
423 | #define REGNO_OK_FOR_INDEX_P(regno) 0 | |
424 | ||
425 | /* Given an rtx X being reloaded into a reg required to be | |
426 | in class CLASS, return the class of reg to actually use. | |
427 | In general this is just CLASS; but on some machines | |
428 | in some cases it is preferable to use a more restrictive class. */ | |
429 | ||
430 | #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS) | |
431 | ||
432 | /* Return the maximum number of consecutive registers | |
433 | needed to represent mode MODE in a register of class CLASS. */ | |
434 | ||
435 | #define CLASS_MAX_NREGS(CLASS, MODE) \ | |
436 | ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) | |
437 | ||
438 | /* The letters I, J, K, L, M, N, O, P in a register constraint string | |
439 | can be used to stand for particular ranges of immediate operands. | |
440 | This macro defines what the ranges are. | |
441 | C is the letter, and VALUE is a constant value. | |
442 | Return 1 if VALUE is in the range specified by C. */ | |
443 | ||
444 | #define INT_7_BITS(VALUE) ((unsigned) (VALUE) + 0x40 < 0x80) | |
445 | #define INT_8_BITS(VALUE) ((unsigned) (VALUE) + 0x80 < 0x100) | |
1933ec7e | 446 | /* zero */ |
ae180d84 | 447 | #define CONST_OK_FOR_I(VALUE) ((VALUE) == 0) |
1933ec7e | 448 | /* 5 bit signed immediate */ |
ae180d84 | 449 | #define CONST_OK_FOR_J(VALUE) ((unsigned) (VALUE) + 0x10 < 0x20) |
1933ec7e | 450 | /* 16 bit signed immediate */ |
ae180d84 | 451 | #define CONST_OK_FOR_K(VALUE) ((unsigned) (VALUE) + 0x8000 < 0x10000) |
1933ec7e | 452 | /* valid constant for movhi instruction. */ |
ae180d84 JL |
453 | #define CONST_OK_FOR_L(VALUE) \ |
454 | (((unsigned) ((int) (VALUE) >> 16) + 0x8000 < 0x10000) \ | |
455 | && CONST_OK_FOR_I ((VALUE & 0xffff))) | |
1933ec7e JW |
456 | /* 16 bit unsigned immediate */ |
457 | #define CONST_OK_FOR_M(VALUE) ((unsigned)(VALUE) < 0x10000) | |
458 | /* 5 bit unsigned immediate in shift instructions */ | |
459 | #define CONST_OK_FOR_N(VALUE) ((unsigned) (VALUE) <= 31) | |
ae180d84 | 460 | |
ae180d84 JL |
461 | #define CONST_OK_FOR_O(VALUE) 0 |
462 | #define CONST_OK_FOR_P(VALUE) 0 | |
463 | ||
145870b5 | 464 | |
ae180d84 JL |
465 | #define CONST_OK_FOR_LETTER_P(VALUE, C) \ |
466 | ((C) == 'I' ? CONST_OK_FOR_I (VALUE) : \ | |
467 | (C) == 'J' ? CONST_OK_FOR_J (VALUE) : \ | |
468 | (C) == 'K' ? CONST_OK_FOR_K (VALUE) : \ | |
469 | (C) == 'L' ? CONST_OK_FOR_L (VALUE) : \ | |
470 | (C) == 'M' ? CONST_OK_FOR_M (VALUE) : \ | |
471 | (C) == 'N' ? CONST_OK_FOR_N (VALUE) : \ | |
472 | (C) == 'O' ? CONST_OK_FOR_O (VALUE) : \ | |
473 | (C) == 'P' ? CONST_OK_FOR_P (VALUE) : \ | |
474 | 0) | |
475 | ||
476 | /* Similar, but for floating constants, and defining letters G and H. | |
477 | Here VALUE is the CONST_DOUBLE rtx itself. | |
478 | ||
479 | `G' is a zero of some form. */ | |
480 | ||
481 | #define CONST_DOUBLE_OK_FOR_G(VALUE) \ | |
482 | ((GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \ | |
483 | && (VALUE) == CONST0_RTX (GET_MODE (VALUE))) \ | |
484 | || (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_INT \ | |
485 | && CONST_DOUBLE_LOW (VALUE) == 0 \ | |
486 | && CONST_DOUBLE_HIGH (VALUE) == 0)) | |
487 | ||
488 | #define CONST_DOUBLE_OK_FOR_H(VALUE) 0 | |
489 | ||
490 | #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \ | |
491 | ((C) == 'G' ? CONST_DOUBLE_OK_FOR_G (VALUE) \ | |
492 | : (C) == 'H' ? CONST_DOUBLE_OK_FOR_H (VALUE) \ | |
493 | : 0) | |
494 | ||
495 | \f | |
496 | /* Stack layout; function entry, exit and calling. */ | |
497 | ||
498 | /* Define this if pushing a word on the stack | |
499 | makes the stack pointer a smaller address. */ | |
500 | ||
501 | #define STACK_GROWS_DOWNWARD | |
502 | ||
503 | /* Define this if the nominal address of the stack frame | |
504 | is at the high-address end of the local variables; | |
505 | that is, each additional local variable allocated | |
506 | goes at a more negative offset in the frame. */ | |
507 | ||
508 | #define FRAME_GROWS_DOWNWARD | |
509 | ||
510 | /* Offset within stack frame to start allocating local variables at. | |
511 | If FRAME_GROWS_DOWNWARD, this is the offset to the END of the | |
512 | first local allocated. Otherwise, it is the offset to the BEGINNING | |
513 | of the first local allocated. */ | |
514 | ||
515 | #define STARTING_FRAME_OFFSET 0 | |
516 | ||
517 | /* Offset of first parameter from the argument pointer register value. */ | |
518 | /* Is equal to the size of the saved fp + pc, even if an fp isn't | |
519 | saved since the value is used before we know. */ | |
520 | ||
521 | #define FIRST_PARM_OFFSET(FNDECL) 0 | |
522 | ||
523 | /* Specify the registers used for certain standard purposes. | |
524 | The values of these macros are register numbers. */ | |
525 | ||
526 | /* Register to use for pushing function arguments. */ | |
527 | #define STACK_POINTER_REGNUM 3 | |
528 | ||
529 | /* Base register for access to local variables of the function. */ | |
530 | #define FRAME_POINTER_REGNUM 32 | |
531 | ||
29a65e3d NC |
532 | /* Register containing return address from latest function call. */ |
533 | #define LINK_POINTER_REGNUM 31 | |
534 | ||
ae180d84 JL |
535 | /* On some machines the offset between the frame pointer and starting |
536 | offset of the automatic variables is not known until after register | |
537 | allocation has been done (for example, because the saved registers | |
538 | are between these two locations). On those machines, define | |
539 | `FRAME_POINTER_REGNUM' the number of a special, fixed register to | |
540 | be used internally until the offset is known, and define | |
541 | `HARD_FRAME_POINTER_REGNUM' to be actual the hard register number | |
542 | used for the frame pointer. | |
543 | ||
544 | You should define this macro only in the very rare circumstances | |
545 | when it is not possible to calculate the offset between the frame | |
546 | pointer and the automatic variables until after register | |
547 | allocation has been completed. When this macro is defined, you | |
548 | must also indicate in your definition of `ELIMINABLE_REGS' how to | |
549 | eliminate `FRAME_POINTER_REGNUM' into either | |
550 | `HARD_FRAME_POINTER_REGNUM' or `STACK_POINTER_REGNUM'. | |
551 | ||
552 | Do not define this macro if it would be the same as | |
553 | `FRAME_POINTER_REGNUM'. */ | |
3ce15347 | 554 | #undef HARD_FRAME_POINTER_REGNUM |
ae180d84 JL |
555 | #define HARD_FRAME_POINTER_REGNUM 29 |
556 | ||
557 | /* Base register for access to arguments of the function. */ | |
558 | #define ARG_POINTER_REGNUM 33 | |
559 | ||
560 | /* Register in which static-chain is passed to a function. */ | |
3ce15347 | 561 | #define STATIC_CHAIN_REGNUM 20 |
ae180d84 JL |
562 | |
563 | /* Value should be nonzero if functions must have frame pointers. | |
564 | Zero means the frame pointer need not be set up (and parms | |
565 | may be accessed via the stack pointer) in functions that seem suitable. | |
566 | This is computed in `reload', in reload1.c. */ | |
567 | #define FRAME_POINTER_REQUIRED 0 | |
568 | ||
569 | /* If defined, this macro specifies a table of register pairs used to | |
570 | eliminate unneeded registers that point into the stack frame. If | |
571 | it is not defined, the only elimination attempted by the compiler | |
572 | is to replace references to the frame pointer with references to | |
573 | the stack pointer. | |
574 | ||
575 | The definition of this macro is a list of structure | |
576 | initializations, each of which specifies an original and | |
577 | replacement register. | |
578 | ||
579 | On some machines, the position of the argument pointer is not | |
580 | known until the compilation is completed. In such a case, a | |
581 | separate hard register must be used for the argument pointer. | |
582 | This register can be eliminated by replacing it with either the | |
583 | frame pointer or the argument pointer, depending on whether or not | |
584 | the frame pointer has been eliminated. | |
585 | ||
586 | In this case, you might specify: | |
587 | #define ELIMINABLE_REGS \ | |
588 | {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ | |
589 | {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \ | |
590 | {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}} | |
591 | ||
592 | Note that the elimination of the argument pointer with the stack | |
593 | pointer is specified first since that is the preferred elimination. */ | |
594 | ||
595 | #define ELIMINABLE_REGS \ | |
596 | {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \ | |
597 | { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \ | |
598 | { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \ | |
599 | { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }} \ | |
600 | ||
601 | /* A C expression that returns non-zero if the compiler is allowed to | |
602 | try to replace register number FROM-REG with register number | |
603 | TO-REG. This macro need only be defined if `ELIMINABLE_REGS' is | |
604 | defined, and will usually be the constant 1, since most of the | |
605 | cases preventing register elimination are things that the compiler | |
606 | already knows about. */ | |
607 | ||
608 | #define CAN_ELIMINATE(FROM, TO) \ | |
609 | ((TO) == STACK_POINTER_REGNUM ? ! frame_pointer_needed : 1) | |
610 | ||
611 | /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It | |
612 | specifies the initial difference between the specified pair of | |
613 | registers. This macro must be defined if `ELIMINABLE_REGS' is | |
614 | defined. */ | |
615 | ||
616 | #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ | |
617 | { \ | |
618 | if ((FROM) == FRAME_POINTER_REGNUM) \ | |
619 | (OFFSET) = get_frame_size () + current_function_outgoing_args_size; \ | |
620 | else if ((FROM) == ARG_POINTER_REGNUM) \ | |
621 | (OFFSET) = compute_frame_size (get_frame_size (), (long *)0); \ | |
622 | else \ | |
623 | abort (); \ | |
624 | } | |
625 | ||
626 | /* A guess for the V850. */ | |
627 | #define PROMOTE_PROTOTYPES 1 | |
628 | ||
629 | /* Keep the stack pointer constant throughout the function. */ | |
f73ad30e | 630 | #define ACCUMULATE_OUTGOING_ARGS 1 |
ae180d84 JL |
631 | |
632 | /* Value is the number of bytes of arguments automatically | |
633 | popped when returning from a subroutine call. | |
634 | FUNDECL is the declaration node of the function (as a tree), | |
635 | FUNTYPE is the data type of the function (as a tree), | |
636 | or for a library call it is an identifier node for the subroutine name. | |
637 | SIZE is the number of bytes of arguments passed on the stack. */ | |
638 | ||
639 | #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0 | |
640 | ||
a64761a3 | 641 | #define RETURN_ADDR_RTX(COUNT, FP) v850_return_addr (COUNT) |
ae180d84 JL |
642 | \f |
643 | /* Define a data type for recording info about an argument list | |
644 | during the scan of that argument list. This data type should | |
645 | hold all necessary information about the function itself | |
646 | and about the args processed so far, enough to enable macros | |
647 | such as FUNCTION_ARG to determine where the next arg should go. */ | |
648 | ||
649 | #define CUMULATIVE_ARGS struct cum_arg | |
650 | struct cum_arg { int nbytes; }; | |
651 | ||
652 | /* Define where to put the arguments to a function. | |
653 | Value is zero to push the argument on the stack, | |
654 | or a hard register in which to store the argument. | |
655 | ||
656 | MODE is the argument's machine mode. | |
657 | TYPE is the data type of the argument (as a tree). | |
658 | This is null for libcalls where that information may | |
659 | not be available. | |
660 | CUM is a variable of type CUMULATIVE_ARGS which gives info about | |
661 | the preceding args and about the function being called. | |
662 | NAMED is nonzero if this argument is a named parameter | |
663 | (otherwise it is an extra parameter matching an ellipsis). */ | |
664 | ||
ae180d84 JL |
665 | #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ |
666 | function_arg (&CUM, MODE, TYPE, NAMED) | |
667 | ||
668 | #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ | |
669 | function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED) | |
670 | ||
671 | /* Initialize a variable CUM of type CUMULATIVE_ARGS | |
672 | for a call to a function whose data type is FNTYPE. | |
673 | For a library call, FNTYPE is 0. */ | |
674 | ||
675 | #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \ | |
676 | ((CUM).nbytes = 0) | |
677 | ||
678 | /* Update the data in CUM to advance over an argument | |
679 | of mode MODE and data type TYPE. | |
680 | (TYPE is null for libcalls where that information may not be available.) */ | |
681 | ||
682 | #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ | |
683 | ((CUM).nbytes += ((MODE) != BLKmode \ | |
684 | ? (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD \ | |
685 | : (int_size_in_bytes (TYPE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD)) | |
686 | ||
687 | /* When a parameter is passed in a register, stack space is still | |
688 | allocated for it. */ | |
689 | #define REG_PARM_STACK_SPACE(DECL) (!TARGET_GHS ? 16 : 0) | |
690 | ||
691 | /* Define this if the above stack space is to be considered part of the | |
692 | space allocated by the caller. */ | |
693 | #define OUTGOING_REG_PARM_STACK_SPACE | |
694 | ||
695 | extern int current_function_anonymous_args; | |
696 | /* Do any setup necessary for varargs/stdargs functions. */ | |
697 | #define SETUP_INCOMING_VARARGS(CUM, MODE, TYPE, PAS, SECOND) \ | |
698 | current_function_anonymous_args = (!TARGET_GHS ? 1 : 0); | |
699 | ||
bc092c4a RH |
700 | /* Implement `va_arg'. */ |
701 | #define EXPAND_BUILTIN_VA_ARG(valist, type) \ | |
702 | v850_va_arg (valist, type) | |
703 | ||
ae180d84 JL |
704 | #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \ |
705 | ((TYPE) && int_size_in_bytes (TYPE) > 8) | |
706 | ||
707 | #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \ | |
708 | ((TYPE) && int_size_in_bytes (TYPE) > 8) | |
709 | ||
710 | /* 1 if N is a possible register number for function argument passing. */ | |
711 | ||
712 | #define FUNCTION_ARG_REGNO_P(N) (N >= 6 && N <= 9) | |
713 | ||
714 | /* Define how to find the value returned by a function. | |
715 | VALTYPE is the data type of the value (as a tree). | |
716 | If the precise function being called is known, FUNC is its FUNCTION_DECL; | |
717 | otherwise, FUNC is 0. */ | |
718 | ||
719 | #define FUNCTION_VALUE(VALTYPE, FUNC) \ | |
c5c76735 | 720 | gen_rtx_REG (TYPE_MODE (VALTYPE), 10) |
ae180d84 JL |
721 | |
722 | /* Define how to find the value returned by a library function | |
723 | assuming the value has mode MODE. */ | |
724 | ||
725 | #define LIBCALL_VALUE(MODE) \ | |
c5c76735 | 726 | gen_rtx_REG (MODE, 10) |
ae180d84 JL |
727 | |
728 | /* 1 if N is a possible register number for a function value. */ | |
729 | ||
730 | #define FUNCTION_VALUE_REGNO_P(N) ((N) == 10) | |
731 | ||
732 | /* Return values > 8 bytes in length in memory. */ | |
733 | #define DEFAULT_PCC_STRUCT_RETURN 0 | |
734 | #define RETURN_IN_MEMORY(TYPE) \ | |
735 | (int_size_in_bytes (TYPE) > 8 || TYPE_MODE (TYPE) == BLKmode) | |
736 | ||
737 | /* Register in which address to store a structure value | |
738 | is passed to a function. On the V850 it's passed as | |
739 | the first parameter. */ | |
740 | ||
741 | #define STRUCT_VALUE 0 | |
742 | ||
743 | /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, | |
744 | the stack pointer does not matter. The value is tested only in | |
745 | functions that have frame pointers. | |
746 | No definition is equivalent to always zero. */ | |
747 | ||
748 | #define EXIT_IGNORE_STACK 1 | |
749 | ||
750 | /* Output assembler code to FILE to increment profiler label # LABELNO | |
751 | for profiling a function entry. */ | |
752 | ||
753 | #define FUNCTION_PROFILER(FILE, LABELNO) ; | |
754 | ||
755 | #define TRAMPOLINE_TEMPLATE(FILE) \ | |
756 | do { \ | |
757 | fprintf (FILE, "\tjarl .+4,r12\n"); \ | |
6ed7412a | 758 | fprintf (FILE, "\tld.w 12[r12],r20\n"); \ |
ae180d84 JL |
759 | fprintf (FILE, "\tld.w 16[r12],r12\n"); \ |
760 | fprintf (FILE, "\tjmp [r12]\n"); \ | |
761 | fprintf (FILE, "\tnop\n"); \ | |
762 | fprintf (FILE, "\t.long 0\n"); \ | |
763 | fprintf (FILE, "\t.long 0\n"); \ | |
764 | } while (0) | |
765 | ||
766 | /* Length in units of the trampoline for entering a nested function. */ | |
767 | ||
768 | #define TRAMPOLINE_SIZE 24 | |
769 | ||
770 | /* Emit RTL insns to initialize the variable parts of a trampoline. | |
771 | FNADDR is an RTX for the address of the function's pure code. | |
772 | CXT is an RTX for the static chain value for the function. */ | |
773 | ||
774 | #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ | |
775 | { \ | |
c5c76735 | 776 | emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 16)), \ |
ae180d84 | 777 | (CXT)); \ |
c5c76735 | 778 | emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 20)), \ |
ae180d84 JL |
779 | (FNADDR)); \ |
780 | } | |
781 | ||
782 | /* Addressing modes, and classification of registers for them. */ | |
783 | ||
784 | \f | |
785 | /* 1 if X is an rtx for a constant that is a valid address. */ | |
786 | ||
1933ec7e JW |
787 | /* ??? This seems too exclusive. May get better code by accepting more |
788 | possibilities here, in particular, should accept ZDA_NAME SYMBOL_REFs. */ | |
789 | ||
ae180d84 JL |
790 | #define CONSTANT_ADDRESS_P(X) \ |
791 | (GET_CODE (X) == CONST_INT \ | |
792 | && CONST_OK_FOR_K (INTVAL (X))) | |
793 | ||
794 | /* Maximum number of registers that can appear in a valid memory address. */ | |
795 | ||
796 | #define MAX_REGS_PER_ADDRESS 1 | |
797 | ||
798 | /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx | |
799 | and check its validity for a certain class. | |
800 | We have two alternate definitions for each of them. | |
801 | The usual definition accepts all pseudo regs; the other rejects | |
802 | them unless they have been allocated suitable hard regs. | |
803 | The symbol REG_OK_STRICT causes the latter definition to be used. | |
804 | ||
805 | Most source files want to accept pseudo regs in the hope that | |
806 | they will get allocated to the class that the insn wants them to be in. | |
807 | Source files for reload pass need to be strict. | |
808 | After reload, it makes no difference, since pseudo regs have | |
809 | been eliminated by then. */ | |
810 | ||
811 | #ifndef REG_OK_STRICT | |
812 | ||
813 | /* Nonzero if X is a hard reg that can be used as an index | |
814 | or if it is a pseudo reg. */ | |
815 | #define REG_OK_FOR_INDEX_P(X) 0 | |
816 | /* Nonzero if X is a hard reg that can be used as a base reg | |
817 | or if it is a pseudo reg. */ | |
818 | #define REG_OK_FOR_BASE_P(X) 1 | |
819 | #define REG_OK_FOR_INDEX_P_STRICT(X) 0 | |
820 | #define REG_OK_FOR_BASE_P_STRICT(X) REGNO_OK_FOR_BASE_P (REGNO (X)) | |
821 | #define STRICT 0 | |
822 | ||
823 | #else | |
824 | ||
825 | /* Nonzero if X is a hard reg that can be used as an index. */ | |
826 | #define REG_OK_FOR_INDEX_P(X) 0 | |
827 | /* Nonzero if X is a hard reg that can be used as a base reg. */ | |
828 | #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) | |
829 | #define STRICT 1 | |
830 | ||
831 | #endif | |
832 | ||
833 | /* A C expression that defines the optional machine-dependent | |
834 | constraint letters that can be used to segregate specific types of | |
835 | operands, usually memory references, for the target machine. | |
836 | Normally this macro will not be defined. If it is required for a | |
837 | particular target machine, it should return 1 if VALUE corresponds | |
838 | to the operand type represented by the constraint letter C. If C | |
839 | is not defined as an extra constraint, the value returned should | |
840 | be 0 regardless of VALUE. | |
841 | ||
842 | For example, on the ROMP, load instructions cannot have their | |
843 | output in r0 if the memory reference contains a symbolic address. | |
844 | Constraint letter `Q' is defined as representing a memory address | |
845 | that does *not* contain a symbolic address. An alternative is | |
846 | specified with a `Q' constraint on the input and `r' on the | |
847 | output. The next alternative specifies `m' on the input and a | |
848 | register class that does not include r0 on the output. */ | |
849 | ||
850 | #define EXTRA_CONSTRAINT(OP, C) \ | |
674fdc14 | 851 | ((C) == 'Q' ? ep_memory_operand (OP, GET_MODE (OP), 0) \ |
ae180d84 JL |
852 | : (C) == 'R' ? special_symbolref_operand (OP, VOIDmode) \ |
853 | : (C) == 'S' ? (GET_CODE (OP) == SYMBOL_REF && ! ZDA_NAME_P (XSTR (OP, 0))) \ | |
854 | : (C) == 'T' ? 0 \ | |
1933ec7e JW |
855 | : (C) == 'U' ? ((GET_CODE (OP) == SYMBOL_REF && ZDA_NAME_P (XSTR (OP, 0))) \ |
856 | || (GET_CODE (OP) == CONST \ | |
857 | && GET_CODE (XEXP (OP, 0)) == PLUS \ | |
858 | && GET_CODE (XEXP (XEXP (OP, 0), 0)) == SYMBOL_REF \ | |
859 | && ZDA_NAME_P (XSTR (XEXP (XEXP (OP, 0), 0), 0)))) \ | |
ae180d84 JL |
860 | : 0) |
861 | \f | |
862 | /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression | |
863 | that is a valid memory address for an instruction. | |
864 | The MODE argument is the machine mode for the MEM expression | |
865 | that wants to use this address. | |
866 | ||
867 | The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS, | |
868 | except for CONSTANT_ADDRESS_P which is actually | |
869 | machine-independent. */ | |
870 | ||
871 | /* Accept either REG or SUBREG where a register is valid. */ | |
872 | ||
873 | #define RTX_OK_FOR_BASE_P(X) \ | |
874 | ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \ | |
875 | || (GET_CODE (X) == SUBREG && REG_P (SUBREG_REG (X)) \ | |
876 | && REG_OK_FOR_BASE_P (SUBREG_REG (X)))) | |
877 | ||
878 | #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ | |
879 | do { \ | |
880 | if (RTX_OK_FOR_BASE_P (X)) goto ADDR; \ | |
881 | if (CONSTANT_ADDRESS_P (X) \ | |
7a846a6c NC |
882 | && (MODE == QImode || INTVAL (X) % 2 == 0) \ |
883 | && (GET_MODE_SIZE (MODE) <= 4 || INTVAL (X) % 4 == 0)) \ | |
ae180d84 JL |
884 | goto ADDR; \ |
885 | if (GET_CODE (X) == LO_SUM \ | |
886 | && GET_CODE (XEXP (X, 0)) == REG \ | |
887 | && REG_OK_FOR_BASE_P (XEXP (X, 0)) \ | |
888 | && CONSTANT_P (XEXP (X, 1)) \ | |
889 | && (GET_CODE (XEXP (X, 1)) != CONST_INT \ | |
890 | || ((MODE == QImode || INTVAL (XEXP (X, 1)) % 2 == 0) \ | |
891 | && CONST_OK_FOR_K (INTVAL (XEXP (X, 1))))) \ | |
892 | && GET_MODE_SIZE (MODE) <= GET_MODE_SIZE (word_mode)) \ | |
893 | goto ADDR; \ | |
894 | if (special_symbolref_operand (X, MODE) \ | |
895 | && (GET_MODE_SIZE (MODE) <= GET_MODE_SIZE (word_mode))) \ | |
896 | goto ADDR; \ | |
897 | if (GET_CODE (X) == PLUS \ | |
898 | && CONSTANT_ADDRESS_P (XEXP (X, 1)) \ | |
899 | && (MODE == QImode || INTVAL (XEXP (X, 1)) % 2 == 0) \ | |
900 | && RTX_OK_FOR_BASE_P (XEXP (X, 0))) goto ADDR; \ | |
901 | } while (0) | |
902 | ||
903 | \f | |
904 | /* Try machine-dependent ways of modifying an illegitimate address | |
905 | to be legitimate. If we find one, return the new, valid address. | |
906 | This macro is used in only one place: `memory_address' in explow.c. | |
907 | ||
908 | OLDX is the address as it was before break_out_memory_refs was called. | |
909 | In some cases it is useful to look at this to decide what needs to be done. | |
910 | ||
911 | MODE and WIN are passed so that this macro can use | |
912 | GO_IF_LEGITIMATE_ADDRESS. | |
913 | ||
914 | It is always safe for this macro to do nothing. It exists to recognize | |
915 | opportunities to optimize the output. */ | |
916 | ||
917 | #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {} | |
918 | ||
919 | /* Go to LABEL if ADDR (a legitimate address expression) | |
920 | has an effect that depends on the machine mode it is used for. */ | |
921 | ||
922 | #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {} | |
923 | ||
924 | /* Nonzero if the constant value X is a legitimate general operand. | |
925 | It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ | |
926 | ||
927 | #define LEGITIMATE_CONSTANT_P(X) \ | |
928 | (GET_CODE (X) == CONST_DOUBLE \ | |
929 | || !(GET_CODE (X) == CONST \ | |
930 | && GET_CODE (XEXP (X, 0)) == PLUS \ | |
931 | && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF \ | |
932 | && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \ | |
933 | && ! CONST_OK_FOR_K (INTVAL (XEXP (XEXP (X, 0), 1))))) | |
934 | ||
935 | /* In rare cases, correct code generation requires extra machine | |
936 | dependent processing between the second jump optimization pass and | |
937 | delayed branch scheduling. On those machines, define this macro | |
938 | as a C statement to act on the code starting at INSN. */ | |
939 | ||
940 | #define MACHINE_DEPENDENT_REORG(INSN) v850_reorg (INSN) | |
941 | ||
942 | \f | |
943 | /* Tell final.c how to eliminate redundant test instructions. */ | |
944 | ||
945 | /* Here we define machine-dependent flags and fields in cc_status | |
8aeea6e6 | 946 | (see `conditions.h'). No extra ones are needed for the VAX. */ |
ae180d84 JL |
947 | |
948 | /* Store in cc_status the expressions | |
949 | that the condition codes will describe | |
950 | after execution of an instruction whose pattern is EXP. | |
951 | Do not alter them if the instruction would not alter the cc's. */ | |
952 | ||
953 | #define CC_OVERFLOW_UNUSABLE 0x200 | |
954 | #define CC_NO_CARRY CC_NO_OVERFLOW | |
955 | #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN) | |
956 | ||
957 | /* A part of a C `switch' statement that describes the relative costs | |
958 | of constant RTL expressions. It must contain `case' labels for | |
959 | expression codes `const_int', `const', `symbol_ref', `label_ref' | |
960 | and `const_double'. Each case must ultimately reach a `return' | |
961 | statement to return the relative cost of the use of that kind of | |
962 | constant value in an expression. The cost may depend on the | |
963 | precise value of the constant, which is available for examination | |
964 | in X, and the rtx code of the expression in which it is contained, | |
965 | found in OUTER_CODE. | |
966 | ||
967 | CODE is the expression code--redundant, since it can be obtained | |
968 | with `GET_CODE (X)'. */ | |
969 | ||
970 | #define CONST_COSTS(RTX,CODE,OUTER_CODE) \ | |
971 | case CONST_INT: \ | |
972 | case CONST_DOUBLE: \ | |
973 | case CONST: \ | |
974 | case SYMBOL_REF: \ | |
975 | case LABEL_REF: \ | |
976 | { \ | |
977 | int _zxy = const_costs(RTX, CODE); \ | |
978 | return (_zxy) ? COSTS_N_INSNS (_zxy) : 0; \ | |
979 | } | |
980 | ||
981 | /* A crude cut at RTX_COSTS for the V850. */ | |
982 | ||
983 | /* Provide the costs of a rtl expression. This is in the body of a | |
984 | switch on CODE. | |
985 | ||
986 | There aren't DImode MOD, DIV or MULT operations, so call them | |
956d6950 | 987 | very expensive. Everything else is pretty much a constant cost. */ |
ae180d84 JL |
988 | |
989 | #define RTX_COSTS(RTX,CODE,OUTER_CODE) \ | |
990 | case MOD: \ | |
991 | case DIV: \ | |
992 | return 60; \ | |
993 | case MULT: \ | |
994 | return 20; | |
995 | ||
996 | /* All addressing modes have the same cost on the V850 series. */ | |
997 | #define ADDRESS_COST(ADDR) 1 | |
998 | ||
999 | /* Nonzero if access to memory by bytes or half words is no faster | |
1000 | than accessing full words. */ | |
1001 | #define SLOW_BYTE_ACCESS 1 | |
1002 | ||
ae180d84 JL |
1003 | /* According expr.c, a value of around 6 should minimize code size, and |
1004 | for the V850 series, that's our primary concern. */ | |
1005 | #define MOVE_RATIO 6 | |
1006 | ||
1007 | /* Indirect calls are expensive, never turn a direct call | |
1008 | into an indirect call. */ | |
1009 | #define NO_FUNCTION_CSE | |
1010 | ||
3ce15347 NC |
1011 | /* The four different data regions on the v850. */ |
1012 | typedef enum | |
1013 | { | |
1014 | DATA_AREA_NORMAL, | |
1015 | DATA_AREA_SDA, | |
1016 | DATA_AREA_TDA, | |
1017 | DATA_AREA_ZDA | |
1018 | } v850_data_area; | |
1019 | ||
ae180d84 JL |
1020 | /* A list of names for sections other than the standard two, which are |
1021 | `in_text' and `in_data'. You need not define this macro on a | |
1022 | system with no other sections (that GCC needs to use). */ | |
1023 | #undef EXTRA_SECTIONS | |
d48bc59a | 1024 | #define EXTRA_SECTIONS in_tdata, in_sdata, in_zdata, \ |
19652adf | 1025 | in_rozdata, in_rosdata, in_sbss, in_zbss, in_zcommon, in_scommon |
ae180d84 JL |
1026 | |
1027 | /* One or more functions to be defined in `varasm.c'. These | |
1028 | functions should do jobs analogous to those of `text_section' and | |
1029 | `data_section', for your additional sections. Do not define this | |
1030 | macro if you do not define `EXTRA_SECTIONS'. */ | |
1031 | #undef EXTRA_SECTION_FUNCTIONS | |
3ce15347 NC |
1032 | |
1033 | /* This could be done a lot more cleanly using ANSI C ... */ | |
ae180d84 | 1034 | #define EXTRA_SECTION_FUNCTIONS \ |
ae180d84 JL |
1035 | void \ |
1036 | sdata_section () \ | |
1037 | { \ | |
1038 | if (in_section != in_sdata) \ | |
1039 | { \ | |
1040 | fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \ | |
1041 | in_section = in_sdata; \ | |
1042 | } \ | |
1043 | } \ | |
1044 | \ | |
1045 | void \ | |
3ce15347 NC |
1046 | rosdata_section () \ |
1047 | { \ | |
1048 | if (in_section != in_rosdata) \ | |
1049 | { \ | |
1050 | fprintf (asm_out_file, "%s\n", ROSDATA_SECTION_ASM_OP); \ | |
1051 | in_section = in_sdata; \ | |
1052 | } \ | |
1053 | } \ | |
1054 | \ | |
1055 | void \ | |
1056 | sbss_section () \ | |
1057 | { \ | |
1058 | if (in_section != in_sbss) \ | |
1059 | { \ | |
1060 | fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \ | |
1061 | in_section = in_sbss; \ | |
1062 | } \ | |
1063 | } \ | |
1064 | \ | |
1065 | void \ | |
ae180d84 JL |
1066 | tdata_section () \ |
1067 | { \ | |
1068 | if (in_section != in_tdata) \ | |
1069 | { \ | |
1070 | fprintf (asm_out_file, "%s\n", TDATA_SECTION_ASM_OP); \ | |
1071 | in_section = in_tdata; \ | |
1072 | } \ | |
1073 | } \ | |
1074 | \ | |
1075 | void \ | |
1076 | zdata_section () \ | |
1077 | { \ | |
1078 | if (in_section != in_zdata) \ | |
1079 | { \ | |
1080 | fprintf (asm_out_file, "%s\n", ZDATA_SECTION_ASM_OP); \ | |
1081 | in_section = in_zdata; \ | |
1082 | } \ | |
3ce15347 NC |
1083 | } \ |
1084 | \ | |
1085 | void \ | |
1086 | rozdata_section () \ | |
1087 | { \ | |
1088 | if (in_section != in_rozdata) \ | |
1089 | { \ | |
1090 | fprintf (asm_out_file, "%s\n", ROZDATA_SECTION_ASM_OP); \ | |
1091 | in_section = in_rozdata; \ | |
1092 | } \ | |
1093 | } \ | |
1094 | \ | |
1095 | void \ | |
1096 | zbss_section () \ | |
1097 | { \ | |
1098 | if (in_section != in_zbss) \ | |
1099 | { \ | |
1100 | fprintf (asm_out_file, "%s\n", ZBSS_SECTION_ASM_OP); \ | |
1101 | in_section = in_zbss; \ | |
1102 | } \ | |
ae180d84 JL |
1103 | } |
1104 | ||
3ce15347 NC |
1105 | #define TEXT_SECTION_ASM_OP "\t.section .text" |
1106 | #define DATA_SECTION_ASM_OP "\t.section .data" | |
1107 | #define BSS_SECTION_ASM_OP "\t.section .bss" | |
ae180d84 | 1108 | #define SDATA_SECTION_ASM_OP "\t.section .sdata,\"aw\"" |
3ce15347 | 1109 | #define SBSS_SECTION_ASM_OP "\t.section .sbss,\"aw\"" |
ae180d84 | 1110 | #define ZDATA_SECTION_ASM_OP "\t.section .zdata,\"aw\"" |
3ce15347 | 1111 | #define ZBSS_SECTION_ASM_OP "\t.section .zbss,\"aw\"" |
ae180d84 | 1112 | #define TDATA_SECTION_ASM_OP "\t.section .tdata,\"aw\"" |
3ce15347 NC |
1113 | #define ROSDATA_SECTION_ASM_OP "\t.section .rosdata,\"a\"" |
1114 | #define ROZDATA_SECTION_ASM_OP "\t.section .rozdata,\"a\"" | |
1115 | ||
471b6f1b HPN |
1116 | #define SCOMMON_ASM_OP "\t.scomm\t" |
1117 | #define ZCOMMON_ASM_OP "\t.zcomm\t" | |
1118 | #define TCOMMON_ASM_OP "\t.tcomm\t" | |
ae180d84 | 1119 | |
ae180d84 JL |
1120 | /* Output at beginning/end of assembler file. */ |
1121 | #undef ASM_FILE_START | |
1122 | #define ASM_FILE_START(FILE) asm_file_start(FILE) | |
1123 | ||
1124 | #define ASM_COMMENT_START "#" | |
1125 | ||
1126 | /* Output to assembler file text saying following lines | |
1127 | may contain character constants, extra white space, comments, etc. */ | |
1128 | ||
1129 | #define ASM_APP_ON "#APP\n" | |
1130 | ||
1131 | /* Output to assembler file text saying following lines | |
1132 | no longer contain unusual constructs. */ | |
1133 | ||
1134 | #define ASM_APP_OFF "#NO_APP\n" | |
1135 | ||
61db4608 NC |
1136 | #undef USER_LABEL_PREFIX |
1137 | #define USER_LABEL_PREFIX "_" | |
1138 | ||
301d03af | 1139 | /* When assemble_integer is used to emit the offsets for a switch |
73a697d9 NC |
1140 | table it can encounter (TRUNCATE:HI (MINUS:SI (LABEL_REF:SI) (LABEL_REF:SI))). |
1141 | output_addr_const will normally barf at this, but it is OK to omit | |
1142 | the truncate and just emit the difference of the two labels. The | |
1143 | .hword directive will automatically handle the truncation for us. */ | |
1144 | ||
1145 | #define OUTPUT_ADDR_CONST_EXTRA(FILE, X, FAIL) \ | |
1146 | if (GET_CODE (x) == TRUNCATE) \ | |
b3656137 | 1147 | output_addr_const (FILE, XEXP (X, 0)); \ |
73a697d9 NC |
1148 | else \ |
1149 | goto FAIL; | |
1150 | ||
ae180d84 | 1151 | /* This says how to output the assembler to define a global |
6db34dd4 | 1152 | uninitialized but not common symbol. */ |
ae180d84 | 1153 | |
f7620587 | 1154 | #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ |
6db34dd4 | 1155 | asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN)) |
ae180d84 | 1156 | |
3ce15347 NC |
1157 | #undef ASM_OUTPUT_ALIGNED_BSS |
1158 | #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ | |
1159 | v850_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) | |
1160 | ||
1161 | /* This says how to output the assembler to define a global | |
1162 | uninitialized, common symbol. */ | |
1163 | #undef ASM_OUTPUT_ALIGNED_COMMON | |
1164 | #undef ASM_OUTPUT_COMMON | |
1165 | #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \ | |
1166 | v850_output_common (FILE, DECL, NAME, SIZE, ALIGN) | |
1167 | ||
1168 | /* This says how to output the assembler to define a local | |
1169 | uninitialized symbol. */ | |
1170 | #undef ASM_OUTPUT_ALIGNED_LOCAL | |
1171 | #undef ASM_OUTPUT_LOCAL | |
1172 | #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \ | |
1173 | v850_output_local (FILE, DECL, NAME, SIZE, ALIGN) | |
1174 | ||
506a61b1 KG |
1175 | /* Globalizing directive for a label. */ |
1176 | #define GLOBAL_ASM_OP "\t.global " | |
ae180d84 | 1177 | |
77f43519 CM |
1178 | /* This is how to output a reference to a user-level label named NAME. |
1179 | `assemble_name' uses this. */ | |
1180 | ||
1181 | #undef ASM_OUTPUT_LABELREF | |
772c5265 RH |
1182 | #define ASM_OUTPUT_LABELREF(FILE, NAME) \ |
1183 | asm_fprintf (FILE, "%U%s", (*targetm.strip_name_encoding) (NAME)) | |
ae180d84 JL |
1184 | |
1185 | /* Store in OUTPUT a string (made with alloca) containing | |
1186 | an assembler-name for a local static variable named NAME. | |
1187 | LABELNO is an integer which is different for each call. */ | |
1188 | ||
1189 | #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ | |
1190 | ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ | |
1191 | sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO))) | |
1192 | ||
1193 | /* This is how we tell the assembler that two symbols have the same value. */ | |
1194 | ||
1195 | #define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \ | |
1196 | do { assemble_name(FILE, NAME1); \ | |
1197 | fputs(" = ", FILE); \ | |
1198 | assemble_name(FILE, NAME2); \ | |
1199 | fputc('\n', FILE); } while (0) | |
1200 | ||
1201 | ||
1202 | /* How to refer to registers in assembler output. | |
1203 | This sequence is indexed by compiler's hard-register-number (see above). */ | |
1204 | ||
1205 | #define REGISTER_NAMES \ | |
1206 | { "r0", "r1", "r2", "sp", "gp", "r5", "r6" , "r7", \ | |
1207 | "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ | |
1208 | "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \ | |
1209 | "r24", "r25", "r26", "r27", "r28", "r29", "ep", "r31", \ | |
1210 | ".fp", ".ap"} | |
1211 | ||
1212 | #define ADDITIONAL_REGISTER_NAMES \ | |
1213 | { { "zero", 0 }, \ | |
1214 | { "hp", 2 }, \ | |
1215 | { "r3", 3 }, \ | |
1216 | { "r4", 4 }, \ | |
1217 | { "tp", 5 }, \ | |
1218 | { "fp", 29 }, \ | |
1219 | { "r30", 30 }, \ | |
1220 | { "lp", 31} } | |
1221 | ||
1222 | /* Print an instruction operand X on file FILE. | |
1223 | look in v850.c for details */ | |
1224 | ||
3ce15347 | 1225 | #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE) |
ae180d84 JL |
1226 | |
1227 | #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \ | |
1228 | ((CODE) == '.') | |
1229 | ||
1230 | /* Print a memory operand whose address is X, on file FILE. | |
1231 | This uses a function in output-vax.c. */ | |
1232 | ||
1233 | #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR) | |
1234 | ||
1235 | #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) | |
1236 | #define ASM_OUTPUT_REG_POP(FILE,REGNO) | |
1237 | ||
1238 | /* This is how to output an element of a case-vector that is absolute. */ | |
1239 | ||
1240 | #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ | |
761c70aa KG |
1241 | fprintf (FILE, "\t%s .L%d\n", \ |
1242 | (TARGET_BIG_SWITCH ? ".long" : ".short"), VALUE) | |
ae180d84 JL |
1243 | |
1244 | /* This is how to output an element of a case-vector that is relative. */ | |
1245 | ||
33f7f353 | 1246 | #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ |
1933ec7e JW |
1247 | fprintf (FILE, "\t%s .L%d-.L%d\n", \ |
1248 | (TARGET_BIG_SWITCH ? ".long" : ".short"), \ | |
1249 | VALUE, REL) | |
ae180d84 | 1250 | |
674fdc14 | 1251 | #define ASM_OUTPUT_ALIGN(FILE, LOG) \ |
ae180d84 JL |
1252 | if ((LOG) != 0) \ |
1253 | fprintf (FILE, "\t.align %d\n", (LOG)) | |
1254 | ||
956d6950 | 1255 | /* We don't have to worry about dbx compatibility for the v850. */ |
ae180d84 JL |
1256 | #define DEFAULT_GDB_EXTENSIONS 1 |
1257 | ||
1258 | /* Use stabs debugging info by default. */ | |
1259 | #undef PREFERRED_DEBUGGING_TYPE | |
1260 | #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG | |
1261 | ||
ae180d84 JL |
1262 | /* Specify the machine mode that this machine uses |
1263 | for the index in the tablejump instruction. */ | |
1933ec7e | 1264 | #define CASE_VECTOR_MODE (TARGET_BIG_SWITCH ? SImode : HImode) |
ae180d84 JL |
1265 | |
1266 | /* Define this if the case instruction drops through after the table | |
1267 | when the index is out of range. Don't define it if the case insn | |
1268 | jumps to the default label instead. */ | |
1933ec7e JW |
1269 | /* #define CASE_DROPS_THROUGH */ |
1270 | ||
18543a22 ILT |
1271 | /* Define as C expression which evaluates to nonzero if the tablejump |
1272 | instruction expects the table to contain offsets from the address of the | |
1273 | table. | |
1274 | Do not define this if the table should contain absolute addresses. */ | |
1275 | #define CASE_VECTOR_PC_RELATIVE 1 | |
1933ec7e JW |
1276 | |
1277 | /* The switch instruction requires that the jump table immediately follow | |
1278 | it. */ | |
75197b37 | 1279 | #define JUMP_TABLES_IN_TEXT_SECTION 1 |
1933ec7e JW |
1280 | |
1281 | /* svr4.h defines this assuming that 4 byte alignment is required. */ | |
1282 | #undef ASM_OUTPUT_BEFORE_CASE_LABEL | |
1283 | #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \ | |
1284 | ASM_OUTPUT_ALIGN ((FILE), (TARGET_BIG_SWITCH ? 2 : 1)); | |
ae180d84 JL |
1285 | |
1286 | #define WORD_REGISTER_OPERATIONS | |
1287 | ||
1288 | /* Byte and short loads sign extend the value to a word. */ | |
1289 | #define LOAD_EXTEND_OP(MODE) SIGN_EXTEND | |
1290 | ||
ae180d84 JL |
1291 | /* This flag, if defined, says the same insns that convert to a signed fixnum |
1292 | also convert validly to an unsigned one. */ | |
1293 | #define FIXUNS_TRUNC_LIKE_FIX_TRUNC | |
1294 | ||
ae180d84 JL |
1295 | /* Max number of bytes we can move from memory to memory |
1296 | in one reasonably fast instruction. */ | |
1297 | #define MOVE_MAX 4 | |
1298 | ||
1299 | /* Define if shifts truncate the shift count | |
1300 | which implies one can omit a sign-extension or zero-extension | |
1301 | of a shift count. */ | |
1302 | #define SHIFT_COUNT_TRUNCATED 1 | |
1303 | ||
1304 | /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits | |
1305 | is done just by pretending it is already truncated. */ | |
1306 | #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 | |
1307 | ||
1308 | #define STORE_FLAG_VALUE 1 | |
1309 | ||
1310 | /* Specify the machine mode that pointers have. | |
1311 | After generation of rtl, the compiler makes no further distinction | |
1312 | between pointers and any other objects of this machine mode. */ | |
1313 | #define Pmode SImode | |
1314 | ||
1315 | /* A function address in a call instruction | |
1316 | is a byte address (for indexing purposes) | |
1317 | so give the MEM rtx a byte's mode. */ | |
1318 | #define FUNCTION_MODE QImode | |
1319 | ||
ae180d84 | 1320 | /* Tell compiler we want to support GHS pragmas */ |
8b97c5f8 | 1321 | #define REGISTER_TARGET_PRAGMAS(PFILE) do { \ |
8b97c5f8 ZW |
1322 | cpp_register_pragma (PFILE, "ghs", "interrupt", ghs_pragma_interrupt); \ |
1323 | cpp_register_pragma (PFILE, "ghs", "section", ghs_pragma_section); \ | |
1324 | cpp_register_pragma (PFILE, "ghs", "starttda", ghs_pragma_starttda); \ | |
1325 | cpp_register_pragma (PFILE, "ghs", "startsda", ghs_pragma_startsda); \ | |
1326 | cpp_register_pragma (PFILE, "ghs", "startzda", ghs_pragma_startzda); \ | |
1327 | cpp_register_pragma (PFILE, "ghs", "endtda", ghs_pragma_endtda); \ | |
1328 | cpp_register_pragma (PFILE, "ghs", "endsda", ghs_pragma_endsda); \ | |
1329 | cpp_register_pragma (PFILE, "ghs", "endzda", ghs_pragma_endzda); \ | |
1330 | } while (0) | |
3ce15347 NC |
1331 | |
1332 | /* enum GHS_SECTION_KIND is an enumeration of the kinds of sections that | |
1333 | can appear in the "ghs section" pragma. These names are used to index | |
1334 | into the GHS_default_section_names[] and GHS_current_section_names[] | |
1335 | that are defined in v850.c, and so the ordering of each must remain | |
1336 | consistant. | |
1337 | ||
1338 | These arrays give the default and current names for each kind of | |
1339 | section defined by the GHS pragmas. The current names can be changed | |
1340 | by the "ghs section" pragma. If the current names are null, use | |
1341 | the default names. Note that the two arrays have different types. | |
1342 | ||
1343 | For the *normal* section kinds (like .data, .text, etc.) we do not | |
1344 | want to explicitly force the name of these sections, but would rather | |
1345 | let the linker (or at least the back end) choose the name of the | |
1346 | section, UNLESS the user has force a specific name for these section | |
1347 | kinds. To accomplish this set the name in ghs_default_section_names | |
1348 | to null. */ | |
1349 | ||
1350 | enum GHS_section_kind | |
1351 | { | |
1352 | GHS_SECTION_KIND_DEFAULT, | |
1353 | ||
1354 | GHS_SECTION_KIND_TEXT, | |
1355 | GHS_SECTION_KIND_DATA, | |
1356 | GHS_SECTION_KIND_RODATA, | |
1357 | GHS_SECTION_KIND_BSS, | |
1358 | GHS_SECTION_KIND_SDATA, | |
1359 | GHS_SECTION_KIND_ROSDATA, | |
1360 | GHS_SECTION_KIND_TDATA, | |
1361 | GHS_SECTION_KIND_ZDATA, | |
1362 | GHS_SECTION_KIND_ROZDATA, | |
1363 | ||
1364 | COUNT_OF_GHS_SECTION_KINDS /* must be last */ | |
1365 | }; | |
ae180d84 | 1366 | |
c3edd394 NC |
1367 | /* The following code is for handling pragmas supported by the |
1368 | v850 compiler produced by Green Hills Software. This is at | |
1369 | the specific request of a customer. */ | |
1370 | ||
1371 | typedef struct data_area_stack_element | |
1372 | { | |
1373 | struct data_area_stack_element * prev; | |
1374 | v850_data_area data_area; /* Current default data area. */ | |
1375 | } data_area_stack_element; | |
1376 | ||
1377 | /* Track the current data area set by the | |
1378 | data area pragma (which can be nested). */ | |
1379 | extern data_area_stack_element * data_area_stack; | |
1380 | ||
1381 | /* Names of the various data areas used on the v850. */ | |
1382 | extern union tree_node * GHS_default_section_names [(int) COUNT_OF_GHS_SECTION_KINDS]; | |
1383 | extern union tree_node * GHS_current_section_names [(int) COUNT_OF_GHS_SECTION_KINDS]; | |
1384 | ||
38e01259 | 1385 | /* The assembler op to start the file. */ |
ae180d84 JL |
1386 | |
1387 | #define FILE_ASM_OP "\t.file\n" | |
1388 | ||
1389 | /* Enable the register move pass to improve code. */ | |
1390 | #define ENABLE_REGMOVE_PASS | |
1391 | ||
1392 | ||
1393 | /* Implement ZDA, TDA, and SDA */ | |
1394 | ||
1395 | #define EP_REGNUM 30 /* ep register number */ | |
1396 | ||
ae180d84 JL |
1397 | #define ZDA_NAME_FLAG_CHAR '@' |
1398 | #define TDA_NAME_FLAG_CHAR '%' | |
1399 | #define SDA_NAME_FLAG_CHAR '&' | |
1400 | ||
1401 | #define ZDA_NAME_P(NAME) (*(NAME) == ZDA_NAME_FLAG_CHAR) | |
1402 | #define TDA_NAME_P(NAME) (*(NAME) == TDA_NAME_FLAG_CHAR) | |
1403 | #define SDA_NAME_P(NAME) (*(NAME) == SDA_NAME_FLAG_CHAR) | |
1404 | ||
1405 | #define ENCODED_NAME_P(SYMBOL_NAME) \ | |
61db4608 | 1406 | ( ZDA_NAME_P (SYMBOL_NAME) \ |
ae180d84 JL |
1407 | || TDA_NAME_P (SYMBOL_NAME) \ |
1408 | || SDA_NAME_P (SYMBOL_NAME)) | |
1409 | ||
ae180d84 JL |
1410 | /* Define this if you have defined special-purpose predicates in the |
1411 | file `MACHINE.c'. This macro is called within an initializer of an | |
1412 | array of structures. The first field in the structure is the name | |
1413 | of a predicate and the second field is an array of rtl codes. For | |
1414 | each predicate, list all rtl codes that can be in expressions | |
1415 | matched by the predicate. The list should have a trailing comma. */ | |
1416 | ||
1417 | #define PREDICATE_CODES \ | |
ae180d84 JL |
1418 | { "reg_or_0_operand", { REG, SUBREG, CONST_INT, CONST_DOUBLE }}, \ |
1419 | { "reg_or_int5_operand", { REG, SUBREG, CONST_INT }}, \ | |
1420 | { "call_address_operand", { REG, SYMBOL_REF }}, \ | |
1421 | { "movsi_source_operand", { LABEL_REF, SYMBOL_REF, CONST_INT, \ | |
1422 | CONST_DOUBLE, CONST, HIGH, MEM, \ | |
1423 | REG, SUBREG }}, \ | |
1424 | { "special_symbolref_operand", { SYMBOL_REF }}, \ | |
1425 | { "power_of_two_operand", { CONST_INT }}, \ | |
145870b5 NC |
1426 | { "pattern_is_ok_for_prologue", { PARALLEL }}, \ |
1427 | { "pattern_is_ok_for_epilogue", { PARALLEL }}, \ | |
1428 | { "register_is_ok_for_epilogue",{ REG }}, \ | |
ae180d84 | 1429 | { "not_power_of_two_operand", { CONST_INT }}, |
3ce15347 | 1430 | |
88657302 | 1431 | #endif /* ! GCC_V850_H */ |