OSDN Git Service

* pdp11.c: Include "recog.h".
[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 Free Software Foundation, Inc.
3    Contributed by Michael K. Gschwind (mike@vlsivie.tuwien.ac.at).
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 1, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21
22
23 /* declarations */
24 int arith_operand ();
25 int const_immediate_operand ();
26 int expand_shift_operand ();
27 int legitimate_address_p ();
28 void notice_update_cc_on_set ();
29 void output_ascii ();
30 void output_function_epilogue ();
31 void output_function_prologue ();
32 char *output_jump();
33 char *output_move_double();
34 char *output_move_quad();
35 char *output_block_move();
36 void print_operand_address ();
37 int register_move_cost ();
38 int simple_memory_operand ();
39
40 /* check whether load_fpu_reg or not */
41 #define LOAD_FPU_REG_P(x) ((x)>=8 && (x)<=11)
42 #define NO_LOAD_FPU_REG_P(x) ((x)==12 || (x)==13)
43 #define FPU_REG_P(x)    (LOAD_FPU_REG_P(x) || NO_LOAD_FPU_REG_P(x))
44 #define CPU_REG_P(x)    ((x)<8)
45
46 /* Names to predefine in the preprocessor for this target machine.  */
47
48 #define CPP_PREDEFINES "-Dpdp11"
49
50 /* Print subsidiary information on the compiler version in use.  */
51 #define TARGET_VERSION fprintf (stderr, " (pdp11)");
52
53
54 /* Generate DBX debugging information.  */
55
56 /* #define DBX_DEBUGGING_INFO */
57
58 /* Run-time compilation parameters selecting different hardware subsets.
59 */
60
61 extern int target_flags;
62
63 /* Macro to define tables used to set the flags.
64    This is a list in braces of pairs in braces,
65    each pair being { "NAME", VALUE }
66    where VALUE is the bits to set or minus the bits to clear.
67    An empty string NAME is used to identify the default VALUE.  */
68
69 #define TARGET_SWITCHES  \
70 {   { "fpu", 1},                \
71     { "soft-float", -1},        \
72 /* return float result in ac0 */\
73     { "ac0", 2},                \
74     { "no-ac0", -2},            \
75 /* is 11/40 */                  \
76     { "40", 4},                 \
77     { "no-40", -4},             \
78 /* is 11/45 */                  \
79     { "45", 8},                 \
80     { "no-45", -8},             \
81 /* is 11/10 */                  \
82     { "10", -12},               \
83 /* use movstrhi for bcopy */    \
84     { "bcopy", 16},             \
85     { "bcopy-builtin", -16},    \
86 /* use 32 bit for int */        \
87     { "int32", 32},             \
88     { "no-int16", 32},          \
89     { "int16", -32},            \
90     { "no-int32", -32},         \
91 /* use 32 bit for float */      \
92     { "float32", 64},           \
93     { "no-float64", 64},        \
94     { "float64", -64},          \
95     { "no-float32", -64},       \
96 /* allow abshi pattern? - can trigger "optimizations" which make code SLOW! */\
97     { "abshi", 128},            \
98     { "no-abshi", -128},        \
99 /* is branching expensive - on a PDP, it's actually really cheap */ \
100 /* this is just to play around and check what code gcc generates */ \
101     { "branch-expensive", 256}, \
102     { "branch-cheap", -256},    \
103 /* split instruction and data memory? */ \
104     { "split", 1024 },          \
105     { "no-split", -1024 },      \
106 /* default */                   \
107     { "", TARGET_DEFAULT}       \
108 }
109
110 #define TARGET_DEFAULT (1 | 8 | 128)
111
112 #define TARGET_FPU              (target_flags & 1)
113 #define TARGET_SOFT_FLOAT       (!TARGET_FPU)
114
115 #define TARGET_AC0              ((target_flags & 2) && TARGET_FPU)
116 #define TARGET_NO_AC0           (! TARGET_AC0)
117
118 #define TARGET_45               (target_flags & 8)
119 #define TARGET_40_PLUS          ((target_flags & 4) || (target_flags & 8))
120 #define TARGET_10               (! TARGET_40_PLUS)
121
122 #define TARGET_BCOPY_BUILTIN    (! (target_flags & 16))
123
124 #define TARGET_INT16            (! TARGET_INT32)
125 #define TARGET_INT32            (target_flags & 32)
126
127 #define TARGET_FLOAT32          (target_flags & 64)
128 #define TARGET_FLOAT64          (! TARGET_FLOAT32)
129
130 #define TARGET_ABSHI_BUILTIN    (target_flags & 128)
131
132 #define TARGET_BRANCH_EXPENSIVE (target_flags & 256)
133 #define TARGET_BRANCH_CHEAP     (!TARGET_BRANCH_EXPENSIVE)
134
135 #define TARGET_SPLIT            (target_flags & 1024)
136 #define TARGET_NOSPLIT          (! TARGET_SPLIT)
137 \f
138
139 /* TYPE SIZES */
140 #define CHAR_TYPE_SIZE          8
141 #define SHORT_TYPE_SIZE         16
142 #define INT_TYPE_SIZE           (TARGET_INT16 ? 16 : 32)
143 #define LONG_TYPE_SIZE          32
144 #define LONG_LONG_TYPE_SIZE     64     
145
146 /* if we set FLOAT_TYPE_SIZE to 32, we could have the benefit 
147    of saving core for huge arrays - the definitions are 
148    already in md - but floats can never reside in 
149    an FPU register - we keep the FPU in double float mode 
150    all the time !! */
151 #define FLOAT_TYPE_SIZE         (TARGET_FLOAT32 ? 32 : 64)
152 #define DOUBLE_TYPE_SIZE        64
153 #define LONG_DOUBLE_TYPE_SIZE   64
154
155 /* machine types from ansi */
156 #define SIZE_TYPE "unsigned int"        /* definition of size_t */
157
158 /* is used in cexp.y - we don't have target_flags there, 
159    so just give default definition 
160
161    hope it does not come back to haunt us! */
162 #define WCHAR_TYPE "int"                /* or long int???? */
163 #define WCHAR_TYPE_SIZE 16
164
165 #define PTRDIFF_TYPE "int"
166
167 /* target machine storage layout */
168
169 /* Define this if most significant bit is lowest numbered
170    in instructions that operate on numbered bit-fields.  */
171 #define BITS_BIG_ENDIAN 0
172
173 /* Define this if most significant byte of a word is the lowest numbered.  */
174 #define BYTES_BIG_ENDIAN 0
175
176 /* Define this if most significant word of a multiword number is numbered.  */
177 #define WORDS_BIG_ENDIAN 1
178
179 /* number of bits in an addressable storage unit */
180 #define BITS_PER_UNIT 8
181
182 /* Width in bits of a "word", which is the contents of a machine register.
183    Note that this is not necessarily the width of data type `int';
184    if using 16-bit ints on a 68000, this would still be 32.
185    But on a machine with 16-bit registers, this would be 16.  */
186 /*  This is a machine with 16-bit registers */
187 #define BITS_PER_WORD 16
188
189 /* Width of a word, in units (bytes). 
190
191    UNITS OR BYTES - seems like units */
192 #define UNITS_PER_WORD 2
193
194 /* Maximum sized of reasonable data type 
195    DImode or Dfmode ...*/
196 #define MAX_FIXED_MODE_SIZE 64  
197
198 /* Width in bits of a pointer.
199    See also the macro `Pmode' defined below.  */
200 #define POINTER_SIZE 16
201
202 /* Allocation boundary (in *bits*) for storing pointers in memory.  */
203 #define POINTER_BOUNDARY 16
204
205 /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
206 #define PARM_BOUNDARY 16
207
208 /* Allocation boundary (in *bits*) for the code of a function.  */
209 #define FUNCTION_BOUNDARY 16
210
211 /* Alignment of field after `int : 0' in a structure.  */
212 #define EMPTY_FIELD_BOUNDARY 16
213
214 /* No data type wants to be aligned rounder than this.  */
215 #define BIGGEST_ALIGNMENT 16
216
217 /* Define this if move instructions will actually fail to work
218    when given unaligned data.  */
219 #define STRICT_ALIGNMENT 1
220 \f
221 /* Standard register usage.  */
222
223 /* Number of actual hardware registers.
224    The hardware registers are assigned numbers for the compiler
225    from 0 to just below FIRST_PSEUDO_REGISTER.
226    All registers that the compiler knows about must be given numbers,
227    even those that are not normally considered general registers.
228
229    we have 8 integer registers, plus 6 float 
230    (don't use scratch float !) */
231
232 #define FIRST_PSEUDO_REGISTER 14
233
234 /* 1 for registers that have pervasive standard uses
235    and are not available for the register allocator.
236
237    On the pdp, these are:
238    Reg 7        = pc;
239    reg 6        = sp;
240    reg 5        = fp;  not necessarily! 
241 */
242
243 /* don't let them touch fp regs for the time being !*/
244
245 #define FIXED_REGISTERS  \
246 {0, 0, 0, 0, 0, 0, 1, 1, \
247  0, 0, 0, 0, 0, 0     }
248
249
250
251 /* 1 for registers not available across function calls.
252    These must include the FIXED_REGISTERS and also any
253    registers that can be used without being saved.
254    The latter must include the registers where values are returned
255    and the register where structure-value addresses are passed.
256    Aside from that, you can include as many other registers as you like.  */
257
258 /* don't know about fp */
259 #define CALL_USED_REGISTERS  \
260 {1, 1, 0, 0, 0, 0, 1, 1, \
261  0, 0, 0, 0, 0, 0 }
262
263
264 /* Make sure everything's fine if we *don't* have an FPU.
265    This assumes that putting a register in fixed_regs will keep the
266    compiler's mitts completely off it.  We don't bother to zero it out
267    of register classes.  
268 */
269 #define CONDITIONAL_REGISTER_USAGE \
270 {                                               \
271   int i;                                        \
272   HARD_REG_SET x;                               \
273   if (!TARGET_FPU)                              \
274     {                                           \
275       COPY_HARD_REG_SET (x, reg_class_contents[(int)FPU_REGS]); \
276       for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
277        if (TEST_HARD_REG_BIT (x, i))            \
278         fixed_regs[i] = call_used_regs[i] = 1;  \
279     }                                           \
280                                                 \
281   if (TARGET_AC0)                               \
282       call_used_regs[8] = 1;                    \
283 }
284
285 /* Return number of consecutive hard regs needed starting at reg REGNO
286    to hold something of mode MODE.
287    This is ordinarily the length in words of a value of mode MODE
288    but can be less for certain modes in special long registers.
289 */
290
291 #define HARD_REGNO_NREGS(REGNO, MODE)   \
292 ((REGNO < 8)?                                                           \
293     ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)      \
294     :1)
295     
296
297 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
298    On the pdp, the cpu registers can hold any mode - check alignment
299
300    FPU can only hold DF - simplifies life!
301 */
302 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
303 (((REGNO) < 8)?                                         \
304   ((GET_MODE_BITSIZE(MODE) <= 16)                       \
305    || (GET_MODE_BITSIZE(MODE) == 32 && !((REGNO) & 1))) \
306   :(MODE) == DFmode)
307     
308
309 /* Value is 1 if it is a good idea to tie two pseudo registers
310    when one has mode MODE1 and one has mode MODE2.
311    If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
312    for any hard reg, then this must be 0 for correct output.  */
313 #define MODES_TIEABLE_P(MODE1, MODE2) 0
314
315 /* Specify the registers used for certain standard purposes.
316    The values of these macros are register numbers.  */
317
318 /* the pdp11 pc overloaded on a register that the compiler knows about.  */
319 #define PC_REGNUM  7
320
321 /* Register to use for pushing function arguments.  */
322 #define STACK_POINTER_REGNUM 6
323
324 /* Base register for access to local variables of the function.  */
325 #define FRAME_POINTER_REGNUM 5
326
327 /* Value should be nonzero if functions must have frame pointers.
328    Zero means the frame pointer need not be set up (and parms
329    may be accessed via the stack pointer) in functions that seem suitable.
330    This is computed in `reload', in reload1.c.
331   */
332
333 #define FRAME_POINTER_REQUIRED 0
334
335 /* Base register for access to arguments of the function.  */
336 #define ARG_POINTER_REGNUM 5
337
338 /* Register in which static-chain is passed to a function.  */
339 /* ??? - i don't want to give up a reg for this! */
340 #define STATIC_CHAIN_REGNUM 4
341
342 /* Register in which address to store a structure value
343    is passed to a function.  
344    let's make it an invisible first argument!!! */
345
346 #define STRUCT_VALUE 0
347
348 \f
349 /* Define the classes of registers for register constraints in the
350    machine description.  Also define ranges of constants.
351
352    One of the classes must always be named ALL_REGS and include all hard regs.
353    If there is more than one class, another class must be named NO_REGS
354    and contain no registers.
355
356    The name GENERAL_REGS must be the name of a class (or an alias for
357    another name such as ALL_REGS).  This is the class of registers
358    that is allowed by "g" or "r" in a register constraint.
359    Also, registers outside this class are allocated only when
360    instructions express preferences for them.
361
362    The classes must be numbered in nondecreasing order; that is,
363    a larger-numbered class must never be contained completely
364    in a smaller-numbered class.
365
366    For any two classes, it is very desirable that there be another
367    class that represents their union.  */
368    
369 /* The pdp has a couple of classes:
370
371 MUL_REGS are used for odd numbered regs, to use in 16 bit multiplication
372          (even numbered do 32 bit multiply)
373 LMUL_REGS long multiply registers (even numbered regs )
374           (don't need them, all 32 bit regs are even numbered!)
375 GENERAL_REGS is all cpu
376 LOAD_FPU_REGS is the first four cpu regs, they are easier to load
377 NO_LOAD_FPU_REGS is ac4 and ac5, currently - difficult to load them
378 FPU_REGS is all fpu regs 
379 */
380
381 enum reg_class { NO_REGS, MUL_REGS, GENERAL_REGS, LOAD_FPU_REGS, NO_LOAD_FPU_REGS, FPU_REGS, ALL_REGS, LIM_REG_CLASSES };
382
383 #define N_REG_CLASSES (int) LIM_REG_CLASSES
384
385 /* have to allow this till cmpsi/tstsi are fixed in a better way !! */
386 #define SMALL_REGISTER_CLASSES 1
387
388 /* Since GENERAL_REGS is the same class as ALL_REGS,
389    don't give it a different class number; just make it an alias.  */
390
391 /* #define GENERAL_REGS ALL_REGS */
392
393 /* Give names of register classes as strings for dump file.   */
394
395 #define REG_CLASS_NAMES {"NO_REGS", "MUL_REGS", "GENERAL_REGS", "LOAD_FPU_REGS", "NO_LOAD_FPU_REGS", "FPU_REGS", "ALL_REGS" }
396
397 /* Define which registers fit in which classes.
398    This is an initializer for a vector of HARD_REG_SET
399    of length N_REG_CLASSES.  */
400
401 #define REG_CLASS_CONTENTS {0, 0x00aa, 0x00ff, 0x0f00, 0x3000, 0x3f00, 0x3fff}
402
403 /* The same information, inverted:
404    Return the class number of the smallest class containing
405    reg number REGNO.  This could be a conditional expression
406    or could index an array.  */
407
408 #define REGNO_REG_CLASS(REGNO)          \
409 ((REGNO)>=8?((REGNO)<=11?LOAD_FPU_REGS:NO_LOAD_FPU_REGS):(((REGNO)&1)?MUL_REGS:GENERAL_REGS))
410
411
412 /* The class value for index registers, and the one for base regs.  */
413 #define INDEX_REG_CLASS GENERAL_REGS
414 #define BASE_REG_CLASS GENERAL_REGS
415
416 /* Get reg_class from a letter such as appears in the machine description.  */
417
418 #define REG_CLASS_FROM_LETTER(C)        \
419 ((C) == 'f' ? FPU_REGS :                        \
420   ((C) == 'd' ? MUL_REGS :                      \
421    ((C) == 'a' ? LOAD_FPU_REGS : NO_REGS)))
422     
423
424 /* The letters I, J, K, L and M in a register constraint string
425    can be used to stand for particular ranges of immediate operands.
426    This macro defines what the ranges are.
427    C is the letter, and VALUE is a constant value.
428    Return 1 if VALUE is in the range specified by C.
429
430    I            bits 31-16 0000
431    J            bits 15-00 0000
432    K            completely random 32 bit
433    L,M,N        -1,1,0 respectively
434    O            where doing shifts in sequence is faster than 
435                 one big shift 
436 */
437
438 #define CONST_OK_FOR_LETTER_P(VALUE, C)  \
439   ((C) == 'I' ? ((VALUE) & 0xffff0000) == 0             \
440    : (C) == 'J' ? ((VALUE) & 0x0000ffff) == 0           \
441    : (C) == 'K' ? (((VALUE) & 0xffff0000) != 0          \
442                    && ((VALUE) & 0x0000ffff) != 0)      \
443    : (C) == 'L' ? ((VALUE) == 1)                        \
444    : (C) == 'M' ? ((VALUE) == -1)                       \
445    : (C) == 'N' ? ((VALUE) == 0)                        \
446    : (C) == 'O' ? (abs(VALUE) >1 && abs(VALUE) <= 4)            \
447    : 0)
448
449 /* Similar, but for floating constants, and defining letters G and H.
450    Here VALUE is the CONST_DOUBLE rtx itself.  */
451
452 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)  \
453   ((C) == 'G' && XINT (VALUE, 0) == 0 && XINT (VALUE, 1) == 0)
454
455
456 /* Letters in the range `Q' through `U' may be defined in a
457    machine-dependent fashion to stand for arbitrary operand types. 
458    The machine description macro `EXTRA_CONSTRAINT' is passed the
459    operand as its first argument and the constraint letter as its
460    second operand.
461
462    `Q'  is for memory references using take more than 1 instruction.
463    `R'  is for memory references which take 1 word for the instruction.  */
464
465 #define EXTRA_CONSTRAINT(OP,CODE)                                       \
466   ((GET_CODE (OP) != MEM) ? 0                                           \
467    : !legitimate_address_p (GET_MODE (OP), XEXP (OP, 0)) ? 0            \
468    : ((CODE) == 'Q')      ? !simple_memory_operand (OP, GET_MODE (OP))  \
469    : ((CODE) == 'R')      ? simple_memory_operand (OP, GET_MODE (OP))   \
470    : 0)
471
472 /* Given an rtx X being reloaded into a reg required to be
473    in class CLASS, return the class of reg to actually use.
474    In general this is just CLASS; but on some machines
475    in some cases it is preferable to use a more restrictive class.  
476
477 loading is easier into LOAD_FPU_REGS than FPU_REGS! */
478
479 #define PREFERRED_RELOAD_CLASS(X,CLASS)         \
480 (((CLASS) != FPU_REGS)?(CLASS):LOAD_FPU_REGS)
481
482 #define SECONDARY_RELOAD_CLASS(CLASS,MODE,x)    \
483 (((CLASS) == NO_LOAD_FPU_REGS && !(REG_P(x) && LOAD_FPU_REG_P(REGNO(x))))?LOAD_FPU_REGS:NO_REGS)
484
485 /* Return the maximum number of consecutive registers
486    needed to represent mode MODE in a register of class CLASS.  */
487 #define CLASS_MAX_NREGS(CLASS, MODE)    \
488 ((CLASS == GENERAL_REGS || CLASS == MUL_REGS)?                          \
489   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD):       \
490   1                                                                     \
491 )
492
493 \f
494 /* Stack layout; function entry, exit and calling.  */
495
496 /* Define this if pushing a word on the stack
497    makes the stack pointer a smaller address.  */
498 #define STACK_GROWS_DOWNWARD
499
500 /* Define this if the nominal address of the stack frame
501    is at the high-address end of the local variables;
502    that is, each additional local variable allocated
503    goes at a more negative offset in the frame.
504 */
505 #define FRAME_GROWS_DOWNWARD
506
507 /* Offset within stack frame to start allocating local variables at.
508    If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
509    first local allocated.  Otherwise, it is the offset to the BEGINNING
510    of the first local allocated.  */
511 #define STARTING_FRAME_OFFSET 0
512
513 /* If we generate an insn to push BYTES bytes,
514    this says how many the stack pointer really advances by.
515    On the pdp11, the stack is on an even boundary */
516 #define PUSH_ROUNDING(BYTES) ((BYTES + 1) & ~1)
517
518 /* current_first_parm_offset stores the # of registers pushed on the 
519    stack */
520 extern int current_first_parm_offset;
521
522 /* Offset of first parameter from the argument pointer register value.  
523    For the pdp11, this is non-zero to account for the return address.
524         1 - return address
525         2 - frame pointer (always saved, even when not used!!!!)
526                 -- chnage some day !!!:q!
527
528 */
529 #define FIRST_PARM_OFFSET(FNDECL) 4
530
531 /* Value is 1 if returning from a function call automatically
532    pops the arguments described by the number-of-args field in the call.
533    FUNDECL is the declaration node of the function (as a tree),
534    FUNTYPE is the data type of the function (as a tree),
535    or for a library call it is an identifier node for the subroutine name.  */
536
537 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
538
539 /* Define how to find the value returned by a function.
540    VALTYPE is the data type of the value (as a tree).
541    If the precise function being called is known, FUNC is its FUNCTION_DECL;
542    otherwise, FUNC is 0.  */
543 #define BASE_RETURN_VALUE_REG(MODE) \
544  ((MODE) == DFmode ? 8 : 0) 
545
546 /* On the pdp11 the value is found in R0 (or ac0??? 
547 not without FPU!!!! ) */
548
549 #define FUNCTION_VALUE(VALTYPE, FUNC)  \
550   gen_rtx (REG, TYPE_MODE (VALTYPE), BASE_RETURN_VALUE_REG(TYPE_MODE(VALTYPE)))
551
552 /* and the called function leaves it in the first register.
553    Difference only on machines with register windows.  */
554
555 #define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC)  \
556   gen_rtx (REG, TYPE_MODE (VALTYPE), BASE_RETURN_VALUE_REG(TYPE_MODE(VALTYPE)))
557
558 /* Define how to find the value returned by a library function
559    assuming the value has mode MODE.  */
560
561 #define LIBCALL_VALUE(MODE)  gen_rtx (REG, MODE, BASE_RETURN_VALUE_REG(MODE))
562
563 /* 1 if N is a possible register number for a function value
564    as seen by the caller.
565    On the pdp, the first "output" reg is the only register thus used. 
566
567 maybe ac0 ? - as option someday! */
568
569 #define FUNCTION_VALUE_REGNO_P(N) (((N) == 0) || (TARGET_AC0 && (N) == 8))
570
571 /* should probably return DImode and DFmode in memory,lest
572    we fill up all regs!
573
574  have to, else we crash - exception: maybe return result in 
575  ac0 if DFmode and FPU present - compatibility problem with
576  libraries for non-floating point ...
577 */
578
579 #define RETURN_IN_MEMORY(TYPE)  \
580   (TYPE_MODE(TYPE) == DImode || (TYPE_MODE(TYPE) == DFmode && ! TARGET_AC0))
581
582
583 /* 1 if N is a possible register number for function argument passing.
584    - not used on pdp */
585
586 #define FUNCTION_ARG_REGNO_P(N) 0
587 \f
588 /* Define a data type for recording info about an argument list
589    during the scan of that argument list.  This data type should
590    hold all necessary information about the function itself
591    and about the args processed so far, enough to enable macros
592    such as FUNCTION_ARG to determine where the next arg should go.
593
594 */
595
596 #define CUMULATIVE_ARGS int
597
598 /* Initialize a variable CUM of type CUMULATIVE_ARGS
599    for a call to a function whose data type is FNTYPE.
600    For a library call, FNTYPE is 0.
601
602    ...., the offset normally starts at 0, but starts at 1 word
603    when the function gets a structure-value-address as an
604    invisible first argument.  */
605
606 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT)       \
607  ((CUM) = 0)
608
609 /* Update the data in CUM to advance over an argument
610    of mode MODE and data type TYPE.
611    (TYPE is null for libcalls where that information may not be available.)  
612
613 */
614
615
616 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)    \
617  ((CUM) += ((MODE) != BLKmode                   \
618             ? (GET_MODE_SIZE (MODE))            \
619             : (int_size_in_bytes (TYPE))))      
620
621 /* Determine where to put an argument to a function.
622    Value is zero to push the argument on the stack,
623    or a hard register in which to store the argument.
624
625    MODE is the argument's machine mode.
626    TYPE is the data type of the argument (as a tree).
627     This is null for libcalls where that information may
628     not be available.
629    CUM is a variable of type CUMULATIVE_ARGS which gives info about
630     the preceding args and about the function being called.
631    NAMED is nonzero if this argument is a named parameter
632     (otherwise it is an extra parameter matching an ellipsis).  */
633
634 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED)  0
635
636 /* Define where a function finds its arguments.
637    This would be different from FUNCTION_ARG if we had register windows.  */
638 /*
639 #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED)   \
640   FUNCTION_ARG (CUM, MODE, TYPE, NAMED)
641 */
642
643 /* For an arg passed partly in registers and partly in memory,
644    this is the number of registers used.
645    For args passed entirely in registers or entirely in memory, zero.  */
646
647 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
648
649 /* This macro generates the assembly code for function entry. */
650 #define FUNCTION_PROLOGUE(FILE, SIZE) \
651     output_function_prologue(FILE, SIZE);
652
653 /* Output assembler code to FILE to increment profiler label # LABELNO
654    for profiling a function entry.  */
655
656 #define FUNCTION_PROFILER(FILE, LABELNO)  \
657    abort ();
658
659 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
660    the stack pointer does not matter.  The value is tested only in
661    functions that have frame pointers.
662    No definition is equivalent to always zero.  */
663
664 extern int may_call_alloca;
665 extern int current_function_pretend_args_size;
666
667 #define EXIT_IGNORE_STACK       1
668
669 /* This macro generates the assembly code for function exit,
670    on machines that need it.  If FUNCTION_EPILOGUE is not defined
671    then individual return instructions are generated for each
672    return statement.  Args are same as for FUNCTION_PROLOGUE.
673 */
674
675 #define FUNCTION_EPILOGUE(FILE, SIZE) \
676     output_function_epilogue(FILE, SIZE);
677   
678 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH_VAR) \
679 {                                                               \
680   int offset, regno;                                            \
681   offset = get_frame_size();                                    \
682   for (regno = 0; regno < 8; regno++)                           \
683     if (regs_ever_live[regno] && ! call_used_regs[regno])       \
684       offset += 2;                                              \
685   for (regno = 8; regno < 14; regno++)                          \
686     if (regs_ever_live[regno] && ! call_used_regs[regno])       \
687       offset += 8;                                              \
688   /* offset -= 2;   no fp on stack frame */                     \
689   (DEPTH_VAR) = offset;                                         \
690 }   
691     
692 \f
693 /* Addressing modes, and classification of registers for them.  */
694
695 #define HAVE_POST_INCREMENT 1
696 /* #define HAVE_POST_DECREMENT 0 */
697
698 #define HAVE_PRE_DECREMENT 1
699 /* #define HAVE_PRE_INCREMENT 0 */
700
701 /* Macros to check register numbers against specific register classes.  */
702
703 /* These assume that REGNO is a hard or pseudo reg number.
704    They give nonzero only if REGNO is a hard reg of the suitable class
705    or a pseudo reg currently allocated to a suitable hard reg.
706    Since they use reg_renumber, they are safe only once reg_renumber
707    has been allocated, which happens in local-alloc.c.  */
708
709 #define REGNO_OK_FOR_INDEX_P(REGNO) \
710   ((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
711 #define REGNO_OK_FOR_BASE_P(REGNO)  \
712   ((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
713
714 /* Now macros that check whether X is a register and also,
715    strictly, whether it is in a specified class.
716 */
717
718
719 \f
720 /* Maximum number of registers that can appear in a valid memory address.  */
721
722 #define MAX_REGS_PER_ADDRESS 2
723
724 /* Recognize any constant value that is a valid address.  */
725
726 #define CONSTANT_ADDRESS_P(X)  CONSTANT_P (X)
727
728 /* Nonzero if the constant value X is a legitimate general operand.
729    It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
730
731 #define LEGITIMATE_CONSTANT_P(X) (1)
732
733 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
734    and check its validity for a certain class.
735    We have two alternate definitions for each of them.
736    The usual definition accepts all pseudo regs; the other rejects
737    them unless they have been allocated suitable hard regs.
738    The symbol REG_OK_STRICT causes the latter definition to be used.
739
740    Most source files want to accept pseudo regs in the hope that
741    they will get allocated to the class that the insn wants them to be in.
742    Source files for reload pass need to be strict.
743    After reload, it makes no difference, since pseudo regs have
744    been eliminated by then.  */
745
746 #ifndef REG_OK_STRICT
747
748 /* Nonzero if X is a hard reg that can be used as an index
749    or if it is a pseudo reg.  */
750 #define REG_OK_FOR_INDEX_P(X) (1)
751 /* Nonzero if X is a hard reg that can be used as a base reg
752    or if it is a pseudo reg.  */
753 #define REG_OK_FOR_BASE_P(X) (1)
754
755 #else
756
757 /* Nonzero if X is a hard reg that can be used as an index.  */
758 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
759 /* Nonzero if X is a hard reg that can be used as a base reg.  */
760 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
761
762 #endif
763 \f
764 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
765    that is a valid memory address for an instruction.
766    The MODE argument is the machine mode for the MEM expression
767    that wants to use this address.
768
769 */
770
771 #define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR) \
772 {                                                     \
773     rtx xfoob;                                                          \
774                                                                         \
775     /* accept (R0) */                                                   \
776     if (GET_CODE (operand) == REG                                       \
777         && REG_OK_FOR_BASE_P(operand))                                  \
778       goto ADDR;                                                        \
779                                                                         \
780     /* accept @#address */                                              \
781     if (CONSTANT_ADDRESS_P (operand))                                   \
782       goto ADDR;                                                        \
783                                                                         \
784     /* accept X(R0) */                                                  \
785     if (GET_CODE (operand) == PLUS                                      \
786         && GET_CODE (XEXP (operand, 0)) == REG                          \
787         && REG_OK_FOR_BASE_P (XEXP (operand, 0))                        \
788         && CONSTANT_ADDRESS_P (XEXP (operand, 1)))                      \
789       goto ADDR;                                                        \
790                                                                         \
791     /* accept -(R0) */                                                  \
792     if (GET_CODE (operand) == PRE_DEC                                   \
793         && GET_CODE (XEXP (operand, 0)) == REG                          \
794         && REG_OK_FOR_BASE_P (XEXP (operand, 0)))                       \
795       goto ADDR;                                                        \
796                                                                         \
797     /* accept (R0)+ */                                                  \
798     if (GET_CODE (operand) == POST_INC                                  \
799         && GET_CODE (XEXP (operand, 0)) == REG                          \
800         && REG_OK_FOR_BASE_P (XEXP (operand, 0)))                       \
801       goto ADDR;                                                        \
802                                                                         \
803     /* handle another level of indirection ! */                         \
804     if (GET_CODE(operand) != MEM)                                       \
805       goto fail;                                                        \
806                                                                         \
807     xfoob = XEXP (operand, 0);                                          \
808                                                                         \
809     /* (MEM:xx (MEM:xx ())) is not valid for SI, DI and currently */    \
810     /* also forbidden for float, because we have to handle this */      \
811     /* in output_move_double and/or output_move_quad() - we could */    \
812     /* do it, but currently it's not worth it!!! */                     \
813     /* now that DFmode cannot go into CPU register file, */             \
814     /* maybe I should allow float ... */                                \
815     /*  but then I have to handle memory-to-memory moves in movdf ?? */ \
816                                                                         \
817     if (GET_MODE_BITSIZE(mode) > 16)                                    \
818       goto fail;                                                        \
819                                                                         \
820     /* accept @(R0) - which is @0(R0) */                                \
821     if (GET_CODE (xfoob) == REG                                         \
822         && REG_OK_FOR_BASE_P(xfoob))                                    \
823       goto ADDR;                                                        \
824                                                                         \
825     /* accept @address */                                               \
826     if (CONSTANT_ADDRESS_P (xfoob))                                     \
827       goto ADDR;                                                        \
828                                                                         \
829     /* accept @X(R0) */                                                 \
830     if (GET_CODE (xfoob) == PLUS                                        \
831         && GET_CODE (XEXP (xfoob, 0)) == REG                            \
832         && REG_OK_FOR_BASE_P (XEXP (xfoob, 0))                          \
833         && CONSTANT_ADDRESS_P (XEXP (xfoob, 1)))                        \
834       goto ADDR;                                                        \
835                                                                         \
836     /* accept @-(R0) */                                                 \
837     if (GET_CODE (xfoob) == PRE_DEC                                     \
838         && GET_CODE (XEXP (xfoob, 0)) == REG                            \
839         && REG_OK_FOR_BASE_P (XEXP (xfoob, 0)))                         \
840       goto ADDR;                                                        \
841                                                                         \
842     /* accept @(R0)+ */                                                 \
843     if (GET_CODE (xfoob) == POST_INC                                    \
844         && GET_CODE (XEXP (xfoob, 0)) == REG                            \
845         && REG_OK_FOR_BASE_P (XEXP (xfoob, 0)))                         \
846       goto ADDR;                                                        \
847                                                                         \
848   /* anything else is invalid */                                        \
849   fail: ;                                                               \
850 }
851
852 \f
853 /* Try machine-dependent ways of modifying an illegitimate address
854    to be legitimate.  If we find one, return the new, valid address.
855    This macro is used in only one place: `memory_address' in explow.c.
856
857    OLDX is the address as it was before break_out_memory_refs was called.
858    In some cases it is useful to look at this to decide what needs to be done.
859
860    MODE and WIN are passed so that this macro can use
861    GO_IF_LEGITIMATE_ADDRESS.
862
863    It is always safe for this macro to do nothing.  It exists to recognize
864    opportunities to optimize the output.  */
865
866 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)     {}
867
868
869 /* Go to LABEL if ADDR (a legitimate address expression)
870    has an effect that depends on the machine mode it is used for.
871    On the pdp this is for predec/postinc */
872
873 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)        \
874  { if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC)       \
875      goto LABEL;                                                        \
876  }
877
878 \f
879 /* Specify the machine mode that this machine uses
880    for the index in the tablejump instruction.  */
881 #define CASE_VECTOR_MODE HImode
882
883 /* Define this if a raw index is all that is needed for a
884    `tablejump' insn.  */
885 #define CASE_TAKES_INDEX_RAW
886
887 /* Define as C expression which evaluates to nonzero if the tablejump
888    instruction expects the table to contain offsets from the address of the
889    table.
890    Do not define this if the table should contain absolute addresses. */
891 /* #define CASE_VECTOR_PC_RELATIVE 1 */
892
893 /* Specify the tree operation to be used to convert reals to integers.  */
894 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
895
896 /* This is the kind of divide that is easiest to do in the general case.  */
897 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
898
899 /* Define this as 1 if `char' should by default be signed; else as 0.  */
900 #define DEFAULT_SIGNED_CHAR 1
901
902 /* Max number of bytes we can move from memory to memory
903    in one reasonably fast instruction.  
904 */
905
906 #define MOVE_MAX 2
907
908 /* Zero extension is faster if the target is known to be zero */
909 /* #define SLOW_ZERO_EXTEND */
910
911 /* Nonzero if access to memory by byte is slow and undesirable. -
912 */
913 #define SLOW_BYTE_ACCESS 0
914
915 /* Do not break .stabs pseudos into continuations.  */
916 #define DBX_CONTIN_LENGTH 0
917
918 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
919    is done just by pretending it is already truncated.  */
920 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
921
922
923 /* Add any extra modes needed to represent the condition code.
924
925    CCFPmode is used for FPU, but should we use a separate reg? */
926 #define EXTRA_CC_MODES CCFPmode
927
928 /* the name for the mode above */
929 #define EXTRA_CC_NAMES "CCFPmode"
930
931 /* Give a comparison code (EQ, NE etc) and the first operand of a COMPARE,
932    return the mode to be used for the comparison.  For floating-point, CCFPmode
933    should be used. */
934
935 #define SELECT_CC_MODE(OP,X,Y)  \
936 (GET_MODE_CLASS(GET_MODE(X)) == MODE_FLOAT? CCFPmode : CCmode)
937
938 /* We assume that the store-condition-codes instructions store 0 for false
939    and some other value for true.  This is the value stored for true.  */
940
941 /* #define STORE_FLAG_VALUE 1 */
942
943 /* Specify the machine mode that pointers have.
944    After generation of rtl, the compiler makes no further distinction
945    between pointers and any other objects of this machine mode.  */
946 #define Pmode HImode
947
948 /* A function address in a call instruction
949    is a word address (for indexing purposes)
950    so give the MEM rtx a word's mode.  */
951 #define FUNCTION_MODE HImode
952
953 /* Define this if addresses of constant functions
954    shouldn't be put through pseudo regs where they can be cse'd.
955    Desirable on machines where ordinary constants are expensive
956    but a CALL with constant address is cheap.  */
957 /* #define NO_FUNCTION_CSE */
958
959 /* Compute the cost of computing a constant rtl expression RTX
960    whose rtx-code is CODE.  The body of this macro is a portion
961    of a switch statement.  If the code is computed here,
962    return it with a return statement.  Otherwise, break from the switch. 
963
964    -1, 0, 1 are cheaper for add, sub ... 
965 */
966
967 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
968   case CONST_INT:                                               \
969     if (INTVAL(RTX) == 0                                        \
970         || INTVAL(RTX) == -1                                    \
971         || INTVAL(RTX) == 1)                                    \
972       return 0;                                                 \
973   case CONST:                                                   \
974   case LABEL_REF:                                               \
975   case SYMBOL_REF:                                              \
976     /* twice as expensive as REG */                             \
977     return 2;                                                   \
978   case CONST_DOUBLE:                                            \
979     /* twice (or 4 times) as expensive as 16 bit */             \
980     return 4;
981 \f
982 /* cost of moving one register class to another */
983 #define REGISTER_MOVE_COST(CLASS1, CLASS2) register_move_cost(CLASS1, CLASS2)
984
985 /* Tell emit-rtl.c how to initialize special values on a per-function base.  */
986 extern int optimize;
987 extern struct rtx_def *cc0_reg_rtx;
988
989 #define CC_STATUS_MDEP rtx
990
991 #define CC_STATUS_MDEP_INIT (cc_status.mdep = 0)
992 \f
993 /* Tell final.c how to eliminate redundant test instructions.  */
994
995 /* Here we define machine-dependent flags and fields in cc_status
996    (see `conditions.h').  */
997
998 #define CC_IN_FPU 04000 
999
1000 /* Do UPDATE_CC if EXP is a set, used in
1001    NOTICE_UPDATE_CC 
1002
1003    floats only do compare correctly, else nullify ...
1004
1005    get cc0 out soon ...
1006 */
1007
1008 /* Store in cc_status the expressions
1009    that the condition codes will describe
1010    after execution of an instruction whose pattern is EXP.
1011    Do not alter them if the instruction would not alter the cc's.  */
1012
1013 #define NOTICE_UPDATE_CC(EXP, INSN) \
1014 { if (GET_CODE (EXP) == SET)                                    \
1015     {                                                           \
1016       notice_update_cc_on_set(EXP, INSN);                       \
1017     }                                                           \
1018   else if (GET_CODE (EXP) == PARALLEL                           \
1019            && GET_CODE (XVECEXP (EXP, 0, 0)) == SET)            \
1020     {                                                           \
1021       notice_update_cc_on_set(XVECEXP (EXP, 0, 0), INSN);       \
1022     }                                                           \
1023   else if (GET_CODE (EXP) == CALL)                              \
1024     { /* all bets are off */ CC_STATUS_INIT; }                  \
1025   if (cc_status.value1 && GET_CODE (cc_status.value1) == REG    \
1026       && cc_status.value2                                       \
1027       && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2))  \
1028     printf ("here!\n", cc_status.value2 = 0);                   \
1029 }
1030 \f
1031 /* Control the assembler format that we output.  */
1032
1033 /* Output at beginning of assembler file.  */
1034
1035 #if 0
1036 #define ASM_FILE_START(FILE) \
1037 (                                                               \
1038 fprintf (FILE, "\t.data\n"),                                    \
1039 fprintf (FILE, "$help$: . = .+8 ; space for tmp moves!\n")      \
1040 /* do we need reg def's R0 = %0 etc ??? */                      \
1041 )
1042 #else
1043 #define ASM_FILE_START(FILE)    (0)
1044 #endif
1045
1046
1047 /* Output to assembler file text saying following lines
1048    may contain character constants, extra white space, comments, etc.  */
1049
1050 #define ASM_APP_ON ""
1051
1052 /* Output to assembler file text saying following lines
1053    no longer contain unusual constructs.  */
1054
1055 #define ASM_APP_OFF ""
1056
1057 /* Output before read-only data.  */
1058
1059 #define TEXT_SECTION_ASM_OP "\t.text\n"
1060
1061 /* Output before writable data.  */
1062
1063 #define DATA_SECTION_ASM_OP "\t.data\n"
1064
1065 /* How to refer to registers in assembler output.
1066    This sequence is indexed by compiler's hard-register-number (see above).  */
1067
1068 #define REGISTER_NAMES \
1069 {"r0", "r1", "r2", "r3", "r4", "fp", "sp", "pc",     \
1070  "ac0", "ac1", "ac2", "ac3", "ac4", "ac5" }
1071
1072 /* How to renumber registers for dbx and gdb.  */
1073
1074 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
1075
1076 /* This is how to output the definition of a user-level label named NAME,
1077    such as the label on a static function or variable NAME.  */
1078
1079 #define ASM_OUTPUT_LABEL(FILE,NAME)     \
1080   do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1081
1082 /* This is how to output a command to make the user-level label named NAME
1083    defined for reference from other files.  */
1084
1085 #define ASM_GLOBALIZE_LABEL(FILE,NAME)  \
1086   do { fputs ("\t.globl ", FILE); assemble_name (FILE, NAME); fputs("\n", FILE); } while (0)
1087
1088 /* The prefix to add to user-visible assembler symbols. */
1089
1090 #define USER_LABEL_PREFIX "_"
1091
1092 /* This is how to output an internal numbered label where
1093    PREFIX is the class of label and NUM is the number within the class.  */
1094
1095 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)      \
1096   fprintf (FILE, "%s_%d:\n", PREFIX, NUM)
1097
1098 /* This is how to store into the string LABEL
1099    the symbol_ref name of an internal numbered label where
1100    PREFIX is the class of label and NUM is the number within the class.
1101    This is suitable for output with `assemble_name'.  */
1102
1103 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)   \
1104   sprintf (LABEL, "*%s_%d", PREFIX, NUM)
1105
1106 /* This is how to output an assembler line defining a `double' constant.  */
1107
1108 #define ASM_OUTPUT_DOUBLE(FILE,VALUE)  \
1109   fprintf (FILE, "\tdouble %.20e\n", (VALUE))
1110
1111 /* This is how to output an assembler line defining a `float' constant.  */
1112
1113 #define ASM_OUTPUT_FLOAT(FILE,VALUE)  \
1114   fprintf (FILE, "\tfloat %.12e\n", (VALUE))
1115
1116 /* This is how to output an assembler line defining an `int' constant.  */
1117
1118 #define ASM_OUTPUT_INT(FILE,VALUE)  \
1119 ( fprintf (FILE, "\t.word "),                   \
1120   output_addr_const (FILE, (VALUE)),            \
1121   fprintf (FILE, "\n"))
1122
1123 /* Likewise for `short' and `char' constants.  */
1124
1125 #define ASM_OUTPUT_SHORT(FILE,VALUE)  \
1126 ( fprintf (FILE, "\t.word "),                   \
1127   output_addr_const (FILE, (VALUE)),            \
1128   fprintf (FILE, " /*short*/\n"))
1129
1130 #define ASM_OUTPUT_CHAR(FILE,VALUE)  \
1131 ( fprintf (FILE, "\t.byte "),                   \
1132   output_addr_const (FILE, (VALUE)),            \
1133   fprintf (FILE, " /* char */\n"))
1134
1135 /* This is how to output an assembler line for a numeric constant byte.-
1136
1137    do we really NEED it ? let's output it with a comment and grep the 
1138    assembly source ;-)
1139 */
1140
1141 #define ASM_OUTPUT_BYTE(FILE,VALUE)  \
1142   fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1143
1144 #define ASM_OUTPUT_ASCII(FILE, P, SIZE)  \
1145   output_ascii (FILE, P, SIZE)
1146
1147 #define ASM_OUTPUT_ADDR_VEC_PROLOGUE(FILE, MODE, LEN)   \
1148   fprintf (FILE, "\t/* HELP! */\n");
1149
1150 /* This is how to output an element of a case-vector that is absolute.  */
1151
1152 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
1153   fprintf (FILE, "\t.word L_%d\n", VALUE)
1154
1155 /* This is how to output an element of a case-vector that is relative.
1156    Don't define this if it is not supported. */
1157
1158 /* #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) */
1159
1160 /* This is how to output an assembler line
1161    that says to advance the location counter
1162    to a multiple of 2**LOG bytes. 
1163
1164    who needs this????
1165 */
1166
1167 #define ASM_OUTPUT_ALIGN(FILE,LOG)      \
1168   if ((LOG) != 0)                       \
1169     fprintf (FILE, "\t.align %d\n", 1<<(LOG))
1170
1171 #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
1172   fprintf (FILE, "\t.=.+ %d\n", (SIZE))
1173
1174 /* This says how to output an assembler line
1175    to define a global common symbol.  */
1176
1177 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
1178 ( fprintf ((FILE), ".globl "),                  \
1179   assemble_name ((FILE), (NAME)),               \
1180   fprintf ((FILE), "\n"),                       \
1181   assemble_name ((FILE), (NAME)),               \
1182   fprintf ((FILE), ": .=.+ %d\n", (ROUNDED))            \
1183 )
1184
1185 /* This says how to output an assembler line
1186    to define a local common symbol.  */
1187
1188 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
1189 ( assemble_name ((FILE), (NAME)),                               \
1190   fprintf ((FILE), ":\t.=.+ %d\n", (ROUNDED)))
1191
1192 /* Store in OUTPUT a string (made with alloca) containing
1193    an assembler-name for a local static variable named NAME.
1194    LABELNO is an integer which is different for each call.  */
1195
1196 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)  \
1197 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),    \
1198   sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1199
1200 /* Define the parentheses used to group arithmetic operations
1201    in assembler code.  */
1202
1203 #define ASM_OPEN_PAREN "("
1204 #define ASM_CLOSE_PAREN ")"
1205
1206 /* Define results of standard character escape sequences.  */
1207 #define TARGET_BELL 007
1208 #define TARGET_BS 010
1209 #define TARGET_TAB 011
1210 #define TARGET_NEWLINE 012
1211 #define TARGET_VT 013
1212 #define TARGET_FF 014
1213 #define TARGET_CR 015
1214
1215 /* Print operand X (an rtx) in assembler syntax to file FILE.
1216    CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1217    For `%' followed by punctuation, CODE is the punctuation and X is null.
1218
1219 */
1220
1221
1222 #define PRINT_OPERAND(FILE, X, CODE)  \
1223 { if (CODE == '#') fprintf (FILE, "#");                                 \
1224   else if (GET_CODE (X) == REG)                                         \
1225     fprintf (FILE, "%s", reg_names[REGNO (X)]);                         \
1226   else if (GET_CODE (X) == MEM)                                         \
1227     output_address (XEXP (X, 0));                                       \
1228   else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != SImode)      \
1229     { union { double d; int i[2]; } u;                                  \
1230       u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X);    \
1231       fprintf (FILE, "#%.20e", u.d); }                                  \
1232   else { putc ('$', FILE); output_addr_const (FILE, X); }}
1233 \f
1234 /* Print a memory address as an operand to reference that memory location.  */
1235
1236 #define PRINT_OPERAND_ADDRESS(FILE, ADDR)  \
1237  print_operand_address (FILE, ADDR)
1238
1239 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)                 \
1240 (                                                       \
1241   fprintf (FILE, "\tmov %s, -(sp)\n", reg_names[REGNO]) \
1242 )
1243
1244 #define ASM_OUTPUT_REG_POP(FILE,REGNO)                          \
1245 (                                                               \
1246   fprintf (FILE, "\tmov (sp)+, %s\n", reg_names[REGNO])         \
1247 )
1248
1249
1250 #define ASM_IDENTIFY_GCC(FILE)                  \
1251     fprintf(FILE, "gcc_compiled:\n")
1252
1253 #define ASM_OUTPUT_DOUBLE_INT(a,b)      fprintf(a,"%d", b)
1254
1255 /* trampoline - how should i do it in separate i+d ? 
1256    have some allocate_trampoline magic??? 
1257
1258    the following should work for shared I/D: */
1259
1260 /* lets see whether this works as trampoline:
1261 MV      #STATIC, $4     0x940Y  0x0000 <- STATIC; Y = STATIC_CHAIN_REGNUM
1262 JMP     FUNCTION        0x0058  0x0000 <- FUNCTION
1263 */
1264
1265 #define TRAMPOLINE_TEMPLATE(FILE)       \
1266 {                                       \
1267   if (TARGET_SPLIT)                     \
1268     abort();                            \
1269                                         \
1270   ASM_OUTPUT_INT (FILE, GEN_INT (0x9400+STATIC_CHAIN_REGNUM)); \
1271   ASM_OUTPUT_INT (FILE, const0_rtx);                            \
1272   ASM_OUTPUT_INT (FILE, GEN_INT(0x0058));                       \
1273   ASM_OUTPUT_INT (FILE, const0_rtx);                            \
1274 }
1275
1276 #define TRAMPOLINE_SIZE 8
1277 #define TRAMPOLINE_ALIGN 16
1278
1279 /* Emit RTL insns to initialize the variable parts of a trampoline.
1280    FNADDR is an RTX for the address of the function's pure code.
1281    CXT is an RTX for the static chain value for the function.  */
1282
1283 #define INITIALIZE_TRAMPOLINE(TRAMP,FNADDR,CXT) \
1284 {                                       \
1285   if (TARGET_SPLIT)                     \
1286     abort();                            \
1287                                         \
1288   emit_move_insn (gen_rtx (MEM, HImode, plus_constant (TRAMP, 2)), CXT); \
1289   emit_move_insn (gen_rtx (MEM, HImode, plus_constant (TRAMP, 6)), FNADDR); \
1290 }
1291
1292
1293 /* Some machines may desire to change what optimizations are
1294    performed for various optimization levels.   This macro, if
1295    defined, is executed once just after the optimization level is
1296    determined and before the remainder of the command options have
1297    been parsed.  Values set in this macro are used as the default
1298    values for the other command line options.
1299
1300    LEVEL is the optimization level specified; 2 if -O2 is
1301    specified, 1 if -O is specified, and 0 if neither is specified.  */
1302
1303 #define OPTIMIZATION_OPTIONS(LEVEL,SIZE)                                \
1304 {                                                                       \
1305   if (LEVEL >= 3)                                                       \
1306     {                                                                   \
1307       if (! SIZE)                                                       \
1308         flag_inline_functions           = 1;                            \
1309       flag_omit_frame_pointer           = 1;                            \
1310       /* flag_unroll_loops                      = 1; */                 \
1311     }                                                                   \
1312 }
1313
1314
1315 /* Provide the costs of a rtl expression.  This is in the body of a
1316    switch on CODE. 
1317
1318    we don't say how expensive SImode is - pretty expensive!!!
1319
1320    there is something wrong in MULT because MULT is not 
1321    as cheap as total = 2 even if we can shift!
1322
1323    if optimizing for size make mult etc cheap, but not 1, so when 
1324    in doubt the faster insn is chosen.
1325 */
1326
1327 #define RTX_COSTS(X,CODE,OUTER_CODE) \
1328   case MULT:                                                            \
1329     if (optimize_size)                                                  \
1330       total = COSTS_N_INSNS(2);                                         \
1331     else                                                                \
1332       total = COSTS_N_INSNS (11);                                       \
1333     break;                                                              \
1334   case DIV:                                                             \
1335     if (optimize_size)                                                  \
1336       total = COSTS_N_INSNS(2);                                         \
1337     else                                                                \
1338       total = COSTS_N_INSNS (25);                                       \
1339     break;                                                              \
1340   case MOD:                                                             \
1341     if (optimize_size)                                                  \
1342       total = COSTS_N_INSNS(2);                                         \
1343     else                                                                \
1344       total = COSTS_N_INSNS (26);                                       \
1345     break;                                                              \
1346   case ABS:                                                             \
1347     /* equivalent to length, so same for optimize_size */               \
1348     total = COSTS_N_INSNS (3);                                          \
1349     break;                                                              \
1350   case ZERO_EXTEND:                                                     \
1351     /* only used for: qi->hi */                                         \
1352     total = COSTS_N_INSNS(1);                                           \
1353     break;                                                              \
1354   case SIGN_EXTEND:                                                     \
1355     if (GET_MODE(X) == HImode)                                          \
1356         total = COSTS_N_INSNS(1);                                       \
1357     else if (GET_MODE(X) == SImode)                                     \
1358         total = COSTS_N_INSNS(6);                                       \
1359     else                                                                \
1360         total = COSTS_N_INSNS(2);                                       \
1361     break;                                                              \
1362   /* case LSHIFT: */                                                    \
1363   case ASHIFT:                                                          \
1364   case LSHIFTRT:                                                        \
1365   case ASHIFTRT:                                                        \
1366     if (optimize_size)                                                  \
1367       total = COSTS_N_INSNS(1);                                         \
1368     else if (GET_MODE(X) ==  QImode)                                    \
1369     {                                                                   \
1370       if (GET_CODE(XEXP (X,1)) != CONST_INT)                            \
1371         total = COSTS_N_INSNS(8); /* worst case */                      \
1372       else                                                              \
1373         total = COSTS_N_INSNS(INTVAL(XEXP (X,1)));                      \
1374     }                                                                   \
1375     else if (GET_MODE(X) == HImode)                                     \
1376     {                                                                   \
1377       if (GET_CODE(XEXP (X,1)) == CONST_INT)                            \
1378       {                                                                 \
1379         if (abs (INTVAL (XEXP (X, 1))) == 1)                            \
1380           total = COSTS_N_INSNS(1);                                     \
1381         else                                                            \
1382           total = COSTS_N_INSNS(2.5 + 0.5 *INTVAL(XEXP(X,1)));          \
1383       }                                                                 \
1384       else /* worst case */                                             \
1385         total = COSTS_N_INSNS (10);                                     \
1386     }                                                                   \
1387     else if (GET_MODE(X) == SImode)                                     \
1388     {                                                                   \
1389       if (GET_CODE(XEXP (X,1)) == CONST_INT)                            \
1390           total = COSTS_N_INSNS(2.5 + 0.5 *INTVAL(XEXP(X,1)));          \
1391       else /* worst case */                                             \
1392         total = COSTS_N_INSNS(18);                                      \
1393     }                                                                   \
1394     break;
1395
1396
1397 /* there is no point in avoiding branches on a pdp, 
1398    since branches are really cheap - I just want to find out
1399    how much difference the BRANCH_COST macro makes in code */
1400 #define BRANCH_COST (TARGET_BRANCH_CHEAP ? 0 : 1)
1401
1402
1403 #define COMPARE_FLAG_MODE HImode
1404