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