* pa.h (CPP_SPEC): Add whitespace after -D__STDC_EXT__.
[official-gcc.git] / gcc / config / pa / pa.h
blob103ff18b5fe745d2751691acd1307a1b43ec6dab
1 /* Definitions of target machine for GNU compiler, for the HP Spectrum.
2 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
3 Free Software Foundation, Inc.
4 Contributed by Michael Tiemann (tiemann@cygnus.com) of Cygnus Support
5 and Tim Moore (moore@defmacro.cs.utah.edu) of the Center for
6 Software Science at the University of Utah.
8 This file is part of GNU CC.
10 GNU CC is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
13 any later version.
15 GNU CC is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with GNU CC; see the file COPYING. If not, write to
22 the Free Software Foundation, 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
25 enum cmp_type /* comparison type */
27 CMP_SI, /* compare integers */
28 CMP_SF, /* compare single precision floats */
29 CMP_DF, /* compare double precision floats */
30 CMP_MAX /* max comparison type */
33 /* For long call handling. */
34 extern unsigned int total_code_bytes;
36 /* Which processor to schedule for. */
38 enum processor_type
40 PROCESSOR_700,
41 PROCESSOR_7100,
42 PROCESSOR_7100LC,
43 PROCESSOR_7200,
44 PROCESSOR_8000
47 /* For -mschedule= option. */
48 extern const char *pa_cpu_string;
49 extern enum processor_type pa_cpu;
51 #define pa_cpu_attr ((enum attr_cpu)pa_cpu)
53 /* The 700 can only issue a single insn at a time.
54 The 7XXX processors can issue two insns at a time.
55 The 8000 can issue 4 insns at a time. */
56 #define ISSUE_RATE \
57 (pa_cpu == PROCESSOR_700 ? 1 \
58 : pa_cpu == PROCESSOR_7100 ? 2 \
59 : pa_cpu == PROCESSOR_7100LC ? 2 \
60 : pa_cpu == PROCESSOR_7200 ? 2 \
61 : pa_cpu == PROCESSOR_8000 ? 4 \
62 : 2)
64 /* Which architecture to generate code for. */
66 enum architecture_type
68 ARCHITECTURE_10,
69 ARCHITECTURE_11,
70 ARCHITECTURE_20
73 /* For -march= option. */
74 extern const char *pa_arch_string;
75 extern enum architecture_type pa_arch;
77 /* Print subsidiary information on the compiler version in use. */
79 #define TARGET_VERSION fputs (" (hppa)", stderr);
81 /* Run-time compilation parameters selecting different hardware subsets. */
83 extern int target_flags;
85 /* compile code for HP-PA 1.1 ("Snake") */
87 #define MASK_PA_11 1
89 #ifndef TARGET_PA_11
90 #define TARGET_PA_11 (target_flags & MASK_PA_11)
91 #endif
93 /* Disable all FP registers (they all become fixed). This may be necessary
94 for compiling kernels which perform lazy context switching of FP regs.
95 Note if you use this option and try to perform floating point operations
96 the compiler will abort! */
98 #define MASK_DISABLE_FPREGS 2
99 #define TARGET_DISABLE_FPREGS (target_flags & MASK_DISABLE_FPREGS)
101 /* Generate code which assumes that calls through function pointers will
102 never cross a space boundary. Such assumptions are generally safe for
103 building kernels and statically linked executables. Code compiled with
104 this option will fail miserably if the executable is dynamically linked
105 or uses nested functions!
107 This is also used to trigger aggressive unscaled index addressing. */
108 #define MASK_NO_SPACE_REGS 4
109 #define TARGET_NO_SPACE_REGS (target_flags & MASK_NO_SPACE_REGS)
111 /* Allow unconditional jumps in the delay slots of call instructions. */
112 #define MASK_JUMP_IN_DELAY 8
113 #define TARGET_JUMP_IN_DELAY (target_flags & MASK_JUMP_IN_DELAY)
115 /* Disable indexed addressing modes. */
116 #define MASK_DISABLE_INDEXING 32
117 #define TARGET_DISABLE_INDEXING (target_flags & MASK_DISABLE_INDEXING)
119 /* Emit code which follows the new portable runtime calling conventions
120 HP wants everyone to use for ELF objects. If at all possible you want
121 to avoid this since it's a performance loss for non-prototyped code.
123 Note TARGET_PORTABLE_RUNTIME also forces all calls to use inline
124 long-call stubs which is quite expensive. */
125 #define MASK_PORTABLE_RUNTIME 64
126 #define TARGET_PORTABLE_RUNTIME (target_flags & MASK_PORTABLE_RUNTIME)
128 /* Emit directives only understood by GAS. This allows parameter
129 relocations to work for static functions. There is no way
130 to make them work the HP assembler at this time. */
131 #define MASK_GAS 128
132 #define TARGET_GAS (target_flags & MASK_GAS)
134 /* Emit code for processors which do not have an FPU. */
135 #define MASK_SOFT_FLOAT 256
136 #define TARGET_SOFT_FLOAT (target_flags & MASK_SOFT_FLOAT)
138 /* Use 3-insn load/store sequences for access to large data segments
139 in shared libraries on hpux10. */
140 #define MASK_LONG_LOAD_STORE 512
141 #define TARGET_LONG_LOAD_STORE (target_flags & MASK_LONG_LOAD_STORE)
143 /* Use a faster sequence for indirect calls. */
144 #define MASK_FAST_INDIRECT_CALLS 1024
145 #define TARGET_FAST_INDIRECT_CALLS (target_flags & MASK_FAST_INDIRECT_CALLS)
147 /* Generate code with big switch statements to avoid out of range branches
148 occurring within the switch table. */
149 #define MASK_BIG_SWITCH 2048
150 #define TARGET_BIG_SWITCH (target_flags & MASK_BIG_SWITCH)
153 /* Generate code for the HPPA 2.0 architecture. TARGET_PA_11 should also be
154 true when this is true. */
155 #define MASK_PA_20 4096
156 #ifndef TARGET_PA_20
157 #define TARGET_PA_20 (target_flags & MASK_PA_20)
158 #endif
160 /* Generate code for the HPPA 2.0 architecture in 64bit mode. */
161 #ifndef TARGET_64BIT
162 #define TARGET_64BIT 0
163 #endif
165 /* Macro to define tables used to set the flags.
166 This is a list in braces of pairs in braces,
167 each pair being { "NAME", VALUE }
168 where VALUE is the bits to set or minus the bits to clear.
169 An empty string NAME is used to identify the default VALUE. */
171 #define TARGET_SWITCHES \
172 {{"snake", MASK_PA_11, "Generate PA1.1 code"}, \
173 {"nosnake", -(MASK_PA_11 | MASK_PA_20), "Generate PA1.0 code"}, \
174 {"pa-risc-1-0", -(MASK_PA_11 | MASK_PA_20), "Generate PA1.0 code"}, \
175 {"pa-risc-1-1", MASK_PA_11, "Generate PA1.1 code"}, \
176 {"pa-risc-2-0", MASK_PA_20, "Generate PA2.0 code. This option requires binutils 2.10 or later"}, \
177 {"disable-fpregs", MASK_DISABLE_FPREGS, "Disable FP regs"}, \
178 {"no-disable-fpregs", -MASK_DISABLE_FPREGS, "Do not disable FP regs"},\
179 {"no-space-regs", MASK_NO_SPACE_REGS, "Disable space regs"}, \
180 {"space-regs", -MASK_NO_SPACE_REGS, "Do not disable space regs"}, \
181 {"jump-in-delay", MASK_JUMP_IN_DELAY, "Put jumps in call delay slots"},\
182 {"no-jump-in-delay", -MASK_JUMP_IN_DELAY, "Do not put jumps in call delay slots"}, \
183 {"disable-indexing", MASK_DISABLE_INDEXING, "Disable indexed addressing"},\
184 {"no-disable-indexing", -MASK_DISABLE_INDEXING, "Do not disable indexed addressing"},\
185 {"portable-runtime", MASK_PORTABLE_RUNTIME, "Use portable calling conventions"}, \
186 {"no-portable-runtime", -MASK_PORTABLE_RUNTIME, "Do not use portable calling conventions"},\
187 {"gas", MASK_GAS, "Assume code will be assembled by GAS"}, \
188 {"no-gas", -MASK_GAS, "Do not assume code will be assembled by GAS"}, \
189 {"soft-float", MASK_SOFT_FLOAT, "Use software floating point"}, \
190 {"no-soft-float", -MASK_SOFT_FLOAT, "Do not use software floating point"}, \
191 {"long-load-store", MASK_LONG_LOAD_STORE, "Emit long load/store sequences"}, \
192 {"no-long-load-store", -MASK_LONG_LOAD_STORE, "Do not emit long load/store sequences"},\
193 {"fast-indirect-calls", MASK_FAST_INDIRECT_CALLS, "Generate fast indirect calls"},\
194 {"no-fast-indirect-calls", -MASK_FAST_INDIRECT_CALLS, "Do not generate fast indirect calls"},\
195 {"big-switch", MASK_BIG_SWITCH, "Generate code for huge switch statements"}, \
196 {"no-big-switch", -MASK_BIG_SWITCH, "Do not generate code for huge switch statements"}, \
197 {"linker-opt", 0, "Enable linker optimizations"}, \
198 { "", TARGET_DEFAULT | TARGET_CPU_DEFAULT, NULL}}
200 #ifndef TARGET_DEFAULT
201 #define TARGET_DEFAULT (MASK_GAS | MASK_JUMP_IN_DELAY)
202 #endif
204 #ifndef TARGET_CPU_DEFAULT
205 #define TARGET_CPU_DEFAULT 0
206 #endif
208 #define TARGET_OPTIONS \
210 { "schedule=", &pa_cpu_string, "Specify CPU for scheduling purposes" },\
211 { "arch=", &pa_arch_string, "Specify architecture for code generation. Values are 1.0, 1.1, and 2.0. 2.0 requires gas snapshot 19990413 or later." }\
214 /* Specify the dialect of assembler to use. New mnemonics is dialect one
215 and the old mnemonics are dialect zero. */
216 #define ASSEMBLER_DIALECT (TARGET_PA_20 ? 1 : 0)
218 #define OVERRIDE_OPTIONS override_options ()
220 /* stabs-in-som is nearly identical to stabs-in-elf. To avoid useless
221 code duplication we simply include this file and override as needed. */
222 #include "dbxelf.h"
224 /* We do not have to be compatible with dbx, so we enable gdb extensions
225 by default. */
226 #define DEFAULT_GDB_EXTENSIONS 1
228 /* This used to be zero (no max length), but big enums and such can
229 cause huge strings which killed gas.
231 We also have to avoid lossage in dbxout.c -- it does not compute the
232 string size accurately, so we are real conservative here. */
233 #undef DBX_CONTIN_LENGTH
234 #define DBX_CONTIN_LENGTH 3000
236 /* Only labels should ever begin in column zero. */
237 #define ASM_STABS_OP "\t.stabs"
238 #define ASM_STABN_OP "\t.stabn"
240 /* GDB always assumes the current function's frame begins at the value
241 of the stack pointer upon entry to the current function. Accessing
242 local variables and parameters passed on the stack is done using the
243 base of the frame + an offset provided by GCC.
245 For functions which have frame pointers this method works fine;
246 the (frame pointer) == (stack pointer at function entry) and GCC provides
247 an offset relative to the frame pointer.
249 This loses for functions without a frame pointer; GCC provides an offset
250 which is relative to the stack pointer after adjusting for the function's
251 frame size. GDB would prefer the offset to be relative to the value of
252 the stack pointer at the function's entry. Yuk! */
253 #define DEBUGGER_AUTO_OFFSET(X) \
254 ((GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0) \
255 + (frame_pointer_needed ? 0 : compute_frame_size (get_frame_size (), 0)))
257 #define DEBUGGER_ARG_OFFSET(OFFSET, X) \
258 ((GET_CODE (X) == PLUS ? OFFSET : 0) \
259 + (frame_pointer_needed ? 0 : compute_frame_size (get_frame_size (), 0)))
261 #define CPP_PA10_SPEC ""
262 #define CPP_PA11_SPEC "-D_PA_RISC1_1 -D__hp9000s700"
263 #define CPP_PA20_SPEC "-D_PA_RISC2_0 -D__hp9000s800"
264 #define CPP_64BIT_SPEC "-D__LP64__ -D__LONG_MAX__=9223372036854775807L"
266 #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_PA_11) == 0
267 #define CPP_CPU_DEFAULT_SPEC "%(cpp_pa10)"
268 #endif
270 #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_PA_11) != 0
271 #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_PA_20) != 0
272 #define CPP_CPU_DEFAULT_SPEC "%(cpp_pa11) %(cpp_pa20)"
273 #else
274 #define CPP_CPU_DEFAULT_SPEC "%(cpp_pa11)"
275 #endif
276 #endif
278 #if TARGET_64BIT
279 #define CPP_64BIT_DEFAULT_SPEC "%(cpp_64bit)"
280 #else
281 #define CPP_64BIT_DEFAULT_SPEC ""
282 #endif
284 /* This macro defines names of additional specifications to put in the
285 specs that can be used in various specifications like CC1_SPEC. Its
286 definition is an initializer with a subgrouping for each command option.
288 Each subgrouping contains a string constant, that defines the
289 specification name, and a string constant that used by the GNU CC driver
290 program.
292 Do not define this macro if it does not need to do anything. */
294 #ifndef SUBTARGET_EXTRA_SPECS
295 #define SUBTARGET_EXTRA_SPECS
296 #endif
298 #define EXTRA_SPECS \
299 { "cpp_pa10", CPP_PA10_SPEC}, \
300 { "cpp_pa11", CPP_PA11_SPEC}, \
301 { "cpp_pa20", CPP_PA20_SPEC}, \
302 { "cpp_64bit", CPP_64BIT_SPEC}, \
303 { "cpp_cpu_default", CPP_CPU_DEFAULT_SPEC }, \
304 { "cpp_64bit_default", CPP_64BIT_DEFAULT_SPEC }, \
305 SUBTARGET_EXTRA_SPECS
307 #define CPP_SPEC "\
308 %{mpa-risc-1-0:%(cpp_pa10)} \
309 %{mpa-risc-1-1:%(cpp_pa11)} \
310 %{msnake:%(cpp_pa11)} \
311 %{mpa-risc-2-0:%(cpp_pa20)} \
312 %{!mpa-risc-1-0:%{!mpa-risc-1-1:%{!mpa-risc-2-0:%{!msnake:%(cpp_cpu_default)}}}} \
313 %{m64bit:%(cpp_64bit)} \
314 %{!m64bit:%(cpp_64bit_default)} \
315 %{!ansi: -D_HPUX_SOURCE -D_HIUX_SOURCE -D__STDC_EXT__} \
316 %{threads: -D_REENTRANT -D_DCE_THREADS}"
318 /* Defines for a K&R CC */
320 #define CC1_SPEC "%{pg:} %{p:}"
322 #define LINK_SPEC "%{mlinker-opt:-O} %{!shared:-u main} %{shared:-b}"
324 /* We don't want -lg. */
325 #ifndef LIB_SPEC
326 #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
327 #endif
329 /* Make gcc agree with <machine/ansi.h> */
331 #define SIZE_TYPE "unsigned int"
332 #define PTRDIFF_TYPE "int"
333 #define WCHAR_TYPE "unsigned int"
334 #define WCHAR_TYPE_SIZE 32
336 /* Show we can debug even without a frame pointer. */
337 #define CAN_DEBUG_WITHOUT_FP
339 /* Machine dependent reorg pass. */
340 #define MACHINE_DEPENDENT_REORG(X) pa_reorg(X)
342 /* Names to predefine in the preprocessor for this target machine. */
344 #define CPP_PREDEFINES "-Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -Dunix -Dhp9000 -Dhp800 -Dspectrum -DREVARGV -Asystem(unix) -Asystem(bsd) -Acpu(hppa) -Amachine(hppa)"
346 /* target machine storage layout */
348 /* Define for cross-compilation from a host with a different float format
349 or endianness (e.g. VAX, x86). */
350 #define REAL_ARITHMETIC
352 /* Define this macro if it is advisable to hold scalars in registers
353 in a wider mode than that declared by the program. In such cases,
354 the value is constrained to be within the bounds of the declared
355 type, but kept valid in the wider mode. The signedness of the
356 extension may differ from that of the type. */
358 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
359 if (GET_MODE_CLASS (MODE) == MODE_INT \
360 && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
361 (MODE) = word_mode;
363 /* Define this if most significant bit is lowest numbered
364 in instructions that operate on numbered bit-fields. */
365 #define BITS_BIG_ENDIAN 1
367 /* Define this if most significant byte of a word is the lowest numbered. */
368 /* That is true on the HP-PA. */
369 #define BYTES_BIG_ENDIAN 1
371 /* Define this if most significant word of a multiword number is lowest
372 numbered. */
373 #define WORDS_BIG_ENDIAN 1
375 /* number of bits in an addressable storage unit */
376 #define BITS_PER_UNIT 8
378 /* Width in bits of a "word", which is the contents of a machine register.
379 Note that this is not necessarily the width of data type `int';
380 if using 16-bit ints on a 68000, this would still be 32.
381 But on a machine with 16-bit registers, this would be 16. */
382 #define BITS_PER_WORD (TARGET_64BIT ? 64 : 32)
383 #define MAX_BITS_PER_WORD 64
384 #define MAX_LONG_TYPE_SIZE 64
385 #define MAX_WCHAR_TYPE_SIZE 32
387 /* Width of a word, in units (bytes). */
388 #define UNITS_PER_WORD (TARGET_64BIT ? 8 : 4)
389 #define MIN_UNITS_PER_WORD 4
391 /* Width in bits of a pointer.
392 See also the macro `Pmode' defined below. */
393 #define POINTER_SIZE BITS_PER_WORD
395 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
396 #define PARM_BOUNDARY BITS_PER_WORD
398 /* Largest alignment required for any stack parameter, in bits.
399 Don't define this if it is equal to PARM_BOUNDARY */
400 #define MAX_PARM_BOUNDARY 64
402 /* Boundary (in *bits*) on which stack pointer is always aligned;
403 certain optimizations in combine depend on this.
405 GCC for the PA always rounds its stacks to a 512bit boundary,
406 but that happens late in the compilation process. */
407 #define STACK_BOUNDARY (TARGET_64BIT ? 128 : 64)
409 /* Allocation boundary (in *bits*) for the code of a function. */
410 #define FUNCTION_BOUNDARY (TARGET_64BIT ? 64 : 32)
412 /* Alignment of field after `int : 0' in a structure. */
413 #define EMPTY_FIELD_BOUNDARY 32
415 /* Every structure's size must be a multiple of this. */
416 #define STRUCTURE_SIZE_BOUNDARY 8
418 /* A bitfield declared as `int' forces `int' alignment for the struct. */
419 #define PCC_BITFIELD_TYPE_MATTERS 1
421 /* No data type wants to be aligned rounder than this. */
422 #define BIGGEST_ALIGNMENT 64
424 /* Get around hp-ux assembler bug, and make strcpy of constants fast. */
425 #define CONSTANT_ALIGNMENT(CODE, TYPEALIGN) \
426 ((TYPEALIGN) < 32 ? 32 : (TYPEALIGN))
428 /* Make arrays of chars word-aligned for the same reasons. */
429 #define DATA_ALIGNMENT(TYPE, ALIGN) \
430 (TREE_CODE (TYPE) == ARRAY_TYPE \
431 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
432 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
435 /* Set this nonzero if move instructions will actually fail to work
436 when given unaligned data. */
437 #define STRICT_ALIGNMENT 1
439 /* Generate calls to memcpy, memcmp and memset. */
440 #define TARGET_MEM_FUNCTIONS
442 /* Value is 1 if it is a good idea to tie two pseudo registers
443 when one has mode MODE1 and one has mode MODE2.
444 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
445 for any hard reg, then this must be 0 for correct output. */
446 #define MODES_TIEABLE_P(MODE1, MODE2) \
447 (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
449 /* Specify the registers used for certain standard purposes.
450 The values of these macros are register numbers. */
452 /* The HP-PA pc isn't overloaded on a register that the compiler knows about. */
453 /* #define PC_REGNUM */
455 /* Register to use for pushing function arguments. */
456 #define STACK_POINTER_REGNUM 30
458 /* Base register for access to local variables of the function. */
459 #define FRAME_POINTER_REGNUM 3
461 /* Value should be nonzero if functions must have frame pointers. */
462 #define FRAME_POINTER_REQUIRED \
463 (current_function_calls_alloca)
465 /* C statement to store the difference between the frame pointer
466 and the stack pointer values immediately after the function prologue.
468 Note, we always pretend that this is a leaf function because if
469 it's not, there's no point in trying to eliminate the
470 frame pointer. If it is a leaf function, we guessed right! */
471 #define INITIAL_FRAME_POINTER_OFFSET(VAR) \
472 do {(VAR) = - compute_frame_size (get_frame_size (), 0);} while (0)
474 /* Base register for access to arguments of the function. */
475 #define ARG_POINTER_REGNUM 3
477 /* Register in which static-chain is passed to a function. */
478 #define STATIC_CHAIN_REGNUM 29
480 /* Register which holds offset table for position-independent
481 data references. */
483 #define PIC_OFFSET_TABLE_REGNUM (TARGET_64BIT ? 27 : 19)
484 #define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED 1
486 /* Register into which we save the PIC_OFFEST_TABLE_REGNUM so that it
487 can be restore across function calls. */
488 #define PIC_OFFSET_TABLE_REGNUM_SAVED 4
490 #define DEFAULT_PCC_STRUCT_RETURN 0
492 /* SOM ABI says that objects larger than 64 bits are returned in memory.
493 PA64 ABI says that objects larger than 128 bits are returned in memory. */
494 #define RETURN_IN_MEMORY(TYPE) \
495 (TARGET_64BIT ? int_size_in_bytes (TYPE) > 16 : int_size_in_bytes (TYPE) > 8)
497 /* Register in which address to store a structure value
498 is passed to a function. */
499 #define STRUCT_VALUE_REGNUM 28
501 /* The letters I, J, K, L and M in a register constraint string
502 can be used to stand for particular ranges of immediate operands.
503 This macro defines what the ranges are.
504 C is the letter, and VALUE is a constant value.
505 Return 1 if VALUE is in the range specified by C.
507 `I' is used for the 11 bit constants.
508 `J' is used for the 14 bit constants.
509 `K' is used for values that can be moved with a zdepi insn.
510 `L' is used for the 5 bit constants.
511 `M' is used for 0.
512 `N' is used for values with the least significant 11 bits equal to zero
513 and when sign extended from 32 to 64 bits the
514 value does not change.
515 `O' is used for numbers n such that n+1 is a power of 2.
518 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
519 ((C) == 'I' ? VAL_11_BITS_P (VALUE) \
520 : (C) == 'J' ? VAL_14_BITS_P (VALUE) \
521 : (C) == 'K' ? zdepi_cint_p (VALUE) \
522 : (C) == 'L' ? VAL_5_BITS_P (VALUE) \
523 : (C) == 'M' ? (VALUE) == 0 \
524 : (C) == 'N' ? (((VALUE) & (unsigned long)0x7ff) == 0 \
525 && (VALUE) == ((((VALUE) & 0xffffffff) ^ (~0x7fffffff)) \
526 + 0x80000000)) \
527 : (C) == 'O' ? (((VALUE) & ((VALUE) + (long)1)) == 0) \
528 : (C) == 'P' ? and_mask_p (VALUE) \
529 : 0)
531 /* Similar, but for floating or large integer constants, and defining letters
532 G and H. Here VALUE is the CONST_DOUBLE rtx itself.
534 For PA, `G' is the floating-point constant zero. `H' is undefined. */
536 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
537 ((C) == 'G' ? (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \
538 && (VALUE) == CONST0_RTX (GET_MODE (VALUE))) \
539 : 0)
541 /* The class value for index registers, and the one for base regs. */
542 #define INDEX_REG_CLASS GENERAL_REGS
543 #define BASE_REG_CLASS GENERAL_REGS
545 #define FP_REG_CLASS_P(CLASS) \
546 ((CLASS) == FP_REGS || (CLASS) == FPUPPER_REGS)
548 /* True if register is floating-point. */
549 #define FP_REGNO_P(N) ((N) >= FP_REG_FIRST && (N) <= FP_REG_LAST)
551 /* Given an rtx X being reloaded into a reg required to be
552 in class CLASS, return the class of reg to actually use.
553 In general this is just CLASS; but on some machines
554 in some cases it is preferable to use a more restrictive class. */
555 #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
557 /* Return the register class of a scratch register needed to copy IN into
558 or out of a register in CLASS in MODE. If it can be done directly
559 NO_REGS is returned.
561 Avoid doing any work for the common case calls. */
563 #define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
564 ((CLASS == BASE_REG_CLASS && GET_CODE (IN) == REG \
565 && REGNO (IN) < FIRST_PSEUDO_REGISTER) \
566 ? NO_REGS : secondary_reload_class (CLASS, MODE, IN))
568 /* On the PA it is not possible to directly move data between
569 GENERAL_REGS and FP_REGS. */
570 #define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \
571 (FP_REG_CLASS_P (CLASS1) != FP_REG_CLASS_P (CLASS2))
573 /* Return the stack location to use for secondary memory needed reloads. */
574 #define SECONDARY_MEMORY_NEEDED_RTX(MODE) \
575 gen_rtx_MEM (MODE, gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (-16)))
578 /* Stack layout; function entry, exit and calling. */
580 /* Define this if pushing a word on the stack
581 makes the stack pointer a smaller address. */
582 /* #define STACK_GROWS_DOWNWARD */
584 /* Believe it or not. */
585 #define ARGS_GROW_DOWNWARD
587 /* Define this if the nominal address of the stack frame
588 is at the high-address end of the local variables;
589 that is, each additional local variable allocated
590 goes at a more negative offset in the frame. */
591 /* #define FRAME_GROWS_DOWNWARD */
593 /* Offset within stack frame to start allocating local variables at.
594 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
595 first local allocated. Otherwise, it is the offset to the BEGINNING
596 of the first local allocated. */
597 #define STARTING_FRAME_OFFSET 8
599 /* If we generate an insn to push BYTES bytes,
600 this says how many the stack pointer really advances by.
601 On the HP-PA, don't define this because there are no push insns. */
602 /* #define PUSH_ROUNDING(BYTES) */
604 /* Offset of first parameter from the argument pointer register value.
605 This value will be negated because the arguments grow down.
606 Also note that on STACK_GROWS_UPWARD machines (such as this one)
607 this is the distance from the frame pointer to the end of the first
608 argument, not it's beginning. To get the real offset of the first
609 argument, the size of the argument must be added. */
611 #define FIRST_PARM_OFFSET(FNDECL) (TARGET_64BIT ? -64 : -32)
613 /* When a parameter is passed in a register, stack space is still
614 allocated for it. */
615 #define REG_PARM_STACK_SPACE(DECL) (TARGET_64BIT ? 64 : 16)
617 /* Define this if the above stack space is to be considered part of the
618 space allocated by the caller. */
619 #define OUTGOING_REG_PARM_STACK_SPACE
621 /* Keep the stack pointer constant throughout the function.
622 This is both an optimization and a necessity: longjmp
623 doesn't behave itself when the stack pointer moves within
624 the function! */
625 #define ACCUMULATE_OUTGOING_ARGS 1
627 /* The weird HPPA calling conventions require a minimum of 48 bytes on
628 the stack: 16 bytes for register saves, and 32 bytes for magic.
629 This is the difference between the logical top of stack and the
630 actual sp. */
631 #define STACK_POINTER_OFFSET \
632 (TARGET_64BIT ? -(current_function_outgoing_args_size + 16): -32)
634 #define STACK_DYNAMIC_OFFSET(FNDECL) \
635 (TARGET_64BIT \
636 ? (STACK_POINTER_OFFSET) \
637 : ((STACK_POINTER_OFFSET) - current_function_outgoing_args_size))
639 /* Value is 1 if returning from a function call automatically
640 pops the arguments described by the number-of-args field in the call.
641 FUNDECL is the declaration node of the function (as a tree),
642 FUNTYPE is the data type of the function (as a tree),
643 or for a library call it is an identifier node for the subroutine name. */
645 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
647 /* Define how to find the value returned by a function.
648 VALTYPE is the data type of the value (as a tree).
649 If the precise function being called is known, FUNC is its FUNCTION_DECL;
650 otherwise, FUNC is 0. */
652 /* On the HP-PA the value is found in register(s) 28(-29), unless
653 the mode is SF or DF. Then the value is returned in fr4 (32, ) */
655 /* This must perform the same promotions as PROMOTE_MODE, else
656 PROMOTE_FUNCTION_RETURN will not work correctly. */
657 #define FUNCTION_VALUE(VALTYPE, FUNC) \
658 gen_rtx_REG (((INTEGRAL_TYPE_P (VALTYPE) \
659 && TYPE_PRECISION (VALTYPE) < BITS_PER_WORD) \
660 || POINTER_TYPE_P (VALTYPE)) \
661 ? word_mode : TYPE_MODE (VALTYPE), \
662 TREE_CODE (VALTYPE) == REAL_TYPE && !TARGET_SOFT_FLOAT ? 32 : 28)
664 /* Define how to find the value returned by a library function
665 assuming the value has mode MODE. */
667 #define LIBCALL_VALUE(MODE) \
668 gen_rtx_REG (MODE, \
669 (! TARGET_SOFT_FLOAT \
670 && ((MODE) == SFmode || (MODE) == DFmode) ? 32 : 28))
672 /* 1 if N is a possible register number for a function value
673 as seen by the caller. */
675 #define FUNCTION_VALUE_REGNO_P(N) \
676 ((N) == 28 || (! TARGET_SOFT_FLOAT && (N) == 32))
679 /* Define a data type for recording info about an argument list
680 during the scan of that argument list. This data type should
681 hold all necessary information about the function itself
682 and about the args processed so far, enough to enable macros
683 such as FUNCTION_ARG to determine where the next arg should go.
685 On the HP-PA, this is a single integer, which is a number of words
686 of arguments scanned so far (including the invisible argument,
687 if any, which holds the structure-value-address).
688 Thus 4 or more means all following args should go on the stack. */
690 struct hppa_args {int words, nargs_prototype, indirect; };
692 #define CUMULATIVE_ARGS struct hppa_args
694 /* Initialize a variable CUM of type CUMULATIVE_ARGS
695 for a call to a function whose data type is FNTYPE.
696 For a library call, FNTYPE is 0. */
698 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
699 (CUM).words = 0, \
700 (CUM).indirect = INDIRECT, \
701 (CUM).nargs_prototype = (FNTYPE && TYPE_ARG_TYPES (FNTYPE) \
702 ? (list_length (TYPE_ARG_TYPES (FNTYPE)) - 1 \
703 + (TYPE_MODE (TREE_TYPE (FNTYPE)) == BLKmode \
704 || RETURN_IN_MEMORY (TREE_TYPE (FNTYPE)))) \
705 : 0)
709 /* Similar, but when scanning the definition of a procedure. We always
710 set NARGS_PROTOTYPE large so we never return a PARALLEL. */
712 #define INIT_CUMULATIVE_INCOMING_ARGS(CUM,FNTYPE,IGNORE) \
713 (CUM).words = 0, \
714 (CUM).indirect = 0, \
715 (CUM).nargs_prototype = 1000
717 /* Figure out the size in words of the function argument. */
719 #define FUNCTION_ARG_SIZE(MODE, TYPE) \
720 ((((MODE) != BLKmode \
721 ? GET_MODE_SIZE (MODE) \
722 : int_size_in_bytes (TYPE)) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
724 /* Update the data in CUM to advance over an argument
725 of mode MODE and data type TYPE.
726 (TYPE is null for libcalls where that information may not be available.) */
728 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
729 { (CUM).nargs_prototype--; \
730 (CUM).words += FUNCTION_ARG_SIZE(MODE, TYPE) \
731 + (((CUM).words & 01) && (TYPE) != 0 \
732 && FUNCTION_ARG_SIZE(MODE, TYPE) > 1); \
735 /* Determine where to put an argument to a function.
736 Value is zero to push the argument on the stack,
737 or a hard register in which to store the argument.
739 MODE is the argument's machine mode.
740 TYPE is the data type of the argument (as a tree).
741 This is null for libcalls where that information may
742 not be available.
743 CUM is a variable of type CUMULATIVE_ARGS which gives info about
744 the preceding args and about the function being called.
745 NAMED is nonzero if this argument is a named parameter
746 (otherwise it is an extra parameter matching an ellipsis).
748 On the HP-PA the first four words of args are normally in registers
749 and the rest are pushed. But any arg that won't entirely fit in regs
750 is pushed.
752 Arguments passed in registers are either 1 or 2 words long.
754 The caller must make a distinction between calls to explicitly named
755 functions and calls through pointers to functions -- the conventions
756 are different! Calls through pointers to functions only use general
757 registers for the first four argument words.
759 Of course all this is different for the portable runtime model
760 HP wants everyone to use for ELF. Ugh. Here's a quick description
761 of how it's supposed to work.
763 1) callee side remains unchanged. It expects integer args to be
764 in the integer registers, float args in the float registers and
765 unnamed args in integer registers.
767 2) caller side now depends on if the function being called has
768 a prototype in scope (rather than if it's being called indirectly).
770 2a) If there is a prototype in scope, then arguments are passed
771 according to their type (ints in integer registers, floats in float
772 registers, unnamed args in integer registers.
774 2b) If there is no prototype in scope, then floating point arguments
775 are passed in both integer and float registers. egad.
777 FYI: The portable parameter passing conventions are almost exactly like
778 the standard parameter passing conventions on the RS6000. That's why
779 you'll see lots of similar code in rs6000.h. */
781 #define FUNCTION_ARG_PADDING(MODE, TYPE) function_arg_padding ((MODE), (TYPE))
783 /* Do not expect to understand this without reading it several times. I'm
784 tempted to try and simply it, but I worry about breaking something. */
786 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
787 function_arg (&CUM, MODE, TYPE, NAMED, 0)
789 #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
790 function_arg (&CUM, MODE, TYPE, NAMED, 1)
792 /* For an arg passed partly in registers and partly in memory,
793 this is the number of registers used.
794 For args passed entirely in registers or entirely in memory, zero. */
796 /* For PA32 there are never split arguments. PA64, on the other hand, can
797 pass arguments partially in registers and partially in memory. */
798 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
799 (TARGET_64BIT ? function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED) : 0)
801 /* If defined, a C expression that gives the alignment boundary, in
802 bits, of an argument with the specified mode and type. If it is
803 not defined, `PARM_BOUNDARY' is used for all arguments. */
805 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
806 (((TYPE) != 0) \
807 ? ((integer_zerop (TYPE_SIZE (TYPE)) \
808 || ! TREE_CONSTANT (TYPE_SIZE (TYPE))) \
809 ? BITS_PER_UNIT \
810 : (((int_size_in_bytes (TYPE)) + UNITS_PER_WORD - 1) \
811 / UNITS_PER_WORD) * BITS_PER_WORD) \
812 : ((GET_MODE_ALIGNMENT(MODE) <= PARM_BOUNDARY) \
813 ? PARM_BOUNDARY : GET_MODE_ALIGNMENT(MODE)))
815 /* Arguments larger than eight bytes are passed by invisible reference */
817 /* PA64 does not pass anything by invisible reference. */
818 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
819 (TARGET_64BIT \
820 ? 0 \
821 : (((TYPE) && int_size_in_bytes (TYPE) > 8) \
822 || ((MODE) && GET_MODE_SIZE (MODE) > 8)))
824 /* PA64 does not pass anything by invisible reference.
825 This should be undef'ed for 64bit, but we'll see if this works. The
826 problem is that we can't test TARGET_64BIT from the preprocessor. */
827 #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \
828 (TARGET_64BIT \
829 ? 0 \
830 : (((TYPE) && int_size_in_bytes (TYPE) > 8) \
831 || ((MODE) && GET_MODE_SIZE (MODE) > 8)))
834 extern struct rtx_def *hppa_compare_op0, *hppa_compare_op1;
835 extern enum cmp_type hppa_branch_type;
837 #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
838 { const char *target_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0); \
839 STRIP_NAME_ENCODING (target_name, target_name); \
840 output_function_prologue (FILE, 0); \
841 if (VAL_14_BITS_P (DELTA)) \
842 fprintf (FILE, "\tb %s\n\tldo %d(%%r26),%%r26\n", target_name, DELTA); \
843 else \
844 fprintf (FILE, "\taddil L%%%d,%%r26\n\tb %s\n\tldo R%%%d(%%r1),%%r26\n", \
845 DELTA, target_name, DELTA); \
846 fprintf (FILE, "\n\t.EXIT\n\t.PROCEND\n"); \
849 /* This macro generates the assembly code for function entry.
850 FILE is a stdio stream to output the code to.
851 SIZE is an int: how many units of temporary storage to allocate.
852 Refer to the array `regs_ever_live' to determine which registers
853 to save; `regs_ever_live[I]' is nonzero if register number I
854 is ever used in the function. This macro is responsible for
855 knowing which registers should not be saved even if used. */
857 /* On HP-PA, move-double insns between fpu and cpu need an 8-byte block
858 of memory. If any fpu reg is used in the function, we allocate
859 such a block here, at the bottom of the frame, just in case it's needed.
861 If this function is a leaf procedure, then we may choose not
862 to do a "save" insn. The decision about whether or not
863 to do this is made in regclass.c. */
865 #define FUNCTION_PROLOGUE(FILE, SIZE) \
866 output_function_prologue (FILE, SIZE)
868 /* Output assembler code to FILE to increment profiler label # LABELNO
869 for profiling a function entry.
871 Because HPUX _mcount is so different, we actually emit the
872 profiling code in function_prologue. This just stores LABELNO for
873 that. */
875 #define PROFILE_BEFORE_PROLOGUE
876 #define FUNCTION_PROFILER(FILE, LABELNO) \
877 { extern int hp_profile_labelno; hp_profile_labelno = (LABELNO);}
879 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
880 the stack pointer does not matter. The value is tested only in
881 functions that have frame pointers.
882 No definition is equivalent to always zero. */
884 extern int may_call_alloca;
886 #define EXIT_IGNORE_STACK \
887 (get_frame_size () != 0 \
888 || current_function_calls_alloca || current_function_outgoing_args_size)
891 /* This macro generates the assembly code for function exit,
892 on machines that need it. If FUNCTION_EPILOGUE is not defined
893 then individual return instructions are generated for each
894 return statement. Args are same as for FUNCTION_PROLOGUE.
896 The function epilogue should not depend on the current stack pointer!
897 It should use the frame pointer only. This is mandatory because
898 of alloca; we also take advantage of it to omit stack adjustments
899 before returning. */
901 #define FUNCTION_EPILOGUE(FILE, SIZE) \
902 output_function_epilogue (FILE, SIZE)
904 /* Output assembler code for a block containing the constant parts
905 of a trampoline, leaving space for the variable parts.\
907 The trampoline sets the static chain pointer to STATIC_CHAIN_REGNUM
908 and then branches to the specified routine.
910 This code template is copied from text segment to stack location
911 and then patched with INITIALIZE_TRAMPOLINE to contain
912 valid values, and then entered as a subroutine.
914 It is best to keep this as small as possible to avoid having to
915 flush multiple lines in the cache. */
917 #define TRAMPOLINE_TEMPLATE(FILE) \
919 if (! TARGET_64BIT) \
921 fputs ("\tldw 36(%r22),%r21\n", FILE); \
922 fputs ("\tbb,>=,n %r21,30,.+16\n", FILE); \
923 if (ASSEMBLER_DIALECT == 0) \
924 fputs ("\tdepi 0,31,2,%r21\n", FILE); \
925 else \
926 fputs ("\tdepwi 0,31,2,%r21\n", FILE); \
927 fputs ("\tldw 4(%r21),%r19\n", FILE); \
928 fputs ("\tldw 0(%r21),%r21\n", FILE); \
929 fputs ("\tldsid (%r21),%r1\n", FILE); \
930 fputs ("\tmtsp %r1,%sr0\n", FILE); \
931 fputs ("\tbe 0(%sr0,%r21)\n", FILE); \
932 fputs ("\tldw 40(%r22),%r29\n", FILE); \
933 fputs ("\t.word 0\n", FILE); \
934 fputs ("\t.word 0\n", FILE); \
936 else \
938 fputs ("\t.dword 0\n", FILE); \
939 fputs ("\t.dword 0\n", FILE); \
940 fputs ("\t.dword 0\n", FILE); \
941 fputs ("\t.dword 0\n", FILE); \
942 fputs ("\tmfia %r31\n", FILE); \
943 fputs ("\tldd 24(%r31),%r1\n", FILE); \
944 fputs ("\tldd 24(%r1),%r27\n", FILE); \
945 fputs ("\tldd 16(%r1),%r1\n", FILE); \
946 fputs ("\tbve (%r1)\n", FILE); \
947 fputs ("\tldd 32(%r31),%r31\n", FILE); \
948 fputs ("\t.dword 0 ; fptr\n", FILE); \
949 fputs ("\t.dword 0 ; static link\n", FILE); \
953 /* Length in units of the trampoline for entering a nested function.
955 Flush the cache entries corresponding to the first and last addresses
956 of the trampoline. This is necessary as the trampoline may cross two
957 cache lines.
959 If the code part of the trampoline ever grows to > 32 bytes, then it
960 will become necessary to hack on the cacheflush pattern in pa.md. */
962 #define TRAMPOLINE_SIZE (TARGET_64BIT ? 72 : 11 * 4)
964 /* Emit RTL insns to initialize the variable parts of a trampoline.
965 FNADDR is an RTX for the address of the function's pure code.
966 CXT is an RTX for the static chain value for the function.
968 Move the function address to the trampoline template at offset 12.
969 Move the static chain value to trampoline template at offset 16. */
971 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
973 if (! TARGET_64BIT) \
975 rtx start_addr, end_addr; \
977 start_addr = memory_address (Pmode, plus_constant ((TRAMP), 36)); \
978 emit_move_insn (gen_rtx_MEM (Pmode, start_addr), (FNADDR)); \
979 start_addr = memory_address (Pmode, plus_constant ((TRAMP), 40)); \
980 emit_move_insn (gen_rtx_MEM (Pmode, start_addr), (CXT)); \
981 /* fdc and fic only use registers for the address to flush, \
982 they do not accept integer displacements. */ \
983 start_addr = force_reg (Pmode, (TRAMP)); \
984 end_addr = force_reg (Pmode, plus_constant ((TRAMP), 32)); \
985 emit_insn (gen_dcacheflush (start_addr, end_addr)); \
986 end_addr = force_reg (Pmode, plus_constant (start_addr, 32)); \
987 emit_insn (gen_icacheflush (start_addr, end_addr, start_addr, \
988 gen_reg_rtx (Pmode), gen_reg_rtx (Pmode)));\
990 else \
992 rtx start_addr, end_addr; \
994 start_addr = memory_address (Pmode, plus_constant ((TRAMP), 56)); \
995 emit_move_insn (gen_rtx_MEM (Pmode, start_addr), (FNADDR)); \
996 start_addr = memory_address (Pmode, plus_constant ((TRAMP), 64)); \
997 emit_move_insn (gen_rtx_MEM (Pmode, start_addr), (CXT)); \
998 /* Create a fat pointer for the trampoline. */ \
999 end_addr = force_reg (Pmode, plus_constant ((TRAMP), 32)); \
1000 start_addr = memory_address (Pmode, plus_constant ((TRAMP), 16)); \
1001 emit_move_insn (gen_rtx_MEM (Pmode, start_addr), end_addr); \
1002 end_addr = gen_rtx_REG (Pmode, 27); \
1003 start_addr = memory_address (Pmode, plus_constant ((TRAMP), 24)); \
1004 emit_move_insn (gen_rtx_MEM (Pmode, start_addr), end_addr); \
1005 /* fdc and fic only use registers for the address to flush, \
1006 they do not accept integer displacements. */ \
1007 start_addr = force_reg (Pmode, (TRAMP)); \
1008 end_addr = force_reg (Pmode, plus_constant ((TRAMP), 32)); \
1009 emit_insn (gen_dcacheflush (start_addr, end_addr)); \
1010 end_addr = force_reg (Pmode, plus_constant (start_addr, 32)); \
1011 emit_insn (gen_icacheflush (start_addr, end_addr, start_addr, \
1012 gen_reg_rtx (Pmode), gen_reg_rtx (Pmode)));\
1016 /* Emit code for a call to builtin_saveregs. We must emit USE insns which
1017 reference the 4 integer arg registers and 4 fp arg registers.
1018 Ordinarily they are not call used registers, but they are for
1019 _builtin_saveregs, so we must make this explicit. */
1021 #define EXPAND_BUILTIN_SAVEREGS() hppa_builtin_saveregs ()
1023 /* Implement `va_start' for varargs and stdarg. */
1025 #define EXPAND_BUILTIN_VA_START(stdarg, valist, nextarg) \
1026 hppa_va_start (stdarg, valist, nextarg)
1028 /* Implement `va_arg'. */
1030 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
1031 hppa_va_arg (valist, type)
1033 /* Addressing modes, and classification of registers for them.
1035 Using autoincrement addressing modes on PA8000 class machines is
1036 not profitable. */
1038 #define HAVE_POST_INCREMENT (pa_cpu < PROCESSOR_8000)
1039 #define HAVE_POST_DECREMENT (pa_cpu < PROCESSOR_8000)
1041 #define HAVE_PRE_DECREMENT (pa_cpu < PROCESSOR_8000)
1042 #define HAVE_PRE_INCREMENT (pa_cpu < PROCESSOR_8000)
1044 /* Macros to check register numbers against specific register classes. */
1046 /* These assume that REGNO is a hard or pseudo reg number.
1047 They give nonzero only if REGNO is a hard reg of the suitable class
1048 or a pseudo reg currently allocated to a suitable hard reg.
1049 Since they use reg_renumber, they are safe only once reg_renumber
1050 has been allocated, which happens in local-alloc.c. */
1052 #define REGNO_OK_FOR_INDEX_P(REGNO) \
1053 ((REGNO) && ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32))
1054 #define REGNO_OK_FOR_BASE_P(REGNO) \
1055 ((REGNO) && ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32))
1056 #define REGNO_OK_FOR_FP_P(REGNO) \
1057 (FP_REGNO_P (REGNO) || FP_REGNO_P (reg_renumber[REGNO]))
1059 /* Now macros that check whether X is a register and also,
1060 strictly, whether it is in a specified class.
1062 These macros are specific to the HP-PA, and may be used only
1063 in code for printing assembler insns and in conditions for
1064 define_optimization. */
1066 /* 1 if X is an fp register. */
1068 #define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
1070 /* Maximum number of registers that can appear in a valid memory address. */
1072 #define MAX_REGS_PER_ADDRESS 2
1074 /* Recognize any constant value that is a valid address except
1075 for symbolic addresses. We get better CSE by rejecting them
1076 here and allowing hppa_legitimize_address to break them up. We
1077 use most of the constants accepted by CONSTANT_P, except CONST_DOUBLE. */
1079 #define CONSTANT_ADDRESS_P(X) \
1080 ((GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1081 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
1082 || GET_CODE (X) == HIGH) \
1083 && (reload_in_progress || reload_completed || ! symbolic_expression_p (X)))
1085 /* Include all constant integers and constant doubles, but not
1086 floating-point, except for floating-point zero.
1088 Reject LABEL_REFs if we're not using gas or the new HP assembler.
1090 ?!? For now also reject CONST_DOUBLES in 64bit mode. This will need
1091 further work. */
1092 #ifdef NEW_HP_ASSEMBLER
1093 #define LEGITIMATE_CONSTANT_P(X) \
1094 ((GET_MODE_CLASS (GET_MODE (X)) != MODE_FLOAT \
1095 || (X) == CONST0_RTX (GET_MODE (X))) \
1096 && !(TARGET_64BIT && GET_CODE (X) == CONST_DOUBLE) \
1097 && !(TARGET_64BIT && GET_CODE (X) == CONST_INT \
1098 && !(cint_ok_for_move (INTVAL (X)) \
1099 || ((INTVAL (X) & 0xffffffff80000000L) == 0xffffffff80000000L) \
1100 || ((INTVAL (X) & 0xffffffff00000000L) == 0x0000000000000000L))) \
1101 && !function_label_operand (X, VOIDmode))
1102 #else
1103 #define LEGITIMATE_CONSTANT_P(X) \
1104 ((GET_MODE_CLASS (GET_MODE (X)) != MODE_FLOAT \
1105 || (X) == CONST0_RTX (GET_MODE (X))) \
1106 && (GET_CODE (X) != LABEL_REF || TARGET_GAS)\
1107 && !(TARGET_64BIT && GET_CODE (X) == CONST_DOUBLE) \
1108 && !(TARGET_64BIT && GET_CODE (X) == CONST_INT \
1109 && !(cint_ok_for_move (INTVAL (X)) \
1110 || ((INTVAL (X) & 0xffffffff80000000L) == 0xffffffff80000000L) \
1111 || ((INTVAL (X) & 0xffffffff00000000L) == 0x0000000000000000L))) \
1112 && !function_label_operand (X, VOIDmode))
1113 #endif
1115 /* Subroutine for EXTRA_CONSTRAINT.
1117 Return 1 iff OP is a pseudo which did not get a hard register and
1118 we are running the reload pass. */
1120 #define IS_RELOADING_PSEUDO_P(OP) \
1121 ((reload_in_progress \
1122 && GET_CODE (OP) == REG \
1123 && REGNO (OP) >= FIRST_PSEUDO_REGISTER \
1124 && reg_renumber [REGNO (OP)] < 0))
1126 /* Optional extra constraints for this machine. Borrowed from sparc.h.
1128 For the HPPA, `Q' means that this is a memory operand but not a
1129 symbolic memory operand. Note that an unassigned pseudo register
1130 is such a memory operand. Needed because reload will generate
1131 these things in insns and then not re-recognize the insns, causing
1132 constrain_operands to fail.
1134 `R' is used for scaled indexed addresses.
1136 `S' is the constant 31.
1138 `T' is for fp loads and stores. */
1139 #define EXTRA_CONSTRAINT(OP, C) \
1140 ((C) == 'Q' ? \
1141 (IS_RELOADING_PSEUDO_P (OP) \
1142 || (GET_CODE (OP) == MEM \
1143 && (memory_address_p (GET_MODE (OP), XEXP (OP, 0))\
1144 || reload_in_progress) \
1145 && ! symbolic_memory_operand (OP, VOIDmode) \
1146 && !(GET_CODE (XEXP (OP, 0)) == PLUS \
1147 && (GET_CODE (XEXP (XEXP (OP, 0), 0)) == MULT\
1148 || GET_CODE (XEXP (XEXP (OP, 0), 1)) == MULT))))\
1149 : ((C) == 'R' ? \
1150 (GET_CODE (OP) == MEM \
1151 && GET_CODE (XEXP (OP, 0)) == PLUS \
1152 && (GET_CODE (XEXP (XEXP (OP, 0), 0)) == MULT \
1153 || GET_CODE (XEXP (XEXP (OP, 0), 1)) == MULT) \
1154 && (move_operand (OP, GET_MODE (OP)) \
1155 || memory_address_p (GET_MODE (OP), XEXP (OP, 0))\
1156 || reload_in_progress)) \
1157 : ((C) == 'T' ? \
1158 (GET_CODE (OP) == MEM \
1159 /* Using DFmode forces only short displacements \
1160 to be recognized as valid in reg+d addresses. \
1161 However, this is not necessary for PA2.0 since\
1162 it has long FP loads/stores. */ \
1163 && memory_address_p ((TARGET_PA_20 \
1164 ? GET_MODE (OP) \
1165 : DFmode), \
1166 XEXP (OP, 0)) \
1167 && !(GET_CODE (XEXP (OP, 0)) == PLUS \
1168 && (GET_CODE (XEXP (XEXP (OP, 0), 0)) == MULT\
1169 || GET_CODE (XEXP (XEXP (OP, 0), 1)) == MULT)))\
1170 : ((C) == 'U' ? \
1171 (GET_CODE (OP) == CONST_INT && INTVAL (OP) == 63) \
1172 : ((C) == 'S' ? \
1173 (GET_CODE (OP) == CONST_INT && INTVAL (OP) == 31) : 0)))))
1176 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1177 and check its validity for a certain class.
1178 We have two alternate definitions for each of them.
1179 The usual definition accepts all pseudo regs; the other rejects
1180 them unless they have been allocated suitable hard regs.
1181 The symbol REG_OK_STRICT causes the latter definition to be used.
1183 Most source files want to accept pseudo regs in the hope that
1184 they will get allocated to the class that the insn wants them to be in.
1185 Source files for reload pass need to be strict.
1186 After reload, it makes no difference, since pseudo regs have
1187 been eliminated by then. */
1189 #ifndef REG_OK_STRICT
1191 /* Nonzero if X is a hard reg that can be used as an index
1192 or if it is a pseudo reg. */
1193 #define REG_OK_FOR_INDEX_P(X) \
1194 (REGNO (X) && (REGNO (X) < 32 || REGNO (X) >= FIRST_PSEUDO_REGISTER))
1195 /* Nonzero if X is a hard reg that can be used as a base reg
1196 or if it is a pseudo reg. */
1197 #define REG_OK_FOR_BASE_P(X) \
1198 (REGNO (X) && (REGNO (X) < 32 || REGNO (X) >= FIRST_PSEUDO_REGISTER))
1200 #else
1202 /* Nonzero if X is a hard reg that can be used as an index. */
1203 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1204 /* Nonzero if X is a hard reg that can be used as a base reg. */
1205 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1207 #endif
1209 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1210 that is a valid memory address for an instruction.
1211 The MODE argument is the machine mode for the MEM expression
1212 that wants to use this address.
1214 On the HP-PA, the actual legitimate addresses must be
1215 REG+REG, REG+(REG*SCALE) or REG+SMALLINT.
1216 But we can treat a SYMBOL_REF as legitimate if it is part of this
1217 function's constant-pool, because such addresses can actually
1218 be output as REG+SMALLINT.
1220 Note we only allow 5 bit immediates for access to a constant address;
1221 doing so avoids losing for loading/storing a FP register at an address
1222 which will not fit in 5 bits. */
1224 #define VAL_5_BITS_P(X) ((unsigned HOST_WIDE_INT)(X) + 0x10 < 0x20)
1225 #define INT_5_BITS(X) VAL_5_BITS_P (INTVAL (X))
1227 #define VAL_U5_BITS_P(X) ((unsigned HOST_WIDE_INT)(X) < 0x20)
1228 #define INT_U5_BITS(X) VAL_U5_BITS_P (INTVAL (X))
1230 #define VAL_11_BITS_P(X) ((unsigned HOST_WIDE_INT)(X) + 0x400 < 0x800)
1231 #define INT_11_BITS(X) VAL_11_BITS_P (INTVAL (X))
1233 #define VAL_14_BITS_P(X) ((unsigned HOST_WIDE_INT)(X) + 0x2000 < 0x4000)
1234 #define INT_14_BITS(X) VAL_14_BITS_P (INTVAL (X))
1236 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1238 if ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \
1239 || ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_DEC \
1240 || GET_CODE (X) == PRE_INC || GET_CODE (X) == POST_INC) \
1241 && REG_P (XEXP (X, 0)) \
1242 && REG_OK_FOR_BASE_P (XEXP (X, 0)))) \
1243 goto ADDR; \
1244 else if (GET_CODE (X) == PLUS) \
1246 rtx base = 0, index = 0; \
1247 if (flag_pic && XEXP (X, 0) == pic_offset_table_rtx)\
1249 if (GET_CODE (XEXP (X, 1)) == REG \
1250 && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
1251 goto ADDR; \
1252 else if (flag_pic == 1 \
1253 && GET_CODE (XEXP (X, 1)) == SYMBOL_REF)\
1254 goto ADDR; \
1256 else if (REG_P (XEXP (X, 0)) \
1257 && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
1258 base = XEXP (X, 0), index = XEXP (X, 1); \
1259 else if (REG_P (XEXP (X, 1)) \
1260 && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
1261 base = XEXP (X, 1), index = XEXP (X, 0); \
1262 if (base != 0) \
1263 if (GET_CODE (index) == CONST_INT \
1264 && ((INT_14_BITS (index) \
1265 && (TARGET_SOFT_FLOAT \
1266 || (TARGET_PA_20 \
1267 && ((MODE == SFmode \
1268 && (INTVAL (index) % 4) == 0)\
1269 || (MODE == DFmode \
1270 && (INTVAL (index) % 8) == 0)))\
1271 || ((MODE) != SFmode && (MODE) != DFmode))) \
1272 || INT_5_BITS (index))) \
1273 goto ADDR; \
1274 if (! TARGET_SOFT_FLOAT \
1275 && ! TARGET_DISABLE_INDEXING \
1276 && base \
1277 && (mode == SFmode || mode == DFmode) \
1278 && GET_CODE (index) == MULT \
1279 && GET_CODE (XEXP (index, 0)) == REG \
1280 && REG_OK_FOR_BASE_P (XEXP (index, 0)) \
1281 && GET_CODE (XEXP (index, 1)) == CONST_INT \
1282 && INTVAL (XEXP (index, 1)) == (mode == SFmode ? 4 : 8))\
1283 goto ADDR; \
1285 else if (GET_CODE (X) == LO_SUM \
1286 && GET_CODE (XEXP (X, 0)) == REG \
1287 && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
1288 && CONSTANT_P (XEXP (X, 1)) \
1289 && (TARGET_SOFT_FLOAT \
1290 /* We can allow symbolic LO_SUM addresses\
1291 for PA2.0. */ \
1292 || (TARGET_PA_20 \
1293 && GET_CODE (XEXP (X, 1)) != CONST_INT)\
1294 || ((MODE) != SFmode \
1295 && (MODE) != DFmode))) \
1296 goto ADDR; \
1297 else if (GET_CODE (X) == LO_SUM \
1298 && GET_CODE (XEXP (X, 0)) == SUBREG \
1299 && GET_CODE (SUBREG_REG (XEXP (X, 0))) == REG\
1300 && REG_OK_FOR_BASE_P (SUBREG_REG (XEXP (X, 0)))\
1301 && CONSTANT_P (XEXP (X, 1)) \
1302 && (TARGET_SOFT_FLOAT \
1303 /* We can allow symbolic LO_SUM addresses\
1304 for PA2.0. */ \
1305 || (TARGET_PA_20 \
1306 && GET_CODE (XEXP (X, 1)) != CONST_INT)\
1307 || ((MODE) != SFmode \
1308 && (MODE) != DFmode))) \
1309 goto ADDR; \
1310 else if (GET_CODE (X) == LABEL_REF \
1311 || (GET_CODE (X) == CONST_INT \
1312 && INT_5_BITS (X))) \
1313 goto ADDR; \
1314 /* Needed for -fPIC */ \
1315 else if (GET_CODE (X) == LO_SUM \
1316 && GET_CODE (XEXP (X, 0)) == REG \
1317 && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
1318 && GET_CODE (XEXP (X, 1)) == UNSPEC) \
1319 goto ADDR; \
1322 /* Look for machine dependent ways to make the invalid address AD a
1323 valid address.
1325 For the PA, transform:
1327 memory(X + <large int>)
1329 into:
1331 if (<large int> & mask) >= 16
1332 Y = (<large int> & ~mask) + mask + 1 Round up.
1333 else
1334 Y = (<large int> & ~mask) Round down.
1335 Z = X + Y
1336 memory (Z + (<large int> - Y));
1338 This makes reload inheritance and reload_cse work better since Z
1339 can be reused.
1341 There may be more opportunities to improve code with this hook. */
1342 #define LEGITIMIZE_RELOAD_ADDRESS(AD, MODE, OPNUM, TYPE, IND, WIN) \
1343 do { \
1344 int offset, newoffset, mask; \
1345 rtx new, temp = NULL_RTX; \
1347 mask = (GET_MODE_CLASS (MODE) == MODE_FLOAT \
1348 ? (TARGET_PA_20 ? 0x3fff : 0x1f) : 0x3fff); \
1350 if (optimize \
1351 && GET_CODE (AD) == PLUS) \
1352 temp = simplify_binary_operation (PLUS, Pmode, \
1353 XEXP (AD, 0), XEXP (AD, 1)); \
1355 new = temp ? temp : AD; \
1357 if (optimize \
1358 && GET_CODE (new) == PLUS \
1359 && GET_CODE (XEXP (new, 0)) == REG \
1360 && GET_CODE (XEXP (new, 1)) == CONST_INT) \
1362 offset = INTVAL (XEXP ((new), 1)); \
1364 /* Choose rounding direction. Round up if we are >= halfway. */ \
1365 if ((offset & mask) >= ((mask + 1) / 2)) \
1366 newoffset = (offset & ~mask) + mask + 1; \
1367 else \
1368 newoffset = offset & ~mask; \
1370 if (newoffset != 0 \
1371 && VAL_14_BITS_P (newoffset)) \
1374 temp = gen_rtx_PLUS (Pmode, XEXP (new, 0), \
1375 GEN_INT (newoffset)); \
1376 AD = gen_rtx_PLUS (Pmode, temp, GEN_INT (offset - newoffset));\
1377 push_reload (XEXP (AD, 0), 0, &XEXP (AD, 0), 0, \
1378 BASE_REG_CLASS, Pmode, VOIDmode, 0, 0, \
1379 (OPNUM), (TYPE)); \
1380 goto WIN; \
1383 } while (0)
1388 /* Try machine-dependent ways of modifying an illegitimate address
1389 to be legitimate. If we find one, return the new, valid address.
1390 This macro is used in only one place: `memory_address' in explow.c.
1392 OLDX is the address as it was before break_out_memory_refs was called.
1393 In some cases it is useful to look at this to decide what needs to be done.
1395 MODE and WIN are passed so that this macro can use
1396 GO_IF_LEGITIMATE_ADDRESS.
1398 It is always safe for this macro to do nothing. It exists to recognize
1399 opportunities to optimize the output. */
1401 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
1402 { rtx orig_x = (X); \
1403 (X) = hppa_legitimize_address (X, OLDX, MODE); \
1404 if ((X) != orig_x && memory_address_p (MODE, X)) \
1405 goto WIN; }
1407 /* Go to LABEL if ADDR (a legitimate address expression)
1408 has an effect that depends on the machine mode it is used for. */
1410 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1411 if (GET_CODE (ADDR) == PRE_DEC \
1412 || GET_CODE (ADDR) == POST_DEC \
1413 || GET_CODE (ADDR) == PRE_INC \
1414 || GET_CODE (ADDR) == POST_INC) \
1415 goto LABEL
1417 /* Arghh. The hpux10 linker chokes if we have a reference to symbols
1418 in a readonly data section when the symbol is defined in a shared
1419 library. Since we can't know at compile time if a symbol will be
1420 satisfied by a shared library or main program we put any symbolic
1421 constant into the normal data section. */
1422 #define SELECT_RTX_SECTION(MODE,RTX) \
1423 if (symbolic_operand (RTX, MODE)) \
1424 data_section (); \
1425 else \
1426 readonly_data_section ();
1428 /* On hpux10, the linker will give an error if we have a reference
1429 in the read-only data section to a symbol defined in a shared
1430 library. Therefore, expressions that might require a reloc can
1431 not be placed in the read-only data section. */
1432 #define SELECT_SECTION(EXP,RELOC) \
1433 if (TREE_CODE (EXP) == VAR_DECL \
1434 && TREE_READONLY (EXP) \
1435 && !TREE_THIS_VOLATILE (EXP) \
1436 && DECL_INITIAL (EXP) \
1437 && (DECL_INITIAL (EXP) == error_mark_node \
1438 || TREE_CONSTANT (DECL_INITIAL (EXP))) \
1439 && !RELOC) \
1440 readonly_data_section (); \
1441 else if (TREE_CODE_CLASS (TREE_CODE (EXP)) == 'c' \
1442 && !(TREE_CODE (EXP) == STRING_CST && flag_writable_strings) \
1443 && !RELOC) \
1444 readonly_data_section (); \
1445 else \
1446 data_section ();
1448 /* Define this macro if references to a symbol must be treated
1449 differently depending on something about the variable or
1450 function named by the symbol (such as what section it is in).
1452 The macro definition, if any, is executed immediately after the
1453 rtl for DECL or other node is created.
1454 The value of the rtl will be a `mem' whose address is a
1455 `symbol_ref'.
1457 The usual thing for this macro to do is to a flag in the
1458 `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
1459 name string in the `symbol_ref' (if one bit is not enough
1460 information).
1462 On the HP-PA we use this to indicate if a symbol is in text or
1463 data space. Also, function labels need special treatment. */
1465 #define TEXT_SPACE_P(DECL)\
1466 (TREE_CODE (DECL) == FUNCTION_DECL \
1467 || (TREE_CODE (DECL) == VAR_DECL \
1468 && TREE_READONLY (DECL) && ! TREE_SIDE_EFFECTS (DECL) \
1469 && (! DECL_INITIAL (DECL) || ! reloc_needed (DECL_INITIAL (DECL))) \
1470 && !flag_pic) \
1471 || (TREE_CODE_CLASS (TREE_CODE (DECL)) == 'c' \
1472 && !(TREE_CODE (DECL) == STRING_CST && flag_writable_strings)))
1474 #define FUNCTION_NAME_P(NAME) \
1475 (*(NAME) == '@' || (*(NAME) == '*' && *((NAME) + 1) == '@'))
1477 #define ENCODE_SECTION_INFO(DECL)\
1478 do \
1479 { if (TEXT_SPACE_P (DECL)) \
1480 { rtx _rtl; \
1481 if (TREE_CODE (DECL) == FUNCTION_DECL \
1482 || TREE_CODE (DECL) == VAR_DECL) \
1483 _rtl = DECL_RTL (DECL); \
1484 else \
1485 _rtl = TREE_CST_RTL (DECL); \
1486 SYMBOL_REF_FLAG (XEXP (_rtl, 0)) = 1; \
1487 if (TREE_CODE (DECL) == FUNCTION_DECL) \
1488 hppa_encode_label (XEXP (DECL_RTL (DECL), 0), 0);\
1491 while (0)
1493 /* Store the user-specified part of SYMBOL_NAME in VAR.
1494 This is sort of inverse to ENCODE_SECTION_INFO. */
1496 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
1497 (VAR) = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*' ? \
1498 1 + (SYMBOL_NAME)[1] == '@'\
1499 : (SYMBOL_NAME)[0] == '@'))
1501 /* Specify the machine mode that this machine uses
1502 for the index in the tablejump instruction. */
1503 #define CASE_VECTOR_MODE (TARGET_BIG_SWITCH ? TImode : DImode)
1505 /* Jump tables must be 32 bit aligned, no matter the size of the element. */
1506 #define ADDR_VEC_ALIGN(ADDR_VEC) 2
1508 /* Specify the tree operation to be used to convert reals to integers. */
1509 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1511 /* This is the kind of divide that is easiest to do in the general case. */
1512 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1514 /* Define this as 1 if `char' should by default be signed; else as 0. */
1515 #define DEFAULT_SIGNED_CHAR 1
1517 /* Max number of bytes we can move from memory to memory
1518 in one reasonably fast instruction. */
1519 #define MOVE_MAX 8
1521 /* Higher than the default as we prefer to use simple move insns
1522 (better scheduling and delay slot filling) and because our
1523 built-in block move is really a 2X unrolled loop.
1525 Believe it or not, this has to be big enough to allow for copying all
1526 arguments passed in registers to avoid infinite recursion during argument
1527 setup for a function call. Why? Consider how we copy the stack slots
1528 reserved for parameters when they may be trashed by a call. */
1529 #define MOVE_RATIO (TARGET_64BIT ? 8 : 4)
1531 /* Define if operations between registers always perform the operation
1532 on the full register even if a narrower mode is specified. */
1533 #define WORD_REGISTER_OPERATIONS
1535 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
1536 will either zero-extend or sign-extend. The value of this macro should
1537 be the code that says which one of the two operations is implicitly
1538 done, NIL if none. */
1539 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
1541 /* Nonzero if access to memory by bytes is slow and undesirable. */
1542 #define SLOW_BYTE_ACCESS 1
1544 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1545 is done just by pretending it is already truncated. */
1546 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1548 /* We assume that the store-condition-codes instructions store 0 for false
1549 and some other value for true. This is the value stored for true. */
1551 #define STORE_FLAG_VALUE 1
1553 /* When a prototype says `char' or `short', really pass an `int'. */
1554 #define PROMOTE_PROTOTYPES 1
1555 #define PROMOTE_FUNCTION_RETURN 1
1557 /* Specify the machine mode that pointers have.
1558 After generation of rtl, the compiler makes no further distinction
1559 between pointers and any other objects of this machine mode. */
1560 #define Pmode word_mode
1562 /* Add any extra modes needed to represent the condition code.
1564 HPPA floating comparisons produce condition codes. */
1565 #define EXTRA_CC_MODES CC(CCFPmode, "CCFP")
1567 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
1568 return the mode to be used for the comparison. For floating-point, CCFPmode
1569 should be used. CC_NOOVmode should be used when the first operand is a
1570 PLUS, MINUS, or NEG. CCmode should be used when no special processing is
1571 needed. */
1572 #define SELECT_CC_MODE(OP,X,Y) \
1573 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT ? CCFPmode : CCmode) \
1575 /* A function address in a call instruction
1576 is a byte address (for indexing purposes)
1577 so give the MEM rtx a byte's mode. */
1578 #define FUNCTION_MODE SImode
1580 /* Define this if addresses of constant functions
1581 shouldn't be put through pseudo regs where they can be cse'd.
1582 Desirable on machines where ordinary constants are expensive
1583 but a CALL with constant address is cheap. */
1584 #define NO_FUNCTION_CSE
1586 /* Define this to be nonzero if shift instructions ignore all but the low-order
1587 few bits. */
1588 #define SHIFT_COUNT_TRUNCATED 1
1590 /* Compute the cost of computing a constant rtl expression RTX
1591 whose rtx-code is CODE. The body of this macro is a portion
1592 of a switch statement. If the code is computed here,
1593 return it with a return statement. Otherwise, break from the switch. */
1595 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1596 case CONST_INT: \
1597 if (INTVAL (RTX) == 0) return 0; \
1598 if (INT_14_BITS (RTX)) return 1; \
1599 case HIGH: \
1600 return 2; \
1601 case CONST: \
1602 case LABEL_REF: \
1603 case SYMBOL_REF: \
1604 return 4; \
1605 case CONST_DOUBLE: \
1606 if ((RTX == CONST0_RTX (DFmode) || RTX == CONST0_RTX (SFmode)) \
1607 && OUTER_CODE != SET) \
1608 return 0; \
1609 else \
1610 return 8;
1612 #define ADDRESS_COST(RTX) \
1613 (GET_CODE (RTX) == REG ? 1 : hppa_address_cost (RTX))
1615 /* Compute extra cost of moving data between one register class
1616 and another.
1618 Make moves from SAR so expensive they should never happen. We used to
1619 have 0xffff here, but that generates overflow in rare cases.
1621 Copies involving a FP register and a non-FP register are relatively
1622 expensive because they must go through memory.
1624 Other copies are reasonably cheap. */
1625 #define REGISTER_MOVE_COST(CLASS1, CLASS2) \
1626 (CLASS1 == SHIFT_REGS ? 0x100 \
1627 : FP_REG_CLASS_P (CLASS1) && ! FP_REG_CLASS_P (CLASS2) ? 16 \
1628 : FP_REG_CLASS_P (CLASS2) && ! FP_REG_CLASS_P (CLASS1) ? 16 \
1629 : 2)
1632 /* Provide the costs of a rtl expression. This is in the body of a
1633 switch on CODE. The purpose for the cost of MULT is to encourage
1634 `synth_mult' to find a synthetic multiply when reasonable. */
1636 #define RTX_COSTS(X,CODE,OUTER_CODE) \
1637 case MULT: \
1638 if (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
1639 return COSTS_N_INSNS (3); \
1640 return (TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT) \
1641 ? COSTS_N_INSNS (8) : COSTS_N_INSNS (20); \
1642 case DIV: \
1643 if (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
1644 return COSTS_N_INSNS (14); \
1645 case UDIV: \
1646 case MOD: \
1647 case UMOD: \
1648 return COSTS_N_INSNS (60); \
1649 case PLUS: /* this includes shNadd insns */ \
1650 case MINUS: \
1651 if (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
1652 return COSTS_N_INSNS (3); \
1653 return COSTS_N_INSNS (1); \
1654 case ASHIFT: \
1655 case ASHIFTRT: \
1656 case LSHIFTRT: \
1657 return COSTS_N_INSNS (1);
1659 /* Adjust the cost of branches. */
1660 #define BRANCH_COST (pa_cpu == PROCESSOR_8000 ? 2 : 1)
1662 /* Adjust the cost of dependencies. */
1664 #define ADJUST_COST(INSN,LINK,DEP,COST) \
1665 (COST) = pa_adjust_cost (INSN, LINK, DEP, COST)
1667 /* Adjust scheduling priorities. We use this to try and keep addil
1668 and the next use of %r1 close together. */
1669 #define ADJUST_PRIORITY(PREV) \
1671 rtx set = single_set (PREV); \
1672 rtx src, dest; \
1673 if (set) \
1675 src = SET_SRC (set); \
1676 dest = SET_DEST (set); \
1677 if (GET_CODE (src) == LO_SUM \
1678 && symbolic_operand (XEXP (src, 1), VOIDmode) \
1679 && ! read_only_operand (XEXP (src, 1), VOIDmode)) \
1680 INSN_PRIORITY (PREV) >>= 3; \
1681 else if (GET_CODE (src) == MEM \
1682 && GET_CODE (XEXP (src, 0)) == LO_SUM \
1683 && symbolic_operand (XEXP (XEXP (src, 0), 1), VOIDmode)\
1684 && ! read_only_operand (XEXP (XEXP (src, 0), 1), VOIDmode))\
1685 INSN_PRIORITY (PREV) >>= 1; \
1686 else if (GET_CODE (dest) == MEM \
1687 && GET_CODE (XEXP (dest, 0)) == LO_SUM \
1688 && symbolic_operand (XEXP (XEXP (dest, 0), 1), VOIDmode)\
1689 && ! read_only_operand (XEXP (XEXP (dest, 0), 1), VOIDmode))\
1690 INSN_PRIORITY (PREV) >>= 3; \
1694 /* Handling the special cases is going to get too complicated for a macro,
1695 just call `pa_adjust_insn_length' to do the real work. */
1696 #define ADJUST_INSN_LENGTH(INSN, LENGTH) \
1697 LENGTH += pa_adjust_insn_length (INSN, LENGTH);
1699 /* Millicode insns are actually function calls with some special
1700 constraints on arguments and register usage.
1702 Millicode calls always expect their arguments in the integer argument
1703 registers, and always return their result in %r29 (ret1). They
1704 are expected to clobber their arguments, %r1, %r29, and %r31 and
1705 nothing else.
1707 This macro tells reorg that the references to arguments and
1708 millicode calls do not appear to happen until after the millicode call.
1709 This allows reorg to put insns which set the argument registers into the
1710 delay slot of the millicode call -- thus they act more like traditional
1711 CALL_INSNs.
1713 Note we can not consider side effects of the insn to be delayed because
1714 the branch and link insn will clobber the return pointer. If we happened
1715 to use the return pointer in the delay slot of the call, then we lose.
1717 get_attr_type will try to recognize the given insn, so make sure to
1718 filter out things it will not accept -- SEQUENCE, USE and CLOBBER insns
1719 in particular. */
1720 #define INSN_REFERENCES_ARE_DELAYED(X) (insn_refs_are_delayed (X))
1723 /* Control the assembler format that we output. */
1725 /* Output to assembler file text saying following lines
1726 may contain character constants, extra white space, comments, etc. */
1728 #define ASM_APP_ON ""
1730 /* Output to assembler file text saying following lines
1731 no longer contain unusual constructs. */
1733 #define ASM_APP_OFF ""
1735 /* This is how to output the definition of a user-level label named NAME,
1736 such as the label on a static function or variable NAME. */
1738 #define ASM_OUTPUT_LABEL(FILE, NAME) \
1739 do { assemble_name (FILE, NAME); \
1740 fputc ('\n', FILE); } while (0)
1742 /* This is how to output a reference to a user-level label named NAME.
1743 `assemble_name' uses this. */
1745 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
1746 fprintf ((FILE), "%s", (NAME) + (FUNCTION_NAME_P (NAME) ? 1 : 0))
1748 /* This is how to output an internal numbered label where
1749 PREFIX is the class of label and NUM is the number within the class. */
1751 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1752 {fprintf (FILE, "%c$%s%04d\n", (PREFIX)[0], (PREFIX) + 1, NUM);}
1754 /* This is how to store into the string LABEL
1755 the symbol_ref name of an internal numbered label where
1756 PREFIX is the class of label and NUM is the number within the class.
1757 This is suitable for output with `assemble_name'. */
1759 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1760 sprintf (LABEL, "*%c$%s%04d", (PREFIX)[0], (PREFIX) + 1, NUM)
1762 /* This is how to output an assembler line defining a `double' constant. */
1764 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
1765 do { long l[2]; \
1766 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
1767 fprintf (FILE, "\t.word 0x%lx\n\t.word 0x%lx\n", l[0], l[1]); \
1768 } while (0)
1770 /* This is how to output an assembler line defining a `float' constant. */
1772 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
1773 do { long l; \
1774 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
1775 fprintf (FILE, "\t.word 0x%lx\n", l); \
1776 } while (0)
1778 /* This is how to output an assembler line defining an `int' constant.
1780 This is made more complicated by the fact that functions must be
1781 prefixed by a P% as well as code label references for the exception
1782 table -- otherwise the linker chokes. */
1784 #define ASM_OUTPUT_INT(FILE,VALUE) \
1785 { fputs ("\t.word ", FILE); \
1786 if (function_label_operand (VALUE, VOIDmode)) \
1787 fputs ("P%", FILE); \
1788 output_addr_const (FILE, (VALUE)); \
1789 fputs ("\n", FILE);}
1791 /* Likewise for `short' and `char' constants. */
1793 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
1794 ( fputs ("\t.half ", FILE), \
1795 output_addr_const (FILE, (VALUE)), \
1796 fputs ("\n", FILE))
1798 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
1799 ( fputs ("\t.byte ", FILE), \
1800 output_addr_const (FILE, (VALUE)), \
1801 fputs ("\n", FILE))
1803 /* This is how to output an assembler line for a numeric constant byte. */
1805 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
1806 fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1808 #define ASM_GLOBALIZE_LABEL(FILE, NAME) \
1809 do { \
1810 /* We only handle DATA objects here, functions are globalized in \
1811 ASM_DECLARE_FUNCTION_NAME. */ \
1812 if (! FUNCTION_NAME_P (NAME)) \
1814 fputs ("\t.EXPORT ", FILE); \
1815 assemble_name (FILE, NAME); \
1816 fputs (",DATA\n", FILE); \
1818 } while (0)
1820 #define ASM_OUTPUT_ASCII(FILE, P, SIZE) \
1821 output_ascii ((FILE), (P), (SIZE))
1823 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)
1824 #define ASM_OUTPUT_REG_POP(FILE,REGNO)
1825 /* This is how to output an element of a case-vector that is absolute.
1826 Note that this method makes filling these branch delay slots
1827 impossible. */
1829 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1830 if (TARGET_BIG_SWITCH) \
1831 fprintf (FILE, "\tstw %%r1,-16(%%r30)\n\tldil LR'L$%04d,%%r1\n\tbe RR'L$%04d(%%sr4,%%r1)\n\tldw -16(%%r30),%%r1\n", VALUE, VALUE); \
1832 else \
1833 fprintf (FILE, "\tb L$%04d\n\tnop\n", VALUE)
1835 /* Jump tables are executable code and live in the TEXT section on the PA. */
1836 #define JUMP_TABLES_IN_TEXT_SECTION 1
1838 /* This is how to output an element of a case-vector that is relative.
1839 This must be defined correctly as it is used when generating PIC code.
1841 I believe it safe to use the same definition as ASM_OUTPUT_ADDR_VEC_ELT
1842 on the PA since ASM_OUTPUT_ADDR_VEC_ELT uses pc-relative jump instructions
1843 rather than a table of absolute addresses. */
1845 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1846 if (TARGET_BIG_SWITCH) \
1847 fprintf (FILE, "\tstw %%r1,-16(%%r30)\n\tldw T'L$%04d(%%r19),%%r1\n\tbv %%r0(%%r1)\n\tldw -16(%%r30),%%r1\n", VALUE); \
1848 else \
1849 fprintf (FILE, "\tb L$%04d\n\tnop\n", VALUE)
1851 /* This is how to output an assembler line
1852 that says to advance the location counter
1853 to a multiple of 2**LOG bytes. */
1855 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1856 fprintf (FILE, "\t.align %d\n", (1<<(LOG)))
1858 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1859 fprintf (FILE, "\t.blockz %d\n", (SIZE))
1861 /* This says how to output an assembler line to define a global common symbol
1862 with size SIZE (in bytes) and alignment ALIGN (in bits). */
1864 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGNED) \
1865 { bss_section (); \
1866 assemble_name ((FILE), (NAME)); \
1867 fputs ("\t.comm ", (FILE)); \
1868 fprintf ((FILE), "%d\n", MAX ((SIZE), ((ALIGNED) / BITS_PER_UNIT)));}
1870 /* This says how to output an assembler line to define a local common symbol
1871 with size SIZE (in bytes) and alignment ALIGN (in bits). */
1873 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGNED) \
1874 { bss_section (); \
1875 fprintf ((FILE), "\t.align %d\n", ((ALIGNED) / BITS_PER_UNIT)); \
1876 assemble_name ((FILE), (NAME)); \
1877 fprintf ((FILE), "\n\t.block %d\n", (SIZE));}
1879 /* Store in OUTPUT a string (made with alloca) containing
1880 an assembler-name for a local static variable named NAME.
1881 LABELNO is an integer which is different for each call. */
1883 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1884 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
1885 sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
1887 /* Define the parentheses used to group arithmetic operations
1888 in assembler code. */
1890 #define ASM_OPEN_PAREN "("
1891 #define ASM_CLOSE_PAREN ")"
1893 /* All HP assemblers use "!" to separate logical lines. */
1894 #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '!')
1896 /* Define results of standard character escape sequences. */
1897 #define TARGET_BELL 007
1898 #define TARGET_BS 010
1899 #define TARGET_TAB 011
1900 #define TARGET_NEWLINE 012
1901 #define TARGET_VT 013
1902 #define TARGET_FF 014
1903 #define TARGET_CR 015
1905 #define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
1906 ((CHAR) == '@' || (CHAR) == '#' || (CHAR) == '*' || (CHAR) == '^')
1908 /* Print operand X (an rtx) in assembler syntax to file FILE.
1909 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1910 For `%' followed by punctuation, CODE is the punctuation and X is null.
1912 On the HP-PA, the CODE can be `r', meaning this is a register-only operand
1913 and an immediate zero should be represented as `r0'.
1915 Several % codes are defined:
1916 O an operation
1917 C compare conditions
1918 N extract conditions
1919 M modifier to handle preincrement addressing for memory refs.
1920 F modifier to handle preincrement addressing for fp memory refs */
1922 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
1925 /* Print a memory address as an operand to reference that memory location. */
1927 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1928 { register rtx addr = ADDR; \
1929 register rtx base; \
1930 int offset; \
1931 switch (GET_CODE (addr)) \
1933 case REG: \
1934 fprintf (FILE, "0(%s)", reg_names [REGNO (addr)]); \
1935 break; \
1936 case PLUS: \
1937 if (GET_CODE (XEXP (addr, 0)) == CONST_INT) \
1938 offset = INTVAL (XEXP (addr, 0)), base = XEXP (addr, 1); \
1939 else if (GET_CODE (XEXP (addr, 1)) == CONST_INT) \
1940 offset = INTVAL (XEXP (addr, 1)), base = XEXP (addr, 0); \
1941 else \
1942 abort (); \
1943 fprintf (FILE, "%d(%s)", offset, reg_names [REGNO (base)]); \
1944 break; \
1945 case LO_SUM: \
1946 if (!symbolic_operand (XEXP (addr, 1), VOIDmode)) \
1947 fputs ("R'", FILE); \
1948 else if (flag_pic == 0) \
1949 fputs ("RR'", FILE); \
1950 else if (flag_pic == 1) \
1951 abort (); \
1952 else if (flag_pic == 2) \
1953 fputs ("RT'", FILE); \
1954 output_global_address (FILE, XEXP (addr, 1), 0); \
1955 fputs ("(", FILE); \
1956 output_operand (XEXP (addr, 0), 0); \
1957 fputs (")", FILE); \
1958 break; \
1959 case CONST_INT: \
1960 fprintf (FILE, "%d(%%r0)", INTVAL (addr)); \
1961 break; \
1962 default: \
1963 output_addr_const (FILE, addr); \
1967 /* Find the return address associated with the frame given by
1968 FRAMEADDR. */
1969 #define RETURN_ADDR_RTX(COUNT, FRAMEADDR) \
1970 (return_addr_rtx (COUNT, FRAMEADDR))
1972 /* Used to mask out junk bits from the return address, such as
1973 processor state, interrupt status, condition codes and the like. */
1974 #define MASK_RETURN_ADDR \
1975 /* The privilege level is in the two low order bits, mask em out \
1976 of the return address. */ \
1977 (GEN_INT (-4))
1979 /* The number of Pmode words for the setjmp buffer. */
1980 #define JMP_BUF_SIZE 50
1982 /* Only direct calls to static functions are allowed to be sibling (tail)
1983 call optimized.
1985 This restriction is necessary because some linker generated stubs will
1986 store return pointers into rp' in some cases which might clobber a
1987 live value already in rp'.
1989 In a sibcall the current function and the target function share stack
1990 space. Thus if the path to the current function and the path to the
1991 target function save a value in rp', they save the value into the
1992 same stack slot, which has undesirable consequences.
1994 Because of the deferred binding nature of shared libraries any function
1995 with external scope could be in a different load module and thus require
1996 rp' to be saved when calling that function. So sibcall optimizations
1997 can only be safe for static function.
1999 Note that GCC never needs return value relocations, so we don't have to
2000 worry about static calls with return value relocations (which require
2001 saving rp').
2003 It is safe to perform a sibcall optimization when the target function
2004 will never return. */
2005 #define FUNCTION_OK_FOR_SIBCALL(DECL) \
2006 (DECL \
2007 && ! TARGET_64BIT \
2008 && (! TREE_PUBLIC (DECL) \
2009 || TREE_THIS_VOLATILE (DECL)))
2011 #define PREDICATE_CODES \
2012 {"reg_or_0_operand", {SUBREG, REG, CONST_INT}}, \
2013 {"call_operand_address", {LABEL_REF, SYMBOL_REF, CONST_INT, \
2014 CONST_DOUBLE, CONST, HIGH, CONSTANT_P_RTX}}, \
2015 {"symbolic_operand", {SYMBOL_REF, LABEL_REF, CONST}}, \
2016 {"symbolic_memory_operand", {SUBREG, MEM}}, \
2017 {"reg_or_nonsymb_mem_operand", {SUBREG, REG, MEM}}, \
2018 {"reg_or_0_or_nonsymb_mem_operand", {SUBREG, REG, MEM, CONST_INT, \
2019 CONST_DOUBLE}}, \
2020 {"move_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT, MEM}}, \
2021 {"reg_or_cint_move_operand", {SUBREG, REG, CONST_INT}}, \
2022 {"pic_label_operand", {LABEL_REF, CONST}}, \
2023 {"fp_reg_operand", {REG}}, \
2024 {"arith_operand", {SUBREG, REG, CONST_INT}}, \
2025 {"arith11_operand", {SUBREG, REG, CONST_INT}}, \
2026 {"pre_cint_operand", {CONST_INT}}, \
2027 {"post_cint_operand", {CONST_INT}}, \
2028 {"arith_double_operand", {SUBREG, REG, CONST_DOUBLE}}, \
2029 {"ireg_or_int5_operand", {CONST_INT, REG}}, \
2030 {"int5_operand", {CONST_INT}}, \
2031 {"uint5_operand", {CONST_INT}}, \
2032 {"int11_operand", {CONST_INT}}, \
2033 {"uint32_operand", {CONST_INT, \
2034 HOST_BITS_PER_WIDE_INT > 32 ? 0 : CONST_DOUBLE}}, \
2035 {"arith5_operand", {SUBREG, REG, CONST_INT}}, \
2036 {"and_operand", {SUBREG, REG, CONST_INT}}, \
2037 {"ior_operand", {CONST_INT}}, \
2038 {"lhs_lshift_cint_operand", {CONST_INT}}, \
2039 {"lhs_lshift_operand", {SUBREG, REG, CONST_INT}}, \
2040 {"arith32_operand", {SUBREG, REG, CONST_INT}}, \
2041 {"pc_or_label_operand", {PC, LABEL_REF}}, \
2042 {"plus_xor_ior_operator", {PLUS, XOR, IOR}}, \
2043 {"shadd_operand", {CONST_INT}}, \
2044 {"basereg_operand", {REG}}, \
2045 {"div_operand", {REG, CONST_INT}}, \
2046 {"ireg_operand", {REG}}, \
2047 {"movb_comparison_operator", {EQ, NE, LT, GE}},