]> gcc.gnu.org Git - gcc.git/blame - gcc/config/m32r/m32r.h
sparc.md (movdf): Avoid calling validize_mem during or after reload.
[gcc.git] / gcc / config / m32r / m32r.h
CommitLineData
18543a22 1/* Definitions of target machine for GNU compiler, Mitsubishi M32R cpu.
cf011243
AO
2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
3 Free Software Foundation, Inc.
8c5ca3b9
DE
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING. If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22/* Things to do:
23- longlong.h?
24*/
25
8c5ca3b9
DE
26#undef SWITCH_TAKES_ARG
27#undef WORD_SWITCH_TAKES_ARG
28#undef HANDLE_SYSV_PRAGMA
29#undef SIZE_TYPE
30#undef PTRDIFF_TYPE
31#undef WCHAR_TYPE
32#undef WCHAR_TYPE_SIZE
33#undef ASM_FILE_START
34#undef ASM_OUTPUT_EXTERNAL_LIBCALL
56e2e762
NC
35#undef TARGET_VERSION
36#undef CPP_SPEC
37#undef ASM_SPEC
38#undef LINK_SPEC
39#undef STARTFILE_SPEC
40#undef ENDFILE_SPEC
41#undef SUBTARGET_SWITCHES
8c5ca3b9
DE
42\f
43/* Print subsidiary information on the compiler version in use. */
56e2e762 44#ifndef TARGET_VERSION
8c5ca3b9 45#define TARGET_VERSION fprintf (stderr, " (m32r)")
56e2e762 46#endif
2b7972b0 47
8c5ca3b9
DE
48/* Switch Recognition by gcc.c. Add -G xx support */
49
56e2e762 50#undef SWITCH_TAKES_ARG
8c5ca3b9
DE
51#define SWITCH_TAKES_ARG(CHAR) \
52(DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G')
53
54/* Names to predefine in the preprocessor for this target machine. */
55/* __M32R__ is defined by the existing compiler so we use that. */
2b57e919 56#define CPP_PREDEFINES "-Acpu=m32r -Amachine=m32r -D__M32R__"
8c5ca3b9 57
56e2e762
NC
58/* This macro defines names of additional specifications to put in the specs
59 that can be used in various specifications like CC1_SPEC. Its definition
60 is an initializer with a subgrouping for each command option.
8c5ca3b9 61
56e2e762
NC
62 Each subgrouping contains a string constant, that defines the
63 specification name, and a string constant that used by the GNU CC driver
64 program.
8c5ca3b9 65
56e2e762 66 Do not define this macro if it does not need to do anything. */
2b7972b0 67
56e2e762
NC
68#ifndef SUBTARGET_EXTRA_SPECS
69#define SUBTARGET_EXTRA_SPECS
8c5ca3b9
DE
70#endif
71
56e2e762
NC
72#ifndef ASM_CPU_SPEC
73#define ASM_CPU_SPEC ""
74#endif
8c5ca3b9 75
56e2e762
NC
76#ifndef CPP_CPU_SPEC
77#define CPP_CPU_SPEC ""
78#endif
79
80#ifndef CC1_CPU_SPEC
81#define CC1_CPU_SPEC ""
82#endif
83
84#ifndef LINK_CPU_SPEC
85#define LINK_CPU_SPEC ""
86#endif
87
88#ifndef STARTFILE_CPU_SPEC
89#define STARTFILE_CPU_SPEC "%{!shared:crt0.o%s} crtinit.o%s"
90#endif
91
92#ifndef ENDFILE_CPU_SPEC
93#define ENDFILE_CPU_SPEC "-lgloss crtfini.o%s"
94#endif
95
96#ifndef RELAX_SPEC
8c5ca3b9 97#if 0 /* not supported yet */
56e2e762 98#define RELAX_SPEC "%{mrelax:-relax}"
8c5ca3b9 99#else
56e2e762
NC
100#define RELAX_SPEC ""
101#endif
8c5ca3b9
DE
102#endif
103
56e2e762
NC
104#define EXTRA_SPECS \
105 { "asm_cpu", ASM_CPU_SPEC }, \
106 { "cpp_cpu", CPP_CPU_SPEC }, \
107 { "cc1_cpu", CC1_CPU_SPEC }, \
108 { "link_cpu", LINK_CPU_SPEC }, \
109 { "startfile_cpu", STARTFILE_CPU_SPEC }, \
110 { "endfile_cpu", ENDFILE_CPU_SPEC }, \
111 { "relax", RELAX_SPEC }, \
112 SUBTARGET_EXTRA_SPECS
8c5ca3b9 113
56e2e762 114#define CC1_SPEC "%{G*} %(cc1_cpu)"
2b7972b0 115
56e2e762
NC
116/* Options to pass on to the assembler. */
117#undef ASM_SPEC
118#define ASM_SPEC "%{v} %(asm_cpu) %(relax)"
119
120#undef ASM_FINAL_SPEC
121
122#define LINK_SPEC "%{v} %(link_cpu) %(relax)"
123
124#undef STARTFILE_SPEC
125#define STARTFILE_SPEC "%(startfile_cpu)"
126
127#undef ENDFILE_SPEC
128#define ENDFILE_SPEC "%(endfile_cpu)"
8c5ca3b9
DE
129
130#undef LIB_SPEC
131\f
132/* Run-time compilation parameters selecting different hardware subsets. */
133
134extern int target_flags;
135
136/* If non-zero, tell the linker to do relaxing.
137 We don't do anything with the option, other than recognize it.
138 LINK_SPEC handles passing -relax to the linker.
139 This can cause incorrect debugging information as line numbers may
140 turn out wrong. This shouldn't be specified unless accompanied with -O2
141 [where the user expects debugging information to be less accurate]. */
56e2e762 142#define TARGET_RELAX_MASK (1 << 0)
8c5ca3b9
DE
143
144/* For miscellaneous debugging purposes. */
56e2e762
NC
145#define TARGET_DEBUG_MASK (1 << 1)
146#define TARGET_DEBUG (target_flags & TARGET_DEBUG_MASK)
8c5ca3b9
DE
147
148/* Align loops to 32 byte boundaries (cache line size). */
149/* ??? This option is experimental and is not documented. */
56e2e762
NC
150#define TARGET_ALIGN_LOOPS_MASK (1 << 2)
151#define TARGET_ALIGN_LOOPS (target_flags & TARGET_ALIGN_LOOPS_MASK)
8c5ca3b9 152
56e2e762 153/* Change issue rate. */
c237e94a
ZW
154#define TARGET_LOW_ISSUE_RATE_MASK (1 << 3)
155#define TARGET_LOW_ISSUE_RATE (target_flags & TARGET_LOW_ISSUE_RATE_MASK)
8c5ca3b9 156
56e2e762
NC
157/* Change branch cost */
158#define TARGET_BRANCH_COST_MASK (1 << 4)
159#define TARGET_BRANCH_COST (target_flags & TARGET_BRANCH_COST_MASK)
2b7972b0 160
56e2e762
NC
161/* Target machine to compile for. */
162#define TARGET_M32R 1
2b7972b0 163
8c5ca3b9
DE
164/* Macro to define tables used to set the flags.
165 This is a list in braces of pairs in braces,
166 each pair being { "NAME", VALUE }
167 where VALUE is the bits to set or minus the bits to clear.
168 An empty string NAME is used to identify the default VALUE. */
169
56e2e762 170#ifndef SUBTARGET_SWITCHES
8c5ca3b9 171#define SUBTARGET_SWITCHES
56e2e762 172#endif
8c5ca3b9 173
56e2e762
NC
174#ifndef TARGET_DEFAULT
175#define TARGET_DEFAULT 0
176#endif
8c5ca3b9 177
56e2e762
NC
178#define TARGET_SWITCHES \
179{ \
180/* { "relax", TARGET_RELAX_MASK, "" }, \
181 { "no-relax", -TARGET_RELAX_MASK, "" },*/ \
182 { "debug", TARGET_DEBUG_MASK, \
047142d3 183 N_("Display compile time statistics") }, \
56e2e762 184 { "align-loops", TARGET_ALIGN_LOOPS_MASK, \
047142d3 185 N_("Align all loops to 32 byte boundary") }, \
56e2e762 186 { "no-align-loops", -TARGET_ALIGN_LOOPS_MASK, "" }, \
c237e94a 187 { "issue-rate=1", TARGET_LOW_ISSUE_RATE_MASK, \
047142d3 188 N_("Only issue one instruction per cycle") }, \
c237e94a 189 { "issue-rate=2", -TARGET_LOW_ISSUE_RATE_MASK, "" }, \
56e2e762 190 { "branch-cost=1", TARGET_BRANCH_COST_MASK, \
047142d3 191 N_("Prefer branches over conditional execution") }, \
56e2e762
NC
192 { "branch-cost=2", -TARGET_BRANCH_COST_MASK, "" }, \
193 SUBTARGET_SWITCHES \
194 { "", TARGET_DEFAULT, "" } \
195}
8c5ca3b9 196
56e2e762
NC
197extern const char * m32r_model_string;
198extern const char * m32r_sdata_string;
2b7972b0 199
56e2e762
NC
200#ifndef SUBTARGET_OPTIONS
201#define SUBTARGET_OPTIONS
202#endif
2b7972b0 203
56e2e762
NC
204#define TARGET_OPTIONS \
205{ \
047142d3
PT
206 { "model=", & m32r_model_string, \
207 N_("Code size: small, medium or large") }, \
208 { "sdata=", & m32r_sdata_string, \
209 N_("Small data area: none, sdata, use") } \
56e2e762 210 SUBTARGET_OPTIONS \
8c5ca3b9
DE
211}
212
213/* Code Models
214
215 Code models are used to select between two choices of two separate
216 possibilities (address space size, call insn to use):
217
218 small: addresses use 24 bits, use bl to make calls
219 medium: addresses use 32 bits, use bl to make calls (*1)
220 large: addresses use 32 bits, use seth/add3/jl to make calls (*2)
221
222 The fourth is "addresses use 24 bits, use seth/add3/jl to make calls" but
223 using this one doesn't make much sense.
224
225 (*1) The linker may eventually be able to relax seth/add3 -> ld24.
226 (*2) The linker may eventually be able to relax seth/add3/jl -> bl.
227
228 Internally these are recorded as TARGET_ADDR{24,32} and
229 TARGET_CALL{26,32}.
230
231 The __model__ attribute can be used to select the code model to use when
232 accessing particular objects. */
233
234enum m32r_model { M32R_MODEL_SMALL, M32R_MODEL_MEDIUM, M32R_MODEL_LARGE };
235
236extern enum m32r_model m32r_model;
237#define TARGET_MODEL_SMALL (m32r_model == M32R_MODEL_SMALL)
238#define TARGET_MODEL_MEDIUM (m32r_model == M32R_MODEL_MEDIUM)
239#define TARGET_MODEL_LARGE (m32r_model == M32R_MODEL_LARGE)
240#define TARGET_ADDR24 (m32r_model == M32R_MODEL_SMALL)
241#define TARGET_ADDR32 (! TARGET_ADDR24)
242#define TARGET_CALL26 (! TARGET_CALL32)
243#define TARGET_CALL32 (m32r_model == M32R_MODEL_LARGE)
244
245/* The default is the small model. */
56e2e762 246#ifndef M32R_MODEL_DEFAULT
8c5ca3b9 247#define M32R_MODEL_DEFAULT "small"
56e2e762 248#endif
8c5ca3b9
DE
249
250/* Small Data Area
251
252 The SDA consists of sections .sdata, .sbss, and .scommon.
253 .scommon isn't a real section, symbols in it have their section index
254 set to SHN_M32R_SCOMMON, though support for it exists in the linker script.
255
256 Two switches control the SDA:
257
258 -G NNN - specifies the maximum size of variable to go in the SDA
259
260 -msdata=foo - specifies how such variables are handled
261
262 -msdata=none - small data area is disabled
263
264 -msdata=sdata - small data goes in the SDA, special code isn't
265 generated to use it, and special relocs aren't
266 generated
267
268 -msdata=use - small data goes in the SDA, special code is generated
269 to use the SDA and special relocs are generated
270
271 The SDA is not multilib'd, it isn't necessary.
272 MULTILIB_EXTRA_OPTS is set in tmake_file to -msdata=sdata so multilib'd
273 libraries have small data in .sdata/SHN_M32R_SCOMMON so programs that use
274 -msdata=use will successfully link with them (references in header files
275 will cause the compiler to emit code that refers to library objects in
276 .data). ??? There can be a problem if the user passes a -G value greater
277 than the default and a library object in a header file is that size.
278 The default is 8 so this should be rare - if it occurs the user
279 is required to rebuild the libraries or use a smaller value for -G.
280*/
281
282/* Maximum size of variables that go in .sdata/.sbss.
283 The -msdata=foo switch also controls how small variables are handled. */
56e2e762 284#ifndef SDATA_DEFAULT_SIZE
8c5ca3b9 285#define SDATA_DEFAULT_SIZE 8
56e2e762 286#endif
8c5ca3b9
DE
287
288extern int g_switch_value; /* value of the -G xx switch */
289extern int g_switch_set; /* whether -G xx was passed. */
290
291enum m32r_sdata { M32R_SDATA_NONE, M32R_SDATA_SDATA, M32R_SDATA_USE };
292
293extern enum m32r_sdata m32r_sdata;
294#define TARGET_SDATA_NONE (m32r_sdata == M32R_SDATA_NONE)
295#define TARGET_SDATA_SDATA (m32r_sdata == M32R_SDATA_SDATA)
296#define TARGET_SDATA_USE (m32r_sdata == M32R_SDATA_USE)
297
298/* Default is to disable the SDA
299 [for upward compatibility with previous toolchains]. */
56e2e762 300#ifndef M32R_SDATA_DEFAULT
8c5ca3b9 301#define M32R_SDATA_DEFAULT "none"
56e2e762 302#endif
8c5ca3b9
DE
303
304/* Define this macro as a C expression for the initializer of an array of
2b7972b0 305 strings to tell the driver program which options are defaults for this
8c5ca3b9
DE
306 target and thus do not need to be handled specially when using
307 `MULTILIB_OPTIONS'. */
56e2e762
NC
308#ifndef SUBTARGET_MULTILIB_DEFAULTS
309#define SUBTARGET_MULTILIB_DEFAULTS
310#endif
311
312#ifndef MULTILIB_DEFAULTS
313#define MULTILIB_DEFAULTS { "mmodel=small" SUBTARGET_MULTILIB_DEFAULTS }
314#endif
8c5ca3b9
DE
315
316/* Sometimes certain combinations of command options do not make
317 sense on a particular target machine. You can define a macro
318 `OVERRIDE_OPTIONS' to take account of this. This macro, if
319 defined, is executed once just after all the command options have
320 been parsed.
321
322 Don't use this macro to turn on various extra optimizations for
323 `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
324
56e2e762
NC
325#ifndef SUBTARGET_OVERRIDE_OPTIONS
326#define SUBTARGET_OVERRIDE_OPTIONS
327#endif
328
329#define OVERRIDE_OPTIONS \
330 do \
331 { \
332 /* These need to be done at start up. \
333 It's convenient to do them here. */ \
334 m32r_init (); \
335 SUBTARGET_OVERRIDE_OPTIONS \
336 } \
337 while (0)
338
339#ifndef SUBTARGET_OPTIMIZATION_OPTIONS
340#define SUBTARGET_OPTIMIZATION_OPTIONS
341#endif
342
343#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \
344 do \
345 { \
346 if (LEVEL == 1) \
347 flag_regmove = TRUE; \
348 \
349 if (SIZE) \
350 { \
351 flag_omit_frame_pointer = TRUE; \
352 flag_strength_reduce = FALSE; \
353 } \
354 \
355 SUBTARGET_OPTIMIZATION_OPTIONS \
356 } \
357 while (0)
8c5ca3b9
DE
358
359/* Define this macro if debugging can be performed even without a
360 frame pointer. If this macro is defined, GNU CC will turn on the
361 `-fomit-frame-pointer' option whenever `-O' is specified. */
362#define CAN_DEBUG_WITHOUT_FP
363\f
364/* Target machine storage layout. */
365
366/* Define to use software floating point emulator for REAL_ARITHMETIC and
367 decimal <-> binary conversion. */
368#define REAL_ARITHMETIC
369
370/* Define this if most significant bit is lowest numbered
371 in instructions that operate on numbered bit-fields. */
372#define BITS_BIG_ENDIAN 1
373
374/* Define this if most significant byte of a word is the lowest numbered. */
375#define BYTES_BIG_ENDIAN 1
376
377/* Define this if most significant word of a multiword number is the lowest
378 numbered. */
379#define WORDS_BIG_ENDIAN 1
380
381/* Define this macro if WORDS_BIG_ENDIAN is not constant. This must
382 be a constant value with the same meaning as WORDS_BIG_ENDIAN,
383 which will be used only when compiling libgcc2.c. Typically the
384 value will be set based on preprocessor defines. */
385/*#define LIBGCC2_WORDS_BIG_ENDIAN 1*/
386
387/* Number of bits in an addressable storage unit. */
388#define BITS_PER_UNIT 8
389
390/* Width in bits of a "word", which is the contents of a machine register.
391 Note that this is not necessarily the width of data type `int';
392 if using 16-bit ints on a 68000, this would still be 32.
393 But on a machine with 16-bit registers, this would be 16. */
394#define BITS_PER_WORD 32
395
396/* Width of a word, in units (bytes). */
397#define UNITS_PER_WORD 4
398
399/* Define this macro if it is advisable to hold scalars in registers
400 in a wider mode than that declared by the program. In such cases,
401 the value is constrained to be within the bounds of the declared
402 type, but kept valid in the wider mode. The signedness of the
403 extension may differ from that of the type. */
56e2e762
NC
404#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
405 if (GET_MODE_CLASS (MODE) == MODE_INT \
406 && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
407 { \
408 (MODE) = SImode; \
409 }
8c5ca3b9
DE
410
411/* Define this macro if the promotion described by `PROMOTE_MODE'
412 should also be done for outgoing function arguments. */
413/*#define PROMOTE_FUNCTION_ARGS*/
414
415/* Likewise, if the function return value is promoted.
416 If defined, FUNCTION_VALUE must perform the same promotions done by
417 PROMOTE_MODE. */
418/*#define PROMOTE_FUNCTION_RETURN*/
419
420/* Width in bits of a pointer.
421 See also the macro `Pmode' defined below. */
422#define POINTER_SIZE 32
423
424/* Allocation boundary (in *bits*) for storing arguments in argument list. */
425#define PARM_BOUNDARY 32
426
427/* Boundary (in *bits*) on which stack pointer should be aligned. */
428#define STACK_BOUNDARY 32
429
430/* ALIGN FRAMES on word boundaries */
431#define M32R_STACK_ALIGN(LOC) (((LOC)+3) & ~3)
432
433/* Allocation boundary (in *bits*) for the code of a function. */
434#define FUNCTION_BOUNDARY 32
435
436/* Alignment of field after `int : 0' in a structure. */
437#define EMPTY_FIELD_BOUNDARY 32
438
439/* Every structure's size must be a multiple of this. */
440#define STRUCTURE_SIZE_BOUNDARY 8
441
442/* A bitfield declared as `int' forces `int' alignment for the struct. */
443#define PCC_BITFIELD_TYPE_MATTERS 1
444
445/* No data type wants to be aligned rounder than this. */
446#define BIGGEST_ALIGNMENT 32
447
448/* The best alignment to use in cases where we have a choice. */
449#define FASTEST_ALIGNMENT 32
450
451/* Make strings word-aligned so strcpy from constants will be faster. */
56e2e762 452#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
8c5ca3b9
DE
453 ((TREE_CODE (EXP) == STRING_CST \
454 && (ALIGN) < FASTEST_ALIGNMENT) \
455 ? FASTEST_ALIGNMENT : (ALIGN))
456
457/* Make arrays of chars word-aligned for the same reasons. */
56e2e762
NC
458#define DATA_ALIGNMENT(TYPE, ALIGN) \
459 (TREE_CODE (TYPE) == ARRAY_TYPE \
460 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
8c5ca3b9
DE
461 && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
462
463/* Set this nonzero if move instructions will actually fail to work
464 when given unaligned data. */
465#define STRICT_ALIGNMENT 1
466\f
467/* Layout of source language data types. */
468
469#define SHORT_TYPE_SIZE 16
470#define INT_TYPE_SIZE 32
471#define LONG_TYPE_SIZE 32
472#define LONG_LONG_TYPE_SIZE 64
473#define FLOAT_TYPE_SIZE 32
474#define DOUBLE_TYPE_SIZE 64
475#define LONG_DOUBLE_TYPE_SIZE 64
476
477/* Define this as 1 if `char' should by default be signed; else as 0. */
478#define DEFAULT_SIGNED_CHAR 1
479
480#define SIZE_TYPE "long unsigned int"
481#define PTRDIFF_TYPE "long int"
482#define WCHAR_TYPE "short unsigned int"
483#define WCHAR_TYPE_SIZE 16
8c5ca3b9
DE
484\f
485/* Standard register usage. */
486
487/* Number of actual hardware registers.
488 The hardware registers are assigned numbers for the compiler
489 from 0 to just below FIRST_PSEUDO_REGISTER.
490 All registers that the compiler knows about must be given numbers,
491 even those that are not normally considered general registers. */
56e2e762
NC
492
493#define M32R_NUM_REGISTERS 19
494
495#ifndef SUBTARGET_NUM_REGISTERS
496#define SUBTARGET_NUM_REGISTERS 0
497#endif
498
499#define FIRST_PSEUDO_REGISTER (M32R_NUM_REGISTERS + SUBTARGET_NUM_REGISTERS)
2b7972b0 500
8c5ca3b9
DE
501/* 1 for registers that have pervasive standard uses
502 and are not available for the register allocator.
503
504 0-3 - arguments/results
505 4-5 - call used [4 is used as a tmp during prologue/epilogue generation]
506 6 - call used, gptmp
507 7 - call used, static chain pointer
508 8-11 - call saved
509 12 - call saved [reserved for global pointer]
510 13 - frame pointer
511 14 - subroutine link register
512 15 - stack pointer
513 16 - arg pointer
514 17 - carry flag
56e2e762 515 18 - accumulator
8c5ca3b9
DE
516
517 By default, the extension registers are not available. */
518
56e2e762
NC
519#ifndef SUBTARGET_FIXED_REGISTERS
520#define SUBTARGET_FIXED_REGISTERS
521#endif
8c5ca3b9 522
56e2e762
NC
523#define FIXED_REGISTERS \
524{ \
525 0, 0, 0, 0, 0, 0, 0, 0, \
526 0, 0, 0, 0, 0, 0, 0, 1, \
527 1, 1, 1 \
528 SUBTARGET_FIXED_REGISTERS \
529}
2b7972b0 530
8c5ca3b9
DE
531/* 1 for registers not available across function calls.
532 These must include the FIXED_REGISTERS and also any
533 registers that can be used without being saved.
534 The latter must include the registers where values are returned
535 and the register where structure-value addresses are passed.
536 Aside from that, you can include as many other registers as you like. */
537
56e2e762
NC
538#ifndef SUBTARGET_CALL_USED_REGISTERS
539#define SUBTARGET_CALL_USED_REGISTERS
540#endif
8c5ca3b9 541
56e2e762
NC
542#define CALL_USED_REGISTERS \
543{ \
544 1, 1, 1, 1, 1, 1, 1, 1, \
545 0, 0, 0, 0, 0, 0, 1, 1, \
546 1, 1, 1 \
547 SUBTARGET_CALL_USED_REGISTERS \
548}
2b7972b0 549
8c5ca3b9
DE
550/* Zero or more C statements that may conditionally modify two variables
551 `fixed_regs' and `call_used_regs' (both of type `char []') after they
552 have been initialized from the two preceding macros.
553
554 This is necessary in case the fixed or call-clobbered registers depend
555 on target flags.
556
557 You need not define this macro if it has no work to do. */
558
56e2e762
NC
559#ifdef SUBTARGET_CONDITIONAL_REGISTER_USAGE
560#define CONDITIONAL_REGISTER_USAGE SUBTARGET_CONDITIONAL_REGISTER_USAGE
561#endif
8c5ca3b9
DE
562
563/* If defined, an initializer for a vector of integers, containing the
564 numbers of hard registers in the order in which GNU CC should
565 prefer to use them (from most preferred to least). */
56e2e762
NC
566
567#ifndef SUBTARGET_REG_ALLOC_ORDER
568#define SUBTARGET_REG_ALLOC_ORDER
569#endif
570
9fd54896 571#if 1 /* better for int code */
56e2e762
NC
572#define REG_ALLOC_ORDER \
573{ \
574 4, 5, 6, 7, 2, 3, 8, 9, 10, \
575 11, 12, 13, 14, 0, 1, 15, 16, 17, 18 \
576 SUBTARGET_REG_ALLOC_ORDER \
577}
578
9fd54896 579#else /* better for fp code at expense of int code */
56e2e762
NC
580#define REG_ALLOC_ORDER \
581{ \
582 0, 1, 2, 3, 4, 5, 6, 7, 8, \
583 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 \
584 SUBTARGET_REG_ALLOC_ORDER \
585}
8c5ca3b9
DE
586#endif
587
588/* Return number of consecutive hard regs needed starting at reg REGNO
589 to hold something of mode MODE.
590 This is ordinarily the length in words of a value of mode MODE
591 but can be less for certain modes in special long registers. */
592#define HARD_REGNO_NREGS(REGNO, MODE) \
593((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
594
595/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
596extern unsigned int m32r_hard_regno_mode_ok[];
597extern unsigned int m32r_mode_class[];
598#define HARD_REGNO_MODE_OK(REGNO, MODE) \
599((m32r_hard_regno_mode_ok[REGNO] & m32r_mode_class[MODE]) != 0)
600
601/* A C expression that is nonzero if it is desirable to choose
602 register allocation so as to avoid move instructions between a
603 value of mode MODE1 and a value of mode MODE2.
604
605 If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
606 MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1,
607 MODE2)' must be zero. */
608
609/* Tie QI/HI/SI modes together. */
610#define MODES_TIEABLE_P(MODE1, MODE2) \
611(GET_MODE_CLASS (MODE1) == MODE_INT \
612 && GET_MODE_CLASS (MODE2) == MODE_INT \
613 && GET_MODE_SIZE (MODE1) <= UNITS_PER_WORD \
614 && GET_MODE_SIZE (MODE2) <= UNITS_PER_WORD)
615\f
616/* Register classes and constants. */
617
618/* Define the classes of registers for register constraints in the
619 machine description. Also define ranges of constants.
620
621 One of the classes must always be named ALL_REGS and include all hard regs.
622 If there is more than one class, another class must be named NO_REGS
623 and contain no registers.
624
625 The name GENERAL_REGS must be the name of a class (or an alias for
626 another name such as ALL_REGS). This is the class of registers
627 that is allowed by "g" or "r" in a register constraint.
628 Also, registers outside this class are allocated only when
629 instructions express preferences for them.
630
631 The classes must be numbered in nondecreasing order; that is,
632 a larger-numbered class must never be contained completely
633 in a smaller-numbered class.
634
635 For any two classes, it is very desirable that there be another
636 class that represents their union.
637
638 It is important that any condition codes have class NO_REGS.
639 See `register_operand'. */
640
56e2e762
NC
641enum reg_class
642{
643 NO_REGS, CARRY_REG, ACCUM_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES
8c5ca3b9
DE
644};
645
56e2e762 646#define N_REG_CLASSES ((int) LIM_REG_CLASSES)
8c5ca3b9
DE
647
648/* Give names of register classes as strings for dump file. */
649#define REG_CLASS_NAMES \
56e2e762 650 { "NO_REGS", "CARRY_REG", "ACCUM_REGS", "GENERAL_REGS", "ALL_REGS" }
8c5ca3b9
DE
651
652/* Define which registers fit in which classes.
653 This is an initializer for a vector of HARD_REG_SET
654 of length N_REG_CLASSES. */
655
56e2e762
NC
656#ifndef SUBTARGET_REG_CLASS_CARRY
657#define SUBTARGET_REG_CLASS_CARRY 0
658#endif
659
660#ifndef SUBTARGET_REG_CLASS_ACCUM
661#define SUBTARGET_REG_CLASS_ACCUM 0
662#endif
663
664#ifndef SUBTARGET_REG_CLASS_GENERAL
665#define SUBTARGET_REG_CLASS_GENERAL 0
666#endif
667
668#ifndef SUBTARGET_REG_CLASS_ALL
669#define SUBTARGET_REG_CLASS_ALL 0
670#endif
8c5ca3b9 671
56e2e762
NC
672#define REG_CLASS_CONTENTS \
673{ \
674 { 0x00000 }, \
675 { 0x20000 | SUBTARGET_REG_CLASS_CARRY }, \
676 { 0x40000 | SUBTARGET_REG_CLASS_ACCUM }, \
677 { 0x1ffff | SUBTARGET_REG_CLASS_GENERAL }, \
678 { 0x7ffff | SUBTARGET_REG_CLASS_ALL }, \
679}
2b7972b0 680
8c5ca3b9
DE
681/* The same information, inverted:
682 Return the class number of the smallest class containing
683 reg number REGNO. This could be a conditional expression
684 or could index an array. */
2b7972b0 685extern enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER];
56e2e762 686#define REGNO_REG_CLASS(REGNO) (m32r_regno_reg_class[REGNO])
8c5ca3b9
DE
687
688/* The class value for index registers, and the one for base regs. */
689#define INDEX_REG_CLASS GENERAL_REGS
690#define BASE_REG_CLASS GENERAL_REGS
691
56e2e762
NC
692#define REG_CLASS_FROM_LETTER(C) \
693((C) == 'c' ? CARRY_REG \
694 : (C) == 'a' ? ACCUM_REGS \
695 : NO_REGS)
8c5ca3b9
DE
696
697/* These assume that REGNO is a hard or pseudo reg number.
698 They give nonzero only if REGNO is a hard reg of the suitable class
699 or a pseudo reg currently allocated to a suitable hard reg.
700 Since they use reg_renumber, they are safe only once reg_renumber
701 has been allocated, which happens in local-alloc.c. */
702#define REGNO_OK_FOR_BASE_P(REGNO) \
703((REGNO) < FIRST_PSEUDO_REGISTER \
704 ? GPR_P (REGNO) || (REGNO) == ARG_POINTER_REGNUM \
705 : GPR_P (reg_renumber[REGNO]))
706#define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_BASE_P(REGNO)
707
708/* Given an rtx X being reloaded into a reg required to be
709 in class CLASS, return the class of reg to actually use.
710 In general this is just CLASS; but on some machines
711 in some cases it is preferable to use a more restrictive class. */
712#define PREFERRED_RELOAD_CLASS(X,CLASS) \
713(CLASS)
714
715/* Return the maximum number of consecutive registers
716 needed to represent mode MODE in a register of class CLASS. */
717#define CLASS_MAX_NREGS(CLASS, MODE) \
718((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
719
720/* The letters I, J, K, L, M, N, O, P in a register constraint string
721 can be used to stand for particular ranges of immediate operands.
722 This macro defines what the ranges are.
723 C is the letter, and VALUE is a constant value.
724 Return 1 if VALUE is in the range specified by C. */
725/* 'I' is used for 8 bit signed immediates.
726 'J' is used for 16 bit signed immediates.
727 'K' is used for 16 bit unsigned immediates.
728 'L' is used for 16 bit immediates left shifted by 16 (sign ???).
729 'M' is used for 24 bit unsigned immediates.
730 'N' is used for any 32 bit non-symbolic value.
731 'O' is used for 5 bit unsigned immediates (shift count).
732 'P' is used for 16 bit signed immediates for compares
733 (values in the range -32767 to +32768). */
734
56e2e762
NC
735/* Return true if a value is inside a range. */
736#define IN_RANGE_P(VALUE, LOW, HIGH) \
737 (((unsigned HOST_WIDE_INT)((VALUE) - (LOW))) \
738 <= ((unsigned HOST_WIDE_INT)((HIGH) - (LOW))))
739
740/* Local to this file. */
40cae311
RH
741#define INT8_P(X) ((X) >= -0x80 && (X) <= 0x7f)
742#define INT16_P(X) ((X) >= -0x8000 && (X) <= 0x7fff)
743#define CMP_INT16_P(X) ((X) >= -0x7fff && (X) <= 0x8000)
40cae311
RH
744#define UPPER16_P(X) (((X) & 0xffff) == 0 \
745 && ((X) >> 16) >= -0x8000 \
746 && ((X) >> 16) <= 0x7fff)
16f104b3
NC
747#define UINT16_P(X) (((unsigned HOST_WIDE_INT) (X)) <= 0x0000ffff)
748#define UINT24_P(X) (((unsigned HOST_WIDE_INT) (X)) <= 0x00ffffff)
749#define UINT32_P(X) (((unsigned HOST_WIDE_INT) (X)) <= 0xffffffff)
750#define UINT5_P(X) ((X) >= 0 && (X) < 32)
5b8ae21f 751#define INVERTED_SIGNED_8BIT(VAL) ((VAL) >= -127 && (VAL) <= 128)
8c5ca3b9 752
5b8ae21f
MM
753#define CONST_OK_FOR_LETTER_P(VALUE, C) \
754((C) == 'I' ? INT8_P (VALUE) \
755 : (C) == 'J' ? INT16_P (VALUE) \
756 : (C) == 'K' ? UINT16_P (VALUE) \
757 : (C) == 'L' ? UPPER16_P (VALUE) \
758 : (C) == 'M' ? UINT24_P (VALUE) \
759 : (C) == 'N' ? INVERTED_SIGNED_8BIT (VALUE) \
760 : (C) == 'O' ? UINT5_P (VALUE) \
761 : (C) == 'P' ? CMP_INT16_P (VALUE) \
8c5ca3b9
DE
762 : 0)
763
764/* Similar, but for floating constants, and defining letters G and H.
765 Here VALUE is the CONST_DOUBLE rtx itself.
766 For the m32r, handle a few constants inline.
767 ??? We needn't treat DI and DF modes differently, but for now we do. */
768#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
5b8ae21f
MM
769((C) == 'G' ? easy_di_const (VALUE) \
770 : (C) == 'H' ? easy_df_const (VALUE) \
8c5ca3b9
DE
771 : 0)
772
773/* A C expression that defines the optional machine-dependent constraint
774 letters that can be used to segregate specific types of operands,
775 usually memory references, for the target machine. It should return 1 if
776 VALUE corresponds to the operand type represented by the constraint letter
777 C. If C is not defined as an extra constraint, the value returned should
778 be 0 regardless of VALUE. */
779/* Q is for symbolic addresses loadable with ld24.
2b7972b0 780 R is for symbolic addresses when ld24 can't be used.
56e2e762 781 S is for stores with pre {inc,dec}rement
5b8ae21f 782 T is for indirect of a pointer.
56e2e762 783 U is for loads with post increment. */
5b8ae21f
MM
784
785#define EXTRA_CONSTRAINT(VALUE, C) \
56e2e762
NC
786( (C) == 'Q' ? ((TARGET_ADDR24 && GET_CODE (VALUE) == LABEL_REF) \
787 || addr24_operand (VALUE, VOIDmode)) \
788 : (C) == 'R' ? ((TARGET_ADDR32 && GET_CODE (VALUE) == LABEL_REF) \
789 || addr32_operand (VALUE, VOIDmode)) \
790 : (C) == 'S' ? (GET_CODE (VALUE) == MEM \
791 && STORE_PREINC_PREDEC_P (GET_MODE (VALUE), \
792 XEXP (VALUE, 0))) \
793 : (C) == 'T' ? (GET_CODE (VALUE) == MEM \
794 && memreg_operand (VALUE, GET_MODE (VALUE))) \
795 : (C) == 'U' ? (GET_CODE (VALUE) == MEM \
796 && LOAD_POSTINC_P (GET_MODE (VALUE), \
797 XEXP (VALUE, 0))) \
8c5ca3b9
DE
798 : 0)
799\f
800/* Stack layout and stack pointer usage. */
801
802/* Define this macro if pushing a word onto the stack moves the stack
803 pointer to a smaller address. */
804#define STACK_GROWS_DOWNWARD
805
806/* Define this if the nominal address of the stack frame
807 is at the high-address end of the local variables;
808 that is, each additional local variable allocated
809 goes at a more negative offset from the frame pointer. */
810/*#define FRAME_GROWS_DOWNWARD*/
811
812/* Offset from frame pointer to start allocating local variables at.
813 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
814 first local allocated. Otherwise, it is the offset to the BEGINNING
815 of the first local allocated. */
816/* The frame pointer points at the same place as the stack pointer, except if
817 alloca has been called. */
818#define STARTING_FRAME_OFFSET \
819M32R_STACK_ALIGN (current_function_outgoing_args_size)
820
821/* Offset from the stack pointer register to the first location at which
822 outgoing arguments are placed. */
823#define STACK_POINTER_OFFSET 0
824
825/* Offset of first parameter from the argument pointer register value. */
826#define FIRST_PARM_OFFSET(FNDECL) 0
827
828/* A C expression whose value is RTL representing the address in a
829 stack frame where the pointer to the caller's frame is stored.
830 Assume that FRAMEADDR is an RTL expression for the address of the
831 stack frame itself.
832
833 If you don't define this macro, the default is to return the value
834 of FRAMEADDR--that is, the stack frame address is also the address
835 of the stack word that points to the previous frame. */
836/*define DYNAMIC_CHAIN_ADDRESS (FRAMEADDR)*/
837
838/* A C expression whose value is RTL representing the value of the
839 return address for the frame COUNT steps up from the current frame.
840 FRAMEADDR is the frame pointer of the COUNT frame, or the frame
841 pointer of the COUNT - 1 frame if `RETURN_ADDR_IN_PREVIOUS_FRAME'
842 is defined. */
843/* The current return address is in r14. */
844#if 0 /* The default value should work. */
845#define RETURN_ADDR_RTX(COUNT, FRAME) \
c5c76735
JL
846(((COUNT) == -1) \
847 ? gen_rtx_REG (Pmode, 14) \
848 : copy_to_reg (gen_rtx_MEM (Pmode, \
849 memory_address (Pmode, \
850 plus_constant ((FRAME), \
851 UNITS_PER_WORD)))))
8c5ca3b9
DE
852#endif
853
854/* Register to use for pushing function arguments. */
855#define STACK_POINTER_REGNUM 15
856
857/* Base register for access to local variables of the function. */
858#define FRAME_POINTER_REGNUM 13
859
860/* Base register for access to arguments of the function. */
861#define ARG_POINTER_REGNUM 16
862
863/* The register number of the return address pointer register, which
864 is used to access the current function's return address from the
865 stack. On some machines, the return address is not at a fixed
866 offset from the frame pointer or stack pointer or argument
867 pointer. This register can be defined to point to the return
868 address on the stack, and then be converted by `ELIMINABLE_REGS'
869 into either the frame pointer or stack pointer.
870
871 Do not define this macro unless there is no other way to get the
872 return address from the stack. */
18543a22 873/* ??? revisit */
8c5ca3b9
DE
874/* #define RETURN_ADDRESS_POINTER_REGNUM */
875
876/* Register in which static-chain is passed to a function. This must
877 not be a register used by the prologue. */
878#define STATIC_CHAIN_REGNUM 7
879
880/* These aren't official macros. */
881#define PROLOGUE_TMP_REGNUM 4
882#define RETURN_ADDR_REGNUM 14
883/* #define GP_REGNUM 12 */
884#define CARRY_REGNUM 17
56e2e762 885#define ACCUM_REGNUM 18
8c5ca3b9
DE
886#define M32R_MAX_INT_REGS 16
887
56e2e762
NC
888#ifndef SUBTARGET_GPR_P
889#define SUBTARGET_GPR_P(REGNO) 0
890#endif
891
892#ifndef SUBTARGET_ACCUM_P
893#define SUBTARGET_ACCUM_P(REGNO) 0
894#endif
895
896#ifndef SUBTARGET_CARRY_P
897#define SUBTARGET_CARRY_P(REGNO) 0
898#endif
899
900#define GPR_P(REGNO) (IN_RANGE_P ((REGNO), 0, 15) || SUBTARGET_GPR_P (REGNO))
901#define ACCUM_P(REGNO) ((REGNO) == ACCUM_REGNUM || SUBTARGET_ACCUM_P (REGNO))
902#define CARRY_P(REGNO) ((REGNO) == CARRY_REGNUM || SUBTARGET_CARRY_P (REGNO))
8c5ca3b9
DE
903\f
904/* Eliminating the frame and arg pointers. */
905
906/* A C expression which is nonzero if a function must have and use a
907 frame pointer. This expression is evaluated in the reload pass.
908 If its value is nonzero the function will have a frame pointer. */
56e2e762 909#define FRAME_POINTER_REQUIRED current_function_calls_alloca
8c5ca3b9
DE
910
911#if 0
912/* C statement to store the difference between the frame pointer
913 and the stack pointer values immediately after the function prologue.
914 If `ELIMINABLE_REGS' is defined, this macro will be not be used and
915 need not be defined. */
916#define INITIAL_FRAME_POINTER_OFFSET(VAR) \
917((VAR) = m32r_compute_frame_size (get_frame_size ()))
918#endif
919
920/* If defined, this macro specifies a table of register pairs used to
921 eliminate unneeded registers that point into the stack frame. If
922 it is not defined, the only elimination attempted by the compiler
923 is to replace references to the frame pointer with references to
924 the stack pointer.
925
926 Note that the elimination of the argument pointer with the stack
927 pointer is specified first since that is the preferred elimination. */
928
56e2e762
NC
929#define ELIMINABLE_REGS \
930{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
931 { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
932 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }}
8c5ca3b9
DE
933
934/* A C expression that returns non-zero if the compiler is allowed to
935 try to replace register number FROM-REG with register number
936 TO-REG. This macro need only be defined if `ELIMINABLE_REGS' is
937 defined, and will usually be the constant 1, since most of the
938 cases preventing register elimination are things that the compiler
939 already knows about. */
940
56e2e762
NC
941#define CAN_ELIMINATE(FROM, TO) \
942 ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
943 ? ! frame_pointer_needed \
944 : 1)
8c5ca3b9
DE
945
946/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
947 specifies the initial difference between the specified pair of
948 registers. This macro must be defined if `ELIMINABLE_REGS' is
949 defined. */
950
951#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
952{ \
953 int size = m32r_compute_frame_size (get_frame_size ()); \
954 \
955 if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
956 (OFFSET) = 0; \
957 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
958 (OFFSET) = size - current_function_pretend_args_size; \
959 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
960 (OFFSET) = size - current_function_pretend_args_size; \
961 else \
962 abort (); \
963}
964\f
965/* Function argument passing. */
966
967/* When a prototype says `char' or `short', really pass an `int'. */
cb560352 968#define PROMOTE_PROTOTYPES 1
8c5ca3b9
DE
969
970/* If defined, the maximum amount of space required for outgoing
971 arguments will be computed and placed into the variable
972 `current_function_outgoing_args_size'. No space will be pushed
973 onto the stack for each call; instead, the function prologue should
974 increase the stack frame size by this amount. */
f73ad30e 975#define ACCUMULATE_OUTGOING_ARGS 1
8c5ca3b9
DE
976
977/* Define this macro if functions should assume that stack space has
978 been allocated for arguments even when their values are passed in
979 registers.
980
981 The value of this macro is the size, in bytes, of the area
982 reserved for arguments passed in registers for the function
983 represented by FNDECL.
984
985 This space can be allocated by the caller, or be a part of the
986 machine-dependent stack frame: `OUTGOING_REG_PARM_STACK_SPACE' says
987 which. */
988#if 0
989#define REG_PARM_STACK_SPACE(FNDECL) \
56e2e762 990 (M32R_MAX_PARM_REGS * UNITS_PER_WORD)
8c5ca3b9
DE
991#endif
992
993/* Value is the number of bytes of arguments automatically
994 popped when returning from a subroutine call.
995 FUNDECL is the declaration node of the function (as a tree),
996 FUNTYPE is the data type of the function (as a tree),
997 or for a library call it is an identifier node for the subroutine name.
998 SIZE is the number of bytes of arguments passed on the stack. */
999#define RETURN_POPS_ARGS(DECL, FUNTYPE, SIZE) 0
1000
4abfe235 1001/* Nonzero if we do not know how to pass TYPE solely in registers. */
56e2e762 1002#define MUST_PASS_IN_STACK(MODE, TYPE) \
4abfe235
NC
1003 ((TYPE) != 0 \
1004 && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \
1005 || TREE_ADDRESSABLE (TYPE)))
1006
8c5ca3b9
DE
1007/* Define a data type for recording info about an argument list
1008 during the scan of that argument list. This data type should
1009 hold all necessary information about the function itself
1010 and about the args processed so far, enough to enable macros
1011 such as FUNCTION_ARG to determine where the next arg should go. */
1012#define CUMULATIVE_ARGS int
1013
1014/* Initialize a variable CUM of type CUMULATIVE_ARGS
1015 for a call to a function whose data type is FNTYPE.
1016 For a library call, FNTYPE is 0. */
56e2e762
NC
1017#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \
1018 ((CUM) = 0)
8c5ca3b9
DE
1019
1020/* The number of registers used for parameter passing. Local to this file. */
1021#define M32R_MAX_PARM_REGS 4
1022
1023/* 1 if N is a possible register number for function argument passing. */
1024#define FUNCTION_ARG_REGNO_P(N) \
56e2e762 1025 ((unsigned) (N) < M32R_MAX_PARM_REGS)
8c5ca3b9
DE
1026
1027/* The ROUND_ADVANCE* macros are local to this file. */
1028/* Round SIZE up to a word boundary. */
1029#define ROUND_ADVANCE(SIZE) \
56e2e762 1030 (((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
8c5ca3b9
DE
1031
1032/* Round arg MODE/TYPE up to the next word boundary. */
1033#define ROUND_ADVANCE_ARG(MODE, TYPE) \
56e2e762 1034 ((MODE) == BLKmode \
16f104b3 1035 ? ROUND_ADVANCE ((unsigned int) int_size_in_bytes (TYPE)) \
56e2e762 1036 : ROUND_ADVANCE (GET_MODE_SIZE (MODE)))
8c5ca3b9
DE
1037
1038/* Round CUM up to the necessary point for argument MODE/TYPE. */
8c5ca3b9 1039#define ROUND_ADVANCE_CUM(CUM, MODE, TYPE) (CUM)
8c5ca3b9
DE
1040
1041/* Return boolean indicating arg of type TYPE and mode MODE will be passed in
1042 a reg. This includes arguments that have to be passed by reference as the
1043 pointer to them is passed in a reg if one is available (and that is what
1044 we're given).
1045 This macro is only used in this file. */
1046#define PASS_IN_REG_P(CUM, MODE, TYPE, NAMED) \
56e2e762 1047 (ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) < M32R_MAX_PARM_REGS)
8c5ca3b9
DE
1048
1049/* Determine where to put an argument to a function.
1050 Value is zero to push the argument on the stack,
1051 or a hard register in which to store the argument.
1052
1053 MODE is the argument's machine mode.
1054 TYPE is the data type of the argument (as a tree).
1055 This is null for libcalls where that information may
1056 not be available.
1057 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1058 the preceding args and about the function being called.
1059 NAMED is nonzero if this argument is a named parameter
1060 (otherwise it is an extra parameter matching an ellipsis). */
1061/* On the M32R the first M32R_MAX_PARM_REGS args are normally in registers
1062 and the rest are pushed. */
1063#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
56e2e762
NC
1064 (PASS_IN_REG_P ((CUM), (MODE), (TYPE), (NAMED)) \
1065 ? gen_rtx_REG ((MODE), ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE))) \
1066 : 0)
8c5ca3b9 1067
18543a22 1068/* ??? Quick hack to try to get varargs working the normal way. */
8c5ca3b9 1069#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
56e2e762
NC
1070 (((! current_function_varargs || (NAMED)) \
1071 && PASS_IN_REG_P ((CUM), (MODE), (TYPE), (NAMED))) \
1072 ? gen_rtx_REG ((MODE), ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE))) \
1073 : 0)
8c5ca3b9
DE
1074
1075/* A C expression for the number of words, at the beginning of an
1076 argument, must be put in registers. The value must be zero for
1077 arguments that are passed entirely in registers or that are entirely
1078 pushed on the stack.
1079
1080 On some machines, certain arguments must be passed partially in
1081 registers and partially in memory. On these machines, typically the
1082 first @var{n} words of arguments are passed in registers, and the rest
1083 on the stack. If a multi-word argument (a @code{double} or a
1084 structure) crosses that boundary, its first few words must be passed
1085 in registers and the rest must be pushed. This macro tells the
1086 compiler when this occurs, and how many of the words should go in
1087 registers. */
1088#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
2b7972b0 1089 function_arg_partial_nregs (&CUM, (int)MODE, TYPE, NAMED)
8c5ca3b9
DE
1090
1091/* A C expression that indicates when an argument must be passed by
1092 reference. If nonzero for an argument, a copy of that argument is
1093 made in memory and a pointer to the argument is passed instead of
1094 the argument itself. The pointer is passed in whatever way is
1095 appropriate for passing a pointer to that type. */
1096/* All arguments greater than 8 bytes are passed this way. */
1097#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
56e2e762 1098 ((TYPE) && int_size_in_bytes (TYPE) > 8)
8c5ca3b9
DE
1099
1100/* Update the data in CUM to advance over an argument
1101 of mode MODE and data type TYPE.
1102 (TYPE is null for libcalls where that information may not be available.) */
1103#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
56e2e762 1104 ((CUM) = (ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) \
8c5ca3b9
DE
1105 + ROUND_ADVANCE_ARG ((MODE), (TYPE))))
1106
1107/* If defined, a C expression that gives the alignment boundary, in bits,
1108 of an argument with the specified mode and type. If it is not defined,
1109 PARM_BOUNDARY is used for all arguments. */
1110#if 0
1111/* We assume PARM_BOUNDARY == UNITS_PER_WORD here. */
1112#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
1113(((TYPE) ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) <= PARM_BOUNDARY \
1114 ? PARM_BOUNDARY \
1115 : 2 * PARM_BOUNDARY)
1116#endif
1117
8c5ca3b9
DE
1118/* This macro offers an alternative
1119 to using `__builtin_saveregs' and defining the macro
1120 `EXPAND_BUILTIN_SAVEREGS'. Use it to store the anonymous register
1121 arguments into the stack so that all the arguments appear to have
1122 been passed consecutively on the stack. Once this is done, you
1123 can use the standard implementation of varargs that works for
1124 machines that pass all their arguments on the stack.
1125
1126 The argument ARGS_SO_FAR is the `CUMULATIVE_ARGS' data structure,
1127 containing the values that obtain after processing of the named
1128 arguments. The arguments MODE and TYPE describe the last named
1129 argument--its machine mode and its data type as a tree node.
1130
1131 The macro implementation should do two things: first, push onto the
1132 stack all the argument registers *not* used for the named
1133 arguments, and second, store the size of the data thus pushed into
1134 the `int'-valued variable whose name is supplied as the argument
1135 PRETEND_SIZE. The value that you store here will serve as
1136 additional offset for setting up the stack frame.
1137
1138 If the argument NO_RTL is nonzero, it means that the
1139 arguments of the function are being analyzed for the second time.
1140 This happens for an inline function, which is not actually
1141 compiled until the end of the source file. The macro
1142 `SETUP_INCOMING_VARARGS' should not generate any instructions in
1143 this case. */
1144
1145#define SETUP_INCOMING_VARARGS(ARGS_SO_FAR, MODE, TYPE, PRETEND_SIZE, NO_RTL) \
56e2e762 1146 m32r_setup_incoming_varargs (&ARGS_SO_FAR, MODE, TYPE, &PRETEND_SIZE, NO_RTL)
40cae311
RH
1147
1148/* Implement `va_arg'. */
1149#define EXPAND_BUILTIN_VA_ARG(valist, type) \
1150 m32r_va_arg (valist, type)
8c5ca3b9
DE
1151\f
1152/* Function results. */
1153
1154/* Define how to find the value returned by a function.
1155 VALTYPE is the data type of the value (as a tree).
1156 If the precise function being called is known, FUNC is its FUNCTION_DECL;
1157 otherwise, FUNC is 0. */
c5c76735 1158#define FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx_REG (TYPE_MODE (VALTYPE), 0)
8c5ca3b9
DE
1159
1160/* Define how to find the value returned by a library function
1161 assuming the value has mode MODE. */
c5c76735 1162#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, 0)
8c5ca3b9
DE
1163
1164/* 1 if N is a possible register number for a function value
1165 as seen by the caller. */
1166/* ??? What about r1 in DI/DF values. */
1167#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
1168
1169/* A C expression which can inhibit the returning of certain function
1170 values in registers, based on the type of value. A nonzero value says
1171 to return the function value in memory, just as large structures are
1172 always returned. Here TYPE will be a C expression of type `tree',
1173 representing the data type of the value. */
1174#define RETURN_IN_MEMORY(TYPE) \
1175(int_size_in_bytes (TYPE) > 8)
1176
1177/* Tell GCC to use RETURN_IN_MEMORY. */
1178#define DEFAULT_PCC_STRUCT_RETURN 0
1179
1180/* Register in which address to store a structure value
1181 is passed to a function, or 0 to use `invisible' first argument. */
1182#define STRUCT_VALUE 0
1183\f
1184/* Function entry and exit. */
1185
1186/* Initialize data used by insn expanders. This is called from
1187 init_emit, once for each function, before code is generated. */
1188#define INIT_EXPANDERS m32r_init_expanders ()
1189
8c5ca3b9
DE
1190/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1191 the stack pointer does not matter. The value is tested only in
1192 functions that have frame pointers.
1193 No definition is equivalent to always zero. */
1194#define EXIT_IGNORE_STACK 1
1195
8c5ca3b9
DE
1196/* Output assembler code to FILE to increment profiler label # LABELNO
1197 for profiling a function entry. */
5b8ae21f 1198#define FUNCTION_PROFILER(FILE, LABELNO) abort ()
8c5ca3b9
DE
1199\f
1200/* Trampolines. */
1201
1202/* On the M32R, the trampoline is
1203
1204 ld24 r7,STATIC
1205 ld24 r6,FUNCTION
1206 jmp r6
1207 nop
1208
18543a22 1209 ??? Need addr32 support.
8c5ca3b9
DE
1210*/
1211
1212/* Length in bytes of the trampoline for entering a nested function. */
1213#define TRAMPOLINE_SIZE 12
1214
1215/* Emit RTL insns to initialize the variable parts of a trampoline.
1216 FNADDR is an RTX for the address of the function's pure code.
1217 CXT is an RTX for the static chain value for the function. */
1218#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1219do { \
c5c76735 1220 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 0)), \
8c5ca3b9 1221 plus_constant ((CXT), 0xe7000000)); \
c5c76735 1222 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 4)), \
8c5ca3b9 1223 plus_constant ((FNADDR), 0xe6000000)); \
c5c76735 1224 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 8)), \
8c5ca3b9 1225 GEN_INT (0x1fc67000)); \
c5c76735 1226 emit_insn (gen_flush_icache (validize_mem (gen_rtx_MEM (SImode, TRAMP)))); \
8c5ca3b9
DE
1227} while (0)
1228\f
1229/* Library calls. */
1230
1231/* Generate calls to memcpy, memcmp and memset. */
1232#define TARGET_MEM_FUNCTIONS
1233\f
1234/* Addressing modes, and classification of registers for them. */
1235
1236/* Maximum number of registers that can appear in a valid memory address. */
1237#define MAX_REGS_PER_ADDRESS 1
1238
1239/* We have post-inc load and pre-dec,pre-inc store,
1240 but only for 4 byte vals. */
940da324
JL
1241#define HAVE_PRE_DECREMENT 1
1242#define HAVE_PRE_INCREMENT 1
1243#define HAVE_POST_INCREMENT 1
8c5ca3b9
DE
1244
1245/* Recognize any constant value that is a valid address. */
1246#define CONSTANT_ADDRESS_P(X) \
1247(GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1248 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST)
1249
1250/* Nonzero if the constant value X is a legitimate general operand.
1251 We don't allow (plus symbol large-constant) as the relocations can't
1252 describe it. INTVAL > 32767 handles both 16 bit and 24 bit relocations.
1253 We allow all CONST_DOUBLE's as the md file patterns will force the
1254 constant to memory if they can't handle them. */
1255
56e2e762
NC
1256#define LEGITIMATE_CONSTANT_P(X) \
1257(! (GET_CODE (X) == CONST \
1258 && GET_CODE (XEXP (X, 0)) == PLUS \
1259 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF \
1260 && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
8c5ca3b9
DE
1261 && (unsigned HOST_WIDE_INT) INTVAL (XEXP (XEXP (X, 0), 1)) > 32767))
1262
1263/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1264 and check its validity for a certain class.
1265 We have two alternate definitions for each of them.
1266 The usual definition accepts all pseudo regs; the other rejects
1267 them unless they have been allocated suitable hard regs.
1268 The symbol REG_OK_STRICT causes the latter definition to be used.
1269
1270 Most source files want to accept pseudo regs in the hope that
1271 they will get allocated to the class that the insn wants them to be in.
1272 Source files for reload pass need to be strict.
1273 After reload, it makes no difference, since pseudo regs have
1274 been eliminated by then. */
1275
1276#ifdef REG_OK_STRICT
1277
1278/* Nonzero if X is a hard reg that can be used as a base reg. */
1279#define REG_OK_FOR_BASE_P(X) GPR_P (REGNO (X))
1280/* Nonzero if X is a hard reg that can be used as an index. */
1281#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
1282
1283#else
1284
1285/* Nonzero if X is a hard reg that can be used as a base reg
1286 or if it is a pseudo reg. */
56e2e762 1287#define REG_OK_FOR_BASE_P(X) \
8c5ca3b9
DE
1288(GPR_P (REGNO (X)) \
1289 || (REGNO (X)) == ARG_POINTER_REGNUM \
1290 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1291/* Nonzero if X is a hard reg that can be used as an index
1292 or if it is a pseudo reg. */
1293#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
1294
1295#endif
1296
1297/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1298 that is a valid memory address for an instruction.
1299 The MODE argument is the machine mode for the MEM expression
1300 that wants to use this address. */
1301
56e2e762
NC
1302/* Local to this file. */
1303#define RTX_OK_FOR_BASE_P(X) (REG_P (X) && REG_OK_FOR_BASE_P (X))
8c5ca3b9 1304
56e2e762 1305/* Local to this file. */
8c5ca3b9
DE
1306#define RTX_OK_FOR_OFFSET_P(X) \
1307(GET_CODE (X) == CONST_INT && INT16_P (INTVAL (X)))
1308
56e2e762 1309/* Local to this file. */
5b8ae21f
MM
1310#define LEGITIMATE_OFFSET_ADDRESS_P(MODE, X) \
1311(GET_CODE (X) == PLUS \
1312 && RTX_OK_FOR_BASE_P (XEXP (X, 0)) \
8c5ca3b9
DE
1313 && RTX_OK_FOR_OFFSET_P (XEXP (X, 1)))
1314
56e2e762 1315/* Local to this file. */
5b8ae21f
MM
1316/* For LO_SUM addresses, do not allow them if the MODE is > 1 word,
1317 since more than one instruction will be required. */
1318#define LEGITIMATE_LO_SUM_ADDRESS_P(MODE, X) \
1319(GET_CODE (X) == LO_SUM \
1320 && (MODE != BLKmode && GET_MODE_SIZE (MODE) <= UNITS_PER_WORD) \
1321 && RTX_OK_FOR_BASE_P (XEXP (X, 0)) \
8c5ca3b9
DE
1322 && CONSTANT_P (XEXP (X, 1)))
1323
56e2e762
NC
1324/* Local to this file. */
1325/* Is this a load and increment operation. */
1326#define LOAD_POSTINC_P(MODE, X) \
1327(((MODE) == SImode || (MODE) == SFmode) \
1328 && GET_CODE (X) == POST_INC \
1329 && GET_CODE (XEXP (X, 0)) == REG \
1330 && RTX_OK_FOR_BASE_P (XEXP (X, 0)))
1331
1332/* Local to this file. */
1333/* Is this a increment/decrement and store operation. */
1334#define STORE_PREINC_PREDEC_P(MODE, X) \
1335(((MODE) == SImode || (MODE) == SFmode) \
1336 && (GET_CODE (X) == PRE_INC || GET_CODE (X) == PRE_DEC) \
1337 && GET_CODE (XEXP (X, 0)) == REG \
1338 && RTX_OK_FOR_BASE_P (XEXP (X, 0)))
5b8ae21f
MM
1339
1340#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1341{ if (RTX_OK_FOR_BASE_P (X)) \
1342 goto ADDR; \
1343 if (LEGITIMATE_OFFSET_ADDRESS_P ((MODE), (X))) \
1344 goto ADDR; \
1345 if (LEGITIMATE_LO_SUM_ADDRESS_P ((MODE), (X))) \
1346 goto ADDR; \
56e2e762
NC
1347 if (LOAD_POSTINC_P ((MODE), (X))) \
1348 goto ADDR; \
1349 if (STORE_PREINC_PREDEC_P ((MODE), (X))) \
5b8ae21f 1350 goto ADDR; \
8c5ca3b9
DE
1351}
1352
1353/* Try machine-dependent ways of modifying an illegitimate address
1354 to be legitimate. If we find one, return the new, valid address.
1355 This macro is used in only one place: `memory_address' in explow.c.
1356
1357 OLDX is the address as it was before break_out_memory_refs was called.
1358 In some cases it is useful to look at this to decide what needs to be done.
1359
1360 MODE and WIN are passed so that this macro can use
1361 GO_IF_LEGITIMATE_ADDRESS.
1362
1363 It is always safe for this macro to do nothing. It exists to recognize
1364 opportunities to optimize the output.
1365
1366 ??? Is there anything useful we can do here for the M32R? */
1367
1368#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN)
1369
1370/* Go to LABEL if ADDR (a legitimate address expression)
1371 has an effect that depends on the machine mode it is used for. */
5b8ae21f
MM
1372#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) \
1373do { \
1374 if (GET_CODE (ADDR) == PRE_DEC \
1375 || GET_CODE (ADDR) == PRE_INC \
1376 || GET_CODE (ADDR) == POST_INC \
1377 || GET_CODE (ADDR) == LO_SUM) \
1378 goto LABEL; \
8c5ca3b9
DE
1379} while (0)
1380\f
1381/* Condition code usage. */
1382
1383/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
1384 return the mode to be used for the comparison. */
8c5ca3b9 1385#define SELECT_CC_MODE(OP, X, Y) \
2b7972b0 1386((enum machine_mode)m32r_select_cc_mode ((int)OP, X, Y))
8c5ca3b9
DE
1387
1388/* Return non-zero if SELECT_CC_MODE will never return MODE for a
1389 floating point inequality comparison. */
18543a22 1390#define REVERSIBLE_CC_MODE(MODE) 1 /*???*/
8c5ca3b9
DE
1391\f
1392/* Costs. */
1393
1394/* ??? I'm quite sure I don't understand enough of the subtleties involved
1395 in choosing the right numbers to use here, but there doesn't seem to be
1396 enough documentation on this. What I've done is define an insn to cost
1397 4 "units" and work from there. COSTS_N_INSNS (N) is defined as (N) * 4 - 2
1398 so that seems reasonable. Some values are supposed to be defined relative
1399 to each other and thus aren't necessarily related to COSTS_N_INSNS. */
1400
1401/* Compute the cost of computing a constant rtl expression RTX
1402 whose rtx-code is CODE. The body of this macro is a portion
1403 of a switch statement. If the code is computed here,
1404 return it with a return statement. Otherwise, break from the switch. */
1405/* Small integers are as cheap as registers. 4 byte values can be fetched
1406 as immediate constants - let's give that the cost of an extra insn. */
56e2e762 1407#define CONST_COSTS(X, CODE, OUTER_CODE) \
8c5ca3b9
DE
1408 case CONST_INT : \
1409 if (INT16_P (INTVAL (X))) \
1410 return 0; \
1411 /* fall through */ \
1412 case CONST : \
1413 case LABEL_REF : \
1414 case SYMBOL_REF : \
1415 return 4; \
1416 case CONST_DOUBLE : \
1417 { \
1418 rtx high, low; \
1419 split_double (X, &high, &low); \
1420 return 4 * (!INT16_P (INTVAL (high)) \
1421 + !INT16_P (INTVAL (low))); \
1422 }
1423
1424/* Compute the cost of an address. */
1425#define ADDRESS_COST(ADDR) m32r_address_cost (ADDR)
1426
1427/* Compute extra cost of moving data between one register class
1428 and another. */
cf011243 1429#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) 2
8c5ca3b9
DE
1430
1431/* Compute the cost of moving data between registers and memory. */
1432/* Memory is 3 times as expensive as registers.
1433 ??? Is that the right way to look at it? */
5b8ae21f 1434#define MEMORY_MOVE_COST(MODE,CLASS,IN_P) \
8c5ca3b9
DE
1435(GET_MODE_SIZE (MODE) <= UNITS_PER_WORD ? 6 : 12)
1436
1437/* The cost of a branch insn. */
1438/* A value of 2 here causes GCC to avoid using branches in comparisons like
1439 while (a < N && a). Branches aren't that expensive on the M32R so
1440 we define this as 1. Defining it as 2 had a heavy hit in fp-bit.c. */
56e2e762 1441#define BRANCH_COST ((TARGET_BRANCH_COST) ? 2 : 1)
8c5ca3b9
DE
1442
1443/* Provide the costs of a rtl expression. This is in the body of a
1444 switch on CODE. The purpose for the cost of MULT is to encourage
1445 `synth_mult' to find a synthetic multiply when reasonable.
1446
1447 If we need more than 12 insns to do a multiply, then go out-of-line,
1448 since the call overhead will be < 10% of the cost of the multiply. */
56e2e762
NC
1449#define RTX_COSTS(X, CODE, OUTER_CODE) \
1450 case MULT : \
1451 return COSTS_N_INSNS (3); \
1452 case DIV : \
1453 case UDIV : \
1454 case MOD : \
1455 case UMOD : \
1456 return COSTS_N_INSNS (10);
8c5ca3b9
DE
1457
1458/* Nonzero if access to memory by bytes is slow and undesirable.
1459 For RISC chips, it means that access to memory by bytes is no
1460 better than access by words when possible, so grab a whole word
1461 and maybe make use of that. */
1462#define SLOW_BYTE_ACCESS 1
1463
1464/* Define this macro if it is as good or better to call a constant
1465 function address than to call an address kept in a register. */
8c5ca3b9
DE
1466#define NO_FUNCTION_CSE
1467
1468/* Define this macro if it is as good or better for a function to call
1469 itself with an explicit address than to call an address kept in a
1470 register. */
8c5ca3b9
DE
1471#define NO_RECURSIVE_FUNCTION_CSE
1472
2b7972b0
MM
1473/* When the `length' insn attribute is used, this macro specifies the
1474 value to be assigned to the address of the first insn in a
1475 function. If not specified, 0 is used. */
1476#define FIRST_INSN_ADDRESS m32r_first_insn_address ()
1477
8c5ca3b9
DE
1478\f
1479/* Section selection. */
1480
1481#define TEXT_SECTION_ASM_OP "\t.section .text"
1482#define DATA_SECTION_ASM_OP "\t.section .data"
1483#define RODATA_SECTION_ASM_OP "\t.section .rodata"
1484#define BSS_SECTION_ASM_OP "\t.section .bss"
1485#define SDATA_SECTION_ASM_OP "\t.section .sdata"
1486#define SBSS_SECTION_ASM_OP "\t.section .sbss"
1487/* This one is for svr4.h. */
56e2e762 1488#undef CONST_SECTION_ASM_OP
8c5ca3b9
DE
1489#define CONST_SECTION_ASM_OP "\t.section .rodata"
1490
1491/* A list of names for sections other than the standard two, which are
1492 `in_text' and `in_data'. You need not define this macro
1493 on a system with no other sections (that GCC needs to use). */
56e2e762 1494#undef EXTRA_SECTIONS
19652adf 1495#define EXTRA_SECTIONS in_sdata, in_sbss, in_const
8c5ca3b9
DE
1496
1497/* One or more functions to be defined in "varasm.c". These
1498 functions should do jobs analogous to those of `text_section' and
1499 `data_section', for your additional sections. Do not define this
1500 macro if you do not define `EXTRA_SECTIONS'. */
56e2e762
NC
1501#undef EXTRA_SECTION_FUNCTIONS
1502#define EXTRA_SECTION_FUNCTIONS \
1503 CONST_SECTION_FUNCTION \
56e2e762
NC
1504 SDATA_SECTION_FUNCTION \
1505 SBSS_SECTION_FUNCTION
8c5ca3b9 1506
2b7972b0 1507#define SDATA_SECTION_FUNCTION \
8c5ca3b9
DE
1508void \
1509sdata_section () \
1510{ \
1511 if (in_section != in_sdata) \
1512 { \
1513 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
1514 in_section = in_sdata; \
1515 } \
1516} \
1517
2b7972b0 1518#define SBSS_SECTION_FUNCTION \
8c5ca3b9
DE
1519void \
1520sbss_section () \
1521{ \
1522 if (in_section != in_sbss) \
1523 { \
1524 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
1525 in_section = in_sbss; \
1526 } \
1527} \
1528
1529/* A C statement or statements to switch to the appropriate section for
1530 output of EXP. You can assume that EXP is either a `VAR_DECL' node
1531 or a constant of some sort. RELOC indicates whether the initial value
1532 of EXP requires link-time relocations. */
56e2e762 1533#undef SELECT_SECTION
201556f0
JJ
1534#define SELECT_SECTION(EXP, RELOC, ALIGN) \
1535 m32r_select_section ((EXP), (RELOC))
8c5ca3b9
DE
1536
1537/* A C statement or statements to switch to the appropriate section for
1538 output of RTX in mode MODE. You can assume that RTX
1539 is some kind of constant in RTL. The argument MODE is redundant
1540 except in the case of a `const_int' rtx. Select the section by
1541 calling `text_section' or one of the alternatives for other
1542 sections.
1543
1544 Do not define this macro if you put all constants in the read-only
1545 data section. */
1546
1547#undef SELECT_RTX_SECTION
1548
1549/* Define this macro if jump tables (for tablejump insns) should be
1550 output in the text section, along with the assembler instructions.
1551 Otherwise, the readonly data section is used.
1552 This macro is irrelevant if there is no separate readonly data section. */
1553/*#define JUMP_TABLES_IN_TEXT_SECTION*/
1554
1555/* Define this macro if references to a symbol must be treated
1556 differently depending on something about the variable or
1557 function named by the symbol (such as what section it is in).
1558
1559 The macro definition, if any, is executed immediately after the
1560 rtl for DECL or other node is created.
1561 The value of the rtl will be a `mem' whose address is a
1562 `symbol_ref'.
1563
1564 The usual thing for this macro to do is to store a flag in the
1565 `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
1566 name string in the `symbol_ref' (if one bit is not enough
1567 information). */
1568
1569#define SDATA_FLAG_CHAR '@'
1570/* Small objects are recorded with no prefix for space efficiency since
1571 they'll be the most common. This isn't the case if the user passes
1572 -mmodel={medium|large} and one could choose to not mark symbols that
1573 are the default, but that complicates things. */
1574/*#define SMALL_FLAG_CHAR '#'*/
1575#define MEDIUM_FLAG_CHAR '%'
1576#define LARGE_FLAG_CHAR '&'
1577
1578#define SDATA_NAME_P(NAME) (*(NAME) == SDATA_FLAG_CHAR)
1579/*#define SMALL_NAME_P(NAME) (*(NAME) == SMALL_FLAG_CHAR)*/
0ebaa85d 1580#define SMALL_NAME_P(NAME) (! ENCODED_NAME_P (NAME) && ! LIT_NAME_P (NAME))
8c5ca3b9
DE
1581#define MEDIUM_NAME_P(NAME) (*(NAME) == MEDIUM_FLAG_CHAR)
1582#define LARGE_NAME_P(NAME) (*(NAME) == LARGE_FLAG_CHAR)
0ebaa85d
DE
1583/* For string literals, etc. */
1584#define LIT_NAME_P(NAME) ((NAME)[0] == '*' && (NAME)[1] == '.')
8c5ca3b9
DE
1585
1586#define ENCODED_NAME_P(SYMBOL_NAME) \
1587(SDATA_NAME_P (SYMBOL_NAME) \
1588 /*|| SMALL_NAME_P (SYMBOL_NAME)*/ \
1589 || MEDIUM_NAME_P (SYMBOL_NAME) \
1590 || LARGE_NAME_P (SYMBOL_NAME))
1591
8c5ca3b9
DE
1592#define ENCODE_SECTION_INFO(DECL) m32r_encode_section_info (DECL)
1593
1594/* Decode SYM_NAME and store the real name part in VAR, sans
1595 the characters that encode section info. Define this macro if
1596 ENCODE_SECTION_INFO alters the symbol's name string. */
0ebaa85d 1597/* Note that we have to handle symbols like "%*start". */
8c5ca3b9
DE
1598#define STRIP_NAME_ENCODING(VAR, SYMBOL_NAME) \
1599do { \
1600 (VAR) = (SYMBOL_NAME) + ENCODED_NAME_P (SYMBOL_NAME); \
1601 (VAR) += *(VAR) == '*'; \
1602} while (0)
1603\f
1604/* PIC */
1605
1606/* The register number of the register used to address a table of static
1607 data addresses in memory. In some cases this register is defined by a
1608 processor's ``application binary interface'' (ABI). When this macro
1609 is defined, RTL is generated for this register once, as with the stack
1610 pointer and frame pointer registers. If this macro is not defined, it
1611 is up to the machine-dependent files to allocate such a register (if
1612 necessary). */
1613/*#define PIC_OFFSET_TABLE_REGNUM 12*/
1614
1615/* Define this macro if the register defined by PIC_OFFSET_TABLE_REGNUM is
1616 clobbered by calls. Do not define this macro if PIC_OFFSET_TABLE_REGNUM
1617 is not defined. */
1618/* This register is call-saved on the M32R. */
1619/*#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED*/
1620
1621/* By generating position-independent code, when two different programs (A
1622 and B) share a common library (libC.a), the text of the library can be
1623 shared whether or not the library is linked at the same address for both
1624 programs. In some of these environments, position-independent code
1625 requires not only the use of different addressing modes, but also
1626 special code to enable the use of these addressing modes.
1627
1628 The FINALIZE_PIC macro serves as a hook to emit these special
1629 codes once the function is being compiled into assembly code, but not
1630 before. (It is not done before, because in the case of compiling an
1631 inline function, it would lead to multiple PIC prologues being
1632 included in functions which used inline functions and were compiled to
1633 assembly language.) */
1634
1635/*#define FINALIZE_PIC m32r_finalize_pic ()*/
1636
1637/* A C expression that is nonzero if X is a legitimate immediate
1638 operand on the target machine when generating position independent code.
1639 You can assume that X satisfies CONSTANT_P, so you need not
1640 check this. You can also assume `flag_pic' is true, so you need not
1641 check it either. You need not define this macro if all constants
1642 (including SYMBOL_REF) can be immediate operands when generating
1643 position independent code. */
1644/*#define LEGITIMATE_PIC_OPERAND_P(X)*/
1645\f
1646/* Control the assembler format that we output. */
1647
1648/* Output at beginning of assembler file. */
8c5ca3b9
DE
1649#define ASM_FILE_START(FILE) m32r_asm_file_start (FILE)
1650
1651/* A C string constant describing how to begin a comment in the target
1652 assembler language. The compiler assumes that the comment will
1653 end at the end of the line. */
1654#define ASM_COMMENT_START ";"
1655
1656/* Output to assembler file text saying following lines
1657 may contain character constants, extra white space, comments, etc. */
1658#define ASM_APP_ON ""
1659
1660/* Output to assembler file text saying following lines
1661 no longer contain unusual constructs. */
1662#define ASM_APP_OFF ""
1663
1664/* This is how to output an assembler line defining a `char' constant. */
56e2e762
NC
1665#define ASM_OUTPUT_CHAR(FILE, VALUE) \
1666 do \
1667 { \
1668 fprintf (FILE, "\t.byte\t"); \
1669 output_addr_const (FILE, (VALUE)); \
1670 fprintf (FILE, "\n"); \
1671 } \
1672 while (0)
8c5ca3b9
DE
1673
1674/* This is how to output an assembler line defining a `short' constant. */
56e2e762
NC
1675#define ASM_OUTPUT_SHORT(FILE, VALUE) \
1676 do \
1677 { \
1678 fprintf (FILE, "\t.hword\t"); \
1679 output_addr_const (FILE, (VALUE)); \
1680 fprintf (FILE, "\n"); \
1681 } \
1682 while (0)
8c5ca3b9
DE
1683
1684/* This is how to output an assembler line defining an `int' constant.
1685 We also handle symbol output here. */
56e2e762
NC
1686#define ASM_OUTPUT_INT(FILE, VALUE) \
1687 do \
1688 { \
1689 fprintf (FILE, "\t.word\t"); \
1690 output_addr_const (FILE, (VALUE)); \
1691 fprintf (FILE, "\n"); \
1692 } \
1693 while (0)
8c5ca3b9
DE
1694
1695/* This is how to output an assembler line defining a `float' constant. */
56e2e762
NC
1696#define ASM_OUTPUT_FLOAT(FILE, VALUE) \
1697 do \
1698 { \
1699 long t; \
1700 char str[30]; \
1701 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
1702 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
1703 fprintf (FILE, "\t.word\t0x%lx %s %s\n", \
1704 t, ASM_COMMENT_START, str); \
1705 } \
1706 while (0)
8c5ca3b9
DE
1707
1708/* This is how to output an assembler line defining a `double' constant. */
56e2e762
NC
1709#define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
1710 do \
1711 { \
1712 long t[2]; \
1713 char str[30]; \
1714 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
1715 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
1716 fprintf (FILE, "\t.word\t0x%lx %s %s\n\t.word\t0x%lx\n", \
1717 t[0], ASM_COMMENT_START, str, t[1]); \
1718 } \
1719 while (0)
8c5ca3b9
DE
1720
1721/* This is how to output an assembler line for a numeric constant byte. */
56e2e762 1722#define ASM_OUTPUT_BYTE(FILE, VALUE) \
016c8440 1723 fprintf (FILE, "%s0x%x\n", ASM_BYTE_OP, (VALUE))
8c5ca3b9 1724
8c5ca3b9
DE
1725/* This is how to output the definition of a user-level label named NAME,
1726 such as the label on a static function or variable NAME. */
1727/* On the M32R we need to ensure the next instruction starts on a 32 bit
1728 boundary [the previous insn must either be 2 16 bit insns or 1 32 bit]. */
56e2e762
NC
1729#define ASM_OUTPUT_LABEL(FILE, NAME) \
1730 do \
1731 { \
1732 assemble_name (FILE, NAME); \
1733 fputs (":\n", FILE); \
1734 } \
1735 while (0)
8c5ca3b9
DE
1736
1737/* This is how to output a command to make the user-level label named NAME
1738 defined for reference from other files. */
56e2e762
NC
1739#define ASM_GLOBALIZE_LABEL(FILE, NAME) \
1740 do \
1741 { \
1742 fputs ("\t.global\t", FILE); \
1743 assemble_name (FILE, NAME); \
1744 fputs ("\n", FILE); \
1745 } \
1746 while (0)
8c5ca3b9
DE
1747
1748/* This is how to output a reference to a user-level label named NAME.
1749 `assemble_name' uses this. */
56e2e762
NC
1750#undef ASM_OUTPUT_LABELREF
1751#define ASM_OUTPUT_LABELREF(FILE, NAME) \
1752 do \
1753 { \
1754 const char * real_name; \
1755 STRIP_NAME_ENCODING (real_name, (NAME)); \
1756 asm_fprintf (FILE, "%U%s", real_name); \
1757 } \
1758 while (0)
8c5ca3b9 1759
5f97de0a
DE
1760/* If -Os, don't force line number labels to begin at the beginning of
1761 the word; we still want the assembler to try to put things in parallel,
1762 should that be possible.
1763 For m32r/d, instructions are never in parallel (other than with a nop)
1764 and the simulator and stub both handle a breakpoint in the middle of
1765 a word so don't ever force line number labels to begin at the beginning
1766 of a word. */
5b8ae21f
MM
1767
1768#undef ASM_OUTPUT_SOURCE_LINE
1769#define ASM_OUTPUT_SOURCE_LINE(file, line) \
56e2e762
NC
1770 do \
1771 { \
1772 static int sym_lineno = 1; \
1773 fprintf (file, ".stabn 68,0,%d,.LM%d-", \
1774 line, sym_lineno); \
1775 assemble_name \
1776 (file, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
1777 fprintf (file, (optimize_size || TARGET_M32R) \
1778 ? "\n\t.debugsym .LM%d\n" \
1779 : "\n.LM%d:\n", \
1780 sym_lineno); \
1781 sym_lineno += 1; \
1782 } \
1783 while (0)
5b8ae21f 1784
8c5ca3b9
DE
1785/* Store in OUTPUT a string (made with alloca) containing
1786 an assembler-name for a local static variable named NAME.
1787 LABELNO is an integer which is different for each call. */
56e2e762
NC
1788#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1789 do \
1790 { \
1791 (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10);\
1792 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)); \
1793 } \
1794 while (0)
8c5ca3b9
DE
1795
1796/* How to refer to registers in assembler output.
1797 This sequence is indexed by compiler's hard-register-number (see above). */
56e2e762
NC
1798#ifndef SUBTARGET_REGISTER_NAMES
1799#define SUBTARGET_REGISTER_NAMES
1800#endif
1801
1802#define REGISTER_NAMES \
8c5ca3b9
DE
1803{ \
1804 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
1805 "r8", "r9", "r10", "r11", "r12", "fp", "lr", "sp", \
56e2e762
NC
1806 "ap", "cbit", "a0" \
1807 SUBTARGET_REGISTER_NAMES \
8c5ca3b9
DE
1808}
1809
1810/* If defined, a C initializer for an array of structures containing
1811 a name and a register number. This macro defines additional names
1812 for hard registers, thus allowing the `asm' option in declarations
1813 to refer to registers using alternate names. */
56e2e762
NC
1814#ifndef SUBTARGET_ADDITIONAL_REGISTER_NAMES
1815#define SUBTARGET_ADDITIONAL_REGISTER_NAMES
1816#endif
1817
1818#define ADDITIONAL_REGISTER_NAMES \
8c5ca3b9
DE
1819{ \
1820 /*{ "gp", GP_REGNUM },*/ \
1821 { "r13", FRAME_POINTER_REGNUM }, \
1822 { "r14", RETURN_ADDR_REGNUM }, \
1823 { "r15", STACK_POINTER_REGNUM }, \
56e2e762 1824 SUBTARGET_ADDITIONAL_REGISTER_NAMES \
8c5ca3b9
DE
1825}
1826
1827/* A C expression which evaluates to true if CODE is a valid
1828 punctuation character for use in the `PRINT_OPERAND' macro. */
1829extern char m32r_punct_chars[];
1830#define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
56e2e762 1831 m32r_punct_chars[(unsigned char) (CHAR)]
8c5ca3b9
DE
1832
1833/* Print operand X (an rtx) in assembler syntax to file FILE.
1834 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1835 For `%' followed by punctuation, CODE is the punctuation and X is null. */
1836#define PRINT_OPERAND(FILE, X, CODE) \
56e2e762 1837 m32r_print_operand (FILE, X, CODE)
8c5ca3b9
DE
1838
1839/* A C compound statement to output to stdio stream STREAM the
1840 assembler syntax for an instruction operand that is a memory
1841 reference whose address is ADDR. ADDR is an RTL expression.
1842
1843 On some machines, the syntax for a symbolic address depends on
1844 the section that the address refers to. On these machines,
1845 define the macro `ENCODE_SECTION_INFO' to store the information
1846 into the `symbol_ref', and then check for it here. */
1847#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
56e2e762 1848 m32r_print_operand_address (FILE, ADDR)
8c5ca3b9
DE
1849
1850/* If defined, C string expressions to be used for the `%R', `%L',
1851 `%U', and `%I' options of `asm_fprintf' (see `final.c'). These
1852 are useful when a single `md' file must support multiple assembler
1853 formats. In that case, the various `tm.h' files can define these
1854 macros differently. */
1855#define REGISTER_PREFIX ""
1856#define LOCAL_LABEL_PREFIX ".L"
1857#define USER_LABEL_PREFIX ""
1858#define IMMEDIATE_PREFIX "#"
1859
1860/* This is how to output an element of a case-vector that is absolute. */
56e2e762
NC
1861#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1862 do \
1863 { \
1864 char label[30]; \
1865 ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
1866 fprintf (FILE, "\t.word\t"); \
1867 assemble_name (FILE, label); \
1868 fprintf (FILE, "\n"); \
1869 } \
1870 while (0)
8c5ca3b9
DE
1871
1872/* This is how to output an element of a case-vector that is relative. */
56e2e762
NC
1873#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL)\
1874 do \
1875 { \
1876 char label[30]; \
1877 ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
1878 fprintf (FILE, "\t.word\t"); \
1879 assemble_name (FILE, label); \
1880 fprintf (FILE, "-"); \
1881 ASM_GENERATE_INTERNAL_LABEL (label, "L", REL); \
1882 assemble_name (FILE, label); \
1883 fprintf (FILE, ")\n"); \
1884 } \
1885 while (0)
8c5ca3b9 1886
fc470718
R
1887/* The desired alignment for the location counter at the beginning
1888 of a loop. */
8c5ca3b9
DE
1889/* On the M32R, align loops to 32 byte boundaries (cache line size)
1890 if -malign-loops. */
fc470718 1891#define LOOP_ALIGN(LABEL) (TARGET_ALIGN_LOOPS ? 5 : 0)
8c5ca3b9 1892
56e2e762
NC
1893/* Define this to be the maximum number of insns to move around when moving
1894 a loop test from the top of a loop to the bottom
1895 and seeing whether to duplicate it. The default is thirty.
1896
1897 Loop unrolling currently doesn't like this optimization, so
1898 disable doing if we are unrolling loops and saving space. */
1899#define LOOP_TEST_THRESHOLD (optimize_size \
1900 && !flag_unroll_loops \
1901 && !flag_unroll_all_loops ? 2 : 30)
1902
8c5ca3b9
DE
1903/* This is how to output an assembler line
1904 that says to advance the location counter
1905 to a multiple of 2**LOG bytes. */
1906/* .balign is used to avoid confusion. */
56e2e762
NC
1907#define ASM_OUTPUT_ALIGN(FILE,LOG) \
1908 do \
1909 { \
1910 if ((LOG) != 0) \
1911 fprintf (FILE, "\t.balign %d\n", 1 << (LOG)); \
1912 } \
1913 while (0)
8c5ca3b9
DE
1914
1915/* Like `ASM_OUTPUT_COMMON' except takes the required alignment as a
1916 separate, explicit argument. If you define this macro, it is used in
1917 place of `ASM_OUTPUT_COMMON', and gives you more flexibility in
1918 handling the required alignment of the variable. The alignment is
1919 specified as the number of bits. */
1920
6e7b07a7 1921#define SCOMMON_ASM_OP "\t.scomm\t"
8c5ca3b9 1922
56e2e762
NC
1923#undef ASM_OUTPUT_ALIGNED_COMMON
1924#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
1925 do \
8c5ca3b9 1926 { \
56e2e762
NC
1927 if (! TARGET_SDATA_NONE \
1928 && (SIZE) > 0 && (SIZE) <= g_switch_value) \
016c8440 1929 fprintf ((FILE), "%s", SCOMMON_ASM_OP); \
56e2e762 1930 else \
016c8440 1931 fprintf ((FILE), "%s", COMMON_ASM_OP); \
8c5ca3b9 1932 assemble_name ((FILE), (NAME)); \
56e2e762 1933 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
8c5ca3b9 1934 } \
56e2e762 1935 while (0)
8c5ca3b9
DE
1936
1937/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
1938 separate, explicit argument. If you define this macro, it is used in
1939 place of `ASM_OUTPUT_BSS', and gives you more flexibility in
1940 handling the required alignment of the variable. The alignment is
1941 specified as the number of bits.
1942
1943 For the M32R we need sbss support. */
1944
56e2e762
NC
1945#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
1946 do \
1947 { \
1948 ASM_GLOBALIZE_LABEL (FILE, NAME); \
1949 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
1950 } \
1951 while (0)
8c5ca3b9
DE
1952\f
1953/* Debugging information. */
1954
1955/* Generate DBX and DWARF debugging information. */
56e2e762
NC
1956#undef DBX_DEBUGGING_INFO
1957#undef DWARF_DEBUGGING_INFO
1958#undef DWARF2_DEBUGGING_INFO
1959
8c5ca3b9
DE
1960#define DBX_DEBUGGING_INFO
1961#define DWARF_DEBUGGING_INFO
56e2e762 1962#define DWARF2_DEBUGGING_INFO
8c5ca3b9
DE
1963
1964/* Prefer STABS (for now). */
56e2e762 1965#undef PREFERRED_DEBUGGING_TYPE
8c5ca3b9
DE
1966#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
1967
1968/* How to renumber registers for dbx and gdb. */
1969#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
1970
1971/* Turn off splitting of long stabs. */
1972#define DBX_CONTIN_LENGTH 0
1973\f
1974/* Miscellaneous. */
1975
1976/* Specify the machine mode that this machine uses
1977 for the index in the tablejump instruction. */
1978#define CASE_VECTOR_MODE Pmode
1979
18543a22
ILT
1980/* Define as C expression which evaluates to nonzero if the tablejump
1981 instruction expects the table to contain offsets from the address of the
1982 table.
1983 Do not define this if the table should contain absolute addresses. */
8c5ca3b9
DE
1984/* It's not clear what PIC will look like or whether we want to use -fpic
1985 for the embedded form currently being talked about. For now require -fpic
1986 to get pc relative switch tables. */
18543a22 1987/*#define CASE_VECTOR_PC_RELATIVE 1 */
8c5ca3b9
DE
1988
1989/* Define if operations between registers always perform the operation
1990 on the full register even if a narrower mode is specified. */
1991#define WORD_REGISTER_OPERATIONS
1992
1993/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
1994 will either zero-extend or sign-extend. The value of this macro should
1995 be the code that says which one of the two operations is implicitly
1996 done, NIL if none. */
1997#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
1998
1999/* Specify the tree operation to be used to convert reals to integers. */
2000#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
2001
2002/* This is the kind of divide that is easiest to do in the general case. */
2003#define EASY_DIV_EXPR TRUNC_DIV_EXPR
2004
2005/* Max number of bytes we can move from memory to memory
2006 in one reasonably fast instruction. */
2007#define MOVE_MAX 4
2008
2009/* Define this to be nonzero if shift instructions ignore all but the low-order
2010 few bits. */
2011#define SHIFT_COUNT_TRUNCATED 1
2012
2013/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
2014 is done just by pretending it is already truncated. */
2015#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
2016
2017/* We assume that the store-condition-codes instructions store 0 for false
2018 and some other value for true. This is the value stored for true. */
2019#define STORE_FLAG_VALUE 1
2020
2021/* Specify the machine mode that pointers have.
2022 After generation of rtl, the compiler makes no further distinction
2023 between pointers and any other objects of this machine mode. */
2024/* ??? The M32R doesn't have full 32 bit pointers, but making this PSImode has
56e2e762 2025 it's own problems (you have to add extendpsisi2 and truncsipsi2).
8c5ca3b9
DE
2026 Try to avoid it. */
2027#define Pmode SImode
2028
2029/* A function address in a call instruction. */
2030#define FUNCTION_MODE SImode
8c5ca3b9
DE
2031\f
2032/* Define the information needed to generate branch and scc insns. This is
2033 stored from the compare operation. Note that we can't use "rtx" here
2034 since it hasn't been defined! */
2b7972b0
MM
2035extern struct rtx_def * m32r_compare_op0;
2036extern struct rtx_def * m32r_compare_op1;
8c5ca3b9
DE
2037
2038/* M32R function types. */
2b7972b0
MM
2039enum m32r_function_type
2040{
8c5ca3b9
DE
2041 M32R_FUNCTION_UNKNOWN, M32R_FUNCTION_NORMAL, M32R_FUNCTION_INTERRUPT
2042};
56e2e762
NC
2043
2044#define M32R_INTERRUPT_P(TYPE) ((TYPE) == M32R_FUNCTION_INTERRUPT)
2b7972b0
MM
2045
2046/* Define this if you have defined special-purpose predicates in the
2047 file `MACHINE.c'. This macro is called within an initializer of an
2048 array of structures. The first field in the structure is the name
2049 of a predicate and the second field is an array of rtl codes. For
2050 each predicate, list all rtl codes that can be in expressions
2051 matched by the predicate. The list should have a trailing comma. */
2052
2053#define PREDICATE_CODES \
2054{ "conditional_move_operand", { REG, SUBREG, CONST_INT }}, \
2055{ "carry_compare_operand", { EQ, NE }}, \
2056{ "eqne_comparison_operator", { EQ, NE }}, \
2057{ "signed_comparison_operator", { EQ, NE, LT, LE, GT, GE }}, \
2058{ "move_dest_operand", { REG, SUBREG, MEM }}, \
2059{ "move_src_operand", { REG, SUBREG, MEM, CONST_INT, \
2060 CONST_DOUBLE, LABEL_REF, CONST, \
2061 SYMBOL_REF }}, \
2062{ "move_double_src_operand", { REG, SUBREG, MEM, CONST_INT, \
2063 CONST_DOUBLE }}, \
2064{ "two_insn_const_operand", { CONST_INT }}, \
2065{ "symbolic_operand", { SYMBOL_REF, LABEL_REF, CONST }}, \
56e2e762
NC
2066{ "seth_add3_operand", { SYMBOL_REF, LABEL_REF, CONST }}, \
2067{ "int8_operand", { CONST_INT }}, \
2068{ "uint16_operand", { CONST_INT }}, \
2b7972b0
MM
2069{ "reg_or_int16_operand", { REG, SUBREG, CONST_INT }}, \
2070{ "reg_or_uint16_operand", { REG, SUBREG, CONST_INT }}, \
2071{ "reg_or_cmp_int16_operand", { REG, SUBREG, CONST_INT }}, \
56e2e762 2072{ "reg_or_eq_int16_operand", { REG, SUBREG, CONST_INT }}, \
2b7972b0
MM
2073{ "cmp_int16_operand", { CONST_INT }}, \
2074{ "call_address_operand", { SYMBOL_REF, LABEL_REF, CONST }}, \
56e2e762 2075{ "extend_operand", { REG, SUBREG, MEM }}, \
2b7972b0 2076{ "small_insn_p", { INSN, CALL_INSN, JUMP_INSN }}, \
d2a73f8e 2077{ "m32r_block_immediate_operand",{ CONST_INT }}, \
997718c7
RH
2078{ "large_insn_p", { INSN, CALL_INSN, JUMP_INSN }}, \
2079{ "seth_add3_operand", { SYMBOL_REF, LABEL_REF, CONST }},
2b7972b0 2080
This page took 1.064789 seconds and 5 git commands to generate.