]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/m32r/m32r.h
tm.texi.in (OVERRIDE_OPTIONS): Remove documentation.
[thirdparty/gcc.git] / gcc / config / m32r / m32r.h
1 /* Definitions of target machine for GNU compiler, Renesas M32R cpu.
2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
3 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published
9 by the Free Software Foundation; either version 3, or (at your
10 option) any later version.
11
12 GCC is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
20
21 /* Things to do:
22 - longlong.h?
23 */
24
25 #undef SWITCH_TAKES_ARG
26 #undef WORD_SWITCH_TAKES_ARG
27 #undef HANDLE_SYSV_PRAGMA
28 #undef SIZE_TYPE
29 #undef PTRDIFF_TYPE
30 #undef WCHAR_TYPE
31 #undef WCHAR_TYPE_SIZE
32 #undef TARGET_VERSION
33 #undef CPP_SPEC
34 #undef ASM_SPEC
35 #undef LINK_SPEC
36 #undef STARTFILE_SPEC
37 #undef ENDFILE_SPEC
38
39 #undef ASM_APP_ON
40 #undef ASM_APP_OFF
41 \f
42
43 /* M32R/X overrides. */
44 /* Print subsidiary information on the compiler version in use. */
45 #define TARGET_VERSION fprintf (stderr, " (m32r/x/2)");
46
47 /* Additional flags for the preprocessor. */
48 #define CPP_CPU_SPEC "%{m32rx:-D__M32RX__ -D__m32rx__ -U__M32R2__ -U__m32r2__} \
49 %{m32r2:-D__M32R2__ -D__m32r2__ -U__M32RX__ -U__m32rx__} \
50 %{m32r:-U__M32RX__ -U__m32rx__ -U__M32R2__ -U__m32r2__} \
51 "
52
53 /* Assembler switches. */
54 #define ASM_CPU_SPEC \
55 "%{m32r} %{m32rx} %{m32r2} %{!O0: %{O*: -O}} --no-warn-explicit-parallel-conflicts"
56
57 /* Use m32rx specific crt0/crtinit/crtfini files. */
58 #define STARTFILE_CPU_SPEC "%{!shared:crt0.o%s} %{m32rx:m32rx/crtinit.o%s} %{!m32rx:crtinit.o%s}"
59 #define ENDFILE_CPU_SPEC "-lgloss %{m32rx:m32rx/crtfini.o%s} %{!m32rx:crtfini.o%s}"
60
61 /* Define this macro as a C expression for the initializer of an array of
62 strings to tell the driver program which options are defaults for this
63 target and thus do not need to be handled specially when using
64 `MULTILIB_OPTIONS'. */
65 #define SUBTARGET_MULTILIB_DEFAULTS , "m32r"
66
67 /* Number of additional registers the subtarget defines. */
68 #define SUBTARGET_NUM_REGISTERS 1
69
70 /* 1 for registers that cannot be allocated. */
71 #define SUBTARGET_FIXED_REGISTERS , 1
72
73 /* 1 for registers that are not available across function calls. */
74 #define SUBTARGET_CALL_USED_REGISTERS , 1
75
76 /* Order to allocate model specific registers. */
77 #define SUBTARGET_REG_ALLOC_ORDER , 19
78
79 /* Registers which are accumulators. */
80 #define SUBTARGET_REG_CLASS_ACCUM 0x80000
81
82 /* All registers added. */
83 #define SUBTARGET_REG_CLASS_ALL SUBTARGET_REG_CLASS_ACCUM
84
85 /* Additional accumulator registers. */
86 #define SUBTARGET_ACCUM_P(REGNO) ((REGNO) == 19)
87
88 /* Define additional register names. */
89 #define SUBTARGET_REGISTER_NAMES , "a1"
90 /* end M32R/X overrides. */
91
92 /* Print subsidiary information on the compiler version in use. */
93 #ifndef TARGET_VERSION
94 #define TARGET_VERSION fprintf (stderr, " (m32r)")
95 #endif
96
97 /* Switch Recognition by gcc.c. Add -G xx support. */
98
99 #undef SWITCH_TAKES_ARG
100 #define SWITCH_TAKES_ARG(CHAR) \
101 (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G')
102
103 /* Names to predefine in the preprocessor for this target machine. */
104 /* __M32R__ is defined by the existing compiler so we use that. */
105 #define TARGET_CPU_CPP_BUILTINS() \
106 do \
107 { \
108 builtin_define ("__M32R__"); \
109 builtin_define ("__m32r__"); \
110 builtin_assert ("cpu=m32r"); \
111 builtin_assert ("machine=m32r"); \
112 builtin_define (TARGET_BIG_ENDIAN \
113 ? "__BIG_ENDIAN__" : "__LITTLE_ENDIAN__"); \
114 } \
115 while (0)
116
117 /* This macro defines names of additional specifications to put in the specs
118 that can be used in various specifications like CC1_SPEC. Its definition
119 is an initializer with a subgrouping for each command option.
120
121 Each subgrouping contains a string constant, that defines the
122 specification name, and a string constant that used by the GCC driver
123 program.
124
125 Do not define this macro if it does not need to do anything. */
126
127 #ifndef SUBTARGET_EXTRA_SPECS
128 #define SUBTARGET_EXTRA_SPECS
129 #endif
130
131 #ifndef ASM_CPU_SPEC
132 #define ASM_CPU_SPEC ""
133 #endif
134
135 #ifndef CPP_CPU_SPEC
136 #define CPP_CPU_SPEC ""
137 #endif
138
139 #ifndef CC1_CPU_SPEC
140 #define CC1_CPU_SPEC ""
141 #endif
142
143 #ifndef LINK_CPU_SPEC
144 #define LINK_CPU_SPEC ""
145 #endif
146
147 #ifndef STARTFILE_CPU_SPEC
148 #define STARTFILE_CPU_SPEC "%{!shared:crt0.o%s} crtinit.o%s"
149 #endif
150
151 #ifndef ENDFILE_CPU_SPEC
152 #define ENDFILE_CPU_SPEC "-lgloss crtfini.o%s"
153 #endif
154
155 #ifndef RELAX_SPEC
156 #if 0 /* Not supported yet. */
157 #define RELAX_SPEC "%{mrelax:-relax}"
158 #else
159 #define RELAX_SPEC ""
160 #endif
161 #endif
162
163 #define EXTRA_SPECS \
164 { "asm_cpu", ASM_CPU_SPEC }, \
165 { "cpp_cpu", CPP_CPU_SPEC }, \
166 { "cc1_cpu", CC1_CPU_SPEC }, \
167 { "link_cpu", LINK_CPU_SPEC }, \
168 { "startfile_cpu", STARTFILE_CPU_SPEC }, \
169 { "endfile_cpu", ENDFILE_CPU_SPEC }, \
170 { "relax", RELAX_SPEC }, \
171 SUBTARGET_EXTRA_SPECS
172
173 #define CPP_SPEC "%(cpp_cpu)"
174
175 #undef CC1_SPEC
176 #define CC1_SPEC "%{G*} %(cc1_cpu)"
177
178 /* Options to pass on to the assembler. */
179 #undef ASM_SPEC
180 #define ASM_SPEC "%{v} %(asm_cpu) %(relax) %{fpic|fpie:-K PIC} %{fPIC|fPIE:-K PIC}"
181
182 #define LINK_SPEC "%{v} %(link_cpu) %(relax)"
183
184 #undef STARTFILE_SPEC
185 #define STARTFILE_SPEC "%(startfile_cpu)"
186
187 #undef ENDFILE_SPEC
188 #define ENDFILE_SPEC "%(endfile_cpu)"
189
190 #undef LIB_SPEC
191 \f
192 /* Run-time compilation parameters selecting different hardware subsets. */
193
194 #define TARGET_M32R (! TARGET_M32RX && ! TARGET_M32R2)
195
196 #ifndef TARGET_LITTLE_ENDIAN
197 #define TARGET_LITTLE_ENDIAN 0
198 #endif
199 #define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
200
201 /* This defaults us to m32r. */
202 #ifndef TARGET_CPU_DEFAULT
203 #define TARGET_CPU_DEFAULT 0
204 #endif
205
206 /* Code Models
207
208 Code models are used to select between two choices of two separate
209 possibilities (address space size, call insn to use):
210
211 small: addresses use 24 bits, use bl to make calls
212 medium: addresses use 32 bits, use bl to make calls (*1)
213 large: addresses use 32 bits, use seth/add3/jl to make calls (*2)
214
215 The fourth is "addresses use 24 bits, use seth/add3/jl to make calls" but
216 using this one doesn't make much sense.
217
218 (*1) The linker may eventually be able to relax seth/add3 -> ld24.
219 (*2) The linker may eventually be able to relax seth/add3/jl -> bl.
220
221 Internally these are recorded as TARGET_ADDR{24,32} and
222 TARGET_CALL{26,32}.
223
224 The __model__ attribute can be used to select the code model to use when
225 accessing particular objects. */
226
227 enum m32r_model { M32R_MODEL_SMALL, M32R_MODEL_MEDIUM, M32R_MODEL_LARGE };
228
229 extern enum m32r_model m32r_model;
230 #define TARGET_MODEL_SMALL (m32r_model == M32R_MODEL_SMALL)
231 #define TARGET_MODEL_MEDIUM (m32r_model == M32R_MODEL_MEDIUM)
232 #define TARGET_MODEL_LARGE (m32r_model == M32R_MODEL_LARGE)
233 #define TARGET_ADDR24 (m32r_model == M32R_MODEL_SMALL)
234 #define TARGET_ADDR32 (! TARGET_ADDR24)
235 #define TARGET_CALL26 (! TARGET_CALL32)
236 #define TARGET_CALL32 (m32r_model == M32R_MODEL_LARGE)
237
238 /* The default is the small model. */
239 #ifndef M32R_MODEL_DEFAULT
240 #define M32R_MODEL_DEFAULT M32R_MODEL_SMALL
241 #endif
242
243 /* Small Data Area
244
245 The SDA consists of sections .sdata, .sbss, and .scommon.
246 .scommon isn't a real section, symbols in it have their section index
247 set to SHN_M32R_SCOMMON, though support for it exists in the linker script.
248
249 Two switches control the SDA:
250
251 -G NNN - specifies the maximum size of variable to go in the SDA
252
253 -msdata=foo - specifies how such variables are handled
254
255 -msdata=none - small data area is disabled
256
257 -msdata=sdata - small data goes in the SDA, special code isn't
258 generated to use it, and special relocs aren't
259 generated
260
261 -msdata=use - small data goes in the SDA, special code is generated
262 to use the SDA and special relocs are generated
263
264 The SDA is not multilib'd, it isn't necessary.
265 MULTILIB_EXTRA_OPTS is set in tmake_file to -msdata=sdata so multilib'd
266 libraries have small data in .sdata/SHN_M32R_SCOMMON so programs that use
267 -msdata=use will successfully link with them (references in header files
268 will cause the compiler to emit code that refers to library objects in
269 .data). ??? There can be a problem if the user passes a -G value greater
270 than the default and a library object in a header file is that size.
271 The default is 8 so this should be rare - if it occurs the user
272 is required to rebuild the libraries or use a smaller value for -G. */
273
274 /* Maximum size of variables that go in .sdata/.sbss.
275 The -msdata=foo switch also controls how small variables are handled. */
276 #ifndef SDATA_DEFAULT_SIZE
277 #define SDATA_DEFAULT_SIZE 8
278 #endif
279
280 enum m32r_sdata { M32R_SDATA_NONE, M32R_SDATA_SDATA, M32R_SDATA_USE };
281
282 extern enum m32r_sdata m32r_sdata;
283 #define TARGET_SDATA_NONE (m32r_sdata == M32R_SDATA_NONE)
284 #define TARGET_SDATA_SDATA (m32r_sdata == M32R_SDATA_SDATA)
285 #define TARGET_SDATA_USE (m32r_sdata == M32R_SDATA_USE)
286
287 /* Default is to disable the SDA
288 [for upward compatibility with previous toolchains]. */
289 #ifndef M32R_SDATA_DEFAULT
290 #define M32R_SDATA_DEFAULT M32R_SDATA_NONE
291 #endif
292
293 /* Define this macro as a C expression for the initializer of an array of
294 strings to tell the driver program which options are defaults for this
295 target and thus do not need to be handled specially when using
296 `MULTILIB_OPTIONS'. */
297 #ifndef SUBTARGET_MULTILIB_DEFAULTS
298 #define SUBTARGET_MULTILIB_DEFAULTS
299 #endif
300
301 #ifndef MULTILIB_DEFAULTS
302 #define MULTILIB_DEFAULTS { "mmodel=small" SUBTARGET_MULTILIB_DEFAULTS }
303 #endif
304
305 #ifndef SUBTARGET_OVERRIDE_OPTIONS
306 #define SUBTARGET_OVERRIDE_OPTIONS
307 #endif
308
309 #ifndef SUBTARGET_OPTIMIZATION_OPTIONS
310 #define SUBTARGET_OPTIMIZATION_OPTIONS
311 #endif
312
313 #define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \
314 do \
315 { \
316 if (LEVEL == 1) \
317 flag_regmove = TRUE; \
318 \
319 if (SIZE) \
320 { \
321 flag_omit_frame_pointer = TRUE; \
322 } \
323 \
324 SUBTARGET_OPTIMIZATION_OPTIONS \
325 } \
326 while (0)
327
328 /* Define this macro if debugging can be performed even without a
329 frame pointer. If this macro is defined, GCC will turn on the
330 `-fomit-frame-pointer' option whenever `-O' is specified. */
331 #define CAN_DEBUG_WITHOUT_FP
332 \f
333 /* Target machine storage layout. */
334
335 /* Define this if most significant bit is lowest numbered
336 in instructions that operate on numbered bit-fields. */
337 #define BITS_BIG_ENDIAN 1
338
339 /* Define this if most significant byte of a word is the lowest numbered. */
340 #define BYTES_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0)
341
342 /* Define this if most significant word of a multiword number is the lowest
343 numbered. */
344 #define WORDS_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0)
345
346 /* Define this macro if WORDS_BIG_ENDIAN is not constant. This must
347 be a constant value with the same meaning as WORDS_BIG_ENDIAN,
348 which will be used only when compiling libgcc2.c. Typically the
349 value will be set based on preprocessor defines. */
350 /*#define LIBGCC2_WORDS_BIG_ENDIAN 1*/
351
352 /* Width of a word, in units (bytes). */
353 #define UNITS_PER_WORD 4
354
355 /* Define this macro if it is advisable to hold scalars in registers
356 in a wider mode than that declared by the program. In such cases,
357 the value is constrained to be within the bounds of the declared
358 type, but kept valid in the wider mode. The signedness of the
359 extension may differ from that of the type. */
360 #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
361 if (GET_MODE_CLASS (MODE) == MODE_INT \
362 && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
363 { \
364 (MODE) = SImode; \
365 }
366
367 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
368 #define PARM_BOUNDARY 32
369
370 /* Boundary (in *bits*) on which stack pointer should be aligned. */
371 #define STACK_BOUNDARY 32
372
373 /* ALIGN FRAMES on word boundaries */
374 #define M32R_STACK_ALIGN(LOC) (((LOC) + 3) & ~ 3)
375
376 /* Allocation boundary (in *bits*) for the code of a function. */
377 #define FUNCTION_BOUNDARY 32
378
379 /* Alignment of field after `int : 0' in a structure. */
380 #define EMPTY_FIELD_BOUNDARY 32
381
382 /* Every structure's size must be a multiple of this. */
383 #define STRUCTURE_SIZE_BOUNDARY 8
384
385 /* A bit-field declared as `int' forces `int' alignment for the struct. */
386 #define PCC_BITFIELD_TYPE_MATTERS 1
387
388 /* No data type wants to be aligned rounder than this. */
389 #define BIGGEST_ALIGNMENT 32
390
391 /* The best alignment to use in cases where we have a choice. */
392 #define FASTEST_ALIGNMENT 32
393
394 /* Make strings word-aligned so strcpy from constants will be faster. */
395 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
396 ((TREE_CODE (EXP) == STRING_CST \
397 && (ALIGN) < FASTEST_ALIGNMENT) \
398 ? FASTEST_ALIGNMENT : (ALIGN))
399
400 /* Make arrays of chars word-aligned for the same reasons. */
401 #define DATA_ALIGNMENT(TYPE, ALIGN) \
402 (TREE_CODE (TYPE) == ARRAY_TYPE \
403 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
404 && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
405
406 /* Set this nonzero if move instructions will actually fail to work
407 when given unaligned data. */
408 #define STRICT_ALIGNMENT 1
409
410 /* Define LAVEL_ALIGN to calculate code length of PNOP at labels. */
411 #define LABEL_ALIGN(insn) 2
412 \f
413 /* Layout of source language data types. */
414
415 #define SHORT_TYPE_SIZE 16
416 #define INT_TYPE_SIZE 32
417 #define LONG_TYPE_SIZE 32
418 #define LONG_LONG_TYPE_SIZE 64
419 #define FLOAT_TYPE_SIZE 32
420 #define DOUBLE_TYPE_SIZE 64
421 #define LONG_DOUBLE_TYPE_SIZE 64
422
423 /* Define this as 1 if `char' should by default be signed; else as 0. */
424 #define DEFAULT_SIGNED_CHAR 1
425
426 #define SIZE_TYPE "long unsigned int"
427 #define PTRDIFF_TYPE "long int"
428 #define WCHAR_TYPE "short unsigned int"
429 #define WCHAR_TYPE_SIZE 16
430 \f
431 /* Standard register usage. */
432
433 /* Number of actual hardware registers.
434 The hardware registers are assigned numbers for the compiler
435 from 0 to just below FIRST_PSEUDO_REGISTER.
436 All registers that the compiler knows about must be given numbers,
437 even those that are not normally considered general registers. */
438
439 #define M32R_NUM_REGISTERS 19
440
441 #ifndef SUBTARGET_NUM_REGISTERS
442 #define SUBTARGET_NUM_REGISTERS 0
443 #endif
444
445 #define FIRST_PSEUDO_REGISTER (M32R_NUM_REGISTERS + SUBTARGET_NUM_REGISTERS)
446
447 /* 1 for registers that have pervasive standard uses
448 and are not available for the register allocator.
449
450 0-3 - arguments/results
451 4-5 - call used [4 is used as a tmp during prologue/epilogue generation]
452 6 - call used, gptmp
453 7 - call used, static chain pointer
454 8-11 - call saved
455 12 - call saved [reserved for global pointer]
456 13 - frame pointer
457 14 - subroutine link register
458 15 - stack pointer
459 16 - arg pointer
460 17 - carry flag
461 18 - accumulator
462 19 - accumulator 1 in the m32r/x
463 By default, the extension registers are not available. */
464
465 #ifndef SUBTARGET_FIXED_REGISTERS
466 #define SUBTARGET_FIXED_REGISTERS
467 #endif
468
469 #define FIXED_REGISTERS \
470 { \
471 0, 0, 0, 0, 0, 0, 0, 0, \
472 0, 0, 0, 0, 0, 0, 0, 1, \
473 1, 1, 1 \
474 SUBTARGET_FIXED_REGISTERS \
475 }
476
477 /* 1 for registers not available across function calls.
478 These must include the FIXED_REGISTERS and also any
479 registers that can be used without being saved.
480 The latter must include the registers where values are returned
481 and the register where structure-value addresses are passed.
482 Aside from that, you can include as many other registers as you like. */
483
484 #ifndef SUBTARGET_CALL_USED_REGISTERS
485 #define SUBTARGET_CALL_USED_REGISTERS
486 #endif
487
488 #define CALL_USED_REGISTERS \
489 { \
490 1, 1, 1, 1, 1, 1, 1, 1, \
491 0, 0, 0, 0, 0, 0, 1, 1, \
492 1, 1, 1 \
493 SUBTARGET_CALL_USED_REGISTERS \
494 }
495
496 #define CALL_REALLY_USED_REGISTERS CALL_USED_REGISTERS
497
498 /* Zero or more C statements that may conditionally modify two variables
499 `fixed_regs' and `call_used_regs' (both of type `char []') after they
500 have been initialized from the two preceding macros.
501
502 This is necessary in case the fixed or call-clobbered registers depend
503 on target flags.
504
505 You need not define this macro if it has no work to do. */
506
507 #ifdef SUBTARGET_CONDITIONAL_REGISTER_USAGE
508 #define CONDITIONAL_REGISTER_USAGE SUBTARGET_CONDITIONAL_REGISTER_USAGE
509 #else
510 #define CONDITIONAL_REGISTER_USAGE \
511 do \
512 { \
513 if (flag_pic) \
514 { \
515 fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
516 call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
517 } \
518 } \
519 while (0)
520 #endif
521
522 /* If defined, an initializer for a vector of integers, containing the
523 numbers of hard registers in the order in which GCC should
524 prefer to use them (from most preferred to least). */
525
526 #ifndef SUBTARGET_REG_ALLOC_ORDER
527 #define SUBTARGET_REG_ALLOC_ORDER
528 #endif
529
530 #if 1 /* Better for int code. */
531 #define REG_ALLOC_ORDER \
532 { \
533 4, 5, 6, 7, 2, 3, 8, 9, 10, \
534 11, 12, 13, 14, 0, 1, 15, 16, 17, 18 \
535 SUBTARGET_REG_ALLOC_ORDER \
536 }
537
538 #else /* Better for fp code at expense of int code. */
539 #define REG_ALLOC_ORDER \
540 { \
541 0, 1, 2, 3, 4, 5, 6, 7, 8, \
542 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 \
543 SUBTARGET_REG_ALLOC_ORDER \
544 }
545 #endif
546
547 /* Return number of consecutive hard regs needed starting at reg REGNO
548 to hold something of mode MODE.
549 This is ordinarily the length in words of a value of mode MODE
550 but can be less for certain modes in special long registers. */
551 #define HARD_REGNO_NREGS(REGNO, MODE) \
552 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
553
554 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
555 extern const unsigned int m32r_hard_regno_mode_ok[FIRST_PSEUDO_REGISTER];
556 extern unsigned int m32r_mode_class[];
557 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
558 ((m32r_hard_regno_mode_ok[REGNO] & m32r_mode_class[MODE]) != 0)
559
560 /* A C expression that is nonzero if it is desirable to choose
561 register allocation so as to avoid move instructions between a
562 value of mode MODE1 and a value of mode MODE2.
563
564 If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
565 MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1,
566 MODE2)' must be zero. */
567
568 /* Tie QI/HI/SI modes together. */
569 #define MODES_TIEABLE_P(MODE1, MODE2) \
570 ( GET_MODE_CLASS (MODE1) == MODE_INT \
571 && GET_MODE_CLASS (MODE2) == MODE_INT \
572 && GET_MODE_SIZE (MODE1) <= UNITS_PER_WORD \
573 && GET_MODE_SIZE (MODE2) <= UNITS_PER_WORD)
574
575 #define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \
576 m32r_hard_regno_rename_ok (OLD_REG, NEW_REG)
577 \f
578 /* Register classes and constants. */
579
580 /* Define the classes of registers for register constraints in the
581 machine description. Also define ranges of constants.
582
583 One of the classes must always be named ALL_REGS and include all hard regs.
584 If there is more than one class, another class must be named NO_REGS
585 and contain no registers.
586
587 The name GENERAL_REGS must be the name of a class (or an alias for
588 another name such as ALL_REGS). This is the class of registers
589 that is allowed by "g" or "r" in a register constraint.
590 Also, registers outside this class are allocated only when
591 instructions express preferences for them.
592
593 The classes must be numbered in nondecreasing order; that is,
594 a larger-numbered class must never be contained completely
595 in a smaller-numbered class.
596
597 For any two classes, it is very desirable that there be another
598 class that represents their union.
599
600 It is important that any condition codes have class NO_REGS.
601 See `register_operand'. */
602
603 enum reg_class
604 {
605 NO_REGS, CARRY_REG, ACCUM_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES
606 };
607
608 #define IRA_COVER_CLASSES \
609 { \
610 ACCUM_REGS, GENERAL_REGS, LIM_REG_CLASSES \
611 }
612
613 #define N_REG_CLASSES ((int) LIM_REG_CLASSES)
614
615 /* Give names of register classes as strings for dump file. */
616 #define REG_CLASS_NAMES \
617 { "NO_REGS", "CARRY_REG", "ACCUM_REGS", "GENERAL_REGS", "ALL_REGS" }
618
619 /* Define which registers fit in which classes.
620 This is an initializer for a vector of HARD_REG_SET
621 of length N_REG_CLASSES. */
622
623 #ifndef SUBTARGET_REG_CLASS_CARRY
624 #define SUBTARGET_REG_CLASS_CARRY 0
625 #endif
626
627 #ifndef SUBTARGET_REG_CLASS_ACCUM
628 #define SUBTARGET_REG_CLASS_ACCUM 0
629 #endif
630
631 #ifndef SUBTARGET_REG_CLASS_GENERAL
632 #define SUBTARGET_REG_CLASS_GENERAL 0
633 #endif
634
635 #ifndef SUBTARGET_REG_CLASS_ALL
636 #define SUBTARGET_REG_CLASS_ALL 0
637 #endif
638
639 #define REG_CLASS_CONTENTS \
640 { \
641 { 0x00000 }, \
642 { 0x20000 | SUBTARGET_REG_CLASS_CARRY }, \
643 { 0x40000 | SUBTARGET_REG_CLASS_ACCUM }, \
644 { 0x1ffff | SUBTARGET_REG_CLASS_GENERAL }, \
645 { 0x7ffff | SUBTARGET_REG_CLASS_ALL }, \
646 }
647
648 /* The same information, inverted:
649 Return the class number of the smallest class containing
650 reg number REGNO. This could be a conditional expression
651 or could index an array. */
652 extern enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER];
653 #define REGNO_REG_CLASS(REGNO) (m32r_regno_reg_class[REGNO])
654
655 /* The class value for index registers, and the one for base regs. */
656 #define INDEX_REG_CLASS GENERAL_REGS
657 #define BASE_REG_CLASS GENERAL_REGS
658
659 /* These assume that REGNO is a hard or pseudo reg number.
660 They give nonzero only if REGNO is a hard reg of the suitable class
661 or a pseudo reg currently allocated to a suitable hard reg.
662 Since they use reg_renumber, they are safe only once reg_renumber
663 has been allocated, which happens in local-alloc.c. */
664 #define REGNO_OK_FOR_BASE_P(REGNO) \
665 ((REGNO) < FIRST_PSEUDO_REGISTER \
666 ? GPR_P (REGNO) || (REGNO) == ARG_POINTER_REGNUM \
667 : GPR_P (reg_renumber[REGNO]))
668
669 #define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_BASE_P(REGNO)
670
671 /* Given an rtx X being reloaded into a reg required to be
672 in class CLASS, return the class of reg to actually use.
673 In general this is just CLASS; but on some machines
674 in some cases it is preferable to use a more restrictive class. */
675 #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
676
677 /* Return the maximum number of consecutive registers
678 needed to represent mode MODE in a register of class CLASS. */
679 #define CLASS_MAX_NREGS(CLASS, MODE) \
680 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
681
682 /* Return true if a value is inside a range. */
683 #define IN_RANGE_P(VALUE, LOW, HIGH) \
684 (((unsigned HOST_WIDE_INT)((VALUE) - (LOW))) \
685 <= ((unsigned HOST_WIDE_INT)((HIGH) - (LOW))))
686
687 /* Some range macros. */
688 #define INT16_P(X) ((X) >= - 0x8000 && (X) <= 0x7fff)
689 #define CMP_INT16_P(X) ((X) >= - 0x7fff && (X) <= 0x8000)
690 #define UINT16_P(X) (((unsigned HOST_WIDE_INT) (X)) <= 0x0000ffff)
691 #define UINT24_P(X) (((unsigned HOST_WIDE_INT) (X)) <= 0x00ffffff)
692 \f
693 /* Stack layout and stack pointer usage. */
694
695 /* Define this macro if pushing a word onto the stack moves the stack
696 pointer to a smaller address. */
697 #define STACK_GROWS_DOWNWARD
698
699 /* Offset from frame pointer to start allocating local variables at.
700 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
701 first local allocated. Otherwise, it is the offset to the BEGINNING
702 of the first local allocated. */
703 /* The frame pointer points at the same place as the stack pointer, except if
704 alloca has been called. */
705 #define STARTING_FRAME_OFFSET \
706 M32R_STACK_ALIGN (crtl->outgoing_args_size)
707
708 /* Offset from the stack pointer register to the first location at which
709 outgoing arguments are placed. */
710 #define STACK_POINTER_OFFSET 0
711
712 /* Offset of first parameter from the argument pointer register value. */
713 #define FIRST_PARM_OFFSET(FNDECL) 0
714
715 /* Register to use for pushing function arguments. */
716 #define STACK_POINTER_REGNUM 15
717
718 /* Base register for access to local variables of the function. */
719 #define FRAME_POINTER_REGNUM 13
720
721 /* Base register for access to arguments of the function. */
722 #define ARG_POINTER_REGNUM 16
723
724 /* Register in which static-chain is passed to a function.
725 This must not be a register used by the prologue. */
726 #define STATIC_CHAIN_REGNUM 7
727
728 /* These aren't official macros. */
729 #define PROLOGUE_TMP_REGNUM 4
730 #define RETURN_ADDR_REGNUM 14
731 /* #define GP_REGNUM 12 */
732 #define CARRY_REGNUM 17
733 #define ACCUM_REGNUM 18
734 #define M32R_MAX_INT_REGS 16
735
736 #ifndef SUBTARGET_GPR_P
737 #define SUBTARGET_GPR_P(REGNO) 0
738 #endif
739
740 #ifndef SUBTARGET_ACCUM_P
741 #define SUBTARGET_ACCUM_P(REGNO) 0
742 #endif
743
744 #ifndef SUBTARGET_CARRY_P
745 #define SUBTARGET_CARRY_P(REGNO) 0
746 #endif
747
748 #define GPR_P(REGNO) (IN_RANGE_P ((REGNO), 0, 15) || SUBTARGET_GPR_P (REGNO))
749 #define ACCUM_P(REGNO) ((REGNO) == ACCUM_REGNUM || SUBTARGET_ACCUM_P (REGNO))
750 #define CARRY_P(REGNO) ((REGNO) == CARRY_REGNUM || SUBTARGET_CARRY_P (REGNO))
751 \f
752 /* Eliminating the frame and arg pointers. */
753
754 #if 0
755 /* C statement to store the difference between the frame pointer
756 and the stack pointer values immediately after the function prologue.
757 If `ELIMINABLE_REGS' is defined, this macro will be not be used and
758 need not be defined. */
759 #define INITIAL_FRAME_POINTER_OFFSET(VAR) \
760 ((VAR) = m32r_compute_frame_size (get_frame_size ()))
761 #endif
762
763 /* If defined, this macro specifies a table of register pairs used to
764 eliminate unneeded registers that point into the stack frame. If
765 it is not defined, the only elimination attempted by the compiler
766 is to replace references to the frame pointer with references to
767 the stack pointer.
768
769 Note that the elimination of the argument pointer with the stack
770 pointer is specified first since that is the preferred elimination. */
771
772 #define ELIMINABLE_REGS \
773 {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
774 { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
775 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }}
776
777 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
778 specifies the initial difference between the specified pair of
779 registers. This macro must be defined if `ELIMINABLE_REGS' is
780 defined. */
781
782 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
783 do \
784 { \
785 int size = m32r_compute_frame_size (get_frame_size ()); \
786 \
787 if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
788 (OFFSET) = 0; \
789 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
790 (OFFSET) = size - crtl->args.pretend_args_size; \
791 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
792 (OFFSET) = size - crtl->args.pretend_args_size; \
793 else \
794 gcc_unreachable (); \
795 } \
796 while (0)
797 \f
798 /* Function argument passing. */
799
800 /* If defined, the maximum amount of space required for outgoing
801 arguments will be computed and placed into the variable
802 `crtl->outgoing_args_size'. No space will be pushed
803 onto the stack for each call; instead, the function prologue should
804 increase the stack frame size by this amount. */
805 #define ACCUMULATE_OUTGOING_ARGS 1
806
807 /* Define a data type for recording info about an argument list
808 during the scan of that argument list. This data type should
809 hold all necessary information about the function itself
810 and about the args processed so far, enough to enable macros
811 such as FUNCTION_ARG to determine where the next arg should go. */
812 #define CUMULATIVE_ARGS int
813
814 /* Initialize a variable CUM of type CUMULATIVE_ARGS
815 for a call to a function whose data type is FNTYPE.
816 For a library call, FNTYPE is 0. */
817 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
818 ((CUM) = 0)
819
820 /* The number of registers used for parameter passing. Local to this file. */
821 #define M32R_MAX_PARM_REGS 4
822
823 /* 1 if N is a possible register number for function argument passing. */
824 #define FUNCTION_ARG_REGNO_P(N) \
825 ((unsigned) (N) < M32R_MAX_PARM_REGS)
826
827 /* If defined, a C expression that gives the alignment boundary, in bits,
828 of an argument with the specified mode and type. If it is not defined,
829 PARM_BOUNDARY is used for all arguments. */
830 #if 0
831 /* We assume PARM_BOUNDARY == UNITS_PER_WORD here. */
832 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
833 (((TYPE) ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) <= PARM_BOUNDARY \
834 ? PARM_BOUNDARY : 2 * PARM_BOUNDARY)
835 #endif
836 \f
837 /* Function results. */
838
839 /* Tell GCC to use TARGET_RETURN_IN_MEMORY. */
840 #define DEFAULT_PCC_STRUCT_RETURN 0
841 \f
842 /* Function entry and exit. */
843
844 /* Initialize data used by insn expanders. This is called from
845 init_emit, once for each function, before code is generated. */
846 #define INIT_EXPANDERS m32r_init_expanders ()
847
848 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
849 the stack pointer does not matter. The value is tested only in
850 functions that have frame pointers.
851 No definition is equivalent to always zero. */
852 #define EXIT_IGNORE_STACK 1
853
854 /* Output assembler code to FILE to increment profiler label # LABELNO
855 for profiling a function entry. */
856 #undef FUNCTION_PROFILER
857 #define FUNCTION_PROFILER(FILE, LABELNO) \
858 do \
859 { \
860 if (flag_pic) \
861 { \
862 fprintf (FILE, "\tld24 r14,#mcount\n"); \
863 fprintf (FILE, "\tadd r14,r12\n"); \
864 fprintf (FILE, "\tld r14,@r14\n"); \
865 fprintf (FILE, "\tjl r14\n"); \
866 } \
867 else \
868 { \
869 if (TARGET_ADDR24) \
870 fprintf (FILE, "\tbl mcount\n"); \
871 else \
872 { \
873 fprintf (FILE, "\tseth r14,#high(mcount)\n"); \
874 fprintf (FILE, "\tor3 r14,r14,#low(mcount)\n"); \
875 fprintf (FILE, "\tjl r14\n"); \
876 } \
877 } \
878 fprintf (FILE, "\taddi sp,#4\n"); \
879 } \
880 while (0)
881 \f
882 /* Trampolines. */
883
884 /* On the M32R, the trampoline is:
885
886 mv r7, lr -> bl L1 ; 178e 7e01
887 L1: add3 r6, lr, #L2-L1 ; 86ae 000c (L2 - L1 = 12)
888 mv lr, r7 -> ld r7,@r6+ ; 1e87 27e6
889 ld r6, @r6 -> jmp r6 ; 26c6 1fc6
890 L2: .word STATIC
891 .word FUNCTION */
892
893 #ifndef CACHE_FLUSH_FUNC
894 #define CACHE_FLUSH_FUNC "_flush_cache"
895 #endif
896 #ifndef CACHE_FLUSH_TRAP
897 #define CACHE_FLUSH_TRAP 12
898 #endif
899
900 /* Length in bytes of the trampoline for entering a nested function. */
901 #define TRAMPOLINE_SIZE 24
902
903 \f
904 #define RETURN_ADDR_RTX(COUNT, FRAME) m32r_return_addr (COUNT)
905
906 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM)
907
908 /* Addressing modes, and classification of registers for them. */
909
910 /* Maximum number of registers that can appear in a valid memory address. */
911 #define MAX_REGS_PER_ADDRESS 1
912
913 /* We have post-inc load and pre-dec,pre-inc store,
914 but only for 4 byte vals. */
915 #define HAVE_PRE_DECREMENT 1
916 #define HAVE_PRE_INCREMENT 1
917 #define HAVE_POST_INCREMENT 1
918
919 /* Recognize any constant value that is a valid address. */
920 #define CONSTANT_ADDRESS_P(X) \
921 ( GET_CODE (X) == LABEL_REF \
922 || GET_CODE (X) == SYMBOL_REF \
923 || CONST_INT_P (X) \
924 || (GET_CODE (X) == CONST \
925 && ! (flag_pic && ! m32r_legitimate_pic_operand_p (X))))
926
927 /* Nonzero if the constant value X is a legitimate general operand.
928 We don't allow (plus symbol large-constant) as the relocations can't
929 describe it. INTVAL > 32767 handles both 16-bit and 24-bit relocations.
930 We allow all CONST_DOUBLE's as the md file patterns will force the
931 constant to memory if they can't handle them. */
932
933 #define LEGITIMATE_CONSTANT_P(X) \
934 (! (GET_CODE (X) == CONST \
935 && GET_CODE (XEXP (X, 0)) == PLUS \
936 && (GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF || GET_CODE (XEXP (XEXP (X, 0), 0)) == LABEL_REF) \
937 && CONST_INT_P (XEXP (XEXP (X, 0), 1)) \
938 && (unsigned HOST_WIDE_INT) INTVAL (XEXP (XEXP (X, 0), 1)) > 32767))
939
940 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
941 and check its validity for a certain class.
942 We have two alternate definitions for each of them.
943 The usual definition accepts all pseudo regs; the other rejects
944 them unless they have been allocated suitable hard regs.
945 The symbol REG_OK_STRICT causes the latter definition to be used.
946
947 Most source files want to accept pseudo regs in the hope that
948 they will get allocated to the class that the insn wants them to be in.
949 Source files for reload pass need to be strict.
950 After reload, it makes no difference, since pseudo regs have
951 been eliminated by then. */
952
953 #ifdef REG_OK_STRICT
954
955 /* Nonzero if X is a hard reg that can be used as a base reg. */
956 #define REG_OK_FOR_BASE_P(X) GPR_P (REGNO (X))
957 /* Nonzero if X is a hard reg that can be used as an index. */
958 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
959
960 #else
961
962 /* Nonzero if X is a hard reg that can be used as a base reg
963 or if it is a pseudo reg. */
964 #define REG_OK_FOR_BASE_P(X) \
965 (GPR_P (REGNO (X)) \
966 || (REGNO (X)) == ARG_POINTER_REGNUM \
967 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
968 /* Nonzero if X is a hard reg that can be used as an index
969 or if it is a pseudo reg. */
970 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
971
972 #endif
973
974 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
975 that is a valid memory address for an instruction.
976 The MODE argument is the machine mode for the MEM expression
977 that wants to use this address. */
978
979 /* Local to this file. */
980 #define RTX_OK_FOR_BASE_P(X) (REG_P (X) && REG_OK_FOR_BASE_P (X))
981
982 /* Local to this file. */
983 #define RTX_OK_FOR_OFFSET_P(X) \
984 (CONST_INT_P (X) && INT16_P (INTVAL (X)))
985
986 /* Local to this file. */
987 #define LEGITIMATE_OFFSET_ADDRESS_P(MODE, X) \
988 (GET_CODE (X) == PLUS \
989 && RTX_OK_FOR_BASE_P (XEXP (X, 0)) \
990 && RTX_OK_FOR_OFFSET_P (XEXP (X, 1)))
991
992 /* Local to this file. */
993 /* For LO_SUM addresses, do not allow them if the MODE is > 1 word,
994 since more than one instruction will be required. */
995 #define LEGITIMATE_LO_SUM_ADDRESS_P(MODE, X) \
996 (GET_CODE (X) == LO_SUM \
997 && (MODE != BLKmode && GET_MODE_SIZE (MODE) <= UNITS_PER_WORD)\
998 && RTX_OK_FOR_BASE_P (XEXP (X, 0)) \
999 && CONSTANT_P (XEXP (X, 1)))
1000
1001 /* Local to this file. */
1002 /* Is this a load and increment operation. */
1003 #define LOAD_POSTINC_P(MODE, X) \
1004 (((MODE) == SImode || (MODE) == SFmode) \
1005 && GET_CODE (X) == POST_INC \
1006 && REG_P (XEXP (X, 0)) \
1007 && RTX_OK_FOR_BASE_P (XEXP (X, 0)))
1008
1009 /* Local to this file. */
1010 /* Is this an increment/decrement and store operation. */
1011 #define STORE_PREINC_PREDEC_P(MODE, X) \
1012 (((MODE) == SImode || (MODE) == SFmode) \
1013 && (GET_CODE (X) == PRE_INC || GET_CODE (X) == PRE_DEC) \
1014 && REG_P (XEXP (X, 0)) \
1015 && RTX_OK_FOR_BASE_P (XEXP (X, 0)))
1016
1017 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1018 do \
1019 { \
1020 if (RTX_OK_FOR_BASE_P (X)) \
1021 goto ADDR; \
1022 if (LEGITIMATE_OFFSET_ADDRESS_P ((MODE), (X))) \
1023 goto ADDR; \
1024 if (LEGITIMATE_LO_SUM_ADDRESS_P ((MODE), (X))) \
1025 goto ADDR; \
1026 if (LOAD_POSTINC_P ((MODE), (X))) \
1027 goto ADDR; \
1028 if (STORE_PREINC_PREDEC_P ((MODE), (X))) \
1029 goto ADDR; \
1030 } \
1031 while (0)
1032 \f
1033 /* Condition code usage. */
1034
1035 /* Return nonzero if SELECT_CC_MODE will never return MODE for a
1036 floating point inequality comparison. */
1037 #define REVERSIBLE_CC_MODE(MODE) 1 /*???*/
1038 \f
1039 /* Costs. */
1040
1041 /* The cost of a branch insn. */
1042 /* A value of 2 here causes GCC to avoid using branches in comparisons like
1043 while (a < N && a). Branches aren't that expensive on the M32R so
1044 we define this as 1. Defining it as 2 had a heavy hit in fp-bit.c. */
1045 #define BRANCH_COST(speed_p, predictable_p) ((TARGET_BRANCH_COST) ? 2 : 1)
1046
1047 /* Nonzero if access to memory by bytes is slow and undesirable.
1048 For RISC chips, it means that access to memory by bytes is no
1049 better than access by words when possible, so grab a whole word
1050 and maybe make use of that. */
1051 #define SLOW_BYTE_ACCESS 1
1052
1053 /* Define this macro if it is as good or better to call a constant
1054 function address than to call an address kept in a register. */
1055 #define NO_FUNCTION_CSE
1056 \f
1057 /* Section selection. */
1058
1059 #define TEXT_SECTION_ASM_OP "\t.section .text"
1060 #define DATA_SECTION_ASM_OP "\t.section .data"
1061 #define BSS_SECTION_ASM_OP "\t.section .bss"
1062
1063 /* Define this macro if jump tables (for tablejump insns) should be
1064 output in the text section, along with the assembler instructions.
1065 Otherwise, the readonly data section is used.
1066 This macro is irrelevant if there is no separate readonly data section. */
1067 #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
1068 \f
1069 /* Position Independent Code. */
1070
1071 /* The register number of the register used to address a table of static
1072 data addresses in memory. In some cases this register is defined by a
1073 processor's ``application binary interface'' (ABI). When this macro
1074 is defined, RTL is generated for this register once, as with the stack
1075 pointer and frame pointer registers. If this macro is not defined, it
1076 is up to the machine-dependent files to allocate such a register (if
1077 necessary). */
1078 #define PIC_OFFSET_TABLE_REGNUM 12
1079
1080 /* Define this macro if the register defined by PIC_OFFSET_TABLE_REGNUM is
1081 clobbered by calls. Do not define this macro if PIC_OFFSET_TABLE_REGNUM
1082 is not defined. */
1083 /* This register is call-saved on the M32R. */
1084 /*#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED*/
1085
1086 /* A C expression that is nonzero if X is a legitimate immediate
1087 operand on the target machine when generating position independent code.
1088 You can assume that X satisfies CONSTANT_P, so you need not
1089 check this. You can also assume `flag_pic' is true, so you need not
1090 check it either. You need not define this macro if all constants
1091 (including SYMBOL_REF) can be immediate operands when generating
1092 position independent code. */
1093 #define LEGITIMATE_PIC_OPERAND_P(X) m32r_legitimate_pic_operand_p (X)
1094 \f
1095 /* Control the assembler format that we output. */
1096
1097 /* A C string constant describing how to begin a comment in the target
1098 assembler language. The compiler assumes that the comment will
1099 end at the end of the line. */
1100 #define ASM_COMMENT_START ";"
1101
1102 /* Output to assembler file text saying following lines
1103 may contain character constants, extra white space, comments, etc. */
1104 #define ASM_APP_ON ""
1105
1106 /* Output to assembler file text saying following lines
1107 no longer contain unusual constructs. */
1108 #define ASM_APP_OFF ""
1109
1110 /* Globalizing directive for a label. */
1111 #define GLOBAL_ASM_OP "\t.global\t"
1112
1113 /* We do not use DBX_LINES_FUNCTION_RELATIVE or
1114 dbxout_stab_value_internal_label_diff here because
1115 we need to use .debugsym for the line label. */
1116
1117 #define DBX_OUTPUT_SOURCE_LINE(file, line, counter) \
1118 do \
1119 { \
1120 const char * begin_label = \
1121 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0); \
1122 char label[64]; \
1123 ASM_GENERATE_INTERNAL_LABEL (label, "LM", counter); \
1124 \
1125 dbxout_begin_stabn_sline (line); \
1126 assemble_name (file, label); \
1127 putc ('-', file); \
1128 assemble_name (file, begin_label); \
1129 fputs ("\n\t.debugsym ", file); \
1130 assemble_name (file, label); \
1131 putc ('\n', file); \
1132 counter += 1; \
1133 } \
1134 while (0)
1135
1136 /* How to refer to registers in assembler output.
1137 This sequence is indexed by compiler's hard-register-number (see above). */
1138 #ifndef SUBTARGET_REGISTER_NAMES
1139 #define SUBTARGET_REGISTER_NAMES
1140 #endif
1141
1142 #define REGISTER_NAMES \
1143 { \
1144 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
1145 "r8", "r9", "r10", "r11", "r12", "fp", "lr", "sp", \
1146 "ap", "cbit", "a0" \
1147 SUBTARGET_REGISTER_NAMES \
1148 }
1149
1150 /* If defined, a C initializer for an array of structures containing
1151 a name and a register number. This macro defines additional names
1152 for hard registers, thus allowing the `asm' option in declarations
1153 to refer to registers using alternate names. */
1154 #ifndef SUBTARGET_ADDITIONAL_REGISTER_NAMES
1155 #define SUBTARGET_ADDITIONAL_REGISTER_NAMES
1156 #endif
1157
1158 #define ADDITIONAL_REGISTER_NAMES \
1159 { \
1160 /*{ "gp", GP_REGNUM },*/ \
1161 { "r13", FRAME_POINTER_REGNUM }, \
1162 { "r14", RETURN_ADDR_REGNUM }, \
1163 { "r15", STACK_POINTER_REGNUM }, \
1164 SUBTARGET_ADDITIONAL_REGISTER_NAMES \
1165 }
1166
1167 /* If defined, C string expressions to be used for the `%R', `%L',
1168 `%U', and `%I' options of `asm_fprintf' (see `final.c'). These
1169 are useful when a single `md' file must support multiple assembler
1170 formats. In that case, the various `tm.h' files can define these
1171 macros differently. */
1172 #define REGISTER_PREFIX ""
1173 #define LOCAL_LABEL_PREFIX ".L"
1174 #define USER_LABEL_PREFIX ""
1175 #define IMMEDIATE_PREFIX "#"
1176
1177 /* This is how to output an element of a case-vector that is absolute. */
1178 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1179 do \
1180 { \
1181 char label[30]; \
1182 ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
1183 fprintf (FILE, "\t.word\t"); \
1184 assemble_name (FILE, label); \
1185 fprintf (FILE, "\n"); \
1186 } \
1187 while (0)
1188
1189 /* This is how to output an element of a case-vector that is relative. */
1190 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL)\
1191 do \
1192 { \
1193 char label[30]; \
1194 ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
1195 fprintf (FILE, "\t.word\t"); \
1196 assemble_name (FILE, label); \
1197 fprintf (FILE, "-"); \
1198 ASM_GENERATE_INTERNAL_LABEL (label, "L", REL); \
1199 assemble_name (FILE, label); \
1200 fprintf (FILE, "\n"); \
1201 } \
1202 while (0)
1203
1204 /* The desired alignment for the location counter at the beginning
1205 of a loop. */
1206 /* On the M32R, align loops to 32 byte boundaries (cache line size)
1207 if -malign-loops. */
1208 #define LOOP_ALIGN(LABEL) (TARGET_ALIGN_LOOPS ? 5 : 0)
1209
1210 /* Define this to be the maximum number of insns to move around when moving
1211 a loop test from the top of a loop to the bottom
1212 and seeing whether to duplicate it. The default is thirty.
1213
1214 Loop unrolling currently doesn't like this optimization, so
1215 disable doing if we are unrolling loops and saving space. */
1216 #define LOOP_TEST_THRESHOLD (optimize_size \
1217 && !flag_unroll_loops \
1218 && !flag_unroll_all_loops ? 2 : 30)
1219
1220 /* This is how to output an assembler line
1221 that says to advance the location counter
1222 to a multiple of 2**LOG bytes. */
1223 /* .balign is used to avoid confusion. */
1224 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1225 do \
1226 { \
1227 if ((LOG) != 0) \
1228 fprintf (FILE, "\t.balign %d\n", 1 << (LOG)); \
1229 } \
1230 while (0)
1231
1232 /* Like `ASM_OUTPUT_COMMON' except takes the required alignment as a
1233 separate, explicit argument. If you define this macro, it is used in
1234 place of `ASM_OUTPUT_COMMON', and gives you more flexibility in
1235 handling the required alignment of the variable. The alignment is
1236 specified as the number of bits. */
1237
1238 #define SCOMMON_ASM_OP "\t.scomm\t"
1239
1240 #undef ASM_OUTPUT_ALIGNED_COMMON
1241 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
1242 do \
1243 { \
1244 if (! TARGET_SDATA_NONE \
1245 && (SIZE) > 0 && (SIZE) <= g_switch_value) \
1246 fprintf ((FILE), "%s", SCOMMON_ASM_OP); \
1247 else \
1248 fprintf ((FILE), "%s", COMMON_ASM_OP); \
1249 assemble_name ((FILE), (NAME)); \
1250 fprintf ((FILE), ",%u,%u\n", (int)(SIZE), (ALIGN) / BITS_PER_UNIT);\
1251 } \
1252 while (0)
1253
1254 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
1255 do \
1256 { \
1257 if (! TARGET_SDATA_NONE \
1258 && (SIZE) > 0 && (SIZE) <= g_switch_value) \
1259 switch_to_section (get_named_section (NULL, ".sbss", 0)); \
1260 else \
1261 switch_to_section (bss_section); \
1262 ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \
1263 last_assemble_variable_decl = DECL; \
1264 ASM_DECLARE_OBJECT_NAME (FILE, NAME, DECL); \
1265 ASM_OUTPUT_SKIP (FILE, SIZE ? SIZE : 1); \
1266 } \
1267 while (0)
1268 \f
1269 /* Debugging information. */
1270
1271 /* Generate DBX and DWARF debugging information. */
1272 #define DBX_DEBUGGING_INFO 1
1273 #define DWARF2_DEBUGGING_INFO 1
1274
1275 /* Use DWARF2 debugging info by default. */
1276 #undef PREFERRED_DEBUGGING_TYPE
1277 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
1278
1279 /* Turn off splitting of long stabs. */
1280 #define DBX_CONTIN_LENGTH 0
1281 \f
1282 /* Miscellaneous. */
1283
1284 /* Specify the machine mode that this machine uses
1285 for the index in the tablejump instruction. */
1286 #define CASE_VECTOR_MODE (flag_pic ? SImode : Pmode)
1287
1288 /* Define if operations between registers always perform the operation
1289 on the full register even if a narrower mode is specified. */
1290 #define WORD_REGISTER_OPERATIONS
1291
1292 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
1293 will either zero-extend or sign-extend. The value of this macro should
1294 be the code that says which one of the two operations is implicitly
1295 done, UNKNOWN if none. */
1296 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
1297
1298 /* Max number of bytes we can move from memory
1299 to memory in one reasonably fast instruction. */
1300 #define MOVE_MAX 4
1301
1302 /* Define this to be nonzero if shift instructions ignore all but the low-order
1303 few bits. */
1304 #define SHIFT_COUNT_TRUNCATED 1
1305
1306 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1307 is done just by pretending it is already truncated. */
1308 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1309
1310 /* Specify the machine mode that pointers have.
1311 After generation of rtl, the compiler makes no further distinction
1312 between pointers and any other objects of this machine mode. */
1313 /* ??? The M32R doesn't have full 32-bit pointers, but making this PSImode has
1314 its own problems (you have to add extendpsisi2 and truncsipsi2).
1315 Try to avoid it. */
1316 #define Pmode SImode
1317
1318 /* A function address in a call instruction. */
1319 #define FUNCTION_MODE SImode
1320 \f
1321 /* M32R function types. */
1322 enum m32r_function_type
1323 {
1324 M32R_FUNCTION_UNKNOWN, M32R_FUNCTION_NORMAL, M32R_FUNCTION_INTERRUPT
1325 };
1326
1327 #define M32R_INTERRUPT_P(TYPE) ((TYPE) == M32R_FUNCTION_INTERRUPT)
1328
1329 /* The maximum number of bytes to copy using pairs of load/store instructions.
1330 If a block is larger than this then a loop will be generated to copy
1331 MAX_MOVE_BYTES chunks at a time. The value of 32 is a semi-arbitrary choice.
1332 A customer uses Dhrystome as their benchmark, and Dhrystone has a 31 byte
1333 string copy in it. */
1334 #define MAX_MOVE_BYTES 32