OSDN Git Service

gcc/
[pf3gnuchains/gcc-fork.git] / gcc / config / pdp11 / pdp11.h
1 /* Definitions of target machine for GNU compiler, for the pdp-11
2    Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2004, 2005
3    Free Software Foundation, Inc.
4    Contributed by Michael K. Gschwind (mike@vlsivie.tuwien.ac.at).
5
6 This file is part of GCC.
7
8 GCC 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.
12
13 GCC 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.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA.  */
22
23 #define CONSTANT_POOL_BEFORE_FUNCTION   0
24
25 /* check whether load_fpu_reg or not */
26 #define LOAD_FPU_REG_P(x) ((x)>=8 && (x)<=11)
27 #define NO_LOAD_FPU_REG_P(x) ((x)==12 || (x)==13)
28 #define FPU_REG_P(x)    (LOAD_FPU_REG_P(x) || NO_LOAD_FPU_REG_P(x))
29 #define CPU_REG_P(x)    ((x)<8)
30
31 /* Names to predefine in the preprocessor for this target machine.  */
32
33 #define TARGET_CPU_CPP_BUILTINS()               \
34   do                                            \
35     {                                           \
36       builtin_define_std ("pdp11");             \
37     }                                           \
38   while (0)
39
40 /* Print subsidiary information on the compiler version in use.  */
41 #define TARGET_VERSION fprintf (stderr, " (pdp11)");
42
43
44 /* Generate DBX debugging information.  */
45
46 /* #define DBX_DEBUGGING_INFO */
47
48 #define TARGET_40_PLUS          (TARGET_40 || TARGET_45)
49 #define TARGET_10               (! TARGET_40_PLUS)
50
51 #define TARGET_UNIX_ASM_DEFAULT 0
52
53 #define ASSEMBLER_DIALECT       (TARGET_UNIX_ASM ? 1 : 0)
54
55 \f
56
57 /* TYPE SIZES */
58 #define SHORT_TYPE_SIZE         16
59 #define INT_TYPE_SIZE           (TARGET_INT16 ? 16 : 32)
60 #define LONG_TYPE_SIZE          32
61 #define LONG_LONG_TYPE_SIZE     64     
62
63 /* if we set FLOAT_TYPE_SIZE to 32, we could have the benefit 
64    of saving core for huge arrays - the definitions are 
65    already in md - but floats can never reside in 
66    an FPU register - we keep the FPU in double float mode 
67    all the time !! */
68 #define FLOAT_TYPE_SIZE         (TARGET_FLOAT32 ? 32 : 64)
69 #define DOUBLE_TYPE_SIZE        64
70 #define LONG_DOUBLE_TYPE_SIZE   64
71
72 /* machine types from ansi */
73 #define SIZE_TYPE "unsigned int"        /* definition of size_t */
74 #define WCHAR_TYPE "int"                /* or long int???? */
75 #define WCHAR_TYPE_SIZE 16
76
77 #define PTRDIFF_TYPE "int"
78
79 /* target machine storage layout */
80
81 /* Define this if most significant bit is lowest numbered
82    in instructions that operate on numbered bit-fields.  */
83 #define BITS_BIG_ENDIAN 0
84
85 /* Define this if most significant byte of a word is the lowest numbered.  */
86 #define BYTES_BIG_ENDIAN 0
87
88 /* Define this if most significant word of a multiword number is first.  */
89 #define WORDS_BIG_ENDIAN 1
90
91 /* Define that floats are in VAX order, not high word first as for ints.  */
92 #define FLOAT_WORDS_BIG_ENDIAN 0
93
94 /* Width of a word, in units (bytes). 
95
96    UNITS OR BYTES - seems like units */
97 #define UNITS_PER_WORD 2
98
99 /* This machine doesn't use IEEE floats.  */
100 /* Because the pdp11 (at least Unix) convention for 32 bit ints is
101    big endian, opposite for what you need for float, the vax float
102    conversion routines aren't actually used directly.  But the underlying
103    format is indeed the vax/pdp11 float format.  */
104 #define TARGET_FLOAT_FORMAT VAX_FLOAT_FORMAT
105
106 extern const struct real_format pdp11_f_format;
107 extern const struct real_format pdp11_d_format;
108
109 /* Maximum sized of reasonable data type 
110    DImode or Dfmode ...*/
111 #define MAX_FIXED_MODE_SIZE 64  
112
113 /* Allocation boundary (in *bits*) for storing pointers in memory.  */
114 #define POINTER_BOUNDARY 16
115
116 /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
117 #define PARM_BOUNDARY 16
118
119 /* Boundary (in *bits*) on which stack pointer should be aligned.  */
120 #define STACK_BOUNDARY 16
121
122 /* Allocation boundary (in *bits*) for the code of a function.  */
123 #define FUNCTION_BOUNDARY 16
124
125 /* Alignment of field after `int : 0' in a structure.  */
126 #define EMPTY_FIELD_BOUNDARY 16
127
128 /* No data type wants to be aligned rounder than this.  */
129 #define BIGGEST_ALIGNMENT 16
130
131 /* Define this if move instructions will actually fail to work
132    when given unaligned data.  */
133 #define STRICT_ALIGNMENT 1
134 \f
135 /* Standard register usage.  */
136
137 /* Number of actual hardware registers.
138    The hardware registers are assigned numbers for the compiler
139    from 0 to just below FIRST_PSEUDO_REGISTER.
140    All registers that the compiler knows about must be given numbers,
141    even those that are not normally considered general registers.
142
143    we have 8 integer registers, plus 6 float 
144    (don't use scratch float !) */
145
146 #define FIRST_PSEUDO_REGISTER 14
147
148 /* 1 for registers that have pervasive standard uses
149    and are not available for the register allocator.
150
151    On the pdp, these are:
152    Reg 7        = pc;
153    reg 6        = sp;
154    reg 5        = fp;  not necessarily! 
155 */
156
157 /* don't let them touch fp regs for the time being !*/
158
159 #define FIXED_REGISTERS  \
160 {0, 0, 0, 0, 0, 0, 1, 1, \
161  0, 0, 0, 0, 0, 0     }
162
163
164
165 /* 1 for registers not available across function calls.
166    These must include the FIXED_REGISTERS and also any
167    registers that can be used without being saved.
168    The latter must include the registers where values are returned
169    and the register where structure-value addresses are passed.
170    Aside from that, you can include as many other registers as you like.  */
171
172 /* don't know about fp */
173 #define CALL_USED_REGISTERS  \
174 {1, 1, 0, 0, 0, 0, 1, 1, \
175  0, 0, 0, 0, 0, 0 }
176
177
178 /* Make sure everything's fine if we *don't* have an FPU.
179    This assumes that putting a register in fixed_regs will keep the
180    compiler's mitts completely off it.  We don't bother to zero it out
181    of register classes.  Also fix incompatible register naming with
182    the UNIX assembler.
183 */
184 #define CONDITIONAL_REGISTER_USAGE \
185 {                                               \
186   int i;                                        \
187   HARD_REG_SET x;                               \
188   if (!TARGET_FPU)                              \
189     {                                           \
190       COPY_HARD_REG_SET (x, reg_class_contents[(int)FPU_REGS]); \
191       for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
192        if (TEST_HARD_REG_BIT (x, i))            \
193         fixed_regs[i] = call_used_regs[i] = 1;  \
194     }                                           \
195                                                 \
196   if (TARGET_AC0)                               \
197       call_used_regs[8] = 1;                    \
198   if (TARGET_UNIX_ASM)                          \
199     {                                           \
200       /* Change names of FPU registers for the UNIX assembler.  */ \
201       reg_names[8] = "fr0";                     \
202       reg_names[9] = "fr1";                     \
203       reg_names[10] = "fr2";                    \
204       reg_names[11] = "fr3";                    \
205       reg_names[12] = "fr4";                    \
206       reg_names[13] = "fr5";                    \
207     }                                           \
208 }
209
210 /* Return number of consecutive hard regs needed starting at reg REGNO
211    to hold something of mode MODE.
212    This is ordinarily the length in words of a value of mode MODE
213    but can be less for certain modes in special long registers.
214 */
215
216 #define HARD_REGNO_NREGS(REGNO, MODE)   \
217 ((REGNO < 8)?                                                           \
218     ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)      \
219     :1)
220     
221
222 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
223    On the pdp, the cpu registers can hold any mode - check alignment
224
225    FPU can only hold DF - simplifies life!
226 */
227 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
228 (((REGNO) < 8)?                                         \
229   ((GET_MODE_BITSIZE(MODE) <= 16)                       \
230    || (GET_MODE_BITSIZE(MODE) == 32 && !((REGNO) & 1))) \
231   :(MODE) == DFmode)
232     
233
234 /* Value is 1 if it is a good idea to tie two pseudo registers
235    when one has mode MODE1 and one has mode MODE2.
236    If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
237    for any hard reg, then this must be 0 for correct output.  */
238 #define MODES_TIEABLE_P(MODE1, MODE2) 0
239
240 /* Specify the registers used for certain standard purposes.
241    The values of these macros are register numbers.  */
242
243 /* the pdp11 pc overloaded on a register that the compiler knows about.  */
244 #define PC_REGNUM  7
245
246 /* Register to use for pushing function arguments.  */
247 #define STACK_POINTER_REGNUM 6
248
249 /* Base register for access to local variables of the function.  */
250 #define FRAME_POINTER_REGNUM 5
251
252 /* Value should be nonzero if functions must have frame pointers.
253    Zero means the frame pointer need not be set up (and parms
254    may be accessed via the stack pointer) in functions that seem suitable.
255    This is computed in `reload', in reload1.c.
256   */
257
258 #define FRAME_POINTER_REQUIRED 0
259
260 /* Base register for access to arguments of the function.  */
261 #define ARG_POINTER_REGNUM 5
262
263 /* Register in which static-chain is passed to a function.  */
264 /* ??? - i don't want to give up a reg for this! */
265 #define STATIC_CHAIN_REGNUM 4
266 \f
267 /* Define the classes of registers for register constraints in the
268    machine description.  Also define ranges of constants.
269
270    One of the classes must always be named ALL_REGS and include all hard regs.
271    If there is more than one class, another class must be named NO_REGS
272    and contain no registers.
273
274    The name GENERAL_REGS must be the name of a class (or an alias for
275    another name such as ALL_REGS).  This is the class of registers
276    that is allowed by "g" or "r" in a register constraint.
277    Also, registers outside this class are allocated only when
278    instructions express preferences for them.
279
280    The classes must be numbered in nondecreasing order; that is,
281    a larger-numbered class must never be contained completely
282    in a smaller-numbered class.
283
284    For any two classes, it is very desirable that there be another
285    class that represents their union.  */
286    
287 /* The pdp has a couple of classes:
288
289 MUL_REGS are used for odd numbered regs, to use in 16 bit multiplication
290          (even numbered do 32 bit multiply)
291 LMUL_REGS long multiply registers (even numbered regs )
292           (don't need them, all 32 bit regs are even numbered!)
293 GENERAL_REGS is all cpu
294 LOAD_FPU_REGS is the first four cpu regs, they are easier to load
295 NO_LOAD_FPU_REGS is ac4 and ac5, currently - difficult to load them
296 FPU_REGS is all fpu regs 
297 */
298
299 enum reg_class { NO_REGS, MUL_REGS, GENERAL_REGS, LOAD_FPU_REGS, NO_LOAD_FPU_REGS, FPU_REGS, ALL_REGS, LIM_REG_CLASSES };
300
301 #define N_REG_CLASSES (int) LIM_REG_CLASSES
302
303 /* have to allow this till cmpsi/tstsi are fixed in a better way !! */
304 #define SMALL_REGISTER_CLASSES 1
305
306 /* Since GENERAL_REGS is the same class as ALL_REGS,
307    don't give it a different class number; just make it an alias.  */
308
309 /* #define GENERAL_REGS ALL_REGS */
310
311 /* Give names of register classes as strings for dump file.  */
312
313 #define REG_CLASS_NAMES {"NO_REGS", "MUL_REGS", "GENERAL_REGS", "LOAD_FPU_REGS", "NO_LOAD_FPU_REGS", "FPU_REGS", "ALL_REGS" }
314
315 /* Define which registers fit in which classes.
316    This is an initializer for a vector of HARD_REG_SET
317    of length N_REG_CLASSES.  */
318
319 #define REG_CLASS_CONTENTS {{0}, {0x00aa}, {0x00ff}, {0x0f00}, {0x3000}, {0x3f00}, {0x3fff}}
320
321 /* The same information, inverted:
322    Return the class number of the smallest class containing
323    reg number REGNO.  This could be a conditional expression
324    or could index an array.  */
325
326 #define REGNO_REG_CLASS(REGNO)          \
327 ((REGNO)>=8?((REGNO)<=11?LOAD_FPU_REGS:NO_LOAD_FPU_REGS):(((REGNO)&1)?MUL_REGS:GENERAL_REGS))
328
329
330 /* The class value for index registers, and the one for base regs.  */
331 #define INDEX_REG_CLASS GENERAL_REGS
332 #define BASE_REG_CLASS GENERAL_REGS
333
334 /* Get reg_class from a letter such as appears in the machine description.  */
335
336 #define REG_CLASS_FROM_LETTER(C)        \
337 ((C) == 'f' ? FPU_REGS :                        \
338   ((C) == 'd' ? MUL_REGS :                      \
339    ((C) == 'a' ? LOAD_FPU_REGS : NO_REGS)))
340     
341
342 /* The letters I, J, K, L and M in a register constraint string
343    can be used to stand for particular ranges of immediate operands.
344    This macro defines what the ranges are.
345    C is the letter, and VALUE is a constant value.
346    Return 1 if VALUE is in the range specified by C.
347
348    I            bits 31-16 0000
349    J            bits 15-00 0000
350    K            completely random 32 bit
351    L,M,N        -1,1,0 respectively
352    O            where doing shifts in sequence is faster than 
353                 one big shift 
354 */
355
356 #define CONST_OK_FOR_LETTER_P(VALUE, C)  \
357   ((C) == 'I' ? ((VALUE) & 0xffff0000) == 0             \
358    : (C) == 'J' ? ((VALUE) & 0x0000ffff) == 0           \
359    : (C) == 'K' ? (((VALUE) & 0xffff0000) != 0          \
360                    && ((VALUE) & 0x0000ffff) != 0)      \
361    : (C) == 'L' ? ((VALUE) == 1)                        \
362    : (C) == 'M' ? ((VALUE) == -1)                       \
363    : (C) == 'N' ? ((VALUE) == 0)                        \
364    : (C) == 'O' ? (abs(VALUE) >1 && abs(VALUE) <= 4)            \
365    : 0)
366
367 /* Similar, but for floating constants, and defining letters G and H.
368    Here VALUE is the CONST_DOUBLE rtx itself.  */
369
370 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)  \
371   ((C) == 'G' && XINT (VALUE, 0) == 0 && XINT (VALUE, 1) == 0)
372
373
374 /* Letters in the range `Q' through `U' may be defined in a
375    machine-dependent fashion to stand for arbitrary operand types. 
376    The machine description macro `EXTRA_CONSTRAINT' is passed the
377    operand as its first argument and the constraint letter as its
378    second operand.
379
380    `Q'  is for memory references that require an extra word after the opcode.
381    `R'  is for memory references which are encoded within the opcode.  */
382
383 #define EXTRA_CONSTRAINT(OP,CODE)                                       \
384   ((GET_CODE (OP) != MEM) ? 0                                           \
385    : !legitimate_address_p (GET_MODE (OP), XEXP (OP, 0)) ? 0            \
386    : ((CODE) == 'Q')      ? !simple_memory_operand (OP, GET_MODE (OP))  \
387    : ((CODE) == 'R')      ? simple_memory_operand (OP, GET_MODE (OP))   \
388    : 0)
389
390 /* Given an rtx X being reloaded into a reg required to be
391    in class CLASS, return the class of reg to actually use.
392    In general this is just CLASS; but on some machines
393    in some cases it is preferable to use a more restrictive class.  
394
395 loading is easier into LOAD_FPU_REGS than FPU_REGS! */
396
397 #define PREFERRED_RELOAD_CLASS(X,CLASS)         \
398 (((CLASS) != FPU_REGS)?(CLASS):LOAD_FPU_REGS)
399
400 #define SECONDARY_RELOAD_CLASS(CLASS,MODE,x)    \
401 (((CLASS) == NO_LOAD_FPU_REGS && !(REG_P(x) && LOAD_FPU_REG_P(REGNO(x))))?LOAD_FPU_REGS:NO_REGS)
402
403 /* Return the maximum number of consecutive registers
404    needed to represent mode MODE in a register of class CLASS.  */
405 #define CLASS_MAX_NREGS(CLASS, MODE)    \
406 ((CLASS == GENERAL_REGS || CLASS == MUL_REGS)?                          \
407   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD):       \
408   1                                                                     \
409 )
410
411 \f
412 /* Stack layout; function entry, exit and calling.  */
413
414 /* Define this if pushing a word on the stack
415    makes the stack pointer a smaller address.  */
416 #define STACK_GROWS_DOWNWARD
417
418 /* Define this to nonzero if the nominal address of the stack frame
419    is at the high-address end of the local variables;
420    that is, each additional local variable allocated
421    goes at a more negative offset in the frame.
422 */
423 #define FRAME_GROWS_DOWNWARD 1
424
425 /* Offset within stack frame to start allocating local variables at.
426    If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
427    first local allocated.  Otherwise, it is the offset to the BEGINNING
428    of the first local allocated.  */
429 #define STARTING_FRAME_OFFSET 0
430
431 /* If we generate an insn to push BYTES bytes,
432    this says how many the stack pointer really advances by.
433    On the pdp11, the stack is on an even boundary */
434 #define PUSH_ROUNDING(BYTES) ((BYTES + 1) & ~1)
435
436 /* current_first_parm_offset stores the # of registers pushed on the 
437    stack */
438 extern int current_first_parm_offset;
439
440 /* Offset of first parameter from the argument pointer register value.  
441    For the pdp11, this is nonzero to account for the return address.
442         1 - return address
443         2 - frame pointer (always saved, even when not used!!!!)
444                 -- chnage some day !!!:q!
445
446 */
447 #define FIRST_PARM_OFFSET(FNDECL) 4
448
449 /* Value is 1 if returning from a function call automatically
450    pops the arguments described by the number-of-args field in the call.
451    FUNDECL is the declaration node of the function (as a tree),
452    FUNTYPE is the data type of the function (as a tree),
453    or for a library call it is an identifier node for the subroutine name.  */
454
455 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
456
457 /* Define how to find the value returned by a function.
458    VALTYPE is the data type of the value (as a tree).
459    If the precise function being called is known, FUNC is its FUNCTION_DECL;
460    otherwise, FUNC is 0.  */
461 #define BASE_RETURN_VALUE_REG(MODE) \
462  ((MODE) == DFmode ? 8 : 0) 
463
464 /* On the pdp11 the value is found in R0 (or ac0??? 
465 not without FPU!!!! ) */
466
467 #define FUNCTION_VALUE(VALTYPE, FUNC)  \
468   gen_rtx_REG (TYPE_MODE (VALTYPE), BASE_RETURN_VALUE_REG(TYPE_MODE(VALTYPE)))
469
470 /* and the called function leaves it in the first register.
471    Difference only on machines with register windows.  */
472
473 #define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC)  \
474   gen_rtx_REG (TYPE_MODE (VALTYPE), BASE_RETURN_VALUE_REG(TYPE_MODE(VALTYPE)))
475
476 /* Define how to find the value returned by a library function
477    assuming the value has mode MODE.  */
478
479 #define LIBCALL_VALUE(MODE)  gen_rtx_REG (MODE, BASE_RETURN_VALUE_REG(MODE))
480
481 /* 1 if N is a possible register number for a function value
482    as seen by the caller.
483    On the pdp, the first "output" reg is the only register thus used. 
484
485 maybe ac0 ? - as option someday! */
486
487 #define FUNCTION_VALUE_REGNO_P(N) (((N) == 0) || (TARGET_AC0 && (N) == 8))
488
489 /* 1 if N is a possible register number for function argument passing.
490    - not used on pdp */
491
492 #define FUNCTION_ARG_REGNO_P(N) 0
493 \f
494 /* Define a data type for recording info about an argument list
495    during the scan of that argument list.  This data type should
496    hold all necessary information about the function itself
497    and about the args processed so far, enough to enable macros
498    such as FUNCTION_ARG to determine where the next arg should go.
499
500 */
501
502 #define CUMULATIVE_ARGS int
503
504 /* Initialize a variable CUM of type CUMULATIVE_ARGS
505    for a call to a function whose data type is FNTYPE.
506    For a library call, FNTYPE is 0.
507
508    ...., the offset normally starts at 0, but starts at 1 word
509    when the function gets a structure-value-address as an
510    invisible first argument.  */
511
512 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
513  ((CUM) = 0)
514
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.)  
518
519 */
520
521
522 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)    \
523  ((CUM) += ((MODE) != BLKmode                   \
524             ? (GET_MODE_SIZE (MODE))            \
525             : (int_size_in_bytes (TYPE))))      
526
527 /* Determine where to put an argument to a function.
528    Value is zero to push the argument on the stack,
529    or a hard register in which to store the argument.
530
531    MODE is the argument's machine mode.
532    TYPE is the data type of the argument (as a tree).
533     This is null for libcalls where that information may
534     not be available.
535    CUM is a variable of type CUMULATIVE_ARGS which gives info about
536     the preceding args and about the function being called.
537    NAMED is nonzero if this argument is a named parameter
538     (otherwise it is an extra parameter matching an ellipsis).  */
539
540 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED)  0
541
542 /* Define where a function finds its arguments.
543    This would be different from FUNCTION_ARG if we had register windows.  */
544 /*
545 #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED)   \
546   FUNCTION_ARG (CUM, MODE, TYPE, NAMED)
547 */
548
549 /* Output assembler code to FILE to increment profiler label # LABELNO
550    for profiling a function entry.  */
551
552 #define FUNCTION_PROFILER(FILE, LABELNO)  \
553    gcc_unreachable ();
554
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.  */
559
560 extern int may_call_alloca;
561
562 #define EXIT_IGNORE_STACK       1
563
564 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH_VAR) \
565 {                                                               \
566   int offset, regno;                                            \
567   offset = get_frame_size();                                    \
568   for (regno = 0; regno < 8; regno++)                           \
569     if (regs_ever_live[regno] && ! call_used_regs[regno])       \
570       offset += 2;                                              \
571   for (regno = 8; regno < 14; regno++)                          \
572     if (regs_ever_live[regno] && ! call_used_regs[regno])       \
573       offset += 8;                                              \
574   /* offset -= 2;   no fp on stack frame */                     \
575   (DEPTH_VAR) = offset;                                         \
576 }   
577     
578 \f
579 /* Addressing modes, and classification of registers for them.  */
580
581 #define HAVE_POST_INCREMENT 1
582
583 #define HAVE_PRE_DECREMENT 1
584
585 /* Macros to check register numbers against specific register classes.  */
586
587 /* These assume that REGNO is a hard or pseudo reg number.
588    They give nonzero only if REGNO is a hard reg of the suitable class
589    or a pseudo reg currently allocated to a suitable hard reg.
590    Since they use reg_renumber, they are safe only once reg_renumber
591    has been allocated, which happens in local-alloc.c.  */
592
593 #define REGNO_OK_FOR_INDEX_P(REGNO) \
594   ((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
595 #define REGNO_OK_FOR_BASE_P(REGNO)  \
596   ((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
597
598 /* Now macros that check whether X is a register and also,
599    strictly, whether it is in a specified class.
600 */
601
602
603 \f
604 /* Maximum number of registers that can appear in a valid memory address.  */
605
606 #define MAX_REGS_PER_ADDRESS 1
607
608 /* Recognize any constant value that is a valid address.  */
609
610 #define CONSTANT_ADDRESS_P(X)  CONSTANT_P (X)
611
612 /* Nonzero if the constant value X is a legitimate general operand.
613    It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
614
615 #define LEGITIMATE_CONSTANT_P(X)                                        \
616   (GET_CODE (X) != CONST_DOUBLE || legitimate_const_double_p (X))
617
618 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
619    and check its validity for a certain class.
620    We have two alternate definitions for each of them.
621    The usual definition accepts all pseudo regs; the other rejects
622    them unless they have been allocated suitable hard regs.
623    The symbol REG_OK_STRICT causes the latter definition to be used.
624
625    Most source files want to accept pseudo regs in the hope that
626    they will get allocated to the class that the insn wants them to be in.
627    Source files for reload pass need to be strict.
628    After reload, it makes no difference, since pseudo regs have
629    been eliminated by then.  */
630
631 #ifndef REG_OK_STRICT
632
633 /* Nonzero if X is a hard reg that can be used as an index
634    or if it is a pseudo reg.  */
635 #define REG_OK_FOR_INDEX_P(X) (1)
636 /* Nonzero if X is a hard reg that can be used as a base reg
637    or if it is a pseudo reg.  */
638 #define REG_OK_FOR_BASE_P(X) (1)
639
640 #else
641
642 /* Nonzero if X is a hard reg that can be used as an index.  */
643 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
644 /* Nonzero if X is a hard reg that can be used as a base reg.  */
645 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
646
647 #endif
648 \f
649 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
650    that is a valid memory address for an instruction.
651    The MODE argument is the machine mode for the MEM expression
652    that wants to use this address.
653
654 */
655
656 #define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR) \
657 {                                                     \
658     rtx xfoob;                                                          \
659                                                                         \
660     /* accept (R0) */                                                   \
661     if (GET_CODE (operand) == REG                                       \
662         && REG_OK_FOR_BASE_P(operand))                                  \
663       goto ADDR;                                                        \
664                                                                         \
665     /* accept @#address */                                              \
666     if (CONSTANT_ADDRESS_P (operand))                                   \
667       goto ADDR;                                                        \
668                                                                         \
669     /* accept X(R0) */                                                  \
670     if (GET_CODE (operand) == PLUS                                      \
671         && GET_CODE (XEXP (operand, 0)) == REG                          \
672         && REG_OK_FOR_BASE_P (XEXP (operand, 0))                        \
673         && CONSTANT_ADDRESS_P (XEXP (operand, 1)))                      \
674       goto ADDR;                                                        \
675                                                                         \
676     /* accept -(R0) */                                                  \
677     if (GET_CODE (operand) == PRE_DEC                                   \
678         && GET_CODE (XEXP (operand, 0)) == REG                          \
679         && REG_OK_FOR_BASE_P (XEXP (operand, 0)))                       \
680       goto ADDR;                                                        \
681                                                                         \
682     /* accept (R0)+ */                                                  \
683     if (GET_CODE (operand) == POST_INC                                  \
684         && GET_CODE (XEXP (operand, 0)) == REG                          \
685         && REG_OK_FOR_BASE_P (XEXP (operand, 0)))                       \
686       goto ADDR;                                                        \
687                                                                         \
688     /* accept -(SP) -- which uses PRE_MODIFY for byte mode */           \
689     if (GET_CODE (operand) == PRE_MODIFY                                \
690         && GET_CODE (XEXP (operand, 0)) == REG                          \
691         && REGNO (XEXP (operand, 0)) == 6                               \
692         && GET_CODE ((xfoob = XEXP (operand, 1))) == PLUS               \
693         && GET_CODE (XEXP (xfoob, 0)) == REG                            \
694         && REGNO (XEXP (xfoob, 0)) == 6                                 \
695         && CONSTANT_P (XEXP (xfoob, 1))                                 \
696         && INTVAL (XEXP (xfoob,1)) == -2)                               \
697       goto ADDR;                                                        \
698                                                                         \
699     /* accept (SP)+ -- which uses POST_MODIFY for byte mode */          \
700     if (GET_CODE (operand) == POST_MODIFY                               \
701         && GET_CODE (XEXP (operand, 0)) == REG                          \
702         && REGNO (XEXP (operand, 0)) == 6                               \
703         && GET_CODE ((xfoob = XEXP (operand, 1))) == PLUS               \
704         && GET_CODE (XEXP (xfoob, 0)) == REG                            \
705         && REGNO (XEXP (xfoob, 0)) == 6                                 \
706         && CONSTANT_P (XEXP (xfoob, 1))                                 \
707         && INTVAL (XEXP (xfoob,1)) == 2)                                \
708       goto ADDR;                                                        \
709                                                                         \
710                                                                         \
711     /* handle another level of indirection ! */                         \
712     if (GET_CODE(operand) != MEM)                                       \
713       goto fail;                                                        \
714                                                                         \
715     xfoob = XEXP (operand, 0);                                          \
716                                                                         \
717     /* (MEM:xx (MEM:xx ())) is not valid for SI, DI and currently */    \
718     /* also forbidden for float, because we have to handle this */      \
719     /* in output_move_double and/or output_move_quad() - we could */    \
720     /* do it, but currently it's not worth it!!! */                     \
721     /* now that DFmode cannot go into CPU register file, */             \
722     /* maybe I should allow float ... */                                \
723     /*  but then I have to handle memory-to-memory moves in movdf ?? */ \
724                                                                         \
725     if (GET_MODE_BITSIZE(mode) > 16)                                    \
726       goto fail;                                                        \
727                                                                         \
728     /* accept @(R0) - which is @0(R0) */                                \
729     if (GET_CODE (xfoob) == REG                                         \
730         && REG_OK_FOR_BASE_P(xfoob))                                    \
731       goto ADDR;                                                        \
732                                                                         \
733     /* accept @address */                                               \
734     if (CONSTANT_ADDRESS_P (xfoob))                                     \
735       goto ADDR;                                                        \
736                                                                         \
737     /* accept @X(R0) */                                                 \
738     if (GET_CODE (xfoob) == PLUS                                        \
739         && GET_CODE (XEXP (xfoob, 0)) == REG                            \
740         && REG_OK_FOR_BASE_P (XEXP (xfoob, 0))                          \
741         && CONSTANT_ADDRESS_P (XEXP (xfoob, 1)))                        \
742       goto ADDR;                                                        \
743                                                                         \
744     /* accept @-(R0) */                                                 \
745     if (GET_CODE (xfoob) == PRE_DEC                                     \
746         && GET_CODE (XEXP (xfoob, 0)) == REG                            \
747         && REG_OK_FOR_BASE_P (XEXP (xfoob, 0)))                         \
748       goto ADDR;                                                        \
749                                                                         \
750     /* accept @(R0)+ */                                                 \
751     if (GET_CODE (xfoob) == POST_INC                                    \
752         && GET_CODE (XEXP (xfoob, 0)) == REG                            \
753         && REG_OK_FOR_BASE_P (XEXP (xfoob, 0)))                         \
754       goto ADDR;                                                        \
755                                                                         \
756   /* anything else is invalid */                                        \
757   fail: ;                                                               \
758 }
759
760 \f
761 /* Go to LABEL if ADDR (a legitimate address expression)
762    has an effect that depends on the machine mode it is used for.
763    On the pdp this is for predec/postinc, and this is now treated
764    generically in recog.c.  */
765
766 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
767
768 \f
769 /* Specify the machine mode that this machine uses
770    for the index in the tablejump instruction.  */
771 #define CASE_VECTOR_MODE HImode
772
773 /* Define this if a raw index is all that is needed for a
774    `tablejump' insn.  */
775 #define CASE_TAKES_INDEX_RAW
776
777 /* Define this as 1 if `char' should by default be signed; else as 0.  */
778 #define DEFAULT_SIGNED_CHAR 1
779
780 /* Max number of bytes we can move from memory to memory
781    in one reasonably fast instruction.  
782 */
783
784 #define MOVE_MAX 2
785
786 /* Nonzero if access to memory by byte is slow and undesirable. -
787 */
788 #define SLOW_BYTE_ACCESS 0
789
790 /* Do not break .stabs pseudos into continuations.  */
791 #define DBX_CONTIN_LENGTH 0
792
793 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
794    is done just by pretending it is already truncated.  */
795 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
796
797 /* Give a comparison code (EQ, NE etc) and the first operand of a COMPARE,
798    return the mode to be used for the comparison.  For floating-point, CCFPmode
799    should be used.  */
800
801 #define SELECT_CC_MODE(OP,X,Y)  \
802 (GET_MODE_CLASS(GET_MODE(X)) == MODE_FLOAT? CCFPmode : CCmode)
803
804 /* Specify the machine mode that pointers have.
805    After generation of rtl, the compiler makes no further distinction
806    between pointers and any other objects of this machine mode.  */
807 #define Pmode HImode
808
809 /* A function address in a call instruction
810    is a word address (for indexing purposes)
811    so give the MEM rtx a word's mode.  */
812 #define FUNCTION_MODE HImode
813
814 /* Define this if addresses of constant functions
815    shouldn't be put through pseudo regs where they can be cse'd.
816    Desirable on machines where ordinary constants are expensive
817    but a CALL with constant address is cheap.  */
818 /* #define NO_FUNCTION_CSE */
819
820 \f
821 /* cost of moving one register class to another */
822 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
823   register_move_cost (CLASS1, CLASS2)
824
825 /* Tell emit-rtl.c how to initialize special values on a per-function base.  */
826 extern int optimize;
827 extern struct rtx_def *cc0_reg_rtx;
828
829 #define CC_STATUS_MDEP rtx
830
831 #define CC_STATUS_MDEP_INIT (cc_status.mdep = 0)
832 \f
833 /* Tell final.c how to eliminate redundant test instructions.  */
834
835 /* Here we define machine-dependent flags and fields in cc_status
836    (see `conditions.h').  */
837
838 #define CC_IN_FPU 04000 
839
840 /* Do UPDATE_CC if EXP is a set, used in
841    NOTICE_UPDATE_CC 
842
843    floats only do compare correctly, else nullify ...
844
845    get cc0 out soon ...
846 */
847
848 /* Store in cc_status the expressions
849    that the condition codes will describe
850    after execution of an instruction whose pattern is EXP.
851    Do not alter them if the instruction would not alter the cc's.  */
852
853 #define NOTICE_UPDATE_CC(EXP, INSN) \
854 { if (GET_CODE (EXP) == SET)                                    \
855     {                                                           \
856       notice_update_cc_on_set(EXP, INSN);                       \
857     }                                                           \
858   else if (GET_CODE (EXP) == PARALLEL                           \
859            && GET_CODE (XVECEXP (EXP, 0, 0)) == SET)            \
860     {                                                           \
861       notice_update_cc_on_set(XVECEXP (EXP, 0, 0), INSN);       \
862     }                                                           \
863   else if (GET_CODE (EXP) == CALL)                              \
864     { /* all bets are off */ CC_STATUS_INIT; }                  \
865   if (cc_status.value1 && GET_CODE (cc_status.value1) == REG    \
866       && cc_status.value2                                       \
867       && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2)) \
868     {                                                           \
869       printf ("here!\n");                                       \
870       cc_status.value2 = 0;                                     \
871     }                                                           \
872 }
873 \f
874 /* Control the assembler format that we output.  */
875
876 /* Output to assembler file text saying following lines
877    may contain character constants, extra white space, comments, etc.  */
878
879 #define ASM_APP_ON ""
880
881 /* Output to assembler file text saying following lines
882    no longer contain unusual constructs.  */
883
884 #define ASM_APP_OFF ""
885
886 /* Output before read-only data.  */
887
888 #define TEXT_SECTION_ASM_OP "\t.text\n"
889
890 /* Output before writable data.  */
891
892 #define DATA_SECTION_ASM_OP "\t.data\n"
893
894 /* How to refer to registers in assembler output.
895    This sequence is indexed by compiler's hard-register-number (see above).  */
896
897 #define REGISTER_NAMES \
898 {"r0", "r1", "r2", "r3", "r4", "r5", "sp", "pc",     \
899  "ac0", "ac1", "ac2", "ac3", "ac4", "ac5" }
900
901 /* Globalizing directive for a label.  */
902 #define GLOBAL_ASM_OP "\t.globl "
903
904 /* The prefix to add to user-visible assembler symbols.  */
905
906 #define USER_LABEL_PREFIX "_"
907
908 /* This is how to store into the string LABEL
909    the symbol_ref name of an internal numbered label where
910    PREFIX is the class of label and NUM is the number within the class.
911    This is suitable for output with `assemble_name'.  */
912
913 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)   \
914   sprintf (LABEL, "*%s_%lu", PREFIX, (unsigned long)(NUM))
915
916 #define ASM_OUTPUT_ASCII(FILE, P, SIZE)  \
917   output_ascii (FILE, P, SIZE)
918
919 /* This is how to output an element of a case-vector that is absolute.  */
920
921 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
922   fprintf (FILE, "\t%sL_%d\n", TARGET_UNIX_ASM ? "" : ".word ", VALUE)
923
924 /* This is how to output an element of a case-vector that is relative.
925    Don't define this if it is not supported.  */
926
927 /* #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) */
928
929 /* This is how to output an assembler line
930    that says to advance the location counter
931    to a multiple of 2**LOG bytes. 
932
933    who needs this????
934 */
935
936 #define ASM_OUTPUT_ALIGN(FILE,LOG)      \
937   switch (LOG)                          \
938     {                                   \
939       case 0:                           \
940         break;                          \
941       case 1:                           \
942         fprintf (FILE, "\t.even\n");    \
943         break;                          \
944       default:                          \
945         gcc_unreachable ();             \
946     }
947
948 #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
949   fprintf (FILE, "\t.=.+ %#ho\n", (unsigned short)(SIZE))
950
951 /* This says how to output an assembler line
952    to define a global common symbol.  */
953
954 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
955 ( fprintf ((FILE), ".globl "),                  \
956   assemble_name ((FILE), (NAME)),               \
957   fprintf ((FILE), "\n"),                       \
958   assemble_name ((FILE), (NAME)),               \
959   fprintf ((FILE), ": .=.+ %#ho\n", (unsigned short)(ROUNDED))          \
960 )
961
962 /* This says how to output an assembler line
963    to define a local common symbol.  */
964
965 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
966 ( assemble_name ((FILE), (NAME)),                               \
967   fprintf ((FILE), ":\t.=.+ %#ho\n", (unsigned short)(ROUNDED)))
968
969 /* Print operand X (an rtx) in assembler syntax to file FILE.
970    CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
971    For `%' followed by punctuation, CODE is the punctuation and X is null.
972
973 */
974
975
976 #define PRINT_OPERAND(FILE, X, CODE)  \
977 { if (CODE == '#') fprintf (FILE, "#");                                 \
978   else if (GET_CODE (X) == REG)                                         \
979     fprintf (FILE, "%s", reg_names[REGNO (X)]);                         \
980   else if (GET_CODE (X) == MEM)                                         \
981     output_address (XEXP (X, 0));                                       \
982   else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != SImode)      \
983     { REAL_VALUE_TYPE r;                                                \
984       long sval[2];                                                     \
985       REAL_VALUE_FROM_CONST_DOUBLE (r, X);                              \
986       REAL_VALUE_TO_TARGET_DOUBLE (r, sval);                            \
987       fprintf (FILE, "$%#o", sval[0] >> 16); }                          \
988   else { putc ('$', FILE); output_addr_const_pdp11 (FILE, X); }}
989 \f
990 /* Print a memory address as an operand to reference that memory location.  */
991
992 #define PRINT_OPERAND_ADDRESS(FILE, ADDR)  \
993  print_operand_address (FILE, ADDR)
994
995 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)                 \
996 (                                                       \
997   fprintf (FILE, "\tmov %s, -(sp)\n", reg_names[REGNO]) \
998 )
999
1000 #define ASM_OUTPUT_REG_POP(FILE,REGNO)                          \
1001 (                                                               \
1002   fprintf (FILE, "\tmov (sp)+, %s\n", reg_names[REGNO])         \
1003 )
1004
1005 /* trampoline - how should i do it in separate i+d ? 
1006    have some allocate_trampoline magic??? 
1007
1008    the following should work for shared I/D: */
1009
1010 /* lets see whether this works as trampoline:
1011 MV      #STATIC, $4     0x940Y  0x0000 <- STATIC; Y = STATIC_CHAIN_REGNUM
1012 JMP     FUNCTION        0x0058  0x0000 <- FUNCTION
1013 */
1014
1015 #define TRAMPOLINE_TEMPLATE(FILE)       \
1016 {                                       \
1017   gcc_assert (!TARGET_SPLIT);           \
1018                                         \
1019   assemble_aligned_integer (2, GEN_INT (0x9400+STATIC_CHAIN_REGNUM));   \
1020   assemble_aligned_integer (2, const0_rtx);                             \
1021   assemble_aligned_integer (2, GEN_INT(0x0058));                        \
1022   assemble_aligned_integer (2, const0_rtx);                             \
1023 }
1024
1025 #define TRAMPOLINE_SIZE 8
1026 #define TRAMPOLINE_ALIGNMENT 16
1027
1028 /* Emit RTL insns to initialize the variable parts of a trampoline.
1029    FNADDR is an RTX for the address of the function's pure code.
1030    CXT is an RTX for the static chain value for the function.  */
1031
1032 #define INITIALIZE_TRAMPOLINE(TRAMP,FNADDR,CXT) \
1033 {                                       \
1034   gcc_assert (!TARGET_SPLIT);           \
1035                                         \
1036   emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 2)), CXT); \
1037   emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 6)), FNADDR); \
1038 }
1039
1040
1041 /* Some machines may desire to change what optimizations are
1042    performed for various optimization levels.   This macro, if
1043    defined, is executed once just after the optimization level is
1044    determined and before the remainder of the command options have
1045    been parsed.  Values set in this macro are used as the default
1046    values for the other command line options.
1047
1048    LEVEL is the optimization level specified; 2 if -O2 is
1049    specified, 1 if -O is specified, and 0 if neither is specified.  */
1050
1051 #define OPTIMIZATION_OPTIONS(LEVEL,SIZE)                                \
1052 {                                                                       \
1053   if (LEVEL >= 3)                                                       \
1054     {                                                                   \
1055       flag_omit_frame_pointer           = 1;                            \
1056       /* flag_unroll_loops                      = 1; */                 \
1057     }                                                                   \
1058 }
1059
1060 /* there is no point in avoiding branches on a pdp, 
1061    since branches are really cheap - I just want to find out
1062    how much difference the BRANCH_COST macro makes in code */
1063 #define BRANCH_COST (TARGET_BRANCH_CHEAP ? 0 : 1)
1064
1065
1066 #define COMPARE_FLAG_MODE HImode