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