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