]> gcc.gnu.org Git - gcc.git/blob - gcc/config/pa/pa.h
* pa.h (DEFAULT_GDB_EXTENSIONS): GDB extensions are on by default.
[gcc.git] / gcc / config / pa / pa.h
1 /* Definitions of target machine for GNU compiler, for the HP Spectrum.
2 Copyright (C) 1992, 1993 Free Software Foundation, Inc.
3 Contributed by Michael Tiemann (tiemann@mcc.com)
4 and Tim Moore (moore@defmacro.cs.utah.edu) of the Center for
5 Software Science at the University of Utah.
6
7 This file is part of GNU CC.
8
9 GNU CC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 1, or (at your option)
12 any later version.
13
14 GNU CC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GNU CC; see the file COPYING. If not, write to
21 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
22
23 enum cmp_type /* comparison type */
24 {
25 CMP_SI, /* compare integers */
26 CMP_SF, /* compare single precision floats */
27 CMP_DF, /* compare double precision floats */
28 CMP_MAX /* max comparison type */
29 };
30
31 /* Print subsidiary information on the compiler version in use. */
32
33 #define TARGET_VERSION fprintf (stderr, " (hppa)");
34
35 /* Run-time compilation parameters selecting different hardware subsets. */
36
37 extern int target_flags;
38
39 /* compile code for HP-PA 1.1 ("Snake") */
40
41 #define TARGET_SNAKE (target_flags & 1)
42
43 /* Disable all FP registers (they all become fixed). This may be necessary
44 for compiling kernels which perform lazy context switching of FP regs.
45 Note if you use this option and try to perform floating point operations
46 the compiler will abort! */
47
48 #define TARGET_DISABLE_FPREGS (target_flags & 2)
49
50 /* Force gcc to only use instructions which are safe when compiling kernels.
51 Specifically, avoid using add instructions with dp (r27) as an argument.
52 Use addil instructions instead. Doing so avoids a nasty bug in the
53 HPUX linker. When HP fixes their linker take this option out. */
54
55 #define TARGET_KERNEL (target_flags & 4)
56
57 /* Allow unconditional jumps in the delay slots of call instructions. */
58 #define TARGET_JUMP_IN_DELAY (target_flags & 8)
59
60 /* Force all function calls to indirect addressing via a register. This
61 avoids lossage when the function is very far away from the current PC.
62
63 ??? What about simple jumps, they can suffer from the same problem.
64 Would require significant surgery in pa.md. */
65
66 #define TARGET_LONG_CALLS (target_flags & 16)
67
68 /* Disable indexed addressing modes. */
69
70 #define TARGET_DISABLE_INDEXING (target_flags & 32)
71
72 /* Force a colon to be tacked onto the end of local and global
73 labels. An option because the HP assembler croaks on them. */
74
75 #define TARGET_TRAILING_COLON (target_flags & 64)
76
77 /* Emit directives only understood by GAS. This allows parameter
78 relocations to work for static functions. There is no way
79 to make them work the HP assembler at this time. */
80
81 #define TARGET_GAS (target_flags & 128)
82
83 /* Macro to define tables used to set the flags.
84 This is a list in braces of pairs in braces,
85 each pair being { "NAME", VALUE }
86 where VALUE is the bits to set or minus the bits to clear.
87 An empty string NAME is used to identify the default VALUE. */
88
89 #define TARGET_SWITCHES \
90 {{"snake", 1}, \
91 {"nosnake", -1}, \
92 {"pa-risc-1-0", -1}, \
93 {"pa-risc-1-1", 1}, \
94 {"disable-fpregs", 2}, \
95 {"no-disable-fpregs", 2}, \
96 {"kernel", 4}, \
97 {"no-kernel", -4}, \
98 {"jump-in-delay", 8}, \
99 {"no-jump-in-delay", -8}, \
100 {"long-calls", 16}, \
101 {"no-long-calls", -16}, \
102 {"disable-indexing", 32}, \
103 {"no-disable-indexing", -32},\
104 {"trailing-colon", 64}, \
105 {"no-trailing-colon", -64}, \
106 {"gas", 128}, \
107 {"no-gas", -128}, \
108 { "", TARGET_DEFAULT}}
109
110 #ifndef TARGET_DEFAULT
111 #define TARGET_DEFAULT 128 /* TARGET_GAS + TARGET_JUMP_IN_DELAY */
112 #endif
113
114 #define DBX_DEBUGGING_INFO
115 #define DEFAULT_GDB_EXTENSIONS 1
116
117 #if (TARGET_DEFAULT & 1) == 0
118 #define CPP_SPEC "%{msnake:-D__hp9000s700 -D_PA_RISC1_1}\
119 %{mpa-risc-1-1:-D__hp9000s700 -D_PA_RISC1_1}"
120 #else
121 #define CPP_SPEC "%{!mpa-risc-1-0:%{!mnosnake:-D__hp9000s700 -D_PA_RISC1_1}}"
122 #endif
123
124 /* Defines for a K&R CC */
125
126 #define CC1_SPEC "%{pg:} %{p:}"
127
128 #define LINK_SPEC "-u main"
129
130 /* Allow $ in identifiers. */
131 #define DOLLARS_IN_IDENTIFIERS 2
132
133 /* Make gcc agree with <machine/ansi.h> */
134
135 #define SIZE_TYPE "unsigned int"
136 #define PTRDIFF_TYPE "int"
137 #define WCHAR_TYPE "short unsigned int"
138 #define WCHAR_TYPE_SIZE 16
139
140 /* Sometimes certain combinations of command options do not make sense
141 on a particular target machine. You can define a macro
142 `OVERRIDE_OPTIONS' to take account of this. This macro, if
143 defined, is executed once just after all the command options have
144 been parsed.
145
146 On the PA, it is used to explicitly warn the user that -fpic and -fPIC
147 do not work. */
148
149 #define OVERRIDE_OPTIONS \
150 { \
151 if (flag_pic != 0) \
152 warning ("-fpic and -fPIC are not supported on the PA."); \
153 }
154
155 /* Omit frame pointer at high optimization levels. */
156
157 #define OPTIMIZATION_OPTIONS(OPTIMIZE) \
158 { \
159 if (OPTIMIZE >= 2) \
160 flag_omit_frame_pointer = 1; \
161 }
162
163 /* Names to predefine in the preprocessor for this target machine. */
164
165 #define CPP_PREDEFINES "-Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -Dunix -D_HPUX_SOURCE -Dhp9000 -Dhp800 -Dspectrum -DREVARGV"
166 \f
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 1
172
173 /* Define this if most significant byte of a word is the lowest numbered. */
174 /* That is true on the HP-PA. */
175 #define BYTES_BIG_ENDIAN 1
176
177 /* Define this if most significant word of a multiword number is lowest
178 numbered. */
179 /* For the HP-PA we can decide arbitrarily
180 since there are no machine instructions for them. */
181 #define WORDS_BIG_ENDIAN 1
182
183 /* number of bits in an addressable storage unit */
184 #define BITS_PER_UNIT 8
185
186 /* Width in bits of a "word", which is the contents of a machine register.
187 Note that this is not necessarily the width of data type `int';
188 if using 16-bit ints on a 68000, this would still be 32.
189 But on a machine with 16-bit registers, this would be 16. */
190 #define BITS_PER_WORD 32
191
192 /* Width of a word, in units (bytes). */
193 #define UNITS_PER_WORD 4
194
195 /* Width in bits of a pointer.
196 See also the macro `Pmode' defined below. */
197 #define POINTER_SIZE 32
198
199 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
200 #define PARM_BOUNDARY 32
201
202 /* Largest alignment required for any stack parameter, in bits.
203 Don't define this if it is equal to PARM_BOUNDARY */
204 #define MAX_PARM_BOUNDARY 64
205
206 /* Boundary (in *bits*) on which stack pointer should be aligned. */
207 #define STACK_BOUNDARY (TARGET_SNAKE ? 512 : 64)
208
209 /* Allocation boundary (in *bits*) for the code of a function. */
210 #define FUNCTION_BOUNDARY 32
211
212 /* Alignment of field after `int : 0' in a structure. */
213 #define EMPTY_FIELD_BOUNDARY 32
214
215 /* Every structure's size must be a multiple of this. */
216 #define STRUCTURE_SIZE_BOUNDARY 8
217
218 /* A bitfield declared as `int' forces `int' alignment for the struct. */
219 #define PCC_BITFIELD_TYPE_MATTERS 1
220
221 /* No data type wants to be aligned rounder than this. */
222 #define BIGGEST_ALIGNMENT 64
223
224 /* Get around hp-ux assembler bug, and make strcpy of constants fast. */
225 #define CONSTANT_ALIGNMENT(CODE, TYPEALIGN) \
226 ((TYPEALIGN) < 32 ? 32 : (TYPEALIGN))
227
228 /* Make arrays of chars word-aligned for the same reasons. */
229 #define DATA_ALIGNMENT(TYPE, ALIGN) \
230 (TREE_CODE (TYPE) == ARRAY_TYPE \
231 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
232 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
233
234
235 /* Set this nonzero if move instructions will actually fail to work
236 when given unaligned data. */
237 #define STRICT_ALIGNMENT 1
238
239 /* Generate calls to memcpy, memcmp and memset. */
240 #define TARGET_MEM_FUNCTIONS
241 \f
242 /* Standard register usage. */
243
244 /* Number of actual hardware registers.
245 The hardware registers are assigned numbers for the compiler
246 from 0 to just below FIRST_PSEUDO_REGISTER.
247 All registers that the compiler knows about must be given numbers,
248 even those that are not normally considered general registers.
249
250 HP-PA 1.0 has 32 fullword registers and 16 floating point
251 registers. The floating point registers hold either word or double
252 word values.
253
254 16 additional registers are reserved.
255
256 HP-PA 1.1 has 32 fullword registers and 32 floating point
257 registers. However, the floating point registers behave
258 differently: the left and right halves of registers are addressable
259 as 32 bit registers. So, we will set things up like the 68k which
260 has different fp units: define separate register sets for the 1.0
261 and 1.1 fp units. */
262
263 #define FIRST_PSEUDO_REGISTER 101 /* 32 + 12 1.0 regs + 56 1.1 regs + */
264 /* 1 shift reg */
265
266 /* 1 for registers that have pervasive standard uses
267 and are not available for the register allocator.
268
269 On the HP-PA, these are:
270 Reg 0 = 0 (hardware). However, 0 is used for condition code,
271 so is not fixed.
272 Reg 1 = ADDIL target/Temporary (hardware).
273 Reg 2 = Return Pointer
274 Reg 3 = Preserved Register (Gnu). Frame Pointer (> 8k frames HP.)
275 Reg 4 = Frame Pointer (Gnu)
276 Reg 5-18 = Preserved Registers
277 Reg 19 = Linkage Table Register in HPUX 8.0 shared library scheme.
278 Reg 20-22 = Temporary Registers
279 Reg 23-26 = Temporary/Parameter Registers
280 Reg 27 = Global Data Pointer (hp)
281 Reg 28 = Temporary/???/Return Value register
282 Reg 29 = Temporary/Static Chain/Return Value register
283 Reg 30 = stack pointer
284 Reg 31 = Temporary/Millicode Return Pointer (hp)
285
286 Freg 0-3 = Status Registers -- Not known to the compiler.
287 Freg 4-7 = Arguments/Return Value
288 Freg 8-11 = Temporary Registers
289 Freg 12-15 = Preserved Registers
290
291 Freg 16-31 = Reserved
292
293 On the Snake, fp regs are
294
295 Freg 0-3 = Status Registers -- Not known to the compiler.
296 Freg 4L-7R = Arguments/Return Value
297 Freg 8L-11R = Temporary Registers
298 Freg 12L-21R = Preserved Registers
299 Freg 22L-31R = Temporary Registers
300
301
302 */
303
304 #define FIXED_REGISTERS \
305 {0, 0, 0, 0, 0, 0, 0, 0, \
306 0, 0, 0, 0, 0, 0, 0, 0, \
307 0, 0, 0, 0, 0, 0, 0, 0, \
308 0, 0, 0, 1, 0, 0, 1, 0, \
309 /* 1.0 fp registers */ \
310 0, 0, 0, 0, \
311 0, 0, 0, 0, 0, 0, 0, 0, \
312 /* 1.1 fp registers */ \
313 0, 0, 0, 0, 0, 0, 0, 0, \
314 0, 0, 0, 0, 0, 0, 0, 0, \
315 0, 0, 0, 0, 0, 0, 0, 0, \
316 0, 0, 0, 0, 0, 0, 0, 0, \
317 0, 0, 0, 0, 0, 0, 0, 0, \
318 0, 0, 0, 0, 0, 0, 0, 0, \
319 0, 0, 0, 0, 0, 0, 0, 0, \
320 0}
321
322 /* 1 for registers not available across function calls.
323 These must include the FIXED_REGISTERS and also any
324 registers that can be used without being saved.
325 The latter must include the registers where values are returned
326 and the register where structure-value addresses are passed.
327 Aside from that, you can include as many other registers as you like. */
328 #define CALL_USED_REGISTERS \
329 {1, 1, 1, 0, 0, 0, 0, 0, \
330 0, 0, 0, 0, 0, 0, 0, 0, \
331 0, 0, 0, 1, 1, 1, 1, 1, \
332 1, 1, 1, 1, 1, 1, 1, 1, \
333 /* 1.0 fp registers */ \
334 1, 1, 1, 1, \
335 1, 1, 1, 1, 0, 0, 0, 0, \
336 /* 1.1 fp registers */ \
337 1, 1, 1, 1, 1, 1, 1, 1, \
338 1, 1, 1, 1, 1, 1, 1, 1, \
339 0, 0, 0, 0, 0, 0, 0, 0, \
340 0, 0, 0, 0, 0, 0, 0, 0, \
341 0, 0, 0, 0, 1, 1, 1, 1, \
342 1, 1, 1, 1, 1, 1, 1, 1, \
343 1, 1, 1, 1, 1, 1, 1, 1, \
344 1}
345
346 /* Make sure everything's fine if we *don't* have a given processor.
347 This assumes that putting a register in fixed_regs will keep the
348 compiler's mitts completely off it. We don't bother to zero it out
349 of register classes. */
350
351 #define CONDITIONAL_REGISTER_USAGE \
352 { \
353 int i; \
354 HARD_REG_SET x; \
355 if (!TARGET_SNAKE) \
356 { \
357 COPY_HARD_REG_SET (x, reg_class_contents[(int)SNAKE_FP_REGS]);\
358 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
359 if (TEST_HARD_REG_BIT (x, i)) \
360 fixed_regs[i] = call_used_regs[i] = 1; \
361 } \
362 else if (TARGET_DISABLE_FPREGS) \
363 { \
364 COPY_HARD_REG_SET (x, reg_class_contents[(int)FP_REGS]);\
365 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
366 if (TEST_HARD_REG_BIT (x, i)) \
367 fixed_regs[i] = call_used_regs[i] = 1; \
368 COPY_HARD_REG_SET (x, reg_class_contents[(int)SNAKE_FP_REGS]);\
369 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
370 if (TEST_HARD_REG_BIT (x, i)) \
371 fixed_regs[i] = call_used_regs[i] = 1; \
372 } \
373 else \
374 { \
375 COPY_HARD_REG_SET (x, reg_class_contents[(int)FP_REGS]); \
376 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
377 if (TEST_HARD_REG_BIT (x, i)) \
378 fixed_regs[i] = call_used_regs[i] = 1; \
379 } \
380 if (flag_pic) \
381 fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
382 }
383
384 /* Allocated the call used registers first. This should minimize
385 the number of registers that need to be saved (as call used
386 registers will generally not be allocated across a call).
387
388 Experimentation has shown slightly better results by allocating
389 FP registers first. */
390
391 #define REG_ALLOC_ORDER \
392 /* 1.0 caller-saved fp regs. */ \
393 {36, 37, 38, 39, 32, 33, 34, 35, \
394 /* 1.1 caller-saved fp regs. */ \
395 52, 53, 54, 55, 56, 57, 58, 59, \
396 80, 81, 82, 83, 84, 85, 86, 87, \
397 88, 89, 90, 91, 92, 93, 94, 95, \
398 96, 97, 98, 99, \
399 44, 45, 46, 47, 48, 49, 50, 51, \
400 /* caller-saved general regs. */ \
401 19, 20, 21, 22, 23, 24, 25, 26, \
402 27, 28, 29, 31, 2, \
403 /* 1.0 callee-saved fp regs. */ \
404 40, 41, 42, 43, \
405 /* 1.1 callee-saved fp regs. */ \
406 60, 61, 62, 63, 64, 65, 66, 67, \
407 68, 69, 70, 71, 72, 73, 74, 75, \
408 76, 77, 78, 79, \
409 /* callee-saved general regs. */ \
410 3, 4, 5, 6, 7, 8, 9, 10, \
411 11, 12, 13, 14, 15, 16, 17, 18, \
412 /* special registers. */ \
413 1, 30, 0, 100}
414
415
416 /* Return number of consecutive hard regs needed starting at reg REGNO
417 to hold something of mode MODE.
418 This is ordinarily the length in words of a value of mode MODE
419 but can be less for certain modes in special long registers.
420
421 On the HP-PA, ordinary registers hold 32 bits worth;
422 The floating point registers are 64 bits wide. Snake fp regs are 32
423 bits wide */
424 #define HARD_REGNO_NREGS(REGNO, MODE) \
425 (((REGNO) < 32 || (REGNO) >= 44) \
426 ? ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) : 1)
427
428 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
429 On the HP-PA, the cpu registers can hold any mode. We
430 force this to be an even register is it cannot hold the full mode. */
431 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
432 ((REGNO) == 0 ? (MODE) == CCmode || (MODE) == CCFPmode \
433 : (REGNO) < 32 ? ((GET_MODE_SIZE (MODE) <= 4) ? 1 : ((REGNO) & 1) == 0)\
434 : (REGNO) < 44 ? (GET_MODE_SIZE (MODE) <= 4 \
435 || (GET_MODE_SIZE (MODE) > 4 \
436 && GET_MODE_CLASS (MODE) == MODE_FLOAT)) \
437 : (GET_MODE_SIZE (MODE) > 4 ? ((REGNO) & 1) == 0 \
438 : 1))
439
440 /* Value is 1 if it is a good idea to tie two pseudo registers
441 when one has mode MODE1 and one has mode MODE2.
442 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
443 for any hard reg, then this must be 0 for correct output. */
444 #define MODES_TIEABLE_P(MODE1, MODE2) \
445 (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
446
447 /* Specify the registers used for certain standard purposes.
448 The values of these macros are register numbers. */
449
450 /* The HP-PA pc isn't overloaded on a register that the compiler knows about. */
451 /* #define PC_REGNUM */
452
453 /* Register to use for pushing function arguments. */
454 #define STACK_POINTER_REGNUM 30
455
456 /* Base register for access to local variables of the function. */
457 #define FRAME_POINTER_REGNUM 4
458
459 /* Value should be nonzero if functions must have frame pointers. */
460 #define FRAME_POINTER_REQUIRED (current_function_calls_alloca)
461
462
463 /* C statement to store the difference between the frame pointer
464 and the stack pointer values immediately after the function prologue.
465
466 Note, we always pretend that this is a leaf function because if
467 it's not, there's no point in trying to eliminate the
468 frame pointer. If it is a leaf function, we guessed right! */
469 #define INITIAL_FRAME_POINTER_OFFSET(VAR) \
470 do {(VAR) = - compute_frame_size (get_frame_size (), 0);} while (0)
471
472 /* Base register for access to arguments of the function. */
473 #define ARG_POINTER_REGNUM 4
474
475 /* Register in which static-chain is passed to a function. */
476 /* ??? */
477 #define STATIC_CHAIN_REGNUM 29
478
479 /* Register which holds offset table for position-independent
480 data references. */
481
482 #define PIC_OFFSET_TABLE_REGNUM 19
483
484 #define INITIALIZE_PIC initialize_pic ()
485 #define FINALIZE_PIC finalize_pic ()
486
487 /* Register in which address to store a structure value
488 is passed to a function. */
489 #define STRUCT_VALUE_REGNUM 28
490 \f
491 /* Define the classes of registers for register constraints in the
492 machine description. Also define ranges of constants.
493
494 One of the classes must always be named ALL_REGS and include all hard regs.
495 If there is more than one class, another class must be named NO_REGS
496 and contain no registers.
497
498 The name GENERAL_REGS must be the name of a class (or an alias for
499 another name such as ALL_REGS). This is the class of registers
500 that is allowed by "g" or "r" in a register constraint.
501 Also, registers outside this class are allocated only when
502 instructions express preferences for them.
503
504 The classes must be numbered in nondecreasing order; that is,
505 a larger-numbered class must never be contained completely
506 in a smaller-numbered class.
507
508 For any two classes, it is very desirable that there be another
509 class that represents their union. */
510
511 /* The HP-PA has four kinds of registers: general regs, 1.0 fp regs,
512 1.1 fp regs, and the high 1.1 fp regs, to which the operands of
513 fmpyadd and fmpysub are restricted.
514
515 FP_OR_SNAKE_FP_REGS is for reload_{in,out}di only and isn't used
516 anywhere else. */
517
518 enum reg_class { NO_REGS, R1_REGS, GENERAL_REGS, FP_REGS, GENERAL_OR_FP_REGS,
519 HI_SNAKE_FP_REGS, SNAKE_FP_REGS, GENERAL_OR_SNAKE_FP_REGS,
520 FP_OR_SNAKE_FP_REGS, NON_SHIFT_REGS, SHIFT_REGS, ALL_REGS, LIM_REG_CLASSES};
521
522 #define N_REG_CLASSES (int) LIM_REG_CLASSES
523
524 /* Give names of register classes as strings for dump file. */
525
526 #define REG_CLASS_NAMES \
527 { "NO_REGS", "R1_REGS", "GENERAL_REGS", "FP_REGS", "GENERAL_OR_FP_REGS",\
528 "HI_SNAKE_FP_REGS", "SNAKE_FP_REGS", "GENERAL_OR_SNAKE_FP_REGS",\
529 "FP_OR_SNAKE_FP_REGS", "NON_SHIFT_REGS", "SHIFT_REGS", "ALL_REGS"}
530
531 /* Define which registers fit in which classes.
532 This is an initializer for a vector of HARD_REG_SET
533 of length N_REG_CLASSES. Register 0, the "condition code" register,
534 is in no class. */
535
536 #define REG_CLASS_CONTENTS \
537 { {0, 0, 0, 0}, /* NO_REGS */ \
538 {0x2, 0, 0, 0}, /* R1_REGS */ \
539 {-2, 0, 0, 0}, /* GENERAL_REGS */ \
540 {0, 0xfff, 0, 0}, /* FP_REGS */ \
541 {-2, 0xfff, 0, 0}, /* GENERAL_OR_FP_REGS */\
542 {0, 0, 0xfffffff0, 0xf}, /* HI_SNAKE_FP_REGS */ \
543 {0, 0xfffff000, ~0, 0xf}, /* SNAKE_FP_REGS */ \
544 {-2, 0xfffff000, ~0, 0xf}, /* GENERAL_OR_SNAKE_FP_REGS */\
545 {0, ~0, ~0, 0xf}, /* FP_OR_SNAKE_FP_REGS */\
546 {-2, ~0, ~0, ~0x10}, /* NON_SHIFT_REGS */ \
547 {0, 0, 0, 0x10}, /* SHIFT_REGS */ \
548 {-2, ~0, ~0, 0x1f}} /* ALL_REGS */
549
550 /* The same information, inverted:
551 Return the class number of the smallest class containing
552 reg number REGNO. This could be a conditional expression
553 or could index an array. */
554
555 #define REGNO_REG_CLASS(REGNO) \
556 ((REGNO) == 0 ? NO_REGS \
557 : (REGNO) == 1 ? R1_REGS \
558 : (REGNO) < 32 ? GENERAL_REGS \
559 : (REGNO) < 44 ? FP_REGS \
560 : (REGNO) < 68 ? SNAKE_FP_REGS \
561 : (REGNO) < 100 ? HI_SNAKE_FP_REGS \
562 : SHIFT_REGS)
563
564 /* The class value for index registers, and the one for base regs. */
565 #define INDEX_REG_CLASS GENERAL_REGS
566 #define BASE_REG_CLASS GENERAL_REGS
567
568 #define FP_REG_CLASS_P(CLASS) \
569 (CLASS == FP_REGS || CLASS == SNAKE_FP_REGS || CLASS == HI_SNAKE_FP_REGS)
570
571 /* Get reg_class from a letter such as appears in the machine description.
572 Note 'Z' is not the same as 'r' since SHIFT_REGS is not part of
573 GENERAL_REGS. */
574
575 #define REG_CLASS_FROM_LETTER(C) \
576 ((C) == 'f' ? (!TARGET_SNAKE ? FP_REGS : NO_REGS) : \
577 ((C) == 'x' ? (TARGET_SNAKE ? SNAKE_FP_REGS : NO_REGS) : \
578 ((C) == 'y' ? (TARGET_SNAKE ? HI_SNAKE_FP_REGS : NO_REGS) : \
579 ((C) == 'q' ? SHIFT_REGS : \
580 ((C) == 'a' ? R1_REGS : \
581 ((C) == 'z' ? FP_OR_SNAKE_FP_REGS : \
582 ((C) == 'Z' ? ALL_REGS : NO_REGS)))))))
583
584 /* The letters I, J, K, L and M in a register constraint string
585 can be used to stand for particular ranges of immediate operands.
586 This macro defines what the ranges are.
587 C is the letter, and VALUE is a constant value.
588 Return 1 if VALUE is in the range specified by C.
589
590 `I' is used for the 11 bit constants.
591 `J' is used for the 14 bit constants.
592 `K' is used for values that can be moved with a zdepi insn.
593 `L' is used for the 5 bit constants.
594 `M' is used for 0.
595 `N' is used for values with the least significant 11 bits equal to zero.
596 `O' is used for numbers n such that n+1 is a power of 2.
597 */
598
599 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
600 ((C) == 'I' ? VAL_11_BITS_P (VALUE) \
601 : (C) == 'J' ? VAL_14_BITS_P (VALUE) \
602 : (C) == 'K' ? zdepi_cint_p (VALUE) \
603 : (C) == 'L' ? VAL_5_BITS_P (VALUE) \
604 : (C) == 'M' ? (VALUE) == 0 \
605 : (C) == 'N' ? ((VALUE) & 0x7ff) == 0 \
606 : (C) == 'O' ? (((VALUE) & ((VALUE) + 1)) == 0) \
607 : (C) == 'P' ? and_mask_p (VALUE) \
608 : 0)
609
610 /* Similar, but for floating or large integer constants, and defining letters
611 G and H. Here VALUE is the CONST_DOUBLE rtx itself.
612
613 For PA, `G' is the floating-point constant zero. `H' is undefined. */
614
615 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
616 ((C) == 'G' ? (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \
617 && (VALUE) == CONST0_RTX (GET_MODE (VALUE))) \
618 : 0)
619
620 /* Given an rtx X being reloaded into a reg required to be
621 in class CLASS, return the class of reg to actually use.
622 In general this is just CLASS; but on some machines
623 in some cases it is preferable to use a more restrictive class. */
624 #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
625
626 /* Return the register class of a scratch register needed to copy IN into
627 or out of a register in CLASS in MODE. If it can be done directly,
628 NO_REGS is returned. */
629
630 #define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
631 secondary_reload_class (CLASS, MODE, IN)
632
633 /* On the PA it is not possible to directly move data between
634 GENERAL_REGS and FP_REGS. */
635 #define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \
636 ((FP_REG_CLASS_P (CLASS1) && ! FP_REG_CLASS_P (CLASS2)) \
637 || (! FP_REG_CLASS_P (CLASS1) && FP_REG_CLASS_P (CLASS2)))
638
639 /* Return the stack location to use for secondary memory needed reloads. */
640 #define SECONDARY_MEMORY_NEEDED_RTX(MODE) \
641 gen_rtx (MEM, MODE, gen_rtx (PLUS, Pmode, stack_pointer_rtx, GEN_INT (-16)))
642
643 /* Return the maximum number of consecutive registers
644 needed to represent mode MODE in a register of class CLASS. */
645 #define CLASS_MAX_NREGS(CLASS, MODE) \
646 ((CLASS) == FP_REGS ? 1 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
647 \f
648 /* Stack layout; function entry, exit and calling. */
649
650 /* Define this if pushing a word on the stack
651 makes the stack pointer a smaller address. */
652 /* #define STACK_GROWS_DOWNWARD */
653
654 /* Believe it or not. */
655 #define ARGS_GROW_DOWNWARD
656
657 /* Define this if the nominal address of the stack frame
658 is at the high-address end of the local variables;
659 that is, each additional local variable allocated
660 goes at a more negative offset in the frame. */
661 /* #define FRAME_GROWS_DOWNWARD */
662
663 /* Offset within stack frame to start allocating local variables at.
664 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
665 first local allocated. Otherwise, it is the offset to the BEGINNING
666 of the first local allocated. */
667 #define STARTING_FRAME_OFFSET 8
668
669 /* If we generate an insn to push BYTES bytes,
670 this says how many the stack pointer really advances by.
671 On the HP-PA, don't define this because there are no push insns. */
672 /* #define PUSH_ROUNDING(BYTES) */
673
674 /* Offset of first parameter from the argument pointer register value.
675 This value will be negated because the arguments grow down.
676 Also note that on STACK_GROWS_UPWARD machines (such as this one)
677 this is the distance from the frame pointer to the end of the first
678 argument, not it's beginning. To get the real offset of the first
679 argument, the size of the argument must be added.
680
681 ??? Have to check on this.*/
682
683 #define FIRST_PARM_OFFSET(FNDECL) -32
684
685 /* Absolute value of offset from top-of-stack address to location to store the
686 function parameter if it can't go in a register.
687 Addresses for following parameters are computed relative to this one. */
688 #define FIRST_PARM_CALLER_OFFSET(FNDECL) -32
689
690
691 /* When a parameter is passed in a register, stack space is still
692 allocated for it. */
693 #define REG_PARM_STACK_SPACE(DECL) 16
694
695 /* Define this if the above stack space is to be considered part of the
696 space allocated by the caller. */
697 #define OUTGOING_REG_PARM_STACK_SPACE
698
699 /* Keep the stack pointer constant throughout the function.
700 This is both an optimization and a necessity: longjmp
701 doesn't behave itself when the stack pointer moves within
702 the function! */
703 #define ACCUMULATE_OUTGOING_ARGS
704
705 /* The weird HPPA calling conventions require a minimum of 48 bytes on
706 the stack: 16 bytes for register saves, and 32 bytes for magic.
707 This is the difference between the logical top of stack and the
708 actual sp. */
709 #define STACK_POINTER_OFFSET -32
710
711 #define STACK_DYNAMIC_OFFSET(FNDECL) \
712 ((STACK_POINTER_OFFSET) - current_function_outgoing_args_size)
713
714 /* Value is 1 if returning from a function call automatically
715 pops the arguments described by the number-of-args field in the call.
716 FUNTYPE is the data type of the function (as a tree),
717 or for a library call it is an identifier node for the subroutine name. */
718
719 #define RETURN_POPS_ARGS(FUNTYPE,SIZE) 0
720
721 /* Define how to find the value returned by a function.
722 VALTYPE is the data type of the value (as a tree).
723 If the precise function being called is known, FUNC is its FUNCTION_DECL;
724 otherwise, FUNC is 0. */
725
726 /* On the HP-PA the value is found in register(s) 28(-29), unless
727 the mode is SF or DF. Then the value is returned in fr4 (32, ) */
728
729
730 #define FUNCTION_VALUE(VALTYPE, FUNC) \
731 gen_rtx (REG, TYPE_MODE (VALTYPE), ((TYPE_MODE (VALTYPE) == SFmode ||\
732 TYPE_MODE (VALTYPE) == DFmode) ? \
733 (TARGET_SNAKE ? 44 : 32) : 28))
734
735 /* Define how to find the value returned by a library function
736 assuming the value has mode MODE. */
737
738 #define LIBCALL_VALUE(MODE) \
739 gen_rtx (REG, MODE, (MODE == SFmode || MODE == DFmode ?\
740 (TARGET_SNAKE ? 44 : 32) : 28))
741
742 /* 1 if N is a possible register number for a function value
743 as seen by the caller. */
744
745 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 28 || (N) == (TARGET_SNAKE ? 44 : 32))
746
747 /* 1 if N is a possible register number for function argument passing. */
748
749 #define FUNCTION_ARG_REGNO_P(N) \
750 (((N) >= 23 && (N) <= 26) \
751 || ((N) >= 32 && (N) <= 35 && ! TARGET_SNAKE) \
752 || ((N) >= 44 && (N) <= 51 && TARGET_SNAKE))
753 \f
754 /* Define a data type for recording info about an argument list
755 during the scan of that argument list. This data type should
756 hold all necessary information about the function itself
757 and about the args processed so far, enough to enable macros
758 such as FUNCTION_ARG to determine where the next arg should go.
759
760 On the HP-PA, this is a single integer, which is a number of words
761 of arguments scanned so far (including the invisible argument,
762 if any, which holds the structure-value-address).
763 Thus 4 or more means all following args should go on the stack. */
764
765 #define CUMULATIVE_ARGS int
766
767 /* Initialize a variable CUM of type CUMULATIVE_ARGS
768 for a call to a function whose data type is FNTYPE.
769 For a library call, FNTYPE is 0.
770 */
771
772 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) ((CUM) = 0)
773
774 /* Figure out the size in words of the function argument. */
775
776 #define FUNCTION_ARG_SIZE(MODE, TYPE) \
777 ((((MODE) != BLKmode ? GET_MODE_SIZE (MODE) : int_size_in_bytes (TYPE))+3)/4)
778
779 /* Update the data in CUM to advance over an argument
780 of mode MODE and data type TYPE.
781 (TYPE is null for libcalls where that information may not be available.) */
782
783 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
784 (((((CUM) & 01) && (TYPE) != 0 && FUNCTION_ARG_SIZE(MODE, TYPE) > 1)\
785 && (CUM)++), (CUM) += FUNCTION_ARG_SIZE(MODE, TYPE))
786
787 /* Determine where to put an argument to a function.
788 Value is zero to push the argument on the stack,
789 or a hard register in which to store the argument.
790
791 MODE is the argument's machine mode.
792 TYPE is the data type of the argument (as a tree).
793 This is null for libcalls where that information may
794 not be available.
795 CUM is a variable of type CUMULATIVE_ARGS which gives info about
796 the preceding args and about the function being called.
797 NAMED is nonzero if this argument is a named parameter
798 (otherwise it is an extra parameter matching an ellipsis). */
799
800 /* On the HP-PA the first four words of args are normally in registers
801 and the rest are pushed. But any arg that won't entirely fit in regs
802 is pushed.
803
804 Arguments passed in registers are either 1 or 2 words long.
805
806 The caller must make a distinction between calls to explicitly named
807 functions and calls through pointers to functions -- the conventions
808 are different! Calls through pointers to functions only use general
809 registers for the first four argument words. */
810
811 #define FUNCTION_ARG_PADDING(MODE, TYPE) function_arg_padding ((MODE), (TYPE))
812
813 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
814 (4 >= ((CUM) + FUNCTION_ARG_SIZE ((MODE), (TYPE))) \
815 ? gen_rtx (REG, (MODE), \
816 (FUNCTION_ARG_SIZE ((MODE), (TYPE)) > 1 \
817 ? ((! current_call_is_indirect \
818 && (MODE) == DFmode) \
819 ? ((CUM) ? (TARGET_SNAKE ? 50 : 35) \
820 : (TARGET_SNAKE ? 46 : 33)) \
821 : ((CUM) ? 23 : 25)) \
822 : ((! current_call_is_indirect \
823 && (MODE) == SFmode) \
824 ? (TARGET_SNAKE ? 44 + 2 * (CUM) : 32 + (CUM)) \
825 : (27 - (CUM) - FUNCTION_ARG_SIZE ((MODE), (TYPE))))))\
826 : 0)
827
828 /* Define where a function finds its arguments.
829 This would be different from FUNCTION_ARG if we had register windows. */
830
831 #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
832 FUNCTION_ARG (CUM, MODE, TYPE, NAMED)
833
834 /* For an arg passed partly in registers and partly in memory,
835 this is the number of registers used.
836 For args passed entirely in registers or entirely in memory, zero. */
837
838 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
839
840 /* If defined, a C expression that gives the alignment boundary, in
841 bits, of an argument with the specified mode and type. If it is
842 not defined, `PARM_BOUNDARY' is used for all arguments. */
843
844 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
845 (((TYPE) != 0) \
846 ? ((TYPE_ALIGN(TYPE) <= PARM_BOUNDARY) \
847 ? PARM_BOUNDARY \
848 : TYPE_ALIGN(TYPE)) \
849 : ((GET_MODE_ALIGNMENT(MODE) <= PARM_BOUNDARY) \
850 ? PARM_BOUNDARY \
851 : GET_MODE_ALIGNMENT(MODE)))
852
853 /* Arguments larger than eight bytes are passed by invisible reference */
854
855 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
856 ((TYPE) && int_size_in_bytes (TYPE) > 8)
857 \f
858 extern struct rtx_def *hppa_compare_op0, *hppa_compare_op1;
859 extern enum cmp_type hppa_branch_type;
860
861 /* Output the label for a function definition. */
862 #ifndef HP_FP_ARG_DESCRIPTOR_REVERSED
863 #define ASM_DOUBLE_ARG_DESCRIPTORS(FILE, ARG0, ARG1) \
864 do { fprintf (FILE, ",ARGW%d=FR", (ARG0)); \
865 fprintf (FILE, ",ARGW%d=FU", (ARG1));} while (0)
866 #else
867 #define ASM_DOUBLE_ARG_DESCRIPTORS(FILE, ARG0, ARG1) \
868 do { fprintf (FILE, ",ARGW%d=FU", (ARG0)); \
869 fprintf (FILE, ",ARGW%d=FR", (ARG1));} while (0)
870 #endif
871
872 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
873 do { tree fntype = TREE_TYPE (TREE_TYPE (DECL)); \
874 tree tree_type = TREE_TYPE (DECL); \
875 tree parm; \
876 int i; \
877 if (TREE_PUBLIC (DECL) || TARGET_GAS) \
878 { extern int current_function_varargs; \
879 if (TREE_PUBLIC (DECL)) \
880 { \
881 fputs ("\t.EXPORT ", FILE); \
882 assemble_name (FILE, NAME); \
883 fputs (",ENTRY,PRIV_LEV=3", FILE); \
884 } \
885 else \
886 { \
887 fputs ("\t.PARAM ", FILE); \
888 assemble_name (FILE, NAME); \
889 } \
890 for (parm = DECL_ARGUMENTS (DECL), i = 0; parm && i < 4; \
891 parm = TREE_CHAIN (parm)) \
892 { \
893 if (TYPE_MODE (DECL_ARG_TYPE (parm)) == SFmode) \
894 fprintf (FILE, ",ARGW%d=FR", i++); \
895 else if (TYPE_MODE (DECL_ARG_TYPE (parm)) == DFmode) \
896 { \
897 if (i <= 2) \
898 { \
899 if (i == 1) i++; \
900 ASM_DOUBLE_ARG_DESCRIPTORS (FILE, i++, i++); \
901 } \
902 else \
903 break; \
904 } \
905 else \
906 { \
907 int arg_size = \
908 FUNCTION_ARG_SIZE (TYPE_MODE (DECL_ARG_TYPE (parm)),\
909 DECL_ARG_TYPE (parm)); \
910 if (arg_size == 2 && i <= 2) \
911 { \
912 if (i == 1) i++; \
913 fprintf (FILE, ",ARGW%d=GR", i++); \
914 fprintf (FILE, ",ARGW%d=GR", i++); \
915 } \
916 else if (arg_size == 1) \
917 fprintf (FILE, ",ARGW%d=GR", i++); \
918 else \
919 i += arg_size; \
920 } \
921 } \
922 /* anonymous args */ \
923 if ((TYPE_ARG_TYPES (tree_type) != 0 \
924 && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (tree_type)))\
925 != void_type_node)) \
926 || current_function_varargs) \
927 { \
928 for (; i < 4; i++) \
929 fprintf (FILE, ",ARGW%d=GR", i); \
930 } \
931 if (TYPE_MODE (fntype) == DFmode) \
932 fprintf (FILE, ",RTNVAL=FR"); \
933 else if (TYPE_MODE (fntype) == SFmode) \
934 fprintf (FILE, ",RTNVAL=FU"); \
935 else if (fntype != void_type_node) \
936 fprintf (FILE, ",RTNVAL=GR"); \
937 fputs ("\n", FILE); \
938 } \
939 ASM_OUTPUT_LABEL (FILE, NAME);} while (0)
940
941 /* This macro generates the assembly code for function entry.
942 FILE is a stdio stream to output the code to.
943 SIZE is an int: how many units of temporary storage to allocate.
944 Refer to the array `regs_ever_live' to determine which registers
945 to save; `regs_ever_live[I]' is nonzero if register number I
946 is ever used in the function. This macro is responsible for
947 knowing which registers should not be saved even if used. */
948
949 /* On HP-PA, move-double insns between fpu and cpu need an 8-byte block
950 of memory. If any fpu reg is used in the function, we allocate
951 such a block here, at the bottom of the frame, just in case it's needed.
952
953 If this function is a leaf procedure, then we may choose not
954 to do a "save" insn. The decision about whether or not
955 to do this is made in regclass.c. */
956
957 #define FUNCTION_PROLOGUE(FILE, SIZE) \
958 output_function_prologue (FILE, SIZE)
959
960 /* Output assembler code to FILE to increment profiler label # LABELNO
961 for profiling a function entry.
962
963 Because HPUX _mcount is so different, we actually emit the
964 profiling code in function_prologue. This just stores LABELNO for
965 that. */
966
967 #define PROFILE_BEFORE_PROLOGUE
968 #define FUNCTION_PROFILER(FILE, LABELNO) \
969 { extern int hp_profile_labelno; hp_profile_labelno = (LABELNO);}
970
971 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
972 the stack pointer does not matter. The value is tested only in
973 functions that have frame pointers.
974 No definition is equivalent to always zero. */
975
976 extern int may_call_alloca;
977 extern int current_function_pretend_args_size;
978
979 #define EXIT_IGNORE_STACK \
980 (get_frame_size () != 0 \
981 || current_function_calls_alloca || current_function_outgoing_args_size)
982
983
984 /* This macro generates the assembly code for function exit,
985 on machines that need it. If FUNCTION_EPILOGUE is not defined
986 then individual return instructions are generated for each
987 return statement. Args are same as for FUNCTION_PROLOGUE.
988
989 The function epilogue should not depend on the current stack pointer!
990 It should use the frame pointer only. This is mandatory because
991 of alloca; we also take advantage of it to omit stack adjustments
992 before returning. */
993
994 /* This declaration is needed due to traditional/ANSI
995 incompatibilities which cannot be #ifdefed away
996 because they occur inside of macros. Sigh. */
997 extern union tree_node *current_function_decl;
998
999 #define FUNCTION_EPILOGUE(FILE, SIZE) \
1000 output_function_epilogue (FILE, SIZE)
1001
1002 /* Output assembler code for a block containing the constant parts
1003 of a trampoline, leaving space for the variable parts.\
1004
1005 The trampoline sets the static chain pointer to STATIC_CHAIN_REGNUM
1006 and then branches to the specified routine.
1007
1008 This code template is copied from text segment to stack location
1009 and then patched with INITIALIZE_TRAMPOLINE to contain
1010 valid values, and then entered as a subroutine.
1011
1012 It is best to keep this as small as possible to avoid having to
1013 flush multiple lines in the cache. */
1014
1015 #define TRAMPOLINE_TEMPLATE(FILE) \
1016 { \
1017 fprintf (FILE, "\tldw 12(0,%%r22),%%r21\n"); \
1018 fprintf (FILE, "\tbe 0(4,%%r21)\n"); \
1019 fprintf (FILE, "\tldw 16(0,%%r22),%%r29\n"); \
1020 fprintf (FILE, "\t.word 0\n"); \
1021 fprintf (FILE, "\t.word 0\n"); \
1022 }
1023
1024 /* Length in units of the trampoline for entering a nested function.
1025
1026 Flush the cache entries corresponding to the first and last addresses
1027 of the trampoline. This is necessary as the trampoline may cross two
1028 cache lines.
1029
1030 If the trampoline ever grows to > 32 bytes, then it will become
1031 necessary to hack on the cacheflush pattern in pa.md. */
1032
1033 #define TRAMPOLINE_SIZE (5 * 4)
1034
1035 /* Emit RTL insns to initialize the variable parts of a trampoline.
1036 FNADDR is an RTX for the address of the function's pure code.
1037 CXT is an RTX for the static chain value for the function.
1038
1039 Move the function address to the trampoline template at offset 12.
1040 Move the static chain value to trampoline template at offset 16. */
1041
1042 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1043 { \
1044 rtx start_addr, end_addr, mem; \
1045 \
1046 start_addr = memory_address (Pmode, plus_constant ((TRAMP), 12));\
1047 emit_move_insn (gen_rtx (MEM, Pmode, start_addr), (FNADDR)); \
1048 start_addr = memory_address (Pmode, plus_constant ((TRAMP), 16));\
1049 emit_move_insn (gen_rtx (MEM, Pmode, start_addr), (CXT)); \
1050 /* fdc and fic only use registers for the address to flush, \
1051 they do not accept integer displacements. */ \
1052 start_addr = force_reg (SImode, (TRAMP)); \
1053 end_addr = force_reg (SImode, plus_constant ((TRAMP), 8)); \
1054 emit_insn (gen_cacheflush (start_addr, end_addr)); \
1055 }
1056
1057 /* Emit code for a call to builtin_saveregs. We must emit USE insns which
1058 reference the 4 integer arg registers and 4 fp arg registers.
1059 Ordinarily they are not call used registers, but they are for
1060 _builtin_saveregs, so we must make this explicit. */
1061
1062 #define EXPAND_BUILTIN_SAVEREGS(ARGLIST) (rtx)hppa_builtin_saveregs (ARGLIST)
1063
1064 \f
1065 /* Addressing modes, and classification of registers for them. */
1066
1067 #define HAVE_POST_INCREMENT
1068 #define HAVE_POST_DECREMENT
1069
1070 #define HAVE_PRE_DECREMENT
1071 #define HAVE_PRE_INCREMENT
1072
1073 /* Macros to check register numbers against specific register classes. */
1074
1075 /* These assume that REGNO is a hard or pseudo reg number.
1076 They give nonzero only if REGNO is a hard reg of the suitable class
1077 or a pseudo reg currently allocated to a suitable hard reg.
1078 Since they use reg_renumber, they are safe only once reg_renumber
1079 has been allocated, which happens in local-alloc.c. */
1080
1081 #define REGNO_OK_FOR_INDEX_P(REGNO) \
1082 ((REGNO) && ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32))
1083 #define REGNO_OK_FOR_BASE_P(REGNO) \
1084 ((REGNO) && ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32))
1085 #define REGNO_OK_FOR_FP_P(REGNO) \
1086 (((REGNO) >= 32 && (REGNO) <= 99)\
1087 || (reg_renumber[REGNO] >= 32 && reg_renumber[REGNO] <= 99))
1088
1089 /* Now macros that check whether X is a register and also,
1090 strictly, whether it is in a specified class.
1091
1092 These macros are specific to the the HP-PA, and may be used only
1093 in code for printing assembler insns and in conditions for
1094 define_optimization. */
1095
1096 /* 1 if X is an fp register. */
1097
1098 #define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
1099 \f
1100 /* Maximum number of registers that can appear in a valid memory address. */
1101
1102 #define MAX_REGS_PER_ADDRESS 2
1103
1104 /* Recognize any constant value that is a valid address except
1105 for symbolic addresses. We get better CSE by rejecting them
1106 here and allowing hppa_legitimize_address to break them up. We
1107 use most of the constants accepted by CONSTANT_P, except CONST_DOUBLE. */
1108
1109 #define CONSTANT_ADDRESS_P(X) \
1110 ((GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1111 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
1112 || GET_CODE (X) == HIGH) \
1113 && (reload_in_progress || reload_completed || ! symbolic_expression_p (X)))
1114
1115 /* Include all constant integers and constant doubles, but not
1116 floating-point, except for floating-point zero.
1117
1118 Also reject function labels as reload can not handle them correctly
1119 right now. (Fix this for 2.5). */
1120 #define LEGITIMATE_CONSTANT_P(X) \
1121 ((GET_MODE_CLASS (GET_MODE (X)) != MODE_FLOAT \
1122 || (X) == CONST0_RTX (GET_MODE (X))) \
1123 && ! function_label_operand (X, VOIDmode))
1124
1125 /* Subroutine for EXTRA_CONSTRAINT.
1126
1127 Return 1 iff OP is a pseudo which did not get a hard register and
1128 we are running the reload pass. */
1129
1130 #define IS_RELOADING_PSEUDO_P(OP) \
1131 ((reload_in_progress \
1132 && GET_CODE (OP) == REG \
1133 && REGNO (OP) >= FIRST_PSEUDO_REGISTER \
1134 && reg_renumber [REGNO (OP)] < 0))
1135
1136 /* Optional extra constraints for this machine. Borrowed from sparc.h.
1137
1138 For the HPPA, `Q' means that this is a memory operand but not a
1139 symbolic memory operand. Note that an unassigned pseudo register
1140 is such a memory operand. Needed because reload will generate
1141 these things in insns and then not re-recognize the insns, causing
1142 constrain_operands to fail.
1143
1144 Also note `Q' accepts any memory operand during the reload pass.
1145 This includes out-of-range displacements in reg+d addressing.
1146 This makes for better code. (??? For 2.5 address this issue).
1147
1148 `R' is unused.
1149
1150 `S' is unused.
1151
1152 `T' is for fp loads and stores. */
1153 #define EXTRA_CONSTRAINT(OP, C) \
1154 ((C) == 'Q' ? \
1155 (IS_RELOADING_PSEUDO_P (OP) \
1156 || (GET_CODE (OP) == MEM \
1157 && reload_in_progress) \
1158 || (GET_CODE (OP) == MEM \
1159 && memory_address_p (GET_MODE (OP), XEXP (OP, 0))\
1160 && ! symbolic_memory_operand (OP, VOIDmode))) \
1161 : ((C) == 'T' ? \
1162 (GET_CODE (OP) == MEM \
1163 /* Using DFmode forces only short displacements \
1164 to be recognized as valid in reg+d addresses. */\
1165 && memory_address_p (DFmode, XEXP (OP, 0))) : 0))
1166
1167 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1168 and check its validity for a certain class.
1169 We have two alternate definitions for each of them.
1170 The usual definition accepts all pseudo regs; the other rejects
1171 them unless they have been allocated suitable hard regs.
1172 The symbol REG_OK_STRICT causes the latter definition to be used.
1173
1174 Most source files want to accept pseudo regs in the hope that
1175 they will get allocated to the class that the insn wants them to be in.
1176 Source files for reload pass need to be strict.
1177 After reload, it makes no difference, since pseudo regs have
1178 been eliminated by then. */
1179
1180 #ifndef REG_OK_STRICT
1181
1182 /* Nonzero if X is a hard reg that can be used as an index
1183 or if it is a pseudo reg. */
1184 #define REG_OK_FOR_INDEX_P(X) \
1185 (REGNO (X) && (REGNO (X) < 32 || REGNO (X) >= FIRST_PSEUDO_REGISTER))
1186 /* Nonzero if X is a hard reg that can be used as a base reg
1187 or if it is a pseudo reg. */
1188 #define REG_OK_FOR_BASE_P(X) \
1189 (REGNO (X) && (REGNO (X) < 32 || REGNO (X) >= FIRST_PSEUDO_REGISTER))
1190
1191 #else
1192
1193 /* Nonzero if X is a hard reg that can be used as an index. */
1194 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1195 /* Nonzero if X is a hard reg that can be used as a base reg. */
1196 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1197
1198 #endif
1199 \f
1200 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1201 that is a valid memory address for an instruction.
1202 The MODE argument is the machine mode for the MEM expression
1203 that wants to use this address.
1204
1205 On the HP-PA, the actual legitimate addresses must be
1206 REG+REG, REG+(REG*SCALE) or REG+SMALLINT.
1207 But we can treat a SYMBOL_REF as legitimate if it is part of this
1208 function's constant-pool, because such addresses can actually
1209 be output as REG+SMALLINT. */
1210
1211 #define VAL_5_BITS_P(X) ((unsigned)(X) + 0x10 < 0x20)
1212 #define INT_5_BITS(X) VAL_5_BITS_P (INTVAL (X))
1213
1214 #define VAL_U5_BITS_P(X) ((unsigned)(X) < 0x20)
1215 #define INT_U5_BITS(X) VAL_U5_BITS_P (INTVAL (X))
1216
1217 #define VAL_11_BITS_P(X) ((unsigned)(X) + 0x400 < 0x800)
1218 #define INT_11_BITS(X) VAL_11_BITS_P (INTVAL (X))
1219
1220 #define VAL_14_BITS_P(X) ((unsigned)(X) + 0x2000 < 0x4000)
1221 #define INT_14_BITS(X) VAL_14_BITS_P (INTVAL (X))
1222
1223 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1224 { \
1225 if ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \
1226 || ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_DEC \
1227 || GET_CODE (X) == PRE_INC || GET_CODE (X) == POST_INC) \
1228 && REG_P (XEXP (X, 0)) \
1229 && REG_OK_FOR_BASE_P (XEXP (X, 0)))) \
1230 goto ADDR; \
1231 else if (GET_CODE (X) == PLUS) \
1232 { \
1233 rtx base = 0, index; \
1234 if (flag_pic && XEXP (X, 0) == pic_offset_table_rtx)\
1235 { \
1236 if (GET_CODE (XEXP (X, 1)) == REG \
1237 && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
1238 goto ADDR; \
1239 else if (flag_pic == 1 \
1240 && GET_CODE (XEXP (X, 1)) != REG \
1241 && GET_CODE (XEXP (X, 1)) != LO_SUM \
1242 && GET_CODE (XEXP (X, 1)) != MEM) \
1243 goto ADDR; \
1244 } \
1245 else if (REG_P (XEXP (X, 0)) \
1246 && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
1247 base = XEXP (X, 0), index = XEXP (X, 1); \
1248 else if (REG_P (XEXP (X, 1)) \
1249 && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
1250 base = XEXP (X, 1), index = XEXP (X, 0); \
1251 if (base != 0) \
1252 if (GET_CODE (index) == CONST_INT \
1253 && ((INT_14_BITS (index) && (MODE) != SFmode && (MODE) != DFmode) \
1254 || INT_5_BITS (index))) \
1255 goto ADDR; \
1256 } \
1257 else if (GET_CODE (X) == LO_SUM \
1258 && GET_CODE (XEXP (X, 0)) == REG \
1259 && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
1260 && CONSTANT_P (XEXP (X, 1)) \
1261 && (MODE) != SFmode \
1262 && (MODE) != DFmode) \
1263 goto ADDR; \
1264 else if (GET_CODE (X) == LO_SUM \
1265 && GET_CODE (XEXP (X, 0)) == SUBREG \
1266 && GET_CODE (SUBREG_REG (XEXP (X, 0))) == REG\
1267 && REG_OK_FOR_BASE_P (SUBREG_REG (XEXP (X, 0)))\
1268 && CONSTANT_P (XEXP (X, 1)) \
1269 && (MODE) != SFmode \
1270 && (MODE) != DFmode) \
1271 goto ADDR; \
1272 else if (GET_CODE (X) == LABEL_REF \
1273 || (GET_CODE (X) == CONST_INT \
1274 && INT_14_BITS (X))) \
1275 goto ADDR; \
1276 }
1277 \f
1278 /* Try machine-dependent ways of modifying an illegitimate address
1279 to be legitimate. If we find one, return the new, valid address.
1280 This macro is used in only one place: `memory_address' in explow.c.
1281
1282 OLDX is the address as it was before break_out_memory_refs was called.
1283 In some cases it is useful to look at this to decide what needs to be done.
1284
1285 MODE and WIN are passed so that this macro can use
1286 GO_IF_LEGITIMATE_ADDRESS.
1287
1288 It is always safe for this macro to do nothing. It exists to recognize
1289 opportunities to optimize the output. */
1290
1291 extern struct rtx_def *hppa_legitimize_address ();
1292 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
1293 { rtx orig_x = (X); \
1294 (X) = hppa_legitimize_address (X, OLDX, MODE); \
1295 if ((X) != orig_x && memory_address_p (MODE, X)) \
1296 goto WIN; }
1297
1298 /* Go to LABEL if ADDR (a legitimate address expression)
1299 has an effect that depends on the machine mode it is used for. */
1300
1301 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1302 if (GET_CODE (ADDR) == PRE_DEC \
1303 || GET_CODE (ADDR) == POST_DEC \
1304 || GET_CODE (ADDR) == PRE_INC \
1305 || GET_CODE (ADDR) == POST_INC) \
1306 goto LABEL
1307 \f
1308 /* Define this macro if references to a symbol must be treated
1309 differently depending on something about the variable or
1310 function named by the symbol (such as what section it is in).
1311
1312 The macro definition, if any, is executed immediately after the
1313 rtl for DECL or other node is created.
1314 The value of the rtl will be a `mem' whose address is a
1315 `symbol_ref'.
1316
1317 The usual thing for this macro to do is to a flag in the
1318 `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
1319 name string in the `symbol_ref' (if one bit is not enough
1320 information).
1321
1322 On the HP-PA we use this to indicate if a symbol is in text or
1323 data space. Also, function labels need special treatment. */
1324
1325 #define TEXT_SPACE_P(DECL)\
1326 (TREE_CODE (DECL) == FUNCTION_DECL \
1327 || (TREE_CODE (DECL) == VAR_DECL \
1328 && TREE_READONLY (DECL) && ! TREE_SIDE_EFFECTS (DECL) \
1329 && !flag_pic) \
1330 || (*tree_code_type[(int) TREE_CODE (DECL)] == 'c' \
1331 && !(TREE_CODE (DECL) == STRING_CST && flag_writable_strings)))
1332
1333 #define FUNCTION_NAME_P(NAME) \
1334 (*(NAME) == '@' || (*(NAME) == '*' && *((NAME) + 1) == '@'))
1335
1336 #define ENCODE_SECTION_INFO(DECL)\
1337 do \
1338 { if (TEXT_SPACE_P (DECL)) \
1339 { rtx _rtl; \
1340 if (TREE_CODE (DECL) == FUNCTION_DECL \
1341 || TREE_CODE (DECL) == VAR_DECL) \
1342 _rtl = DECL_RTL (DECL); \
1343 else \
1344 _rtl = TREE_CST_RTL (DECL); \
1345 SYMBOL_REF_FLAG (XEXP (_rtl, 0)) = 1; \
1346 if (TREE_CODE (DECL) == FUNCTION_DECL) \
1347 hppa_encode_label (XEXP (DECL_RTL (DECL), 0));\
1348 } \
1349 } \
1350 while (0)
1351
1352 /* Store the user-specified part of SYMBOL_NAME in VAR.
1353 This is sort of inverse to ENCODE_SECTION_INFO. */
1354
1355 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
1356 (VAR) = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*' ? \
1357 1 + (SYMBOL_NAME)[1] == '@'\
1358 : (SYMBOL_NAME)[0] == '@'))
1359
1360 /* Specify the machine mode that this machine uses
1361 for the index in the tablejump instruction. */
1362 #define CASE_VECTOR_MODE DImode
1363
1364 /* Define this if the tablejump instruction expects the table
1365 to contain offsets from the address of the table.
1366 Do not define this if the table should contain absolute addresses. */
1367 /* #define CASE_VECTOR_PC_RELATIVE */
1368
1369 #define CASE_DROPS_THROUGH
1370 /* Specify the tree operation to be used to convert reals to integers. */
1371 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1372
1373 /* This is the kind of divide that is easiest to do in the general case. */
1374 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1375
1376 /* Define this as 1 if `char' should by default be signed; else as 0. */
1377 #define DEFAULT_SIGNED_CHAR 1
1378
1379 /* Max number of bytes we can move from memory to memory
1380 in one reasonably fast instruction. */
1381 #define MOVE_MAX 8
1382
1383 /* Define if normal loads of shorter-than-word items from memory clears
1384 the rest of the bigs in the register. */
1385 #define BYTE_LOADS_ZERO_EXTEND
1386
1387 /* Nonzero if access to memory by bytes is slow and undesirable. */
1388 #define SLOW_BYTE_ACCESS 1
1389
1390 /* Do not break .stabs pseudos into continuations. */
1391 #define DBX_CONTIN_LENGTH 0
1392
1393 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1394 is done just by pretending it is already truncated. */
1395 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1396
1397 /* We assume that the store-condition-codes instructions store 0 for false
1398 and some other value for true. This is the value stored for true. */
1399
1400 #define STORE_FLAG_VALUE 1
1401
1402 /* When a prototype says `char' or `short', really pass an `int'. */
1403 #define PROMOTE_PROTOTYPES
1404
1405 /* Specify the machine mode that pointers have.
1406 After generation of rtl, the compiler makes no further distinction
1407 between pointers and any other objects of this machine mode. */
1408 #define Pmode SImode
1409
1410 /* Add any extra modes needed to represent the condition code.
1411
1412 HPPA floating comparisons produce condition codes. */
1413 #define EXTRA_CC_MODES CCFPmode
1414
1415 /* Define the names for the modes specified above. */
1416 #define EXTRA_CC_NAMES "CCFP"
1417
1418 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
1419 return the mode to be used for the comparison. For floating-point, CCFPmode
1420 should be used. CC_NOOVmode should be used when the first operand is a
1421 PLUS, MINUS, or NEG. CCmode should be used when no special processing is
1422 needed. */
1423 #define SELECT_CC_MODE(OP,X,Y) \
1424 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT ? CCFPmode : CCmode) \
1425
1426 /* A function address in a call instruction
1427 is a byte address (for indexing purposes)
1428 so give the MEM rtx a byte's mode. */
1429 #define FUNCTION_MODE SImode
1430
1431 /* Define this if addresses of constant functions
1432 shouldn't be put through pseudo regs where they can be cse'd.
1433 Desirable on machines where ordinary constants are expensive
1434 but a CALL with constant address is cheap. */
1435 #define NO_FUNCTION_CSE
1436
1437 /* Define this if shift instructions ignore all but the low-order
1438 few bits. */
1439 #define SHIFT_COUNT_TRUNCATED
1440
1441 /* Use atexit for static constructors/destructors, instead of defining
1442 our own exit function. */
1443 #define HAVE_ATEXIT
1444
1445 /* Compute the cost of computing a constant rtl expression RTX
1446 whose rtx-code is CODE. The body of this macro is a portion
1447 of a switch statement. If the code is computed here,
1448 return it with a return statement. Otherwise, break from the switch. */
1449
1450 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1451 case CONST_INT: \
1452 if (INTVAL (RTX) == 0) return 0; \
1453 if (INT_14_BITS (RTX)) return 1; \
1454 case HIGH: \
1455 return 2; \
1456 case CONST: \
1457 case LABEL_REF: \
1458 case SYMBOL_REF: \
1459 return 4; \
1460 case CONST_DOUBLE: \
1461 if (RTX == CONST0_RTX (DFmode) || RTX == CONST0_RTX (SFmode)\
1462 && OUTER_CODE != SET) \
1463 return 0; \
1464 else \
1465 return 8;
1466
1467 #define ADDRESS_COST(RTX) \
1468 (GET_CODE (RTX) == REG ? 1 : hppa_address_cost (RTX))
1469
1470 /* Compute extra cost of moving data between one register class
1471 and another.
1472
1473 Make moves from SAR so expensive they should never happen.
1474
1475 Copies involving a FP register and a non-FP register are relatively
1476 expensive because they must go through memory.
1477
1478 Other copies are reasonably cheap. */
1479 #define REGISTER_MOVE_COST(CLASS1, CLASS2) \
1480 (CLASS1 == SHIFT_REGS ? 0xffff \
1481 : FP_REG_CLASS_P (CLASS1) && ! FP_REG_CLASS_P (CLASS2) ? 16 \
1482 : FP_REG_CLASS_P (CLASS2) && ! FP_REG_CLASS_P (CLASS1) ? 16 \
1483 : 2)
1484
1485
1486 /* Provide the costs of a rtl expression. This is in the body of a
1487 switch on CODE. The purpose for the cost of MULT is to encourage
1488 `synth_mult' to find a synthetic multiply when reasonable. */
1489
1490 #define RTX_COSTS(X,CODE,OUTER_CODE) \
1491 case MULT: \
1492 return TARGET_SNAKE && ! TARGET_DISABLE_FPREGS \
1493 ? COSTS_N_INSNS (8) : COSTS_N_INSNS (20); \
1494 case DIV: \
1495 case UDIV: \
1496 case MOD: \
1497 case UMOD: \
1498 return COSTS_N_INSNS (60); \
1499 case PLUS: /* this includes shNadd insns */ \
1500 return COSTS_N_INSNS (1) + 2;
1501
1502 /* Adjust the cost of dependencies. */
1503
1504 #define ADJUST_COST(INSN,LINK,DEP,COST) \
1505 (COST) = pa_adjust_cost (INSN, LINK, DEP, COST)
1506
1507 /* Handling the special cases is going to get too complicated for a macro,
1508 just call `pa_adjust_insn_length' to do the real work. */
1509 #define ADJUST_INSN_LENGTH(INSN, LENGTH) \
1510 LENGTH += pa_adjust_insn_length (INSN, LENGTH);
1511
1512 /* Enable a bug fix. (This is for extra caution.) */
1513 #define SHORTEN_WITH_ADJUST_INSN_LENGTH
1514
1515 /* Millicode insns are actually function calls with some special
1516 constraints on arguments and register usage.
1517
1518 Millicode calls always expect their arguments in the integer argument
1519 registers, and always return their result in %r29 (ret1). They
1520 are expected to clobber their arguments, %r1, %r29, and %r31 and
1521 nothing else.
1522
1523 These macros tell reorg that the references to arguments and
1524 register clobbers for millicode calls do not appear to happen
1525 until after the millicode call. This allows reorg to put insns
1526 which set the argument registers into the delay slot of the millicode
1527 call -- thus they act more like traditional CALL_INSNs.
1528
1529 get_attr_type will try to recognize the given insn, so make sure to
1530 filter out things it will not accept -- SEQUENCE, USE and CLOBBER insns
1531 in particular. */
1532 #define INSN_SETS_ARE_DELAYED(X) \
1533 ((GET_CODE (X) == INSN \
1534 && GET_CODE (PATTERN (X)) != SEQUENCE \
1535 && GET_CODE (PATTERN (X)) != USE \
1536 && GET_CODE (PATTERN (X)) != CLOBBER \
1537 && get_attr_type (X) == TYPE_MILLI))
1538
1539 #define INSN_REFERENCES_ARE_DELAYED(X) \
1540 ((GET_CODE (X) == INSN \
1541 && GET_CODE (PATTERN (X)) != SEQUENCE \
1542 && GET_CODE (PATTERN (X)) != USE \
1543 && GET_CODE (PATTERN (X)) != CLOBBER \
1544 && get_attr_type (X) == TYPE_MILLI))
1545
1546 \f
1547 /* Control the assembler format that we output. */
1548
1549 /* Output at beginning of assembler file. */
1550
1551 #define ASM_FILE_START(FILE) \
1552 do { fprintf (FILE, "\t.SPACE $PRIVATE$\n\
1553 \t.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31\n\
1554 \t.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82\n\
1555 \t.SPACE $TEXT$\n\
1556 \t.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44\n\
1557 \t.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY\n\
1558 \t.IMPORT $global$,DATA\n\
1559 \t.IMPORT $$dyncall,MILLICODE\n");\
1560 if (profile_flag)\
1561 fprintf (FILE, "\t.IMPORT _mcount, CODE\n");\
1562 } while (0)
1563
1564 /* Output to assembler file text saying following lines
1565 may contain character constants, extra white space, comments, etc. */
1566
1567 #define ASM_APP_ON ""
1568
1569 /* Output to assembler file text saying following lines
1570 no longer contain unusual constructs. */
1571
1572 #define ASM_APP_OFF ""
1573
1574 /* We don't yet know how to identify GCC to HP-PA machines. */
1575 #define ASM_IDENTIFY_GCC(FILE) fprintf (FILE, "; gcc_compiled.:\n")
1576
1577 /* Output before code. */
1578
1579 /* Supposedly the assembler rejects the command if there is no tab! */
1580 #define TEXT_SECTION_ASM_OP "\t.SPACE $TEXT$\n\t.SUBSPA $CODE$\n"
1581
1582 /* Output before writable data. */
1583
1584 /* Supposedly the assembler rejects the command if there is no tab! */
1585 #define DATA_SECTION_ASM_OP "\t.SPACE $PRIVATE$\n\t.SUBSPA $DATA$\n"
1586
1587 /* Output before uninitialized data. */
1588
1589 #define BSS_SECTION_ASM_OP "\t.SPACE $PRIVATE$\n\t.SUBSPA $BSS$\n"
1590
1591 /* Define the .bss section for ASM_OUTPUT_LOCAL to use. */
1592
1593 #define EXTRA_SECTIONS in_bss
1594
1595 #define EXTRA_SECTION_FUNCTIONS \
1596 void \
1597 bss_section () \
1598 { \
1599 if (in_section != in_bss) \
1600 { \
1601 fprintf (asm_out_file, "%s\n", BSS_SECTION_ASM_OP); \
1602 in_section = in_bss; \
1603 } \
1604 }
1605
1606
1607 /* How to refer to registers in assembler output.
1608 This sequence is indexed by compiler's hard-register-number (see above). */
1609
1610 #define REGISTER_NAMES \
1611 {"0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7", \
1612 "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", \
1613 "%r16", "%r17", "%r18", "%r19", "%r20", "%r21", "%r22", "%r23", \
1614 "%r24", "%r25", "%r26", "%r27", "%r28", "%r29", "%r30", "%r31", \
1615 "%fr4", "%fr5", "%fr6", "%fr7", \
1616 "%fr8", "%fr9", "%fr10", "%fr11", "%fr12", "%fr13", "%fr14", "%fr15", \
1617 "%fr4", "%fr4R", "%fr5", "%fr5R", "%fr6", "%fr6R", "%fr7", "%fr7R", \
1618 "%fr8", "%fr8R", "%fr9", "%fr9R", "%fr10", "%fr10R", "%fr11", "%fr11R",\
1619 "%fr12", "%fr12R", "%fr13", "%fr13R", "%fr14", "%fr14R", "%fr15", "%fr15R",\
1620 "%fr16", "%fr16R", "%fr17", "%fr17R", "%fr18", "%fr18R", "%fr19", "%fr19R",\
1621 "%fr20", "%fr20R", "%fr21", "%fr21R", "%fr22", "%fr22R", "%fr23", "%fr23R",\
1622 "%fr24", "%fr24R", "%fr25", "%fr25R", "%fr26", "%fr26R", "%fr27", "%fr27R",\
1623 "%fr28", "%fr28R", "%fr29", "%fr29R", "%fr30", "%fr30R", "%fr31", "%fr31R",\
1624 "SAR"}
1625
1626 /* How to renumber registers for dbx and gdb. */
1627
1628 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
1629
1630 /* This is how to output the definition of a user-level label named NAME,
1631 such as the label on a static function or variable NAME. */
1632
1633 #define ASM_OUTPUT_LABEL(FILE, NAME) \
1634 do { assemble_name (FILE, NAME); \
1635 if (TARGET_TRAILING_COLON) \
1636 fputc (':', FILE); \
1637 fputc ('\n', FILE); } while (0)
1638
1639 /* This is how to output a command to make the user-level label named NAME
1640 defined for reference from other files. */
1641
1642 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
1643 do { fputs ("\t.IMPORT ", FILE); \
1644 assemble_name (FILE, NAME); \
1645 if (FUNCTION_NAME_P (NAME)) \
1646 fputs (",CODE\n", FILE); \
1647 else \
1648 fputs (",DATA\n", FILE); \
1649 } while (0)
1650
1651 /* hpux ld doesn't output the object file name, or anything useful at
1652 all, to indicate the start of an object file's symbols. This screws
1653 up gdb, so we'll output this magic cookie at the end of an object
1654 file with debugging symbols */
1655
1656 #define ASM_FILE_END(FILE) \
1657 do { if (write_symbols == DBX_DEBUG)\
1658 { fputs (TEXT_SECTION_ASM_OP, FILE);\
1659 fputs (".stabs \"end_file.\",4,0,0,Ltext_end\nLtext_end:\n",\
1660 (FILE));\
1661 }\
1662 } while (0)
1663
1664 /* The bogus HP assembler requires ALL external references to be
1665 "imported", even library calls. They look a bit different, so
1666 here's this macro. */
1667
1668 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, RTL) \
1669 do { fputs ("\t.IMPORT ", FILE); \
1670 assemble_name (FILE, XSTR ((RTL), 0)); \
1671 fputs (",CODE\n", FILE); \
1672 } while (0)
1673
1674 #define ASM_GLOBALIZE_LABEL(FILE, NAME) \
1675 do { fputs ("\t.EXPORT ", FILE); assemble_name (FILE, NAME); \
1676 if (FUNCTION_NAME_P (NAME)) \
1677 fputs (",CODE\n", FILE); \
1678 else \
1679 fputs (",DATA\n", FILE);} while (0)
1680
1681 /* This is how to output a reference to a user-level label named NAME.
1682 `assemble_name' uses this. */
1683
1684 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
1685 fprintf ((FILE), "%s", (NAME) + (FUNCTION_NAME_P (NAME) ? 1 : 0))
1686
1687 /* This is how to output an internal numbered label where
1688 PREFIX is the class of label and NUM is the number within the class. */
1689
1690 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1691 {fprintf (FILE, "%s$%04d", PREFIX, NUM); \
1692 if (TARGET_TRAILING_COLON) \
1693 fputs (":\n", FILE); \
1694 else \
1695 fputs ("\n", FILE);}
1696
1697 /* This is how to store into the string LABEL
1698 the symbol_ref name of an internal numbered label where
1699 PREFIX is the class of label and NUM is the number within the class.
1700 This is suitable for output with `assemble_name'. */
1701
1702 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1703 sprintf (LABEL, "*%s$%04d", PREFIX, NUM)
1704
1705 /* This is how to output an assembler line defining a `double' constant. */
1706
1707 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
1708 do { union { double d; int i[2];} __u; \
1709 __u.d = (VALUE); \
1710 fprintf (FILE, "\t; .double %.20e\n\t.word %d ; = 0x%x\n\t.word %d ; = 0x%x\n", \
1711 __u.d, __u.i[0], __u.i[0], __u.i[1], __u.i[1]); \
1712 } while (0)
1713
1714 /* This is how to output an assembler line defining a `float' constant. */
1715
1716 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
1717 do { union { float f; int i;} __u; \
1718 __u.f = (VALUE); \
1719 fprintf (FILE, "\t; .float %.12e\n\t.word %d ; = 0x%x\n", __u.f, __u.i, __u.i); \
1720 } while (0)
1721
1722 /* This is how to output an assembler line defining an `int' constant. */
1723
1724 #define ASM_OUTPUT_INT(FILE,VALUE) \
1725 { fprintf (FILE, "\t.word "); \
1726 if (function_label_operand (VALUE, VOIDmode)) \
1727 fprintf (FILE, "P%%"); \
1728 output_addr_const (FILE, (VALUE)); \
1729 fprintf (FILE, "\n");}
1730
1731 /* Likewise for `short' and `char' constants. */
1732
1733 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
1734 ( fprintf (FILE, "\t.half "), \
1735 output_addr_const (FILE, (VALUE)), \
1736 fprintf (FILE, "\n"))
1737
1738 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
1739 ( fprintf (FILE, "\t.byte "), \
1740 output_addr_const (FILE, (VALUE)), \
1741 fprintf (FILE, "\n"))
1742
1743 /* This is how to output an assembler line for a numeric constant byte. */
1744
1745 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
1746 fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1747
1748 #define ASM_OUTPUT_ASCII(FILE, P, SIZE) \
1749 output_ascii ((FILE), (P), (SIZE))
1750
1751 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)
1752 #define ASM_OUTPUT_REG_POP(FILE,REGNO)
1753 /* This is how to output an element of a case-vector that is absolute.
1754 Note that this method makes filling these branch delay slots
1755 impossible. */
1756
1757 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1758 fprintf (FILE, "\tb L$%04d\n\tnop\n", VALUE)
1759
1760 /* Jump tables are executable code and live in the TEXT section on the PA. */
1761 #define JUMP_TABLES_IN_TEXT_SECTION
1762
1763 /* This is how to output an element of a case-vector that is relative.
1764 (The HP-PA does not use such vectors,
1765 but we must define this macro anyway.) */
1766
1767 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
1768 fprintf (FILE, "\tword L%d-L%d\n", VALUE, REL)
1769
1770 /* This is how to output an assembler line
1771 that says to advance the location counter
1772 to a multiple of 2**LOG bytes. */
1773
1774 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1775 fprintf (FILE, "\t.align %d\n", (1<<(LOG)))
1776
1777 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1778 fprintf (FILE, "\t.blockz %d\n", (SIZE))
1779
1780 /* This says how to output an assembler line
1781 to define a global common symbol. */
1782
1783 /* Supposedly the assembler rejects the command if there is no tab! */
1784
1785
1786 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1787 { bss_section (); \
1788 assemble_name ((FILE), (NAME)); \
1789 if (TARGET_TRAILING_COLON) \
1790 fputc (':', (FILE)); \
1791 fputs ("\t.comm ", (FILE)); \
1792 fprintf ((FILE), "%d\n", (ROUNDED));}
1793
1794 /* This says how to output an assembler line
1795 to define a local common symbol. */
1796
1797 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
1798 { bss_section (); \
1799 fprintf ((FILE), "\t.align %d\n", (SIZE) <= 4 ? 4 : 8); \
1800 assemble_name ((FILE), (NAME)); \
1801 if (TARGET_TRAILING_COLON) \
1802 fputc (':', (FILE)); \
1803 fprintf ((FILE), "\n\t.block %d\n", (ROUNDED));}
1804
1805 /* Store in OUTPUT a string (made with alloca) containing
1806 an assembler-name for a local static variable named NAME.
1807 LABELNO is an integer which is different for each call. */
1808
1809 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1810 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
1811 sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
1812
1813 /* Define the parentheses used to group arithmetic operations
1814 in assembler code. */
1815
1816 #define ASM_OPEN_PAREN "("
1817 #define ASM_CLOSE_PAREN ")"
1818
1819 /* Define results of standard character escape sequences. */
1820 #define TARGET_BELL 007
1821 #define TARGET_BS 010
1822 #define TARGET_TAB 011
1823 #define TARGET_NEWLINE 012
1824 #define TARGET_VT 013
1825 #define TARGET_FF 014
1826 #define TARGET_CR 015
1827
1828 #define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
1829 ((CHAR) == '@' || (CHAR) == '#' || (CHAR) == '*' || (CHAR) == '^')
1830
1831 /* Print operand X (an rtx) in assembler syntax to file FILE.
1832 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1833 For `%' followed by punctuation, CODE is the punctuation and X is null.
1834
1835 On the HP-PA, the CODE can be `r', meaning this is a register-only operand
1836 and an immediate zero should be represented as `r0'.
1837
1838 Several % codes are defined:
1839 O an operation
1840 C compare conditions
1841 N extract conditions
1842 M modifier to handle preincrement addressing for memory refs.
1843 F modifier to handle preincrement addressing for fp memory refs */
1844
1845 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
1846
1847 \f
1848 /* Print a memory address as an operand to reference that memory location. */
1849
1850 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1851 { register rtx addr = ADDR; \
1852 register rtx base; \
1853 int offset; \
1854 switch (GET_CODE (addr)) \
1855 { \
1856 case REG: \
1857 fprintf (FILE, "0(0,%s)", reg_names [REGNO (addr)]); \
1858 break; \
1859 case PLUS: \
1860 if (GET_CODE (XEXP (addr, 0)) == CONST_INT) \
1861 offset = INTVAL (XEXP (addr, 0)), base = XEXP (addr, 1); \
1862 else if (GET_CODE (XEXP (addr, 1)) == CONST_INT) \
1863 offset = INTVAL (XEXP (addr, 1)), base = XEXP (addr, 0); \
1864 else \
1865 abort (); \
1866 fprintf (FILE, "%d(0,%s)", offset, reg_names [REGNO (base)]); \
1867 break; \
1868 case LO_SUM: \
1869 fputs ("R'", FILE); \
1870 output_global_address (FILE, XEXP (addr, 1)); \
1871 fputs ("(", FILE); \
1872 output_operand (XEXP (addr, 0), 0); \
1873 fputs (")", FILE); \
1874 break; \
1875 case CONST_INT: \
1876 fprintf (FILE, "%d(0,0)", INTVAL (addr)); \
1877 break; \
1878 default: \
1879 output_addr_const (FILE, addr); \
1880 }}
1881
1882 \f
1883 /* Define functions in pa.c and used in insn-output.c. */
1884
1885 extern char *output_and ();
1886 extern char *output_ior ();
1887 extern char *output_move_double ();
1888 extern char *output_fp_move_double ();
1889 extern char *output_block_move ();
1890 extern char *output_scc_insn ();
1891 extern char *output_cbranch ();
1892 extern char *output_bb ();
1893 extern char *output_dbra ();
1894 extern char *output_movb ();
1895 extern char *output_return ();
1896 extern char *output_call ();
1897 extern char *output_floatsisf2 ();
1898 extern char *output_floatsidf2 ();
1899 extern char *output_mul_insn ();
1900 extern char *output_div_insn ();
1901 extern char *output_mod_insn ();
1902 extern char *singlemove_string ();
1903 extern void output_arg_descriptor ();
1904 extern void output_global_address ();
1905 extern struct rtx_def *legitimize_pic_address ();
1906 extern struct rtx_def *gen_cmp_fp ();
1907 extern void hppa_encode_label ();
1908
1909 extern struct rtx_def *hppa_save_pic_table_rtx;
This page took 0.127404 seconds and 5 git commands to generate.