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)
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. */
31 #define TARGET_VERSION fprintf (stderr, " (1750A, IEEE syntax)");
33 #define TARGET_VERSION fprintf (stderr, " (MIL-STD-1750A)");
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
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 {
57 struct jumplabel_array {
61 enum section { Init, Normal, Konst, Static };
62 #define DATALBL_ARRSIZ 256
63 #define JMPLBL_ARRSIZ 256
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];
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
91 #define WORDS_BIG_ENDIAN 1
93 /* number of bits in an addressable storage unit */
94 #define BITS_PER_UNIT 16
96 /* Width in bits of a "word", which is the contents of a machine register.
97 Note that this is not necessarily the width of data type `int';
98 if using 16-bit ints on a 68000, this would still be 32.
99 But on a machine with 16-bit registers, this would be 16. */
100 #define BITS_PER_WORD 16
102 /* Width of a word, in units (bytes). */
103 #define UNITS_PER_WORD 1
105 /* Width in bits of a pointer.
106 See also the macro `Pmode' defined below. */
107 #define POINTER_SIZE 16
109 #define PTRDIFF_TYPE "int"
111 /* Type to use for `size_t'. If undefined, uses `long unsigned int'. */
112 #define SIZE_TYPE "int"
114 /* 1750a preliminary. Ought to properly define the format in real.c. */
115 #define TARGET_FLOAT_FORMAT UNKNOWN_FLOAT_FORMAT
117 /* Allocation boundary (in *bits*) for storing pointers in memory. */
118 #define POINTER_BOUNDARY 16
120 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
121 /* 1750: should have had to make this 32 when BITS_PER_WORD is 32. */
122 #define PARM_BOUNDARY 16
124 /* Boundary (in *bits*) on which stack pointer should be aligned. */
125 #define STACK_BOUNDARY 16
127 /* Allocation boundary (in *bits*) for the code of a function. */
128 #define FUNCTION_BOUNDARY 16
130 /* Alignment of field after `int : 0' in a structure. */
131 #define EMPTY_FIELD_BOUNDARY 16
133 /* No data type wants to be aligned rounder than this. */
134 #define BIGGEST_ALIGNMENT 16
136 /* Define this to 1 if move instructions will actually fail to work
137 when given unaligned data. */
138 #define STRICT_ALIGNMENT 0
140 /* Define number of bits in most basic integer type.
141 (If undefined, default is BITS_PER_WORD).
142 #define INT_TYPE_SIZE 16 */
144 /* Define number of bits in short integer type.
145 (If undefined, default is half of BITS_PER_WORD). */
146 #define SHORT_TYPE_SIZE 16
148 /* Define number of bits in long integer type.
149 (If undefined, default is BITS_PER_WORD). */
150 #define LONG_TYPE_SIZE 32
152 /* Define number of bits in long long integer type.
153 (If undefined, default is twice BITS_PER_WORD). */
154 /* 1750 PRELIMINARY : no processor support for `long long', therefore
155 need to check out the long-long opencodings ! */
156 #define LONG_LONG_TYPE_SIZE 64
158 /* Define number of bits in float type.
159 (If undefined, default is BITS_PER_WORD). */
160 #define FLOAT_TYPE_SIZE 32
162 /* Define number of bits in double type.
163 (If undefined, default is twice BITS_PER_WORD). */
164 #define DOUBLE_TYPE_SIZE 48
166 /*****************************************************************************/
168 /* Standard register usage. */
170 /* Number of actual hardware registers.
171 The hardware registers are assigned numbers for the compiler
172 from 0 to just below FIRST_PSEUDO_REGISTER.
173 All registers that the compiler knows about must be given numbers,
174 even those that are not normally considered general registers. */
175 #define FIRST_PSEUDO_REGISTER 16
177 /* 1 for registers that have pervasive standard uses
178 and are not available for the register allocator.
179 R15 is the 1750A stack pointer. R14 is the frame pointer. */
181 #define FIXED_REGISTERS \
182 { 0, 0, 0, 0, 0, 0, 0, 0, \
183 0, 0, 0, 0, 0, 0, 1, 1 }
185 /* 1 for registers not available across function calls.
186 These must include the FIXED_REGISTERS and also any
187 registers that can be used without being saved.
188 The latter must include the registers where values are returned
189 and the register where structure-value addresses are passed.
190 Aside from that, you can include as many other registers as you like.
191 1750: return value in R0 foll. (depending on size of retval).
192 Should be possible to refine this (how many regs are actually used) */
194 #define CALL_USED_REGISTERS \
195 { 1, 1, 1, 1, 1, 1, 1, 1, \
196 1, 1, 1, 1, 1, 1, 1, 1 }
198 /* Order in which to allocate registers. Each register must be
199 listed once, even those in FIXED_REGISTERS. List frame pointer
200 late and fixed registers last. Note that, in general, we prefer
201 registers listed in CALL_USED_REGISTERS, keeping the others
202 available for storage of persistent values. */
204 /* #define REG_ALLOC_ORDER \
205 { 2, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
208 /* Return number of consecutive hard regs needed starting at reg REGNO
209 to hold something of mode MODE.
210 This is ordinarily the length in words of a value of mode MODE
211 but can be less for certain modes in special long registers.
212 All 1750 registers are one word long. */
213 #define HARD_REGNO_NREGS(REGNO, MODE) \
214 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
216 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
217 #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
219 /* Value is 1 if it is a good idea to tie two pseudo registers
220 when one has mode MODE1 and one has mode MODE2.
221 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
222 for any hard reg, then this must be 0 for correct output. */
223 #define MODES_TIEABLE_P(MODE1, MODE2) 1
225 /* Specify the registers used for certain standard purposes.
226 The values of these macros are register numbers. */
228 /* 1750A pc isn't overloaded on a register. */
229 /* #define PC_REGNUM */
231 /* Register to use for pushing function arguments. */
232 #define STACK_POINTER_REGNUM 15
234 /* Base register for access to local variables of the function. */
235 #define FRAME_POINTER_REGNUM 14
237 /* Value should be nonzero if functions must have frame pointers.
238 Zero means the frame pointer need not be set up (and parms
239 may be accessed via the stack pointer) in functions that seem suitable.
240 This is computed in `reload', in reload1.c. */
241 #define FRAME_POINTER_REQUIRED 0
243 /* Base register for access to arguments of the function. */
244 #define ARG_POINTER_REGNUM 14
246 /* Define this if successive args to a function occupy decreasing addresses
248 #define ARGS_GROW_DOWNWARD
251 /* Register in which static-chain is passed to a function. */
252 #define STATIC_CHAIN_REGNUM 13
254 /* Place in which caller passes the structure value address.
255 0 means push the value on the stack like an argument.
256 #define STRUCT_VALUE 0
259 /* Register in which address to store a structure value
260 arrives in the function.
261 #define STRUCT_VALUE_INCOMING 0
264 /* Register in which address to store a structure value
265 is passed to a function. */
266 #define STRUCT_VALUE_REGNUM 12
268 /* Define this to be 1 if all structure return values must be in memory. */
269 #define DEFAULT_PCC_STRUCT_RETURN 0
271 /*****************************************************************************/
273 /* Define the classes of registers for register constraints in the
274 machine description. Also define ranges of constants.
276 One of the classes must always be named ALL_REGS and include all hard regs.
277 If there is more than one class, another class must be named NO_REGS
278 and contain no registers.
280 The name GENERAL_REGS must be the name of a class (or an alias for
281 another name such as ALL_REGS). This is the class of registers
282 that is allowed by "g" or "r" in a register constraint.
283 Also, registers outside this class are allocated only when
284 instructions express preferences for them.
286 The classes must be numbered in nondecreasing order; that is,
287 a larger-numbered class must never be contained completely
288 in a smaller-numbered class.
290 For any two classes, it is very desirable that there be another
291 class that represents their union. */
293 /* 1750 note: The names (BASE_REGS/INDEX_REGS) are used in their *gcc sense*
294 (i.e. *opposite* to the MIL-STD-1750A defined meanings). This means that
295 R1..R15 are called "base" regs and R12..R15 are "index" regs.
296 Index reg mode (in the gcc sense) is not yet implemented (these are the
297 1750 "Base with Index Reg" instructions, LBX etc. See 1750.md)
299 Here's an example to drive this point home: in "LBX B12,R5"
300 B12 shall be called the "index" reg and R5 shall be the "base" reg.
301 This naming inversion is due to the GCC defined capabilities of
302 "Base" vs. "Index" regs. */
304 enum reg_class { NO_REGS, R2, R0_1, INDEX_REGS, BASE_REGS, ALL_REGS, LIM_REG_CLASSES };
306 #define N_REG_CLASSES (int) LIM_REG_CLASSES
308 /* Since GENERAL_REGS is the same class as ALL_REGS,
309 don't give it a different class number; just make it an alias. */
310 #define GENERAL_REGS ALL_REGS
312 /* Give names of register classes as strings for dump file. */
314 #define REG_CLASS_NAMES \
315 { "NO_REGS", "R2", "R0_1", "INDEX_REGS", "BASE_REGS", "ALL_REGS" }
317 /* Define which registers fit in which classes.
318 This is an initializer for a vector of HARD_REG_SET
319 of length N_REG_CLASSES.
320 1750 "index" (remember, in the *GCC* sense!) regs are R12 through R15.
321 The only 1750 register not usable as BASE_REG is R0. */
323 #define REG_CLASS_CONTENTS { {0}, {0x0004}, {0x0003}, {0xf000}, {0xfffe}, {0xffff} }
325 /* The same information, inverted:
326 Return the class number of the smallest class containing
327 reg number REGNO. This could be a conditional expression
328 or could index an array. */
329 #define REGNO_REG_CLASS(REGNO) ((REGNO) == 2 ? R2 : (REGNO) == 0 ? R0_1 : \
330 (REGNO) >= 12 ? INDEX_REGS : (REGNO) > 0 ? BASE_REGS : ALL_REGS)
332 /* The class value for index registers, and the one for base regs. */
334 #define BASE_REG_CLASS BASE_REGS
335 #define INDEX_REG_CLASS INDEX_REGS
337 /* Get reg_class from a letter such as appears in the machine description.
338 For the 1750, we have 'z' for R0_1, 't' for R2, 'b' for gcc Base regs
339 and 'x' for gcc Index regs. */
341 #define REG_CLASS_FROM_LETTER(C) ((C) == 't' ? R2 : \
342 (C) == 'z' ? R0_1 : \
343 (C) == 'b' ? BASE_REGS : \
344 (C) == 'x' ? INDEX_REGS : NO_REGS)
346 /* The letters I,J,K,.. to P in a register constraint string
347 can be used to stand for particular ranges of immediate operands.
348 This macro defines what the ranges are.
349 C is the letter, and VALUE is a constant value.
350 Return 1 if VALUE is in the range specified by C.
353 `I' is used for ISP mode instructions,
354 `J' is used for ISN mode instructions,
355 `K' is used for the STC instruction's constant range,
356 `L' is used for unsigned 8-bit address displacements in instructions
357 of addressing mode "Base Relative",
358 `M' is for IM mode instructions et al.,
359 `O' is a synonym for (const_int 0). */
361 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
362 ((C) == 'I' ? (VALUE) > 0 && (VALUE) <= 16 : \
363 (C) == 'J' ? (VALUE) < 0 && (VALUE) >= -16 : \
364 (C) == 'K' ? (VALUE) >= 0 && (VALUE) <= 15 : \
365 (C) == 'L' ? (VALUE) >= 0 && (VALUE) <= 0xFF : \
366 (C) == 'M' ? (VALUE) >= -0x8000 && (VALUE) <= 0x7FFF : \
367 (C) == 'O' ? (VALUE) == 0 : 0)
369 /* Similar, but for floating constants, and defining letter 'G'.
370 Here VALUE is the CONST_DOUBLE rtx itself. */
371 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
372 ((C) == 'G' ? ((VALUE) == CONST0_RTX (HFmode) \
373 || (VALUE) == CONST0_RTX (TQFmode)) : 0)
375 /* Optional extra constraints for this machine.
377 For the 1750, `Q' means that this is a memory operand consisting
378 of the sum of an Index Register (in the GCC sense, i.e. R12..R15)
379 and a constant in the range 0..255. This constraint is used for
380 the Base Register with Offset address mode instructions (LB,STB,AB,..) */
382 #define EXTRA_CONSTRAINT(OP, C) \
383 ((C) == 'Q' && b_mode_operand (OP))
385 /* Given an rtx X being reloaded into a reg required to be
386 in class CLASS, return the class of reg to actually use.
387 In general this is just CLASS; but on some machines
388 in some cases it is preferable to use a more restrictive class. */
390 #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
392 /* Return the maximum number of consecutive registers
393 needed to represent mode MODE in a register of class CLASS.
394 On the 1750A, this is the size of MODE in words,
395 since class doesn't make any difference. */
396 #define CLASS_MAX_NREGS(CLASS,MODE) GET_MODE_SIZE(MODE)
398 /*****************************************************************************/
400 /* Stack layout; function entry, exit and calling. */
402 /* Define this if pushing a word on the stack
403 makes the stack pointer a smaller address. */
404 #define STACK_GROWS_DOWNWARD 1
406 /* Define this if the nominal address of the stack frame
407 is at the high-address end of the local variables;
408 goes at a more negative offset in the frame.
409 #define FRAME_GROWS_DOWNWARD
412 /* Offset within stack frame to start allocating local variables at.
413 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
414 first local allocated. Otherwise, it is the offset to the BEGINNING
415 of the first local allocated.
417 #define STARTING_FRAME_OFFSET 1
419 /* This is the default anyway:
420 #define DYNAMIC_CHAIN_ADDRESS(FRAMEADDR) FRAMEADDR
423 /* If we generate an insn to push BYTES bytes,
424 this says how many the stack pointer really advances by.
425 1750 note: what GCC calls a "byte" is really a 16-bit word,
426 because BITS_PER_UNIT is 16. */
428 #define PUSH_ROUNDING(BYTES) (BYTES)
430 /* Define this macro if functions should assume that stack space has
431 been allocated for arguments even when their values are passed in
433 Size, in bytes, of the area reserved for arguments passed in
434 registers for the function represented by FNDECL.
435 #define REG_PARM_STACK_SPACE(FNDECL) 14 */
437 /* Define this if it is the responsibility of the caller to allocate
438 the area reserved for arguments passed in registers.
439 #define OUTGOING_REG_PARM_STACK_SPACE */
441 /* Offset of first parameter from the argument pointer register value.
443 Parameters appear in reversed order on the frame (so when they are
444 popped, they come off in the normal left-to-right order.)
446 one word for the caller's (PC+1) (i.e. the return address)
447 plus total size of called function's "auto" variables
448 plus one word for the caller's frame pointer (i.e. the old FP) */
450 #define FIRST_PARM_OFFSET(FNDECL) \
451 (1 + get_frame_size() + 1)
453 /* Value is 1 if returning from a function call automatically
454 pops the arguments described by the number-of-args field in the call.
455 FUNDECL is the declaration node of the function (as a tree),
456 FUNTYPE is the data type of the function (as a tree),
457 or for a library call it is an identifier node for the subroutine name.
460 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
462 /* Define how to find the value returned by a function.
463 VALTYPE is the data type of the value (as a tree).
464 If the precise function being called is known, FUNC is its FUNCTION_DECL;
465 otherwise, FUNC is 0. */
467 #define FUNCTION_VALUE(VALTYPE, FUNC) \
468 gen_rtx_REG (TYPE_MODE (VALTYPE), 0)
470 /* Define how to find the value returned by a library function
471 assuming the value has mode MODE. */
472 /* 1750 note: no libcalls yet */
474 #define LIBCALL_VALUE(MODE) printf("LIBCALL_VALUE called!\n"), \
475 gen_rtx_REG (MODE, 0)
477 /* 1 if N is a possible register number for a function value. */
479 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
481 /* 1 if the tree TYPE should be returned in memory instead of in regs.
482 #define RETURN_IN_MEMORY(TYPE) \
483 (int_size_in_bytes(TYPE) > 12)
486 /* Define this if PCC uses the nonreentrant convention for returning
487 structure and union values.
488 #define PCC_STATIC_STRUCT_RETURN */
490 /* 1 if N is a possible register number for function argument passing. */
492 #define FUNCTION_ARG_REGNO_P(N) ((N) < 12)
494 /*****************************************************************************/
496 /* Define a data type for recording info about an argument list
497 during the scan of that argument list. This data type should
498 hold all necessary information about the function itself
499 and about the args processed so far, enough to enable macros
500 such as FUNCTION_ARG to determine where the next arg should go.
502 For 1750A, this is a single integer, which is a number of words
503 of arguments scanned so far. */
505 #define CUMULATIVE_ARGS int
507 /* Initialize a variable CUM of type CUMULATIVE_ARGS
508 for a call to a function whose data type is FNTYPE.
509 For a library call, FNTYPE is 0.
511 For 1750A, the offset starts at 0. */
513 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) ((CUM) = 0)
515 /* Update the data in CUM to advance over an argument
516 of mode MODE and data type TYPE.
517 (TYPE is null for libcalls where that information may not be available.)
519 1750 note: "int_size_in_bytes()" returns a unit relative to
520 BITS_PER_UNIT, so in our case not bytes, but 16-bit words. */
522 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
523 ((CUM) += (MODE) == BLKmode ? int_size_in_bytes(TYPE) : GET_MODE_SIZE(MODE))
525 /* Define where to put the arguments to a function.
526 Value is zero to push the argument on the stack,
527 or a hard register in which to store the argument.
529 MODE is the argument's machine mode.
530 TYPE is the data type of the argument (as a tree).
531 This is null for libcalls where that information may
533 CUM is a variable of type CUMULATIVE_ARGS which gives info about
534 the preceding args and about the function being called.
535 NAMED is nonzero if this argument is a named parameter
536 (otherwise it is an extra parameter matching an ellipsis). */
538 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) function_arg (CUM,MODE,TYPE,NAMED)
540 /* Define the following macro if function calls on the target machine
541 do not preserve any registers; in other words, if `CALL_USED_REGISTERS'
542 has 1 for all registers. This macro enables `-fcaller-saves' by
543 default. Eventually that option will be enabled by default on all
544 machines and both the option and this macro will be eliminated. */
546 #define DEFAULT_CALLER_SAVES
548 /************* 1750: PROFILER HANDLING NOT YET DONE !!!!!!! *************/
549 /* Output assembler code to FILE to increment profiler label # LABELNO
550 for profiling a function entry. */
552 #define FUNCTION_PROFILER(FILE, LABELNO) \
553 fprintf (FILE, "; got into FUNCTION_PROFILER with label # %d\n", (LABELNO))
555 /* Output assembler code to FILE to initialize this source file's
556 basic block profiling info, if that has not already been done. */
557 #define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
558 fprintf (FILE, "; got into FUNCTION_BLOCK_PROFILER with label # %d\n",LABELNO)
560 /* Output assembler code to FILE to increment the entry-count for
561 the BLOCKNO'th basic block in this source file. */
562 #define BLOCK_PROFILER(FILE, BLOCKNO) \
563 fprintf (FILE, "; got into BLOCK_PROFILER with block # %d\n",BLOCKNO)
565 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
566 the stack pointer does not matter. The value is tested only in
567 functions that have frame pointers.
568 No definition is equivalent to always zero. */
570 #define EXIT_IGNORE_STACK 0
572 /* If the memory address ADDR is relative to the frame pointer,
573 correct it to be relative to the stack pointer instead.
574 This is for when we don't use a frame pointer.
575 ADDR should be a variable name.
577 #define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH)
580 /* Store in the variable DEPTH the initial difference between the
581 frame pointer reg contents and the stack pointer reg contents,
582 as of the start of the function body. This depends on the layout
583 of the fixed parts of the stack frame and on how registers are saved.
584 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) DEPTH = 0
587 #define ELIMINABLE_REGS { \
588 { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
589 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }, \
590 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM } }
592 #define CAN_ELIMINATE(FROM, TO) 1
594 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
595 OFFSET = (TO == STACK_POINTER_REGNUM) ? -1 : 0
598 /* Output assembler code for a block containing the constant parts
599 of a trampoline, leaving space for the variable parts. */
601 #define TRAMPOLINE_TEMPLATE(FILE) fprintf(FILE,"TRAMPOLINE_TEMPLATE called\n")
603 /* Length in units of the trampoline for entering a nested function. */
605 #define TRAMPOLINE_SIZE 2
607 /* Emit RTL insns to initialize the variable parts of a trampoline.
608 FNADDR is an RTX for the address of the function's pure code.
609 CXT is an RTX for the static chain value for the function. */
611 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) printf("INITIALIZE_TRAMPO called\n")
613 emit_move_insn (gen_rtx_MEM (QImode, plus_constant (TRAMP, 1)), CXT); \
614 emit_move_insn (gen_rtx_MEM (QImode, plus_constant (TRAMP, 6)), FNADDR); \
618 /*****************************************************************************/
620 /* Addressing modes, and classification of registers for them. */
622 /* 1750 doesn't have a lot of auto-incr./decr. - just for the stack ptr. */
624 /* #define HAVE_POST_INCREMENT 0 just for R15 (stack pointer) */
625 /* #define HAVE_POST_DECREMENT 0 */
626 /* #define HAVE_PRE_DECREMENT 0 just for R15 (stack pointer) */
627 /* #define HAVE_PRE_INCREMENT 0 */
629 /* Macros to check register numbers against specific register classes. */
631 /* These assume that REGNO is a hard or pseudo reg number.
632 They give nonzero only if REGNO is a hard reg of the suitable class
633 or a pseudo reg currently allocated to a suitable hard reg.
634 Since they use reg_renumber, they are safe only once reg_renumber
635 has been allocated, which happens in local-alloc.c.
636 1750 note: The words BASE and INDEX are used in their GCC senses:
637 The "Index Registers", R12 through R15, are used in the 1750
638 instructions LB,STB,AB,SBB,MB,DB,LBX,STBX,...
641 #define REGNO_OK_FOR_BASE_P(REGNO) \
642 (((REGNO) > 0 && (REGNO) <= 15) || \
643 (reg_renumber[REGNO] > 0 && reg_renumber[REGNO] <= 15))
644 #define REGNO_OK_FOR_INDEX_P(REGNO) \
645 (((REGNO) >= 12 && (REGNO) <= 15) || \
646 (reg_renumber[REGNO] >= 12 && reg_renumber[REGNO] <= 15))
648 /* Now macros that check whether X is a register and also,
649 strictly, whether it is in a specified class. */
651 /* 1 if X is an address register */
653 #define ADDRESS_REG_P(X) (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X)))
655 /* Maximum number of registers that can appear in a valid memory address. */
656 #define MAX_REGS_PER_ADDRESS 1
658 /* Recognize any constant value that is a valid address. */
660 #define CONSTANT_ADDRESS_P(X) CONSTANT_P(X)
662 /* Nonzero if the constant value X is a legitimate general operand.
663 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
665 #define LEGITIMATE_CONSTANT_P(X) 1
667 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
668 and check its validity for a certain class.
669 We have two alternate definitions for each of them.
670 The usual definition accepts all pseudo regs; the other rejects
671 them unless they have been allocated suitable hard regs.
672 The symbol REG_OK_STRICT causes the latter definition to be used.
674 Most source files want to accept pseudo regs in the hope that
675 they will get allocated to the class that the insn wants them to be in.
676 Source files for reload pass need to be strict.
677 After reload, it makes no difference, since pseudo regs have
678 been eliminated by then. */
682 /* Nonzero if X is a hard reg that can be used as an index. */
683 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P(REGNO(X))
684 /* Nonzero if X is a hard reg that can be used as a base reg. */
685 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P(REGNO(X))
689 /* Nonzero if X is a hard reg that can be used as an index
690 or if it is a pseudo reg. */
691 #define REG_OK_FOR_INDEX_P(X) (REGNO (X) >= 12)
692 /* Nonzero if X is a hard reg that can be used as a base reg
693 or if it is a pseudo reg. */
694 #define REG_OK_FOR_BASE_P(X) (REGNO (X) > 0)
699 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
700 that is a valid memory address for an instruction.
701 The MODE argument is the machine mode for the MEM expression
702 that wants to use this address.
703 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS.
705 1750 note: Currently we don't implement address expressions that use
706 GCC "Index"-class regs. To be expanded to handle the 1750 "Base with Index"
707 instructions (see also MAX_REGS_PER_ADDRESS and others). */
709 #define GO_IF_BASED_ADDRESS(X, ADDR) { \
710 if ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P(X))) \
712 if (GET_CODE (X) == PLUS) \
713 { register rtx x0 = XEXP(X,0), x1 = XEXP(X,1); \
714 if ((REG_P(x0) && REG_OK_FOR_BASE_P(x0) && CONSTANT_ADDRESS_P(x1)) \
715 || (REG_P(x1) && REG_OK_FOR_BASE_P(x1) && CONSTANT_ADDRESS_P(x0))) \
718 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) { \
719 if (CONSTANT_ADDRESS_P(X)) goto ADDR; \
720 GO_IF_BASED_ADDRESS(X,ADDR) }
723 /* Try machine-dependent ways of modifying an illegitimate address
724 to be legitimate. If we find one, return the new, valid address.
725 This macro is used in only one place: `memory_address' in explow.c.
727 OLDX is the address as it was before break_out_memory_refs was called.
728 In some cases it is useful to look at this to decide what needs to be done.
730 MODE and WIN are passed so that this macro can use
731 GO_IF_LEGITIMATE_ADDRESS.
733 It is always safe for this macro to do nothing. It exists to recognize
734 opportunities to optimize the output. */
736 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)
738 /* Go to LABEL if ADDR (a legitimate address expression)
739 has an effect that depends on the machine mode it is used for.
740 On the 68000, only predecrement and postincrement address depend thus
741 (the amount of decrement or increment being the length of the operand). */
742 /* 1750: not used. */
744 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
746 /*****************************************************************************/
748 /* Specify the machine mode that this machine uses
749 for the index in the tablejump instruction. */
750 #define CASE_VECTOR_MODE QImode
752 /* Define as C expression which evaluates to nonzero if the tablejump
753 instruction expects the table to contain offsets from the address of the
755 Do not define this if the table should contain absolute addresses. */
756 /* #define CASE_VECTOR_PC_RELATIVE 1 */
758 /* Define this as 1 if `char' should by default be signed; else as 0. */
759 #define DEFAULT_SIGNED_CHAR 1
761 /* Max number of bytes we can move from memory to memory
762 in one reasonably fast instruction. */
763 #define MOVE_MAX 65536
765 /* If a memory-to-memory move would take MOVE_RATIO or more simple
766 move-instruction pairs, we will do a movstr or libcall instead. */
769 /* Nonzero if access to memory by bytes is slow and undesirable. */
770 #define SLOW_BYTE_ACCESS 0
772 /* Define if shifts truncate the shift count
773 which implies one can omit a sign-extension or zero-extension
775 /* #define SHIFT_COUNT_TRUNCATED 1 */
777 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
778 is done just by pretending it is already truncated. */
779 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
781 /* We assume that the store-condition-codes instructions store 0 for false
782 and some other value for true. This is the value stored for true. */
784 #define STORE_FLAG_VALUE 1
786 /* When a prototype says `char' or `short', really pass an `int'.
787 1750: for now, `char' is 16 bits wide anyway. */
788 #define PROMOTE_PROTOTYPES 0
790 /* Specify the machine mode that pointers have.
791 After generation of rtl, the compiler makes no further distinction
792 between pointers and any other objects of this machine mode. */
795 /* A function address in a call instruction
796 is a 16-bit address (for indexing purposes) */
797 #define FUNCTION_MODE QImode
799 /* Compute the cost of computing a constant rtl expression RTX
800 whose rtx-code is CODE. The body of this macro is a portion
801 of a switch statement. If the code is computed here,
802 return it with a return statement. Otherwise, break from the switch. */
804 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
806 return (INTVAL(RTX) >= -16 && INTVAL(RTX) <= 16) ? 1 : 3; \
814 #define ADDRESS_COST(ADDRESS) (memop_valid (ADDRESS) ? 3 : 10)
816 #define REGISTER_MOVE_COST(MODE,FROM,TO) 2
818 #define MEMORY_MOVE_COST(M,C,I) 4
820 /* Tell final.c how to eliminate redundant test instructions. */
822 /* Here we define machine-dependent flags and fields in cc_status
823 (see `conditions.h'). */
824 /* MIL-STD-1750: none -- just has the garden variety C,P,Z,N flags. */
826 /* Store in cc_status the expressions
827 that the condition codes will describe
828 after execution of an instruction whose pattern is EXP.
829 Do not alter them if the instruction would not alter the cc's.
830 1750: See file out-1750a.c for notice_update_cc(). */
832 #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP)
834 /**********************************************/
835 /* Produce debugging info in the DWARF format
836 #define DWARF_DEBUGGING_INFO
839 /*****************************************************************************/
841 /* Control the assembler format that we output. */
843 /* Output at beginning of assembler file. */
845 #define ASM_FILE_START(FILE) { \
846 char *p2, name[40]; \
848 if ((p = strrchr(main_input_filename,'/')) != NULL ? 1 : \
849 (p = strrchr(main_input_filename,']')) != NULL) \
852 p = main_input_filename; \
854 if ((p2 = strchr(name,'.'))) \
856 fprintf(FILE,"\tname %s\n",name); \
857 fprintf(FILE,"\tnolist\n\tinclude \"ms1750.inc\"\n\tlist\n\n"); \
858 fprintf(FILE,"\tglobal\t__main\n\n"); }
860 /* Output at end of assembler file.
861 For 1750, we copy the data labels accrued in datalbl[] from the Constants
862 section (Konst) to the Writable-Data section (Static). */
864 #define ASM_FILE_END(FILE) \
866 if (datalbl_ndx >= 0) { \
868 fprintf(FILE,"\n\tstatic\ninit_srel\n"); \
869 for (i = 0; i <= datalbl_ndx; i++) { \
870 if (datalbl[i].name == NULL) \
872 fprintf(stderr, "asm_file_end internal datalbl err\n"); \
875 fprintf(FILE,"%s \tblock %d\n", \
876 datalbl[i].name,datalbl[i].size); \
877 cum_size += datalbl[i].size; \
879 fprintf(FILE,"\n\tinit\n"); \
880 fprintf(FILE,"\tlim\tr0,init_srel\n"); /* destin. */ \
881 fprintf(FILE,"\tlim\tr1,%d\n",cum_size); /* count */ \
882 fprintf(FILE,"\tlim\tr2,K%s\n",datalbl[0].name); /* source */ \
883 fprintf(FILE,"\tmov\tr0,r2\n"); \
884 fprintf(FILE,"\n\tnormal\n"); \
885 datalbl_ndx = -1; /* reset stuff */ \
886 for (i = 0; i < DATALBL_ARRSIZ; i++) \
887 datalbl[i].size = 0; \
889 fprintf(FILE,"\n\tend\n"); \
892 /* Output to assembler file text saying following lines
893 may contain character constants, extra white space, comments, etc. */
895 #define ASM_APP_ON "; ASM_APP_ON\n"
897 /* Output to assembler file text saying following lines
898 no longer contain unusual constructs. */
900 #define ASM_APP_OFF "; ASM_APP_OFF\n"
903 #define EXTRA_SECTIONS in_readonly_data
905 #define EXTRA_SECTION_FUNCTIONS \
906 extern void const_section PARAMS ((void)); \
907 void const_section() \
909 fprintf(asm_out_file,"\tkonst\n"); \
910 current_section = Konst; \
912 void check_section(sect) \
915 if (current_section != sect) { \
916 fprintf(asm_out_file,"\t%s\n",sectname[(int)sect]); \
917 current_section = sect; \
922 in_section = in_text; \
925 in_section = in_data; \
928 in_section = in_readonly_data; \
934 /* Function that switches to the read-only data section (optional) */
935 #define READONLY_DATA_SECTION const_section
937 /* Output before program init section */
938 #define INIT_SECTION_ASM_OP "\n\tinit ; init_section\n"
940 /* Output before program text section */
941 #define TEXT_SECTION_ASM_OP "\n\tnormal ; text_section\n"
943 /* Output before writable data.
944 1750 Note: This is actually read-only data. The copying from read-only
945 to writable memory is done elsewhere (in ASM_FILE_END.)
947 #define DATA_SECTION_ASM_OP "\n\tkonst ; data_section\n"
949 /* How to refer to registers in assembler output.
950 This sequence is indexed by compiler's hard-register-number (see above). */
952 #define REGISTER_NAMES \
953 { "0", "1", "2", "3", "4", "5", "6", "7", \
954 "8", "9","10","11","12","13","14","15" }
956 /****************** Assembler output formatting **********************/
958 #define ASM_COMMENT_START ";"
960 #define ASM_OUTPUT_OPCODE(FILE,PTR) do { \
961 while (*(PTR) != '\0' && *(PTR) != ' ') { \
962 putc (*(PTR), FILE); \
965 while (*(PTR) == ' ') \
968 program_counter += 2; \
971 #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
972 fprintf(FILE,"%s\n",NAME)
974 /* This is how to output the definition of a user-level label named NAME,
975 such as the label on a static function or variable NAME. */
976 /* 1750 note: Labels are prefixed with a 'K'. This is because handling
977 has been changed for labels to be output in the "Constants" section
978 (named "Konst"), and special initialization code takes care of copying
979 the Const-section data into the writable data section (named "Static").
980 In the Static section we therefore have the true label names (i.e.
981 not prefixed with 'K'). */
983 #define ASM_OUTPUT_LABEL(FILE,NAME) \
984 do { if (NAME[0] == '.') { \
985 fprintf(stderr,"Oops! label %s can't begin with '.'\n",NAME); \
989 check_section(Konst); \
990 fprintf(FILE,"K%s\n",NAME); \
992 datalbl[++datalbl_ndx].name = (char *)xstrdup (NAME);\
993 datalbl[datalbl_ndx].size = 0; \
999 /* This is how to output a command to make the user-level label named NAME
1000 defined for reference from other files. */
1002 #define ASM_GLOBALIZE_LABEL(FILE,NAME) do { \
1003 fprintf (FILE, "\tglobal %s\t; export\n", NAME); \
1006 /* The prefix to add to user-visible assembler symbols. */
1008 #define USER_LABEL_PREFIX ""
1010 /* This is how to output an internal numbered label where
1011 PREFIX is the class of label and NUM is the number within the class. */
1013 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1015 if (strcmp(PREFIX,"LC") == 0) { \
1016 label_pending = 1; \
1017 datalbl[++datalbl_ndx].name = (char *) xmalloc (9);\
1018 sprintf(datalbl[datalbl_ndx].name,"LC%d",NUM); \
1019 datalbl[datalbl_ndx].size = 0; \
1020 check_section(Konst); \
1021 fprintf(FILE,"K%s%d\n",PREFIX,NUM); \
1023 else if (find_jmplbl(NUM) < 0) { \
1024 jmplbl[++jmplbl_ndx].num = NUM; \
1025 jmplbl[jmplbl_ndx].pc = program_counter; \
1026 fprintf(FILE, "%s%d\n", PREFIX, NUM); \
1032 /* This is how to store into the string LABEL
1033 the symbol_ref name of an internal numbered label where
1034 PREFIX is the class of label and NUM is the number within the class.
1035 This is suitable for output with `assemble_name'. */
1037 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1038 sprintf (LABEL, "%s%d", PREFIX, NUM)
1040 /* Output at the end of a jump table.
1041 1750: To be uncommented when we can put jump tables in Konst.
1042 #define ASM_OUTPUT_CASE_END(FILE,NUM,INSN) \
1043 fprintf (FILE, "\tnormal\t; case_end\n")
1046 /* Currently, it is not possible to put jump tables in section Konst.
1047 This is because there is a one-to-one relation between sections Konst
1048 and Static (i.e., all Konst data are copied to Static, and the order
1049 of data is the same between the two sections.) However, jump tables are
1050 not copied to Static, which destroys the equivalence between Konst and
1051 Static. When a more intelligent Konst-to-Static copying mechanism is
1052 implemented (i.e. one that excludes the copying of jumptables), then
1053 ASM_OUTPUT_CASE_END shall be defined, and JUMP_LABELS_IN_TEXT_SECTION
1054 shall be undefined. */
1056 #define JUMP_TABLES_IN_TEXT_SECTION 1
1058 /* This is how to output an assembler line defining a string constant. */
1060 #define ASM_OUTPUT_ASCII(FILE, PTR, LEN) do { \
1062 if (label_pending) \
1063 label_pending = 0; \
1064 datalbl[datalbl_ndx].size += LEN; \
1065 for (i = 0; i < (int) LEN; i++) { \
1066 if ((i % 15) == 0) { \
1068 fprintf(FILE,"\n"); \
1069 fprintf(FILE,"\tdata\t"); \
1072 fprintf(FILE,","); \
1073 if (PTR[i] >= 32 && PTR[i] < 127) \
1074 fprintf(FILE,"'%c'",PTR[i]); \
1076 fprintf(FILE,"%d",PTR[i]); \
1078 fprintf(FILE,"\n"); \
1081 /* This is how to output an insn to push a register on the stack.
1082 It need not be very fast code. */
1084 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1085 fprintf (FILE, "\tPSHM R%s,R%s\n", reg_names[REGNO], "FIXME: missing arg")
1087 /* This is how to output an insn to pop a register from the stack.
1088 It need not be very fast code. */
1090 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1091 fprintf (FILE, "\tPOPM R%s,R%s\n", reg_names[REGNO], "FIXME: missing arg")
1093 /* This is how to output an element of a case-vector that is absolute. */
1095 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1096 fprintf (FILE, "\tdata\tL%d ;addr_vec_elt\n", VALUE)
1098 /* This is how to output an element of a case-vector that is relative. */
1100 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1101 fprintf (FILE, "\tdata\tL%d-L%d ;addr_diff_elt\n", VALUE,REL)
1103 /* This is how to output an assembler line
1104 that says to advance the location counter
1105 to a multiple of 2**LOG bytes. */
1107 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1108 fprintf(FILE,"; in ASM_OUTPUT_ALIGN: pwr_of_2_bytcnt=%d\n",LOG)
1110 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1111 fprintf(FILE,"; in ASM_OUTPUT_SKIP: size=%d\n",SIZE)
1113 /* This says how to output an assembler line
1114 to define a global common symbol. */
1116 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) do { \
1117 check_section(Static); \
1118 fprintf (FILE, "\tcommon %s,%d\n", NAME, SIZE); \
1121 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) do { \
1122 fprintf (FILE, "\tglobal %s\t; import\n", NAME); \
1125 /* This says how to output an assembler line
1126 to define a local common symbol. */
1128 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) do { \
1129 check_section (Static); \
1130 fprintf(FILE,"%s \tblock %d\t; local common\n",NAME,SIZE); \
1133 /* Store in OUTPUT a string (made with alloca) containing
1134 an assembler-name for a local static variable named NAME.
1135 LABELNO is an integer which is different for each call. */
1137 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1138 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1139 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1141 /* Print operand X (an rtx) in assembler syntax to file FILE.
1142 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1143 For `%' followed by punctuation, CODE is the punctuation and X is null.
1144 1750 note: there are three special CODE characters:
1145 'D', 'E': print a reference to a floating point constant (D=double,
1146 E=single precision) label name
1147 'F': print a label defining a floating-point constant value
1148 'J': print the absolute value of a negative INT_CONST
1149 (this is used in LISN/CISN/MISN/SISP and others)
1150 'Q': print a 1750 Base-Register-with-offset instruction's operands
1153 #define PRINT_OPERAND(FILE, X, CODE) print_operand(FILE,X,CODE)
1154 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address(FILE,ADDR)
1156 /* Convert a REAL_VALUE_TYPE to the target 1750a float format. */
1157 #define REAL_VALUE_TO_TARGET_SINGLE(IN, OUT) \
1158 ((OUT) = real_value_to_target_single(IN))
1160 /* Convert a REAL_VALUE_TYPE to the target 1750a extended float format. */
1161 #define REAL_VALUE_TO_TARGET_DOUBLE(IN, OUT) \
1162 real_value_to_target_double((IN), (OUT))