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