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