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