]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/m32r/m32r.h
flags.h (g_switch_value, [...]): Remove.
[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 this macro if debugging can be performed even without a
314 frame pointer. If this macro is defined, GCC will turn on the
315 `-fomit-frame-pointer' option whenever `-O' is specified. */
316 #define CAN_DEBUG_WITHOUT_FP
317 \f
318 /* Target machine storage layout. */
319
320 /* Define this if most significant bit is lowest numbered
321 in instructions that operate on numbered bit-fields. */
322 #define BITS_BIG_ENDIAN 1
323
324 /* Define this if most significant byte of a word is the lowest numbered. */
325 #define BYTES_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0)
326
327 /* Define this if most significant word of a multiword number is the lowest
328 numbered. */
329 #define WORDS_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0)
330
331 /* Define this macro if WORDS_BIG_ENDIAN is not constant. This must
332 be a constant value with the same meaning as WORDS_BIG_ENDIAN,
333 which will be used only when compiling libgcc2.c. Typically the
334 value will be set based on preprocessor defines. */
335 /*#define LIBGCC2_WORDS_BIG_ENDIAN 1*/
336
337 /* Width of a word, in units (bytes). */
338 #define UNITS_PER_WORD 4
339
340 /* Define this macro if it is advisable to hold scalars in registers
341 in a wider mode than that declared by the program. In such cases,
342 the value is constrained to be within the bounds of the declared
343 type, but kept valid in the wider mode. The signedness of the
344 extension may differ from that of the type. */
345 #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
346 if (GET_MODE_CLASS (MODE) == MODE_INT \
347 && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
348 { \
349 (MODE) = SImode; \
350 }
351
352 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
353 #define PARM_BOUNDARY 32
354
355 /* Boundary (in *bits*) on which stack pointer should be aligned. */
356 #define STACK_BOUNDARY 32
357
358 /* ALIGN FRAMES on word boundaries */
359 #define M32R_STACK_ALIGN(LOC) (((LOC) + 3) & ~ 3)
360
361 /* Allocation boundary (in *bits*) for the code of a function. */
362 #define FUNCTION_BOUNDARY 32
363
364 /* Alignment of field after `int : 0' in a structure. */
365 #define EMPTY_FIELD_BOUNDARY 32
366
367 /* Every structure's size must be a multiple of this. */
368 #define STRUCTURE_SIZE_BOUNDARY 8
369
370 /* A bit-field declared as `int' forces `int' alignment for the struct. */
371 #define PCC_BITFIELD_TYPE_MATTERS 1
372
373 /* No data type wants to be aligned rounder than this. */
374 #define BIGGEST_ALIGNMENT 32
375
376 /* The best alignment to use in cases where we have a choice. */
377 #define FASTEST_ALIGNMENT 32
378
379 /* Make strings word-aligned so strcpy from constants will be faster. */
380 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
381 ((TREE_CODE (EXP) == STRING_CST \
382 && (ALIGN) < FASTEST_ALIGNMENT) \
383 ? FASTEST_ALIGNMENT : (ALIGN))
384
385 /* Make arrays of chars word-aligned for the same reasons. */
386 #define DATA_ALIGNMENT(TYPE, ALIGN) \
387 (TREE_CODE (TYPE) == ARRAY_TYPE \
388 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
389 && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
390
391 /* Set this nonzero if move instructions will actually fail to work
392 when given unaligned data. */
393 #define STRICT_ALIGNMENT 1
394
395 /* Define LAVEL_ALIGN to calculate code length of PNOP at labels. */
396 #define LABEL_ALIGN(insn) 2
397 \f
398 /* Layout of source language data types. */
399
400 #define SHORT_TYPE_SIZE 16
401 #define INT_TYPE_SIZE 32
402 #define LONG_TYPE_SIZE 32
403 #define LONG_LONG_TYPE_SIZE 64
404 #define FLOAT_TYPE_SIZE 32
405 #define DOUBLE_TYPE_SIZE 64
406 #define LONG_DOUBLE_TYPE_SIZE 64
407
408 /* Define this as 1 if `char' should by default be signed; else as 0. */
409 #define DEFAULT_SIGNED_CHAR 1
410
411 #define SIZE_TYPE "long unsigned int"
412 #define PTRDIFF_TYPE "long int"
413 #define WCHAR_TYPE "short unsigned int"
414 #define WCHAR_TYPE_SIZE 16
415 \f
416 /* Standard register usage. */
417
418 /* Number of actual hardware registers.
419 The hardware registers are assigned numbers for the compiler
420 from 0 to just below FIRST_PSEUDO_REGISTER.
421 All registers that the compiler knows about must be given numbers,
422 even those that are not normally considered general registers. */
423
424 #define M32R_NUM_REGISTERS 19
425
426 #ifndef SUBTARGET_NUM_REGISTERS
427 #define SUBTARGET_NUM_REGISTERS 0
428 #endif
429
430 #define FIRST_PSEUDO_REGISTER (M32R_NUM_REGISTERS + SUBTARGET_NUM_REGISTERS)
431
432 /* 1 for registers that have pervasive standard uses
433 and are not available for the register allocator.
434
435 0-3 - arguments/results
436 4-5 - call used [4 is used as a tmp during prologue/epilogue generation]
437 6 - call used, gptmp
438 7 - call used, static chain pointer
439 8-11 - call saved
440 12 - call saved [reserved for global pointer]
441 13 - frame pointer
442 14 - subroutine link register
443 15 - stack pointer
444 16 - arg pointer
445 17 - carry flag
446 18 - accumulator
447 19 - accumulator 1 in the m32r/x
448 By default, the extension registers are not available. */
449
450 #ifndef SUBTARGET_FIXED_REGISTERS
451 #define SUBTARGET_FIXED_REGISTERS
452 #endif
453
454 #define FIXED_REGISTERS \
455 { \
456 0, 0, 0, 0, 0, 0, 0, 0, \
457 0, 0, 0, 0, 0, 0, 0, 1, \
458 1, 1, 1 \
459 SUBTARGET_FIXED_REGISTERS \
460 }
461
462 /* 1 for registers not available across function calls.
463 These must include the FIXED_REGISTERS and also any
464 registers that can be used without being saved.
465 The latter must include the registers where values are returned
466 and the register where structure-value addresses are passed.
467 Aside from that, you can include as many other registers as you like. */
468
469 #ifndef SUBTARGET_CALL_USED_REGISTERS
470 #define SUBTARGET_CALL_USED_REGISTERS
471 #endif
472
473 #define CALL_USED_REGISTERS \
474 { \
475 1, 1, 1, 1, 1, 1, 1, 1, \
476 0, 0, 0, 0, 0, 0, 1, 1, \
477 1, 1, 1 \
478 SUBTARGET_CALL_USED_REGISTERS \
479 }
480
481 #define CALL_REALLY_USED_REGISTERS CALL_USED_REGISTERS
482
483 /* Zero or more C statements that may conditionally modify two variables
484 `fixed_regs' and `call_used_regs' (both of type `char []') after they
485 have been initialized from the two preceding macros.
486
487 This is necessary in case the fixed or call-clobbered registers depend
488 on target flags.
489
490 You need not define this macro if it has no work to do. */
491
492 #ifdef SUBTARGET_CONDITIONAL_REGISTER_USAGE
493 #define CONDITIONAL_REGISTER_USAGE SUBTARGET_CONDITIONAL_REGISTER_USAGE
494 #else
495 #define CONDITIONAL_REGISTER_USAGE \
496 do \
497 { \
498 if (flag_pic) \
499 { \
500 fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
501 call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
502 } \
503 } \
504 while (0)
505 #endif
506
507 /* If defined, an initializer for a vector of integers, containing the
508 numbers of hard registers in the order in which GCC should
509 prefer to use them (from most preferred to least). */
510
511 #ifndef SUBTARGET_REG_ALLOC_ORDER
512 #define SUBTARGET_REG_ALLOC_ORDER
513 #endif
514
515 #if 1 /* Better for int code. */
516 #define REG_ALLOC_ORDER \
517 { \
518 4, 5, 6, 7, 2, 3, 8, 9, 10, \
519 11, 12, 13, 14, 0, 1, 15, 16, 17, 18 \
520 SUBTARGET_REG_ALLOC_ORDER \
521 }
522
523 #else /* Better for fp code at expense of int code. */
524 #define REG_ALLOC_ORDER \
525 { \
526 0, 1, 2, 3, 4, 5, 6, 7, 8, \
527 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 \
528 SUBTARGET_REG_ALLOC_ORDER \
529 }
530 #endif
531
532 /* Return number of consecutive hard regs needed starting at reg REGNO
533 to hold something of mode MODE.
534 This is ordinarily the length in words of a value of mode MODE
535 but can be less for certain modes in special long registers. */
536 #define HARD_REGNO_NREGS(REGNO, MODE) \
537 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
538
539 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
540 extern const unsigned int m32r_hard_regno_mode_ok[FIRST_PSEUDO_REGISTER];
541 extern unsigned int m32r_mode_class[];
542 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
543 ((m32r_hard_regno_mode_ok[REGNO] & m32r_mode_class[MODE]) != 0)
544
545 /* A C expression that is nonzero if it is desirable to choose
546 register allocation so as to avoid move instructions between a
547 value of mode MODE1 and a value of mode MODE2.
548
549 If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
550 MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1,
551 MODE2)' must be zero. */
552
553 /* Tie QI/HI/SI modes together. */
554 #define MODES_TIEABLE_P(MODE1, MODE2) \
555 ( GET_MODE_CLASS (MODE1) == MODE_INT \
556 && GET_MODE_CLASS (MODE2) == MODE_INT \
557 && GET_MODE_SIZE (MODE1) <= UNITS_PER_WORD \
558 && GET_MODE_SIZE (MODE2) <= UNITS_PER_WORD)
559
560 #define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \
561 m32r_hard_regno_rename_ok (OLD_REG, NEW_REG)
562 \f
563 /* Register classes and constants. */
564
565 /* Define the classes of registers for register constraints in the
566 machine description. Also define ranges of constants.
567
568 One of the classes must always be named ALL_REGS and include all hard regs.
569 If there is more than one class, another class must be named NO_REGS
570 and contain no registers.
571
572 The name GENERAL_REGS must be the name of a class (or an alias for
573 another name such as ALL_REGS). This is the class of registers
574 that is allowed by "g" or "r" in a register constraint.
575 Also, registers outside this class are allocated only when
576 instructions express preferences for them.
577
578 The classes must be numbered in nondecreasing order; that is,
579 a larger-numbered class must never be contained completely
580 in a smaller-numbered class.
581
582 For any two classes, it is very desirable that there be another
583 class that represents their union.
584
585 It is important that any condition codes have class NO_REGS.
586 See `register_operand'. */
587
588 enum reg_class
589 {
590 NO_REGS, CARRY_REG, ACCUM_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES
591 };
592
593 #define IRA_COVER_CLASSES \
594 { \
595 ACCUM_REGS, GENERAL_REGS, LIM_REG_CLASSES \
596 }
597
598 #define N_REG_CLASSES ((int) LIM_REG_CLASSES)
599
600 /* Give names of register classes as strings for dump file. */
601 #define REG_CLASS_NAMES \
602 { "NO_REGS", "CARRY_REG", "ACCUM_REGS", "GENERAL_REGS", "ALL_REGS" }
603
604 /* Define which registers fit in which classes.
605 This is an initializer for a vector of HARD_REG_SET
606 of length N_REG_CLASSES. */
607
608 #ifndef SUBTARGET_REG_CLASS_CARRY
609 #define SUBTARGET_REG_CLASS_CARRY 0
610 #endif
611
612 #ifndef SUBTARGET_REG_CLASS_ACCUM
613 #define SUBTARGET_REG_CLASS_ACCUM 0
614 #endif
615
616 #ifndef SUBTARGET_REG_CLASS_GENERAL
617 #define SUBTARGET_REG_CLASS_GENERAL 0
618 #endif
619
620 #ifndef SUBTARGET_REG_CLASS_ALL
621 #define SUBTARGET_REG_CLASS_ALL 0
622 #endif
623
624 #define REG_CLASS_CONTENTS \
625 { \
626 { 0x00000 }, \
627 { 0x20000 | SUBTARGET_REG_CLASS_CARRY }, \
628 { 0x40000 | SUBTARGET_REG_CLASS_ACCUM }, \
629 { 0x1ffff | SUBTARGET_REG_CLASS_GENERAL }, \
630 { 0x7ffff | SUBTARGET_REG_CLASS_ALL }, \
631 }
632
633 /* The same information, inverted:
634 Return the class number of the smallest class containing
635 reg number REGNO. This could be a conditional expression
636 or could index an array. */
637 extern enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER];
638 #define REGNO_REG_CLASS(REGNO) (m32r_regno_reg_class[REGNO])
639
640 /* The class value for index registers, and the one for base regs. */
641 #define INDEX_REG_CLASS GENERAL_REGS
642 #define BASE_REG_CLASS GENERAL_REGS
643
644 /* These assume that REGNO is a hard or pseudo reg number.
645 They give nonzero only if REGNO is a hard reg of the suitable class
646 or a pseudo reg currently allocated to a suitable hard reg.
647 Since they use reg_renumber, they are safe only once reg_renumber
648 has been allocated, which happens in local-alloc.c. */
649 #define REGNO_OK_FOR_BASE_P(REGNO) \
650 ((REGNO) < FIRST_PSEUDO_REGISTER \
651 ? GPR_P (REGNO) || (REGNO) == ARG_POINTER_REGNUM \
652 : GPR_P (reg_renumber[REGNO]))
653
654 #define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_BASE_P(REGNO)
655
656 /* Given an rtx X being reloaded into a reg required to be
657 in class CLASS, return the class of reg to actually use.
658 In general this is just CLASS; but on some machines
659 in some cases it is preferable to use a more restrictive class. */
660 #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
661
662 /* Return the maximum number of consecutive registers
663 needed to represent mode MODE in a register of class CLASS. */
664 #define CLASS_MAX_NREGS(CLASS, MODE) \
665 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
666
667 /* Return true if a value is inside a range. */
668 #define IN_RANGE_P(VALUE, LOW, HIGH) \
669 (((unsigned HOST_WIDE_INT)((VALUE) - (LOW))) \
670 <= ((unsigned HOST_WIDE_INT)((HIGH) - (LOW))))
671
672 /* Some range macros. */
673 #define INT16_P(X) ((X) >= - 0x8000 && (X) <= 0x7fff)
674 #define CMP_INT16_P(X) ((X) >= - 0x7fff && (X) <= 0x8000)
675 #define UINT16_P(X) (((unsigned HOST_WIDE_INT) (X)) <= 0x0000ffff)
676 #define UINT24_P(X) (((unsigned HOST_WIDE_INT) (X)) <= 0x00ffffff)
677 \f
678 /* Stack layout and stack pointer usage. */
679
680 /* Define this macro if pushing a word onto the stack moves the stack
681 pointer to a smaller address. */
682 #define STACK_GROWS_DOWNWARD
683
684 /* Offset from frame pointer to start allocating local variables at.
685 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
686 first local allocated. Otherwise, it is the offset to the BEGINNING
687 of the first local allocated. */
688 /* The frame pointer points at the same place as the stack pointer, except if
689 alloca has been called. */
690 #define STARTING_FRAME_OFFSET \
691 M32R_STACK_ALIGN (crtl->outgoing_args_size)
692
693 /* Offset from the stack pointer register to the first location at which
694 outgoing arguments are placed. */
695 #define STACK_POINTER_OFFSET 0
696
697 /* Offset of first parameter from the argument pointer register value. */
698 #define FIRST_PARM_OFFSET(FNDECL) 0
699
700 /* Register to use for pushing function arguments. */
701 #define STACK_POINTER_REGNUM 15
702
703 /* Base register for access to local variables of the function. */
704 #define FRAME_POINTER_REGNUM 13
705
706 /* Base register for access to arguments of the function. */
707 #define ARG_POINTER_REGNUM 16
708
709 /* Register in which static-chain is passed to a function.
710 This must not be a register used by the prologue. */
711 #define STATIC_CHAIN_REGNUM 7
712
713 /* These aren't official macros. */
714 #define PROLOGUE_TMP_REGNUM 4
715 #define RETURN_ADDR_REGNUM 14
716 /* #define GP_REGNUM 12 */
717 #define CARRY_REGNUM 17
718 #define ACCUM_REGNUM 18
719 #define M32R_MAX_INT_REGS 16
720
721 #ifndef SUBTARGET_GPR_P
722 #define SUBTARGET_GPR_P(REGNO) 0
723 #endif
724
725 #ifndef SUBTARGET_ACCUM_P
726 #define SUBTARGET_ACCUM_P(REGNO) 0
727 #endif
728
729 #ifndef SUBTARGET_CARRY_P
730 #define SUBTARGET_CARRY_P(REGNO) 0
731 #endif
732
733 #define GPR_P(REGNO) (IN_RANGE_P ((REGNO), 0, 15) || SUBTARGET_GPR_P (REGNO))
734 #define ACCUM_P(REGNO) ((REGNO) == ACCUM_REGNUM || SUBTARGET_ACCUM_P (REGNO))
735 #define CARRY_P(REGNO) ((REGNO) == CARRY_REGNUM || SUBTARGET_CARRY_P (REGNO))
736 \f
737 /* Eliminating the frame and arg pointers. */
738
739 #if 0
740 /* C statement to store the difference between the frame pointer
741 and the stack pointer values immediately after the function prologue.
742 If `ELIMINABLE_REGS' is defined, this macro will be not be used and
743 need not be defined. */
744 #define INITIAL_FRAME_POINTER_OFFSET(VAR) \
745 ((VAR) = m32r_compute_frame_size (get_frame_size ()))
746 #endif
747
748 /* If defined, this macro specifies a table of register pairs used to
749 eliminate unneeded registers that point into the stack frame. If
750 it is not defined, the only elimination attempted by the compiler
751 is to replace references to the frame pointer with references to
752 the stack pointer.
753
754 Note that the elimination of the argument pointer with the stack
755 pointer is specified first since that is the preferred elimination. */
756
757 #define ELIMINABLE_REGS \
758 {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
759 { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
760 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }}
761
762 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
763 specifies the initial difference between the specified pair of
764 registers. This macro must be defined if `ELIMINABLE_REGS' is
765 defined. */
766
767 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
768 do \
769 { \
770 int size = m32r_compute_frame_size (get_frame_size ()); \
771 \
772 if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
773 (OFFSET) = 0; \
774 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
775 (OFFSET) = size - crtl->args.pretend_args_size; \
776 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
777 (OFFSET) = size - crtl->args.pretend_args_size; \
778 else \
779 gcc_unreachable (); \
780 } \
781 while (0)
782 \f
783 /* Function argument passing. */
784
785 /* If defined, the maximum amount of space required for outgoing
786 arguments will be computed and placed into the variable
787 `crtl->outgoing_args_size'. No space will be pushed
788 onto the stack for each call; instead, the function prologue should
789 increase the stack frame size by this amount. */
790 #define ACCUMULATE_OUTGOING_ARGS 1
791
792 /* Define a data type for recording info about an argument list
793 during the scan of that argument list. This data type should
794 hold all necessary information about the function itself
795 and about the args processed so far, enough to enable macros
796 such as FUNCTION_ARG to determine where the next arg should go. */
797 #define CUMULATIVE_ARGS int
798
799 /* Initialize a variable CUM of type CUMULATIVE_ARGS
800 for a call to a function whose data type is FNTYPE.
801 For a library call, FNTYPE is 0. */
802 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
803 ((CUM) = 0)
804
805 /* The number of registers used for parameter passing. Local to this file. */
806 #define M32R_MAX_PARM_REGS 4
807
808 /* 1 if N is a possible register number for function argument passing. */
809 #define FUNCTION_ARG_REGNO_P(N) \
810 ((unsigned) (N) < M32R_MAX_PARM_REGS)
811
812 /* If defined, a C expression that gives the alignment boundary, in bits,
813 of an argument with the specified mode and type. If it is not defined,
814 PARM_BOUNDARY is used for all arguments. */
815 #if 0
816 /* We assume PARM_BOUNDARY == UNITS_PER_WORD here. */
817 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
818 (((TYPE) ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) <= PARM_BOUNDARY \
819 ? PARM_BOUNDARY : 2 * PARM_BOUNDARY)
820 #endif
821 \f
822 /* Function results. */
823
824 /* Tell GCC to use TARGET_RETURN_IN_MEMORY. */
825 #define DEFAULT_PCC_STRUCT_RETURN 0
826 \f
827 /* Function entry and exit. */
828
829 /* Initialize data used by insn expanders. This is called from
830 init_emit, once for each function, before code is generated. */
831 #define INIT_EXPANDERS m32r_init_expanders ()
832
833 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
834 the stack pointer does not matter. The value is tested only in
835 functions that have frame pointers.
836 No definition is equivalent to always zero. */
837 #define EXIT_IGNORE_STACK 1
838
839 /* Output assembler code to FILE to increment profiler label # LABELNO
840 for profiling a function entry. */
841 #undef FUNCTION_PROFILER
842 #define FUNCTION_PROFILER(FILE, LABELNO) \
843 do \
844 { \
845 if (flag_pic) \
846 { \
847 fprintf (FILE, "\tld24 r14,#mcount\n"); \
848 fprintf (FILE, "\tadd r14,r12\n"); \
849 fprintf (FILE, "\tld r14,@r14\n"); \
850 fprintf (FILE, "\tjl r14\n"); \
851 } \
852 else \
853 { \
854 if (TARGET_ADDR24) \
855 fprintf (FILE, "\tbl mcount\n"); \
856 else \
857 { \
858 fprintf (FILE, "\tseth r14,#high(mcount)\n"); \
859 fprintf (FILE, "\tor3 r14,r14,#low(mcount)\n"); \
860 fprintf (FILE, "\tjl r14\n"); \
861 } \
862 } \
863 fprintf (FILE, "\taddi sp,#4\n"); \
864 } \
865 while (0)
866 \f
867 /* Trampolines. */
868
869 /* On the M32R, the trampoline is:
870
871 mv r7, lr -> bl L1 ; 178e 7e01
872 L1: add3 r6, lr, #L2-L1 ; 86ae 000c (L2 - L1 = 12)
873 mv lr, r7 -> ld r7,@r6+ ; 1e87 27e6
874 ld r6, @r6 -> jmp r6 ; 26c6 1fc6
875 L2: .word STATIC
876 .word FUNCTION */
877
878 #ifndef CACHE_FLUSH_FUNC
879 #define CACHE_FLUSH_FUNC "_flush_cache"
880 #endif
881 #ifndef CACHE_FLUSH_TRAP
882 #define CACHE_FLUSH_TRAP 12
883 #endif
884
885 /* Length in bytes of the trampoline for entering a nested function. */
886 #define TRAMPOLINE_SIZE 24
887
888 \f
889 #define RETURN_ADDR_RTX(COUNT, FRAME) m32r_return_addr (COUNT)
890
891 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM)
892
893 /* Addressing modes, and classification of registers for them. */
894
895 /* Maximum number of registers that can appear in a valid memory address. */
896 #define MAX_REGS_PER_ADDRESS 1
897
898 /* We have post-inc load and pre-dec,pre-inc store,
899 but only for 4 byte vals. */
900 #define HAVE_PRE_DECREMENT 1
901 #define HAVE_PRE_INCREMENT 1
902 #define HAVE_POST_INCREMENT 1
903
904 /* Recognize any constant value that is a valid address. */
905 #define CONSTANT_ADDRESS_P(X) \
906 ( GET_CODE (X) == LABEL_REF \
907 || GET_CODE (X) == SYMBOL_REF \
908 || CONST_INT_P (X) \
909 || (GET_CODE (X) == CONST \
910 && ! (flag_pic && ! m32r_legitimate_pic_operand_p (X))))
911
912 /* Nonzero if the constant value X is a legitimate general operand.
913 We don't allow (plus symbol large-constant) as the relocations can't
914 describe it. INTVAL > 32767 handles both 16-bit and 24-bit relocations.
915 We allow all CONST_DOUBLE's as the md file patterns will force the
916 constant to memory if they can't handle them. */
917
918 #define LEGITIMATE_CONSTANT_P(X) \
919 (! (GET_CODE (X) == CONST \
920 && GET_CODE (XEXP (X, 0)) == PLUS \
921 && (GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF || GET_CODE (XEXP (XEXP (X, 0), 0)) == LABEL_REF) \
922 && CONST_INT_P (XEXP (XEXP (X, 0), 1)) \
923 && (unsigned HOST_WIDE_INT) INTVAL (XEXP (XEXP (X, 0), 1)) > 32767))
924
925 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
926 and check its validity for a certain class.
927 We have two alternate definitions for each of them.
928 The usual definition accepts all pseudo regs; the other rejects
929 them unless they have been allocated suitable hard regs.
930 The symbol REG_OK_STRICT causes the latter definition to be used.
931
932 Most source files want to accept pseudo regs in the hope that
933 they will get allocated to the class that the insn wants them to be in.
934 Source files for reload pass need to be strict.
935 After reload, it makes no difference, since pseudo regs have
936 been eliminated by then. */
937
938 #ifdef REG_OK_STRICT
939
940 /* Nonzero if X is a hard reg that can be used as a base reg. */
941 #define REG_OK_FOR_BASE_P(X) GPR_P (REGNO (X))
942 /* Nonzero if X is a hard reg that can be used as an index. */
943 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
944
945 #else
946
947 /* Nonzero if X is a hard reg that can be used as a base reg
948 or if it is a pseudo reg. */
949 #define REG_OK_FOR_BASE_P(X) \
950 (GPR_P (REGNO (X)) \
951 || (REGNO (X)) == ARG_POINTER_REGNUM \
952 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
953 /* Nonzero if X is a hard reg that can be used as an index
954 or if it is a pseudo reg. */
955 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
956
957 #endif
958
959 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
960 that is a valid memory address for an instruction.
961 The MODE argument is the machine mode for the MEM expression
962 that wants to use this address. */
963
964 /* Local to this file. */
965 #define RTX_OK_FOR_BASE_P(X) (REG_P (X) && REG_OK_FOR_BASE_P (X))
966
967 /* Local to this file. */
968 #define RTX_OK_FOR_OFFSET_P(X) \
969 (CONST_INT_P (X) && INT16_P (INTVAL (X)))
970
971 /* Local to this file. */
972 #define LEGITIMATE_OFFSET_ADDRESS_P(MODE, X) \
973 (GET_CODE (X) == PLUS \
974 && RTX_OK_FOR_BASE_P (XEXP (X, 0)) \
975 && RTX_OK_FOR_OFFSET_P (XEXP (X, 1)))
976
977 /* Local to this file. */
978 /* For LO_SUM addresses, do not allow them if the MODE is > 1 word,
979 since more than one instruction will be required. */
980 #define LEGITIMATE_LO_SUM_ADDRESS_P(MODE, X) \
981 (GET_CODE (X) == LO_SUM \
982 && (MODE != BLKmode && GET_MODE_SIZE (MODE) <= UNITS_PER_WORD)\
983 && RTX_OK_FOR_BASE_P (XEXP (X, 0)) \
984 && CONSTANT_P (XEXP (X, 1)))
985
986 /* Local to this file. */
987 /* Is this a load and increment operation. */
988 #define LOAD_POSTINC_P(MODE, X) \
989 (((MODE) == SImode || (MODE) == SFmode) \
990 && GET_CODE (X) == POST_INC \
991 && REG_P (XEXP (X, 0)) \
992 && RTX_OK_FOR_BASE_P (XEXP (X, 0)))
993
994 /* Local to this file. */
995 /* Is this an increment/decrement and store operation. */
996 #define STORE_PREINC_PREDEC_P(MODE, X) \
997 (((MODE) == SImode || (MODE) == SFmode) \
998 && (GET_CODE (X) == PRE_INC || GET_CODE (X) == PRE_DEC) \
999 && REG_P (XEXP (X, 0)) \
1000 && RTX_OK_FOR_BASE_P (XEXP (X, 0)))
1001
1002 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1003 do \
1004 { \
1005 if (RTX_OK_FOR_BASE_P (X)) \
1006 goto ADDR; \
1007 if (LEGITIMATE_OFFSET_ADDRESS_P ((MODE), (X))) \
1008 goto ADDR; \
1009 if (LEGITIMATE_LO_SUM_ADDRESS_P ((MODE), (X))) \
1010 goto ADDR; \
1011 if (LOAD_POSTINC_P ((MODE), (X))) \
1012 goto ADDR; \
1013 if (STORE_PREINC_PREDEC_P ((MODE), (X))) \
1014 goto ADDR; \
1015 } \
1016 while (0)
1017 \f
1018 /* Condition code usage. */
1019
1020 /* Return nonzero if SELECT_CC_MODE will never return MODE for a
1021 floating point inequality comparison. */
1022 #define REVERSIBLE_CC_MODE(MODE) 1 /*???*/
1023 \f
1024 /* Costs. */
1025
1026 /* The cost of a branch insn. */
1027 /* A value of 2 here causes GCC to avoid using branches in comparisons like
1028 while (a < N && a). Branches aren't that expensive on the M32R so
1029 we define this as 1. Defining it as 2 had a heavy hit in fp-bit.c. */
1030 #define BRANCH_COST(speed_p, predictable_p) ((TARGET_BRANCH_COST) ? 2 : 1)
1031
1032 /* Nonzero if access to memory by bytes is slow and undesirable.
1033 For RISC chips, it means that access to memory by bytes is no
1034 better than access by words when possible, so grab a whole word
1035 and maybe make use of that. */
1036 #define SLOW_BYTE_ACCESS 1
1037
1038 /* Define this macro if it is as good or better to call a constant
1039 function address than to call an address kept in a register. */
1040 #define NO_FUNCTION_CSE
1041 \f
1042 /* Section selection. */
1043
1044 #define TEXT_SECTION_ASM_OP "\t.section .text"
1045 #define DATA_SECTION_ASM_OP "\t.section .data"
1046 #define BSS_SECTION_ASM_OP "\t.section .bss"
1047
1048 /* Define this macro if jump tables (for tablejump insns) should be
1049 output in the text section, along with the assembler instructions.
1050 Otherwise, the readonly data section is used.
1051 This macro is irrelevant if there is no separate readonly data section. */
1052 #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
1053 \f
1054 /* Position Independent Code. */
1055
1056 /* The register number of the register used to address a table of static
1057 data addresses in memory. In some cases this register is defined by a
1058 processor's ``application binary interface'' (ABI). When this macro
1059 is defined, RTL is generated for this register once, as with the stack
1060 pointer and frame pointer registers. If this macro is not defined, it
1061 is up to the machine-dependent files to allocate such a register (if
1062 necessary). */
1063 #define PIC_OFFSET_TABLE_REGNUM 12
1064
1065 /* Define this macro if the register defined by PIC_OFFSET_TABLE_REGNUM is
1066 clobbered by calls. Do not define this macro if PIC_OFFSET_TABLE_REGNUM
1067 is not defined. */
1068 /* This register is call-saved on the M32R. */
1069 /*#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED*/
1070
1071 /* A C expression that is nonzero if X is a legitimate immediate
1072 operand on the target machine when generating position independent code.
1073 You can assume that X satisfies CONSTANT_P, so you need not
1074 check this. You can also assume `flag_pic' is true, so you need not
1075 check it either. You need not define this macro if all constants
1076 (including SYMBOL_REF) can be immediate operands when generating
1077 position independent code. */
1078 #define LEGITIMATE_PIC_OPERAND_P(X) m32r_legitimate_pic_operand_p (X)
1079 \f
1080 /* Control the assembler format that we output. */
1081
1082 /* A C string constant describing how to begin a comment in the target
1083 assembler language. The compiler assumes that the comment will
1084 end at the end of the line. */
1085 #define ASM_COMMENT_START ";"
1086
1087 /* Output to assembler file text saying following lines
1088 may contain character constants, extra white space, comments, etc. */
1089 #define ASM_APP_ON ""
1090
1091 /* Output to assembler file text saying following lines
1092 no longer contain unusual constructs. */
1093 #define ASM_APP_OFF ""
1094
1095 /* Globalizing directive for a label. */
1096 #define GLOBAL_ASM_OP "\t.global\t"
1097
1098 /* We do not use DBX_LINES_FUNCTION_RELATIVE or
1099 dbxout_stab_value_internal_label_diff here because
1100 we need to use .debugsym for the line label. */
1101
1102 #define DBX_OUTPUT_SOURCE_LINE(file, line, counter) \
1103 do \
1104 { \
1105 const char * begin_label = \
1106 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0); \
1107 char label[64]; \
1108 ASM_GENERATE_INTERNAL_LABEL (label, "LM", counter); \
1109 \
1110 dbxout_begin_stabn_sline (line); \
1111 assemble_name (file, label); \
1112 putc ('-', file); \
1113 assemble_name (file, begin_label); \
1114 fputs ("\n\t.debugsym ", file); \
1115 assemble_name (file, label); \
1116 putc ('\n', file); \
1117 counter += 1; \
1118 } \
1119 while (0)
1120
1121 /* How to refer to registers in assembler output.
1122 This sequence is indexed by compiler's hard-register-number (see above). */
1123 #ifndef SUBTARGET_REGISTER_NAMES
1124 #define SUBTARGET_REGISTER_NAMES
1125 #endif
1126
1127 #define REGISTER_NAMES \
1128 { \
1129 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
1130 "r8", "r9", "r10", "r11", "r12", "fp", "lr", "sp", \
1131 "ap", "cbit", "a0" \
1132 SUBTARGET_REGISTER_NAMES \
1133 }
1134
1135 /* If defined, a C initializer for an array of structures containing
1136 a name and a register number. This macro defines additional names
1137 for hard registers, thus allowing the `asm' option in declarations
1138 to refer to registers using alternate names. */
1139 #ifndef SUBTARGET_ADDITIONAL_REGISTER_NAMES
1140 #define SUBTARGET_ADDITIONAL_REGISTER_NAMES
1141 #endif
1142
1143 #define ADDITIONAL_REGISTER_NAMES \
1144 { \
1145 /*{ "gp", GP_REGNUM },*/ \
1146 { "r13", FRAME_POINTER_REGNUM }, \
1147 { "r14", RETURN_ADDR_REGNUM }, \
1148 { "r15", STACK_POINTER_REGNUM }, \
1149 SUBTARGET_ADDITIONAL_REGISTER_NAMES \
1150 }
1151
1152 /* If defined, C string expressions to be used for the `%R', `%L',
1153 `%U', and `%I' options of `asm_fprintf' (see `final.c'). These
1154 are useful when a single `md' file must support multiple assembler
1155 formats. In that case, the various `tm.h' files can define these
1156 macros differently. */
1157 #define REGISTER_PREFIX ""
1158 #define LOCAL_LABEL_PREFIX ".L"
1159 #define USER_LABEL_PREFIX ""
1160 #define IMMEDIATE_PREFIX "#"
1161
1162 /* This is how to output an element of a case-vector that is absolute. */
1163 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1164 do \
1165 { \
1166 char label[30]; \
1167 ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
1168 fprintf (FILE, "\t.word\t"); \
1169 assemble_name (FILE, label); \
1170 fprintf (FILE, "\n"); \
1171 } \
1172 while (0)
1173
1174 /* This is how to output an element of a case-vector that is relative. */
1175 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL)\
1176 do \
1177 { \
1178 char label[30]; \
1179 ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
1180 fprintf (FILE, "\t.word\t"); \
1181 assemble_name (FILE, label); \
1182 fprintf (FILE, "-"); \
1183 ASM_GENERATE_INTERNAL_LABEL (label, "L", REL); \
1184 assemble_name (FILE, label); \
1185 fprintf (FILE, "\n"); \
1186 } \
1187 while (0)
1188
1189 /* The desired alignment for the location counter at the beginning
1190 of a loop. */
1191 /* On the M32R, align loops to 32 byte boundaries (cache line size)
1192 if -malign-loops. */
1193 #define LOOP_ALIGN(LABEL) (TARGET_ALIGN_LOOPS ? 5 : 0)
1194
1195 /* Define this to be the maximum number of insns to move around when moving
1196 a loop test from the top of a loop to the bottom
1197 and seeing whether to duplicate it. The default is thirty.
1198
1199 Loop unrolling currently doesn't like this optimization, so
1200 disable doing if we are unrolling loops and saving space. */
1201 #define LOOP_TEST_THRESHOLD (optimize_size \
1202 && !flag_unroll_loops \
1203 && !flag_unroll_all_loops ? 2 : 30)
1204
1205 /* This is how to output an assembler line
1206 that says to advance the location counter
1207 to a multiple of 2**LOG bytes. */
1208 /* .balign is used to avoid confusion. */
1209 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1210 do \
1211 { \
1212 if ((LOG) != 0) \
1213 fprintf (FILE, "\t.balign %d\n", 1 << (LOG)); \
1214 } \
1215 while (0)
1216
1217 /* Like `ASM_OUTPUT_COMMON' except takes the required alignment as a
1218 separate, explicit argument. If you define this macro, it is used in
1219 place of `ASM_OUTPUT_COMMON', and gives you more flexibility in
1220 handling the required alignment of the variable. The alignment is
1221 specified as the number of bits. */
1222
1223 #define SCOMMON_ASM_OP "\t.scomm\t"
1224
1225 #undef ASM_OUTPUT_ALIGNED_COMMON
1226 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
1227 do \
1228 { \
1229 if (! TARGET_SDATA_NONE \
1230 && (SIZE) > 0 \
1231 && (SIZE) <= (unsigned HOST_WIDE_INT) g_switch_value) \
1232 fprintf ((FILE), "%s", SCOMMON_ASM_OP); \
1233 else \
1234 fprintf ((FILE), "%s", COMMON_ASM_OP); \
1235 assemble_name ((FILE), (NAME)); \
1236 fprintf ((FILE), ",%u,%u\n", (int)(SIZE), (ALIGN) / BITS_PER_UNIT);\
1237 } \
1238 while (0)
1239
1240 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
1241 do \
1242 { \
1243 if (! TARGET_SDATA_NONE \
1244 && (SIZE) > 0 \
1245 && (SIZE) <= (unsigned HOST_WIDE_INT) g_switch_value) \
1246 switch_to_section (get_named_section (NULL, ".sbss", 0)); \
1247 else \
1248 switch_to_section (bss_section); \
1249 ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \
1250 last_assemble_variable_decl = DECL; \
1251 ASM_DECLARE_OBJECT_NAME (FILE, NAME, DECL); \
1252 ASM_OUTPUT_SKIP (FILE, SIZE ? SIZE : 1); \
1253 } \
1254 while (0)
1255 \f
1256 /* Debugging information. */
1257
1258 /* Generate DBX and DWARF debugging information. */
1259 #define DBX_DEBUGGING_INFO 1
1260 #define DWARF2_DEBUGGING_INFO 1
1261
1262 /* Use DWARF2 debugging info by default. */
1263 #undef PREFERRED_DEBUGGING_TYPE
1264 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
1265
1266 /* Turn off splitting of long stabs. */
1267 #define DBX_CONTIN_LENGTH 0
1268 \f
1269 /* Miscellaneous. */
1270
1271 /* Specify the machine mode that this machine uses
1272 for the index in the tablejump instruction. */
1273 #define CASE_VECTOR_MODE (flag_pic ? SImode : Pmode)
1274
1275 /* Define if operations between registers always perform the operation
1276 on the full register even if a narrower mode is specified. */
1277 #define WORD_REGISTER_OPERATIONS
1278
1279 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
1280 will either zero-extend or sign-extend. The value of this macro should
1281 be the code that says which one of the two operations is implicitly
1282 done, UNKNOWN if none. */
1283 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
1284
1285 /* Max number of bytes we can move from memory
1286 to memory in one reasonably fast instruction. */
1287 #define MOVE_MAX 4
1288
1289 /* Define this to be nonzero if shift instructions ignore all but the low-order
1290 few bits. */
1291 #define SHIFT_COUNT_TRUNCATED 1
1292
1293 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1294 is done just by pretending it is already truncated. */
1295 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1296
1297 /* Specify the machine mode that pointers have.
1298 After generation of rtl, the compiler makes no further distinction
1299 between pointers and any other objects of this machine mode. */
1300 /* ??? The M32R doesn't have full 32-bit pointers, but making this PSImode has
1301 its own problems (you have to add extendpsisi2 and truncsipsi2).
1302 Try to avoid it. */
1303 #define Pmode SImode
1304
1305 /* A function address in a call instruction. */
1306 #define FUNCTION_MODE SImode
1307 \f
1308 /* M32R function types. */
1309 enum m32r_function_type
1310 {
1311 M32R_FUNCTION_UNKNOWN, M32R_FUNCTION_NORMAL, M32R_FUNCTION_INTERRUPT
1312 };
1313
1314 #define M32R_INTERRUPT_P(TYPE) ((TYPE) == M32R_FUNCTION_INTERRUPT)
1315
1316 /* The maximum number of bytes to copy using pairs of load/store instructions.
1317 If a block is larger than this then a loop will be generated to copy
1318 MAX_MOVE_BYTES chunks at a time. The value of 32 is a semi-arbitrary choice.
1319 A customer uses Dhrystome as their benchmark, and Dhrystone has a 31 byte
1320 string copy in it. */
1321 #define MAX_MOVE_BYTES 32