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