Merged revisions 96681,96683-96686,96689-96692,96698-96701,96705,96708,96710,96712...
[official-gcc.git] / gcc / config / h8300 / h8300.h
blob5f1e838049a8cdce3c3a76cea05ec35770836012
1 /* Definitions of target machine for GNU compiler.
2 Renesas H8/300 (generic)
3 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1996, 1997, 1998, 1999,
4 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
5 Contributed by Steve Chamberlain (sac@cygnus.com),
6 Jim Wilson (wilson@cygnus.com), and Doug Evans (dje@cygnus.com).
8 This file is part of GCC.
10 GCC is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
13 any later version.
15 GCC is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with GCC; see the file COPYING. If not, write to
22 the Free Software Foundation, 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
25 #ifndef GCC_H8300_H
26 #define GCC_H8300_H
28 /* Which CPU to compile for.
29 We use int for CPU_TYPE to avoid lots of casts. */
30 #if 0 /* defined in insn-attr.h, here for documentation */
31 enum attr_cpu { CPU_H8300, CPU_H8300H };
32 #endif
33 extern int cpu_type;
35 /* Various globals defined in h8300.c. */
37 extern const char *h8_push_op, *h8_pop_op, *h8_mov_op;
38 extern const char * const *h8_reg_names;
40 /* Target CPU builtins. */
41 #define TARGET_CPU_CPP_BUILTINS() \
42 do \
43 { \
44 if (TARGET_H8300H) \
45 { \
46 builtin_define ("__H8300H__"); \
47 builtin_assert ("cpu=h8300h"); \
48 builtin_assert ("machine=h8300h"); \
49 if (TARGET_NORMAL_MODE) \
50 { \
51 builtin_define ("__NORMAL_MODE__"); \
52 } \
53 } \
54 else if (TARGET_H8300SX) \
55 { \
56 builtin_define ("__H8300SX__"); \
57 if (TARGET_NORMAL_MODE) \
58 { \
59 builtin_define ("__NORMAL_MODE__"); \
60 } \
61 } \
62 else if (TARGET_H8300S) \
63 { \
64 builtin_define ("__H8300S__"); \
65 builtin_assert ("cpu=h8300s"); \
66 builtin_assert ("machine=h8300s"); \
67 if (TARGET_NORMAL_MODE) \
68 { \
69 builtin_define ("__NORMAL_MODE__"); \
70 } \
71 } \
72 else \
73 { \
74 builtin_define ("__H8300__"); \
75 builtin_assert ("cpu=h8300"); \
76 builtin_assert ("machine=h8300"); \
77 } \
78 } \
79 while (0)
81 #define LINK_SPEC "%{mh:%{mn:-m h8300hn}} %{mh:%{!mn:-m h8300h}} %{ms:%{mn:-m h8300sn}} %{ms:%{!mn:-m h8300s}}"
83 #define LIB_SPEC "%{mrelax:-relax} %{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
85 #define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \
86 do \
87 { \
88 /* Basic block reordering is only beneficial on targets with cache \
89 and/or variable-cycle branches where (cycle count taken != \
90 cycle count not taken). */ \
91 flag_reorder_blocks = 0; \
92 } \
93 while (0)
95 /* Print subsidiary information on the compiler version in use. */
97 #define TARGET_VERSION fprintf (stderr, " (Renesas H8/300)");
99 /* Macros used in the machine description to test the flags. */
101 /* Select between the H8/300 and H8/300H CPUs. */
102 #define TARGET_H8300 (! TARGET_H8300H && ! TARGET_H8300S)
103 #define TARGET_H8300S (TARGET_H8300S_1 || TARGET_H8300SX)
104 /* Some multiply instructions are not available in all H8SX variants.
105 Use this macro instead of TARGET_H8300SX to indicate this, even
106 though we don't actually generate different code for now. */
107 #define TARGET_H8300SXMUL TARGET_H8300SX
109 #ifdef IN_LIBGCC2
110 #undef TARGET_H8300H
111 #undef TARGET_H8300S
112 #undef TARGET_NORMAL_MODE
113 /* If compiling libgcc2, make these compile time constants based on what
114 flags are we actually compiling with. */
115 #ifdef __H8300H__
116 #define TARGET_H8300H 1
117 #else
118 #define TARGET_H8300H 0
119 #endif
120 #ifdef __H8300S__
121 #define TARGET_H8300S 1
122 #else
123 #define TARGET_H8300S 0
124 #endif
125 #ifdef __NORMAL_MODE__
126 #define TARGET_NORMAL_MODE 1
127 #else
128 #define TARGET_NORMAL_MODE 0
129 #endif
130 #endif /* !IN_LIBGCC2 */
132 /* Do things that must be done once at start up. */
134 #define OVERRIDE_OPTIONS \
135 do \
137 h8300_init_once (); \
139 while (0)
141 /* Default target_flags if no switches specified. */
143 #ifndef TARGET_DEFAULT
144 #define TARGET_DEFAULT (MASK_QUICKCALL)
145 #endif
147 /* Show we can debug even without a frame pointer. */
148 /* #define CAN_DEBUG_WITHOUT_FP */
150 /* Define this if addresses of constant functions
151 shouldn't be put through pseudo regs where they can be cse'd.
152 Desirable on machines where ordinary constants are expensive
153 but a CALL with constant address is cheap.
155 Calls through a register are cheaper than calls to named
156 functions; however, the register pressure this causes makes
157 CSEing of function addresses generally a lose. */
158 #define NO_FUNCTION_CSE
160 /* Target machine storage layout */
162 /* Define this if most significant bit is lowest numbered
163 in instructions that operate on numbered bit-fields.
164 This is not true on the H8/300. */
165 #define BITS_BIG_ENDIAN 0
167 /* Define this if most significant byte of a word is the lowest numbered. */
168 /* That is true on the H8/300. */
169 #define BYTES_BIG_ENDIAN 1
171 /* Define this if most significant word of a multiword number is lowest
172 numbered. */
173 #define WORDS_BIG_ENDIAN 1
175 #define MAX_BITS_PER_WORD 32
177 /* Width of a word, in units (bytes). */
178 #define UNITS_PER_WORD (TARGET_H8300H || TARGET_H8300S ? 4 : 2)
179 #define MIN_UNITS_PER_WORD 2
181 #define SHORT_TYPE_SIZE 16
182 #define INT_TYPE_SIZE (TARGET_INT32 ? 32 : 16)
183 #define LONG_TYPE_SIZE 32
184 #define LONG_LONG_TYPE_SIZE 64
185 #define FLOAT_TYPE_SIZE 32
186 #define DOUBLE_TYPE_SIZE 32
187 #define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE
189 #define MAX_FIXED_MODE_SIZE 32
191 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
192 #define PARM_BOUNDARY (TARGET_H8300H || TARGET_H8300S ? 32 : 16)
194 /* Allocation boundary (in *bits*) for the code of a function. */
195 #define FUNCTION_BOUNDARY 16
197 /* Alignment of field after `int : 0' in a structure. */
198 /* One can argue this should be 32 for -mint32, but since 32 bit ints only
199 need 16 bit alignment, this is left as is so that -mint32 doesn't change
200 structure layouts. */
201 #define EMPTY_FIELD_BOUNDARY 16
203 /* No data type wants to be aligned rounder than this.
204 32 bit values are aligned as such on the H8/300H and H8S for speed. */
205 #define BIGGEST_ALIGNMENT \
206 (((TARGET_H8300H || TARGET_H8300S) && ! TARGET_ALIGN_300) ? 32 : 16)
208 /* The stack goes in 16/32 bit lumps. */
209 #define STACK_BOUNDARY (TARGET_H8300 ? 16 : 32)
211 /* Define this if move instructions will actually fail to work
212 when given unaligned data. */
213 /* On the H8/300, longs can be aligned on halfword boundaries, but not
214 byte boundaries. */
215 #define STRICT_ALIGNMENT 1
217 /* Standard register usage. */
219 /* Number of actual hardware registers.
220 The hardware registers are assigned numbers for the compiler
221 from 0 to just below FIRST_PSEUDO_REGISTER.
223 All registers that the compiler knows about must be given numbers,
224 even those that are not normally considered general registers.
226 Reg 9 does not correspond to any hardware register, but instead
227 appears in the RTL as an argument pointer prior to reload, and is
228 eliminated during reloading in favor of either the stack or frame
229 pointer. */
231 #define FIRST_PSEUDO_REGISTER 12
233 /* 1 for registers that have pervasive standard uses
234 and are not available for the register allocator. */
236 #define FIXED_REGISTERS \
237 /* r0 r1 r2 r3 r4 r5 r6 r7 mac ap rap fp */ \
238 { 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1 }
240 /* 1 for registers not available across function calls.
241 These must include the FIXED_REGISTERS and also any
242 registers that can be used without being saved.
243 The latter must include the registers where values are returned
244 and the register where structure-value addresses are passed.
245 Aside from that, you can include as many other registers as you
246 like.
248 H8 destroys r0,r1,r2,r3. */
250 #define CALL_USED_REGISTERS \
251 /* r0 r1 r2 r3 r4 r5 r6 r7 mac ap rap fp */ \
252 { 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1 }
254 #define REG_ALLOC_ORDER \
255 /* r0 r1 r2 r3 r4 r5 r6 r7 mac ap rap fp */ \
256 { 2, 3, 0, 1, 4, 5, 6, 8, 7, 9, 10, 11 }
258 #define CONDITIONAL_REGISTER_USAGE \
260 if (!TARGET_MAC) \
261 fixed_regs[MAC_REG] = call_used_regs[MAC_REG] = 1; \
264 #define HARD_REGNO_NREGS(REGNO, MODE) \
265 h8300_hard_regno_nregs ((REGNO), (MODE))
267 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
268 h8300_hard_regno_mode_ok ((REGNO), (MODE))
270 /* Value is 1 if it is a good idea to tie two pseudo registers
271 when one has mode MODE1 and one has mode MODE2.
272 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
273 for any hard reg, then this must be 0 for correct output. */
274 #define MODES_TIEABLE_P(MODE1, MODE2) \
275 ((MODE1) == (MODE2) \
276 || (((MODE1) == QImode || (MODE1) == HImode \
277 || ((TARGET_H8300H || TARGET_H8300S) && (MODE1) == SImode)) \
278 && ((MODE2) == QImode || (MODE2) == HImode \
279 || ((TARGET_H8300H || TARGET_H8300S) && (MODE2) == SImode))))
281 /* A C expression that is nonzero if hard register NEW_REG can be
282 considered for use as a rename register for OLD_REG register */
284 #define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \
285 h8300_hard_regno_rename_ok (OLD_REG, NEW_REG)
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 SP_REG
297 /* Base register for access to local variables of the function. */
298 #define HARD_FRAME_POINTER_REGNUM HFP_REG
300 /* Base register for access to local variables of the function. */
301 #define FRAME_POINTER_REGNUM FP_REG
303 /* Value should be nonzero if functions must have frame pointers.
304 Zero means the frame pointer need not be set up (and parms
305 may be accessed via the stack pointer) in functions that seem suitable.
306 This is computed in `reload', in reload1.c. */
307 #define FRAME_POINTER_REQUIRED 0
309 /* Base register for access to arguments of the function. */
310 #define ARG_POINTER_REGNUM AP_REG
312 /* Register in which static-chain is passed to a function. */
313 #define STATIC_CHAIN_REGNUM SC_REG
315 /* Fake register that holds the address on the stack of the
316 current function's return address. */
317 #define RETURN_ADDRESS_POINTER_REGNUM RAP_REG
319 /* A C expression whose value is RTL representing the value of the return
320 address for the frame COUNT steps up from the current frame.
321 FRAMEADDR is already the frame pointer of the COUNT frame, assuming
322 a stack layout with the frame pointer as the first saved register. */
323 #define RETURN_ADDR_RTX(COUNT, FRAME) h8300_return_addr_rtx ((COUNT), (FRAME))
325 /* Define the classes of registers for register constraints in the
326 machine description. Also define ranges of constants.
328 One of the classes must always be named ALL_REGS and include all hard regs.
329 If there is more than one class, another class must be named NO_REGS
330 and contain no registers.
332 The name GENERAL_REGS must be the name of a class (or an alias for
333 another name such as ALL_REGS). This is the class of registers
334 that is allowed by "g" or "r" in a register constraint.
335 Also, registers outside this class are allocated only when
336 instructions express preferences for them.
338 The classes must be numbered in nondecreasing order; that is,
339 a larger-numbered class must never be contained completely
340 in a smaller-numbered class.
342 For any two classes, it is very desirable that there be another
343 class that represents their union. */
345 enum reg_class {
346 NO_REGS, COUNTER_REGS, SOURCE_REGS, DESTINATION_REGS,
347 GENERAL_REGS, MAC_REGS, ALL_REGS, LIM_REG_CLASSES
350 #define N_REG_CLASSES ((int) LIM_REG_CLASSES)
352 /* Give names of register classes as strings for dump file. */
354 #define REG_CLASS_NAMES \
355 { "NO_REGS", "COUNTER_REGS", "SOURCE_REGS", "DESTINATION_REGS", \
356 "GENERAL_REGS", "MAC_REGS", "ALL_REGS", "LIM_REGS" }
358 /* Define which registers fit in which classes.
359 This is an initializer for a vector of HARD_REG_SET
360 of length N_REG_CLASSES. */
362 #define REG_CLASS_CONTENTS \
363 { {0}, /* No regs */ \
364 {0x010}, /* COUNTER_REGS */ \
365 {0x020}, /* SOURCE_REGS */ \
366 {0x040}, /* DESTINATION_REGS */ \
367 {0xeff}, /* GENERAL_REGS */ \
368 {0x100}, /* MAC_REGS */ \
369 {0xfff}, /* ALL_REGS */ \
372 /* The same information, inverted:
373 Return the class number of the smallest class containing
374 reg number REGNO. This could be a conditional expression
375 or could index an array. */
377 #define REGNO_REG_CLASS(REGNO) \
378 ((REGNO) == MAC_REG ? MAC_REGS \
379 : (REGNO) == COUNTER_REG ? COUNTER_REGS \
380 : (REGNO) == SOURCE_REG ? SOURCE_REGS \
381 : (REGNO) == DESTINATION_REG ? DESTINATION_REGS \
382 : GENERAL_REGS)
384 /* The class value for index registers, and the one for base regs. */
386 #define INDEX_REG_CLASS (TARGET_H8300SX ? GENERAL_REGS : NO_REGS)
387 #define BASE_REG_CLASS GENERAL_REGS
389 /* Get reg_class from a letter such as appears in the machine description.
391 'a' is the MAC register. */
393 #define REG_CLASS_FROM_LETTER(C) (h8300_reg_class_from_letter (C))
395 /* The letters I, J, K, L, M, N, O, P in a register constraint string
396 can be used to stand for particular ranges of immediate operands.
397 This macro defines what the ranges are.
398 C is the letter, and VALUE is a constant value.
399 Return 1 if VALUE is in the range specified by C. */
401 #define CONST_OK_FOR_I(VALUE) ((VALUE) == 0)
402 #define CONST_OK_FOR_J(VALUE) (((VALUE) & 0xff) == 0)
403 #define CONST_OK_FOR_L(VALUE) \
404 (TARGET_H8300H || TARGET_H8300S \
405 ? (VALUE) == 1 || (VALUE) == 2 || (VALUE) == 4 \
406 : (VALUE) == 1 || (VALUE) == 2)
407 #define CONST_OK_FOR_M(VALUE) \
408 ((VALUE) == 1 || (VALUE) == 2)
409 #define CONST_OK_FOR_N(VALUE) \
410 (TARGET_H8300H || TARGET_H8300S \
411 ? (VALUE) == -1 || (VALUE) == -2 || (VALUE) == -4 \
412 : (VALUE) == -1 || (VALUE) == -2)
413 #define CONST_OK_FOR_O(VALUE) \
414 ((VALUE) == -1 || (VALUE) == -2)
416 /* Multi-letter constraints for constant are always started with P
417 (just because it was the only letter in the range left. New
418 constraints for constants should be added here. */
419 #define CONST_OK_FOR_Ppositive(VALUE, NBITS) \
420 ((VALUE) > 0 && (VALUE) < (1 << (NBITS)))
421 #define CONST_OK_FOR_Pnegative(VALUE, NBITS) \
422 ((VALUE) < 0 && (VALUE) > -(1 << (NBITS)))
423 #define CONST_OK_FOR_P(VALUE, STR) \
424 ((STR)[1] >= '1' && (STR)[1] <= '9' && (STR)[2] == '<' \
425 ? (((STR)[3] == '0' || ((STR)[3] == 'X' && TARGET_H8300SX)) \
426 && CONST_OK_FOR_Pnegative ((VALUE), (STR)[1] - '0')) \
427 : ((STR)[1] >= '1' && (STR)[1] <= '9' && (STR)[2] == '>') \
428 ? (((STR)[3] == '0' || ((STR)[3] == 'X' && TARGET_H8300SX)) \
429 && CONST_OK_FOR_Ppositive ((VALUE), (STR)[1] - '0')) \
430 : 0)
431 #define CONSTRAINT_LEN_FOR_P(STR) \
432 ((((STR)[1] >= '1' && (STR)[1] <= '9') \
433 && ((STR)[2] == '<' || (STR)[2] == '>') \
434 && ((STR)[3] == 'X' || (STR)[3] == '0')) ? 4 \
435 : 0)
437 #define CONST_OK_FOR_CONSTRAINT_P(VALUE, C, STR) \
438 ((C) == 'P' ? CONST_OK_FOR_P ((VALUE), (STR)) \
439 : CONST_OK_FOR_LETTER_P ((VALUE), (C)))
441 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
442 ((C) == 'I' ? CONST_OK_FOR_I (VALUE) : \
443 (C) == 'J' ? CONST_OK_FOR_J (VALUE) : \
444 (C) == 'L' ? CONST_OK_FOR_L (VALUE) : \
445 (C) == 'M' ? CONST_OK_FOR_M (VALUE) : \
446 (C) == 'N' ? CONST_OK_FOR_N (VALUE) : \
447 (C) == 'O' ? CONST_OK_FOR_O (VALUE) : \
450 /* Similar, but for floating constants, and defining letters G and H.
451 Here VALUE is the CONST_DOUBLE rtx itself.
453 `G' is a floating-point zero. */
455 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
456 ((C) == 'G' ? (VALUE) == CONST0_RTX (SFmode) \
457 : 0)
459 /* Given an rtx X being reloaded into a reg required to be
460 in class CLASS, return the class of reg to actually use.
461 In general this is just CLASS; but on some machines
462 in some cases it is preferable to use a more restrictive class. */
464 #define PREFERRED_RELOAD_CLASS(X, CLASS) (CLASS)
466 /* Return the maximum number of consecutive registers
467 needed to represent mode MODE in a register of class CLASS. */
469 /* On the H8, this is the size of MODE in words. */
471 #define CLASS_MAX_NREGS(CLASS, MODE) \
472 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
474 /* Any SI register-to-register move may need to be reloaded,
475 so define REGISTER_MOVE_COST to be > 2 so that reload never
476 shortcuts. */
478 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
479 (CLASS1 == MAC_REGS || CLASS2 == MAC_REGS ? 6 : 3)
481 /* Stack layout; function entry, exit and calling. */
483 /* Define this if pushing a word on the stack
484 makes the stack pointer a smaller address. */
486 #define STACK_GROWS_DOWNWARD
488 /* Define this if the nominal address of the stack frame
489 is at the high-address end of the local variables;
490 that is, each additional local variable allocated
491 goes at a more negative offset in the frame. */
493 #define FRAME_GROWS_DOWNWARD
495 /* Offset within stack frame to start allocating local variables at.
496 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
497 first local allocated. Otherwise, it is the offset to the BEGINNING
498 of the first local allocated. */
500 #define STARTING_FRAME_OFFSET 0
502 /* If we generate an insn to push BYTES bytes,
503 this says how many the stack pointer really advances by.
505 On the H8/300, @-sp really pushes a byte if you ask it to - but that's
506 dangerous, so we claim that it always pushes a word, then we catch
507 the mov.b rx,@-sp and turn it into a mov.w rx,@-sp on output.
509 On the H8/300H, we simplify TARGET_QUICKCALL by setting this to 4
510 and doing a similar thing. */
512 #define PUSH_ROUNDING(BYTES) \
513 (((BYTES) + PARM_BOUNDARY / 8 - 1) & -PARM_BOUNDARY / 8)
515 /* Offset of first parameter from the argument pointer register value. */
516 /* Is equal to the size of the saved fp + pc, even if an fp isn't
517 saved since the value is used before we know. */
519 #define FIRST_PARM_OFFSET(FNDECL) 0
521 /* Value is the number of bytes of arguments automatically
522 popped when returning from a subroutine call.
523 FUNDECL is the declaration node of the function (as a tree),
524 FUNTYPE is the data type of the function (as a tree),
525 or for a library call it is an identifier node for the subroutine name.
526 SIZE is the number of bytes of arguments passed on the stack.
528 On the H8 the return does not pop anything. */
530 #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, SIZE) 0
532 /* Definitions for register eliminations.
534 This is an array of structures. Each structure initializes one pair
535 of eliminable registers. The "from" register number is given first,
536 followed by "to". Eliminations of the same "from" register are listed
537 in order of preference.
539 We have three registers that can be eliminated on the h8300.
540 First, the frame pointer register can often be eliminated in favor
541 of the stack pointer register. Secondly, the argument pointer
542 register and the return address pointer register are always
543 eliminated; they are replaced with either the stack or frame
544 pointer. */
546 #define ELIMINABLE_REGS \
547 {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
548 { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
549 { RETURN_ADDRESS_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
550 { RETURN_ADDRESS_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
551 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
552 { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
554 /* Given FROM and TO register numbers, say whether this elimination is allowed.
555 Frame pointer elimination is automatically handled.
557 For the h8300, if frame pointer elimination is being done, we would like to
558 convert ap and rp into sp, not fp.
560 All other eliminations are valid. */
562 #define CAN_ELIMINATE(FROM, TO) \
563 ((TO) == STACK_POINTER_REGNUM ? ! frame_pointer_needed : 1)
565 /* Define the offset between two registers, one to be eliminated, and the other
566 its replacement, at the start of a routine. */
568 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
569 ((OFFSET) = h8300_initial_elimination_offset ((FROM), (TO)))
571 /* Define how to find the value returned by a function.
572 VALTYPE is the data type of the value (as a tree).
573 If the precise function being called is known, FUNC is its FUNCTION_DECL;
574 otherwise, FUNC is 0.
576 On the H8 the return value is in R0/R1. */
578 #define FUNCTION_VALUE(VALTYPE, FUNC) \
579 gen_rtx_REG (TYPE_MODE (VALTYPE), R0_REG)
581 /* Define how to find the value returned by a library function
582 assuming the value has mode MODE. */
584 /* On the H8 the return value is in R0/R1. */
586 #define LIBCALL_VALUE(MODE) \
587 gen_rtx_REG (MODE, R0_REG)
589 /* 1 if N is a possible register number for a function value.
590 On the H8, R0 is the only register thus used. */
592 #define FUNCTION_VALUE_REGNO_P(N) ((N) == R0_REG)
594 /* Define this if PCC uses the nonreentrant convention for returning
595 structure and union values. */
597 /*#define PCC_STATIC_STRUCT_RETURN*/
599 /* 1 if N is a possible register number for function argument passing.
600 On the H8, no registers are used in this way. */
602 #define FUNCTION_ARG_REGNO_P(N) (TARGET_QUICKCALL ? N < 3 : 0)
604 /* When defined, the compiler allows registers explicitly used in the
605 rtl to be used as spill registers but prevents the compiler from
606 extending the lifetime of these registers. */
608 #define SMALL_REGISTER_CLASSES 1
610 /* Define a data type for recording info about an argument list
611 during the scan of that argument list. This data type should
612 hold all necessary information about the function itself
613 and about the args processed so far, enough to enable macros
614 such as FUNCTION_ARG to determine where the next arg should go.
616 On the H8/300, this is a two item struct, the first is the number
617 of bytes scanned so far and the second is the rtx of the called
618 library function if any. */
620 #define CUMULATIVE_ARGS struct cum_arg
621 struct cum_arg
623 int nbytes;
624 struct rtx_def *libcall;
627 /* Initialize a variable CUM of type CUMULATIVE_ARGS
628 for a call to a function whose data type is FNTYPE.
629 For a library call, FNTYPE is 0.
631 On the H8/300, the offset starts at 0. */
633 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
634 ((CUM).nbytes = 0, (CUM).libcall = LIBNAME)
636 /* Update the data in CUM to advance over an argument
637 of mode MODE and data type TYPE.
638 (TYPE is null for libcalls where that information may not be available.) */
640 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
641 ((CUM).nbytes += ((MODE) != BLKmode \
642 ? (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD \
643 : (int_size_in_bytes (TYPE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD))
645 /* Define where to put the arguments to a function.
646 Value is zero to push the argument on the stack,
647 or a hard register in which to store the argument.
649 MODE is the argument's machine mode.
650 TYPE is the data type of the argument (as a tree).
651 This is null for libcalls where that information may
652 not be available.
653 CUM is a variable of type CUMULATIVE_ARGS which gives info about
654 the preceding args and about the function being called.
655 NAMED is nonzero if this argument is a named parameter
656 (otherwise it is an extra parameter matching an ellipsis). */
658 /* On the H8/300 all normal args are pushed, unless -mquickcall in which
659 case the first 3 arguments are passed in registers.
660 See function `function_arg'. */
662 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
663 function_arg (&CUM, MODE, TYPE, NAMED)
665 /* Output assembler code to FILE to increment profiler label # LABELNO
666 for profiling a function entry. */
668 #define FUNCTION_PROFILER(FILE, LABELNO) \
669 fprintf (FILE, "\t%s\t#LP%d,%s\n\tjsr @mcount\n", \
670 h8_mov_op, (LABELNO), h8_reg_names[0]);
672 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
673 the stack pointer does not matter. The value is tested only in
674 functions that have frame pointers.
675 No definition is equivalent to always zero. */
677 #define EXIT_IGNORE_STACK 0
679 /* We emit the entire trampoline with INITIALIZE_TRAMPOLINE.
680 Depending on the pointer size, we use a different trampoline.
682 Pmode == HImode
683 vvvv context
684 1 0000 7903xxxx mov.w #0x1234,r3
685 2 0004 5A00xxxx jmp @0x1234
686 ^^^^ function
688 Pmode == SImode
689 vvvvvvvv context
690 2 0000 7A03xxxxxxxx mov.l #0x12345678,er3
691 3 0006 5Axxxxxx jmp @0x123456
692 ^^^^^^ function
695 /* Length in units of the trampoline for entering a nested function. */
697 #define TRAMPOLINE_SIZE ((Pmode == HImode) ? 8 : 12)
699 /* Emit RTL insns to build a trampoline.
700 FNADDR is an RTX for the address of the function's pure code.
701 CXT is an RTX for the static chain value for the function. */
703 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
704 do \
706 if (Pmode == HImode) \
708 emit_move_insn (gen_rtx_MEM (HImode, (TRAMP)), GEN_INT (0x7903)); \
709 emit_move_insn (gen_rtx_MEM (Pmode, plus_constant ((TRAMP), 2)), \
710 (CXT)); \
711 emit_move_insn (gen_rtx_MEM (Pmode, plus_constant ((TRAMP), 4)), \
712 GEN_INT (0x5a00)); \
713 emit_move_insn (gen_rtx_MEM (Pmode, plus_constant ((TRAMP), 6)), \
714 (FNADDR)); \
716 else \
718 rtx tem = gen_reg_rtx (Pmode); \
720 emit_move_insn (gen_rtx_MEM (HImode, (TRAMP)), GEN_INT (0x7a03)); \
721 emit_move_insn (gen_rtx_MEM (Pmode, plus_constant ((TRAMP), 2)), \
722 (CXT)); \
723 emit_move_insn (tem, (FNADDR)); \
724 emit_insn (gen_andsi3 (tem, tem, GEN_INT (0x00ffffff))); \
725 emit_insn (gen_iorsi3 (tem, tem, GEN_INT (0x5a000000))); \
726 emit_move_insn (gen_rtx_MEM (Pmode, plus_constant ((TRAMP), 6)), \
727 tem); \
730 while (0)
732 /* Addressing modes, and classification of registers for them. */
734 #define HAVE_POST_INCREMENT 1
735 #define HAVE_PRE_DECREMENT 1
736 #define HAVE_POST_DECREMENT TARGET_H8300SX
737 #define HAVE_PRE_INCREMENT TARGET_H8300SX
739 /* Macros to check register numbers against specific register classes. */
741 /* These assume that REGNO is a hard or pseudo reg number.
742 They give nonzero only if REGNO is a hard reg of the suitable class
743 or a pseudo reg currently allocated to a suitable hard reg.
744 Since they use reg_renumber, they are safe only once reg_renumber
745 has been allocated, which happens in local-alloc.c. */
747 #define REGNO_OK_FOR_INDEX_P(regno) 0
749 #define REGNO_OK_FOR_BASE_P(regno) \
750 (((regno) < FIRST_PSEUDO_REGISTER && regno != MAC_REG) \
751 || reg_renumber[regno] >= 0)
753 /* Maximum number of registers that can appear in a valid memory address. */
755 #define MAX_REGS_PER_ADDRESS 1
757 /* 1 if X is an rtx for a constant that is a valid address. */
759 #define CONSTANT_ADDRESS_P(X) \
760 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
761 || (GET_CODE (X) == CONST_INT \
762 /* We handle signed and unsigned offsets here. */ \
763 && INTVAL (X) > (TARGET_H8300 ? -0x10000 : -0x1000000) \
764 && INTVAL (X) < (TARGET_H8300 ? 0x10000 : 0x1000000)) \
765 || (GET_CODE (X) == HIGH || GET_CODE (X) == CONST))
767 /* Nonzero if the constant value X is a legitimate general operand.
768 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
770 #define LEGITIMATE_CONSTANT_P(X) (h8300_legitimate_constant_p (X))
772 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
773 and check its validity for a certain class.
774 We have two alternate definitions for each of them.
775 The usual definition accepts all pseudo regs; the other rejects
776 them unless they have been allocated suitable hard regs.
777 The symbol REG_OK_STRICT causes the latter definition to be used.
779 Most source files want to accept pseudo regs in the hope that
780 they will get allocated to the class that the insn wants them to be in.
781 Source files for reload pass need to be strict.
782 After reload, it makes no difference, since pseudo regs have
783 been eliminated by then. */
785 /* Non-strict versions. */
786 #define REG_OK_FOR_INDEX_NONSTRICT_P(X) 0
787 /* Don't use REGNO_OK_FOR_BASE_P here because it uses reg_renumber. */
788 #define REG_OK_FOR_BASE_NONSTRICT_P(X) \
789 (REGNO (X) >= FIRST_PSEUDO_REGISTER || REGNO (X) != MAC_REG)
791 /* Strict versions. */
792 #define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
793 #define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
795 #ifndef REG_OK_STRICT
797 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_NONSTRICT_P (X)
798 #define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NONSTRICT_P (X)
800 #else
802 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_STRICT_P (X)
803 #define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P (X)
805 #endif
807 /* Extra constraints. */
809 #define OK_FOR_Q(OP) \
810 (TARGET_H8300SX && memory_operand ((OP), VOIDmode))
812 #define OK_FOR_R(OP) \
813 (GET_CODE (OP) == CONST_INT \
814 ? !h8300_shift_needs_scratch_p (INTVAL (OP), QImode) \
815 : 0)
817 #define OK_FOR_S(OP) \
818 (GET_CODE (OP) == CONST_INT \
819 ? !h8300_shift_needs_scratch_p (INTVAL (OP), HImode) \
820 : 0)
822 #define OK_FOR_T(OP) \
823 (GET_CODE (OP) == CONST_INT \
824 ? !h8300_shift_needs_scratch_p (INTVAL (OP), SImode) \
825 : 0)
827 /* 'U' if valid for a bset destination;
828 i.e. a register, register indirect, or the eightbit memory region
829 (a SYMBOL_REF with an SYMBOL_REF_FLAG set).
831 On the H8S 'U' can also be a 16bit or 32bit absolute. */
832 #define OK_FOR_U(OP) \
833 ((GET_CODE (OP) == REG && REG_OK_FOR_BASE_P (OP)) \
834 || (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == REG \
835 && REG_OK_FOR_BASE_P (XEXP (OP, 0))) \
836 || (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == SYMBOL_REF \
837 && TARGET_H8300S) \
838 || (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == CONST \
839 && GET_CODE (XEXP (XEXP (OP, 0), 0)) == PLUS \
840 && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 0)) == SYMBOL_REF \
841 && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 1)) == CONST_INT \
842 && (TARGET_H8300S \
843 || SYMBOL_REF_FLAG (XEXP (XEXP (XEXP (OP, 0), 0), 0)))) \
844 || (GET_CODE (OP) == MEM \
845 && h8300_eightbit_constant_address_p (XEXP (OP, 0))) \
846 || (GET_CODE (OP) == MEM && TARGET_H8300S \
847 && GET_CODE (XEXP (OP, 0)) == CONST_INT))
849 /* Multi-letter constraints starting with W are to be used for
850 operands that require a memory operand, i.e,. that are never used
851 along with register constraints (see EXTRA_MEMORY_CONSTRAINTS).
852 For operands that require a memory operand (or not) but that always
853 accept a register, a multi-letter constraint starting with Y should
854 be used instead. */
856 #define OK_FOR_WU(OP) \
857 (GET_CODE (OP) == MEM && OK_FOR_U (OP))
859 #define OK_FOR_W(OP, STR) \
860 ((STR)[1] == 'U' ? OK_FOR_WU (OP) \
861 : 0)
863 #define CONSTRAINT_LEN_FOR_W(STR) \
864 ((STR)[1] == 'U' ? 2 \
865 : 0)
867 /* We don't have any constraint starting with Y yet, but before
868 someone uses it for a one-letter constraint and we're left without
869 any upper-case constraints left, we reserve it for extensions
870 here. */
871 #define OK_FOR_Y(OP, STR) \
874 #define CONSTRAINT_LEN_FOR_Y(STR) \
877 #define OK_FOR_Z(OP) \
878 (TARGET_H8300SX \
879 && GET_CODE (OP) == MEM \
880 && CONSTANT_P (XEXP ((OP), 0)))
882 #define EXTRA_CONSTRAINT_STR(OP, C, STR) \
883 ((C) == 'Q' ? OK_FOR_Q (OP) : \
884 (C) == 'R' ? OK_FOR_R (OP) : \
885 (C) == 'S' ? OK_FOR_S (OP) : \
886 (C) == 'T' ? OK_FOR_T (OP) : \
887 (C) == 'U' ? OK_FOR_U (OP) : \
888 (C) == 'W' ? OK_FOR_W ((OP), (STR)) : \
889 (C) == 'Y' ? OK_FOR_Y ((OP), (STR)) : \
890 (C) == 'Z' ? OK_FOR_Z (OP) : \
893 #define CONSTRAINT_LEN(C, STR) \
894 ((C) == 'P' ? CONSTRAINT_LEN_FOR_P (STR) \
895 : (C) == 'W' ? CONSTRAINT_LEN_FOR_W (STR) \
896 : (C) == 'Y' ? CONSTRAINT_LEN_FOR_Y (STR) \
897 : DEFAULT_CONSTRAINT_LEN ((C), (STR)))
899 /* Experiments suggest that it's better not add 'Q' or 'U' here. No
900 patterns need it for correctness (no patterns use 'Q' and 'U'
901 without also providing a register alternative). And defining it
902 will mean that a spilled pseudo could be replaced by its frame
903 location in several consecutive insns.
905 Instead, it seems to be better to force pseudos to be reloaded
906 into registers and then use peepholes to recombine insns when
907 beneficial.
909 Unfortunately, for WU (unlike plain U, that matches regs as well),
910 we must require a memory address. In fact, all multi-letter
911 constraints started with W are supposed to have this property, so
912 we just test for W here. */
913 #define EXTRA_MEMORY_CONSTRAINT(C, STR) \
914 ((C) == 'W')
917 #ifndef REG_OK_STRICT
918 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
919 do \
921 if (h8300_legitimate_address_p ((MODE), (X), 0)) \
922 goto ADDR; \
924 while (0)
925 #else
926 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
927 do \
929 if (h8300_legitimate_address_p ((MODE), (X), 1)) \
930 goto ADDR; \
932 while (0)
933 #endif
935 /* Go to LABEL if ADDR (a legitimate address expression)
936 has an effect that depends on the machine mode it is used for.
938 On the H8/300, the predecrement and postincrement address depend thus
939 (the amount of decrement or increment being the length of the operand). */
941 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) \
942 if (GET_CODE (ADDR) == POST_INC \
943 || GET_CODE (ADDR) == POST_DEC \
944 || GET_CODE (ADDR) == PRE_INC \
945 || GET_CODE (ADDR) == PRE_DEC) \
946 goto LABEL; \
947 if (GET_CODE (ADDR) == PLUS \
948 && h8300_get_index (XEXP (ADDR, 0), VOIDmode, 0) != XEXP (ADDR, 0)) \
949 goto LABEL;
951 /* Specify the machine mode that this machine uses
952 for the index in the tablejump instruction. */
953 #define CASE_VECTOR_MODE Pmode
955 /* Define this as 1 if `char' should by default be signed; else as 0.
957 On the H8/300, sign extension is expensive, so we'll say that chars
958 are unsigned. */
959 #define DEFAULT_SIGNED_CHAR 0
961 /* This flag, if defined, says the same insns that convert to a signed fixnum
962 also convert validly to an unsigned one. */
963 #define FIXUNS_TRUNC_LIKE_FIX_TRUNC
965 /* Max number of bytes we can move from memory to memory
966 in one reasonably fast instruction. */
967 #define MOVE_MAX (TARGET_H8300H || TARGET_H8300S ? 4 : 2)
968 #define MAX_MOVE_MAX 4
970 /* Nonzero if access to memory by bytes is slow and undesirable. */
971 #define SLOW_BYTE_ACCESS TARGET_SLOWBYTE
973 /* Define if shifts truncate the shift count
974 which implies one can omit a sign-extension or zero-extension
975 of a shift count. */
976 /* #define SHIFT_COUNT_TRUNCATED */
978 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
979 is done just by pretending it is already truncated. */
980 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
982 /* Specify the machine mode that pointers have.
983 After generation of rtl, the compiler makes no further distinction
984 between pointers and any other objects of this machine mode. */
985 #define Pmode \
986 ((TARGET_H8300H || TARGET_H8300S) && !TARGET_NORMAL_MODE ? SImode : HImode)
988 /* ANSI C types.
989 We use longs for the H8/300H and the H8S because ints can be 16 or 32.
990 GCC requires SIZE_TYPE to be the same size as pointers. */
991 #define SIZE_TYPE \
992 (TARGET_H8300 || TARGET_NORMAL_MODE ? TARGET_INT32 ? "short unsigned int" : "unsigned int" : "long unsigned int")
993 #define PTRDIFF_TYPE \
994 (TARGET_H8300 || TARGET_NORMAL_MODE ? TARGET_INT32 ? "short int" : "int" : "long int")
996 #define POINTER_SIZE \
997 ((TARGET_H8300H || TARGET_H8300S) && !TARGET_NORMAL_MODE ? 32 : 16)
999 #define WCHAR_TYPE "short unsigned int"
1000 #define WCHAR_TYPE_SIZE 16
1002 /* A function address in a call instruction
1003 is a byte address (for indexing purposes)
1004 so give the MEM rtx a byte's mode. */
1005 #define FUNCTION_MODE QImode
1007 /* Return the length of JUMP's delay slot insn (0 if it has none).
1008 If JUMP is a delayed branch, NEXT_INSN (PREV_INSN (JUMP)) will
1009 be the containing SEQUENCE, not JUMP itself. */
1010 #define DELAY_SLOT_LENGTH(JUMP) \
1011 (NEXT_INSN (PREV_INSN (JUMP)) == JUMP ? 0 : 2)
1013 #define BRANCH_COST 0
1015 /* Tell final.c how to eliminate redundant test instructions. */
1017 /* Here we define machine-dependent flags and fields in cc_status
1018 (see `conditions.h'). No extra ones are needed for the h8300. */
1020 /* Store in cc_status the expressions
1021 that the condition codes will describe
1022 after execution of an instruction whose pattern is EXP.
1023 Do not alter them if the instruction would not alter the cc's. */
1025 #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc (EXP, INSN)
1027 /* The add insns don't set overflow in a usable way. */
1028 #define CC_OVERFLOW_UNUSABLE 01000
1029 /* The mov,and,or,xor insns don't set carry. That's OK though as the
1030 Z bit is all we need when doing unsigned comparisons on the result of
1031 these insns (since they're always with 0). However, conditions.h has
1032 CC_NO_OVERFLOW defined for this purpose. Rename it to something more
1033 understandable. */
1034 #define CC_NO_CARRY CC_NO_OVERFLOW
1036 /* Control the assembler format that we output. */
1038 /* Output to assembler file text saying following lines
1039 may contain character constants, extra white space, comments, etc. */
1041 #define ASM_APP_ON "; #APP\n"
1043 /* Output to assembler file text saying following lines
1044 no longer contain unusual constructs. */
1046 #define ASM_APP_OFF "; #NO_APP\n"
1048 #define FILE_ASM_OP "\t.file\n"
1050 /* The assembler op to get a word, 2 bytes for the H8/300, 4 for H8/300H. */
1051 #define ASM_WORD_OP \
1052 (TARGET_H8300 || TARGET_NORMAL_MODE ? "\t.word\t" : "\t.long\t")
1054 #define TEXT_SECTION_ASM_OP "\t.section .text"
1055 #define DATA_SECTION_ASM_OP "\t.section .data"
1056 #define BSS_SECTION_ASM_OP "\t.section .bss"
1058 #undef DO_GLOBAL_CTORS_BODY
1059 #define DO_GLOBAL_CTORS_BODY \
1061 extern func_ptr __ctors[]; \
1062 extern func_ptr __ctors_end[]; \
1063 func_ptr *p; \
1064 for (p = __ctors_end; p > __ctors; ) \
1066 (*--p)(); \
1070 #undef DO_GLOBAL_DTORS_BODY
1071 #define DO_GLOBAL_DTORS_BODY \
1073 extern func_ptr __dtors[]; \
1074 extern func_ptr __dtors_end[]; \
1075 func_ptr *p; \
1076 for (p = __dtors; p < __dtors_end; p++) \
1078 (*p)(); \
1082 /* How to refer to registers in assembler output.
1083 This sequence is indexed by compiler's hard-register-number (see above). */
1085 #define REGISTER_NAMES \
1086 { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp", "mac", "ap", "rap", "fp" }
1088 #define ADDITIONAL_REGISTER_NAMES \
1089 { {"er0", 0}, {"er1", 1}, {"er2", 2}, {"er3", 3}, {"er4", 4}, \
1090 {"er5", 5}, {"er6", 6}, {"er7", 7}, {"r7", 7} }
1092 /* Globalizing directive for a label. */
1093 #define GLOBAL_ASM_OP "\t.global "
1095 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
1096 ASM_OUTPUT_LABEL (FILE, NAME)
1098 /* The prefix to add to user-visible assembler symbols. */
1100 #define USER_LABEL_PREFIX "_"
1102 /* This is how to store into the string LABEL
1103 the symbol_ref name of an internal numbered label where
1104 PREFIX is the class of label and NUM is the number within the class.
1105 This is suitable for output with `assemble_name'.
1107 N.B.: The h8300.md branch_true and branch_false patterns also know
1108 how to generate internal labels. */
1109 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
1110 sprintf (LABEL, "*.%s%lu", PREFIX, (unsigned long)(NUM))
1112 /* This is how to output an insn to push a register on the stack.
1113 It need not be very fast code. */
1115 #define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \
1116 fprintf (FILE, "\t%s\t%s\n", h8_push_op, h8_reg_names[REGNO])
1118 /* This is how to output an insn to pop a register from the stack.
1119 It need not be very fast code. */
1121 #define ASM_OUTPUT_REG_POP(FILE, REGNO) \
1122 fprintf (FILE, "\t%s\t%s\n", h8_pop_op, h8_reg_names[REGNO])
1124 /* This is how to output an element of a case-vector that is absolute. */
1126 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1127 fprintf (FILE, "%s.L%d\n", ASM_WORD_OP, VALUE)
1129 /* This is how to output an element of a case-vector that is relative. */
1131 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1132 fprintf (FILE, "%s.L%d-.L%d\n", ASM_WORD_OP, VALUE, REL)
1134 /* This is how to output an assembler line
1135 that says to advance the location counter
1136 to a multiple of 2**LOG bytes. */
1138 #define ASM_OUTPUT_ALIGN(FILE, LOG) \
1139 if ((LOG) != 0) \
1140 fprintf (FILE, "\t.align %d\n", (LOG))
1142 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
1143 fprintf (FILE, "\t.space %d\n", (int)(SIZE))
1145 /* This says how to output an assembler line
1146 to define a global common symbol. */
1148 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1149 ( fputs ("\t.comm ", (FILE)), \
1150 assemble_name ((FILE), (NAME)), \
1151 fprintf ((FILE), ",%lu\n", (unsigned long)(SIZE)))
1153 /* This says how to output the assembler to define a global
1154 uninitialized but not common symbol.
1155 Try to use asm_output_bss to implement this macro. */
1157 #define ASM_OUTPUT_BSS(FILE, DECL, NAME, SIZE, ROUNDED) \
1158 asm_output_bss ((FILE), (DECL), (NAME), (SIZE), (ROUNDED))
1160 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
1161 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
1163 /* This says how to output an assembler line
1164 to define a local common symbol. */
1166 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
1167 ( fputs ("\t.lcomm ", (FILE)), \
1168 assemble_name ((FILE), (NAME)), \
1169 fprintf ((FILE), ",%d\n", (int)(SIZE)))
1171 #define ASM_PN_FORMAT "%s___%lu"
1173 /* Print an instruction operand X on file FILE.
1174 Look in h8300.c for details. */
1176 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1177 ((CODE) == '#')
1179 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
1181 /* Print a memory operand whose address is X, on file FILE.
1182 This uses a function in h8300.c. */
1184 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
1186 /* H8300 specific pragmas. */
1187 #define REGISTER_TARGET_PRAGMAS() \
1188 do \
1190 c_register_pragma (0, "saveall", h8300_pr_saveall); \
1191 c_register_pragma (0, "interrupt", h8300_pr_interrupt); \
1193 while (0)
1195 #define FINAL_PRESCAN_INSN(insn, operand, nop) \
1196 final_prescan_insn (insn, operand, nop)
1198 #define MOVE_RATIO 3
1199 extern int h8300_move_ratio;
1200 #undef MOVE_RATIO
1201 #define MOVE_RATIO h8300_move_ratio
1203 /* Machine-specific symbol_ref flags. */
1204 #define SYMBOL_FLAG_FUNCVEC_FUNCTION (SYMBOL_FLAG_MACH_DEP << 0)
1205 #define SYMBOL_FLAG_EIGHTBIT_DATA (SYMBOL_FLAG_MACH_DEP << 1)
1206 #define SYMBOL_FLAG_TINY_DATA (SYMBOL_FLAG_MACH_DEP << 2)
1208 #endif /* ! GCC_H8300_H */