|
|
1.1 root 1: /* Definitions of target machine for GNU compiler. NS32000 version.
2: Copyright (C) 1988 Free Software Foundation, Inc.
3: Contributed by Michael Tiemann ([email protected])
4:
5: This file is part of GNU CC.
6:
7: GNU CC is free software; you can redistribute it and/or modify
8: it under the terms of the GNU General Public License as published by
9: the Free Software Foundation; either version 1, or (at your option)
10: any later version.
11:
12: GNU CC is distributed in the hope that it will be useful,
13: but WITHOUT ANY WARRANTY; without even the implied warranty of
14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: GNU General Public License for more details.
16:
17: You should have received a copy of the GNU General Public License
18: along with GNU CC; see the file COPYING. If not, write to
19: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20:
21:
22: /* Note that some other tm- files include this one and then override
23: many of the definitions that relate to assembler syntax. */
24:
25:
26: /* Names to predefine in the preprocessor for this target machine. */
27:
28: #define CPP_PREDEFINES "-Dns32000 -Dunix"
29:
30: /* Print subsidiary information on the compiler version in use. */
31: #define TARGET_VERSION fprintf (stderr, " (32000, National syntax)");
32:
33: /* Run-time compilation parameters selecting different hardware subsets. */
34:
35: extern int target_flags;
36:
37: /* Macros used in the machine description to test the flags. */
38:
39: /* Compile 32081 insns for floating point (not library calls). */
40: #define TARGET_32081 (target_flags & 1)
41: /* Compile using rtd insn calling sequence.
42: This will not work unless you use prototypes at least
43: for all functions that can take varying numbers of args. */
44: #define TARGET_RTD (target_flags & 2)
45: /* Compile passing first two args in regs 0 and 1. */
46: #define TARGET_REGPARM (target_flags & 4)
47:
48: /* Macro to define tables used to set the flags.
49: This is a list in braces of pairs in braces,
50: each pair being { "NAME", VALUE }
51: where VALUE is the bits to set or minus the bits to clear.
52: An empty string NAME is used to identify the default VALUE. */
53:
54: #define TARGET_SWITCHES \
55: { { "32081", 1}, \
56: { "soft-float", -1}, \
57: { "rtd", 2}, \
58: { "nortd", -2}, \
59: { "regparm", 4}, \
60: { "noregparm", -4}, \
61: { "", TARGET_DEFAULT}}
62:
63: /* target machine storage layout */
64:
65: /* Define this if most significant bit is lowest numbered
66: in instructions that operate on numbered bit-fields.
67: This is not true on the ns32k. */
68: /* #define BITS_BIG_ENDIAN */
69:
70: /* Define this if most significant byte of a word is the lowest numbered. */
71: /* That is not true on the ns32k. */
72: /* #define BYTES_BIG_ENDIAN */
73:
74: /* Define this if most significant word of a multiword number is numbered. */
75: /* This is not true on the ns32k. */
76: /* #define WORDS_BIG_ENDIAN */
77:
78: /* Number of bits in an addressible 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 32000, 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 pointers in memory. */
95: #define POINTER_BOUNDARY 16
96:
97: /* Allocation boundary (in *bits*) for storing arguments in argument list. */
98: #define PARM_BOUNDARY 32
99:
100: /* Boundary (in *bits*) on which stack pointer should be aligned. */
101: #define STACK_BOUNDARY 32
102:
103: /* Allocation boundary (in *bits*) for the code of a function. */
104: #define FUNCTION_BOUNDARY 16
105:
106: /* Alignment of field after `int : 0' in a structure. */
107: #define EMPTY_FIELD_BOUNDARY 32
108:
109: /* Every structure's size must be a multiple of this. */
110: #define STRUCTURE_SIZE_BOUNDARY 8
111:
112: /* No data type wants to be aligned rounder than this. */
113: #define BIGGEST_ALIGNMENT 32
114:
115: /* Define this if move instructions will actually fail to work
116: when given unaligned data. National claims that the NS32032
117: works without strict alignment, but rumor has it that operands
118: crossing a page boundary cause unpredictable results. */
119: #define STRICT_ALIGNMENT
120:
121: /* Standard register usage. */
122:
123: /* Number of actual hardware registers.
124: The hardware registers are assigned numbers for the compiler
125: from 0 to just below FIRST_PSEUDO_REGISTER.
126: All registers that the compiler knows about must be given numbers,
127: even those that are not normally considered general registers. */
128: #define FIRST_PSEUDO_REGISTER 18
129:
130: /* 1 for registers that have pervasive standard uses
131: and are not available for the register allocator.
132: On the ns32k, these are the FP, SP, (SB and PC are not included here). */
133: #define FIXED_REGISTERS {0, 0, 0, 0, 0, 0, 0, 0, \
134: 0, 0, 0, 0, 0, 0, 0, 0, \
135: 1, 1}
136:
137: /* 1 for registers not available across function calls.
138: These must include the FIXED_REGISTERS and also any
139: registers that can be used without being saved.
140: The latter must include the registers where values are returned
141: and the register where structure-value addresses are passed.
142: Aside from that, you can include as many other registers as you like. */
143: #define CALL_USED_REGISTERS {1, 1, 1, 0, 0, 0, 0, 0, \
144: 1, 1, 1, 1, 0, 0, 0, 0, \
145: 1, 1}
146:
147: /* Return number of consecutive hard regs needed starting at reg REGNO
148: to hold something of mode MODE.
149: This is ordinarily the length in words of a value of mode MODE
150: but can be less for certain modes in special long registers.
151: On the ns32k, all registers are 32 bits long. */
152: #define HARD_REGNO_NREGS(REGNO, MODE) \
153: ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
154:
155: /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
156: On the 32000, all registers can hold all modes, except that
157: double precision floats (and double ints) must fall on even-register
158: boundaries */
159: #define HARD_REGNO_MODE_OK(REGNO, MODE) \
160: ((MODE) == DFmode \
161: ? (((REGNO) & 1) == 0 \
162: && (TARGET_32081 ? (REGNO) < 16 : (REGNO) < 8)) \
163: : (MODE) == DImode ? ((REGNO) & 1) == 0 && (REGNO) < 8 \
164: : 1)
165:
166: /* Value is 1 if it is a good idea to tie two pseudo registers
167: when one has mode MODE1 and one has mode MODE2.
168: If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
169: for any hard reg, then this must be 0 for correct output. */
170: #define MODES_TIEABLE_P(MODE1, MODE2) \
171: (((MODE1) == DFmode || (MODE1) == DImode) == ((MODE2) == DFmode || (MODE2) == DImode))
172:
173: /* Specify the registers used for certain standard purposes.
174: The values of these macros are register numbers. */
175:
176: /* NS32000 pc is not overloaded on a register. */
177: /* #define PC_REGNUM */
178:
179: /* Register to use for pushing function arguments. */
180: #define STACK_POINTER_REGNUM 17
181:
182: /* Base register for access to local variables of the function. */
183: #define FRAME_POINTER_REGNUM 16
184:
185: /* Value should be nonzero if functions must have frame pointers.
186: Zero means the frame pointer need not be set up (and parms
187: may be accessed via the stack pointer) in functions that seem suitable.
188: This is computed in `reload', in reload1.c. */
189: #define FRAME_POINTER_REQUIRED 0
190:
191: /* Base register for access to arguments of the function. */
192: #define ARG_POINTER_REGNUM 16
193:
194: /* Register in which static-chain is passed to a function. */
195: #define STATIC_CHAIN_REGNUM 1
196:
197: /* Register in which address to store a structure value
198: is passed to a function. */
199: #define STRUCT_VALUE_REGNUM 2
200:
201: /* Define the classes of registers for register constraints in the
202: machine description. Also define ranges of constants.
203:
204: One of the classes must always be named ALL_REGS and include all hard regs.
205: If there is more than one class, another class must be named NO_REGS
206: and contain no registers.
207:
208: The name GENERAL_REGS must be the name of a class (or an alias for
209: another name such as ALL_REGS). This is the class of registers
210: that is allowed by "g" or "r" in a register constraint.
211: Also, registers outside this class are allocated only when
212: instructions express preferences for them.
213:
214: The classes must be numbered in nondecreasing order; that is,
215: a larger-numbered class must never be contained completely
216: in a smaller-numbered class.
217:
218: For any two classes, it is very desirable that there be another
219: class that represents their union. */
220:
221: enum reg_class { NO_REGS, GENERAL_REGS, FLOAT_REGS, GEN_AND_FLOAT_REGS,
222: GEN_AND_MEM_REGS, ALL_REGS, LIM_REG_CLASSES };
223:
224: #define N_REG_CLASSES (int) LIM_REG_CLASSES
225:
226: /* Give names of register classes as strings for dump file. */
227:
228: #define REG_CLASS_NAMES \
229: {"NO_REGS", "GENERAL_REGS", "FLOAT_REGS", "GEN_AND_FLOAT_REGS", "GEN_AND_MEM_REGS", "ALL_REGS" }
230:
231: /* Define which registers fit in which classes.
232: This is an initializer for a vector of HARD_REG_SET
233: of length N_REG_CLASSES. */
234:
235: #define REG_CLASS_CONTENTS {0, 0x00ff, 0xff00, 0xffff, 0x300ff, 0x3ffff, }
236:
237: /* The same information, inverted:
238: Return the class number of the smallest class containing
239: reg number REGNO. This could be a conditional expression
240: or could index an array. */
241:
242: #define REGNO_REG_CLASS(REGNO) \
243: ((REGNO) < 8 ? GENERAL_REGS : (REGNO) < 16 ? FLOAT_REGS : ALL_REGS)
244:
245: /* The class value for index registers, and the one for base regs. */
246:
247: #define INDEX_REG_CLASS GENERAL_REGS
248: #define BASE_REG_CLASS GEN_AND_MEM_REGS
249:
250: /* Get reg_class from a letter such as appears in the machine description. */
251:
252: #define REG_CLASS_FROM_LETTER(C) \
253: ((C) == 'r' ? GENERAL_REGS \
254: : (C) == 'f' ? FLOAT_REGS \
255: : (C) == 'x' ? GEN_AND_MEM_REGS \
256: : NO_REGS)
257:
258: /* The letters I, J, K, L and M in a register constraint string
259: can be used to stand for particular ranges of immediate operands.
260: This macro defines what the ranges are.
261: C is the letter, and VALUE is a constant value.
262: Return 1 if VALUE is in the range specified by C.
263:
264: On the ns32k, these letters are used as follows:
265:
266: I : Matches integers which are valid shift amounts for scaled indexing.
267: These are 0, 1, 2, 3 for byte, word, double, and quadword.
268: J : Matches integers which fit a "quick" operand.
269: K : Matches integers 0 to 7 (for inss and exts instructions). */
270:
271: #define CONST_OK_FOR_LETTER_P(VALUE, C) \
272: ((VALUE) < 8 && (VALUE) + 8 >= 0 ? \
273: ((C) == 'I' ? (0 <= (VALUE) && (VALUE) <= 3) : \
274: (C) == 'J' ? (VALUE) <= 7 : \
275: (C) == 'K' ? 0 <= (VALUE) : 0) : 0)
276:
277: /* Similar, but for floating constants, and defining letters G and H.
278: Here VALUE is the CONST_DOUBLE rtx itself. */
279:
280: #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1
281:
282: /* Given an rtx X being reloaded into a reg required to be
283: in class CLASS, return the class of reg to actually use.
284: In general this is just CLASS; but on some machines
285: in some cases it is preferable to use a more restrictive class. */
286:
287: #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
288:
289: /* Return the maximum number of consecutive registers
290: needed to represent mode MODE in a register of class CLASS. */
291: /* On the 32000, this is the size of MODE in words */
292: #define CLASS_MAX_NREGS(CLASS, MODE) \
293: ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
294:
295: /* Stack layout; function entry, exit and calling. */
296:
297: /* Define this if pushing a word on the stack
298: makes the stack pointer a smaller address. */
299: #define STACK_GROWS_DOWNWARD
300:
301: /* Define this if the nominal address of the stack frame
302: is at the high-address end of the local variables;
303: that is, each additional local variable allocated
304: goes at a more negative offset in the frame. */
305: #define FRAME_GROWS_DOWNWARD
306:
307: /* Offset within stack frame to start allocating local variables at.
308: If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
309: first local allocated. Otherwise, it is the offset to the BEGINNING
310: of the first local allocated. */
311: #define STARTING_FRAME_OFFSET 0
312:
313: /* If we generate an insn to push BYTES bytes,
314: this says how many the stack pointer really advances by.
315: On the 32000, sp@- in a byte insn really pushes a BYTE. */
316: #define PUSH_ROUNDING(BYTES) (BYTES)
317:
318: /* Offset of first parameter from the argument pointer register value. */
319: #define FIRST_PARM_OFFSET(FNDECL) 8
320:
321: /* Value is 1 if returning from a function call automatically
322: pops the arguments described by the number-of-args field in the call.
323: FUNTYPE is the data type of the function (as a tree),
324: or for a library call it is an identifier node for the subroutine name.
325:
326: On the 32000, the RET insn may be used to pop them if the number
327: of args is fixed, but if the number is variable then the caller
328: must pop them all. RET can't be used for library calls now
329: because the library is compiled with the Unix compiler.
330: Use of RET is a selectable option, since it is incompatible with
331: standard Unix calling sequences. If the option is not selected,
332: the caller must always pop the args. */
333:
334: #define RETURN_POPS_ARGS(FUNTYPE) \
335: (TARGET_RTD && TREE_CODE (FUNTYPE) != IDENTIFIER_NODE \
336: && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
337: || TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) == void_type_node))
338:
339: /* Define how to find the value returned by a function.
340: VALTYPE is the data type of the value (as a tree).
341: If the precise function being called is known, FUNC is its FUNCTION_DECL;
342: otherwise, FUNC is 0. */
343:
344: /* On the 32000 the return value is in R0,
345: or perhaps in F0 is there is fp support. */
346:
347: #define FUNCTION_VALUE(VALTYPE, FUNC) \
348: (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_32081 \
349: ? gen_rtx (REG, TYPE_MODE (VALTYPE), 8) \
350: : gen_rtx (REG, TYPE_MODE (VALTYPE), 0))
351:
352: /* Define how to find the value returned by a library function
353: assuming the value has mode MODE. */
354:
355: /* On the 32000 the return value is in R0,
356: or perhaps F0 is there is fp support. */
357:
358: #define LIBCALL_VALUE(MODE) \
359: (((MODE) == DFmode || (MODE) == SFmode) && TARGET_32081 \
360: ? gen_rtx (REG, MODE, 8) \
361: : gen_rtx (REG, MODE, 0))
362:
363: /* Define this if PCC uses the nonreentrant convention for returning
364: structure and union values. */
365:
366: #define PCC_STATIC_STRUCT_RETURN
367:
368: /* 1 if N is a possible register number for a function value.
369: On the 32000, R0 and F0 are the only registers thus used. */
370:
371: #define FUNCTION_VALUE_REGNO_P(N) (((N) & ~8) == 0)
372:
373: /* 1 if N is a possible register number for function argument passing.
374: On the 32000, no registers are used in this way. */
375:
376: #define FUNCTION_ARG_REGNO_P(N) 0
377:
378: /* Define a data type for recording info about an argument list
379: during the scan of that argument list. This data type should
380: hold all necessary information about the function itself
381: and about the args processed so far, enough to enable macros
382: such as FUNCTION_ARG to determine where the next arg should go.
383:
384: On the ns32k, this is a single integer, which is a number of bytes
385: of arguments scanned so far. */
386:
387: #define CUMULATIVE_ARGS int
388:
389: /* Initialize a variable CUM of type CUMULATIVE_ARGS
390: for a call to a function whose data type is FNTYPE.
391: For a library call, FNTYPE is 0.
392:
393: On the ns32k, the offset starts at 0. */
394:
395: #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE) \
396: ((CUM) = 0)
397:
398: /* Update the data in CUM to advance over an argument
399: of mode MODE and data type TYPE.
400: (TYPE is null for libcalls where that information may not be available.) */
401:
402: #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
403: ((CUM) += ((MODE) != BLKmode \
404: ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
405: : (int_size_in_bytes (TYPE) + 3) & ~3))
406:
407: /* Define where to put the arguments to a function.
408: Value is zero to push the argument on the stack,
409: or a hard register in which to store the argument.
410:
411: MODE is the argument's machine mode.
412: TYPE is the data type of the argument (as a tree).
413: This is null for libcalls where that information may
414: not be available.
415: CUM is a variable of type CUMULATIVE_ARGS which gives info about
416: the preceding args and about the function being called.
417: NAMED is nonzero if this argument is a named parameter
418: (otherwise it is an extra parameter matching an ellipsis). */
419:
420: /* On the 32000 all args are pushed, except if -mregparm is specified
421: then the first two words of arguments are passed in r0, r1.
422: *NOTE* -mregparm does not work.
423: It exists only to test register calling conventions. */
424:
425: #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
426: ((TARGET_REGPARM && (CUM) < 8) ? gen_rtx (REG, (MODE), (CUM) / 4) : 0)
427:
428: /* For an arg passed partly in registers and partly in memory,
429: this is the number of registers used.
430: For args passed entirely in registers or entirely in memory, zero. */
431:
432: #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
433: ((TARGET_REGPARM && (CUM) < 8 \
434: && 8 < ((CUM) + ((MODE) == BLKmode \
435: ? int_size_in_bytes (TYPE) \
436: : GET_MODE_SIZE (MODE)))) \
437: ? 2 - (CUM) / 4 : 0)
438:
439: #ifndef MAIN_FUNCTION_PROLOGUE
440: #define MAIN_FUNCTION_PROLOGUE
441: #endif
442:
443: /* This macro generates the assembly code for function entry.
444: FILE is a stdio stream to output the code to.
445: SIZE is an int: how many units of temporary storage to allocate.
446: Refer to the array `regs_ever_live' to determine which registers
447: to save; `regs_ever_live[I]' is nonzero if register number I
448: is ever used in the function. This macro is responsible for
449: knowing which registers should not be saved even if used. */
450:
451: #define FUNCTION_PROLOGUE(FILE, SIZE) \
452: { register int regno; \
453: int used_regs_buf[8], *bufp = used_regs_buf; \
454: int used_fregs_buf[8], *fbufp = used_fregs_buf; \
455: extern char call_used_regs[]; \
456: MAIN_FUNCTION_PROLOGUE; \
457: for (regno = 0; regno < 8; regno++) \
458: if (regs_ever_live[regno] && !call_used_regs[regno]) { \
459: *bufp++ = regno; \
460: } \
461: *bufp = -1; \
462: for (; regno < 16; regno++) \
463: if (regs_ever_live[regno] && !call_used_regs[regno]) { \
464: *fbufp++ = regno; \
465: } \
466: *fbufp = -1; \
467: bufp = used_regs_buf; \
468: if (frame_pointer_needed) \
469: { \
470: fprintf (FILE, "\tenter ["); \
471: while (*bufp >= 0) \
472: { \
473: fprintf (FILE, "r%d", *bufp++); \
474: if (*bufp >= 0) \
475: fputc (',', FILE); \
476: } \
477: fprintf (FILE, "],%d\n", SIZE); \
478: } \
479: else while (*bufp >= 0) \
480: fprintf (FILE, "\tmovd r%d,tos\n", *bufp++); \
481: fbufp = used_fregs_buf; \
482: while (*fbufp >= 0) \
483: { \
484: if ((*fbufp & 1) || (fbufp[0] != fbufp[1] - 1)) \
485: fprintf (FILE, "\tmovf f%d,tos\n", *fbufp++ - 8); \
486: else \
487: { \
488: fprintf (FILE, "\tmovl f%d,tos\n", fbufp[0] - 8); \
489: fbufp += 2; \
490: } \
491: } \
492: }
493:
494: /* Output assembler code to FILE to increment profiler label # LABELNO
495: for profiling a function entry.
496:
497: THIS DEFINITION FOR THE 32000 IS A GUESS. IT HAS NOT BEEN TESTED. */
498:
499: #define FUNCTION_PROFILER(FILE, LABELNO) \
500: fprintf (FILE, "\taddr LP%d,r0\n\tbsr mcount\n", (LABELNO))
501:
502: /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
503: the stack pointer does not matter. The value is tested only in
504: functions that have frame pointers.
505: No definition is equivalent to always zero. */
506:
507: /* #define EXIT_IGNORE_STACK */
508:
509: /* This macro generates the assembly code for function exit,
510: on machines that need it. If FUNCTION_EPILOGUE is not defined
511: then individual return instructions are generated for each
512: return statement. Args are same as for FUNCTION_PROLOGUE.
513:
514: The function epilogue should not depend on the current stack pointer!
515: It should use the frame pointer only. This is mandatory because
516: of alloca; we also take advantage of it to omit stack adjustments
517: before returning. */
518:
519: #define FUNCTION_EPILOGUE(FILE, SIZE) \
520: { extern int current_function_pops_args; \
521: extern int current_function_args_size; \
522: register int regno; \
523: int used_regs_buf[8], *bufp = used_regs_buf; \
524: int used_fregs_buf[8], *fbufp = used_fregs_buf; \
525: extern char call_used_regs[]; \
526: *fbufp++ = -2; \
527: for (regno = 8; regno < 16; regno++) \
528: if (regs_ever_live[regno] && !call_used_regs[regno]) { \
529: *fbufp++ = regno; \
530: } \
531: fbufp--; \
532: while (fbufp > used_fregs_buf) \
533: { \
534: if ((*fbufp & 1) && fbufp[0] == fbufp[-1] + 1) \
535: { \
536: fprintf (FILE, "\tmovl tos,f%d\n", fbufp[-1] - 8); \
537: fbufp -= 2; \
538: } \
539: else fprintf (FILE, "\tmovf tos,f%d\n", *fbufp-- - 8); \
540: } \
541: for (regno = 0; regno < 8; regno++) \
542: if (regs_ever_live[regno] && ! call_used_regs[regno]) \
543: *bufp++ = regno; \
544: if (frame_pointer_needed) \
545: { \
546: fprintf (FILE, "\texit ["); \
547: while (bufp > used_regs_buf) \
548: { \
549: fprintf (FILE, "r%d", *--bufp); \
550: if (bufp > used_regs_buf) \
551: fputc (',', FILE); \
552: } \
553: fprintf (FILE, "]\n"); \
554: } \
555: else \
556: { \
557: while (bufp > used_regs_buf) \
558: fprintf (FILE, "\tmovd tos,r%d\n", *--bufp); \
559: } \
560: if (current_function_pops_args && current_function_args_size) \
561: fprintf (FILE, "\tret %d\n", current_function_args_size); \
562: else fprintf (FILE, "\tret 0\n"); }
563:
564: /* If the memory address ADDR is relative to the frame pointer,
565: correct it to be relative to the stack pointer instead.
566: This is for when we don't use a frame pointer.
567: ADDR should be a variable name. */
568:
569: #if 0
570: #define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH) \
571: { int offset = -1; \
572: if (GET_CODE (ADDR) == REG && REGNO (ADDR) == FRAME_POINTER_REGNUM) \
573: offset = 0; \
574: else if (GET_CODE (ADDR) == PLUS && GET_CODE (XEXP (ADDR, 0)) == REG \
575: && REGNO (XEXP (ADDR, 0)) == FRAME_POINTER_REGNUM \
576: && GET_CODE (XEXP (ADDR, 1)) == CONST_INT) \
577: offset = INTVAL (XEXP (ADDR, 1)); \
578: if (offset >= 0) \
579: { int regno; \
580: extern char call_used_regs[]; \
581: for (regno = 0; regno < 8; regno++) \
582: if (regs_ever_live[regno] && ! call_used_regs[regno]) \
583: offset += 4; \
584: offset -= 4; \
585: ADDR = plus_constant (gen_rtx (REG, Pmode, STACK_POINTER_REGNUM), \
586: offset + (DEPTH)); } }
587: #else
588: #define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH) \
589: if (check_reg(ADDR, FRAME_POINTER_REGNUM)) { \
590: register int regno, offset = (DEPTH) - 4; \
591: extern char call_used_regs[]; \
592: for (regno = 0; regno < 16; regno++) \
593: if (regs_ever_live[regno] && ! call_used_regs[regno]) \
594: offset += 4; \
595: if (GET_CODE (ADDR) == REG && REGNO (ADDR) == FRAME_POINTER_REGNUM) \
596: ADDR = plus_constant(stack_pointer_rtx, offset); \
597: else if (GET_CODE(ADDR) == PLUS) { \
598: register rtx a0 = XEXP(ADDR, 0); \
599: if (GET_CODE(a0) == REG && REGNO(a0) == FRAME_POINTER_REGNUM) \
600: if (GET_CODE(XEXP(ADDR, 1)) == CONST_INT) \
601: ADDR = plus_constant(stack_pointer_rtx, \
602: offset + INTVAL(XEXP(ADDR, 1))); \
603: else \
604: ADDR = plus_constant(gen_rtx(PLUS, Pmode, \
605: stack_pointer_rtx, XEXP (ADDR, 1)), \
606: offset); \
607: else if (GET_CODE(a0) == MEM) { \
608: register rtx a1 = XEXP(a0, 0); \
609: if (GET_CODE(a1) == REG && REGNO(a1) == FRAME_POINTER_REGNUM) \
610: ADDR = gen_rtx(PLUS, Pmode, \
611: gen_rtx(MEM, Pmode, \
612: plus_constant(stack_pointer_rtx, offset)), \
613: XEXP(ADDR, 1)); \
614: else if (GET_CODE(a1) == PLUS && GET_CODE(XEXP(a1, 0)) == REG \
615: && REGNO(XEXP(a1, 0)) == FRAME_POINTER_REGNUM) \
616: ADDR = gen_rtx(PLUS, Pmode, \
617: gen_rtx(MEM, Pmode, \
618: plus_constant(stack_pointer_rtx, \
619: offset+INTVAL(XEXP(a1, 1)))),\
620: XEXP(ADDR, 1)); \
621: else \
622: abort(); \
623: } else if (GET_CODE(XEXP(ADDR, 1)) == MEM) { \
624: register rtx a1 = XEXP(XEXP(ADDR, 1), 0); \
625: if (GET_CODE(a1) == REG && REGNO(a1) == FRAME_POINTER_REGNUM) \
626: ADDR = gen_rtx(PLUS, Pmode, \
627: XEXP(ADDR, 0), \
628: gen_rtx(MEM, Pmode, \
629: plus_constant(stack_pointer_rtx, \
630: offset))); \
631: else if (GET_CODE(a1) == PLUS && GET_CODE(XEXP(a1, 0)) == REG \
632: && REGNO(XEXP(a1, 0)) == FRAME_POINTER_REGNUM) \
633: ADDR = gen_rtx(PLUS, Pmode, \
634: XEXP(ADDR, 0), \
635: gen_rtx(MEM, Pmode, \
636: plus_constant(stack_pointer_rtx, \
637: offset+INTVAL(XEXP(a1, 1)))));\
638: else \
639: abort(); \
640: } else \
641: abort(); \
642: } else if (GET_CODE(ADDR) == MEM) { \
643: register rtx a0 = XEXP(ADDR, 0); \
644: if (GET_CODE (a0) == REG && REGNO (a0) == FRAME_POINTER_REGNUM) \
645: ADDR = gen_rtx(MEM, Pmode, \
646: plus_constant(stack_pointer_rtx, offset)); \
647: else if (GET_CODE(a0) == PLUS && GET_CODE(XEXP(a0, 0)) == REG \
648: && REGNO(XEXP(a0, 0)) == FRAME_POINTER_REGNUM \
649: && GET_CODE(XEXP(a0, 1)) == CONST_INT) \
650: ADDR = gen_rtx(MEM, Pmode, \
651: plus_constant(stack_pointer_rtx, \
652: offset + INTVAL(XEXP(a0, 1)))); \
653: else \
654: abort(); \
655: } else \
656: abort(); \
657: }
658: #endif
659:
660: /* Addressing modes, and classification of registers for them. */
661:
662: /* #define HAVE_POST_INCREMENT */
663: /* #define HAVE_POST_DECREMENT */
664:
665: /* #define HAVE_PRE_DECREMENT */
666: /* #define HAVE_PRE_INCREMENT */
667:
668: /* Macros to check register numbers against specific register classes. */
669:
670: /* These assume that REGNO is a hard or pseudo reg number.
671: They give nonzero only if REGNO is a hard reg of the suitable class
672: or a pseudo reg currently allocated to a suitable hard reg.
673: Since they use reg_renumber, they are safe only once reg_renumber
674: has been allocated, which happens in local-alloc.c. */
675:
676: /* note that FP and SP cannot be used as an index. What about PC? */
677: #define REGNO_OK_FOR_INDEX_P(REGNO) \
678: ((REGNO) < 8 || (unsigned)reg_renumber[REGNO] < 8)
679: #define REGNO_OK_FOR_BASE_P(REGNO) \
680: ((REGNO) < 8 || (unsigned)reg_renumber[REGNO] < 8 \
681: || (REGNO) == FRAME_POINTER_REGNUM || (REGNO) == STACK_POINTER_REGNUM)
682:
683: /* Maximum number of registers that can appear in a valid memory address. */
684:
685: #define MAX_REGS_PER_ADDRESS 2
686:
687: /* Recognize any constant value that is a valid address. */
688:
689: #define CONSTANT_ADDRESS_P(X) \
690: (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
691: || GET_CODE (X) == CONST \
692: || (GET_CODE (X) == CONST_INT \
693: && ((unsigned)INTVAL (X) >= 0xe0000000 \
694: || (unsigned)INTVAL (X) < 0x20000000)))
695:
696: #define CONSTANT_ADDRESS_NO_LABEL_P(X) \
697: (GET_CODE (X) == CONST_INT \
698: && ((unsigned)INTVAL (X) >= 0xe0000000 \
699: || (unsigned)INTVAL (X) < 0x20000000))
700:
701: /* Nonzero if the constant value X is a legitimate general operand.
702: It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
703:
704: #define LEGITIMATE_CONSTANT_P(X) 1
705:
706: /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
707: and check its validity for a certain class.
708: We have two alternate definitions for each of them.
709: The usual definition accepts all pseudo regs; the other rejects
710: them unless they have been allocated suitable hard regs.
711: The symbol REG_OK_STRICT causes the latter definition to be used.
712:
713: Most source files want to accept pseudo regs in the hope that
714: they will get allocated to the class that the insn wants them to be in.
715: Source files for reload pass need to be strict.
716: After reload, it makes no difference, since pseudo regs have
717: been eliminated by then. */
718:
719: #ifndef REG_OK_STRICT
720:
721: /* Nonzero if X is a hard reg that can be used as an index
722: or if it is a pseudo reg. */
723: #define REG_OK_FOR_INDEX_P(X) \
724: (REGNO (X) < 8 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
725: /* Nonzero if X is a hard reg that can be used as a base reg
726: of if it is a pseudo reg. */
727: #define REG_OK_FOR_BASE_P(X) (REGNO (X) < 8 || REGNO (X) >= FRAME_POINTER_REGNUM)
728: /* Nonzero if X is a floating point reg or a pseudo reg. */
729:
730: #else
731:
732: /* Nonzero if X is a hard reg that can be used as an index. */
733: #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
734: /* Nonzero if X is a hard reg that can be used as a base reg. */
735: #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
736:
737: #endif
738:
739: /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
740: that is a valid memory address for an instruction.
741: The MODE argument is the machine mode for the MEM expression
742: that wants to use this address.
743:
744: The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. */
745:
746: /* 1 if X is an address that we could indirect through. */
747: /***** NOTE ***** There is a bug in the Sequent assembler which fails
748: to fixup addressing information for symbols used as offsets
749: from registers which are not FP or SP (or SB or PC). This
750: makes _x(fp) valid, while _x(r0) is invalid. */
751:
752: #define INDIRECTABLE_1_ADDRESS_P(X) \
753: (CONSTANT_P (X) \
754: || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
755: || (GET_CODE (X) == PLUS \
756: && GET_CODE (XEXP (X, 0)) == REG \
757: && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
758: && CONSTANT_ADDRESS_P (XEXP (X, 1))))
759:
760: #define MEM_REG(X) \
761: ((GET_CODE (X) == REG && (REGNO (X) ^ 16) < 2) \
762: || (GET_CODE (X) == SYMBOL_REF))
763:
764: #define INDIRECTABLE_2_ADDRESS_P(X) \
765: (GET_CODE (X) == MEM \
766: && (((xfoo0 = XEXP (X, 0), MEM_REG (xfoo0)) \
767: || (GET_CODE (xfoo0) == PLUS \
768: && GET_CODE (XEXP (xfoo0, 0)) == REG \
769: && MEM_REG (XEXP (xfoo0, 0)) \
770: && CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfoo0, 1)))) \
771: || CONSTANT_ADDRESS_P (xfoo0)))
772:
773: #define INDIRECTABLE_ADDRESS_P(X) \
774: (INDIRECTABLE_1_ADDRESS_P(X) \
775: || INDIRECTABLE_2_ADDRESS_P (X) \
776: || (GET_CODE (X) == PLUS \
777: && CONSTANT_ADDRESS_NO_LABEL_P (XEXP (X, 1)) \
778: && INDIRECTABLE_2_ADDRESS_P (XEXP (X, 0))))
779:
780: /* Go to ADDR if X is a valid address not using indexing.
781: (This much is the easy part.) */
782: #define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
783: { register rtx xfoob = (X); \
784: if (GET_CODE (xfoob) == REG) goto ADDR; \
785: if (INDIRECTABLE_1_ADDRESS_P(X)) goto ADDR; \
786: if (INDIRECTABLE_2_ADDRESS_P (X)) goto ADDR; \
787: if (GET_CODE (X) == PLUS) \
788: if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (X, 1))) \
789: if (INDIRECTABLE_2_ADDRESS_P (XEXP (X, 0))) \
790: goto ADDR; \
791: }
792:
793: /* 1 if PROD is either a reg times size of mode MODE
794: or just a reg, if MODE is just one byte. Actually, on the ns32k,
795: since the index mode is independent of the operand size,
796: we can match more stuff...
797:
798: This macro's expansion uses the temporary variables xfoo0, xfoo1
799: and xfoo2 that must be declared in the surrounding context. */
800: #define INDEX_TERM_P(PROD, MODE) \
801: ((GET_CODE (PROD) == REG && REG_OK_FOR_INDEX_P (PROD)) \
802: || (GET_CODE (PROD) == MULT \
803: && (xfoo0 = XEXP (PROD, 0), xfoo1 = XEXP (PROD, 1), \
804: (GET_CODE (xfoo1) == CONST_INT \
805: && GET_CODE (xfoo0) == REG \
806: && FITS_INDEX_RANGE (INTVAL (xfoo1)) \
807: && REG_OK_FOR_INDEX_P (xfoo0)))))
808:
809: #define FITS_INDEX_RANGE(X) \
810: ((xfoo2 = (unsigned)(X)-1), \
811: ((xfoo2 < 4 && xfoo2 != 2) || xfoo2 == 7))
812:
813: #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
814: { register rtx xfooy, xfooz, xfoo0, xfoo1; \
815: unsigned xfoo2; \
816: xfooy = X; \
817: GO_IF_NONINDEXED_ADDRESS (xfooy, ADDR); \
818: if (GET_CODE (xfooy) == PLUS) \
819: { \
820: if (GET_CODE (XEXP (xfooy, 1)) == CONST_INT \
821: && GET_CODE (XEXP (xfooy, 0)) == PLUS) \
822: xfooy = XEXP (xfooy, 0); \
823: else if (GET_CODE (XEXP (xfooy, 0)) == CONST_INT \
824: && GET_CODE (XEXP (xfooy, 1)) == PLUS) \
825: xfooy = XEXP (xfooy, 1); \
826: xfooz = XEXP (xfooy, 1); \
827: if (INDEX_TERM_P (xfooz, MODE)) \
828: { rtx t = XEXP (xfooy, 0); GO_IF_NONINDEXED_ADDRESS (t, ADDR); }\
829: xfooz = XEXP (xfooy, 0); \
830: if (INDEX_TERM_P (xfooz, MODE)) \
831: { rtx t = XEXP (xfooy, 1); GO_IF_NONINDEXED_ADDRESS (t, ADDR); }\
832: } \
833: else if (INDEX_TERM_P (xfooy, MODE)) \
834: goto ADDR; \
835: else if (GET_CODE (xfooy) == PRE_DEC) \
836: if (REGNO (XEXP (xfooy, 0)) == STACK_POINTER_REGNUM) goto ADDR; \
837: else abort (); \
838: }
839:
840: /* Try machine-dependent ways of modifying an illegitimate address
841: to be legitimate. If we find one, return the new, valid address.
842: This macro is used in only one place: `memory_address' in explow.c.
843:
844: OLDX is the address as it was before break_out_memory_refs was called.
845: In some cases it is useful to look at this to decide what needs to be done.
846:
847: MODE and WIN are passed so that this macro can use
848: GO_IF_LEGITIMATE_ADDRESS.
849:
850: It is always safe for this macro to do nothing. It exists to recognize
851: opportunities to optimize the output.
852:
853: For the ns32k, we do nothing */
854:
855: #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
856:
857: /* Go to LABEL if ADDR (a legitimate address expression)
858: has an effect that depends on the machine mode it is used for.
859: On the ns32k, only predecrement and postincrement address depend thus
860: (the amount of decrement or increment being the length of the operand). */
861:
862: #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
863: { if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) \
864: goto LABEL;}
865:
866: /* Specify the machine mode that this machine uses
867: for the index in the tablejump instruction.
868: Can do SImode, but HI mode is more efficient. */
869: #define CASE_VECTOR_MODE HImode
870:
871: /* Define this if the tablejump instruction expects the table
872: to contain offsets from the address of the table.
873: Do not define this if the table should contain absolute addresses. */
874: #define CASE_VECTOR_PC_RELATIVE
875:
876: /* Specify the tree operation to be used to convert reals to integers. */
877: #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
878:
879: /* This is the kind of divide that is easiest to do in the general case. */
880: #define EASY_DIV_EXPR TRUNC_DIV_EXPR
881:
882: /* Define this as 1 if `char' should by default be signed; else as 0. */
883: #define DEFAULT_SIGNED_CHAR 1
884:
885: /* Max number of bytes we can move from memory to memory
886: in one reasonably fast instruction. */
887: #define MOVE_MAX 4
888:
889: /* Define this if zero-extension is slow (more than one real instruction). */
890: /* #define SLOW_ZERO_EXTEND */
891:
892: /* Nonzero if access to memory by bytes is slow and undesirable. */
893: #define SLOW_BYTE_ACCESS 0
894:
895: /* Define if shifts truncate the shift count
896: which implies one can omit a sign-extension or zero-extension
897: of a shift count. */
898: /* #define SHIFT_COUNT_TRUNCATED */
899:
900: /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
901: is done just by pretending it is already truncated. */
902: #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
903:
904: /* We assume that the store-condition-codes instructions store 0 for false
905: and some other value for true. This is the value stored for true. */
906:
907: #define STORE_FLAG_VALUE 1
908:
909: /* Specify the machine mode that pointers have.
910: After generation of rtl, the compiler makes no further distinction
911: between pointers and any other objects of this machine mode. */
912: #define Pmode SImode
913:
914: /* A function address in a call instruction
915: is a byte address (for indexing purposes)
916: so give the MEM rtx a byte's mode. */
917: #define FUNCTION_MODE QImode
918:
919: /* Compute the cost of computing a constant rtl expression RTX
920: whose rtx-code is CODE. The body of this macro is a portion
921: of a switch statement. If the code is computed here,
922: return it with a return statement. Otherwise, break from the switch. */
923:
924: #define CONST_COSTS(RTX,CODE) \
925: case CONST_INT: \
926: if (INTVAL (RTX) <= 7 && INTVAL (RTX) >= -8) return 0; \
927: if (INTVAL (RTX) < 0x4000 && INTVAL (RTX) >= -0x4000) \
928: return 1; \
929: case CONST: \
930: case LABEL_REF: \
931: case SYMBOL_REF: \
932: return 3; \
933: case CONST_DOUBLE: \
934: return 5;
935:
936: /* Tell final.c how to eliminate redundant test instructions. */
937:
938: /* Here we define machine-dependent flags and fields in cc_status
939: (see `conditions.h'). */
940:
941: /* This bit means that what ought to be in the Z bit
942: should be tested in the F bit. */
943: #define CC_Z_IN_F 04000
944:
945: /* This bit means that what ought to be in the Z bit
946: is complemented in the F bit. */
947: #define CC_Z_IN_NOT_F 010000
948:
949: /* Store in cc_status the expressions
950: that the condition codes will describe
951: after execution of an instruction whose pattern is EXP.
952: Do not alter them if the instruction would not alter the cc's. */
953:
954: #define NOTICE_UPDATE_CC(EXP, INSN) \
955: { if (GET_CODE (EXP) == SET) \
956: { if (GET_CODE (SET_DEST (EXP)) == CC0) \
957: { cc_status.flags = 0; \
958: cc_status.value1 = SET_DEST (EXP); \
959: cc_status.value2 = SET_SRC (EXP); \
960: } \
961: else if (GET_CODE (SET_SRC (EXP)) == CALL) \
962: { CC_STATUS_INIT; } \
963: else if (GET_CODE (SET_DEST (EXP)) == REG) \
964: { if (cc_status.value1 \
965: && reg_overlap_mentioned_p (SET_DEST (EXP), cc_status.value1)) \
966: cc_status.value1 = 0; \
967: if (cc_status.value2 \
968: && reg_overlap_mentioned_p (SET_DEST (EXP), cc_status.value2)) \
969: cc_status.value2 = 0; \
970: } \
971: else if (GET_CODE (SET_DEST (EXP)) == MEM) \
972: { CC_STATUS_INIT; } \
973: } \
974: else if (GET_CODE (EXP) == PARALLEL \
975: && GET_CODE (XVECEXP (EXP, 0, 0)) == SET) \
976: { if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == CC0) \
977: { cc_status.flags = 0; \
978: cc_status.value1 = SET_DEST (XVECEXP (EXP, 0, 0)); \
979: cc_status.value2 = SET_SRC (XVECEXP (EXP, 0, 0)); \
980: } \
981: else if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == REG) \
982: { if (cc_status.value1 \
983: && reg_overlap_mentioned_p (SET_DEST (XVECEXP (EXP, 0, 0)), cc_status.value1)) \
984: cc_status.value1 = 0; \
985: if (cc_status.value2 \
986: && reg_overlap_mentioned_p (SET_DEST (XVECEXP (EXP, 0, 0)), cc_status.value2)) \
987: cc_status.value2 = 0; \
988: } \
989: else if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == MEM) \
990: { CC_STATUS_INIT; } \
991: } \
992: else if (GET_CODE (EXP) == CALL) \
993: { /* all bets are off */ CC_STATUS_INIT; } \
994: else { /* nothing happens? CC_STATUS_INIT; */} \
995: if (cc_status.value1 && GET_CODE (cc_status.value1) == REG \
996: && cc_status.value2 \
997: && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2)) \
998: printf ("here!\n", cc_status.value2 = 0); \
999: }
1000:
1001: #define OUTPUT_JUMP(NORMAL, NO_OV) \
1002: { if (cc_status.flags & CC_NO_OVERFLOW) \
1003: return NO_OV; \
1004: return NORMAL; }
1005:
1006: /* Control the assembler format that we output. */
1007:
1008: /* Output at beginning of assembler file. */
1009:
1010: #define ASM_FILE_START(FILE) fprintf (FILE, "#NO_APP\n");
1011:
1012: /* Output to assembler file text saying following lines
1013: may contain character constants, extra white space, comments, etc. */
1014:
1015: #define ASM_APP_ON "#APP\n"
1016:
1017: /* Output to assembler file text saying following lines
1018: no longer contain unusual constructs. */
1019:
1020: #define ASM_APP_OFF "#NO_APP\n"
1021:
1022: /* Output before read-only data. */
1023:
1024: #define TEXT_SECTION_ASM_OP ".text"
1025:
1026: /* Output before writable data. */
1027:
1028: #define DATA_SECTION_ASM_OP ".data"
1029:
1030: /* How to refer to registers in assembler output.
1031: This sequence is indexed by compiler's hard-register-number (see above). */
1032:
1033: #define REGISTER_NAMES \
1034: {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
1035: "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
1036: "fp", "sp"}
1037:
1038: /* How to renumber registers for dbx and gdb.
1039: NS32000 may need more change in the numeration. */
1040:
1041: #define DBX_REGISTER_NUMBER(REGNO) ((REGNO < 8) ? (REGNO)+4 : (REGNO))
1042:
1043: /* This is how to output the definition of a user-level label named NAME,
1044: such as the label on a static function or variable NAME. */
1045:
1046: #define ASM_OUTPUT_LABEL(FILE,NAME) \
1047: do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1048:
1049: /* This is how to output a command to make the user-level label named NAME
1050: defined for reference from other files. */
1051:
1052: #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
1053: do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
1054:
1055: /* This is how to output a reference to a user-level label named NAME.
1056: `assemble_name' uses this. */
1057:
1058: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
1059: fprintf (FILE, "_%s", NAME)
1060:
1061: /* This is how to output an internal numbered label where
1062: PREFIX is the class of label and NUM is the number within the class. */
1063:
1064: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1065: fprintf (FILE, "%s%d:\n", PREFIX, NUM)
1066:
1067: /* This is how to store into the string LABEL
1068: the symbol_ref name of an internal numbered label where
1069: PREFIX is the class of label and NUM is the number within the class.
1070: This is suitable for output with `assemble_name'. */
1071:
1072: #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1073: sprintf (LABEL, "*%s%d", PREFIX, NUM)
1074:
1075: /* This is how to align the code that follows an unconditional branch. */
1076:
1077: #define ASM_OUTPUT_ALIGN_CODE(FILE) \
1078: fprintf (FILE, "\t.align 4\n")
1079:
1080: /* This is how to output an assembler line defining a `double' constant. */
1081:
1082: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
1083: fprintf (FILE, "\t.double 0d%.20e\n", (VALUE))
1084:
1085: /* This is how to output an assembler line defining a `float' constant. */
1086:
1087: #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
1088: fprintf (FILE, "\t.float 0f%.20e\n", (VALUE))
1089:
1090: /* This is how to output an assembler line defining an `int' constant. */
1091:
1092: #define ASM_OUTPUT_INT(FILE,VALUE) \
1093: ( fprintf (FILE, "\t.long "), \
1094: output_addr_const (FILE, (VALUE)), \
1095: fprintf (FILE, "\n"))
1096:
1097: /* Likewise for `char' and `short' constants. */
1098:
1099: #define ASM_OUTPUT_SHORT(FILE,VALUE) \
1100: ( fprintf (FILE, "\t.word "), \
1101: output_addr_const (FILE, (VALUE)), \
1102: fprintf (FILE, "\n"))
1103:
1104: #define ASM_OUTPUT_CHAR(FILE,VALUE) \
1105: ( fprintf (FILE, "\t.byte "), \
1106: output_addr_const (FILE, (VALUE)), \
1107: fprintf (FILE, "\n"))
1108:
1109: /* This is how to output an assembler line for a numeric constant byte. */
1110:
1111: #define ASM_OUTPUT_BYTE(FILE,VALUE) \
1112: fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1113:
1114: /* This is how to output an insn to push a register on the stack.
1115: It need not be very fast code. */
1116:
1117: #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1118: fprintf (FILE, "\tmovd %s,tos\n", reg_names[REGNO])
1119:
1120: /* This is how to output an insn to pop a register from the stack.
1121: It need not be very fast code. */
1122:
1123: #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1124: fprintf (FILE, "\tmovd tos,%s\n", reg_names[REGNO])
1125:
1126: /* This is how to output an element of a case-vector that is absolute.
1127: (The 68000 does not use such vectors,
1128: but we must define this macro anyway.) */
1129:
1130: #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1131: fprintf (FILE, "\t.long L%d\n", VALUE)
1132:
1133: /* This is how to output an element of a case-vector that is relative. */
1134: /* ** Notice that the second element is LI format! */
1135: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
1136: fprintf (FILE, "\t.word L%d-LI%d\n", VALUE, REL)
1137:
1138: /* This is how to output an assembler line
1139: that says to advance the location counter
1140: to a multiple of 2**LOG bytes. */
1141:
1142: #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1143: fprintf (FILE, "\t.align %d\n", (LOG))
1144:
1145: #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1.1.1.2 ! root 1146: fprintf (FILE, "\t.space %u\n", (SIZE))
1.1 root 1147:
1148: /* This says how to output an assembler line
1149: to define a global common symbol. */
1150:
1151: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1152: ( fputs (".comm ", (FILE)), \
1153: assemble_name ((FILE), (NAME)), \
1.1.1.2 ! root 1154: fprintf ((FILE), ",%u\n", (ROUNDED)))
1.1 root 1155:
1156: /* This says how to output an assembler line
1157: to define a local common symbol. */
1158:
1159: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
1160: ( fputs (".lcomm ", (FILE)), \
1161: assemble_name ((FILE), (NAME)), \
1.1.1.2 ! root 1162: fprintf ((FILE), ",%u\n", (ROUNDED)))
1.1 root 1163:
1164: /* Store in OUTPUT a string (made with alloca) containing
1165: an assembler-name for a local static variable named NAME.
1166: LABELNO is an integer which is different for each call. */
1167:
1168: #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1169: ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1170: sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1171:
1172: /* Define the parentheses used to group arithmetic operations
1173: in assembler code. */
1174:
1175: #define ASM_OPEN_PAREN "("
1176: #define ASM_CLOSE_PAREN ")"
1177:
1178: /* Define results of standard character escape sequences. */
1179: #define TARGET_BELL 007
1180: #define TARGET_BS 010
1181: #define TARGET_TAB 011
1182: #define TARGET_NEWLINE 012
1183: #define TARGET_VT 013
1184: #define TARGET_FF 014
1185: #define TARGET_CR 015
1186:
1187: /* Print an instruction operand X on file FILE.
1188: CODE is the code from the %-spec that requested printing this operand;
1189: if `%z3' was used to print operand 3, then CODE is 'z'. */
1190:
1191: /* %$ means print the prefix for an immediate operand. */
1192:
1193: #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1194: ((CODE) == '$' || (CODE) == '?')
1195:
1196: #define PRINT_OPERAND(FILE, X, CODE) \
1197: { if (CODE == '$') fprintf (FILE, "$"); \
1198: else if (CODE == '?'); \
1199: else if (GET_CODE (X) == REG) \
1200: fprintf (FILE, "%s", reg_names[REGNO (X)]); \
1201: else if (GET_CODE (X) == MEM) \
1202: output_address (XEXP (X, 0)); \
1203: else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != DImode) \
1204: if (GET_MODE (X) == DFmode) \
1205: { union { double d; int i[2]; } u; \
1206: u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
1207: fprintf (FILE, "$0d%.20e", u.d); } \
1208: else \
1209: { union { double d; int i[2]; } u; \
1210: u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
1211: fprintf (FILE, "$0f%.20e", u.d); } \
1212: else { putc ('$', FILE); output_addr_const (FILE, X); }}
1213:
1214: /* Print a memory operand whose address is X, on file FILE. */
1215:
1216: #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1217: { register rtx reg1, reg2, breg, ireg; \
1218: register rtx addr = ADDR; \
1219: rtx offset; \
1220: int mem=0, multval, offset_printed; \
1221: char reg1_str[256], reg2_str[256]; \
1222: retry: \
1223: switch (GET_CODE (addr)) \
1224: { \
1225: case MEM: \
1226: fprintf (FILE, "0("); \
1227: addr = XEXP (addr, 0); \
1228: mem =1; \
1229: goto retry; \
1230: case REG: \
1231: fprintf (FILE, "0(%s)", reg_names[REGNO (addr)]); \
1232: break; \
1233: case PRE_DEC: \
1234: if (REGNO(XEXP(addr, 0)) != STACK_POINTER_REGNUM) \
1235: fprintf(FILE, ")1:%d", REGNO(XEXP(addr,0))); \
1236: else fprintf (FILE, "tos", reg_names[REGNO (XEXP (addr, 0))]); \
1237: break; \
1238: case POST_INC: \
1239: if (REGNO(XEXP(addr, 0)) != STACK_POINTER_REGNUM) \
1240: fprintf(FILE, ")2:%d", REGNO(XEXP(addr,0))); \
1241: else fprintf (FILE, "tos", reg_names[REGNO (XEXP (addr, 0))]); \
1242: break; \
1243: case MULT: \
1244: reg1 = XEXP (addr, 0); /* [rX:Y] */ \
1245: reg2 = XEXP (addr, 1); /* CONST/REG */ \
1246: if (GET_CODE (reg1) == CONST_INT && GET_CODE(reg2) == REG) { \
1247: reg1 = reg2; \
1248: reg2 = XEXP (addr, 0); /* [rX:Y] */ \
1249: } else \
1250: if (GET_CODE (reg2) != CONST_INT || \
1251: GET_CODE (reg1) != REG) { \
1252: abort(); \
1253: } \
1254: fprintf (FILE, "0[%s:%c]", \
1255: reg_names[ REGNO(reg1) ], \
1256: "XbwXdXXXq"[INTVAL (reg2)]); \
1257: break; \
1258: case PLUS: \
1259: reg1 = 0; reg2 = 0; \
1260: ireg = 0; breg = 0; \
1261: offset = 0; \
1262: multval = 0; \
1263: reg1_str[0] = 0; reg2_str[0] = 0; \
1264: offset_printed = 0; \
1265: if (CONSTANT_ADDRESS_P (XEXP (addr, 0)) \
1266: || GET_CODE (XEXP (addr, 0)) == MEM) \
1267: { \
1268: /* CONST / MEM(PLUS((REG)(CONST))) */ \
1269: offset = XEXP (addr, 0); \
1270: /* (REG) / PLUS((REG)(CONST)) / MULT((REG)(CONST)) */ \
1271: addr = XEXP (addr, 1); \
1272: } \
1273: else if (CONSTANT_ADDRESS_P (XEXP (addr, 1)) \
1274: || GET_CODE (XEXP (addr, 1)) == MEM) \
1275: { \
1276: /* CONST / MEM(PLUS((REG)(CONST))) */ \
1277: offset = XEXP (addr, 1); \
1278: /* (REG) / PLUS((REG)(CONST)) / MULT((REG)(CONST)) */ \
1279: addr = XEXP (addr, 0); \
1280: } \
1281: if (offset != 0) { \
1282: if (GET_CODE (offset) == MEM) { \
1283: offset = XEXP (offset, 0); /* skip MEM */ \
1284: switch (GET_CODE (offset)) { \
1285: case REG: \
1286: sprintf (reg1_str, "(%s)", \
1287: reg_names[REGNO (offset)]); \
1288: offset = 0; \
1289: break; \
1290: case PLUS: \
1291: if (!CONSTANT_ADDRESS_P (XEXP (offset, 1))) { \
1292: fprintf (FILE, \
1293: "PROGRAM in disorder PRINT_ADDR, PLUS, PLUS\n"); \
1294: print_rtl(FILE, offset); \
1295: exit (1); \
1296: } \
1297: if (GET_CODE (XEXP(offset,0)) != REG) { \
1298: fprintf (FILE, \
1299: "PROGRAM in disorder PRINT_ADDR, PLUS, REG\n"); \
1300: print_rtl(FILE, offset); \
1301: exit (1); \
1302: } \
1303: sprintf (reg1_str, "(%s))", \
1304: reg_names[REGNO (XEXP(offset,0))]); \
1305: offset = XEXP (offset, 1); \
1306: break; \
1307: default: \
1308: abort(); \
1309: } \
1310: } else { /* !MEM */ \
1311: if (!CONSTANT_ADDRESS_P (offset)) { \
1312: abort(); \
1313: } \
1314: output_addr_const (FILE, offset); \
1315: offset_printed = 1; \
1316: offset = 0; \
1317: } \
1318: } \
1319: \
1320: if (GET_CODE (addr) == PLUS) { \
1321: if (GET_CODE (XEXP (addr, 0)) == MULT) \
1322: { \
1323: reg1 = XEXP (addr, 0); /* [rX:Y] */ \
1324: addr = XEXP (addr, 1); /* CONST/REG */ \
1325: if (GET_CODE (XEXP (reg1, 1)) != CONST_INT || \
1326: GET_CODE (XEXP (reg1, 0)) != REG) { \
1327: abort(); \
1328: } \
1329: sprintf (reg2_str, "[%s:%c]", \
1330: reg_names[ REGNO(XEXP (reg1, 0)) ], \
1331: "XbwXdXXXq"[INTVAL (XEXP (reg1, 1))]); \
1332: reg1 = 0; \
1333: } \
1334: else if (GET_CODE (XEXP (addr, 1)) == MULT) \
1335: { \
1336: reg1 = XEXP (addr, 1); /* [rX:Y] */ \
1337: addr = XEXP (addr, 0); /* CONST */ \
1338: if (GET_CODE (XEXP (reg1, 1)) != CONST_INT || \
1339: GET_CODE (XEXP (reg1, 0)) != REG) { \
1340: abort(); \
1341: } \
1342: sprintf (reg2_str, "[%s:%c]", \
1343: reg_names[ REGNO(XEXP (reg1, 0)) ], \
1344: "XbwXdXXXq"[INTVAL (XEXP (reg1, 1))]); \
1345: reg1 = 0; \
1346: } \
1347: else if (GET_CODE (XEXP (addr, 0)) == REG \
1348: && REGNO (XEXP (addr, 0)) < 8) \
1349: { \
1350: sprintf (reg2_str, "[%s:b]", \
1351: reg_names[ REGNO(XEXP (addr, 0)) ]); \
1352: addr = XEXP (addr, 1); /* CONST / REG */ \
1353: } \
1354: else if (GET_CODE (XEXP (addr, 1)) == REG \
1355: && REGNO (XEXP (addr, 1)) < 8) \
1356: { \
1357: sprintf (reg2_str, "[%s:b]", \
1358: reg_names[ REGNO(XEXP (addr, 1)) ]); \
1359: addr = XEXP (addr, 0); /* CONST / REG */ \
1360: } \
1361: else abort (); \
1362: } \
1363: if (addr) \
1364: switch (GET_CODE (addr)) { \
1365: case MULT: \
1366: if(*reg2_str) { \
1367: fprintf (FILE, \
1368: "PROGRAM in disorder PRINT_ADDR, INDEX, two mults\n"); \
1369: print_rtl(FILE, addr); \
1370: exit (1); \
1371: } \
1372: reg1 = XEXP (addr, 0); /* [rX:Y] */ \
1373: addr = XEXP (addr, 1); /* CONST */ \
1374: if (GET_CODE (addr) != CONST_INT) { \
1375: fprintf (FILE, \
1376: "PROGRAM in disorder PRINT_ADDR, INDEX, !CONS3 (%d)\n", \
1377: GET_CODE (addr)); \
1378: print_rtl(FILE, addr); \
1379: exit (1); \
1380: } \
1381: sprintf (reg2_str, "[%s:%c]", reg_names[ REGNO(reg1) ], \
1382: "XbwXdXXXq"[INTVAL (addr)]); \
1383: break; \
1384: case REG: \
1385: if (!*reg1_str) { \
1386: if (offset || offset_printed) \
1387: sprintf (reg1_str, "(%s)", reg_names[REGNO (addr)]); \
1388: else \
1389: sprintf (reg1_str, "0(%s)", reg_names[REGNO (addr)]); \
1390: } else if (!*reg2_str) \
1391: sprintf (reg2_str, "[%s:b]", \
1392: reg_names[REGNO (addr)]); \
1393: else abort(); \
1394: break; \
1395: case MEM: \
1396: addr = XEXP(addr,0); \
1397: switch (GET_CODE(addr)) { \
1398: case REG: \
1399: if (!*reg1_str) { \
1400: if (offset || offset_printed) \
1401: sprintf (reg1_str, "(0(%s))", \
1402: reg_names[REGNO (addr)]); \
1403: else \
1404: sprintf (reg1_str, "0(0(%s))", \
1405: reg_names[REGNO (addr)]); \
1406: } else \
1407: abort(); \
1408: break; \
1409: case PLUS: \
1410: if (GET_CODE (XEXP (addr, 0)) == REG) { \
1411: if (!*reg1_str) { \
1412: sprintf (reg1_str, "(%s))", \
1413: reg_names[REGNO(XEXP(addr, 0))]); \
1414: offset = XEXP(addr, 1); \
1415: } else \
1416: abort(); \
1417: } else { \
1418: if (!*reg1_str) { \
1419: sprintf (reg1_str, "(%s))", \
1420: reg_names[REGNO(XEXP(addr, 1))]); \
1421: offset = XEXP(addr, 0); \
1422: } else \
1423: abort(); \
1424: } \
1425: break; \
1426: default: \
1427: abort(); \
1428: } \
1429: break; \
1430: default: \
1431: if (offset_printed) \
1432: fprintf (FILE, "+"); \
1433: output_addr_const (FILE, addr); \
1434: offset_printed ++; \
1435: } \
1436: if (offset) { \
1437: if(!offset_printed) \
1438: fputc ('0', FILE); \
1439: fputc ('(', FILE); \
1440: output_addr_const (FILE, offset); \
1441: } \
1442: if (*reg1_str) \
1443: fprintf (FILE, "%s", reg1_str); \
1444: if (*reg2_str) \
1445: fprintf (FILE, "%s", reg2_str); \
1446: break; \
1447: default: \
1448: output_addr_const (FILE, addr); \
1449: } \
1450: if(mem) \
1451: fprintf(FILE,")");}
1452:
1453: /*
1454: Local variables:
1455: version-control: t
1456: End:
1457: */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.