]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/dsp16xx/dsp16xx.h
Merge in gcc2 snapshot 19980929. See gcc/ChangeLog and gcc/FSFChangeLog for
[thirdparty/gcc.git] / gcc / config / dsp16xx / dsp16xx.h
1 /* Definitions of target machine for GNU compiler. AT&T DSP1600.
2 Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
3 Contributed by Michael Collison (collison@world.std.com).
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 1, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 extern char *low_reg_names[];
23 extern char *text_seg_name;
24 extern char *rsect_text;
25 extern char *data_seg_name;
26 extern char *rsect_data;
27 extern char *bss_seg_name;
28 extern char *rsect_bss;
29 extern char *const_seg_name;
30 extern char *rsect_const;
31 extern char *chip_name;
32 extern char *save_chip_name;
33 extern struct rtx_def *dsp16xx_compare_op0, *dsp16xx_compare_op1;
34 extern struct rtx_def *(*dsp16xx_compare_gen)();
35 extern struct rtx_def *gen_compare_reg();
36 extern struct rtx_def *dsp16xx_addhf3_libcall;
37 extern struct rtx_def *dsp16xx_subhf3_libcall;
38 extern struct rtx_def *dsp16xx_mulhf3_libcall;
39 extern struct rtx_def *dsp16xx_divhf3_libcall;
40 extern struct rtx_def *dsp16xx_cmphf3_libcall;
41 extern struct rtx_def *dsp16xx_fixhfhi2_libcall;
42 extern struct rtx_def *dsp16xx_floathihf2_libcall;
43 extern struct rtx_def *dsp16xx_neghf2_libcall;
44 extern struct rtx_def *dsp16xx_umulhi3_libcall;
45 extern struct rtx_def *dsp16xx_mulhi3_libcall;
46 extern struct rtx_def *dsp16xx_udivqi3_libcall;
47 extern struct rtx_def *dsp16xx_udivhi3_libcall;
48 extern struct rtx_def *dsp16xx_divqi3_libcall;
49 extern struct rtx_def *dsp16xx_divhi3_libcall;
50 extern struct rtx_def *dsp16xx_modqi3_libcall;
51 extern struct rtx_def *dsp16xx_modhi3_libcall;
52 extern struct rtx_def *dsp16xx_umodqi3_libcall;
53 extern struct rtx_def *dsp16xx_umodhi3_libcall;
54
55 extern struct rtx_def *dsp16xx_ashrhi3_libcall;
56 extern struct rtx_def *dsp16xx_ashlhi3_libcall;
57 extern struct rtx_def *dsp16xx_lshrhi3_libcall;
58
59
60 extern int hard_regno_mode_ok ();
61 extern enum reg_class dsp16xx_reg_class_from_letter ();
62 extern enum reg_class dsp16xx_limit_reload_class ();
63 extern int hard_regno_nregs ();
64 extern int regno_reg_class ();
65 extern int move_operand ();
66 extern int symbolic_address_p ();
67 extern int Y_address ();
68 extern int call_address_operand ();
69 extern void notice_update_cc();
70 extern void function_prologue ();
71 extern void function_epilogue ();
72 extern int dsp1600_comparison_reverse ();
73 extern void double_reg_from_memory ();
74 extern void double_reg_to_memory ();
75 extern void bss_section ();
76 extern struct rtx_def *dsp16xx_function_arg ();
77 extern void dsp16xx_function_arg_advance ();
78 extern enum rtx_code next_cc_user_code ();
79 extern int next_cc_user_unsigned ();
80 extern struct rtx_def *gen_tst_reg ();
81 extern char *output_block_move();
82
83 /* RUN-TIME TARGET SPECIFICATION */
84 #define DSP16XX 1
85
86 /* Name of the AT&T assembler */
87
88 #define ASM_PROG "as1600"
89
90 /* Name of the AT&T linker */
91
92 #define LD_PROG "ld1600"
93
94 /* Define which switches take word arguments */
95 #define WORD_SWITCH_TAKES_ARG(STR) \
96 (!strcmp (STR, "ifile") ? 1 : \
97 0)
98
99 #ifdef CC1_SPEC
100 #undef CC1_SPEC
101 #endif
102 #define CC1_SPEC ""
103
104 /* Define this as a spec to call the AT&T assembler */
105
106 #define CROSS_ASM_SPEC "%{!S:as1600 %a %i\n }"
107
108 /* Define this as a spec to call the AT&T linker */
109
110 #define CROSS_LINK_SPEC "%{!c:%{!M:%{!MM:%{!E:%{!S:ld1600 %l %X %{o*} %{m} \
111 %{r} %{s} %{t} %{u*} %{x}\
112 %{!A:%{!nostdlib:%{!nostartfiles:%S}}} %{static:}\
113 %{L*} %D %o %{!nostdlib:-le1600 %L -le1600}\
114 %{!A:%{!nostdlib:%{!nostartfiles:%E}}}\n }}}}}"
115
116 /* Nothing complicated here, just link with libc.a under normal
117 circumstances */
118 #define LIB_SPEC "-lc"
119
120 /* Specify the startup file to link with. */
121 #define STARTFILE_SPEC "%{mmap1:m1_crt0.o%s} \
122 %{mmap2:m2_crt0.o%s} \
123 %{mmap3:m3_crt0.o%s} \
124 %{mmap4:m4_crt0.o%s} \
125 %{!mmap*: %{!ifile*: m4_crt0.o%s} %{ifile*: \
126 %eA -ifile option requires a -map option}}"
127
128 /* Specify the end file to link with */
129
130 #define ENDFILE_SPEC "%{mmap1:m1_crtn.o%s} \
131 %{mmap2:m2_crtn.o%s} \
132 %{mmap3:m3_crtn.o%s} \
133 %{mmap4:m4_crtn.o%s} \
134 %{!mmap*: %{!ifile*: m4_crtn.o%s} %{ifile*: \
135 %eA -ifile option requires a -map option}}"
136
137
138 /* Tell gcc where to look for the startfile */
139 #define STANDARD_STARTFILE_PREFIX "/d1600/lib"
140
141 /* Tell gcc where to look for its executables */
142 #define STANDARD_EXEC_PREFIX "/d1600/bin"
143
144 /* Command line options to the AT&T assembler */
145 #define ASM_SPEC "%{v:-V} %{g*:-g}"
146
147 /* Command line options for the AT&T linker */
148 #define LINK_SPEC "%{v:-V} %{minit:-i} \
149 %{!ifile*:%{mmap1:-ifile m1_deflt.if%s} \
150 %{mmap2:-ifile m2_deflt.if%s} \
151 %{mmap3:-ifile m3_deflt.if%s} \
152 %{mmap4:-ifile m4_deflt.if%s} \
153 %{!mmap*:-ifile m4_deflt.if%s}} \
154 %{ifile*} %{!r:-a}"
155
156 /* Names to predefine in the preprocessor for this target machine. */
157 #ifdef __MSDOS__
158 #define CPP_PREDEFINES "-Ddsp1600 -DDSP1600 -DMSDOS"
159 #else
160 #define CPP_PREDEFINES "-Ddsp1600 -DDSP1600 -Ddsp1610 -DDSP1610"
161 #endif
162
163 /* Run-time compilation parameters selecting different hardware subsets. */
164
165 extern int target_flags;
166
167 /* Macros used in the machine description to test the flags. */
168
169 #define MASK_REGPARM 0x00000001 /* Pass parameters in registers */
170 #define MASK_NEAR_CALL 0x00000002 /* The call is on the same 4k page */
171 #define MASK_NEAR_JUMP 0x00000004 /* The jump is on the same 4k page */
172 #define MASK_BMU 0x00000008 /* Use the 'bmu' shift instructions */
173 #define MASK_OPTIMIZE_MEMORY 0x00000010 /* Optimize to conserve memory */
174 #define MASK_OPTIMIZE_SPEED 0x00000020 /* Optimize for speed */
175 #define MASK_MAP1 0x00000040 /* Link with map1 */
176 #define MASK_MAP2 0x00000080 /* Link with map2 */
177 #define MASK_MAP3 0x00000100 /* Link with map3 */
178 #define MASK_MAP4 0x00000200 /* Link with map4 */
179 #define MASK_YBASE_HIGH 0x00000400 /* The ybase register window starts high */
180 #define MASK_INIT 0x00000800 /* Have the linker generate tables to
181 initialize data at startup */
182 #define MASK_INLINE_MULT 0x00001000 /* Inline 32 bit multiplies */
183 #define MASK_RESERVE_YBASE 0x00002000 /* Reserved the ybase registers */
184
185 /* Compile passing first two args in regs 0 and 1.
186 This exists only to test compiler features that will
187 be needed for RISC chips. It is not usable
188 and is not intended to be usable on this cpu. */
189 #define TARGET_REGPARM (target_flags & MASK_REGPARM)
190
191 /* The call is on the same 4k page, so instead of loading
192 the 'pt' register and branching, we can branch directly */
193
194 #define TARGET_NEAR_CALL (target_flags & MASK_NEAR_CALL)
195
196 /* The jump is on the same 4k page, so instead of loading
197 the 'pt' register and branching, we can branch directly */
198
199 #define TARGET_NEAR_JUMP (target_flags & MASK_NEAR_JUMP)
200
201 /* Generate shift instructions to use the 1610 Bit Manipulation
202 Unit. */
203 #define TARGET_BMU (target_flags & MASK_BMU)
204
205 /* Optimize to conserve memory */
206 #define TARGET_OPTIMIZE_MEMORY (target_flags & MASK_OPTIMIZE_MEMORY)
207
208 /* Optimize for maximum speed */
209 #define TARGET_OPTIMIZE_SPEED (target_flags & MASK_OPTIMIZE_SPEED)
210
211 #define TARGET_YBASE_HIGH (target_flags & MASK_YBASE_HIGH)
212
213 /* Direct the linker to output extra info for initialized data */
214 #define TARGET_MASK_INIT (target_flags & MASK_INIT)
215
216 #define TARGET_INLINE_MULT (target_flags & MASK_INLINE_MULT)
217
218 /* Reserve the ybase registers *(0) - *(31) */
219 #define TARGET_RESERVE_YBASE (target_flags & MASK_RESERVE_YBASE)
220
221 /* Macro to define tables used to set the flags.
222 This is a list in braces of pairs in braces,
223 each pair being { "NAME", VALUE }
224 where VALUE is the bits to set or minus the bits to clear.
225 An empty string NAME is used to identify the default VALUE. */
226
227
228 #define TARGET_SWITCHES \
229 { \
230 { "regparm", MASK_REGPARM}, \
231 { "no-regparm", -MASK_REGPARM}, \
232 { "no-near-call", -MASK_NEAR_CALL}, \
233 { "near-jump", MASK_NEAR_JUMP}, \
234 { "no-near-jump", -MASK_NEAR_JUMP}, \
235 { "bmu", MASK_BMU}, \
236 { "no-bmu", -MASK_BMU}, \
237 { "Om", MASK_OPTIMIZE_MEMORY}, \
238 { "Os", MASK_OPTIMIZE_SPEED}, \
239 { "map1", MASK_MAP1}, \
240 { "map2", MASK_MAP2}, \
241 { "map3", MASK_MAP3}, \
242 { "map4", MASK_MAP4}, \
243 { "ybase-high", MASK_YBASE_HIGH}, \
244 { "init", MASK_INIT}, \
245 { "inline-mult", MASK_INLINE_MULT}, \
246 { "reserve-ybase", MASK_RESERVE_YBASE}, \
247 { "", TARGET_DEFAULT} \
248 }
249
250 /* Default target_flags if no switches are specified */
251 #ifndef TARGET_DEFAULT
252 #define TARGET_DEFAULT MASK_OPTIMIZE_MEMORY|MASK_REGPARM|MASK_YBASE_HIGH
253 #endif
254
255 /* This macro is similar to `TARGET_SWITCHES' but defines names of
256 command options that have values. Its definition is an
257 initializer with a subgrouping for each command option.
258
259 Each subgrouping contains a string constant, that defines the
260 fixed part of the option name, and the address of a variable.
261 The variable, type `char *', is set to the variable part of the
262 given option if the fixed part matches. The actual option name
263 is made by appending `-m' to the specified name.
264
265 Here is an example which defines `-mshort-data-NUMBER'. If the
266 given option is `-mshort-data-512', the variable `m88k_short_data'
267 will be set to the string `"512"'.
268
269 extern char *m88k_short_data;
270 #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */
271
272 #define TARGET_OPTIONS \
273 { \
274 { "text=", &text_seg_name }, \
275 { "data=", &data_seg_name }, \
276 { "bss=", &bss_seg_name }, \
277 { "const=", &const_seg_name }, \
278 { "chip=", &chip_name } \
279 }
280
281 /* Sometimes certain combinations of command options do not make sense
282 on a particular target machine. You can define a macro
283 `OVERRIDE_OPTIONS' to take account of this. This macro, if
284 defined, is executed once just after all the command options have
285 been parsed.
286
287 Don't use this macro to turn on various extra optimizations for
288 `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
289
290 #define OVERRIDE_OPTIONS override_options ()
291
292 #define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \
293 do \
294 { \
295 flag_gnu_linker = FALSE; \
296 \
297 if (SIZE) \
298 { \
299 flag_strength_reduce = FALSE; \
300 flag_inline_functions = FALSE; \
301 } \
302 } \
303 while (0)
304 \f
305 /* STORAGE LAYOUT */
306
307 /* Define if you don't want extended real, but do want to use the
308 software floating point emulator for REAL_ARITHMETIC and
309 decimal <-> binary conversion. */
310 #define REAL_ARITHMETIC
311
312 /* Define this if most significant bit is lowest numbered
313 in instructions that operate on numbered bit-fields.
314 */
315 #define BITS_BIG_ENDIAN 1
316
317 /* Define this if most significant byte of a word is the lowest numbered.
318 We define big-endian, but since the 1600 series cannot address bytes
319 it does not matter. */
320 #define BYTES_BIG_ENDIAN 1
321
322 /* Define this if most significant word of a multiword number is numbered.
323 For the 1600 we can decide arbitrarily since there are no machine instructions for them. */
324 #define WORDS_BIG_ENDIAN 1
325
326 /* number of bits in an addressable storage unit */
327 #define BITS_PER_UNIT 16
328
329 /* Width in bits of a "word", which is the contents of a machine register.
330 Note that this is not necessarily the width of data type `int';
331 if using 16-bit ints on a 68000, this would still be 32.
332 But on a machine with 16-bit registers, this would be 16. */
333 #define BITS_PER_WORD 16
334
335 /* Maximum number of bits in a word. */
336 #define MAX_BITS_PER_WORD 16
337
338 /* Width of a word, in units (bytes). */
339 #define UNITS_PER_WORD 1
340
341 /* Width in bits of a pointer.
342 See also the macro `Pmode' defined below. */
343 #define POINTER_SIZE 16
344
345 /* Allocation boundary (in *bits*) for storing pointers in memory. */
346 #define POINTER_BOUNDARY 16
347
348 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
349 #define PARM_BOUNDARY 16
350
351 /* Boundary (in *bits*) on which stack pointer should be aligned. */
352 #define STACK_BOUNDARY 16
353
354 /* Allocation boundary (in *bits*) for the code of a function. */
355 #define FUNCTION_BOUNDARY 16
356
357 /* Biggest alignment that any data type can require on this machine, in bits. */
358 #define BIGGEST_ALIGNMENT 16
359
360 /* Biggest alignment that any structure field can require on this machine, in bits */
361 #define BIGGEST_FIELD_ALIGNMENT 16
362
363 /* Alignment of field after `int : 0' in a structure. */
364 #define EMPTY_FIELD_BOUNDARY 16
365
366 /* Number of bits which any structure or union's size must be a multiple of. Each structure
367 or union's size is rounded up to a multiple of this */
368 #define STRUCTURE_SIZE_BOUNDARY 16
369
370 /* Define this if move instructions will actually fail to work
371 when given unaligned data. */
372 #define STRICT_ALIGNMENT 1
373
374 /* An integer expression for the size in bits of the largest integer machine mode that
375 should actually be used. All integer machine modes of this size or smaller can be
376 used for structures and unions with the appropriate sizes. */
377 #define MAX_FIXED_MODE_SIZE 32
378 \f
379 /* LAYOUT OF SOURCE LANGUAGE DATA TYPES */
380
381 #define CHAR_TYPE_SIZE 16
382 #define SHORT_TYPE_SIZE 16
383 #define INT_TYPE_SIZE 16
384 #define LONG_TYPE_SIZE 32
385 #define LONG_LONG_TYPE_SIZE 32
386 #define FLOAT_TYPE_SIZE 32
387 #define DOUBLE_TYPE_SIZE 32
388 #define LONG_DOUBLE_TYPE_SIZE 32
389
390 /* An expression whose value is 1 or 0, according to whether the type char should be
391 signed or unsigned by default. */
392
393 #define DEFAULT_SIGNED_CHAR 1
394
395 /* A C expression to determine whether to give an enum type only as many bytes
396 as it takes to represent the range of possible values of that type. A nonzero
397 value means to do that; a zero value means all enum types should be allocated
398 like int. */
399
400 #define DEFAULT_SHORT_ENUMS 0
401
402 /* A C expression for a string describing the name of the data type to use for
403 size values. */
404
405 #define SIZE_TYPE "long unsigned int"
406
407 /* A C expression for a string describing the name of the datat type to use for the
408 result of subtracting two pointers */
409
410 #define PTRDIFF_TYPE "long int"
411
412 #define TARGET_BELL '\a'
413 #define TARGET_BS '\b'
414 #define TARGET_TAB '\t'
415 #define TARGET_NEWLINE '\n'
416 #define TARGET_VT '\v'
417 #define TARGET_FF '\f'
418 #define TARGET_CR '\r'
419
420 \f
421 /* REGISTER USAGE. */
422
423 #define ALL_16_BIT_REGISTERS 1
424
425 /* Number of actual hardware registers.
426 The hardware registers are assigned numbers for the compiler
427 from 0 to FIRST_PSEUDO_REGISTER-1 */
428
429 #define FIRST_PSEUDO_REGISTER (REG_YBASE31 + 1)
430
431 /* 1 for registers that have pervasive standard uses
432 and are not available for the register allocator.
433
434 The registers are laid out as follows:
435
436 {a0,a0l,a1,a1l,x,y,yl,p,pl} - Data Arithmetic Unit
437 {r0,r1,r2,r3,j,k,ybase} - Y Space Address Arithmetic Unit
438 {pt} - X Space Address Arithmetic Unit
439 {ar0,ar1,ar2,ar3} - Bit Manipulation UNit
440 {pr} - Return Address Register
441
442 We reserve r2 for the Stack Pointer.
443 We specify r3 for the Frame Pointer but allow the compiler
444 to omit it when possible since we have so few pointer registers. */
445
446 #define REG_A0 0
447 #define REG_A0L 1
448 #define REG_A1 2
449 #define REG_A1L 3
450 #define REG_X 4
451 #define REG_Y 5
452 #define REG_YL 6
453 #define REG_PROD 7
454 #define REG_PRODL 8
455 #define REG_R0 9
456 #define REG_R1 10
457 #define REG_R2 11
458 #define REG_R3 12
459 #define REG_J 13
460 #define REG_K 14
461 #define REG_YBASE 15
462 #define REG_PT 16
463 #define REG_AR0 17
464 #define REG_AR1 18
465 #define REG_AR2 19
466 #define REG_AR3 20
467 #define REG_C0 21
468 #define REG_C1 22
469 #define REG_C2 23
470 #define REG_PR 24
471 #define REG_RB 25
472 #define REG_YBASE0 26
473 #define REG_YBASE1 27
474 #define REG_YBASE2 28
475 #define REG_YBASE3 29
476 #define REG_YBASE4 30
477 #define REG_YBASE5 31
478 #define REG_YBASE6 32
479 #define REG_YBASE7 33
480 #define REG_YBASE8 34
481 #define REG_YBASE9 35
482 #define REG_YBASE10 36
483 #define REG_YBASE11 37
484 #define REG_YBASE12 38
485 #define REG_YBASE13 39
486 #define REG_YBASE14 40
487 #define REG_YBASE15 41
488 #define REG_YBASE16 42
489 #define REG_YBASE17 43
490 #define REG_YBASE18 44
491 #define REG_YBASE19 45
492 #define REG_YBASE20 46
493 #define REG_YBASE21 47
494 #define REG_YBASE22 48
495 #define REG_YBASE23 49
496 #define REG_YBASE24 50
497 #define REG_YBASE25 51
498 #define REG_YBASE26 52
499 #define REG_YBASE27 53
500 #define REG_YBASE28 54
501 #define REG_YBASE29 55
502 #define REG_YBASE30 56
503 #define REG_YBASE31 57
504
505 /* Do we have a accumulator register? */
506 #define IS_ACCUM_REG(REGNO) ((REGNO) >= REG_A0 && (REGNO) <= REG_A1L)
507 #define IS_ACCUM_LOW_REG(REGNO) ((REGNO) == REG_A0L || (REGNO) == REG_A1L)
508
509 /* Do we have a virtual ybase register */
510 #define IS_YBASE_REGISTER_WINDOW(REGNO) ((REGNO) >= REG_YBASE0 && (REGNO) <= REG_YBASE31)
511
512 #define IS_ADDRESS_REGISTER(REGNO) ((REGNO) >= REG_R0 && (REGNO) <= REG_R3)
513
514 #define FIXED_REGISTERS \
515 {0, 0, 0, 0, 0, 0, 0, 0, 0, \
516 0, 0, 0, 1, 0, 0, 1, \
517 1, \
518 0, 0, 0, 0, \
519 1, 1, 1, \
520 0, 0, \
521 0, 0, 0, 0, 0, 0, 0, 0, \
522 0, 0, 0, 0, 0, 0, 0, 0, \
523 0, 0, 0, 0, 0, 0, 0, 0, \
524 0, 0, 0, 0, 0, 0, 0, 0}
525
526 /* 1 for registers not available across function calls.
527 These must include the FIXED_REGISTERS and also any
528 registers that can be used without being saved.
529 The latter must include the registers where values are returned
530 and the register where structure-value addresses are passed.
531 On the 1610 'a0' holds return values from functions. 'r0' holds
532 structure-value addresses.
533
534 In addition we don't save either j, k, ybase or any of the
535 bit manipulation registers. */
536
537
538 #define CALL_USED_REGISTERS \
539 {1, 1, 1, 1, 0, 1, 1, 1, 1, \
540 1, 0, 0, 1, 1, 1, 1, \
541 1, \
542 0, 0, 1, 1, \
543 1, 1, 1, \
544 0, 1, \
545 0, 0, 0, 0, 0, 0, 0, 0, \
546 0, 0, 0, 0, 0, 0, 0, 0, \
547 0, 0, 0, 0, 0, 0, 0, 0, \
548 0, 0, 0, 0, 0, 0, 0, 0}
549
550 /* List the order in which to allocate registers. Each register must be
551 listed once, even those in FIXED_REGISTERS.
552
553 We allocate in the following order:
554 */
555
556 #define REG_ALLOC_ORDER \
557 { REG_R0, REG_R1, REG_R2, REG_PROD, REG_Y, REG_X, \
558 REG_PRODL, REG_YL, REG_AR0, REG_AR1, \
559 REG_RB, REG_A0, REG_A1, REG_A0L, \
560 REG_A1L, REG_AR2, REG_AR3, \
561 REG_YBASE, REG_J, REG_K, REG_PR, REG_PT, REG_C0, \
562 REG_C1, REG_C2, REG_R3, \
563 REG_YBASE0, REG_YBASE1, REG_YBASE2, REG_YBASE3, \
564 REG_YBASE4, REG_YBASE5, REG_YBASE6, REG_YBASE7, \
565 REG_YBASE8, REG_YBASE9, REG_YBASE10, REG_YBASE11, \
566 REG_YBASE12, REG_YBASE13, REG_YBASE14, REG_YBASE15, \
567 REG_YBASE16, REG_YBASE17, REG_YBASE18, REG_YBASE19, \
568 REG_YBASE20, REG_YBASE21, REG_YBASE22, REG_YBASE23, \
569 REG_YBASE24, REG_YBASE25, REG_YBASE26, REG_YBASE27, \
570 REG_YBASE28, REG_YBASE29, REG_YBASE30, REG_YBASE31 }
571
572 /* Zero or more C statements that may conditionally modify two
573 variables `fixed_regs' and `call_used_regs' (both of type `char
574 []') after they have been initialized from the two preceding
575 macros.
576
577 This is necessary in case the fixed or call-clobbered registers
578 depend on target flags.
579
580 You need not define this macro if it has no work to do.
581
582 If the usage of an entire class of registers depends on the target
583 flags, you may indicate this to GCC by using this macro to modify
584 `fixed_regs' and `call_used_regs' to 1 for each of the registers in
585 the classes which should not be used by GCC. Also define the macro
586 `REG_CLASS_FROM_LETTER' to return `NO_REGS' if it is called with a
587 letter for a class that shouldn't be used.
588
589 (However, if this class is not included in `GENERAL_REGS' and all
590 of the insn patterns whose constraints permit this class are
591 controlled by target switches, then GCC will automatically avoid
592 using these registers when the target switches are opposed to
593 them.) If the user tells us there is no BMU, we can't use
594 ar0-ar3 for register allocation */
595
596 #define CONDITIONAL_REGISTER_USAGE \
597 do \
598 { \
599 if (!TARGET_BMU) \
600 { \
601 int regno; \
602 \
603 for (regno = REG_AR0; regno <= REG_AR3; regno++) \
604 fixed_regs[regno] = call_used_regs[regno] = 1; \
605 } \
606 if (TARGET_RESERVE_YBASE) \
607 { \
608 int regno; \
609 \
610 for (regno = REG_YBASE0; regno <= REG_YBASE31; regno++) \
611 fixed_regs[regno] = call_used_regs[regno] = 1; \
612 } \
613 } \
614 while (0)
615
616 /* Determine which register classes are very likely used by spill registers.
617 local-alloc.c won't allocate pseudos that have these classes as their
618 preferred class unless they are "preferred or nothing". */
619
620 #define CLASS_LIKELY_SPILLED_P(CLASS) \
621 ((CLASS) != ALL_REGS && (CLASS) != YBASE_VIRT_REGS)
622
623 /* Return number of consecutive hard regs needed starting at reg REGNO
624 to hold something of mode MODE.
625 This is ordinarily the length in words of a value of mode MODE
626 but can be less for certain modes in special long registers. */
627
628 #define HARD_REGNO_NREGS(REGNO, MODE) \
629 (GET_MODE_SIZE(MODE))
630
631 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
632
633 #define HARD_REGNO_MODE_OK(REGNO, MODE) hard_regno_mode_ok(REGNO, MODE)
634
635 /* Value is 1 if it is a good idea to tie two pseudo registers
636 when one has mode MODE1 and one has mode MODE2.
637 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
638 for any hard reg, then this must be 0 for correct output. */
639 #define MODES_TIEABLE_P(MODE1, MODE2) \
640 (((MODE1) == (MODE2)) || \
641 (GET_MODE_CLASS((MODE1)) == MODE_FLOAT) \
642 == (GET_MODE_CLASS((MODE2)) == MODE_FLOAT))
643
644 /* Specify the registers used for certain standard purposes.
645 The values of these macros are register numbers. */
646
647 /* DSP1600 pc isn't overloaded on a register. */
648 /* #define PC_REGNUM */
649
650 /* Register to use for pushing function arguments.
651 This is r3 in our case */
652 #define STACK_POINTER_REGNUM REG_R3
653
654 /* Base register for access to local variables of the function.
655 This is r2 in our case */
656 #define FRAME_POINTER_REGNUM REG_R2
657
658 /* We can debug without the frame pointer */
659 #define CAN_DEBUG_WITHOUT_FP 1
660
661 /* The 1610 saves the return address in this register */
662 #define RETURN_ADDRESS_REGNUM REG_PR
663
664 /* Base register for access to arguments of the function. */
665 #define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM
666
667 /* Register in which static-chain is passed to a function. */
668
669 #define STATIC_CHAIN_REGNUM 4
670
671 /* Register in which address to store a structure value
672 is passed to a function. This is 'r0' in our case */
673 #define STRUCT_VALUE_REGNUM REG_R0
674 \f
675 /* Define the classes of registers for register constraints in the
676 machine description. Also define ranges of constants.
677
678 One of the classes must always be named ALL_REGS and include all hard regs.
679 If there is more than one class, another class must be named NO_REGS
680 and contain no registers.
681
682 The name GENERAL_REGS must be the name of a class (or an alias for
683 another name such as ALL_REGS). This is the class of registers
684 that is allowed by "g" or "r" in a register constraint.
685 Also, registers outside this class are allocated only when
686 instructions express preferences for them.
687
688 The classes must be numbered in nondecreasing order; that is,
689 a larger-numbered class must never be contained completely
690 in a smaller-numbered class.
691
692 For any two classes, it is very desirable that there be another
693 class that represents their union. */
694
695
696 enum reg_class
697 {
698 NO_REGS,
699 A0H_REG,
700 A0L_REG,
701 A0_REG,
702 A1H_REG,
703 ACCUM_HIGH_REGS,
704 A1L_REG,
705 ACCUM_LOW_REGS,
706 A1_REG,
707 ACCUM_REGS,
708 X_REG,
709 X_OR_ACCUM_LOW_REGS,
710 X_OR_ACCUM_REGS,
711 YH_REG,
712 YH_OR_ACCUM_HIGH_REGS,
713 X_OR_YH_REGS,
714 YL_REG,
715 YL_OR_ACCUM_LOW_REGS,
716 X_OR_YL_REGS,
717 X_OR_Y_REGS,
718 Y_REG,
719 ACCUM_OR_Y_REGS,
720 PH_REG,
721 X_OR_PH_REGS,
722 PL_REG,
723 PL_OR_ACCUM_LOW_REGS,
724 X_OR_PL_REGS,
725 YL_OR_PL_OR_ACCUM_LOW_REGS,
726 P_REG,
727 ACCUM_OR_P_REGS,
728 YL_OR_P_REGS,
729 ACCUM_LOW_OR_YL_OR_P_REGS,
730 Y_OR_P_REGS,
731 ACCUM_Y_OR_P_REGS,
732 NO_FRAME_Y_ADDR_REGS,
733 Y_ADDR_REGS,
734 ACCUM_LOW_OR_Y_ADDR_REGS,
735 ACCUM_OR_Y_ADDR_REGS,
736 X_OR_Y_ADDR_REGS,
737 Y_OR_Y_ADDR_REGS,
738 P_OR_Y_ADDR_REGS,
739 NON_HIGH_YBASE_ELIGIBLE_REGS,
740 YBASE_ELIGIBLE_REGS,
741 J_REG,
742 J_OR_DAU_16_BIT_REGS,
743 BMU_REGS,
744 NOHIGH_NON_ADDR_REGS,
745 NON_ADDR_REGS,
746 SLOW_MEM_LOAD_REGS,
747 NOHIGH_NON_YBASE_REGS,
748 NO_ACCUM_NON_YBASE_REGS,
749 NON_YBASE_REGS,
750 YBASE_VIRT_REGS,
751 ACCUM_LOW_OR_YBASE_REGS,
752 ACCUM_OR_YBASE_REGS,
753 X_OR_YBASE_REGS,
754 Y_OR_YBASE_REGS,
755 ACCUM_LOW_YL_PL_OR_YBASE_REGS,
756 P_OR_YBASE_REGS,
757 ACCUM_Y_P_OR_YBASE_REGS,
758 Y_ADDR_OR_YBASE_REGS,
759 YBASE_OR_NOHIGH_YBASE_ELIGIBLE_REGS,
760 YBASE_OR_YBASE_ELIGIBLE_REGS,
761 NO_HIGH_ALL_REGS,
762 ALL_REGS,
763 LIM_REG_CLASSES
764 };
765
766 /* GENERAL_REGS must be the name of a register class */
767 #define GENERAL_REGS ALL_REGS
768
769 #define N_REG_CLASSES (int) LIM_REG_CLASSES
770
771 /* Give names of register classes as strings for dump file. */
772
773 #define REG_CLASS_NAMES \
774 { \
775 "NO_REGS", \
776 "A0H_REG", \
777 "A0L_REG", \
778 "A0_REG", \
779 "A1H_REG", \
780 "ACCUM_HIGH_REGS", \
781 "A1L_REG", \
782 "ACCUM_LOW_REGS", \
783 "A1_REG", \
784 "ACCUM_REGS", \
785 "X_REG", \
786 "X_OR_ACCUM_LOW_REGS", \
787 "X_OR_ACCUM_REGS", \
788 "YH_REG", \
789 "YH_OR_ACCUM_HIGH_REGS", \
790 "X_OR_YH_REGS", \
791 "YL_REG", \
792 "YL_OR_ACCUM_LOW_REGS", \
793 "X_OR_YL_REGS", \
794 "X_OR_Y_REGS", \
795 "Y_REG", \
796 "ACCUM_OR_Y_REGS", \
797 "PH_REG", \
798 "X_OR_PH_REGS", \
799 "PL_REG", \
800 "PL_OR_ACCUM_LOW_REGS", \
801 "X_OR_PL_REGS", \
802 "PL_OR_YL_OR_ACCUM_LOW_REGS", \
803 "P_REG", \
804 "ACCUM_OR_P_REGS", \
805 "YL_OR_P_REGS", \
806 "ACCUM_LOW_OR_YL_OR_P_REGS", \
807 "Y_OR_P_REGS", \
808 "ACCUM_Y_OR_P_REGS", \
809 "NO_FRAME_Y_ADDR_REGS", \
810 "Y_ADDR_REGS", \
811 "ACCUM_LOW_OR_Y_ADDR_REGS", \
812 "ACCUM_OR_Y_ADDR_REGS", \
813 "X_OR_Y_ADDR_REGS", \
814 "Y_OR_Y_ADDR_REGS", \
815 "P_OR_Y_ADDR_REGS", \
816 "NON_HIGH_YBASE_ELIGIBLE_REGS", \
817 "YBASE_ELIGIBLE_REGS", \
818 "J_REG", \
819 "J_OR_DAU_16_BIT_REGS", \
820 "BMU_REGS", \
821 "NOHIGH_NON_ADDR_REGS", \
822 "NON_ADDR_REGS", \
823 "SLOW_MEM_LOAD_REGS", \
824 "NOHIGH_NON_YBASE_REGS", \
825 "NO_ACCUM_NON_YBASE_REGS", \
826 "NON_YBASE_REGS", \
827 "YBASE_VIRT_REGS", \
828 "ACCUM_LOW_OR_YBASE_REGS", \
829 "ACCUM_OR_YBASE_REGS", \
830 "X_OR_YBASE_REGS", \
831 "Y_OR_YBASE_REGS", \
832 "ACCUM_LOW_YL_PL_OR_YBASE_REGS", \
833 "P_OR_YBASE_REGS", \
834 "ACCUM_Y_P_OR_YBASE_REGS", \
835 "Y_ADDR_OR_YBASE_REGS", \
836 "YBASE_OR_NOHIGH_YBASE_ELIGIBLE_REGS", \
837 "YBASE_OR_YBASE_ELIGIBLE_REGS", \
838 "NO_HIGH_ALL_REGS", \
839 "ALL_REGS" \
840 }
841
842 /* Define which registers fit in which classes.
843 This is an initializer for a vector of HARD_REG_SET
844 of length N_REG_CLASSES. */
845
846 #define REG_CLASS_CONTENTS \
847 { \
848 {0x00000000, 0x00000000}, /* no reg */ \
849 {0x00000001, 0x00000000}, /* a0h */ \
850 {0x00000002, 0x00000000}, /* a0l */ \
851 {0x00000003, 0x00000000}, /* a0h:a0l */ \
852 {0x00000004, 0x00000000}, /* a1h */ \
853 {0x00000005, 0x00000000}, /* accum high */ \
854 {0x00000008, 0x00000000}, /* a1l */ \
855 {0x0000000A, 0x00000000}, /* accum low */ \
856 {0x0000000c, 0x00000000}, /* a1h:a1l */ \
857 {0x0000000f, 0x00000000}, /* accum regs */ \
858 {0x00000010, 0x00000000}, /* x reg */ \
859 {0x0000001A, 0x00000000}, /* x & accum_low_regs */ \
860 {0x0000001f, 0x00000000}, /* x & accum regs */ \
861 {0x00000020, 0x00000000}, /* y high */ \
862 {0x00000025, 0x00000000}, /* yh, accum high */ \
863 {0x00000030, 0x00000000}, /* x & yh */ \
864 {0x00000040, 0x00000000}, /* y low */ \
865 {0x0000004A, 0x00000000}, /* y low, accum_low */ \
866 {0x00000050, 0x00000000}, /* x & yl */ \
867 {0x00000060, 0x00000000}, /* yl:yh */ \
868 {0x00000070, 0x00000000}, /* x, yh,a nd yl */ \
869 {0x0000006F, 0x00000000}, /* accum, y */ \
870 {0x00000080, 0x00000000}, /* p high */ \
871 {0x00000090, 0x00000000}, /* x & ph */ \
872 {0x00000100, 0x00000000}, /* p low */ \
873 {0x0000010A, 0x00000000}, /* p_low and accum_low */ \
874 {0x00000110, 0x00000000}, /* x & pl */ \
875 {0x0000014A, 0x00000000}, /* pl,yl,a1l,a0l */ \
876 {0x00000180, 0x00000000}, /* pl:ph */ \
877 {0x0000018F, 0x00000000}, /* accum, p */ \
878 {0x000001C0, 0x00000000}, /* pl:ph and yl */ \
879 {0x000001CA, 0x00000000}, /* pl:ph, yl, a0l, a1l */ \
880 {0x000001E0, 0x00000000}, /* y or p */ \
881 {0x000001EF, 0x00000000}, /* accum, y or p */ \
882 {0x00000E00, 0x00000000}, /* r0-r2 */ \
883 {0x00001E00, 0x00000000}, /* r0-r3 */ \
884 {0x00001E0A, 0x00000000}, /* r0-r3, accum_low */ \
885 {0x00001E0F, 0x00000000}, /* accum,r0-r3 */ \
886 {0x00001E10, 0x00000000}, /* x,r0-r3 */ \
887 {0x00001E60, 0x00000000}, /* y,r0-r3 */ \
888 {0x00001F80, 0x00000000}, /* p,r0-r3 */ \
889 {0x00001FDA, 0x00000000}, /* ph:pl, r0-r3, x,a0l,a1l */ \
890 {0x00001fff, 0x00000000}, /* accum,x,y,p,r0-r3 */ \
891 {0x00002000, 0x00000000}, /* j */ \
892 {0x00002025, 0x00000000}, /* j, yh, a1h, a0h */ \
893 {0x001E0000, 0x00000000}, /* ar0-ar3 */ \
894 {0x03FFE1DA, 0x00000000}, /* non_addr except yh,a0h,a1h */ \
895 {0x03FFE1FF, 0x00000000}, /* non_addr regs */ \
896 {0x03FFFF8F, 0x00000000}, /* non ybase except yh, yl, and x */ \
897 {0x03FFFFDA, 0x00000000}, /* non ybase regs except yh,a0h,a1h */ \
898 {0x03FFFFF0, 0x00000000}, /* non ybase except a0,a0l,a1,a1l */ \
899 {0x03FFFFFF, 0x00000000}, /* non ybase regs */ \
900 {0xFC000000, 0x03FFFFFF}, /* virt ybase regs */ \
901 {0xFC00000A, 0x03FFFFFF}, /* accum_low, virt ybase regs */ \
902 {0xFC00000F, 0x03FFFFFF}, /* accum, virt ybase regs */ \
903 {0xFC000010, 0x03FFFFFF}, /* x,virt ybase regs */ \
904 {0xFC000060, 0x03FFFFFF}, /* y,virt ybase regs */ \
905 {0xFC00014A, 0x03FFFFFF}, /* accum_low, yl, pl, ybase */ \
906 {0xFC000180, 0x03FFFFFF}, /* p,virt ybase regs */ \
907 {0xFC0001EF, 0x03FFFFFF}, /* accum,y,p,ybase regs */ \
908 {0xFC001E00, 0x03FFFFFF}, /* r0-r3, ybase regs */ \
909 {0xFC001FDA, 0x03FFFFFF}, /* r0-r3, pl:ph,yl,x,a1l,a0l */ \
910 {0xFC001FFF, 0x03FFFFFF}, /* virt ybase, ybase eligible regs */ \
911 {0xFCFFFFDA, 0x03FFFFFF}, /* all regs except yh,a0h,a1h */ \
912 {0xFFFFFFFF, 0x03FFFFFF} /* all regs */ \
913 }
914
915
916 /* The same information, inverted:
917 Return the class number of the smallest class containing
918 reg number REGNO. This could be a conditional expression
919 or could index an array. */
920
921 #define REGNO_REG_CLASS(REGNO) regno_reg_class(REGNO)
922
923 /* The class value for index registers, and the one for base regs. */
924
925 #define INDEX_REG_CLASS NO_REGS
926 #define BASE_REG_CLASS Y_ADDR_REGS
927
928 /* Get reg_class from a letter such as appears in the machine description. */
929
930 #define REG_CLASS_FROM_LETTER(C) \
931 dsp16xx_reg_class_from_letter(C)
932
933 #define SECONDARY_RELOAD_CLASS(CLASS, MODE, X) \
934 secondary_reload_class(CLASS, MODE, X)
935
936 /* When defined, the compiler allows registers explicitly used in the
937 rtl to be used as spill registers but prevents the compiler from
938 extending the lifetime of these registers. */
939
940 #define SMALL_REGISTER_CLASSES 1
941
942 /* Macros to check register numbers against specific register classes. */
943
944 /* These assume that REGNO is a hard or pseudo reg number.
945 They give nonzero only if REGNO is a hard reg of the suitable class
946 or a pseudo reg currently allocated to a suitable hard reg.
947 Since they use reg_renumber, they are safe only once reg_renumber
948 has been allocated, which happens in local-alloc.c. */
949
950 /* A C expression which is nonzero if register REGNO is suitable for use
951 as a base register in operand addresses. It may be either a suitable
952 hard register or a pseudo register that has been allocated such a
953 hard register.
954
955 On the 1610 the Y address pointers can be used as a base registers */
956 #define REGNO_OK_FOR_BASE_P(REGNO) \
957 (((REGNO) >= REG_R0 && (REGNO) < REG_R3 + 1) || ((unsigned) reg_renumber[REGNO] >= REG_R0 \
958 && (unsigned) reg_renumber[REGNO] < REG_R3 + 1))
959
960 #define REGNO_OK_FOR_YBASE_P(REGNO) \
961 (((REGNO) == REG_YBASE) || ((unsigned) reg_renumber[REGNO] == REG_YBASE))
962
963 #define REGNO_OK_FOR_INDEX_P(REGNO) 0
964
965 #ifdef ALL_16_BIT_REGISTERS
966 #define IS_32_BIT_REG(REGNO) 0
967 #else
968 #define IS_32_BIT_REG(REGNO) \
969 ((REGNO) == REG_A0 || (REGNO) == REG_A1 || (REGNO) == REG_Y || (REGNO) == REG_PROD)
970 #endif
971
972 /* Given an rtx X being reloaded into a reg required to be
973 in class CLASS, return the class of reg to actually use.
974 In general this is just CLASS; but on some machines
975 in some cases it is preferable to use a more restrictive class.
976 Also, we must ensure that a PLUS is reloaded either
977 into an accumulator or an address register. */
978
979 #define PREFERRED_RELOAD_CLASS(X,CLASS) preferred_reload_class (X, CLASS)
980
981 /* A C expression that places additional restrictions on the register
982 class to use when it is necessary to be able to hold a value of
983 mode MODE in a reload register for which class CLASS would
984 ordinarily be used.
985
986 Unlike `PREFERRED_RELOAD_CLASS', this macro should be used when
987 there are certain modes that simply can't go in certain reload
988 classes.
989
990 The value is a register class; perhaps CLASS, or perhaps another,
991 smaller class.
992
993 Don't define this macro unless the target machine has limitations
994 which require the macro to do something nontrivial. */
995
996 #if 0
997 #define LIMIT_RELOAD_CLASS(MODE, CLASS) dsp16xx_limit_reload_class (MODE, CLASS)
998 #endif
999
1000 /* A C expression for the maximum number of consecutive registers of class CLASS
1001 needed to hold a value of mode MODE */
1002 #define CLASS_MAX_NREGS(CLASS, MODE) \
1003 class_max_nregs(CLASS, MODE)
1004
1005 /* The letters 'I' through 'P' in a register constraint string
1006 can be used to stand for particular ranges of immediate operands.
1007 This macro defines what the ranges are.
1008 C is the letter, and VALUE is a constant value.
1009 Return 1 if VALUE is in the range specified by C.
1010
1011 For the 16xx, the following constraints are used:
1012 'I' requires a non-negative 16-bit value.
1013 'J' requires a non-negative 9-bit value
1014 'K' requires a constant 0 operand.
1015 'L' requires 16-bit value
1016 'M' 32-bit value -- low 16-bits zero
1017 */
1018
1019 #define SMALL_INT(X) (SMALL_INTVAL (INTVAL (X)))
1020 #define SMALL_INTVAL(I) ((unsigned) (I) < 0x10000)
1021 #define SHORT_IMMEDIATE(X) (SHORT_INTVAL (INTVAL(X)))
1022 #define SHORT_INTVAL(I) ((unsigned) (I) < 0x100)
1023
1024 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
1025 ((C) == 'I' ? (SMALL_INTVAL(VALUE)) \
1026 : (C) == 'J' ? (SHORT_INTVAL(VALUE)) \
1027 : (C) == 'K' ? ((VALUE) == 0) \
1028 : (C) == 'L' ? ! ((VALUE) & ~0x0000ffff) \
1029 : (C) == 'M' ? ! ((VALUE) & ~0xffff0000) \
1030 : (C) == 'N' ? ((VALUE) == -1 || (VALUE) == 1 || \
1031 (VALUE) == -2 || (VALUE) == 2) \
1032 : 0)
1033
1034 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1
1035
1036 /* Optional extra constraints for this machine */
1037 #define EXTRA_CONSTRAINT(OP,C) \
1038 ((C) == 'R' ? symbolic_address_p (OP) \
1039 : 0)
1040 \f
1041 /* DESCRIBING STACK LAYOUT AND CALLING CONVENTIONS */
1042
1043 /* Define this if pushing a word on the stack
1044 makes the stack pointer a smaller address. */
1045 /* #define STACK_GROWS_DOWNWARD */
1046
1047 /* Define this if the nominal address of the stack frame
1048 is at the high-address end of the local variables;
1049 that is, each additional local variable allocated
1050 goes at a more negative offset in the frame. */
1051 /* #define FRAME_GROWS_DOWNWARD */
1052
1053 #define ARGS_GROW_DOWNWARD
1054
1055 /* We use post decrement on the 1600 because there isn't
1056 a pre-decrement addressing mode. This means that we
1057 assume the stack pointer always points at the next
1058 FREE location on the stack. */
1059 #define STACK_PUSH_CODE POST_INC
1060
1061 /* Offset within stack frame to start allocating local variables at.
1062 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
1063 first local allocated. Otherwise, it is the offset to the BEGINNING
1064 of the first local allocated. */
1065 #define STARTING_FRAME_OFFSET 0
1066
1067 /* Offset from the stack pointer register to the first
1068 location at which outgoing arguments are placed. */
1069 #define STACK_POINTER_OFFSET (0)
1070
1071 struct dsp16xx_frame_info
1072 {
1073 unsigned long total_size; /* # bytes that the entire frame takes up */
1074 unsigned long var_size; /* # bytes that variables take up */
1075 unsigned long args_size; /* # bytes that outgoing arguments take up */
1076 unsigned long extra_size; /* # bytes of extra gunk */
1077 unsigned int reg_size; /* # bytes needed to store regs */
1078 long fp_save_offset; /* offset from vfp to store registers */
1079 unsigned long sp_save_offset; /* offset from new sp to store registers */
1080 int initialized; /* != 0 if frame size already calculated */
1081 int num_regs; /* number of registers saved */
1082 int function_makes_calls; /* Does the function make calls */
1083 };
1084
1085 extern struct dsp16xx_frame_info current_frame_info;
1086
1087 /* If we generate an insn to push BYTES bytes,
1088 this says how many the stack pointer really advances by. */
1089 /* #define PUSH_ROUNDING(BYTES) ((BYTES)) */
1090
1091 /* If defined, the maximum amount of space required for outgoing
1092 arguments will be computed and placed into the variable
1093 'current_function_outgoing_args_size'. No space will be pushed
1094 onto the stack for each call; instead, the function prologue should
1095 increase the stack frame size by this amount.
1096
1097 It is not proper to define both 'PUSH_ROUNDING' and
1098 'ACCUMULATE_OUTGOING_ARGS'. */
1099 #define ACCUMULATE_OUTGOING_ARGS
1100
1101 /* Offset of first parameter from the argument pointer
1102 register value. */
1103
1104 #define FIRST_PARM_OFFSET(FNDECL) (0)
1105
1106 /* Value is 1 if returning from a function call automatically
1107 pops the arguments described by the number-of-args field in the call.
1108 FUNDECL is the declaration node of the function (as a tree),
1109 FUNTYPE is the data type of the function (as a tree),
1110 or for a library call it is an identifier node for the subroutine name. */
1111
1112 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
1113
1114 /* Define how to find the value returned by a function.
1115 VALTYPE is the data type of the value (as a tree).
1116 If the precise function being called is known, FUNC is its FUNCTION_DECL;
1117 otherwise, FUNC is 0. On the 1610 all function return their values
1118 in a0 (i.e. the upper 16 bits). If the return value is 32-bits the
1119 entire register is significant. */
1120
1121 #define VALUE_REGNO(MODE) (REG_Y)
1122
1123 #define FUNCTION_VALUE(VALTYPE, FUNC) \
1124 gen_rtx_REG (TYPE_MODE (VALTYPE), VALUE_REGNO(TYPE_MODE(VALTYPE)))
1125
1126 /* Define how to find the value returned by a library function
1127 assuming the value has mode MODE. */
1128 #define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, VALUE_REGNO(MODE))
1129
1130 /* 1 if N is a possible register number for a function value. */
1131 #define FUNCTION_VALUE_REGNO_P(N) ((N) == REG_Y)
1132 \f
1133
1134 /* Define where to put the arguments to a function.
1135 Value is zero to push the argument on the stack,
1136 or a hard register in which to store the argument.
1137
1138 MODE is the argument's machine mode.
1139 TYPE is the data type of the argument (as a tree).
1140 This is null for libcalls where that information may
1141 not be available.
1142 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1143 the preceding args and about the function being called.
1144 NAMED is nonzero if this argument is a named parameter
1145 (otherwise it is an extra parameter matching an ellipsis). */
1146
1147 /* On the 1610 all args are pushed, except if -mregparm is specified
1148 then the first two words of arguments are passed in a0, a1. */
1149 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1150 dsp16xx_function_arg (CUM, MODE, TYPE, NAMED)
1151
1152 /* Define the first register to be used for argument passing */
1153 #define FIRST_REG_FOR_FUNCTION_ARG REG_Y
1154
1155 /* Define the profitability of saving registers around calls.
1156 NOTE: For now we turn this off because of a bug in the
1157 caller-saves code and also because i'm not sure it is helpful
1158 on the 1610. */
1159
1160 #define CALLER_SAVE_PROFITABLE(REFS,CALLS) 0
1161
1162 /* This indicates that an argument is to be passed with an invisible reference
1163 (i.e., a pointer to the object is passed).
1164
1165 On the dsp16xx, we do this if it must be passed on the stack. */
1166
1167 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
1168 (MUST_PASS_IN_STACK (MODE, TYPE))
1169
1170 /* For an arg passed partly in registers and partly in memory,
1171 this is the number of registers used.
1172 For args passed entirely in registers or entirely in memory, zero. */
1173
1174 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) (0)
1175
1176 /* Define a data type for recording info about an argument list
1177 during the scan of that argument list. This data type should
1178 hold all necessary information about the function itself
1179 and about the args processed so far, enough to enable macros
1180 such as FUNCTION_ARG to determine where the next arg should go. */
1181 #define CUMULATIVE_ARGS int
1182
1183 /* Initialize a variable CUM of type CUMULATIVE_ARGS
1184 for a call to a function whose data type is FNTYPE.
1185 For a library call, FNTYPE is 0. */
1186 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) ((CUM) = 0)
1187
1188 /* Update the data in CUM to advance over an argument
1189 of mode MODE and data type TYPE.
1190 (TYPE is null for libcalls where that information may not be available.) */
1191
1192 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1193 dsp16xx_function_arg_advance (&CUM, MODE,TYPE, NAMED)
1194
1195 /* 1 if N is a possible register number for function argument passing. */
1196 #define FUNCTION_ARG_REGNO_P(N) \
1197 ((N) == REG_Y || (N) == REG_YL || (N) == REG_PROD || (N) == REG_PRODL)
1198
1199 /* This macro generates the assembly code for function entry.
1200 FILE is a stdio stream to output the code to.
1201 SIZE is an int: how many units of temporary storage to allocate.
1202 Refer to the array `regs_ever_live' to determine which registers
1203 to save; `regs_ever_live[I]' is nonzero if register number I
1204 is ever used in the function. This macro is responsible for
1205 knowing which registers should not be saved even if used. */
1206
1207 #define FUNCTION_PROLOGUE(FILE, SIZE) function_prologue(FILE, SIZE)
1208
1209 /* Output assembler code to FILE to increment profiler label # LABELNO
1210 for profiling a function entry. */
1211
1212 #define FUNCTION_PROFILER(FILE, LABELNO) fatal("Profiling not implemented yet.")
1213
1214 /* Output assembler code to FILE to initialize this source file's
1215 basic block profiling info, if that has not already been done. */
1216 #define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) fatal("Profiling not implemented yet.")
1217
1218 /* Output assembler code to FILE to increment the entry-count for
1219 the BLOCKNO'th basic block in this source file. */
1220 #define BLOCK_PROFILER(FILE, BLOCKNO) fatal("Profiling not implemented yet.")
1221
1222
1223 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1224 the stack pointer does not matter. The value is tested only in
1225 functions that have frame pointers.
1226 No definition is equivalent to always zero. */
1227
1228 #define EXIT_IGNORE_STACK (0)
1229
1230 #define TRAMPOLINE_TEMPLATE(FILE) fatal ("Trampolines not yet implemented");
1231
1232 /* Length in units of the trampoline for entering a nested function.
1233 This is a dummy value */
1234
1235 #define TRAMPOLINE_SIZE 20
1236
1237 /* Emit RTL insns to initialize the variable parts of a trampoline.
1238 FNADDR is an RTX for the address of the function's pure code.
1239 CXT is an RTX for the static chain value for the function. */
1240
1241 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1242 fatal ("Trampolines not yet implemented");
1243
1244 /* This macro generates the assembly code for function exit,
1245 on machines that need it. If FUNCTION_EPILOGUE is not defined
1246 then individual return instructions are generated for each
1247 return statement. Args are same as for FUNCTION_PROLOGUE.
1248
1249 The function epilogue should not depend on the current stack pointer!
1250 It should use the frame pointer only. This is mandatory because
1251 of alloca; we also take advantage of it to omit stack adjustments
1252 before returning. */
1253
1254 #define FUNCTION_EPILOGUE(FILE, SIZE) function_epilogue(FILE, SIZE)
1255
1256 /* A C expression which is nonzero if a function must have and use a
1257 frame pointer. If its value is nonzero the functions will have a
1258 frame pointer. */
1259 #define FRAME_POINTER_REQUIRED (current_function_calls_alloca)
1260
1261 /* A C statement to store in the variable 'DEPTH' the difference
1262 between the frame pointer and the stack pointer values immediately
1263 after the function prologue. */
1264 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
1265 { (DEPTH) = initial_frame_pointer_offset(); \
1266 }
1267 \f
1268 /* IMPLICIT CALLS TO LIBRARY ROUTINES */
1269
1270 #define ADDHF3_LIBCALL "__Emulate_addhf3"
1271 #define SUBHF3_LIBCALL "__Emulate_subhf3"
1272 #define MULHF3_LIBCALL "__Emulate_mulhf3"
1273 #define DIVHF3_LIBCALL "__Emulate_divhf3"
1274 #define CMPHF3_LIBCALL "__Emulate_cmphf3"
1275 #define FIXHFHI2_LIBCALL "__Emulate_fixhfhi2"
1276 #define FLOATHIHF2_LIBCALL "__Emulate_floathihf2"
1277 #define NEGHF2_LIBCALL "__Emulate_neghf2"
1278
1279 #define UMULHI3_LIBCALL "__Emulate_umulhi3"
1280 #define MULHI3_LIBCALL "__Emulate_mulhi3"
1281 #define UDIVQI3_LIBCALL "__Emulate_udivqi3"
1282 #define UDIVHI3_LIBCALL "__Emulate_udivhi3"
1283 #define DIVQI3_LIBCALL "__Emulate_divqi3"
1284 #define DIVHI3_LIBCALL "__Emulate_divhi3"
1285 #define MODQI3_LIBCALL "__Emulate_modqi3"
1286 #define MODHI3_LIBCALL "__Emulate_modhi3"
1287 #define UMODQI3_LIBCALL "__Emulate_umodqi3"
1288 #define UMODHI3_LIBCALL "__Emulate_umodhi3"
1289 #define ASHRHI3_LIBCALL "__Emulate_ashrhi3"
1290 #define LSHRHI3_LIBCALL "__Emulate_lshrhi3"
1291 #define ASHLHI3_LIBCALL "__Emulate_ashlhi3"
1292 #define LSHLHI3_LIBCALL "__Emulate_lshlhi3" /* NOT USED */
1293
1294 /* Define this macro if calls to the ANSI C library functions memcpy and
1295 memset should be generated instead of the BSD function bcopy & bzero. */
1296 #define TARGET_MEM_FUNCTIONS
1297
1298 \f
1299 /* ADDRESSING MODES */
1300
1301 /* The 1610 has post-increment and decrement, but no pre-modify */
1302 #define HAVE_POST_INCREMENT 1
1303 #define HAVE_POST_DECREMENT 1
1304
1305 /* #define HAVE_PRE_DECREMENT 0 */
1306 /* #define HAVE_PRE_INCREMENT 0 */
1307
1308 /* Recognize any constant value that is a valid address. */
1309 #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
1310
1311 /* Maximum number of registers that can appear in a valid memory address. */
1312 #define MAX_REGS_PER_ADDRESS 1
1313
1314 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1315 and check its validity for a certain class.
1316 We have two alternate definitions for each of them.
1317 The usual definition accepts all pseudo regs; the other rejects
1318 them unless they have been allocated suitable hard regs.
1319 The symbol REG_OK_STRICT causes the latter definition to be used.
1320
1321 Most source files want to accept pseudo regs in the hope that
1322 they will get allocated to the class that the insn wants them to be in.
1323 Source files for reload pass need to be strict.
1324 After reload, it makes no difference, since pseudo regs have
1325 been eliminated by then. */
1326
1327 #ifndef REG_OK_STRICT
1328
1329 /* Nonzero if X is a hard reg that can be used as an index
1330 or if it is a pseudo reg. */
1331 #define REG_OK_FOR_INDEX_P(X) 0
1332
1333 /* Nonzero if X is a hard reg that can be used as a base reg
1334 or if it is a pseudo reg. */
1335 #define REG_OK_FOR_BASE_P(X) \
1336 ((REGNO (X) >= REG_R0 && REGNO (X) < REG_R3 + 1 ) \
1337 || (REGNO (X) >= FIRST_PSEUDO_REGISTER))
1338
1339 /* Nonzero if X is the 'ybase' register */
1340 #define REG_OK_FOR_YBASE_P(X) \
1341 (REGNO(X) == REG_YBASE || (REGNO (X) >= FIRST_PSEUDO_REGISTER))
1342 #else
1343
1344 /* Nonzero if X is a hard reg that can be used as an index. */
1345 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1346
1347 /* Nonzero if X is a hard reg that can be used as a base reg. */
1348 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1349
1350 /* Nonzero if X is the 'ybase' register */
1351 #define REG_OK_FOR_YBASE_P(X) REGNO_OK_FOR_YBASE_P (REGNO(X))
1352
1353 #endif
1354 \f
1355 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1356 that is a valid memory address for an instruction.
1357 The MODE argument is the machine mode for the MEM expression
1358 that wants to use this address.
1359
1360 On the 1610, the actual legitimate addresses must be N (N must fit in
1361 5 bits), *rn (register indirect), *rn++, or *rn-- */
1362
1363 #define INT_FITS_5_BITS(I) ((unsigned long) (I) < 0x20)
1364 #define INT_FITS_16_BITS(I) ((unsigned long) (I) < 0x10000)
1365 #define YBASE_CONST_OFFSET(I) ((I) >= -31 && (I) <= 0)
1366 #define YBASE_OFFSET(X) (GET_CODE (X) == CONST_INT && YBASE_CONST_OFFSET (INTVAL(X)))
1367
1368 #define FITS_16_BITS(X) (GET_CODE (X) == CONST_INT && INT_FITS_16_BITS(INTVAL(X)))
1369 #define FITS_5_BITS(X) (GET_CODE (X) == CONST_INT && INT_FITS_5_BITS(INTVAL(X)))
1370 #define ILLEGAL_HIMODE_ADDR(MODE, CONST) ((MODE) == HImode && CONST == -31)
1371
1372 #define INDIRECTABLE_ADDRESS_P(X) \
1373 ((GET_CODE(X) == REG && REG_OK_FOR_BASE_P(X)) \
1374 || ((GET_CODE(X) == POST_DEC || GET_CODE(X) == POST_INC) \
1375 && REG_P(XEXP(X,0)) && REG_OK_FOR_BASE_P(XEXP(X,0))) \
1376 || (GET_CODE(X) == CONST_INT && (unsigned long) (X) < 0x20))
1377
1378
1379 #define INDEXABLE_ADDRESS_P(X,MODE) \
1380 ((GET_CODE(X) == PLUS && GET_CODE (XEXP (X,0)) == REG && \
1381 XEXP(X,0) == stack_pointer_rtx && YBASE_OFFSET(XEXP(X,1)) && \
1382 !ILLEGAL_HIMODE_ADDR(MODE, INTVAL(XEXP(X,1)))) || \
1383 (GET_CODE(X) == PLUS && GET_CODE (XEXP (X,1)) == REG && \
1384 XEXP(X,1) == stack_pointer_rtx && YBASE_OFFSET(XEXP(X,0)) && \
1385 !ILLEGAL_HIMODE_ADDR(MODE, INTVAL(XEXP(X,0)))))
1386
1387 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1388 { \
1389 if (INDIRECTABLE_ADDRESS_P(X)) \
1390 goto ADDR; \
1391 }
1392
1393 \f
1394 /* Try machine-dependent ways of modifying an illegitimate address
1395 to be legitimate. If we find one, return the new, valid address.
1396 This macro is used in only one place: `memory_address' in explow.c.
1397
1398 OLDX is the address as it was before break_out_memory_refs was called.
1399 In some cases it is useful to look at this to decide what needs to be done.
1400
1401 MODE and WIN are passed so that this macro can use
1402 GO_IF_LEGITIMATE_ADDRESS.
1403
1404 It is always safe for this macro to do nothing. It exists to recognize
1405 opportunities to optimize the output.
1406
1407 For the 1610, we need not do anything. However, if we don't,
1408 `memory_address' will try lots of things to get a valid address, most of
1409 which will result in dead code and extra pseudos. So we make the address
1410 valid here.
1411
1412 This is easy: The only valid addresses are an offset from a register
1413 and we know the address isn't valid. So just call either `force_operand'
1414 or `force_reg' unless this is a (plus (reg ...) (const_int 0)). */
1415
1416 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
1417 { if (GET_CODE (X) == PLUS && XEXP (X, 1) == const0_rtx) \
1418 X = XEXP (x, 0); \
1419 if (GET_CODE (X) == MULT || GET_CODE (X) == PLUS) \
1420 X = force_operand (X, 0); \
1421 else \
1422 X = force_reg (Pmode, X); \
1423 goto WIN; \
1424 }
1425
1426 /* Go to LABEL if ADDR (a legitimate address expression)
1427 has an effect that depends on the machine mode it is used for.
1428 On the 1610, only postdecrement and postincrement address depend thus
1429 (the amount of decrement or increment being the length of the operand). */
1430
1431 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1432 if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == POST_DEC) goto LABEL
1433
1434 /* Nonzero if the constant value X is a legitimate general operand.
1435 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1436 #define LEGITIMATE_CONSTANT_P(X) (1)
1437
1438 \f
1439 /* CONDITION CODE INFORMATION */
1440
1441 /* Store in cc_status the expressions
1442 that the condition codes will describe
1443 after execution of an instruction whose pattern is EXP.
1444 Do not alter them if the instruction would not alter the cc's. */
1445
1446 #define NOTICE_UPDATE_CC(EXP, INSN) \
1447 notice_update_cc( (EXP) )
1448 \f
1449 /* DESCRIBING RELATIVE COSTS OF OPERATIONS */
1450
1451 /* Compute the cost of computing a constant rtl expression RTX
1452 whose rtx-code is CODE. The body of this macro is a portion
1453 of a switch statement. If the code is computed here,
1454 return it with a return statement. */
1455 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1456 case CONST_INT: \
1457 return 0; \
1458 case LABEL_REF: \
1459 case SYMBOL_REF: \
1460 case CONST: \
1461 return COSTS_N_INSNS (1); \
1462 \
1463 case CONST_DOUBLE: \
1464 return COSTS_N_INSNS (2);
1465
1466 /* Like CONST_COSTS but applies to nonconstant RTL expressions.
1467 This can be used, for example to indicate how costly a multiply
1468 instruction is. */
1469 #define RTX_COSTS(X,CODE,OUTER_CODE) \
1470 case MEM: \
1471 return GET_MODE (X) == QImode ? COSTS_N_INSNS (2) : \
1472 COSTS_N_INSNS (4); \
1473 case DIV: \
1474 case MOD: \
1475 return COSTS_N_INSNS (38); \
1476 case MULT: \
1477 if (GET_MODE (X) == QImode) \
1478 return COSTS_N_INSNS (2); \
1479 else \
1480 return COSTS_N_INSNS (38); \
1481 case PLUS: \
1482 if (GET_MODE_CLASS (GET_MODE (X)) == MODE_INT) \
1483 { \
1484 if (GET_CODE (XEXP (X,1)) == CONST_INT) \
1485 { \
1486 int number = INTVAL(XEXP (X,1)); \
1487 if (number == 1) \
1488 return COSTS_N_INSNS (1); \
1489 if (INT_FITS_16_BITS(number)) \
1490 return COSTS_N_INSNS (2); \
1491 else \
1492 return COSTS_N_INSNS (4); \
1493 } \
1494 return COSTS_N_INSNS (1); \
1495 } \
1496 else \
1497 return COSTS_N_INSNS (38); \
1498 case MINUS: \
1499 if (GET_MODE_CLASS (GET_MODE (X)) == MODE_INT) \
1500 { \
1501 if (GET_CODE (XEXP (X,1)) == CONST_INT) \
1502 { \
1503 if (INT_FITS_16_BITS(INTVAL(XEXP(X,1)))) \
1504 return COSTS_N_INSNS (2); \
1505 else \
1506 return COSTS_N_INSNS (4); \
1507 } \
1508 return COSTS_N_INSNS (1); \
1509 } \
1510 else \
1511 return COSTS_N_INSNS (38); \
1512 case AND: case IOR: case XOR: \
1513 if (GET_CODE (XEXP (X,1)) == CONST_INT) \
1514 { \
1515 if (INT_FITS_16_BITS(INTVAL(XEXP(X,1)))) \
1516 return COSTS_N_INSNS (2); \
1517 else \
1518 return COSTS_N_INSNS (4); \
1519 } \
1520 return COSTS_N_INSNS (1); \
1521 case NEG: case NOT: \
1522 return COSTS_N_INSNS (1); \
1523 case ASHIFT: \
1524 case ASHIFTRT: \
1525 case LSHIFTRT: \
1526 if (GET_CODE (XEXP (X,1)) == CONST_INT) \
1527 { \
1528 int number = INTVAL(XEXP (X,1)); \
1529 if (number == 1 || number == 4 || number == 8 || \
1530 number == 16) \
1531 return COSTS_N_INSNS (1); \
1532 else \
1533 return COSTS_N_INSNS (2); \
1534 } \
1535 return COSTS_N_INSNS (1);
1536
1537 /* An expression giving the cost of an addressing mode that contains
1538 address. */
1539 #define ADDRESS_COST(ADDR) dsp16xx_address_cost (ADDR)
1540
1541 /* A c expression for the cost of moving data from a register in
1542 class FROM to one in class TO. The classes are expressed using
1543 the enumeration values such as GENERAL_REGS. A value of 2 is
1544 the default. */
1545 #define REGISTER_MOVE_COST(FROM,TO) dsp16xx_register_move_cost (FROM, TO)
1546
1547 /* A C expression for the cost of moving data of mode MODE between
1548 a register and memory. A value of 2 is the default. */
1549 #define MEMORY_MOVE_COST(MODE,CLASS,IN) \
1550 (GET_MODE_CLASS(MODE) == MODE_INT && MODE == QImode ? 12 \
1551 : 16)
1552
1553 /* A C expression for the cost of a branch instruction. A value of
1554 1 is the default; */
1555 #define BRANCH_COST 2
1556 \f
1557
1558 /* Define this because otherwise gcc will try to put the function address
1559 in any old pseudo register. We can only use pt. */
1560 #define NO_FUNCTION_CSE
1561
1562 /* Define this macro as a C expression which is nonzero if accessing less
1563 than a word of memory (i.e a char or short) is no faster than accessing
1564 a word of memory, i.e if such access require more than one instruction
1565 or if ther is no difference in cost between byte and (aligned) word
1566 loads. */
1567 #define SLOW_BYTE_ACCESS 1
1568
1569 /* Define this macro if zero-extension (of a char or short to an int) can
1570 be done faster if the destination is a register that is know to be zero. */
1571 /* #define SLOW_ZERO_EXTEND */
1572
1573 /* Define this macro if unaligned accesses have a cost many times greater than
1574 aligned accesses, for example if they are emulated in a trap handler */
1575 /* define SLOW_UNALIGNED_ACCESS */
1576
1577 /* Define this macro to inhibit strength reduction of memory addresses */
1578 /* #define DONT_REDUCE_ADDR */
1579
1580 \f
1581 /* DIVIDING THE OUTPUT IN SECTIONS */
1582 /* Output before read-only data. */
1583
1584 #define DEFAULT_TEXT_SEG_NAME ".text"
1585 #define TEXT_SECTION_ASM_OP rsect_text
1586
1587 /* Output before constants and strings */
1588 #define DEFAULT_CONST_SEG_NAME ".const"
1589 #define READONLY_SECTION_ASM_OP rsect_const
1590 #define READONLY_DATA_SECTION const_section
1591
1592 /* Output before writable data. */
1593 #define DEFAULT_DATA_SEG_NAME ".data"
1594 #define DATA_SECTION_ASM_OP rsect_data
1595
1596 #define DEFAULT_BSS_SEG_NAME ".bss"
1597 #define BSS_SECTION_ASM_OP rsect_bss
1598
1599 /* We will default to using 1610 if the user doesn't
1600 specify it. */
1601 #define DEFAULT_CHIP_NAME "1610"
1602
1603 /* A list of names for sections other than the standard ones, which are
1604 'in_text' and 'in_data' (and .bss if BSS_SECTION_ASM_OP is defined). */
1605 #define EXTRA_SECTIONS in_const
1606
1607 #define EXTRA_SECTION_FUNCTIONS \
1608 void \
1609 const_section () \
1610 { \
1611 if (in_section != in_const) \
1612 { \
1613 fprintf (asm_out_file, "%s\n", READONLY_SECTION_ASM_OP); \
1614 in_section = in_const; \
1615 } \
1616 }
1617 \f
1618 /* THE OVERALL FRAMEWORK OF AN ASSEMBLER FILE */
1619
1620 /* Output at beginning of assembler file. */
1621 #define ASM_FILE_START(FILE) dsp16xx_file_start ()
1622
1623 /* Prevent output of .gcc_compiled */
1624 #define ASM_IDENTIFY_GCC(FILE)
1625
1626 /* A C string constant describing how to begin a comment in the target
1627 assembler language. */
1628 /* define ASM_COMMENT_START */
1629
1630 /* Output to assembler file text saying following lines
1631 may contain character constants, extra white space, comments, etc. */
1632 #define ASM_APP_ON ""
1633
1634 /* Output to assembler file text saying following lines
1635 no longer contain unusual constructs. */
1636 #define ASM_APP_OFF ""
1637 \f
1638 /* OUTPUT OF DATA */
1639
1640 /* This is how to output an assembler line defining a `double' constant. */
1641 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) asm_output_float (FILE,VALUE)
1642
1643 /* This is how to output an assembler line defining a `float' constant. */
1644 #define ASM_OUTPUT_FLOAT(FILE,VALUE) asm_output_float (FILE, VALUE)
1645
1646 /* This is how to output an assembler line defining a 'float' constant of
1647 size HFmode. */
1648 #define ASM_OUTPUT_SHORT_FLOAT(FILE,VALUE) asm_output_float (FILE, VALUE)
1649
1650 /* This is how to output an assembler line defining an `char' constant. */
1651 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
1652 ( fprintf (FILE, "\tint "), \
1653 output_addr_const (FILE, (VALUE)), \
1654 fprintf (FILE, "\n"))
1655
1656 /* This is how to output an assembler line defining an `short' constant. */
1657 #define ASM_OUTPUT_SHORT(FILE,EXP) asm_output_long(FILE,INTVAL(EXP))
1658
1659 /* This is how to output an assembler line defining a 'int' constant. */
1660 #define ASM_OUTPUT_INT(FILE, EXP) asm_output_long(FILE,INTVAL(EXP))
1661
1662 /* This is how to output an assembler line for a numeric constant byte. */
1663 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
1664 fprintf ((FILE), "\tint %ld\n", (long)(VALUE))
1665
1666
1667 /* This is how we output a 'c' character string. For the 16xx
1668 assembler we have to do it one letter at a time */
1669
1670 #define ASCII_LENGTH 10
1671
1672 #define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
1673 do { \
1674 FILE *_hide_asm_out_file = (MYFILE); \
1675 unsigned char *_hide_p = (unsigned char *) (MYSTRING); \
1676 int _hide_thissize = (MYLENGTH); \
1677 { \
1678 FILE *asm_out_file = _hide_asm_out_file; \
1679 unsigned char *p = _hide_p; \
1680 int thissize = _hide_thissize; \
1681 int i; \
1682 \
1683 for (i = 0; i < thissize; i++) \
1684 { \
1685 register int c = p[i]; \
1686 \
1687 if (i % ASCII_LENGTH == 0) \
1688 fprintf (asm_out_file, "\tint "); \
1689 \
1690 if (c >= ' ' && c < 0177 && c != '\'') \
1691 { \
1692 putc ('\'', asm_out_file); \
1693 putc (c, asm_out_file); \
1694 putc ('\'', asm_out_file); \
1695 } \
1696 else \
1697 { \
1698 fprintf (asm_out_file, "%d", c); \
1699 /* After an octal-escape, if a digit follows, \
1700 terminate one string constant and start another. \
1701 The Vax assembler fails to stop reading the escape \
1702 after three digits, so this is the only way we \
1703 can get it to parse the data properly. \
1704 if (i < thissize - 1 \
1705 && p[i + 1] >= '0' && p[i + 1] <= '9') \
1706 fprintf (asm_out_file, "\'\n\tint \'"); \
1707 */ \
1708 } \
1709 /* if: \
1710 we are not at the last char (i != thissize -1) \
1711 and (we are not at a line break multiple \
1712 but i == 0) (it will be the very first time) \
1713 then put out a comma to extend. \
1714 */ \
1715 if ((i != thissize - 1) && ((i + 1) % ASCII_LENGTH)) \
1716 fprintf(asm_out_file, ","); \
1717 if (!((i + 1) % ASCII_LENGTH)) \
1718 fprintf (asm_out_file, "\n"); \
1719 } \
1720 fprintf (asm_out_file, "\n"); \
1721 } \
1722 } \
1723 while (0)
1724
1725 /* Store in OUTPUT a string (made with alloca) containing
1726 an assembler-name for a local static variable or function
1727 named NAME. LABELNO is an integer which is different for
1728 each call. */
1729
1730 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1731 do { \
1732 int len = strlen (NAME); \
1733 char *temp = (char *) alloca (len + 3); \
1734 temp[0] = 'L'; \
1735 strcpy (&temp[1], (NAME)); \
1736 temp[len + 1] = '_'; \
1737 temp[len + 2] = 0; \
1738 (OUTPUT) = (char *) alloca (strlen (NAME) + 11); \
1739 ASM_GENERATE_INTERNAL_LABEL (OUTPUT, temp, LABELNO); \
1740 } while (0)
1741
1742 #define ASM_OPEN_PAREN "("
1743 #define ASM_CLOSE_PAREN ")"
1744
1745 \f
1746 /* OUTPUT OF UNINITIALIZED VARIABLES */
1747
1748 /* This says how to output an assembler line
1749 to define a global common symbol. */
1750
1751 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1752 asm_output_common (FILE, NAME, SIZE, ROUNDED);
1753
1754 /* This says how to output an assembler line
1755 to define a local common symbol. */
1756
1757 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
1758 asm_output_local (FILE, NAME, SIZE, ROUNDED);
1759 \f
1760 /* OUTPUT AND GENERATION OF LABELS */
1761
1762 /* This is how to output the definition of a user-level label named NAME,
1763 such as the label on a static function or variable NAME. */
1764 #define ASM_OUTPUT_LABEL(FILE,NAME) \
1765 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1766
1767 /* This is how to output a command to make the user-level label named NAME
1768 defined for reference from other files. */
1769
1770 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
1771 do { fputs (".global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
1772
1773 /* A C statement to output to the stdio stream any text necessary
1774 for declaring the name of an external symbol named name which
1775 is referenced in this compilation but not defined. */
1776
1777 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
1778 { \
1779 fprintf (FILE, ".extern "); \
1780 assemble_name (FILE, NAME); \
1781 fprintf (FILE, "\n"); \
1782 }
1783 /* A C statement to output on stream an assembler pseudo-op to
1784 declare a library function named external. */
1785
1786 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
1787 { \
1788 fprintf (FILE, ".extern "); \
1789 assemble_name (FILE, XSTR (FUN, 0)); \
1790 fprintf (FILE, "\n"); \
1791 }
1792
1793 /* The prefix to add to user-visible assembler symbols. */
1794
1795 #define USER_LABEL_PREFIX "_"
1796
1797 /* This is how to output an internal numbered label where
1798 PREFIX is the class of label and NUM is the number within the class. */
1799 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1800 fprintf (FILE, "%s%d:\n", PREFIX, NUM)
1801
1802 /* This is how to store into the string LABEL
1803 the symbol_ref name of an internal numbered label where
1804 PREFIX is the class of label and NUM is the number within the class.
1805 This is suitable for output with `assemble_name'. */
1806 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1807 sprintf (LABEL, "*%s%d", PREFIX, NUM)
1808
1809 \f
1810 /* OUTPUT OF ASSEMBLER INSTRUCTIONS */
1811
1812 /* How to refer to registers in assembler output.
1813 This sequence is indexed by compiler's hard-register-number (see above). */
1814
1815 #define REGISTER_NAMES \
1816 {"a0", "a0l", "a1", "a1l", "x", "y", "yl", "p", "pl", \
1817 "r0", "r1", "r2", "r3", "j", "k", "ybase", "pt", \
1818 "ar0", "ar1", "ar2", "ar3", \
1819 "c0", "c1", "c2", "pr", "rb", \
1820 "*(0)", "*(1)", "*(2)", "*(3)", "*(4)", "*(5)", \
1821 "*(6)", "*(7)", "*(8)", "*(9)", "*(10)", "*(11)", \
1822 "*(12)", "*(13)", "*(14)", "*(15)", "*(16)", "*(17)", \
1823 "*(18)", "*(19)", "*(20)", "*(21)", "*(22)", "*(23)", \
1824 "*(24)", "*(25)", "*(26)", "*(27)", "*(28)", "*(29)", \
1825 "*(30)", "*(31)" }
1826
1827 #define HIMODE_REGISTER_NAMES \
1828 {"a0", "a0", "a1", "a1", "x", "y", "y", "p", "p", \
1829 "r0", "r1", "r2", "r3", "j", "k", "ybase", "pt", \
1830 "ar0", "ar1", "ar2", "ar3", \
1831 "c0", "c1", "c2", "pr", "rb", \
1832 "*(0)", "*(1)", "*(2)", "*(3)", "*(4)", "*(5)", \
1833 "*(6)", "*(7)", "*(8)", "*(9)", "*(10)", "*(11)", \
1834 "*(12)", "*(13)", "*(14)", "*(15)", "*(16)", "*(17)", \
1835 "*(18)", "*(19)", "*(20)", "*(21)", "*(22)", "*(23)", \
1836 "*(24)", "*(25)", "*(26)", "*(27)", "*(28)", "*(29)", \
1837 "*(30)", "*(31)" }
1838
1839 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) 0
1840
1841 /* Print operand X (an rtx) in assembler syntax to file FILE.
1842 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1843 For `%' followed by punctuation, CODE is the punctuation and X is null.
1844
1845 DSP1610 extensions for operand codes:
1846
1847 %H - print lower 16 bits of constant
1848 %U - print upper 16 bits of constant
1849 %w - print low half of register (e.g 'a0l')
1850 %u - print upper half of register (e.g 'a0')
1851 %b - print high half of accumulator for F3 ALU instructions
1852 %h - print constant in decimal */
1853
1854 #define PRINT_OPERAND(FILE, X, CODE) print_operand(FILE, X, CODE)
1855
1856
1857 /* Print a memory address as an operand to reference that memory location. */
1858
1859 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
1860
1861 /* This is how to output an insn to push a register on the stack.
1862 It need not be very fast code since it is used only for profiling */
1863 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) fatal("Profiling not implemented yet.");
1864
1865 /* This is how to output an insn to pop a register from the stack.
1866 It need not be very fast code since it is used only for profiling */
1867 #define ASM_OUTPUT_REG_POP(FILE,REGNO) fatal("Profiling not implemented yet.");
1868 \f
1869 /* OUTPUT OF DISPATCH TABLES */
1870
1871 /* This macro should be provided on machines where the addresses in a dispatch
1872 table are relative to the table's own address. */
1873 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1874 fprintf (FILE, "\tint L%d-L%d\n", VALUE, REL)
1875
1876 /* This macro should be provided on machines where the addresses in a dispatch
1877 table are absolute. */
1878 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1879 fprintf (FILE, "\tint L%d\n", VALUE)
1880
1881 /* ASSEMBLER COMMANDS FOR ALIGNMENT */
1882
1883 /* This is how to output an assembler line that says to advance
1884 the location counter to a multiple of 2**LOG bytes. We should
1885 not have to do any alignment since the 1610 is a word machine. */
1886 #define ASM_OUTPUT_ALIGN(FILE,LOG)
1887
1888 /* Define this macro if ASM_OUTPUT_SKIP should not be used in the text section
1889 because it fails to put zero1 in the bytes that are skipped. */
1890 #define ASM_NO_SKIP_IN_TEXT 1
1891
1892 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1893 fprintf (FILE, "\t%d * int 0\n", (SIZE))
1894
1895 /* CONTROLLING DEBUGGING INFORMATION FORMAT */
1896
1897 /* Define this macro if GCC should produce COFF-style debugging output
1898 for SDB in response to the '-g' option */
1899 #define SDB_DEBUGGING_INFO
1900
1901 /* Support generating stabs for the listing file generator */
1902 #define DBX_DEBUGGING_INFO
1903
1904 /* The default format when -g is given is still COFF debug info */
1905 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
1906
1907 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
1908 \f
1909 /* MISCELLANEOUS PARAMETERS */
1910
1911 /* Specify the machine mode that this machine uses
1912 for the index in the tablejump instruction. */
1913 #define CASE_VECTOR_MODE QImode
1914
1915 /* Define as C expression which evaluates to nonzero if the tablejump
1916 instruction expects the table to contain offsets from the address of the
1917 table.
1918 Do not define this if the table should contain absolute addresses. */
1919 /* #define CASE_VECTOR_PC_RELATIVE 1 */
1920
1921 /* Specify the tree operation to be used to convert reals to integers. */
1922 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1923
1924 /* This is the kind of divide that is easiest to do in the general case. */
1925 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1926
1927 /* Max number of bytes we can move from memory to memory
1928 in one reasonably fast instruction. */
1929 #define MOVE_MAX 1
1930
1931 /* Defining this macro causes the compiler to omit a sign-extend, zero-extend,
1932 or bitwise 'and' instruction that truncates the count of a shift operation
1933 to a width equal to the number of bits needed to represent the size of the
1934 object being shifted. Do not define this macro unless the truncation applies
1935 to both shift operations and bit-field operations (if any). */
1936 /* #define SHIFT_COUNT_TRUNCATED */
1937
1938 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1939 is done just by pretending it is already truncated. */
1940 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1941
1942 /* When a prototype says `char' or `short', really pass an `int'. */
1943 #define PROMOTE_PROTOTYPES
1944
1945 /* An alias for the machine mode used for pointers */
1946 #define Pmode QImode
1947
1948 /* A function address in a call instruction
1949 is a byte address (for indexing purposes)
1950 so give the MEM rtx a byte's mode. */
1951 #define FUNCTION_MODE QImode
1952
1953 #if !defined(__DATE__)
1954 #define TARGET_VERSION fprintf (stderr, " (%s)", VERSION_INFO1)
1955 #else
1956 #define TARGET_VERSION fprintf (stderr, " (%s, %s)", VERSION_INFO1, __DATE__)
1957 #endif
1958
1959 #define VERSION_INFO1 "AT&T DSP16xx C Cross Compiler, version 1.2.0"
1960
1961
1962 /* Define this as 1 if `char' should by default be signed; else as 0. */
1963 #define DEFAULT_SIGNED_CHAR 1
1964
1965 /* If this macro is defined, GNU CC gathers statistics about the number and
1966 kind of tree node it allocates during each run. The option '-fstats' will
1967 tell the compiler to print these statistics about the sizes of it obstacks. */
1968 #define GATHER_STATISTICS
1969
1970 /* Define this so gcc does not output a call to __main, since we
1971 are not currently supporting c++. */
1972 #define INIT_SECTION_ASM_OP 1
1973
1974 void dsp16xx_invalid_register_for_compare ();