calls.c (expand_call): Remove current_call_is_indirect nonsense.
[gcc.git] / gcc / config / clipper / clipper.h
1 /* Definitions of target machine for GNU compiler. Clipper version.
2 Copyright (C) 1987, 88, 91, 93-95, 1996 Free Software Foundation, Inc.
3 Contributed by Holger Teutsch (holger@hotbso.rhein-main.de)
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 2, 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 struct rtx_def *clipper_builtin_saveregs ();
23 extern int clipper_frame_size ();
24
25 /* Print subsidiary information on the compiler version in use. */
26
27 #define TARGET_VERSION fprintf (stderr, " (clipper)");
28
29 /* Run-time compilation parameters selecting different hardware subsets. */
30
31 extern int target_flags;
32
33 /* Macros used in the machine description to test the flags. */
34
35 /* Macro to define tables used to set the flags.
36 This is a list in braces of pairs in braces,
37 each pair being { "NAME", VALUE }
38 where VALUE is the bits to set or minus the bits to clear.
39 An empty string NAME is used to identify the default VALUE. */
40
41 #define TARGET_SWITCHES \
42 { { "c400", 1 }, \
43 { "c300", -1 }, \
44 { "", TARGET_DEFAULT} }
45
46 #define TARGET_C400 1
47 #define TARGET_C300 0
48
49 /* Default target_flags if no switches specified. */
50
51 #ifndef TARGET_DEFAULT
52 #define TARGET_DEFAULT TARGET_C300
53 #endif
54
55 /* Show that we can debug generated code without a frame pointer. */
56 #define CAN_DEBUG_WITHOUT_FP
57 \f
58 /* Target machine storage layout */
59
60 /* Define this if most significant bit is lowest numbered
61 in instructions that operate on numbered bit-fields. */
62
63 #define BITS_BIG_ENDIAN 0
64
65 /* Define this if most significant byte of a word is the lowest numbered. */
66
67 #define BYTES_BIG_ENDIAN 0
68
69 /* Define this if most significant word of a multiword number is the lowest
70 numbered. */
71
72 #define WORDS_BIG_ENDIAN 0
73
74 /* Number of bits in an addressable storage unit */
75 #define BITS_PER_UNIT 8
76
77 /* Width in bits of a "word", which is the contents of a machine register.
78 Note that this is not necessarily the width of data type `int';
79 if using 16-bit ints on a 68000, this would still be 32.
80 But on a machine with 16-bit registers, this would be 16. */
81 #define BITS_PER_WORD 32
82
83 /* Width of a word, in units (bytes). */
84 #define UNITS_PER_WORD 4
85
86 /* Width in bits of a pointer.
87 See also the macro `Pmode' defined below. */
88 #define POINTER_SIZE 32
89
90 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
91 #define PARM_BOUNDARY 32
92
93 /* Largest alignment for stack parameters (if greater than PARM_BOUNDARY). */
94 #define MAX_PARM_BOUNDARY 64
95
96 /* Allocation boundary (in *bits*) for the code of a function. */
97 #define FUNCTION_BOUNDARY 128
98
99 /* Alignment of field after `int : 0' in a structure. */
100 #define EMPTY_FIELD_BOUNDARY 32
101
102 /* Every structure's size must be a multiple of this. */
103 #define STRUCTURE_SIZE_BOUNDARY 8
104
105 /* A bitfield declared as `int' forces `int' alignment for the struct. */
106 #define PCC_BITFIELD_TYPE_MATTERS 1
107
108 /* No data type wants to be aligned rounder than this. */
109 #define BIGGEST_ALIGNMENT 64
110
111 /* No structure field wants to be aligned rounder than this. */
112 #define BIGGEST_FIELD_ALIGNMENT 64
113
114 /* Make strcpy of constants fast. */
115 #define CONSTANT_ALIGNMENT(CODE, TYPEALIGN) \
116 ((TYPEALIGN) < 32 ? 32 : (TYPEALIGN))
117
118 /* Make arrays of chars word-aligned for the same reasons. */
119 #define DATA_ALIGNMENT(TYPE, ALIGN) \
120 (TREE_CODE (TYPE) == ARRAY_TYPE \
121 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
122 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
123
124 /* Set this nonzero if move instructions will actually fail to work
125 when given unaligned data. */
126 #define STRICT_ALIGNMENT 1
127
128 /* Let's keep the stack somewhat aligned. */
129 #define STACK_BOUNDARY 64
130
131 /* Define this macro if it is advisable to hold scalars in registers
132 in a wider mode than that declared by the program. In such cases,
133 the value is constrained to be within the bounds of the declared
134 type, but kept valid in the wider mode. The signedness of the
135 extension may differ from that of the type.
136
137 For Clipper, we always store objects in a full register. */
138
139 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
140 if (GET_MODE_CLASS (MODE) == MODE_INT \
141 && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
142 { \
143 (UNSIGNEDP) = 0; \
144 (MODE) = SImode; \
145 }
146
147
148 /* Define this if function arguments should also be promoted using the above
149 procedure. */
150
151 /* FIXME: do we loose compatibility to acc if we define this? */
152
153 /* #define PROMOTE_FUNCTION_ARGS */
154
155 /* Likewise, if the function return value is promoted. */
156
157 /* #define PROMOTE_FUNCTION_RETURN */
158
159 \f
160 /* Standard register usage. */
161
162 /* Number of actual hardware registers.
163 The hardware registers are assigned numbers for the compiler
164 from 0 to just below FIRST_PSEUDO_REGISTER.
165 All registers that the compiler knows about must be given numbers,
166 even those that are not normally considered general registers. */
167 #define FIRST_PSEUDO_REGISTER 32
168
169 /* 1 for registers that have pervasive standard uses
170 and are not available for the register allocator.
171 On the clipper, these are the FP and SP . */
172 #define FIXED_REGISTERS \
173 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,\
174 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1} /* Default: C300 */
175
176 /* 1 for registers not available across function calls.
177 These must include the FIXED_REGISTERS and also any
178 registers that can be used without being saved.
179 The latter must include the registers where values are returned
180 and the register where structure-value addresses are passed.
181 Aside from that, you can include as many other registers as you like. */
182 #define CALL_USED_REGISTERS \
183 {1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,\
184 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1} /* default: C300 */
185
186 /* Zero or more C statements that may conditionally modify two
187 variables `fixed_regs' and `call_used_regs' (both of type `char
188 []') after they have been initialized from the two preceding
189 macros. A C400 has additional floating registers f8 -> f15 */
190
191 #define CONDITIONAL_REGISTER_USAGE \
192 if (target_flags & TARGET_C400) \
193 { int i; \
194 for (i = 24; i < 32; i++) fixed_regs[i] = call_used_regs[i] = 0; }
195
196 /* Return number of consecutive hard regs needed starting at reg REGNO
197 to hold something of mode MODE.
198 This is ordinarily the length in words of a value of mode MODE
199 but can be less for certain modes in special long registers.
200 On the clipper, fp registers are 64 bits. */
201
202 #define HARD_REGNO_NREGS(REGNO, MODE) \
203 ((REGNO) >= 16 ? 1 \
204 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
205
206 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
207 On the clipper 0-15 may hold any mode but DImode and DFmode must be even.
208 Registers 16-31 hold SFmode and DFmode */
209
210 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
211 ((REGNO) < 16 \
212 ? ((MODE) != DImode && (MODE) != DFmode || ((REGNO) & 1) == 0) \
213 : ((MODE) == SFmode || (MODE) == DFmode))
214
215 /* Value is 1 if it is a good idea to tie two pseudo registers
216 when one has mode MODE1 and one has mode MODE2.
217 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
218 for any hard reg, then this must be 0 for correct output. */
219 #define MODES_TIEABLE_P(MODE1, MODE2) ((MODE1) == (MODE2))
220
221 /* Specify the registers used for certain standard purposes.
222 The values of these macros are register numbers. */
223
224 /* clipper has extra PC */
225 /* #define PC_REGNUM */
226
227 /* Register to use for pushing function arguments. */
228 #define STACK_POINTER_REGNUM 15
229
230 /* Base register for access to local variables of the function. */
231 #define FRAME_POINTER_REGNUM 14
232
233 /* Value should be nonzero if functions must have frame pointers.
234 Zero means the frame pointer need not be set up (and parms
235 may be accessed via the stack pointer) in functions that seem suitable.
236 This is computed in `reload', in reload1.c. */
237 #define FRAME_POINTER_REQUIRED \
238 (! leaf_function_p ())
239
240 /* Base register for access to arguments of the function. */
241 #define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM
242
243 /* Register in which static-chain is passed to a function. */
244 #define STATIC_CHAIN_REGNUM 2
245
246 /* Register in which address to store a structure value
247 is passed to a function. */
248 #define STRUCT_VALUE_REGNUM 0
249 \f
250 /* Define the classes of registers for register constraints in the
251 machine description. Also define ranges of constants.
252
253 One of the classes must always be named ALL_REGS and include all hard regs.
254 If there is more than one class, another class must be named NO_REGS
255 and contain no registers.
256
257 The name GENERAL_REGS must be the name of a class (or an alias for
258 another name such as ALL_REGS). This is the class of registers
259 that is allowed by "g" or "r" in a register constraint.
260 Also, registers outside this class are allocated only when
261 instructions express preferences for them.
262
263 The classes must be numbered in nondecreasing order; that is,
264 a larger-numbered class must never be contained completely
265 in a smaller-numbered class.
266
267 For any two classes, it is very desirable that there be another
268 class that represents their union. */
269
270 /* The clipper has general and FP regs. */
271
272 enum reg_class { NO_REGS, GENERAL_REGS, FLOAT_REGS, ALL_REGS, LIM_REG_CLASSES};
273
274 #define N_REG_CLASSES (int) LIM_REG_CLASSES
275
276 /* Give names of register classes as strings for dump file. */
277
278 #define REG_CLASS_NAMES \
279 {"NO_REGS", "GENERAL_REGS", "FLOAT_REGS", "ALL_REGS" }
280
281 /* Define which registers fit in which classes.
282 This is an initializer for a vector of HARD_REG_SET
283 of length N_REG_CLASSES. */
284
285 #define REG_CLASS_CONTENTS {0, 0x0000ffff, 0xffff0000, 0xffffffff}
286
287 /* The same information, inverted:
288 Return the class number of the smallest class containing
289 reg number REGNO. This could be a conditional expression
290 or could index an array. */
291
292 #define REGNO_REG_CLASS(REGNO) ((REGNO) >= 16 ? FLOAT_REGS : GENERAL_REGS)
293
294 /* The class value for index registers, and the one for base regs. */
295
296 #define INDEX_REG_CLASS GENERAL_REGS
297 #define BASE_REG_CLASS GENERAL_REGS
298
299 /* Get reg_class from a letter such as appears in the machine description. */
300
301 #define REG_CLASS_FROM_LETTER(C) \
302 ((C) == 'r' ? GENERAL_REGS : ((C) == 'f' ? FLOAT_REGS: NO_REGS))
303
304 /* The letters I, J, K, L and M in a register constraint string
305 can be used to stand for particular ranges of immediate operands.
306 This macro defines what the ranges are.
307 C is the letter, and VALUE is a constant value.
308 Return 1 if VALUE is in the range specified by C. */
309
310 #define CONST_OK_FOR_LETTER_P(VALUE, C) 0
311
312 /* Similar, but for floating constants, and defining letters G and H.
313 Here VALUE is the CONST_DOUBLE rtx itself. */
314
315 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0
316
317 /* Optional extra constraints for this machine. */
318
319 /* #define EXTRA_CONSTRAINT(OP, C) */
320
321
322 /* Given an rtx X being reloaded into a reg required to be
323 in class CLASS, return the class of reg to actually use.
324 In general this is just CLASS; but on some machines
325 in some cases it is preferable to use a more restrictive class. */
326
327 #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
328
329 /* Return the maximum number of consecutive registers
330 needed to represent mode MODE in a register of class CLASS. */
331
332 #define CLASS_MAX_NREGS(CLASS, MODE) \
333 ((CLASS) == FLOAT_REGS \
334 ? 1 \
335 : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
336 \f
337 /* Stack layout; function entry, exit and calling. */
338
339 /* Define this if pushing a word on the stack
340 makes the stack pointer a smaller address. */
341 #define STACK_GROWS_DOWNWARD
342
343 /* Define this if longjmp restores from saved registers
344 rather than from what setjmp saved. */
345 /* #define LONGJMP_RESTORE_FROM_STACK */
346
347 /* Define this if the nominal address of the stack frame
348 is at the high-address end of the local variables;
349 that is, each additional local variable allocated
350 goes at a more negative offset in the frame. */
351 #define FRAME_GROWS_DOWNWARD
352
353 /* Offset within stack frame to start allocating local variables at.
354 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
355 first local allocated. Otherwise, it is the offset to the BEGINNING
356 of the first local allocated. */
357 #define STARTING_FRAME_OFFSET 0
358
359 /* Given an rtx for the address of a frame,
360 return an rtx for the address of the word in the frame
361 that holds the dynamic chain--the previous frame's address. */
362 #define DYNAMIC_CHAIN_ADDRESS(frame) (frame)
363
364 /* If we generate an insn to push BYTES bytes,
365 this says how many the stack pointer really advances by. */
366
367 /* #define PUSH_ROUNDING(BYTES) (BYTES) */
368
369 /* Keep the stack pointer constant throughout the function. */
370 /* we can't set this for clipper as library calls may have 3 args and we pass
371 only 2 args in regs. */
372
373 /* #define ACCUMULATE_OUTGOING_ARGS */
374
375
376 /* Offset of first parameter from the argument pointer register value.
377 size of PC + FP */
378
379 #define FIRST_PARM_OFFSET(FNDECL) 8
380
381 /* Value is the number of bytes of arguments automatically
382 popped when returning from a subroutine call.
383 FUNDECL is the declaration node of the function (as a tree),
384 FUNTYPE is the data type of the function (as a tree),
385 or for a library call it is an identifier node for the subroutine name.
386 SIZE is the number of bytes of arguments passed on the stack. */
387
388 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
389
390 /* Define how to find the value returned by a function.
391 VALTYPE is the data type of the value (as a tree).
392 If the precise function being called is known, FUNC is its FUNCTION_DECL;
393 otherwise, FUNC is 0. */
394
395 #define FUNCTION_VALUE(VALTYPE, FUNC) \
396 gen_rtx (REG, TYPE_MODE (VALTYPE), ((TYPE_MODE (VALTYPE) == SFmode ||\
397 TYPE_MODE (VALTYPE) == DFmode) ? \
398 16 : 0))
399
400 /* Define how to find the value returned by a library function
401 assuming the value has mode MODE. */
402
403 #define LIBCALL_VALUE(MODE) \
404 gen_rtx (REG, (MODE), ((MODE) == SFmode || (MODE) == DFmode ? 16 : 0))
405
406
407 /* 1 if N is a possible register number for a function value
408 as seen by the caller. */
409
410 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (N) == 16)
411
412 /* 1 if N is a possible register number for function argument passing. */
413
414 #define FUNCTION_ARG_REGNO_P(N) \
415 ((N) == 0 || (N) == 1 || (N) == 16 || (N) == 17)
416
417 /* Define this if PCC uses the nonreentrant convention for returning
418 structure and union values. Old Green Hills C-Clipper returns static
419 structs but the newer Apogee compiler passes structs as hidden arg 0.
420 Structs etc are always passed in memory */
421
422 /* #define PCC_STATIC_STRUCT_RETURN */
423
424 \f
425 /* Define a data type for recording info about an argument list
426 during the scan of that argument list. This data type should
427 hold all necessary information about the function itself
428 and about the args processed so far, enough to enable macros
429 such as FUNCTION_ARG to determine where the next arg should go.
430
431 Clipper uses 2 register 'slots' that pass arguments in r0/r1 or f0/f1.
432 An argument that must be passed in memory (struct... ) leaves that slot
433 free.
434 We pass 'long long' only in registers when both slots are free.
435 Returned structs must be allocated by the caller, the address is passed
436 in r0.
437
438 struct ss {..}
439
440 fun (i,j,k) i in r0, j in r1, k on stack
441 fun (s,j,k) s on stack, j in r1, k on stack
442 fun (i,s,k) i in r0, s on stack, k on stack
443 s1 = fun (i,s,k) &s1 in r0, i in r1, s on stack, k on stack
444
445 We must keep enough information for varargs/stdargs.
446
447 _clipper_cum_args is a struct of 2 integers, with
448 num = slots used
449 size = size of all stack args = offset to next arg without alignment
450
451 If we use stdarg.h, size points to the first unnamed arg,
452 see va-clipper.h */
453
454 struct _clipper_cum_args { int num; int size; };
455
456 #define CUMULATIVE_ARGS struct _clipper_cum_args
457
458 /* Initialize a variable CUM of type CUMULATIVE_ARGS
459 for a call to a function whose data type is FNTYPE.
460 For a library call, FNTYPE is 0.
461
462 clipper passes the address of a struct in r0, set num = 1 in this case */
463
464 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
465 ((CUM).num = ((FNTYPE) != 0 && aggregate_value_p (TREE_TYPE (FNTYPE))), \
466 (CUM).size = 0)
467
468 /* internal helper : size of an argument */
469
470 #define CLIPPER_ARG_SIZE(MODE, TYPE) \
471 (((MODE) != BLKmode \
472 ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \
473 : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD) \
474 * UNITS_PER_WORD)
475
476 /* Update the data in CUM to advance over an argument
477 of mode MODE and data type TYPE.
478 (TYPE is null for libcalls where that information may not be available.) */
479
480 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
481 do \
482 { \
483 int reg = 0; \
484 \
485 if ((CUM).num < 2 \
486 && (GET_MODE_CLASS(MODE)==MODE_INT || GET_MODE_CLASS(MODE)==MODE_FLOAT) \
487 && (GET_MODE_SIZE (MODE) <= 8) \
488 && ((TYPE) == NULL || !AGGREGATE_TYPE_P(TYPE)) \
489 && ((MODE) != DImode || (CUM).num == 0)) \
490 { \
491 reg = 1; \
492 if ((MODE) == DImode) \
493 (CUM).num = 1; \
494 } \
495 \
496 (CUM).num++; \
497 \
498 if (! reg) \
499 { \
500 int align = FUNCTION_ARG_BOUNDARY (MODE, TYPE) / BITS_PER_UNIT; \
501 (CUM).size += align - 1; \
502 (CUM).size &= ~(align - 1); \
503 (CUM).size += CLIPPER_ARG_SIZE (MODE, TYPE); \
504 } \
505 } while (0)
506
507 /* Define where to put the arguments to a function.
508 Value is zero to push the argument on the stack,
509 or a hard register in which to store the argument.
510
511 MODE is the argument's machine mode.
512 TYPE is the data type of the argument (as a tree).
513 This is null for libcalls where that information may
514 not be available.
515 CUM is a variable of type CUMULATIVE_ARGS which gives info about
516 the preceding args and about the function being called.
517 NAMED is nonzero if this argument is a named parameter
518 (otherwise it is an extra parameter matching an ellipsis).
519
520 2 args may go into regs. These must be MODE_INT or MODE_FLOAT but only
521 if they really fit into ONE register. The exception is a DImode arg
522 that occupies both register slots. */
523
524 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
525 (((CUM).num < 2 \
526 && (GET_MODE_CLASS(MODE)==MODE_INT || GET_MODE_CLASS(MODE)==MODE_FLOAT) \
527 && (GET_MODE_SIZE (MODE) <= 8) \
528 && ((TYPE) == NULL || !AGGREGATE_TYPE_P(TYPE)) \
529 && ((MODE) != DImode || (CUM).num == 0)) \
530 ? gen_rtx (REG, (MODE), \
531 GET_MODE_CLASS(MODE) == MODE_FLOAT ? (CUM).num+16 : (CUM).num) \
532 : 0)
533
534 /* If defined, a C expression that gives the alignment boundary, in bits,
535 of an argument with the specified mode and type. If it is not defined,
536 `PARM_BOUNDARY' is used for all arguments. */
537
538 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
539 (((TYPE) ? TYPE_ALIGN (TYPE) : GET_MODE_SIZE (MODE)) <= PARM_BOUNDARY \
540 ? PARM_BOUNDARY : 2 * PARM_BOUNDARY)
541
542 /* For an arg passed partly in registers and partly in memory,
543 this is the number of registers used.
544 For args passed entirely in registers or entirely in memory, zero.
545 Clipper never passed args partially in regs/mem. */
546
547 /* #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0 */
548
549 /* Generate necessary RTL for __builtin_saveregs().
550 ARGLIST is the argument list; see expr.c. */
551
552 #define EXPAND_BUILTIN_SAVEREGS(ARGLIST) clipper_builtin_saveregs (ARGLIST)
553
554 /* This macro generates the assembly code for function entry.
555 FILE is a stdio stream to output the code to.
556 SIZE is an int: how many units of temporary storage to allocate.
557 Refer to the array `regs_ever_live' to determine which registers
558 to save; `regs_ever_live[I]' is nonzero if register number I
559 is ever used in the function. This macro is responsible for
560 knowing which registers should not be saved even if used. */
561
562 #define FUNCTION_PROLOGUE(FILE, SIZE) output_function_prologue (FILE,SIZE)
563
564 /* Output assembler code to FILE to increment profiler label # LABELNO
565 for profiling a function entry. */
566
567 #define FUNCTION_PROFILER(FILE, LABELNO) /* FIXME */
568
569 /* Output assembler code to FILE to initialize this source file's
570 basic block profiling info, if that has not already been done. */
571
572 #define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) /* FIXME */
573
574 /* Output assembler code to FILE to increment the entry-count for
575 the BLOCKNO'th basic block in this source file. */
576
577 #define BLOCK_PROFILER(FILE, BLOCKNO) /* FIXME */
578
579 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
580 the stack pointer does not matter. The value is tested only in
581 functions that have frame pointers.
582 No definition is equivalent to always zero. */
583
584 #define EXIT_IGNORE_STACK 1
585
586 /* This macro generates the assembly code for function exit,
587 on machines that need it. If FUNCTION_EPILOGUE is not defined
588 then individual return instructions are generated for each
589 return statement. Args are same as for FUNCTION_PROLOGUE. */
590
591 #define FUNCTION_EPILOGUE(FILE, SIZE) output_function_epilogue(FILE,SIZE)
592
593 /* Store in the variable DEPTH the initial difference between the
594 frame pointer reg contents and the stack pointer reg contents,
595 as of the start of the function body. This depends on the layout
596 of the fixed parts of the stack frame and on how registers are saved. */
597
598 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
599 DEPTH = clipper_frame_size (get_frame_size ())
600
601
602 /* Output assembler code for a block containing the constant parts
603 of a trampoline, leaving space for the variable parts. */
604
605 #define TRAMPOLINE_TEMPLATE(FILE) \
606 { \
607 fputs ("\t.word 0x459F,0x0004\t# call sp,.+4\n", FILE); \
608 fputs ("\tmovw (sp),r3\n", FILE); \
609 fputs ("\taddq $4,sp\n", FILE); \
610 fputs ("\tloadw 20(r3),r2\n", FILE); \
611 fputs ("\tloadw 24(r3),r3\n", FILE); \
612 fputs ("\tb (r3)\n", FILE); \
613 fputs ("\t.long 0,0\n", FILE); \
614 }
615
616 /* Length in units of the trampoline for entering a nested function. */
617
618 #define TRAMPOLINE_SIZE 32
619
620 /* Alignment required for a trampoline. 128 is used to find the
621 beginning of a line in the instruction cache and to allow for
622 instruction cache lines of up to 128 bytes. */
623
624 #define TRAMPOLINE_ALIGNMENT 128
625
626 /* Section in which to place the trampoline. */
627
628 #define TRAMPOLINE_SECTION text_section
629
630 /* Emit RTL insns to initialize the variable parts of a trampoline.
631 FNADDR is an RTX for the address of the function's pure code.
632 CXT is an RTX for the static chain value for the function. */
633
634 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
635 { \
636 emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 24)), CXT); \
637 emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 28)), FNADDR); \
638 }
639 \f
640 /* Addressing modes, and classification of registers for them. */
641
642 /* #define HAVE_POST_DECREMENT */
643
644 /* #define HAVE_PRE_INCREMENT */
645
646 /* Macros to check register numbers against specific register classes. */
647
648 /* These assume that REGNO is a hard or pseudo reg number.
649 They give nonzero only if REGNO is a hard reg of the suitable class
650 or a pseudo reg currently allocated to a suitable hard reg.
651 Since they use reg_renumber, they are safe only once reg_renumber
652 has been allocated, which happens in local-alloc.c. */
653
654 #define REGNO_OK_FOR_INDEX_P(regno) \
655 ((regno) < 16 || (unsigned)reg_renumber[regno] < 16)
656 #define REGNO_OK_FOR_BASE_P(regno) \
657 ((regno) < 16 || (unsigned)reg_renumber[regno] < 16)
658 \f
659 /* Maximum number of registers that can appear in a valid memory address. */
660
661 #define MAX_REGS_PER_ADDRESS 2
662
663 /* 1 if X is an rtx for a constant that is a valid address. */
664
665 #define CONSTANT_ADDRESS_P(X) \
666 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
667 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
668 || GET_CODE (X) == HIGH)
669
670 /* Nonzero if the constant value X is a legitimate general operand.
671 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
672
673 #define LEGITIMATE_CONSTANT_P(X) 1
674
675 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
676 and check its validity for a certain class.
677 We have two alternate definitions for each of them.
678 The usual definition accepts all pseudo regs; the other rejects
679 them unless they have been allocated suitable hard regs.
680 The symbol REG_OK_STRICT causes the latter definition to be used.
681
682 Most source files want to accept pseudo regs in the hope that
683 they will get allocated to the class that the insn wants them to be in.
684 Source files for reload pass need to be strict.
685 After reload, it makes no difference, since pseudo regs have
686 been eliminated by then. */
687
688 /* clipper doesn't have true indexing */
689
690 #ifndef REG_OK_STRICT
691
692 /* Nonzero if X is a hard reg that can be used as an index
693 or if it is a pseudo reg. */
694
695 #define REG_OK_FOR_INDEX_P(X) \
696 (REGNO (X) < 16 || REGNO(X) >= FIRST_PSEUDO_REGISTER)
697
698 /* Nonzero if X is a hard reg that can be used as a base reg
699 or if it is a pseudo reg. */
700
701 #define REG_OK_FOR_BASE_P(X) \
702 (REGNO (X) < 16 || REGNO(X) >= FIRST_PSEUDO_REGISTER)
703
704 #else
705
706 /* Nonzero if X is a hard reg that can be used as an index. */
707 #define REG_OK_FOR_INDEX_P(X) (REGNO(X) < 16)
708
709 /* Nonzero if X is a hard reg that can be used as a base reg. */
710 #define REG_OK_FOR_BASE_P(X) (REGNO(X) < 16)
711
712 #endif
713 \f
714 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
715 that is a valid memory address for an instruction.
716 The MODE argument is the machine mode for the MEM expression
717 that wants to use this address.
718
719 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
720 except for CONSTANT_ADDRESS_P which is actually machine-independent. */
721
722 /* Non-zero if X is an address which can be indirected. */
723
724 #define INDIRECTABLE_CONSTANT_ADDRESS_P(X) 0
725
726 #define INDIRECTABLE_ADDRESS_P(X) \
727 (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))
728
729 /* Go to ADDR if X is a valid address not using indexing.
730 (This much is the easy part.) */
731
732 #define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
733 { if (CONSTANT_ADDRESS_P (X)) goto ADDR; \
734 if (INDIRECTABLE_ADDRESS_P (X)) goto ADDR; }
735
736 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
737 { register rtx xfoo = (X); \
738 GO_IF_NONINDEXED_ADDRESS (xfoo, ADDR); \
739 if (GET_CODE (xfoo) == PLUS) \
740 { register rtx xfoo0, xfoo1; \
741 xfoo0 = XEXP (xfoo, 0); \
742 xfoo1 = XEXP (xfoo, 1); \
743 /* handle reg + reg -> [r1](r0) */ \
744 if (INDIRECTABLE_ADDRESS_P (xfoo0) && INDIRECTABLE_ADDRESS_P (xfoo1)) \
745 goto ADDR; \
746 /* Handle <symbol>(reg) -> xxx(r0) */ \
747 if (INDIRECTABLE_ADDRESS_P (xfoo0) && CONSTANT_ADDRESS_P (xfoo1)) \
748 goto ADDR; \
749 if (INDIRECTABLE_ADDRESS_P (xfoo1) && CONSTANT_ADDRESS_P (xfoo0)) \
750 goto ADDR; }}
751
752 \f
753 /* Try machine-dependent ways of modifying an illegitimate address
754 to be legitimate. If we find one, return the new, valid address.
755 This macro is used in only one place: `memory_address' in explow.c.
756
757 OLDX is the address as it was before break_out_memory_refs was called.
758 In some cases it is useful to look at this to decide what needs to be done.
759
760 MODE and WIN are passed so that this macro can use
761 GO_IF_LEGITIMATE_ADDRESS.
762
763 It is always safe for this macro to do nothing. It exists to recognize
764 opportunities to optimize the output.
765
766 For the clipper, nothing needs to be done. */
767
768 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
769
770 /* Go to LABEL if ADDR (a legitimate address expression)
771 has an effect that depends on the machine mode it is used for. */
772
773 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {}
774
775 \f
776 /* Specify the machine mode that this machine uses
777 for the index in the tablejump instruction. */
778 #define CASE_VECTOR_MODE SImode
779
780 /* Define this if the case instruction expects the table
781 to contain offsets from the address of the table.
782 Do not define this if the table should contain absolute addresses. */
783 /* #define CASE_VECTOR_PC_RELATIVE */
784
785 /* Define this if the case instruction drops through after the table
786 when the index is out of range. Don't define it if the case insn
787 jumps to the default label instead. */
788 /* #define CASE_DROPS_THROUGH */
789
790 /* Define if operations between registers always perform the operation
791 on the full register even if a narrower mode is specified. */
792 #define WORD_REGISTER_OPERATIONS
793
794 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
795 will either zero-extend or sign-extend. The value of this macro should
796 be the code that says which one of the two operations is implicitly
797 done, NIL if none. */
798 #define LOAD_EXTEND_OP(MODE) SIGN_EXTEND
799
800 /* Specify the tree operation to be used to convert reals to integers. */
801 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
802
803 /* This is the kind of divide that is easiest to do in the general case. */
804 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
805
806 /* Define this as 1 if `char' should by default be signed; else as 0. */
807 #define DEFAULT_SIGNED_CHAR 1
808
809 /* This flag, if defined, says the same insns that convert to a signed fixnum
810 also convert validly to an unsigned one. */
811 #define FIXUNS_TRUNC_LIKE_FIX_TRUNC
812
813 /* Max number of bytes we can move from memory to memory
814 in one reasonably fast instruction. */
815 #define MOVE_MAX 4
816
817 /* MOVE_RATIO is the number of move instructions that is better than a
818 block move. Make this large on clipper, since the block move is very
819 inefficient with small blocks, and the hard register needs of the
820 block move require much reload work. */
821
822 #define MOVE_RATIO 20
823
824 /* Define this if zero-extension is slow (more than one real instruction). */
825 /* #define SLOW_ZERO_EXTEND */
826
827 /* Nonzero if access to memory by bytes is slow and undesirable. */
828 #define SLOW_BYTE_ACCESS 0
829
830 /* Define if shifts truncate the shift count
831 which implies one can omit a sign-extension or zero-extension
832 of a shift count. */
833 /* #define SHIFT_COUNT_TRUNCATED */
834
835 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
836 is done just by pretending it is already truncated. */
837 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
838
839 /* Specify the machine mode that pointers have.
840 After generation of rtl, the compiler makes no further distinction
841 between pointers and any other objects of this machine mode. */
842 #define Pmode SImode
843
844 /* A function address in a call instruction
845 is a byte address (for indexing purposes)
846 so give the MEM rtx a byte's mode. */
847 #define FUNCTION_MODE QImode
848
849 /* This machine uses IEEE floats. */
850
851 #define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
852
853 /* Check a `double' value for validity for a particular machine mode.
854 This is defined to avoid crashes outputting certain constants.
855 Since we output the number in hex, the assembler won't choke on it. */
856 /* #define CHECK_FLOAT_VALUE(MODE,VALUE) */
857
858
859 /* Compute the cost of computing a constant rtl expression RTX
860 whose rtx-code is CODE. The body of this macro is a portion
861 of a switch statement. If the code is computed here,
862 return it with a return statement. Otherwise, break from the switch. */
863
864 /* On a Clipper, constants from 0..15 are cheap because they can use the
865 'quick' mode. */
866
867 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
868 case CONST_INT: \
869 if (0 <= INTVAL (RTX) && INTVAL(RTX) <= 15 ) return 0; \
870 return 1; \
871 case CONST: \
872 case LABEL_REF: \
873 case SYMBOL_REF: \
874 return 3; \
875 case CONST_DOUBLE: \
876 return 5;
877
878 /* Provide the costs of a rtl expression. This is in the body of a
879 switch on CODE. */
880
881 #define RTX_COSTS(X,CODE,OUTER_CODE) \
882 case MULT: \
883 return COSTS_N_INSNS (4); \
884 case DIV: \
885 case UDIV: \
886 case MOD: \
887 case UMOD: \
888 return COSTS_N_INSNS (40); \
889 case ASHIFT: \
890 case LSHIFTRT: \
891 case ASHIFTRT: \
892 return COSTS_N_INSNS (2); \
893 case SIGN_EXTEND: \
894 return (GET_CODE (XEXP (X,0)) == REG ? COSTS_N_INSNS (3) : 4);
895
896 /* Specify the cost of a branch insn; roughly the number of extra insns that
897 should be added to avoid a branch */
898
899 /* #define BRANCH_COST 0 */
900
901 \f
902 /* Tell final.c how to eliminate redundant test instructions. */
903
904 /* Here we define machine-dependent flags and fields in cc_status
905 (see `conditions.h'). No extra ones are needed for the clipper. */
906
907 /* Store in cc_status the expressions
908 that the condition codes will describe
909 after execution of an instruction whose pattern is EXP.
910 Do not alter them if the instruction would not alter the cc's. */
911
912 #define NOTICE_UPDATE_CC(EXP, INSN) \
913 { \
914 enum attr_cc cc = get_attr_cc (INSN); \
915 rtx dest = SET_DEST (EXP); \
916 switch (cc) \
917 { \
918 case CC_CHANGE0: \
919 if (GET_CODE (EXP) == PARALLEL) abort(); \
920 if (cc_status.value1 && rtx_equal_p (dest, cc_status.value1) || \
921 cc_status.value2 && rtx_equal_p (dest, cc_status.value2)) \
922 CC_STATUS_INIT; \
923 break; \
924 \
925 case CC_SET1: \
926 if (GET_CODE (EXP) == PARALLEL) abort(); \
927 cc_status.flags = 0; \
928 cc_status.value1 = dest; \
929 cc_status.value2 = 0; \
930 break; \
931 \
932 case CC_SET2: \
933 if (GET_CODE (EXP) == PARALLEL) abort(); \
934 cc_status.flags = 0; \
935 cc_status.value1 = dest; \
936 cc_status.value2 = SET_SRC (EXP); \
937 break; \
938 \
939 case CC_UNCHANGED: \
940 break; \
941 \
942 case CC_CLOBBER: \
943 CC_STATUS_INIT; \
944 break; \
945 \
946 default: \
947 abort (); \
948 } \
949 }
950
951 \f
952 /* Control the assembler format that we output. */
953
954 /* Output at beginning of assembler file. */
955
956 #define ASM_FILE_START(FILE) fprintf (FILE, "#NO_APP\n");
957
958 /* Output to assembler file text saying following lines
959 may contain character constants, extra white space, comments, etc. */
960
961 #define ASM_APP_ON "#APP\n"
962
963 /* Output to assembler file text saying following lines
964 no longer contain unusual constructs. */
965
966 #define ASM_APP_OFF "#NO_APP\n"
967
968 /* Output before read-only data. */
969
970 #define TEXT_SECTION_ASM_OP ".text"
971
972 /* Output before writable data. */
973
974 #define DATA_SECTION_ASM_OP ".data"
975
976 /* How to refer to registers in assembler output.
977 This sequence is indexed by compiler's hard-register-number (see above). */
978
979 #define REGISTER_NAMES \
980 {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", \
981 "r9", "r10", "r11", "r12", "r13", "fp", "sp", \
982 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", \
983 "f9", "f10", "f11", "f12", "f13", "f14", "f15" }
984
985 /* How to renumber registers for dbx and gdb.
986 Clipper needs no change in the numeration. */
987
988 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
989
990
991 /* This is how to output the definition of a user-level label named NAME,
992 such as the label on a static function or variable NAME. */
993
994 #define ASM_OUTPUT_LABEL(FILE,NAME) \
995 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
996
997 /* This is how to output a command to make the user-level label named NAME
998 defined for reference from other files. */
999
1000 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
1001 do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
1002
1003 /* This is how to output an assembler line defining an `int' constant. */
1004
1005 #define ASM_OUTPUT_INT(FILE,VALUE) \
1006 ( fprintf (FILE, "\t.long "), \
1007 output_addr_const (FILE, (VALUE)), \
1008 fprintf (FILE, "\n"))
1009
1010 /* Likewise for `char' and `short' constants. */
1011
1012 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
1013 ( fprintf (FILE, "\t.word "), \
1014 output_addr_const (FILE, (VALUE)), \
1015 fprintf (FILE, "\n"))
1016
1017 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
1018 ( fprintf (FILE, "\t.byte "), \
1019 output_addr_const (FILE, (VALUE)), \
1020 fprintf (FILE, "\n"))
1021
1022 /* This is how to output an assembler line for a numeric constant byte. */
1023
1024 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
1025 fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1026
1027 /* This is how to output an insn to push a register on the stack.
1028 It need not be very fast code. */
1029
1030 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1031 fprintf (FILE, "\tsubq $8,sp\n\t%s %s,(sp)\n", \
1032 (REGNO) < 16 ? "storw" : "stord", reg_names[REGNO])
1033
1034 /* This is how to output an insn to pop a register from the stack.
1035 It need not be very fast code. */
1036
1037 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1038 fprintf (FILE, "\t%s (sp),%s\n\t\addq $8,sp\n", \
1039 (REGNO) < 16 ? "loadw" : "loadd", reg_names[REGNO])
1040 /* This is how to output an element of a case-vector that is absolute */
1041
1042 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1043 fprintf (FILE, "\t.long .L%d\n", VALUE)
1044
1045 /* This is how to output an element of a case-vector that is relative. */
1046
1047 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
1048 fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
1049
1050 /* This is how to output an assembler line
1051 that says to advance the location counter by SIZE bytes. */
1052
1053 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1054 fprintf (FILE, "\t.space %u\n", (SIZE))
1055
1056 /* This says how to output an assembler line
1057 to define a local common symbol. */
1058 /* ??? The use of .bss here seems odd. */
1059
1060 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE,NAME,SIZE,ALIGN) \
1061 ( data_section (), \
1062 fputs ("\t.bss\t", (FILE)), \
1063 assemble_name ((FILE), (NAME)), \
1064 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN)/BITS_PER_UNIT))
1065
1066 /* Store in OUTPUT a string (made with alloca) containing
1067 an assembler-name for a local static variable named NAME.
1068 LABELNO is an integer which is different for each call. */
1069
1070 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1071 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1072 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1073
1074 /* Define the parentheses used to group arithmetic operations
1075 in assembler code. */
1076
1077 #define ASM_OPEN_PAREN "("
1078 #define ASM_CLOSE_PAREN ")"
1079
1080 /* Define results of standard character escape sequences. */
1081 #define TARGET_BELL 007
1082 #define TARGET_BS 010
1083 #define TARGET_TAB 011
1084 #define TARGET_NEWLINE 012
1085 #define TARGET_VT 013
1086 #define TARGET_FF 014
1087 #define TARGET_CR 015
1088
1089 /* Print an instruction operand X on file FILE.
1090 CODE is the code from the %-spec that requested printing this operand;
1091 if `%z3' was used to print operand 3, then CODE is 'z'.
1092
1093 Clipper operand formatting codes:
1094
1095 letter print
1096 C reverse branch condition
1097 */
1098
1099 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1100 ((CODE) == 'C')
1101
1102 #define PRINT_OPERAND(FILE, X, CODE) \
1103 { extern char *rev_cond_name (); \
1104 if (CODE == 'C') \
1105 fputs (rev_cond_name (X), FILE); \
1106 else if (GET_CODE (X) == REG) \
1107 fprintf (FILE, "%s", reg_names[REGNO (X)]); \
1108 else if (GET_CODE (X) == MEM) \
1109 output_address (XEXP (X, 0)); \
1110 else { putc ('$', FILE); output_addr_const (FILE, X); }}
1111
1112 /* Print a memory operand whose address is X, on file FILE.
1113 This uses a function in output-clipper.c. */
1114
1115 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1116 print_operand_address (FILE, ADDR)
1117
1118 /* Define the codes that are matched by predicates in clipper.c */
1119
1120 #define PREDICATE_CODES \
1121 {"int_reg_operand", {SUBREG, REG}}, \
1122 {"fp_reg_operand", {SUBREG, REG}},