|
|
1.1 root 1: /* Definitions of target machine for GNU compiler, for SPUR chip.
2: Copyright (C) 1988 Free Software Foundation, Inc.
3:
4: This file is part of GNU CC.
5:
6: GNU CC is free software; you can redistribute it and/or modify
7: it under the terms of the GNU General Public License as published by
8: the Free Software Foundation; either version 2, or (at your option)
9: any later version.
10:
11: GNU CC is distributed in the hope that it will be useful,
12: but WITHOUT ANY WARRANTY; without even the implied warranty of
13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: GNU General Public License for more details.
15:
16: You should have received a copy of the GNU General Public License
17: along with GNU CC; see the file COPYING. If not, write to
18: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19:
20:
21: /* Note that some other tm.h files include this one and then override
22: many of the definitions that relate to assembler syntax. */
23:
24:
25: /* Names to predefine in the preprocessor for this target machine. */
26:
27: #define CPP_PREDEFINES "-Dspur"
28:
29: /* Link with libg.a when debugging, for dbx's sake. */
30:
31: #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} "
32:
33: /* Print subsidiary information on the compiler version in use. */
34: #define TARGET_VERSION fprintf (stderr, " (spur)");
35:
36: /* Run-time compilation parameters selecting different hardware subsets.
37:
38: On the SPUR, we don't yet need any. */
39:
40: extern int target_flags;
41:
42: /* Nonzero if we should generate code to use the fpu. */
43: #define TARGET_FPU (target_flags & 1)
44:
45: /* Nonzero if we should expand constant shifts into series of shift
46: instructions. */
47: #define TARGET_EXPAND_SHIFTS (target_flags & 2)
48:
49: /* Nonzero if we should generate long jumps for compares. */
50: #define TARGET_LONG_JUMPS (target_flags & 4)
51:
52: /* Macro to define tables used to set the flags.
53: This is a list in braces of pairs in braces,
54: each pair being { "NAME", VALUE }
55: where VALUE is the bits to set or minus the bits to clear.
56: An empty string NAME is used to identify the default VALUE. */
57:
58: #define TARGET_SWITCHES \
59: { {"fpu", 1}, \
60: {"soft-float", -1}, \
61: {"expand-shifts", 2}, \
62: {"lib-shifts", -2}, \
63: {"long-jumps", 4}, \
64: {"short-jumps", -4}, \
65: { "", TARGET_DEFAULT}}
66:
67: #define TARGET_DEFAULT 0
68:
69: /* target machine storage layout */
70:
71: /* Define this if most significant bit is lowest numbered
72: in instructions that operate on numbered bit-fields.
73: This is a moot question on the SPUR due to the lack of bit-field insns. */
74: #define BITS_BIG_ENDIAN 0
75:
76: /* Define this if most significant byte of a word is the lowest numbered. */
77: /* That is not true on SPUR. */
78: #define BYTES_BIG_ENDIAN 0
79:
80: /* Define this if most significant word of a multiword number is the lowest
81: numbered. */
82: /* For SPUR we can decide arbitrarily
83: since there are no machine instructions for them. */
84: #define WORDS_BIG_ENDIAN 0
85:
1.1.1.2 root 86: /* number of bits in an addressable storage unit */
1.1 root 87: #define BITS_PER_UNIT 8
88:
89: /* Width in bits of a "word", which is the contents of a machine register.
90: Note that this is not necessarily the width of data type `int';
91: if using 16-bit ints on a 68000, this would still be 32.
92: But on a machine with 16-bit registers, this would be 16. */
93: #define BITS_PER_WORD 32
94:
95: /* Width of a word, in units (bytes). */
96: #define UNITS_PER_WORD 4
97:
98: /* Width in bits of a pointer.
99: See also the macro `Pmode' defined below. */
100: #define POINTER_SIZE 32
101:
102: /* Allocation boundary (in *bits*) for storing arguments in argument list. */
103: #define PARM_BOUNDARY 64
104:
105: /* Boundary (in *bits*) on which stack pointer should be aligned. */
106: #define STACK_BOUNDARY 64
107:
108: /* Allocation boundary (in *bits*) for the code of a function. */
109: #define FUNCTION_BOUNDARY 32
110:
111: /* Alignment of field after `int : 0' in a structure. */
112: #define EMPTY_FIELD_BOUNDARY 32
113:
114: /* Every structure's size must be a multiple of this. */
115: #define STRUCTURE_SIZE_BOUNDARY 32
116:
117: /* No data type wants to be aligned rounder than this. */
118: #define BIGGEST_ALIGNMENT 64
119:
1.1.1.2 root 120: /* Set this nonzero if move instructions will actually fail to work
1.1 root 121: when given unaligned data. */
1.1.1.2 root 122: #define STRICT_ALIGNMENT 1
1.1 root 123:
124: /* Standard register usage. */
125:
126: /* Number of actual hardware registers.
127: The hardware registers are assigned numbers for the compiler
128: from 0 to just below FIRST_PSEUDO_REGISTER.
129: All registers that the compiler knows about must be given numbers,
130: even those that are not normally considered general registers.
131:
132: SPUR has 32 fullword registers and 15 floating point registers. */
133:
134: #define FIRST_PSEUDO_REGISTER 47
135:
136: /* 1 for registers that have pervasive standard uses
137: and are not available for the register allocator.
138: On SPUR, this includes all the global registers
139: and the callee return address register. */
140: #define FIXED_REGISTERS \
141: {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
142: 1, 0, 0, 0, 0, 0, \
143: 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, \
144: 1, 0, 0, 0, 0, 0, \
145: 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
146:
147: /* 1 for registers not available across function calls.
148: These must include the FIXED_REGISTERS and also any
149: registers that can be used without being saved.
150: The latter must include the registers where values are returned
151: and the register where structure-value addresses are passed.
152: Aside from that, you can include as many other registers as you like. */
153: #define CALL_USED_REGISTERS \
154: {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
155: 1, 0, 0, 0, 0, 0, \
156: 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, \
157: 1, 1, 1, 1, 1, 1, \
158: 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0}
159:
160: /* Return number of consecutive hard regs needed starting at reg REGNO
161: to hold something of mode MODE.
162: This is ordinarily the length in words of a value of mode MODE
163: but can be less for certain modes in special long registers.
164:
165: On SPUR, ordinary registers hold 32 bits worth;
166: a single floating point register is always enough for
167: anything that can be stored in them at all. */
168: #define HARD_REGNO_NREGS(REGNO, MODE) \
169: ((REGNO) >= 32 ? GET_MODE_NUNITS ((MODE)) \
170: : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
171:
172: /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
173: On SPUR, the cpu registers can hold any mode but the float registers
174: can hold only floating point. And they can't hold anything if use
175: of hardware floating point is disabled. */
176: #define HARD_REGNO_MODE_OK(REGNO, MODE) \
177: (((REGNO) < 32 \
178: && (REGNO) + ((GET_MODE_UNIT_SIZE ((MODE)) + 3) / 4) <= 32) \
179: || (TARGET_FPU && ((MODE) == SFmode || (MODE) == DFmode \
180: || (MODE) == SCmode || (MODE) == DCmode)))
181:
182: /* Value is 1 if it is a good idea to tie two pseudo registers
183: when one has mode MODE1 and one has mode MODE2.
184: If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
185: for any hard reg, then this must be 0 for correct output. */
186: #define MODES_TIEABLE_P(MODE1, MODE2) \
187: (((MODE1) == SFmode || (MODE1) == DFmode \
188: || (MODE1) == SCmode || (MODE1) == DCmode) \
189: == ((MODE2) == SFmode || (MODE2) == DFmode \
190: || (MODE2) == SCmode || (MODE2) == DCmode))
191:
192: /* Specify the registers used for certain standard purposes.
193: The values of these macros are register numbers. */
194:
195: /* SPUR pc isn't overloaded on a register that the compiler knows about. */
196: /* #define PC_REGNUM */
197:
198: /* Register to use for pushing function arguments. */
199: #define STACK_POINTER_REGNUM 4
200:
201: /* Base register for access to local variables of the function. */
202: #define FRAME_POINTER_REGNUM 25
203:
204: /* Value should be nonzero if functions must have frame pointers.
205: Zero means the frame pointer need not be set up (and parms
206: may be accessed via the stack pointer) in functions that seem suitable.
207: This is computed in `reload', in reload1.c. */
208: #define FRAME_POINTER_REQUIRED 1
209:
210: /* Base register for access to arguments of the function. */
211: #define ARG_POINTER_REGNUM 25
212:
213: /* Register in which static-chain is passed to a function. */
214: /* ??? */
215: #define STATIC_CHAIN_REGNUM 8
216:
217: /* Register in which address to store a structure value
218: is passed to a function. */
219: #define STRUCT_VALUE_REGNUM 27
220: #define STRUCT_VALUE_INCOMING_REGNUM 11
221:
222: /* Define the classes of registers for register constraints in the
223: machine description. Also define ranges of constants.
224:
225: One of the classes must always be named ALL_REGS and include all hard regs.
226: If there is more than one class, another class must be named NO_REGS
227: and contain no registers.
228:
229: The name GENERAL_REGS must be the name of a class (or an alias for
230: another name such as ALL_REGS). This is the class of registers
231: that is allowed by "g" or "r" in a register constraint.
232: Also, registers outside this class are allocated only when
233: instructions express preferences for them.
234:
235: The classes must be numbered in nondecreasing order; that is,
236: a larger-numbered class must never be contained completely
237: in a smaller-numbered class.
238:
239: For any two classes, it is very desirable that there be another
240: class that represents their union. */
241:
242: /* The 68000 has two kinds of registers, hence four classes. */
243:
244: enum reg_class { NO_REGS, GENERAL_REGS, FP_REGS, ALL_REGS, LIM_REG_CLASSES };
245:
246: #define N_REG_CLASSES (int) LIM_REG_CLASSES
247:
248: /* Give names of register classes as strings for dump file. */
249:
250: #define REG_CLASS_NAMES \
251: {"NO_REGS", "GENERAL_REGS", "FP_REGS", "ALL_REGS" }
252:
253: /* Define which registers fit in which classes.
254: This is an initializer for a vector of HARD_REG_SET
255: of length N_REG_CLASSES. */
256:
257: #define REG_CLASS_CONTENTS {{0, 0}, {-1, 0}, {0, 0x7fff}, {-1, 0x7fff}}
258:
259: /* The same information, inverted:
260: Return the class number of the smallest class containing
261: reg number REGNO. This could be a conditional expression
262: or could index an array. */
263:
264: #define REGNO_REG_CLASS(REGNO) \
265: ((REGNO) >= 32 ? FP_REGS : GENERAL_REGS)
266:
267: /* The class value for index registers, and the one for base regs. */
268: #define INDEX_REG_CLASS GENERAL_REGS
269: #define BASE_REG_CLASS GENERAL_REGS
270:
271: /* Get reg_class from a letter such as appears in the machine description. */
272:
273: #define REG_CLASS_FROM_LETTER(C) \
274: ((C) == 'f' ? FP_REGS : NO_REGS)
275:
276: /* The letters I, J, K, L and M in a register constraint string
277: can be used to stand for particular ranges of immediate operands.
278: This macro defines what the ranges are.
279: C is the letter, and VALUE is a constant value.
280: Return 1 if VALUE is in the range specified by C.
281:
282: For SPUR, `I' is used for the range of constants an insn
283: can actually contain.
284: `J' is used for the range which is just zero (since that is R0).
285: `K' is used for the 5-bit operand of a compare insns. */
286:
287: #define CONST_OK_FOR_LETTER_P(VALUE, C) \
288: ((C) == 'I' ? (unsigned) ((VALUE) + 0x2000) < 0x4000 \
289: : (C) == 'J' ? (VALUE) == 0 \
290: : (C) == 'K' ? (unsigned) (VALUE) < 0x20 \
291: : 0)
292:
293: /* Similar, but for floating constants, and defining letters G and H.
294: Here VALUE is the CONST_DOUBLE rtx itself. */
295:
296: #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
297: ((C) == 'G' && CONST_DOUBLE_HIGH (VALUE) == 0 \
298: && CONST_DOUBLE_LOW (VALUE) == 0)
299:
300: /* Given an rtx X being reloaded into a reg required to be
301: in class CLASS, return the class of reg to actually use.
302: In general this is just CLASS; but on some machines
303: in some cases it is preferable to use a more restrictive class. */
304: #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
305:
306: /* Return the maximum number of consecutive registers
307: needed to represent mode MODE in a register of class CLASS. */
308: /* On SPUR, this is the size of MODE in words,
309: except in the FP regs, where a single reg is always enough. */
310: #define CLASS_MAX_NREGS(CLASS, MODE) \
311: ((CLASS) == FP_REGS ? 1 \
312: : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
313:
314: /* Stack layout; function entry, exit and calling. */
315:
316: /* Define this if pushing a word on the stack
317: makes the stack pointer a smaller address. */
318: #define STACK_GROWS_DOWNWARD
319:
320: /* Define this if the nominal address of the stack frame
321: is at the high-address end of the local variables;
322: that is, each additional local variable allocated
323: goes at a more negative offset in the frame. */
324: #define FRAME_GROWS_DOWNWARD
325:
326: /* Offset within stack frame to start allocating local variables at.
327: If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
328: first local allocated. Otherwise, it is the offset to the BEGINNING
329: of the first local allocated. */
330: #define STARTING_FRAME_OFFSET 0
331:
332: /* If we generate an insn to push BYTES bytes,
333: this says how many the stack pointer really advances by.
334: On SPUR, don't define this because there are no push insns. */
335: /* #define PUSH_ROUNDING(BYTES) */
336:
337: /* Offset of first parameter from the argument pointer register value. */
338: #define FIRST_PARM_OFFSET(FNDECL) 0
339:
340: /* Value is the number of bytes of arguments automatically
341: popped when returning from a subroutine call.
342: FUNTYPE is the data type of the function (as a tree),
343: or for a library call it is an identifier node for the subroutine name.
344: SIZE is the number of bytes of arguments passed on the stack. */
345:
346: #define RETURN_POPS_ARGS(FUNTYPE,SIZE) 0
347:
348: /* Define how to find the value returned by a function.
349: VALTYPE is the data type of the value (as a tree).
350: If the precise function being called is known, FUNC is its FUNCTION_DECL;
351: otherwise, FUNC is 0. */
352:
353: /* On SPUR the value is found in the second "output" register. */
354:
355: #define FUNCTION_VALUE(VALTYPE, FUNC) \
356: gen_rtx (REG, TYPE_MODE (VALTYPE), 27)
357:
358: /* But the called function leaves it in the second "input" register. */
359:
360: #define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
361: gen_rtx (REG, TYPE_MODE (VALTYPE), 11)
362:
363: /* Define how to find the value returned by a library function
364: assuming the value has mode MODE. */
365:
366: #define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 27)
367:
368: /* 1 if N is a possible register number for a function value
369: as seen by the caller.
370: On SPUR, the first "output" reg is the only register thus used. */
371:
372: #define FUNCTION_VALUE_REGNO_P(N) ((N) == 27)
373:
374: /* 1 if N is a possible register number for function argument passing.
375: On SPUR, these are the "output" registers. */
376:
377: #define FUNCTION_ARG_REGNO_P(N) ((N) < 32 && (N) > 26)
378:
379: /* Define a data type for recording info about an argument list
380: during the scan of that argument list. This data type should
381: hold all necessary information about the function itself
382: and about the args processed so far, enough to enable macros
383: such as FUNCTION_ARG to determine where the next arg should go.
384:
385: On SPUR, this is a single integer, which is a number of words
386: of arguments scanned so far (including the invisible argument,
387: if any, which holds the structure-value-address).
388: Thus 5 or more means all following args should go on the stack. */
389:
390: #define CUMULATIVE_ARGS int
391:
392: /* Initialize a variable CUM of type CUMULATIVE_ARGS
393: for a call to a function whose data type is FNTYPE.
394: For a library call, FNTYPE is 0.
395:
396: On SPUR, the offset normally starts at 0, but starts at 4 bytes
397: when the function gets a structure-value-address as an
398: invisible first argument. */
399:
400: #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) \
401: ((CUM) = ((FNTYPE) != 0 && aggregate_value_p ((FNTYPE))))
402:
403: /* Update the data in CUM to advance over an argument
404: of mode MODE and data type TYPE.
405: (TYPE is null for libcalls where that information may not be available.) */
406:
407: #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
408: ((CUM) += ((MODE) != BLKmode \
409: ? (GET_MODE_SIZE (MODE) + 3) / 4 \
410: : (int_size_in_bytes (TYPE) + 3) / 4))
411:
412: /* Determine where to put an argument to a function.
413: Value is zero to push the argument on the stack,
414: or a hard register in which to store the argument.
415:
416: MODE is the argument's machine mode.
417: TYPE is the data type of the argument (as a tree).
418: This is null for libcalls where that information may
419: not be available.
420: CUM is a variable of type CUMULATIVE_ARGS which gives info about
421: the preceding args and about the function being called.
422: NAMED is nonzero if this argument is a named parameter
423: (otherwise it is an extra parameter matching an ellipsis). */
424:
425: /* On SPUR the first five words of args are normally in registers
426: and the rest are pushed. But any arg that won't entirely fit in regs
427: is pushed. */
428:
429: #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
430: (5 >= ((CUM) \
431: + ((MODE) == BLKmode \
432: ? (int_size_in_bytes (TYPE) + 3) / 4 \
433: : (GET_MODE_SIZE (MODE) + 3) / 4)) \
434: ? gen_rtx (REG, (MODE), 27 + (CUM)) \
435: : 0)
436:
437: /* Define where a function finds its arguments.
438: This is different from FUNCTION_ARG because of register windows. */
439:
440: #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
441: (5 >= ((CUM) \
442: + ((MODE) == BLKmode \
443: ? (int_size_in_bytes (TYPE) + 3) / 4 \
444: : (GET_MODE_SIZE (MODE) + 3) / 4)) \
445: ? gen_rtx (REG, (MODE), 11 + (CUM)) \
446: : 0)
447:
448: /* For an arg passed partly in registers and partly in memory,
449: this is the number of registers used.
450: For args passed entirely in registers or entirely in memory, zero. */
451:
452: #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
453:
454: /* This macro generates the assembly code for function entry.
455: FILE is a stdio stream to output the code to.
456: SIZE is an int: how many units of temporary storage to allocate.
457: Refer to the array `regs_ever_live' to determine which registers
458: to save; `regs_ever_live[I]' is nonzero if register number I
459: is ever used in the function. This macro is responsible for
460: knowing which registers should not be saved even if used. */
461:
462: /* On spur, move-double insns between fpu and cpu need an 8-byte block
463: of memory. If any fpu reg is used in the function, we allocate
464: such a block here, at the bottom of the frame, just in case it's needed. */
465:
466: #define FUNCTION_PROLOGUE(FILE, SIZE) \
467: { \
468: extern char call_used_regs[]; \
469: extern int current_function_pretend_args_size; \
470: int fsize = ((SIZE) + 7) & ~7; \
471: int nregs, i, fp_used = 0; \
472: for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
473: { \
474: if (regs_ever_live[i] && ! call_used_regs[i]) \
475: nregs++; \
476: if (regs_ever_live[i]) fp_used = 1; \
477: } \
478: if (fp_used) fsize += 8; \
479: fprintf (FILE, "0:\trd_special r24,pc\n"); \
480: fprintf (FILE, "\tand r24,r24,$~0x3\n"); \
481: fprintf (FILE, "\tadd_nt r25,r4,$%d\n", \
482: - current_function_pretend_args_size); \
483: if (fsize + nregs != 0 || current_function_pretend_args_size > 0)\
484: { \
485: int n = - fsize - nregs * 16; \
486: if (n >= -8192) \
487: fprintf (FILE, "\tadd_nt r4,r25,$%d\n", n); \
488: else \
489: { \
490: fprintf (FILE, "\tadd_nt r4,r25,$-8192\n"); \
491: n += 8192; \
492: while (n < -8192) \
493: fprintf (FILE, "\tadd_nt r4,r4,$-8192\n"), n += 8192; \
494: if (n != 0) \
495: fprintf (FILE, "\tadd_nt r4,r4,$%d\n", n); \
496: } \
497: } \
498: for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
499: if (regs_ever_live[i] && ! call_used_regs[i]) \
500: { \
501: fprintf (FILE, "\tst_ext1 %s,r4,$%d\n", \
502: reg_names[i], 8 * nregs++); \
503: fprintf (FILE, "\tst_ext2 %s,r4,$%d\n", \
504: reg_names[i], 8 * nregs++); \
505: } \
506: }
507:
508: /* Output assembler code to FILE to increment profiler label # LABELNO
509: for profiling a function entry. */
510:
511: #define FUNCTION_PROFILER(FILE, LABELNO) \
512: abort ();
513:
514: /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
515: the stack pointer does not matter. The value is tested only in
516: functions that have frame pointers.
517: No definition is equivalent to always zero. */
518:
519: extern int current_function_calls_alloca;
520: extern int current_function_pretend_args_size;
521:
522: #define EXIT_IGNORE_STACK \
523: (get_frame_size () != 0 \
524: || current_function_calls_alloca || current_function_pretend_args_size)
525:
526: /* This macro generates the assembly code for function exit,
527: on machines that need it. If FUNCTION_EPILOGUE is not defined
528: then individual return instructions are generated for each
529: return statement. Args are same as for FUNCTION_PROLOGUE.
530:
531: The function epilogue should not depend on the current stack pointer!
532: It should use the frame pointer only. This is mandatory because
533: of alloca; we also take advantage of it to omit stack adjustments
534: before returning. */
535:
536: #define FUNCTION_EPILOGUE(FILE, SIZE) \
537: { \
538: extern char call_used_regs[]; \
539: extern int current_function_calls_alloca; \
540: extern int current_function_pretend_args_size; \
541: int fsize = ((SIZE) + 7) & ~7; \
542: int nregs, i, fp_used = 0; \
543: for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
544: { \
545: if (regs_ever_live[i] && ! call_used_regs[i]) \
546: nregs++; \
547: if (regs_ever_live[i]) fp_used = 1; \
548: } \
549: if (fp_used) fsize += 8; \
550: if (nregs != 0) \
551: { \
552: fprintf (FILE, "\tadd_nt r4,r25,$%d\n", - fsize - nregs * 16); \
553: for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
554: if (regs_ever_live[i] && ! call_used_regs[i]) \
555: { \
556: fprintf (FILE, "\tld_ext1 %s,r4,$%d\n\tnop\n", \
557: reg_names[i], 8 * nregs++); \
558: fprintf (FILE, "\tld_ext2 %s,r4,$%d\n\tnop\n", \
559: reg_names[i], 8 * nregs++); \
560: } \
561: } \
562: if (fsize != 0 || nregs != 0 || current_function_calls_alloca \
563: || current_function_pretend_args_size > 0) \
564: fprintf (FILE, "\tadd_nt r4,r25,$%d\n", \
565: current_function_pretend_args_size); \
566: fprintf (FILE, "\treturn r10,$8\n\tnop\n"); \
567: }
568:
569: /* Addressing modes, and classification of registers for them. */
570:
571: /* #define HAVE_POST_INCREMENT */
572: /* #define HAVE_POST_DECREMENT */
573:
574: /* #define HAVE_PRE_DECREMENT */
575: /* #define HAVE_PRE_INCREMENT */
576:
577: /* Macros to check register numbers against specific register classes. */
578:
579: /* These assume that REGNO is a hard or pseudo reg number.
580: They give nonzero only if REGNO is a hard reg of the suitable class
581: or a pseudo reg currently allocated to a suitable hard reg.
582: Since they use reg_renumber, they are safe only once reg_renumber
583: has been allocated, which happens in local-alloc.c. */
584:
585: #define REGNO_OK_FOR_INDEX_P(REGNO) \
586: ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
587: #define REGNO_OK_FOR_BASE_P(REGNO) \
588: ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
589: #define REGNO_OK_FOR_FP_P(REGNO) \
590: (((REGNO) ^ 0x20) < 14 || (unsigned) (reg_renumber[REGNO] ^ 0x20) < 14)
591:
592: /* Now macros that check whether X is a register and also,
593: strictly, whether it is in a specified class.
594:
595: These macros are specific to the SPUR, and may be used only
596: in code for printing assembler insns and in conditions for
597: define_optimization. */
598:
599: /* 1 if X is an fp register. */
600:
601: #define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
602:
603: /* Maximum number of registers that can appear in a valid memory address. */
604:
605: #define MAX_REGS_PER_ADDRESS 2
606:
607: /* Recognize any constant value that is a valid address. */
608:
609: #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
610:
611: /* Nonzero if the constant value X is a legitimate general operand.
612: It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
613:
614: #define LEGITIMATE_CONSTANT_P(X) \
615: ((GET_CODE (X) == CONST_INT \
616: && (unsigned) (INTVAL (X) + 0x2000) < 0x4000)\
617: || (GET_CODE (X) == SYMBOL_REF && (X)->unchanging))
618:
619: /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
620: and check its validity for a certain class.
621: We have two alternate definitions for each of them.
622: The usual definition accepts all pseudo regs; the other rejects
623: them unless they have been allocated suitable hard regs.
624: The symbol REG_OK_STRICT causes the latter definition to be used.
625:
626: Most source files want to accept pseudo regs in the hope that
627: they will get allocated to the class that the insn wants them to be in.
628: Source files for reload pass need to be strict.
629: After reload, it makes no difference, since pseudo regs have
630: been eliminated by then. */
631:
632: #ifndef REG_OK_STRICT
633:
634: /* Nonzero if X is a hard reg that can be used as an index
635: or if it is a pseudo reg. */
636: #define REG_OK_FOR_INDEX_P(X) (((unsigned) REGNO (X)) - 32 >= 14)
637: /* Nonzero if X is a hard reg that can be used as a base reg
638: or if it is a pseudo reg. */
639: #define REG_OK_FOR_BASE_P(X) (((unsigned) REGNO (X)) - 32 >= 14)
640:
641: #else
642:
643: /* Nonzero if X is a hard reg that can be used as an index. */
644: #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
645: /* Nonzero if X is a hard reg that can be used as a base reg. */
646: #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
647:
648: #endif
649:
650: /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
651: that is a valid memory address for an instruction.
652: The MODE argument is the machine mode for the MEM expression
653: that wants to use this address.
654:
655: On SPUR, the actual legitimate addresses must be REG+SMALLINT or REG+REG.
656: Actually, REG+REG is not legitimate for stores, so
657: it is obtained only by combination on loads.
658: We can treat a SYMBOL_REF as legitimate if it is part of this
659: function's constant-pool, because such addresses can actually
660: be output as REG+SMALLINT. */
661:
662: #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
663: { if (GET_CODE (X) == REG \
664: && REG_OK_FOR_BASE_P (X)) \
665: goto ADDR; \
666: if (GET_CODE (X) == SYMBOL_REF && (X)->unchanging) \
667: goto ADDR; \
668: if (GET_CODE (X) == PLUS \
669: && GET_CODE (XEXP (X, 0)) == REG \
670: && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
671: { \
672: if (GET_CODE (XEXP (X, 1)) == CONST_INT \
673: && INTVAL (XEXP (X, 1)) >= -0x2000 \
674: && INTVAL (XEXP (X, 1)) < 0x2000) \
675: goto ADDR; \
676: } \
677: }
678:
679: /* Try machine-dependent ways of modifying an illegitimate address
680: to be legitimate. If we find one, return the new, valid address.
681: This macro is used in only one place: `memory_address' in explow.c.
682:
683: OLDX is the address as it was before break_out_memory_refs was called.
684: In some cases it is useful to look at this to decide what needs to be done.
685:
686: MODE and WIN are passed so that this macro can use
687: GO_IF_LEGITIMATE_ADDRESS.
688:
689: It is always safe for this macro to do nothing. It exists to recognize
690: opportunities to optimize the output. */
691:
692: /* On SPUR, change REG+N into REG+REG, and REG+(X*Y) into REG+REG. */
693:
694: #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
695: { if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
696: (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
697: copy_to_mode_reg (SImode, XEXP (X, 1))); \
698: if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 0))) \
699: (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
700: copy_to_mode_reg (SImode, XEXP (X, 0))); \
701: if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT) \
702: (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
703: force_operand (XEXP (X, 0), 0)); \
704: if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT) \
705: (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
706: force_operand (XEXP (X, 1), 0)); \
707: if (memory_address_p (MODE, X)) \
708: goto WIN; }
709:
710: /* Go to LABEL if ADDR (a legitimate address expression)
711: has an effect that depends on the machine mode it is used for.
712: On the SPUR this is never true. */
713:
714: #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
715:
716: /* Specify the machine mode that this machine uses
717: for the index in the tablejump instruction. */
718: #define CASE_VECTOR_MODE SImode
719:
720: /* Define this if the tablejump instruction expects the table
721: to contain offsets from the address of the table.
722: Do not define this if the table should contain absolute addresses. */
723: /* #define CASE_VECTOR_PC_RELATIVE */
724:
725: /* Specify the tree operation to be used to convert reals to integers. */
726: #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
727:
728: /* This is the kind of divide that is easiest to do in the general case. */
729: #define EASY_DIV_EXPR TRUNC_DIV_EXPR
730:
731: /* Define this as 1 if `char' should by default be signed; else as 0. */
732: #define DEFAULT_SIGNED_CHAR 0
733:
734: /* Max number of bytes we can move from memory to memory
735: in one reasonably fast instruction. */
736: #define MOVE_MAX 4
737:
738: /* Nonzero if access to memory by bytes is slow and undesirable. */
739: #define SLOW_BYTE_ACCESS 1
740:
741: /* This is BSD, so it wants DBX format. */
742: #define DBX_DEBUGGING_INFO
743:
744: /* Do not break .stabs pseudos into continuations. */
745: #define DBX_CONTIN_LENGTH 0
746:
747: /* Don't try to use the `x' type-cross-reference character in DBX data.
748: Also has the consequence of putting each struct, union or enum
749: into a separate .stabs, containing only cross-refs to the others. */
750: #define DBX_NO_XREFS
751:
752: /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
753: is done just by pretending it is already truncated. */
754: #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
755:
756: /* Specify the machine mode that pointers have.
757: After generation of rtl, the compiler makes no further distinction
758: between pointers and any other objects of this machine mode. */
759: #define Pmode SImode
760:
761: /* A function address in a call instruction
762: is a byte address (for indexing purposes)
763: so give the MEM rtx a byte's mode. */
764: #define FUNCTION_MODE SImode
765:
766: /* Define this if addresses of constant functions
767: shouldn't be put through pseudo regs where they can be cse'd.
768: Desirable on machines where ordinary constants are expensive
769: but a CALL with constant address is cheap. */
770: #define NO_FUNCTION_CSE
771:
772: /* Compute the cost of computing a constant rtl expression RTX
773: whose rtx-code is CODE. The body of this macro is a portion
774: of a switch statement. If the code is computed here,
775: return it with a return statement. Otherwise, break from the switch. */
776:
1.1.1.3 ! root 777: #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1.1 root 778: case CONST_INT: \
779: if (INTVAL (RTX) < 0x2000 && INTVAL (RTX) >= -0x2000) return 1; \
780: case CONST: \
781: case LABEL_REF: \
782: case SYMBOL_REF: \
783: return 2; \
784: case CONST_DOUBLE: \
785: return 4;
786:
787: /* Tell final.c how to eliminate redundant test instructions. */
788:
789: /* Here we define machine-dependent flags and fields in cc_status
790: (see `conditions.h'). */
791:
792: /* (None are needed on SPUR.) */
793:
794: /* Store in cc_status the expressions
795: that the condition codes will describe
796: after execution of an instruction whose pattern is EXP.
797: Do not alter them if the instruction would not alter the cc's. */
798:
799: /* The SPUR does not really have a condition code. */
800:
801: #define NOTICE_UPDATE_CC(EXP, INSN) \
802: { CC_STATUS_INIT; }
803:
804: /* Control the assembler format that we output. */
805:
806: /* Output at beginning of assembler file. */
807:
808: #define ASM_FILE_START(FILE)
809:
810: /* Output to assembler file text saying following lines
811: may contain character constants, extra white space, comments, etc. */
812:
813: #define ASM_APP_ON ""
814:
815: /* Output to assembler file text saying following lines
816: no longer contain unusual constructs. */
817:
818: #define ASM_APP_OFF ""
819:
820: /* Output before read-only data. */
821:
822: #define TEXT_SECTION_ASM_OP ".text"
823:
824: /* Output before writable data. */
825:
826: #define DATA_SECTION_ASM_OP ".data"
827:
828: /* How to refer to registers in assembler output.
829: This sequence is indexed by compiler's hard-register-number (see above). */
830:
831: #define REGISTER_NAMES \
832: {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", \
833: "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", \
834: "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", \
835: "r30", "r31", \
836: "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", \
837: "f10", "f11", "f12", "f13", "f14" }
838:
839: /* How to renumber registers for dbx and gdb. */
840:
841: #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
842:
843: /* This is how to output the definition of a user-level label named NAME,
844: such as the label on a static function or variable NAME. */
845:
846: #define ASM_OUTPUT_LABEL(FILE,NAME) \
847: do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
848:
849: /* This is how to output a command to make the user-level label named NAME
850: defined for reference from other files. */
851:
852: #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
853: do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
854:
855: /* This is how to output a reference to a user-level label named NAME.
856: `assemble_name' uses this. */
857:
858: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
859: fprintf (FILE, "_%s", NAME)
860:
861: /* This is how to output an internal numbered label where
862: PREFIX is the class of label and NUM is the number within the class. */
863:
864: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
865: fprintf (FILE, "%s%d:\n", PREFIX, NUM)
866:
867: /* This is how to store into the string LABEL
868: the symbol_ref name of an internal numbered label where
869: PREFIX is the class of label and NUM is the number within the class.
870: This is suitable for output with `assemble_name'. */
871:
872: #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
873: sprintf (LABEL, "*%s%d", PREFIX, NUM)
874:
875: /* This is how to output an assembler line defining a `double' constant. */
876:
877: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
878: fprintf (FILE, "\t.double %.20e\n", (VALUE))
879:
880: /* This is how to output an assembler line defining a `float' constant. */
881:
882: #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
883: fprintf (FILE, "\t.single %.12e\n", (VALUE))
884:
885: /* This is how to output an assembler line defining an `int' constant. */
886:
887: #define ASM_OUTPUT_INT(FILE,VALUE) \
888: ( fprintf (FILE, "\t.long "), \
889: output_addr_const (FILE, (VALUE)), \
890: fprintf (FILE, "\n"))
891:
892: /* Likewise for `char' and `short' constants. */
893:
894: #define ASM_OUTPUT_SHORT(FILE,VALUE) \
895: ( fprintf (FILE, "\t.word "), \
896: output_addr_const (FILE, (VALUE)), \
897: fprintf (FILE, "\n"))
898:
899: #define ASM_OUTPUT_CHAR(FILE,VALUE) \
900: ( fprintf (FILE, "\t.byte "), \
901: output_addr_const (FILE, (VALUE)), \
902: fprintf (FILE, "\n"))
903:
904: /* This is how to output an assembler line for a numeric constant byte. */
905:
906: #define ASM_OUTPUT_BYTE(FILE,VALUE) \
907: fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
908:
909: /* This is how to output code to push a register on the stack.
910: It need not be very fast code. */
911:
912: #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
913: fprintf (FILE, "\tadd_nt r4,r4,$-4\n\tst_32 %s,r4,$0\n", reg_names[REGNO])
914:
915: /* This is how to output an insn to pop a register from the stack.
916: It need not be very fast code. */
917:
918: #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
919: fprintf (FILE, "\tld_32 %s,r4,$0\n\tadd_nt r4,r4,$4\n", reg_names[REGNO])
920:
921: /* This is how to output an element of a case-vector that is absolute. */
922:
923: #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
924: fprintf (FILE, "\t.long L%d\n", VALUE)
925:
926: /* This is how to output an element of a case-vector that is relative.
927: (SPUR does not use such vectors,
928: but we must define this macro anyway.) */
929:
930: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
931: fprintf (FILE, "\t.word L%d-L%d\n", VALUE, REL)
932:
933: /* This is how to output an assembler line
934: that says to advance the location counter
935: to a multiple of 2**LOG bytes. */
936:
937: #define ASM_OUTPUT_ALIGN(FILE,LOG) \
938: if ((LOG) != 0) \
939: fprintf (FILE, "\t.align %d\n", (LOG))
940:
941: #define ASM_OUTPUT_SKIP(FILE,SIZE) \
942: fprintf (FILE, "\t.space %u\n", (SIZE))
943:
944: /* This says how to output an assembler line
945: to define a global common symbol. */
946:
947: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
948: ( fputs (".comm ", (FILE)), \
949: assemble_name ((FILE), (NAME)), \
950: fprintf ((FILE), ",%u\n", (ROUNDED)))
951:
952: /* This says how to output an assembler line
953: to define a local common symbol. */
954:
955: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
956: ( fputs (".lcomm ", (FILE)), \
957: assemble_name ((FILE), (NAME)), \
958: fprintf ((FILE), ",%u\n", (ROUNDED)))
959:
960: /* Store in OUTPUT a string (made with alloca) containing
961: an assembler-name for a local static variable named NAME.
962: LABELNO is an integer which is different for each call. */
963:
964: #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
965: ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
966: sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
967:
968: /* Define the parentheses used to group arithmetic operations
969: in assembler code. */
970:
971: #define ASM_OPEN_PAREN "("
972: #define ASM_CLOSE_PAREN ")"
973:
974: /* Define results of standard character escape sequences. */
975: #define TARGET_BELL 007
976: #define TARGET_BS 010
977: #define TARGET_TAB 011
978: #define TARGET_NEWLINE 012
979: #define TARGET_VT 013
980: #define TARGET_FF 014
981: #define TARGET_CR 015
982:
983: /* Print operand X (an rtx) in assembler syntax to file FILE.
984: CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
985: For `%' followed by punctuation, CODE is the punctuation and X is null.
986:
987: On SPUR, the CODE can be `r', meaning this is a register-only operand
988: and an immediate zero should be represented as `r0'. */
989:
990: #define PRINT_OPERAND(FILE, X, CODE) \
991: { if (GET_CODE (X) == REG) \
992: fprintf (FILE, "%s", reg_names[REGNO (X)]); \
993: else if (GET_CODE (X) == MEM) \
994: output_address (XEXP (X, 0)); \
995: else if (GET_CODE (X) == CONST_DOUBLE) \
996: abort (); \
997: else if ((CODE) == 'r' && (X) == const0_rtx) \
998: fprintf (FILE, "r0"); \
999: else { putc ('$', FILE); output_addr_const (FILE, X); }}
1000:
1001: /* Print a memory address as an operand to reference that memory location. */
1002:
1003: #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1004: { register rtx base, index = 0; \
1005: int offset = 0; \
1006: register rtx addr = ADDR; \
1007: if (GET_CODE (addr) == REG) \
1008: { \
1009: fprintf (FILE, "%s,$0", reg_names[REGNO (addr)]); \
1010: } \
1011: else if (GET_CODE (addr) == PLUS) \
1012: { \
1013: if (GET_CODE (XEXP (addr, 0)) == CONST_INT) \
1014: offset = INTVAL (XEXP (addr, 0)), base = XEXP (addr, 1);\
1015: else if (GET_CODE (XEXP (addr, 1)) == CONST_INT) \
1016: offset = INTVAL (XEXP (addr, 1)), base = XEXP (addr, 0);\
1017: else \
1018: base = XEXP (addr, 0), index = XEXP (addr, 1); \
1019: fprintf (FILE, "%s,", reg_names[REGNO (base)]); \
1020: if (index == 0) \
1021: fprintf (FILE, "$%d", offset); \
1022: else \
1023: fprintf (FILE, "%s,", reg_names[REGNO (index)]); \
1024: } \
1025: else \
1026: { \
1027: fprintf (FILE, "r24,$("); \
1028: output_addr_const (FILE, addr); \
1029: fprintf (FILE, "-0b)"); \
1030: } \
1031: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.