* h8300/h8300.h (OK_FOR_U): If generating H8/S code, accept
[official-gcc.git] / gcc / config / h8300 / h8300.h
blob9d4288b5b90d37fb46523de37dd2f86abb464d7d
1 /* Definitions of target machine for GNU compiler.
2 Hitachi H8/300 version generating coff
3 Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
4 Contributed by Steve Chamberlain (sac@cygnus.com),
5 Jim Wilson (wilson@cygnus.com), and Doug Evans (dje@cygnus.com).
7 This file is part of GNU CC.
9 GNU CC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
14 GNU CC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GNU CC; see the file COPYING. If not, write to
21 the Free Software Foundation, 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
24 /* Which cpu to compile for.
25 We use int for CPU_TYPE to avoid lots of casts. */
26 #if 0 /* defined in insn-attr.h, here for documentation */
27 enum attr_cpu { CPU_H8300, CPU_H8300H };
28 #endif
29 extern int cpu_type;
31 /* Various globals defined in h8300.c. */
33 extern char *h8_push_op,*h8_pop_op,*h8_mov_op;
34 extern char **h8_reg_names;
36 /* Names to predefine in the preprocessor for this target machine. */
38 #define CPP_PREDEFINES \
39 "-D__LONG_MAX__=2147483647L -D__LONG_LONG_MAX__=2147483647L"
41 #define CPP_SPEC \
42 "%{!mh:%{!ms:-D__H8300__}} %{mh:-D__H8300H__} %{ms:-D__H8300S__} \
43 %{!mh:%{!ms:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}} \
44 %{mh:-D__SIZE_TYPE__=unsigned\\ long -D__PTRDIFF_TYPE__=long} \
45 %{ms:-D__SIZE_TYPE__=unsigned\\ long -D__PTRDIFF_TYPE__=long} \
46 %{!mh:%{!ms:-Acpu(h8300) -Amachine(h8300)}} \
47 %{mh:-Acpu(h8300h) -Amachine(h8300h)} \
48 %{ms:-Acpu(h8300s) -Amachine(h8300s)} \
49 %{!mint32:-D__INT_MAX__=32767} %{mint32:-D__INT_MAX__=2147483647}"
51 #define LINK_SPEC "%{mh:-m h8300h} %{ms:-m h8300s}"
53 #define LIB_SPEC "%{mrelax:-relax} %{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
55 /* Print subsidiary information on the compiler version in use. */
57 #define TARGET_VERSION fprintf (stderr, " (Hitachi H8/300)");
59 /* Run-time compilation parameters selecting different hardware subsets. */
61 extern int target_flags;
63 /* Macros used in the machine description to test the flags. */
65 /* Make int's 32 bits. */
66 #define TARGET_INT32 (target_flags & 8)
68 /* Dump recorded insn lengths into the output file. This helps debug the
69 md file. */
70 #define TARGET_ADDRESSES (target_flags & 64)
72 /* Pass the first few arguments in registers. */
73 #define TARGET_QUICKCALL (target_flags & 128)
75 /* Pretend byte accesses are slow. */
76 #define TARGET_SLOWBYTE (target_flags & 256)
78 /* Dump each assembler insn's rtl into the output file.
79 This is for debugging the compiler only. */
80 #define TARGET_RTL_DUMP (target_flags & 2048)
82 /* Select between the h8/300 and h8/300h cpus. */
83 #define TARGET_H8300 (! TARGET_H8300H && ! TARGET_H8300S)
84 #define TARGET_H8300H (target_flags & 4096)
85 #define TARGET_H8300S (target_flags & 1)
87 /* Align all values on the h8/300h the same way as the h8/300. Specifically,
88 32 bit and larger values are aligned on 16 bit boundaries.
89 This is all the hardware requires, but the default is 32 bits for the 300h.
90 ??? Now watch someone add hardware floating point requiring 32 bit
91 alignment. */
92 #define TARGET_ALIGN_300 (target_flags & 8192)
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. */
100 #define TARGET_SWITCHES \
101 { {"s",1 }, \
102 {"no-s",-1}, \
103 {"int32",8}, \
104 {"addresses",64 }, \
105 {"quickcall",128}, \
106 {"no-quickcall",-128}, \
107 {"slowbyte",256}, \
108 {"relax",1024}, \
109 {"rtl-dump",2048}, \
110 {"h",4096}, \
111 {"no-h",-4096}, \
112 {"align-300",8192}, \
113 { "", TARGET_DEFAULT}}
115 /* Do things that must be done once at start up. */
117 #define OVERRIDE_OPTIONS \
118 do { \
119 h8300_init_once (); \
120 } while (0)
122 /* Default target_flags if no switches specified. */
124 #ifndef TARGET_DEFAULT
125 #define TARGET_DEFAULT (128) /* quickcall */
126 #endif
128 /* Show we can debug even without a frame pointer. */
129 /* #define CAN_DEBUG_WITHOUT_FP */
131 /* Define this if addresses of constant functions
132 shouldn't be put through pseudo regs where they can be cse'd.
133 Desirable on machines where ordinary constants are expensive
134 but a CALL with constant address is cheap.
136 Calls through a register are cheaper than calls to named
137 functions; however, the register pressure this causes makes
138 CSEing of function addresses generally a lose. */
139 #define NO_FUNCTION_CSE
141 /* Target machine storage layout */
143 /* Define to use software floating point emulator for REAL_ARITHMETIC and
144 decimal <-> binary conversion. */
145 #define REAL_ARITHMETIC
147 /* Define this if most significant bit is lowest numbered
148 in instructions that operate on numbered bit-fields.
149 This is not true on the H8/300. */
150 #define BITS_BIG_ENDIAN 0
152 /* Define this if most significant byte of a word is the lowest numbered. */
153 /* That is true on the H8/300. */
154 #define BYTES_BIG_ENDIAN 1
156 /* Define this if most significant word of a multiword number is lowest
157 numbered.
158 This is true on an H8/300 (actually we can make it up, but we choose to
159 be consistent). */
160 #define WORDS_BIG_ENDIAN 1
162 /* Number of bits in an addressable storage unit */
163 #define BITS_PER_UNIT 8
165 /* Width in bits of a "word", which is the contents of a machine register.
166 Note that this is not necessarily the width of data type `int';
167 if using 16-bit ints on a 68000, this would still be 32.
168 But on a machine with 16-bit registers, this would be 16. */
169 #define BITS_PER_WORD (TARGET_H8300H || TARGET_H8300S ? 32 : 16)
170 #define MAX_BITS_PER_WORD 32
172 /* Width of a word, in units (bytes). */
173 #define UNITS_PER_WORD (TARGET_H8300H || TARGET_H8300S ? 4 : 2)
174 #define MIN_UNITS_PER_WORD 2
176 /* Width in bits of a pointer.
177 See also the macro `Pmode' defined below. */
178 #define POINTER_SIZE (TARGET_H8300H || TARGET_H8300S ? 32 : 16)
180 #define SHORT_TYPE_SIZE 16
181 #define INT_TYPE_SIZE (TARGET_INT32 ? 32 : 16)
182 #define LONG_TYPE_SIZE 32
183 #define LONG_LONG_TYPE_SIZE 32
184 #define FLOAT_TYPE_SIZE 32
185 #define DOUBLE_TYPE_SIZE 32
186 #define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE
188 #define MAX_FIXED_MODE_SIZE 32
190 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
191 #define PARM_BOUNDARY (TARGET_H8300H || TARGET_H8300S ? 32 : 16)
193 /* Allocation boundary (in *bits*) for the code of a function. */
194 #define FUNCTION_BOUNDARY 16
196 /* Alignment of field after `int : 0' in a structure. */
197 /* One can argue this should be 32 for -mint32, but since 32 bit ints only
198 need 16 bit alignment, this is left as is so that -mint32 doesn't change
199 structure layouts. */
200 #define EMPTY_FIELD_BOUNDARY 16
202 /* A bitfield declared as `int' forces `int' alignment for the struct. */
203 #define PCC_BITFIELD_TYPE_MATTERS 0
205 /* No data type wants to be aligned rounder than this.
206 32 bit values are aligned as such on the 300h for speed. */
207 #define BIGGEST_ALIGNMENT \
208 (((TARGET_H8300H || TARGET_H8300S) && ! TARGET_ALIGN_300) ? 32 : 16)
210 /* No structure field wants to be aligned rounder than this. */
211 #define BIGGEST_FIELD_ALIGNMENT \
212 (((TARGET_H8300H || TARGET_H8300S) && ! TARGET_ALIGN_300) ? 32 : 16)
214 /* The stack goes in 16/32 bit lumps. */
215 #define STACK_BOUNDARY (TARGET_H8300 ? 16 : 32)
217 /* Define this if move instructions will actually fail to work
218 when given unaligned data. */
219 /* On the H8/300, longs can be aligned on halfword boundaries, but not
220 byte boundaries. */
221 #define STRICT_ALIGNMENT 1
223 /* Standard register usage. */
225 /* Number of actual hardware registers.
226 The hardware registers are assigned numbers for the compiler
227 from 0 to just below FIRST_PSEUDO_REGISTER.
229 All registers that the compiler knows about must be given numbers,
230 even those that are not normally considered general registers.
232 Reg 8 does not correspond to any hardware register, but instead
233 appears in the RTL as an argument pointer prior to reload, and is
234 eliminated during reloading in favor of either the stack or frame
235 pointer. */
237 #define FIRST_PSEUDO_REGISTER 9
239 /* 1 for registers that have pervasive standard uses
240 and are not available for the register allocator. */
242 #define FIXED_REGISTERS \
243 { 0, 0, 0, 0, 0, 0, 0, 1, 1}
245 /* 1 for registers not available across function calls.
246 These must include the FIXED_REGISTERS and also any
247 registers that can be used without being saved.
248 The latter must include the registers where values are returned
249 and the register where structure-value addresses are passed.
250 Aside from that, you can include as many other registers as you
251 like.
253 h8 destroys r0,r1,r2,r3. */
255 #define CALL_USED_REGISTERS \
256 { 1, 1, 1, 1, 0, 0, 0, 1, 1 }
258 #define REG_ALLOC_ORDER \
259 { 2, 3, 0, 1, 4, 5, 6, 7, 8}
261 /* Return number of consecutive hard regs needed starting at reg REGNO
262 to hold something of mode MODE.
264 This is ordinarily the length in words of a value of mode MODE
265 but can be less for certain modes in special long registers. */
267 #define HARD_REGNO_NREGS(REGNO, MODE) \
268 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
270 /* Value is 1 if hard register REGNO can hold a value of machine-mode
271 MODE.
273 H8/300: If an even reg, then anything goes. Otherwise the mode must be QI
274 or HI.
275 H8/300H: Anything goes. */
277 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
278 (TARGET_H8300 ? (((REGNO)&1)==0) || (MODE==HImode) || (MODE==QImode) \
279 : 1)
281 /* Value is 1 if it is a good idea to tie two pseudo registers
282 when one has mode MODE1 and one has mode MODE2.
283 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
284 for any hard reg, then this must be 0 for correct output. */
285 #define MODES_TIEABLE_P(MODE1, MODE2) ((MODE1) == (MODE2))
287 /* Specify the registers used for certain standard purposes.
288 The values of these macros are register numbers. */
290 /* H8/300 pc is not overloaded on a register. */
292 /*#define PC_REGNUM 15*/
294 /* Register to use for pushing function arguments. */
295 #define STACK_POINTER_REGNUM 7
297 /* Base register for access to local variables of the function. */
298 #define FRAME_POINTER_REGNUM 6
300 /* Value should be nonzero if functions must have frame pointers.
301 Zero means the frame pointer need not be set up (and parms
302 may be accessed via the stack pointer) in functions that seem suitable.
303 This is computed in `reload', in reload1.c. */
304 #define FRAME_POINTER_REQUIRED 0
306 /* Base register for access to arguments of the function. */
307 #define ARG_POINTER_REGNUM 8
309 /* Register in which static-chain is passed to a function. */
310 #define STATIC_CHAIN_REGNUM 3
312 /* Define the classes of registers for register constraints in the
313 machine description. Also define ranges of constants.
315 One of the classes must always be named ALL_REGS and include all hard regs.
316 If there is more than one class, another class must be named NO_REGS
317 and contain no registers.
319 The name GENERAL_REGS must be the name of a class (or an alias for
320 another name such as ALL_REGS). This is the class of registers
321 that is allowed by "g" or "r" in a register constraint.
322 Also, registers outside this class are allocated only when
323 instructions express preferences for them.
325 The classes must be numbered in nondecreasing order; that is,
326 a larger-numbered class must never be contained completely
327 in a smaller-numbered class.
329 For any two classes, it is very desirable that there be another
330 class that represents their union. */
332 enum reg_class {
333 NO_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES
336 #define N_REG_CLASSES (int) LIM_REG_CLASSES
338 /* Give names of register classes as strings for dump file. */
340 #define REG_CLASS_NAMES \
341 { "NO_REGS", "GENERAL_REGS", "ALL_REGS", "LIM_REGS" }
343 /* Define which registers fit in which classes.
344 This is an initializer for a vector of HARD_REG_SET
345 of length N_REG_CLASSES. */
347 #define REG_CLASS_CONTENTS \
348 { 0, /* No regs */ \
349 0x0ff, /* GENERAL_REGS */ \
350 0x1ff, /* ALL_REGS */ \
353 /* The same information, inverted:
354 Return the class number of the smallest class containing
355 reg number REGNO. This could be a conditional expression
356 or could index an array.
358 ??? What about the ARG_POINTER_REGISTER? */
360 #define REGNO_REG_CLASS(REGNO) GENERAL_REGS
362 /* The class value for index registers, and the one for base regs. */
364 #define INDEX_REG_CLASS NO_REGS
365 #define BASE_REG_CLASS GENERAL_REGS
367 /* Get reg_class from a letter such as appears in the machine description. */
369 #define REG_CLASS_FROM_LETTER(C) (NO_REGS)
371 /* The letters I, J, K, L, M, N, O, P in a register constraint string
372 can be used to stand for particular ranges of immediate operands.
373 This macro defines what the ranges are.
374 C is the letter, and VALUE is a constant value.
375 Return 1 if VALUE is in the range specified by C. */
377 #define CONST_OK_FOR_I(VALUE) ((VALUE) == 0)
378 #define CONST_OK_FOR_J(VALUE) ((unsigned) (VALUE) < 256)
379 #define CONST_OK_FOR_K(VALUE) (((VALUE) == 1) || (VALUE) == 2)
380 #define CONST_OK_FOR_L(VALUE) (((VALUE) == -1) || (VALUE) == -2)
381 #define CONST_OK_FOR_M(VALUE) (((VALUE) == 3) || (VALUE) == 4)
382 #define CONST_OK_FOR_N(VALUE) (((VALUE) == -3) || (VALUE) == -4)
383 #define CONST_OK_FOR_O(VALUE) (ok_for_bclr (VALUE))
384 #define CONST_OK_FOR_P(VALUE) (small_power_of_two (VALUE))
386 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
387 ((C) == 'I' ? CONST_OK_FOR_I (VALUE) : \
388 (C) == 'J' ? CONST_OK_FOR_J (VALUE) : \
389 (C) == 'K' ? CONST_OK_FOR_K (VALUE) : \
390 (C) == 'L' ? CONST_OK_FOR_L (VALUE) : \
391 (C) == 'M' ? CONST_OK_FOR_M (VALUE) : \
392 (C) == 'N' ? CONST_OK_FOR_N (VALUE) : \
393 (C) == 'O' ? CONST_OK_FOR_O (VALUE) : \
394 (C) == 'P' ? CONST_OK_FOR_P(VALUE) : \
397 /* Similar, but for floating constants, and defining letters G and H.
398 Here VALUE is the CONST_DOUBLE rtx itself.
400 `G' is a floating-point zero. */
402 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
403 ((C) == 'G' ? (VALUE) == CONST0_RTX (DFmode) \
404 : 0)
406 /* Given an rtx X being reloaded into a reg required to be
407 in class CLASS, return the class of reg to actually use.
408 In general this is just CLASS; but on some machines
409 in some cases it is preferable to use a more restrictive class. */
411 #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
413 /* Return the maximum number of consecutive registers
414 needed to represent mode MODE in a register of class CLASS. */
416 /* On the H8, this is the size of MODE in words. */
418 #define CLASS_MAX_NREGS(CLASS, MODE) \
419 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
421 /* Any SI register to register move may need to be reloaded,
422 so define REGISTER_MOVE_COST to be > 2 so that reload never
423 shortcuts. */
425 #define REGISTER_MOVE_COST(CLASS1, CLASS2) 3
427 /* Stack layout; function entry, exit and calling. */
429 /* Define this if pushing a word on the stack
430 makes the stack pointer a smaller address. */
432 #define STACK_GROWS_DOWNWARD
434 /* Define this if the nominal address of the stack frame
435 is at the high-address end of the local variables;
436 that is, each additional local variable allocated
437 goes at a more negative offset in the frame. */
439 #define FRAME_GROWS_DOWNWARD
441 /* Offset within stack frame to start allocating local variables at.
442 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
443 first local allocated. Otherwise, it is the offset to the BEGINNING
444 of the first local allocated. */
446 #define STARTING_FRAME_OFFSET 0
448 /* If we generate an insn to push BYTES bytes,
449 this says how many the stack pointer really advances by.
451 On the H8/300, @-sp really pushes a byte if you ask it to - but that's
452 dangerous, so we claim that it always pushes a word, then we catch
453 the mov.b rx,@-sp and turn it into a mov.w rx,@-sp on output.
455 On the H8/300h, we simplify TARGET_QUICKCALL by setting this to 4 and doing
456 a similar thing. */
458 #define PUSH_ROUNDING(BYTES) \
459 (((BYTES) + PARM_BOUNDARY/8 - 1) & -PARM_BOUNDARY/8)
461 /* Offset of first parameter from the argument pointer register value. */
462 /* Is equal to the size of the saved fp + pc, even if an fp isn't
463 saved since the value is used before we know. */
465 #define FIRST_PARM_OFFSET(FNDECL) 0
467 /* Value is the number of bytes of arguments automatically
468 popped when returning from a subroutine call.
469 FUNDECL is the declaration node of the function (as a tree),
470 FUNTYPE is the data type of the function (as a tree),
471 or for a library call it is an identifier node for the subroutine name.
472 SIZE is the number of bytes of arguments passed on the stack.
474 On the H8 the return does not pop anything. */
476 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
478 /* Definitions for register eliminations.
480 This is an array of structures. Each structure initializes one pair
481 of eliminable registers. The "from" register number is given first,
482 followed by "to". Eliminations of the same "from" register are listed
483 in order of preference.
485 We have two registers that can be eliminated on the h8300. First, the
486 frame pointer register can often be eliminated in favor of the stack
487 pointer register. Secondly, the argument pointer register can always be
488 eliminated; it is replaced with either the stack or frame pointer. */
490 #define ELIMINABLE_REGS \
491 {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
492 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
493 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
495 /* Given FROM and TO register numbers, say whether this elimination is allowed.
496 Frame pointer elimination is automatically handled.
498 For the h8300, if frame pointer elimination is being done, we would like to
499 convert ap into sp, not fp.
501 All other eliminations are valid. */
503 #define CAN_ELIMINATE(FROM, TO) \
504 ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
505 ? ! frame_pointer_needed \
506 : 1)
508 /* Define the offset between two registers, one to be eliminated, and the other
509 its replacement, at the start of a routine. */
511 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
512 OFFSET = initial_offset (FROM, TO)
514 /* Define how to find the value returned by a function.
515 VALTYPE is the data type of the value (as a tree).
516 If the precise function being called is known, FUNC is its FUNCTION_DECL;
517 otherwise, FUNC is 0.
519 On the H8 the return value is in R0/R1. */
521 #define FUNCTION_VALUE(VALTYPE, FUNC) \
522 gen_rtx (REG, TYPE_MODE (VALTYPE), 0)
524 /* Define how to find the value returned by a library function
525 assuming the value has mode MODE. */
527 /* On the h8 the return value is in R0/R1 */
529 #define LIBCALL_VALUE(MODE) \
530 gen_rtx (REG, MODE, 0)
532 /* 1 if N is a possible register number for a function value.
533 On the H8, R0 is the only register thus used. */
535 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
537 /* Define this if PCC uses the nonreentrant convention for returning
538 structure and union values. */
540 /*#define PCC_STATIC_STRUCT_RETURN*/
542 /* 1 if N is a possible register number for function argument passing.
543 On the H8, no registers are used in this way. */
545 #define FUNCTION_ARG_REGNO_P(N) (TARGET_QUICKCALL ? N < 3 : 0)
547 /* Register in which address to store a structure value
548 is passed to a function. */
550 #define STRUCT_VALUE 0
552 /* Return true if X should be returned in memory. */
553 #define RETURN_IN_MEMORY(X) \
554 (TYPE_MODE (X) == BLKmode || GET_MODE_SIZE (TYPE_MODE (X)) > 4)
556 /* When defined, the compiler allows registers explicitly used in the
557 rtl to be used as spill registers but prevents the compiler from
558 extending the lifetime of these registers. */
560 #define SMALL_REGISTER_CLASSES
562 /* Define a data type for recording info about an argument list
563 during the scan of that argument list. This data type should
564 hold all necessary information about the function itself
565 and about the args processed so far, enough to enable macros
566 such as FUNCTION_ARG to determine where the next arg should go.
568 On the H8/300, this is a two item struct, the first is the number of bytes
569 scanned so far and the second is the rtx of the called library
570 function if any. */
572 #define CUMULATIVE_ARGS struct cum_arg
573 struct cum_arg { int nbytes; struct rtx_def * libcall; };
575 /* Initialize a variable CUM of type CUMULATIVE_ARGS
576 for a call to a function whose data type is FNTYPE.
577 For a library call, FNTYPE is 0.
579 On the H8/300, the offset starts at 0. */
581 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
582 ((CUM).nbytes = 0, (CUM).libcall = LIBNAME)
584 /* Update the data in CUM to advance over an argument
585 of mode MODE and data type TYPE.
586 (TYPE is null for libcalls where that information may not be available.) */
588 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
589 ((CUM).nbytes += ((MODE) != BLKmode \
590 ? (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD \
591 : (int_size_in_bytes (TYPE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD))
593 /* Define where to put the arguments to a function.
594 Value is zero to push the argument on the stack,
595 or a hard register in which to store the argument.
597 MODE is the argument's machine mode.
598 TYPE is the data type of the argument (as a tree).
599 This is null for libcalls where that information may
600 not be available.
601 CUM is a variable of type CUMULATIVE_ARGS which gives info about
602 the preceding args and about the function being called.
603 NAMED is nonzero if this argument is a named parameter
604 (otherwise it is an extra parameter matching an ellipsis). */
606 /* On the H8/300 all normal args are pushed, unless -mquickcall in which
607 case the first 3 arguments are passed in registers.
608 See function `function_arg'. */
610 struct rtx_def *function_arg();
611 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
612 function_arg (&CUM, MODE, TYPE, NAMED)
614 /* Generate assembly output for the start of a function. */
616 #define FUNCTION_PROLOGUE(FILE, SIZE) \
617 function_prologue (FILE, SIZE)
619 /* Output assembler code to FILE to increment profiler label # LABELNO
620 for profiling a function entry. */
622 #define FUNCTION_PROFILER(FILE, LABELNO) \
623 fprintf (FILE, "\t%s\t#LP%d,%s\n\tjsr @mcount\n", \
624 h8_mov_op, (LABELNO), h8_reg_names[0]);
626 /* Output assembler code to FILE to initialize this source file's
627 basic block profiling info, if that has not already been done. */
628 /* ??? @LPBX0 is moved into r0 twice. */
630 #define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
631 fprintf (FILE, "\t%s\t%s\n\t%s\t@LPBX0,%s\n\tbne LPI%d\n\t%s\t@LPBX0,%s\n\t%s\t%s\n\tjsr\t@__bb_init_func\nLPI%d:\t%s\t%s\n", \
632 h8_push_op, h8_reg_names[0], \
633 h8_mov_op, h8_reg_names[0], \
634 (LABELNO), \
635 h8_mov_op, h8_reg_names[0], \
636 h8_push_op, h8_reg_names[0], \
637 (LABELNO), \
638 h8_pop_op, h8_reg_names[0]);
640 /* Output assembler code to FILE to increment the entry-count for
641 the BLOCKNO'th basic block in this source file. This is a real pain in the
642 sphincter on a VAX, since we do not want to change any of the bits in the
643 processor status word. The way it is done here, it is pushed onto the stack
644 before any flags have changed, and then the stack is fixed up to account for
645 the fact that the instruction to restore the flags only reads a word.
646 It may seem a bit clumsy, but at least it works. */
647 /* ??? This one needs work. */
649 #define BLOCK_PROFILER(FILE, BLOCKNO) \
650 fprintf (FILE, "\tmovpsl -(sp)\n\tmovw (sp),2(sp)\n\taddl2 $2,sp\n\taddl2 $1,LPBX2+%d\n\tbicpsw $255\n\tbispsw (sp)+\n", \
651 4 * BLOCKNO)
653 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
654 the stack pointer does not matter. The value is tested only in
655 functions that have frame pointers.
656 No definition is equivalent to always zero. */
658 #define EXIT_IGNORE_STACK 0
660 /* This macro generates the assembly code for function exit,
661 on machines that need it. If FUNCTION_EPILOGUE is not defined
662 then individual return instructions are generated for each
663 return statement. Args are same as for FUNCTION_PROLOGUE. */
665 #define FUNCTION_EPILOGUE(FILE, SIZE) \
666 function_epilogue (FILE, SIZE)
668 /* Output assembler code for a block containing the constant parts
669 of a trampoline, leaving space for the variable parts.
671 H8/300
672 vvvv context
673 1 0000 7900xxxx mov.w #0x1234,r3
674 2 0004 5A00xxxx jmp @0x1234
675 ^^^^ function
677 H8/300H
678 vvvvvvvv context
679 2 0000 7A00xxxxxxxx mov.l #0x12345678,er3
680 3 0006 5Axxxxxx jmp @0x123456
681 ^^^^^^ function
684 #define TRAMPOLINE_TEMPLATE(FILE) \
685 do { \
686 if (TARGET_H8300) \
688 fprintf (FILE, "\tmov.w #0x1234,r3\n"); \
689 fprintf (FILE, "\tjmp @0x1234\n"); \
691 else \
693 fprintf (FILE, "\tmov.l #0x12345678,er3\n"); \
694 fprintf (FILE, "\tjmp @0x123456\n"); \
696 } while (0)
698 /* Length in units of the trampoline for entering a nested function. */
700 #define TRAMPOLINE_SIZE (TARGET_H8300 ? 8 : 12)
702 /* Emit RTL insns to initialize the variable parts of a trampoline.
703 FNADDR is an RTX for the address of the function's pure code.
704 CXT is an RTX for the static chain value for the function. */
706 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
708 enum machine_mode mode = TARGET_H8300H || TARGET_H8300S? SImode : HImode; \
709 emit_move_insn (gen_rtx (MEM, mode, plus_constant ((TRAMP), 2)), CXT); \
710 emit_move_insn (gen_rtx (MEM, mode, plus_constant ((TRAMP), 6)), FNADDR); \
711 if (TARGET_H8300H || TARGET_H8300S) \
712 emit_move_insn (gen_rtx (MEM, QImode, plus_constant ((TRAMP), 6)), GEN_INT (0x5A)); \
715 /* Addressing modes, and classification of registers for them. */
717 #define HAVE_POST_INCREMENT
718 /*#define HAVE_POST_DECREMENT */
720 #define HAVE_PRE_DECREMENT
721 /*#define HAVE_PRE_INCREMENT */
723 /* Macros to check register numbers against specific register classes. */
725 /* These assume that REGNO is a hard or pseudo reg number.
726 They give nonzero only if REGNO is a hard reg of the suitable class
727 or a pseudo reg currently allocated to a suitable hard reg.
728 Since they use reg_renumber, they are safe only once reg_renumber
729 has been allocated, which happens in local-alloc.c. */
731 #define REGNO_OK_FOR_INDEX_P(regno) 0
733 #define REGNO_OK_FOR_BASE_P(regno) \
734 ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
736 /* Maximum number of registers that can appear in a valid memory address. */
738 #define MAX_REGS_PER_ADDRESS 1
740 /* 1 if X is an rtx for a constant that is a valid address. */
742 #define CONSTANT_ADDRESS_P(X) \
743 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
744 || (GET_CODE (X) == CONST_INT \
745 /* We handle signed and unsigned offsets here. */ \
746 && INTVAL (X) > (TARGET_H8300 ? -0x10000 : -0x1000000) \
747 && INTVAL (X) < (TARGET_H8300 ? 0x10000 : 0x1000000)) \
748 || ((GET_CODE (X) == HIGH || GET_CODE (X) == CONST) \
749 && TARGET_H8300))
751 /* Nonzero if the constant value X is a legitimate general operand.
752 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
754 #define LEGITIMATE_CONSTANT_P(X) (GET_CODE (X) != CONST_DOUBLE)
756 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
757 and check its validity for a certain class.
758 We have two alternate definitions for each of them.
759 The usual definition accepts all pseudo regs; the other rejects
760 them unless they have been allocated suitable hard regs.
761 The symbol REG_OK_STRICT causes the latter definition to be used.
763 Most source files want to accept pseudo regs in the hope that
764 they will get allocated to the class that the insn wants them to be in.
765 Source files for reload pass need to be strict.
766 After reload, it makes no difference, since pseudo regs have
767 been eliminated by then. */
769 #ifndef REG_OK_STRICT
771 /* Nonzero if X is a hard reg that can be used as an index
772 or if it is a pseudo reg. */
773 #define REG_OK_FOR_INDEX_P(X) 0
774 /* Nonzero if X is a hard reg that can be used as a base reg
775 or if it is a pseudo reg. */
776 #define REG_OK_FOR_BASE_P(X) 1
777 #define REG_OK_FOR_INDEX_P_STRICT(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
778 #define REG_OK_FOR_BASE_P_STRICT(X) REGNO_OK_FOR_BASE_P (REGNO (X))
779 #define STRICT 0
781 #else
783 /* Nonzero if X is a hard reg that can be used as an index. */
784 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
785 /* Nonzero if X is a hard reg that can be used as a base reg. */
786 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
787 #define STRICT 1
789 #endif
791 /* Extra constraints - 'U' if for an operand valid for a bset
792 destination; i.e. a register, register indirect, or the
793 eightbit memory region (a SYMBOL_REF with an SYMBOL_REF_FLAG set).
795 On the H8/S 'U' can also be a 16bit or 32bit absolute. */
796 #define OK_FOR_U(OP) \
797 ((GET_CODE (OP) == REG && REG_OK_FOR_BASE_P (OP)) \
798 || (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == REG \
799 && REG_OK_FOR_BASE_P (XEXP (OP, 0))) \
800 || (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == SYMBOL_REF \
801 && (TARGET_H8300S || SYMBOL_REF_FLAG (XEXP (OP, 0)))) \
802 || (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == CONST \
803 && GET_CODE (XEXP (XEXP (OP, 0), 0)) == PLUS \
804 && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 0)) == SYMBOL_REF \
805 && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 1)) == CONST_INT) \
806 && (TARGET_H8300S || SYMBOL_REF_FLAG (XEXP (XEXP (OP, 0), 0))))
808 #define EXTRA_CONSTRAINT(OP, C) \
809 ((C) == 'U' ? OK_FOR_U (OP) : 0)
811 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
812 that is a valid memory address for an instruction.
813 The MODE argument is the machine mode for the MEM expression
814 that wants to use this address.
816 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
817 except for CONSTANT_ADDRESS_P which is actually
818 machine-independent.
820 On the H8/300, a legitimate address has the form
821 REG, REG+CONSTANT_ADDRESS or CONSTANT_ADDRESS. */
823 /* Accept either REG or SUBREG where a register is valid. */
825 #define RTX_OK_FOR_BASE_P(X) \
826 ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \
827 || (GET_CODE (X) == SUBREG && REG_P (SUBREG_REG (X)) \
828 && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
830 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
831 if (RTX_OK_FOR_BASE_P (X)) goto ADDR; \
832 if (CONSTANT_ADDRESS_P (X)) goto ADDR; \
833 if (GET_CODE (X) == PLUS \
834 && CONSTANT_ADDRESS_P (XEXP (X, 1)) \
835 && RTX_OK_FOR_BASE_P (XEXP (X, 0))) goto ADDR;
837 /* Try machine-dependent ways of modifying an illegitimate address
838 to be legitimate. If we find one, return the new, valid address.
839 This macro is used in only one place: `memory_address' in explow.c.
841 OLDX is the address as it was before break_out_memory_refs was called.
842 In some cases it is useful to look at this to decide what needs to be done.
844 MODE and WIN are passed so that this macro can use
845 GO_IF_LEGITIMATE_ADDRESS.
847 It is always safe for this macro to do nothing. It exists to recognize
848 opportunities to optimize the output.
850 For the H8/300, don't do anything. */
852 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
854 /* Go to LABEL if ADDR (a legitimate address expression)
855 has an effect that depends on the machine mode it is used for.
857 On the H8/300, the predecrement and postincrement address depend thus
858 (the amount of decrement or increment being the length of the operand)
859 and all indexed address depend thus (because the index scale factor
860 is the length of the operand). */
862 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
863 if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) goto LABEL;
865 /* Specify the machine mode that this machine uses
866 for the index in the tablejump instruction. */
867 #define CASE_VECTOR_MODE Pmode
869 /* Define this if the case instruction expects the table
870 to contain offsets from the address of the table.
871 Do not define this if the table should contain absolute addresses. */
872 /*#define CASE_VECTOR_PC_RELATIVE*/
874 /* Define this if the case instruction drops through after the table
875 when the index is out of range. Don't define it if the case insn
876 jumps to the default label instead. */
877 #define CASE_DROPS_THROUGH
879 /* Specify the tree operation to be used to convert reals to integers. */
880 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
882 /* This is the kind of divide that is easiest to do in the general case. */
883 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
885 /* Define this as 1 if `char' should by default be signed; else as 0.
887 On the H8/300, sign extension is expensive, so we'll say that chars
888 are unsigned. */
889 #define DEFAULT_SIGNED_CHAR 0
891 /* This flag, if defined, says the same insns that convert to a signed fixnum
892 also convert validly to an unsigned one. */
893 #define FIXUNS_TRUNC_LIKE_FIX_TRUNC
895 /* Max number of bytes we can move from memory to memory
896 in one reasonably fast instruction. */
897 #define MOVE_MAX (TARGET_H8300H || TARGET_H8300S ? 4 : 2)
898 #define MAX_MOVE_MAX 4
900 /* Define this if zero-extension is slow (more than one real instruction). */
901 /* #define SLOW_ZERO_EXTEND */
903 /* Nonzero if access to memory by bytes is slow and undesirable. */
904 #define SLOW_BYTE_ACCESS TARGET_SLOWBYTE
906 /* Define if shifts truncate the shift count
907 which implies one can omit a sign-extension or zero-extension
908 of a shift count. */
909 /* #define SHIFT_COUNT_TRUNCATED */
911 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
912 is done just by pretending it is already truncated. */
913 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
915 /* Specify the machine mode that pointers have.
916 After generation of rtl, the compiler makes no further distinction
917 between pointers and any other objects of this machine mode. */
918 #define Pmode (TARGET_H8300H || TARGET_H8300S ? SImode : HImode)
920 /* ANSI C types.
921 We use longs for the 300h because ints can be 16 or 32.
922 GCC requires SIZE_TYPE to be the same size as pointers. */
923 #define NO_BUILTIN_SIZE_TYPE
924 #define NO_BUILTIN_PTRDIFF_TYPE
925 #define SIZE_TYPE (TARGET_H8300 ? "unsigned int" : "long unsigned int")
926 #define PTRDIFF_TYPE (TARGET_H8300 ? "int" : "long int")
928 #define WCHAR_TYPE "short unsigned int"
929 #define WCHAR_TYPE_SIZE 16
930 #define MAX_WCHAR_TYPE_SIZE 16
932 /* A function address in a call instruction
933 is a byte address (for indexing purposes)
934 so give the MEM rtx a byte's mode. */
935 #define FUNCTION_MODE QImode
937 /* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
938 is a valid machine specific attribute for DECL.
939 The attributes in ATTRIBUTES have previously been assigned to DECL. */
940 extern int h8300_valid_machine_decl_attribute ();
941 #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
942 h8300_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
944 #define ADJUST_INSN_LENGTH(INSN, LENGTH) \
945 LENGTH += h8300_adjust_insn_length (INSN, LENGTH);
947 /* Compute the cost of computing a constant rtl expression RTX
948 whose rtx-code is CODE. The body of this macro is a portion
949 of a switch statement. If the code is computed here,
950 return it with a return statement. Otherwise, break from the switch. */
952 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
953 default: { int _zxy= const_costs(RTX, CODE); \
954 if(_zxy) return _zxy; break;}
956 #define BRANCH_COST 0
958 /* We say that MOD and DIV are so cheap because otherwise we'll
959 generate some really horrible code for division of a power of two. */
961 /* Provide the costs of a rtl expression. This is in the body of a
962 switch on CODE. */
963 /* ??? Shifts need to have a *much* higher cost than this. */
965 #define RTX_COSTS(RTX,CODE,OUTER_CODE) \
966 case MOD: \
967 case DIV: \
968 return 60; \
969 case MULT: \
970 return 20; \
971 case ASHIFT: \
972 case ASHIFTRT: \
973 case LSHIFTRT: \
974 case ROTATE: \
975 case ROTATERT: \
976 if (GET_MODE (RTX) == HImode) return 2; \
977 return 8;
979 /* Tell final.c how to eliminate redundant test instructions. */
981 /* Here we define machine-dependent flags and fields in cc_status
982 (see `conditions.h'). No extra ones are needed for the vax. */
984 /* Store in cc_status the expressions
985 that the condition codes will describe
986 after execution of an instruction whose pattern is EXP.
987 Do not alter them if the instruction would not alter the cc's. */
989 #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN)
991 /* The mov,and,or,xor insns always set V to 0. */
992 #define CC_OVERFLOW_0 0400
993 /* The add insns don't set overflow in a usable way. */
994 #define CC_OVERFLOW_UNUSABLE 01000
995 /* The mov,and,or,xor insns don't set carry. That's ok though as the
996 Z bit is all we need when doing unsigned comparisons on the result of
997 these insns (since they're always with 0). However, conditions.h has
998 CC_NO_OVERFLOW defined for this purpose. Rename it to something more
999 understandable. */
1000 #define CC_NO_CARRY CC_NO_OVERFLOW
1001 /* ??? Use CC_Z_IN_NOT_C for bld insns? */
1003 /* Control the assembler format that we output. */
1005 #define ASM_IDENTIFY_GCC /* nothing */
1007 /* Output at beginning/end of assembler file. */
1009 #define ASM_FILE_START(FILE) asm_file_start(FILE)
1011 #define ASM_FILE_END(FILE) asm_file_end(FILE)
1013 /* Output to assembler file text saying following lines
1014 may contain character constants, extra white space, comments, etc. */
1016 #define ASM_APP_ON "; #APP\n"
1018 /* Output to assembler file text saying following lines
1019 no longer contain unusual constructs. */
1021 #define ASM_APP_OFF "; #NO_APP\n"
1023 #define FILE_ASM_OP "\t.file\n"
1024 #define IDENT_ASM_OP "\t.ident\n"
1026 /* The assembler op to get a word, 2 bytes for the H8/300, 4 for H8/300H. */
1027 #define ASM_WORD_OP (TARGET_H8300 ? ".word" : ".long")
1029 /* We define a readonly data section solely to remove readonly data
1030 from the instruction stream. This can improve relaxing in two significant
1031 ways. First it's more likely that references to readonly data
1032 can be done with a 16bit absolute address since they'll be in low
1033 memory. Second, it's more likely that jsr instructions can be
1034 turned into bsr instructions since read-only data is not in the
1035 instruction stream. */
1036 #define READONLY_DATA_SECTION readonly_data
1038 #define TEXT_SECTION_ASM_OP "\t.section .text"
1039 #define DATA_SECTION_ASM_OP "\t.section .data"
1040 #define BSS_SECTION_ASM_OP "\t.section .bss"
1041 #define INIT_SECTION_ASM_OP "\t.section .init"
1042 #define CTORS_SECTION_ASM_OP "\t.section .ctors"
1043 #define DTORS_SECTION_ASM_OP "\t.section .dtors"
1044 #define READONLY_DATA_SECTION_ASM_OP "\t.section .rodata"
1046 #define EXTRA_SECTIONS in_ctors, in_dtors, in_readonly_data
1048 #define EXTRA_SECTION_FUNCTIONS \
1050 void \
1051 ctors_section() \
1053 if (in_section != in_ctors) \
1055 fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
1056 in_section = in_ctors; \
1060 void \
1061 dtors_section() \
1063 if (in_section != in_dtors) \
1065 fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
1066 in_section = in_dtors; \
1070 void \
1071 readonly_data() \
1073 if (in_section != in_readonly_data) \
1075 fprintf (asm_out_file, "%s\n", READONLY_DATA_SECTION_ASM_OP);\
1076 in_section = in_readonly_data; \
1082 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
1083 do { ctors_section(); \
1084 fprintf(FILE, "\t%s\t_%s\n", ASM_WORD_OP, NAME); } while (0)
1086 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
1087 do { dtors_section(); \
1088 fprintf(FILE, "\t%s\t_%s\n", ASM_WORD_OP, NAME); } while (0)
1090 #undef DO_GLOBAL_CTORS_BODY
1091 #define DO_GLOBAL_CTORS_BODY \
1093 typedef (*pfunc)(); \
1094 extern pfunc __ctors[]; \
1095 extern pfunc __ctors_end[]; \
1096 pfunc *p; \
1097 for (p = __ctors_end; p > __ctors; ) \
1099 (*--p)(); \
1103 #undef DO_GLOBAL_DTORS_BODY
1104 #define DO_GLOBAL_DTORS_BODY \
1106 typedef (*pfunc)(); \
1107 extern pfunc __dtors[]; \
1108 extern pfunc __dtors_end[]; \
1109 pfunc *p; \
1110 for (p = __dtors; p < __dtors_end; p++) \
1112 (*p)(); \
1116 #define TINY_DATA_NAME_P(NAME) (*(NAME) == '*')
1118 /* If we are referencing a function that is supposed to be called
1119 through the function vector, the SYMBOL_REF_FLAG in the rtl
1120 so the call patterns can generate the correct code. */
1121 #define ENCODE_SECTION_INFO(DECL) \
1122 if (TREE_CODE (DECL) == FUNCTION_DECL \
1123 && h8300_funcvec_function_p (DECL)) \
1124 SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
1125 else if ((TREE_STATIC (DECL) || DECL_EXTERNAL (DECL)) \
1126 && TREE_CODE (DECL) == VAR_DECL \
1127 && h8300_eightbit_data_p (DECL)) \
1128 SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
1129 else if ((TREE_STATIC (DECL) || DECL_EXTERNAL (DECL)) \
1130 && TREE_CODE (DECL) == VAR_DECL \
1131 && h8300_tiny_data_p (DECL)) \
1132 h8300_encode_label (DECL);
1134 /* Store the user-specified part of SYMBOL_NAME in VAR.
1135 This is sort of inverse to ENCODE_SECTION_INFO. */
1136 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
1137 (VAR) = (SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*' || (SYMBOL_NAME)[0] == '@');
1139 /* How to refer to registers in assembler output.
1140 This sequence is indexed by compiler's hard-register-number (see above). */
1142 #define REGISTER_NAMES \
1143 { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp", "ap"}
1145 #define ADDITIONAL_REGISTER_NAMES { { "r7", 7 } }
1147 /* How to renumber registers for dbx and gdb.
1148 H8/300 needs no change in the numeration. */
1150 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
1152 #define SDB_DEBUGGING_INFO
1153 #define SDB_DELIM "\n"
1155 /* Support -gstabs. */
1157 #include "dbxcoff.h"
1159 /* Override definition in dbxcoff.h. */
1160 /* Generate a blank trailing N_SO to mark the end of the .o file, since
1161 we can't depend upon the linker to mark .o file boundaries with
1162 embedded stabs. */
1164 #undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
1165 #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
1166 fprintf (FILE, \
1167 "\t.text\n.stabs \"\",%d,0,0,.Letext\n.Letext:\n", N_SO)
1169 /* A C statement to output something to the assembler file to switch to section
1170 NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
1171 NULL_TREE. Some target formats do not support arbitrary sections. Do not
1172 define this macro in such cases. */
1174 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
1175 fprintf (FILE, "\t.section %s\n", NAME)
1177 /* This is how to output the definition of a user-level label named NAME,
1178 such as the label on a static function or variable NAME. */
1180 #define ASM_OUTPUT_LABEL(FILE, NAME) \
1181 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1183 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)
1185 /* This is how to output a command to make the user-level label named NAME
1186 defined for reference from other files. */
1188 #define ASM_GLOBALIZE_LABEL(FILE, NAME) \
1189 do { fputs ("\t.global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
1191 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
1192 ASM_OUTPUT_LABEL(FILE, NAME)
1194 /* This is how to output a reference to a user-level label named NAME.
1195 `assemble_name' uses this. */
1197 #define ASM_OUTPUT_LABELREF(FILE, NAME) \
1198 fprintf (FILE, "_%s", NAME)
1200 /* This is how to output an internal numbered label where
1201 PREFIX is the class of label and NUM is the number within the class. */
1203 #define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \
1204 fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
1206 /* This is how to store into the string LABEL
1207 the symbol_ref name of an internal numbered label where
1208 PREFIX is the class of label and NUM is the number within the class.
1209 This is suitable for output with `assemble_name'. */
1211 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
1212 sprintf (LABEL, "*.%s%d", PREFIX, NUM)
1214 /* This is how to output an assembler line defining a `double' constant.
1215 It is .dfloat or .gfloat, depending. */
1217 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
1218 do { char dstr[30]; \
1219 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
1220 fprintf (FILE, "\t.double %s\n", dstr); \
1221 } while (0)
1224 /* This is how to output an assembler line defining a `float' constant. */
1225 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
1226 do { char dstr[30]; \
1227 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
1228 fprintf (FILE, "\t.float %s\n", dstr); \
1229 } while (0)
1231 /* This is how to output an assembler line defining an `int' constant. */
1233 #define ASM_OUTPUT_INT(FILE, VALUE) \
1234 ( fprintf (FILE, "\t.long "), \
1235 output_addr_const (FILE, (VALUE)), \
1236 fprintf (FILE, "\n"))
1238 /* Likewise for `char' and `short' constants. */
1240 #define ASM_OUTPUT_SHORT(FILE, VALUE) \
1241 ( fprintf (FILE, "\t.word "), \
1242 output_addr_const (FILE, (VALUE)), \
1243 fprintf (FILE, "\n"))
1245 #define ASM_OUTPUT_CHAR(FILE, VALUE) \
1246 ( fprintf (FILE, "\t.byte "), \
1247 output_addr_const (FILE, (VALUE)), \
1248 fprintf (FILE, "\n"))
1250 /* This is how to output an assembler line for a numeric constant byte. */
1251 #define ASM_OUTPUT_BYTE(FILE, VALUE) \
1252 fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1254 /* This is how to output an insn to push a register on the stack.
1255 It need not be very fast code. */
1257 #define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \
1258 fprintf (FILE, "\t%s\t%s\n", h8_push_op, h8_reg_names[REGNO])
1260 /* This is how to output an insn to pop a register from the stack.
1261 It need not be very fast code. */
1263 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1264 fprintf (FILE, "\t%s\t%s\n", h8_pop_op, h8_reg_names[REGNO])
1266 /* This is how to output an element of a case-vector that is absolute. */
1268 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1269 asm_fprintf (FILE, "\t%s .L%d\n", ASM_WORD_OP, VALUE)
1271 /* This is how to output an element of a case-vector that is relative. */
1273 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
1274 fprintf (FILE, "\t%s .L%d-.L%d\n", ASM_WORD_OP, VALUE, REL)
1276 /* This is how to output an assembler line
1277 that says to advance the location counter
1278 to a multiple of 2**LOG bytes. */
1280 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1281 if ((LOG) != 0) \
1282 fprintf (FILE, "\t.align %d\n", (LOG))
1284 /* This is how to output an assembler line
1285 that says to advance the location counter by SIZE bytes. */
1287 #define ASM_OUTPUT_IDENT(FILE, NAME) \
1288 fprintf(FILE, "%s\t \"%s\"\n", IDENT_ASM_OP, NAME)
1290 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
1291 fprintf (FILE, "\t.space %d\n", (SIZE))
1293 /* This says how to output an assembler line
1294 to define a global common symbol. */
1296 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1297 ( fputs ("\t.comm ", (FILE)), \
1298 assemble_name ((FILE), (NAME)), \
1299 fprintf ((FILE), ",%d\n", (SIZE)))
1301 /* This says how to output the assembler to define a global
1302 uninitialized but not common symbol.
1303 Try to use asm_output_bss to implement this macro. */
1305 #define ASM_OUTPUT_BSS(FILE, DECL, NAME, SIZE, ROUNDED) \
1306 asm_output_bss ((FILE), (DECL), (NAME), (SIZE), (ROUNDED))
1308 /* This says how to output an assembler line
1309 to define a local common symbol. */
1311 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
1312 ( fputs ("\t.lcomm ", (FILE)), \
1313 assemble_name ((FILE), (NAME)), \
1314 fprintf ((FILE), ",%d\n", (SIZE)))
1316 /* Store in OUTPUT a string (made with alloca) containing
1317 an assembler-name for a local static variable named NAME.
1318 LABELNO is an integer which is different for each call. */
1320 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1321 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1322 sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
1324 /* Define the parentheses used to group arithmetic operations
1325 in assembler code. */
1327 #define ASM_OPEN_PAREN "("
1328 #define ASM_CLOSE_PAREN ")"
1330 /* Define results of standard character escape sequences. */
1331 #define TARGET_BELL 007
1332 #define TARGET_BS 010
1333 #define TARGET_TAB 011
1334 #define TARGET_NEWLINE 012
1335 #define TARGET_VT 013
1336 #define TARGET_FF 014
1337 #define TARGET_CR 015
1339 /* Print an instruction operand X on file FILE.
1340 look in h8300.c for details */
1342 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1343 ((CODE) == '#')
1345 #define PRINT_OPERAND(FILE, X, CODE) print_operand(FILE,X,CODE)
1347 /* Print a memory operand whose address is X, on file FILE.
1348 This uses a function in output-vax.c. */
1350 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
1352 /* Define this macro if you want to implement any pragmas. If defined, it
1353 should be a C expression to be executed when #pragma is seen. The
1354 argument STREAM is the stdio input stream from which the source
1355 text can be read. CH is the first character after the #pragma. The
1356 result of the expression is the terminating character found
1357 (newline or EOF). */
1358 #define HANDLE_PRAGMA(FILE, NODE) handle_pragma (FILE, NODE)
1360 #define FINAL_PRESCAN_INSN(insn, operand, nop) final_prescan_insn (insn, operand,nop)
1362 /* Define this macro if GNU CC should generate calls to the System V
1363 (and ANSI C) library functions `memcpy' and `memset' rather than
1364 the BSD functions `bcopy' and `bzero'. */
1366 #define TARGET_MEM_FUNCTIONS 1
1368 #define MULHI3_LIBCALL "__mulhi3"
1369 #define DIVHI3_LIBCALL "__divhi3"
1370 #define UDIVHI3_LIBCALL "__udivhi3"
1371 #define MODHI3_LIBCALL "__modhi3"
1372 #define UMODHI3_LIBCALL "__umodhi3"
1374 /* Perform target dependent optabs initialization. */
1376 #define INIT_TARGET_OPTABS \
1377 do { \
1378 smul_optab->handlers[(int) HImode].libfunc \
1379 = gen_rtx (SYMBOL_REF, Pmode, MULHI3_LIBCALL); \
1380 sdiv_optab->handlers[(int) HImode].libfunc \
1381 = gen_rtx (SYMBOL_REF, Pmode, DIVHI3_LIBCALL); \
1382 udiv_optab->handlers[(int) HImode].libfunc \
1383 = gen_rtx (SYMBOL_REF, Pmode, UDIVHI3_LIBCALL); \
1384 smod_optab->handlers[(int) HImode].libfunc \
1385 = gen_rtx (SYMBOL_REF, Pmode, MODHI3_LIBCALL); \
1386 umod_optab->handlers[(int) HImode].libfunc \
1387 = gen_rtx (SYMBOL_REF, Pmode, UMODHI3_LIBCALL); \
1388 } while (0)
1390 #define MOVE_RATIO 3
1392 /* Declarations for functions used in insn-output.c. */
1393 char *emit_a_shift ();
1394 int h8300_funcvec_function_p ();
1395 char *output_adds_subs ();
1396 char * output_simode_bld ();