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