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