* config/xtensa/xtensa.c (xtensa_va_arg): Handle variable-sized types.
[official-gcc.git] / gcc / config / 1750a / 1750a.h
blobce61f65670f59f086565c2f7eb8d8f4b2ae2abaa
1 /* Definitions of target machine for GNU compiler.
2 Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001, 2002 Free Software Foundation, Inc.
4 Contributed by O.M.Kellogg, DASA (oliver.kellogg@space.otn.dasa.de)
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
24 /* Names to predefine in the preprocessor for this target machine. */
26 /* See tm-sun3.h, tm-sun2.h, tm-isi68.h for different CPP_PREDEFINES. */
27 #define CPP_PREDEFINES ""
29 /* Print subsidiary information on the compiler version in use. */
30 #ifdef IEEE
31 #define TARGET_VERSION fprintf (stderr, " (1750A, IEEE syntax)");
32 #else
33 #define TARGET_VERSION fprintf (stderr, " (MIL-STD-1750A)");
34 #endif
36 /* Run-time compilation parameters selecting different hardware subsets. */
38 #define TARGET_SWITCHES \
39 { {"vaxc-alignment", 2, N_("Use VAX-C alignment")}, \
40 { "", TARGET_DEFAULT, NULL}}
42 /* Default target_flags if no switches specified. */
44 #ifndef TARGET_DEFAULT
45 #define TARGET_DEFAULT 1
46 #endif
48 /*****************************************************************************/
50 /* SPECIAL ADDITION FOR MIL-STD-1750A by O.M.Kellogg, 15-Apr-1993 */
51 /* See file aux-output.c for the actual data instances. */
52 struct datalabel_array {
53 char *name;
54 char value[14];
55 int size;
57 struct jumplabel_array {
58 int pc;
59 int num;
61 enum section { Init, Normal, Konst, Static };
62 #define DATALBL_ARRSIZ 256
63 #define JMPLBL_ARRSIZ 256
64 #ifndef __datalbl
65 extern struct datalabel_array datalbl[DATALBL_ARRSIZ];
66 extern struct jumplabel_array jmplbl[JMPLBL_ARRSIZ];
67 extern int datalbl_ndx, jmplbl_ndx, label_pending, program_counter;
68 extern enum section current_section;
69 extern const char *const sectname[4];
70 #endif
71 /*--------------------------------------------------------------------*/
73 /* target machine storage layout */
75 /* Define this if most significant bit is lowest numbered
76 in instructions that operate on numbered bit-fields.
77 Though 1750 actually counts bits in big-endian fashion, the sign bit
78 is still the most significant bit, which is leftmost. Therefore leaving
79 this little-endian. Adjust short before assembler output when needed:
80 e.g. in QImode, a GCC bit n is a 1750 bit (15-n). */
81 #define BITS_BIG_ENDIAN 0
83 /* Define this if most significant byte of a word is the lowest numbered. */
84 /* For 1750 we can decide arbitrarily
85 since there are no machine instructions for them. */
86 #define BYTES_BIG_ENDIAN 0
88 /* Define this if most significant word of a multiword value is lowest
89 numbered.
90 True for 1750. */
91 #define WORDS_BIG_ENDIAN 1
93 /* number of bits in an addressable storage unit */
94 #define BITS_PER_UNIT 16
96 /* Width of a word, in units (bytes). */
97 #define UNITS_PER_WORD 1
99 #define PTRDIFF_TYPE "int"
101 /* Type to use for `size_t'. If undefined, uses `long unsigned int'. */
102 #define SIZE_TYPE "int"
104 /* 1750a preliminary. Ought to properly define the format in real.c. */
105 #define TARGET_FLOAT_FORMAT UNKNOWN_FLOAT_FORMAT
107 /* Allocation boundary (in *bits*) for storing pointers in memory. */
108 #define POINTER_BOUNDARY 16
110 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
111 /* 1750: should have had to make this 32 when BITS_PER_WORD is 32. */
112 #define PARM_BOUNDARY 16
114 /* Boundary (in *bits*) on which stack pointer should be aligned. */
115 #define STACK_BOUNDARY 16
117 /* Allocation boundary (in *bits*) for the code of a function. */
118 #define FUNCTION_BOUNDARY 16
120 /* Alignment of field after `int : 0' in a structure. */
121 #define EMPTY_FIELD_BOUNDARY 16
123 /* No data type wants to be aligned rounder than this. */
124 #define BIGGEST_ALIGNMENT 16
126 /* Define this to 1 if move instructions will actually fail to work
127 when given unaligned data. */
128 #define STRICT_ALIGNMENT 0
130 /* Define number of bits in most basic integer type.
131 (If undefined, default is BITS_PER_WORD).
132 #define INT_TYPE_SIZE 16 */
134 /* Define number of bits in short integer type.
135 (If undefined, default is half of BITS_PER_WORD). */
136 #define SHORT_TYPE_SIZE 16
138 /* Define number of bits in long integer type.
139 (If undefined, default is BITS_PER_WORD). */
140 #define LONG_TYPE_SIZE 32
142 /* Define number of bits in long long integer type.
143 (If undefined, default is twice BITS_PER_WORD). */
144 /* 1750 PRELIMINARY : no processor support for `long long', therefore
145 need to check out the long-long opencodings ! */
146 #define LONG_LONG_TYPE_SIZE 64
148 /* Define number of bits in float type.
149 (If undefined, default is BITS_PER_WORD). */
150 #define FLOAT_TYPE_SIZE 32
152 /* Define number of bits in double type.
153 (If undefined, default is twice BITS_PER_WORD). */
154 #define DOUBLE_TYPE_SIZE 48
156 /*****************************************************************************/
158 /* Standard register usage. */
160 /* Number of actual hardware registers.
161 The hardware registers are assigned numbers for the compiler
162 from 0 to just below FIRST_PSEUDO_REGISTER.
163 All registers that the compiler knows about must be given numbers,
164 even those that are not normally considered general registers. */
165 #define FIRST_PSEUDO_REGISTER 16
167 /* 1 for registers that have pervasive standard uses
168 and are not available for the register allocator.
169 R15 is the 1750A stack pointer. R14 is the frame pointer. */
171 #define FIXED_REGISTERS \
172 { 0, 0, 0, 0, 0, 0, 0, 0, \
173 0, 0, 0, 0, 0, 0, 1, 1 }
175 /* 1 for registers not available across function calls.
176 These must include the FIXED_REGISTERS and also any
177 registers that can be used without being saved.
178 The latter must include the registers where values are returned
179 and the register where structure-value addresses are passed.
180 Aside from that, you can include as many other registers as you like.
181 1750: return value in R0 foll. (depending on size of retval).
182 Should be possible to refine this (how many regs are actually used) */
184 #define CALL_USED_REGISTERS \
185 { 1, 1, 1, 1, 1, 1, 1, 1, \
186 1, 1, 1, 1, 1, 1, 1, 1 }
188 /* Order in which to allocate registers. Each register must be
189 listed once, even those in FIXED_REGISTERS. List frame pointer
190 late and fixed registers last. Note that, in general, we prefer
191 registers listed in CALL_USED_REGISTERS, keeping the others
192 available for storage of persistent values. */
194 /* #define REG_ALLOC_ORDER \
195 { 2, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
198 /* Return number of consecutive hard regs needed starting at reg REGNO
199 to hold something of mode MODE.
200 This is ordinarily the length in words of a value of mode MODE
201 but can be less for certain modes in special long registers.
202 All 1750 registers are one word long. */
203 #define HARD_REGNO_NREGS(REGNO, MODE) \
204 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
206 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
207 #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
209 /* Value is 1 if it is a good idea to tie two pseudo registers
210 when one has mode MODE1 and one has mode MODE2.
211 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
212 for any hard reg, then this must be 0 for correct output. */
213 #define MODES_TIEABLE_P(MODE1, MODE2) 1
215 /* Specify the registers used for certain standard purposes.
216 The values of these macros are register numbers. */
218 /* 1750A pc isn't overloaded on a register. */
219 /* #define PC_REGNUM */
221 /* Register to use for pushing function arguments. */
222 #define STACK_POINTER_REGNUM 15
224 /* Base register for access to local variables of the function. */
225 #define FRAME_POINTER_REGNUM 14
227 /* Value should be nonzero if functions must have frame pointers.
228 Zero means the frame pointer need not be set up (and parms
229 may be accessed via the stack pointer) in functions that seem suitable.
230 This is computed in `reload', in reload1.c. */
231 #define FRAME_POINTER_REQUIRED 0
233 /* Base register for access to arguments of the function. */
234 #define ARG_POINTER_REGNUM 14
236 /* Define this if successive args to a function occupy decreasing addresses
237 on the stack.
238 #define ARGS_GROW_DOWNWARD
241 /* Register in which static-chain is passed to a function. */
242 #define STATIC_CHAIN_REGNUM 13
244 /* Place in which caller passes the structure value address.
245 0 means push the value on the stack like an argument.
246 #define STRUCT_VALUE 0
249 /* Register in which address to store a structure value
250 arrives in the function.
251 #define STRUCT_VALUE_INCOMING 0
254 /* Register in which address to store a structure value
255 is passed to a function. */
256 #define STRUCT_VALUE_REGNUM 12
258 /* Define this to be 1 if all structure return values must be in memory. */
259 #define DEFAULT_PCC_STRUCT_RETURN 0
261 /*****************************************************************************/
263 /* Define the classes of registers for register constraints in the
264 machine description. Also define ranges of constants.
266 One of the classes must always be named ALL_REGS and include all hard regs.
267 If there is more than one class, another class must be named NO_REGS
268 and contain no registers.
270 The name GENERAL_REGS must be the name of a class (or an alias for
271 another name such as ALL_REGS). This is the class of registers
272 that is allowed by "g" or "r" in a register constraint.
273 Also, registers outside this class are allocated only when
274 instructions express preferences for them.
276 The classes must be numbered in nondecreasing order; that is,
277 a larger-numbered class must never be contained completely
278 in a smaller-numbered class.
280 For any two classes, it is very desirable that there be another
281 class that represents their union. */
283 /* 1750 note: The names (BASE_REGS/INDEX_REGS) are used in their *gcc sense*
284 (i.e. *opposite* to the MIL-STD-1750A defined meanings). This means that
285 R1..R15 are called "base" regs and R12..R15 are "index" regs.
286 Index reg mode (in the gcc sense) is not yet implemented (these are the
287 1750 "Base with Index Reg" instructions, LBX etc. See 1750.md)
289 Here's an example to drive this point home: in "LBX B12,R5"
290 B12 shall be called the "index" reg and R5 shall be the "base" reg.
291 This naming inversion is due to the GCC defined capabilities of
292 "Base" vs. "Index" regs. */
294 enum reg_class { NO_REGS, R2, R0_1, INDEX_REGS, BASE_REGS, ALL_REGS, LIM_REG_CLASSES };
296 #define N_REG_CLASSES (int) LIM_REG_CLASSES
298 /* Since GENERAL_REGS is the same class as ALL_REGS,
299 don't give it a different class number; just make it an alias. */
300 #define GENERAL_REGS ALL_REGS
302 /* Give names of register classes as strings for dump file. */
304 #define REG_CLASS_NAMES \
305 { "NO_REGS", "R2", "R0_1", "INDEX_REGS", "BASE_REGS", "ALL_REGS" }
307 /* Define which registers fit in which classes.
308 This is an initializer for a vector of HARD_REG_SET
309 of length N_REG_CLASSES.
310 1750 "index" (remember, in the *GCC* sense!) regs are R12 through R15.
311 The only 1750 register not usable as BASE_REG is R0. */
313 #define REG_CLASS_CONTENTS { {0}, {0x0004}, {0x0003}, {0xf000}, {0xfffe}, {0xffff} }
315 /* The same information, inverted:
316 Return the class number of the smallest class containing
317 reg number REGNO. This could be a conditional expression
318 or could index an array. */
319 #define REGNO_REG_CLASS(REGNO) ((REGNO) == 2 ? R2 : (REGNO) == 0 ? R0_1 : \
320 (REGNO) >= 12 ? INDEX_REGS : (REGNO) > 0 ? BASE_REGS : ALL_REGS)
322 /* The class value for index registers, and the one for base regs. */
324 #define BASE_REG_CLASS BASE_REGS
325 #define INDEX_REG_CLASS INDEX_REGS
327 /* Get reg_class from a letter such as appears in the machine description.
328 For the 1750, we have 'z' for R0_1, 't' for R2, 'b' for gcc Base regs
329 and 'x' for gcc Index regs. */
331 #define REG_CLASS_FROM_LETTER(C) ((C) == 't' ? R2 : \
332 (C) == 'z' ? R0_1 : \
333 (C) == 'b' ? BASE_REGS : \
334 (C) == 'x' ? INDEX_REGS : NO_REGS)
336 /* The letters I,J,K,.. to P in a register constraint string
337 can be used to stand for particular ranges of immediate operands.
338 This macro defines what the ranges are.
339 C is the letter, and VALUE is a constant value.
340 Return 1 if VALUE is in the range specified by C.
342 For the 1750A,
343 `I' is used for ISP mode instructions,
344 `J' is used for ISN mode instructions,
345 `K' is used for the STC instruction's constant range,
346 `L' is used for unsigned 8-bit address displacements in instructions
347 of addressing mode "Base Relative",
348 `M' is for IM mode instructions et al.,
349 `O' is a synonym for (const_int 0). */
351 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
352 ((C) == 'I' ? (VALUE) > 0 && (VALUE) <= 16 : \
353 (C) == 'J' ? (VALUE) < 0 && (VALUE) >= -16 : \
354 (C) == 'K' ? (VALUE) >= 0 && (VALUE) <= 15 : \
355 (C) == 'L' ? (VALUE) >= 0 && (VALUE) <= 0xFF : \
356 (C) == 'M' ? (VALUE) >= -0x8000 && (VALUE) <= 0x7FFF : \
357 (C) == 'O' ? (VALUE) == 0 : 0)
359 /* Similar, but for floating constants, and defining letter 'G'.
360 Here VALUE is the CONST_DOUBLE rtx itself. */
361 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
362 ((C) == 'G' ? ((VALUE) == CONST0_RTX (HFmode) \
363 || (VALUE) == CONST0_RTX (TQFmode)) : 0)
365 /* Optional extra constraints for this machine.
367 For the 1750, `Q' means that this is a memory operand consisting
368 of the sum of an Index Register (in the GCC sense, i.e. R12..R15)
369 and a constant in the range 0..255. This constraint is used for
370 the Base Register with Offset address mode instructions (LB,STB,AB,..) */
372 #define EXTRA_CONSTRAINT(OP, C) \
373 ((C) == 'Q' && b_mode_operand (OP))
375 /* Given an rtx X being reloaded into a reg required to be
376 in class CLASS, return the class of reg to actually use.
377 In general this is just CLASS; but on some machines
378 in some cases it is preferable to use a more restrictive class. */
380 #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
382 /* Return the maximum number of consecutive registers
383 needed to represent mode MODE in a register of class CLASS.
384 On the 1750A, this is the size of MODE in words,
385 since class doesn't make any difference. */
386 #define CLASS_MAX_NREGS(CLASS,MODE) GET_MODE_SIZE(MODE)
388 /*****************************************************************************/
390 /* Stack layout; function entry, exit and calling. */
392 /* Define this if pushing a word on the stack
393 makes the stack pointer a smaller address. */
394 #define STACK_GROWS_DOWNWARD 1
396 /* Define this if the nominal address of the stack frame
397 is at the high-address end of the local variables;
398 goes at a more negative offset in the frame.
399 #define FRAME_GROWS_DOWNWARD
402 /* Offset within stack frame to start allocating local variables at.
403 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
404 first local allocated. Otherwise, it is the offset to the BEGINNING
405 of the first local allocated.
407 #define STARTING_FRAME_OFFSET 1
409 /* This is the default anyway:
410 #define DYNAMIC_CHAIN_ADDRESS(FRAMEADDR) FRAMEADDR
413 /* If we generate an insn to push BYTES bytes,
414 this says how many the stack pointer really advances by.
415 1750 note: what GCC calls a "byte" is really a 16-bit word,
416 because BITS_PER_UNIT is 16. */
418 #define PUSH_ROUNDING(BYTES) (BYTES)
420 /* Define this macro if functions should assume that stack space has
421 been allocated for arguments even when their values are passed in
422 registers.
423 Size, in bytes, of the area reserved for arguments passed in
424 registers for the function represented by FNDECL.
425 #define REG_PARM_STACK_SPACE(FNDECL) 14 */
427 /* Define this if it is the responsibility of the caller to allocate
428 the area reserved for arguments passed in registers.
429 #define OUTGOING_REG_PARM_STACK_SPACE */
431 /* Offset of first parameter from the argument pointer register value.
432 1750 note:
433 Parameters appear in reversed order on the frame (so when they are
434 popped, they come off in the normal left-to-right order.)
435 Computed as follows:
436 one word for the caller's (PC+1) (i.e. the return address)
437 plus total size of called function's "auto" variables
438 plus one word for the caller's frame pointer (i.e. the old FP) */
440 #define FIRST_PARM_OFFSET(FNDECL) \
441 (1 + get_frame_size() + 1)
443 /* Value is 1 if returning from a function call automatically
444 pops the arguments described by the number-of-args field in the call.
445 FUNDECL is the declaration node of the function (as a tree),
446 FUNTYPE is the data type of the function (as a tree),
447 or for a library call it is an identifier node for the subroutine name.
450 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
452 /* Define how to find the value returned by a function.
453 VALTYPE is the data type of the value (as a tree).
454 If the precise function being called is known, FUNC is its FUNCTION_DECL;
455 otherwise, FUNC is 0. */
457 #define FUNCTION_VALUE(VALTYPE, FUNC) \
458 gen_rtx_REG (TYPE_MODE (VALTYPE), 0)
460 /* Define how to find the value returned by a library function
461 assuming the value has mode MODE. */
462 /* 1750 note: no libcalls yet */
464 #define LIBCALL_VALUE(MODE) printf("LIBCALL_VALUE called!\n"), \
465 gen_rtx_REG (MODE, 0)
467 /* 1 if N is a possible register number for a function value. */
469 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
471 /* 1 if the tree TYPE should be returned in memory instead of in regs.
472 #define RETURN_IN_MEMORY(TYPE) \
473 (int_size_in_bytes(TYPE) > 12)
476 /* Define this if PCC uses the nonreentrant convention for returning
477 structure and union values.
478 #define PCC_STATIC_STRUCT_RETURN */
480 /* 1 if N is a possible register number for function argument passing. */
482 #define FUNCTION_ARG_REGNO_P(N) ((N) < 12)
484 /*****************************************************************************/
486 /* Define a data type for recording info about an argument list
487 during the scan of that argument list. This data type should
488 hold all necessary information about the function itself
489 and about the args processed so far, enough to enable macros
490 such as FUNCTION_ARG to determine where the next arg should go.
492 For 1750A, this is a single integer, which is a number of words
493 of arguments scanned so far. */
495 #define CUMULATIVE_ARGS int
497 /* Initialize a variable CUM of type CUMULATIVE_ARGS
498 for a call to a function whose data type is FNTYPE.
499 For a library call, FNTYPE is 0.
501 For 1750A, the offset starts at 0. */
503 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) ((CUM) = 0)
505 /* Update the data in CUM to advance over an argument
506 of mode MODE and data type TYPE.
507 (TYPE is null for libcalls where that information may not be available.)
509 1750 note: "int_size_in_bytes()" returns a unit relative to
510 BITS_PER_UNIT, so in our case not bytes, but 16-bit words. */
512 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
513 ((CUM) += (MODE) == BLKmode ? int_size_in_bytes(TYPE) : GET_MODE_SIZE(MODE))
515 /* Define where to put the arguments to a function.
516 Value is zero to push the argument on the stack,
517 or a hard register in which to store the argument.
519 MODE is the argument's machine mode.
520 TYPE is the data type of the argument (as a tree).
521 This is null for libcalls where that information may
522 not be available.
523 CUM is a variable of type CUMULATIVE_ARGS which gives info about
524 the preceding args and about the function being called.
525 NAMED is nonzero if this argument is a named parameter
526 (otherwise it is an extra parameter matching an ellipsis). */
528 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) function_arg (CUM,MODE,TYPE,NAMED)
530 /* Define the following macro if function calls on the target machine
531 do not preserve any registers; in other words, if `CALL_USED_REGISTERS'
532 has 1 for all registers. This macro enables `-fcaller-saves' by
533 default. Eventually that option will be enabled by default on all
534 machines and both the option and this macro will be eliminated. */
536 #define DEFAULT_CALLER_SAVES
538 /************* 1750: PROFILER HANDLING NOT YET DONE !!!!!!! *************/
539 /* Output assembler code to FILE to increment profiler label # LABELNO
540 for profiling a function entry. */
542 #define FUNCTION_PROFILER(FILE, LABELNO) \
543 fprintf (FILE, "; got into FUNCTION_PROFILER with label # %d\n", (LABELNO))
545 /* Output assembler code to FILE to initialize this source file's
546 basic block profiling info, if that has not already been done. */
547 #define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
548 fprintf (FILE, "; got into FUNCTION_BLOCK_PROFILER with label # %d\n",LABELNO)
550 /* Output assembler code to FILE to increment the entry-count for
551 the BLOCKNO'th basic block in this source file. */
552 #define BLOCK_PROFILER(FILE, BLOCKNO) \
553 fprintf (FILE, "; got into BLOCK_PROFILER with block # %d\n",BLOCKNO)
555 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
556 the stack pointer does not matter. The value is tested only in
557 functions that have frame pointers.
558 No definition is equivalent to always zero. */
560 #define EXIT_IGNORE_STACK 0
562 /* If the memory address ADDR is relative to the frame pointer,
563 correct it to be relative to the stack pointer instead.
564 This is for when we don't use a frame pointer.
565 ADDR should be a variable name.
567 #define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH)
570 /* Store in the variable DEPTH the initial difference between the
571 frame pointer reg contents and the stack pointer reg contents,
572 as of the start of the function body. This depends on the layout
573 of the fixed parts of the stack frame and on how registers are saved.
574 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) DEPTH = 0
577 #define ELIMINABLE_REGS { \
578 { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
579 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }, \
580 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM } }
582 #define CAN_ELIMINATE(FROM, TO) 1
584 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
585 OFFSET = (TO == STACK_POINTER_REGNUM) ? -1 : 0
588 /* Output assembler code for a block containing the constant parts
589 of a trampoline, leaving space for the variable parts. */
591 #define TRAMPOLINE_TEMPLATE(FILE) fprintf(FILE,"TRAMPOLINE_TEMPLATE called\n")
593 /* Length in units of the trampoline for entering a nested function. */
595 #define TRAMPOLINE_SIZE 2
597 /* Emit RTL insns to initialize the variable parts of a trampoline.
598 FNADDR is an RTX for the address of the function's pure code.
599 CXT is an RTX for the static chain value for the function. */
601 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) printf("INITIALIZE_TRAMPO called\n")
602 /* { \
603 emit_move_insn (gen_rtx_MEM (QImode, plus_constant (TRAMP, 1)), CXT); \
604 emit_move_insn (gen_rtx_MEM (QImode, plus_constant (TRAMP, 6)), FNADDR); \
605 } */
608 /*****************************************************************************/
610 /* Addressing modes, and classification of registers for them. */
612 /* 1750 doesn't have a lot of auto-incr./decr. - just for the stack ptr. */
614 /* #define HAVE_POST_INCREMENT 0 just for R15 (stack pointer) */
615 /* #define HAVE_POST_DECREMENT 0 */
616 /* #define HAVE_PRE_DECREMENT 0 just for R15 (stack pointer) */
617 /* #define HAVE_PRE_INCREMENT 0 */
619 /* Macros to check register numbers against specific register classes. */
621 /* These assume that REGNO is a hard or pseudo reg number.
622 They give nonzero only if REGNO is a hard reg of the suitable class
623 or a pseudo reg currently allocated to a suitable hard reg.
624 Since they use reg_renumber, they are safe only once reg_renumber
625 has been allocated, which happens in local-alloc.c.
626 1750 note: The words BASE and INDEX are used in their GCC senses:
627 The "Index Registers", R12 through R15, are used in the 1750
628 instructions LB,STB,AB,SBB,MB,DB,LBX,STBX,...
631 #define REGNO_OK_FOR_BASE_P(REGNO) \
632 (((REGNO) > 0 && (REGNO) <= 15) || \
633 (reg_renumber[REGNO] > 0 && reg_renumber[REGNO] <= 15))
634 #define REGNO_OK_FOR_INDEX_P(REGNO) \
635 (((REGNO) >= 12 && (REGNO) <= 15) || \
636 (reg_renumber[REGNO] >= 12 && reg_renumber[REGNO] <= 15))
638 /* Now macros that check whether X is a register and also,
639 strictly, whether it is in a specified class. */
641 /* 1 if X is an address register */
643 #define ADDRESS_REG_P(X) (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X)))
645 /* Maximum number of registers that can appear in a valid memory address. */
646 #define MAX_REGS_PER_ADDRESS 1
648 /* Recognize any constant value that is a valid address. */
650 #define CONSTANT_ADDRESS_P(X) CONSTANT_P(X)
652 /* Nonzero if the constant value X is a legitimate general operand.
653 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
655 #define LEGITIMATE_CONSTANT_P(X) 1
657 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
658 and check its validity for a certain class.
659 We have two alternate definitions for each of them.
660 The usual definition accepts all pseudo regs; the other rejects
661 them unless they have been allocated suitable hard regs.
662 The symbol REG_OK_STRICT causes the latter definition to be used.
664 Most source files want to accept pseudo regs in the hope that
665 they will get allocated to the class that the insn wants them to be in.
666 Source files for reload pass need to be strict.
667 After reload, it makes no difference, since pseudo regs have
668 been eliminated by then. */
670 #ifdef REG_OK_STRICT
672 /* Nonzero if X is a hard reg that can be used as an index. */
673 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P(REGNO(X))
674 /* Nonzero if X is a hard reg that can be used as a base reg. */
675 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P(REGNO(X))
677 #else
679 /* Nonzero if X is a hard reg that can be used as an index
680 or if it is a pseudo reg. */
681 #define REG_OK_FOR_INDEX_P(X) (REGNO (X) >= 12)
682 /* Nonzero if X is a hard reg that can be used as a base reg
683 or if it is a pseudo reg. */
684 #define REG_OK_FOR_BASE_P(X) (REGNO (X) > 0)
686 #endif
689 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
690 that is a valid memory address for an instruction.
691 The MODE argument is the machine mode for the MEM expression
692 that wants to use this address.
693 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS.
695 1750 note: Currently we don't implement address expressions that use
696 GCC "Index"-class regs. To be expanded to handle the 1750 "Base with Index"
697 instructions (see also MAX_REGS_PER_ADDRESS and others). */
699 #define GO_IF_BASED_ADDRESS(X, ADDR) { \
700 if ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P(X))) \
701 goto ADDR; \
702 if (GET_CODE (X) == PLUS) \
703 { register rtx x0 = XEXP(X,0), x1 = XEXP(X,1); \
704 if ((REG_P(x0) && REG_OK_FOR_BASE_P(x0) && CONSTANT_ADDRESS_P(x1)) \
705 || (REG_P(x1) && REG_OK_FOR_BASE_P(x1) && CONSTANT_ADDRESS_P(x0))) \
706 goto ADDR; } }
708 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) { \
709 if (CONSTANT_ADDRESS_P(X)) goto ADDR; \
710 GO_IF_BASED_ADDRESS(X,ADDR) }
713 /* Try machine-dependent ways of modifying an illegitimate address
714 to be legitimate. If we find one, return the new, valid address.
715 This macro is used in only one place: `memory_address' in explow.c.
717 OLDX is the address as it was before break_out_memory_refs was called.
718 In some cases it is useful to look at this to decide what needs to be done.
720 MODE and WIN are passed so that this macro can use
721 GO_IF_LEGITIMATE_ADDRESS.
723 It is always safe for this macro to do nothing. It exists to recognize
724 opportunities to optimize the output. */
726 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)
728 /* Go to LABEL if ADDR (a legitimate address expression)
729 has an effect that depends on the machine mode it is used for.
730 On the 68000, only predecrement and postincrement address depend thus
731 (the amount of decrement or increment being the length of the operand). */
732 /* 1750: not used. */
734 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
736 /*****************************************************************************/
738 /* Specify the machine mode that this machine uses
739 for the index in the tablejump instruction. */
740 #define CASE_VECTOR_MODE QImode
742 /* Define as C expression which evaluates to nonzero if the tablejump
743 instruction expects the table to contain offsets from the address of the
744 table.
745 Do not define this if the table should contain absolute addresses. */
746 /* #define CASE_VECTOR_PC_RELATIVE 1 */
748 /* Define this as 1 if `char' should by default be signed; else as 0. */
749 #define DEFAULT_SIGNED_CHAR 1
751 /* Max number of bytes we can move from memory to memory
752 in one reasonably fast instruction. */
753 #define MOVE_MAX 65536
755 /* If a memory-to-memory move would take MOVE_RATIO or more simple
756 move-instruction pairs, we will do a movstr or libcall instead. */
757 #define MOVE_RATIO 4
759 /* Nonzero if access to memory by bytes is slow and undesirable. */
760 #define SLOW_BYTE_ACCESS 0
762 /* Define if shifts truncate the shift count
763 which implies one can omit a sign-extension or zero-extension
764 of a shift count. */
765 /* #define SHIFT_COUNT_TRUNCATED 1 */
767 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
768 is done just by pretending it is already truncated. */
769 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
771 /* We assume that the store-condition-codes instructions store 0 for false
772 and some other value for true. This is the value stored for true. */
774 #define STORE_FLAG_VALUE 1
776 /* When a prototype says `char' or `short', really pass an `int'.
777 1750: for now, `char' is 16 bits wide anyway. */
778 #define PROMOTE_PROTOTYPES 0
780 /* Specify the machine mode that pointers have.
781 After generation of rtl, the compiler makes no further distinction
782 between pointers and any other objects of this machine mode. */
783 #define Pmode QImode
785 /* A function address in a call instruction
786 is a 16-bit address (for indexing purposes) */
787 #define FUNCTION_MODE QImode
789 /* Compute the cost of computing a constant rtl expression RTX
790 whose rtx-code is CODE. The body of this macro is a portion
791 of a switch statement. If the code is computed here,
792 return it with a return statement. Otherwise, break from the switch. */
794 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
795 case CONST_INT: \
796 return (INTVAL(RTX) >= -16 && INTVAL(RTX) <= 16) ? 1 : 3; \
797 case CONST: \
798 case LABEL_REF: \
799 case SYMBOL_REF: \
800 return 3; \
801 case CONST_DOUBLE: \
802 return 4;
804 #define ADDRESS_COST(ADDRESS) (memop_valid (ADDRESS) ? 3 : 10)
806 #define REGISTER_MOVE_COST(MODE,FROM,TO) 2
808 #define MEMORY_MOVE_COST(M,C,I) 4
810 /* Tell final.c how to eliminate redundant test instructions. */
812 /* Here we define machine-dependent flags and fields in cc_status
813 (see `conditions.h'). */
814 /* MIL-STD-1750: none -- just has the garden variety C,P,Z,N flags. */
816 /* Store in cc_status the expressions
817 that the condition codes will describe
818 after execution of an instruction whose pattern is EXP.
819 Do not alter them if the instruction would not alter the cc's.
820 1750: See file out-1750a.c for notice_update_cc(). */
822 #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP)
824 /**********************************************/
825 /* Produce debugging info in the DWARF format
826 #define DWARF_DEBUGGING_INFO
829 /*****************************************************************************/
831 /* Control the assembler format that we output. */
833 /* Output at beginning of assembler file. */
835 #define ASM_FILE_START(FILE) { \
836 char *p2, name[40]; \
837 const char *p; \
838 if ((p = strrchr(main_input_filename,'/')) != NULL ? 1 : \
839 (p = strrchr(main_input_filename,']')) != NULL) \
840 p++; \
841 else \
842 p = main_input_filename; \
843 strcpy(name,p); \
844 if ((p2 = strchr(name,'.'))) \
845 *p2 = '\0'; \
846 fprintf(FILE,"\tname %s\n",name); \
847 fprintf(FILE,"\tnolist\n\tinclude \"ms1750.inc\"\n\tlist\n\n"); \
848 fprintf(FILE,"\tglobal\t__main\n\n"); }
850 /* Output at end of assembler file.
851 For 1750, we copy the data labels accrued in datalbl[] from the Constants
852 section (Konst) to the Writable-Data section (Static). */
854 #define ASM_FILE_END(FILE) \
855 do { \
856 if (datalbl_ndx >= 0) { \
857 int i, cum_size=0; \
858 fprintf(FILE,"\n\tstatic\ninit_srel\n"); \
859 for (i = 0; i <= datalbl_ndx; i++) { \
860 if (datalbl[i].name == NULL) \
862 fprintf(stderr, "asm_file_end internal datalbl err\n"); \
863 exit (0); \
865 fprintf(FILE,"%s \tblock %d\n", \
866 datalbl[i].name,datalbl[i].size); \
867 cum_size += datalbl[i].size; \
869 fprintf(FILE,"\n\tinit\n"); \
870 fprintf(FILE,"\tlim\tr0,init_srel\n"); /* destin. */ \
871 fprintf(FILE,"\tlim\tr1,%d\n",cum_size); /* count */ \
872 fprintf(FILE,"\tlim\tr2,K%s\n",datalbl[0].name); /* source */ \
873 fprintf(FILE,"\tmov\tr0,r2\n"); \
874 fprintf(FILE,"\n\tnormal\n"); \
875 datalbl_ndx = -1; /* reset stuff */ \
876 for (i = 0; i < DATALBL_ARRSIZ; i++) \
877 datalbl[i].size = 0; \
879 fprintf(FILE,"\n\tend\n"); \
880 } while (0)
882 /* Output to assembler file text saying following lines
883 may contain character constants, extra white space, comments, etc. */
885 #define ASM_APP_ON "; ASM_APP_ON\n"
887 /* Output to assembler file text saying following lines
888 no longer contain unusual constructs. */
890 #define ASM_APP_OFF "; ASM_APP_OFF\n"
893 #define EXTRA_SECTIONS in_readonly_data
895 #define EXTRA_SECTION_FUNCTIONS \
896 extern void const_section PARAMS ((void)); \
897 void const_section() \
899 fprintf(asm_out_file,"\tkonst\n"); \
900 current_section = Konst; \
902 void check_section(sect) \
903 enum section sect; \
905 if (current_section != sect) { \
906 fprintf(asm_out_file,"\t%s\n",sectname[(int)sect]); \
907 current_section = sect; \
909 switch (sect) { \
910 case Init: \
911 case Normal: \
912 in_section = in_text; \
913 break; \
914 case Static: \
915 in_section = in_data; \
916 break; \
917 case Konst: \
918 in_section = in_readonly_data; \
919 break; \
924 /* Function that switches to the read-only data section (optional) */
925 #define READONLY_DATA_SECTION const_section
927 /* Output before program init section */
928 #define INIT_SECTION_ASM_OP "\n\tinit ; init_section\n"
930 /* Output before program text section */
931 #define TEXT_SECTION_ASM_OP "\n\tnormal ; text_section\n"
933 /* Output before writable data.
934 1750 Note: This is actually read-only data. The copying from read-only
935 to writable memory is done elsewhere (in ASM_FILE_END.)
937 #define DATA_SECTION_ASM_OP "\n\tkonst ; data_section\n"
939 /* How to refer to registers in assembler output.
940 This sequence is indexed by compiler's hard-register-number (see above). */
942 #define REGISTER_NAMES \
943 { "0", "1", "2", "3", "4", "5", "6", "7", \
944 "8", "9","10","11","12","13","14","15" }
946 /****************** Assembler output formatting **********************/
948 #define ASM_COMMENT_START ";"
950 #define ASM_OUTPUT_OPCODE(FILE,PTR) do { \
951 while (*(PTR) != '\0' && *(PTR) != ' ') { \
952 putc (*(PTR), FILE); \
953 (PTR)++; \
955 while (*(PTR) == ' ') \
956 (PTR)++; \
957 putc ('\t', FILE); \
958 program_counter += 2; \
959 } while (0)
961 #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
962 fprintf(FILE,"%s\n",NAME)
964 /* This is how to output the definition of a user-level label named NAME,
965 such as the label on a static function or variable NAME. */
966 /* 1750 note: Labels are prefixed with a 'K'. This is because handling
967 has been changed for labels to be output in the "Constants" section
968 (named "Konst"), and special initialization code takes care of copying
969 the Const-section data into the writable data section (named "Static").
970 In the Static section we therefore have the true label names (i.e.
971 not prefixed with 'K'). */
973 #define ASM_OUTPUT_LABEL(FILE,NAME) \
974 do { if (NAME[0] == '.') { \
975 fprintf(stderr,"Oops! label %s can't begin with '.'\n",NAME); \
976 abort(); \
978 else { \
979 check_section(Konst); \
980 fprintf(FILE,"K%s\n",NAME); \
981 fflush(FILE); \
982 datalbl[++datalbl_ndx].name = (char *)xstrdup (NAME);\
983 datalbl[datalbl_ndx].size = 0; \
984 label_pending = 1; \
986 } while (0)
989 /* This is how to output a command to make the user-level label named NAME
990 defined for reference from other files. */
992 #define ASM_GLOBALIZE_LABEL(FILE,NAME) do { \
993 fprintf (FILE, "\tglobal %s\t; export\n", NAME); \
994 } while (0)
996 /* The prefix to add to user-visible assembler symbols. */
998 #define USER_LABEL_PREFIX ""
1000 /* This is how to output an internal numbered label where
1001 PREFIX is the class of label and NUM is the number within the class. */
1003 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1004 do { \
1005 if (strcmp(PREFIX,"LC") == 0) { \
1006 label_pending = 1; \
1007 datalbl[++datalbl_ndx].name = (char *) xmalloc (9);\
1008 sprintf(datalbl[datalbl_ndx].name,"LC%d",NUM); \
1009 datalbl[datalbl_ndx].size = 0; \
1010 check_section(Konst); \
1011 fprintf(FILE,"K%s%d\n",PREFIX,NUM); \
1013 else if (find_jmplbl(NUM) < 0) { \
1014 jmplbl[++jmplbl_ndx].num = NUM; \
1015 jmplbl[jmplbl_ndx].pc = program_counter; \
1016 fprintf(FILE, "%s%d\n", PREFIX, NUM); \
1018 fflush(FILE); \
1019 } while (0)
1022 /* This is how to store into the string LABEL
1023 the symbol_ref name of an internal numbered label where
1024 PREFIX is the class of label and NUM is the number within the class.
1025 This is suitable for output with `assemble_name'. */
1027 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1028 sprintf (LABEL, "%s%d", PREFIX, NUM)
1030 /* Output at the end of a jump table.
1031 1750: To be uncommented when we can put jump tables in Konst.
1032 #define ASM_OUTPUT_CASE_END(FILE,NUM,INSN) \
1033 fprintf (FILE, "\tnormal\t; case_end\n")
1036 /* Currently, it is not possible to put jump tables in section Konst.
1037 This is because there is a one-to-one relation between sections Konst
1038 and Static (i.e., all Konst data are copied to Static, and the order
1039 of data is the same between the two sections.) However, jump tables are
1040 not copied to Static, which destroys the equivalence between Konst and
1041 Static. When a more intelligent Konst-to-Static copying mechanism is
1042 implemented (i.e. one that excludes the copying of jumptables), then
1043 ASM_OUTPUT_CASE_END shall be defined, and JUMP_LABELS_IN_TEXT_SECTION
1044 shall be undefined. */
1046 #define JUMP_TABLES_IN_TEXT_SECTION 1
1048 /* This is how to output an assembler line defining a string constant. */
1050 #define ASM_OUTPUT_ASCII(FILE, PTR, LEN) do { \
1051 int i; \
1052 if (label_pending) \
1053 label_pending = 0; \
1054 datalbl[datalbl_ndx].size += LEN; \
1055 for (i = 0; i < (int) LEN; i++) { \
1056 if ((i % 15) == 0) { \
1057 if (i != 0) \
1058 fprintf(FILE,"\n"); \
1059 fprintf(FILE,"\tdata\t"); \
1061 else \
1062 fprintf(FILE,","); \
1063 if (PTR[i] >= 32 && PTR[i] < 127) \
1064 fprintf(FILE,"'%c'",PTR[i]); \
1065 else \
1066 fprintf(FILE,"%d",PTR[i]); \
1068 fprintf(FILE,"\n"); \
1069 } while (0)
1071 /* This is how to output an insn to push a register on the stack.
1072 It need not be very fast code. */
1074 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1075 fprintf (FILE, "\tPSHM R%s,R%s\n", reg_names[REGNO], "FIXME: missing arg")
1077 /* This is how to output an insn to pop a register from the stack.
1078 It need not be very fast code. */
1080 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1081 fprintf (FILE, "\tPOPM R%s,R%s\n", reg_names[REGNO], "FIXME: missing arg")
1083 /* This is how to output an element of a case-vector that is absolute. */
1085 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1086 fprintf (FILE, "\tdata\tL%d ;addr_vec_elt\n", VALUE)
1088 /* This is how to output an element of a case-vector that is relative. */
1090 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1091 fprintf (FILE, "\tdata\tL%d-L%d ;addr_diff_elt\n", VALUE,REL)
1093 /* This is how to output an assembler line
1094 that says to advance the location counter
1095 to a multiple of 2**LOG bytes. */
1097 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1098 fprintf(FILE,"; in ASM_OUTPUT_ALIGN: pwr_of_2_bytcnt=%d\n",LOG)
1100 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1101 fprintf(FILE,"; in ASM_OUTPUT_SKIP: size=%d\n",SIZE)
1103 /* This says how to output an assembler line
1104 to define a global common symbol. */
1106 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) do { \
1107 check_section(Static); \
1108 fprintf (FILE, "\tcommon %s,%d\n", NAME, SIZE); \
1109 } while (0)
1111 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) do { \
1112 fprintf (FILE, "\tglobal %s\t; import\n", NAME); \
1113 } while (0)
1115 /* This says how to output an assembler line
1116 to define a local common symbol. */
1118 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) do { \
1119 check_section (Static); \
1120 fprintf(FILE,"%s \tblock %d\t; local common\n",NAME,SIZE); \
1121 } while (0)
1123 /* Store in OUTPUT a string (made with alloca) containing
1124 an assembler-name for a local static variable named NAME.
1125 LABELNO is an integer which is different for each call. */
1127 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1128 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1129 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1131 /* Print operand X (an rtx) in assembler syntax to file FILE.
1132 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1133 For `%' followed by punctuation, CODE is the punctuation and X is null.
1134 1750 note: there are three special CODE characters:
1135 'D', 'E': print a reference to a floating point constant (D=double,
1136 E=single precision) label name
1137 'F': print a label defining a floating-point constant value
1138 'J': print the absolute value of a negative INT_CONST
1139 (this is used in LISN/CISN/MISN/SISP and others)
1140 'Q': print a 1750 Base-Register-with-offset instruction's operands
1143 #define PRINT_OPERAND(FILE, X, CODE) print_operand(FILE,X,CODE)
1144 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address(FILE,ADDR)
1146 /* Convert a REAL_VALUE_TYPE to the target 1750a float format. */
1147 #define REAL_VALUE_TO_TARGET_SINGLE(IN, OUT) \
1148 ((OUT) = real_value_to_target_single(IN))
1150 /* Convert a REAL_VALUE_TYPE to the target 1750a extended float format. */
1151 #define REAL_VALUE_TO_TARGET_DOUBLE(IN, OUT) \
1152 real_value_to_target_double((IN), (OUT))