* tm.texi (REGISTER_MOVE_COST): Add a mode argument.
[official-gcc.git] / gcc / config / pa / pa.h
blobad8643c7748cdded68bef7274fd307638dbd0959
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 2001 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\t"
238 #define ASM_STABN_OP "\t.stabn\t"
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 /* This macro defines command-line switches that modify the default
330 target name.
332 The definition is be an initializer for an array of structures. Each
333 array element has have three elements: the switch name, one of the
334 enumeration codes ADD or DELETE to indicate whether the string should be
335 inserted or deleted, and the string to be inserted or deleted. */
336 #define MODIFY_TARGET_NAME {{"-32", DELETE, "64"}, {"-64", ADD, "64"}}
338 /* Make gcc agree with <machine/ansi.h> */
340 #define SIZE_TYPE "unsigned int"
341 #define PTRDIFF_TYPE "int"
342 #define WCHAR_TYPE "unsigned int"
343 #define WCHAR_TYPE_SIZE 32
345 /* Show we can debug even without a frame pointer. */
346 #define CAN_DEBUG_WITHOUT_FP
348 /* Machine dependent reorg pass. */
349 #define MACHINE_DEPENDENT_REORG(X) pa_reorg(X)
351 /* Names to predefine in the preprocessor for this target machine. */
353 #define CPP_PREDEFINES "-Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -Dunix -Dhp9000 -Dhp800 -Dspectrum -DREVARGV -Asystem=unix -Asystem=bsd -Acpu=hppa -Amachine=hppa"
355 /* target machine storage layout */
357 /* Define for cross-compilation from a host with a different float format
358 or endianness (e.g. VAX, x86). */
359 #define REAL_ARITHMETIC
361 /* Define this macro if it is advisable to hold scalars in registers
362 in a wider mode than that declared by the program. In such cases,
363 the value is constrained to be within the bounds of the declared
364 type, but kept valid in the wider mode. The signedness of the
365 extension may differ from that of the type. */
367 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
368 if (GET_MODE_CLASS (MODE) == MODE_INT \
369 && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
370 (MODE) = word_mode;
372 /* Define this if most significant bit is lowest numbered
373 in instructions that operate on numbered bit-fields. */
374 #define BITS_BIG_ENDIAN 1
376 /* Define this if most significant byte of a word is the lowest numbered. */
377 /* That is true on the HP-PA. */
378 #define BYTES_BIG_ENDIAN 1
380 /* Define this if most significant word of a multiword number is lowest
381 numbered. */
382 #define WORDS_BIG_ENDIAN 1
384 /* number of bits in an addressable storage unit */
385 #define BITS_PER_UNIT 8
387 /* Width in bits of a "word", which is the contents of a machine register.
388 Note that this is not necessarily the width of data type `int';
389 if using 16-bit ints on a 68000, this would still be 32.
390 But on a machine with 16-bit registers, this would be 16. */
391 #define BITS_PER_WORD (TARGET_64BIT ? 64 : 32)
392 #define MAX_BITS_PER_WORD 64
393 #define MAX_LONG_TYPE_SIZE 64
394 #define MAX_WCHAR_TYPE_SIZE 32
396 /* Width of a word, in units (bytes). */
397 #define UNITS_PER_WORD (TARGET_64BIT ? 8 : 4)
398 #define MIN_UNITS_PER_WORD 4
400 /* Width in bits of a pointer.
401 See also the macro `Pmode' defined below. */
402 #define POINTER_SIZE BITS_PER_WORD
404 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
405 #define PARM_BOUNDARY BITS_PER_WORD
407 /* Largest alignment required for any stack parameter, in bits.
408 Don't define this if it is equal to PARM_BOUNDARY */
409 #define MAX_PARM_BOUNDARY 64
411 /* Boundary (in *bits*) on which stack pointer is always aligned;
412 certain optimizations in combine depend on this.
414 GCC for the PA always rounds its stacks to a 512bit boundary,
415 but that happens late in the compilation process. */
416 #define STACK_BOUNDARY (TARGET_64BIT ? 128 : 64)
418 /* Allocation boundary (in *bits*) for the code of a function. */
419 #define FUNCTION_BOUNDARY (TARGET_64BIT ? 64 : 32)
421 /* Alignment of field after `int : 0' in a structure. */
422 #define EMPTY_FIELD_BOUNDARY 32
424 /* Every structure's size must be a multiple of this. */
425 #define STRUCTURE_SIZE_BOUNDARY 8
427 /* A bitfield declared as `int' forces `int' alignment for the struct. */
428 #define PCC_BITFIELD_TYPE_MATTERS 1
430 /* No data type wants to be aligned rounder than this. */
431 #define BIGGEST_ALIGNMENT 64
433 /* Get around hp-ux assembler bug, and make strcpy of constants fast. */
434 #define CONSTANT_ALIGNMENT(CODE, TYPEALIGN) \
435 ((TYPEALIGN) < 32 ? 32 : (TYPEALIGN))
437 /* Make arrays of chars word-aligned for the same reasons. */
438 #define DATA_ALIGNMENT(TYPE, ALIGN) \
439 (TREE_CODE (TYPE) == ARRAY_TYPE \
440 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
441 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
444 /* Set this nonzero if move instructions will actually fail to work
445 when given unaligned data. */
446 #define STRICT_ALIGNMENT 1
448 /* Generate calls to memcpy, memcmp and memset. */
449 #define TARGET_MEM_FUNCTIONS
451 /* Value is 1 if it is a good idea to tie two pseudo registers
452 when one has mode MODE1 and one has mode MODE2.
453 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
454 for any hard reg, then this must be 0 for correct output. */
455 #define MODES_TIEABLE_P(MODE1, MODE2) \
456 (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
458 /* Specify the registers used for certain standard purposes.
459 The values of these macros are register numbers. */
461 /* The HP-PA pc isn't overloaded on a register that the compiler knows about. */
462 /* #define PC_REGNUM */
464 /* Register to use for pushing function arguments. */
465 #define STACK_POINTER_REGNUM 30
467 /* Base register for access to local variables of the function. */
468 #define FRAME_POINTER_REGNUM 3
470 /* Value should be nonzero if functions must have frame pointers. */
471 #define FRAME_POINTER_REQUIRED \
472 (current_function_calls_alloca)
474 /* C statement to store the difference between the frame pointer
475 and the stack pointer values immediately after the function prologue.
477 Note, we always pretend that this is a leaf function because if
478 it's not, there's no point in trying to eliminate the
479 frame pointer. If it is a leaf function, we guessed right! */
480 #define INITIAL_FRAME_POINTER_OFFSET(VAR) \
481 do {(VAR) = - compute_frame_size (get_frame_size (), 0);} while (0)
483 /* Base register for access to arguments of the function. */
484 #define ARG_POINTER_REGNUM 3
486 /* Register in which static-chain is passed to a function. */
487 #define STATIC_CHAIN_REGNUM 29
489 /* Register which holds offset table for position-independent
490 data references. */
492 #define PIC_OFFSET_TABLE_REGNUM (TARGET_64BIT ? 27 : 19)
493 #define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED 1
495 /* Register into which we save the PIC_OFFEST_TABLE_REGNUM so that it
496 can be restore across function calls. */
497 #define PIC_OFFSET_TABLE_REGNUM_SAVED 4
499 #define DEFAULT_PCC_STRUCT_RETURN 0
501 /* SOM ABI says that objects larger than 64 bits are returned in memory.
502 PA64 ABI says that objects larger than 128 bits are returned in memory. */
503 #define RETURN_IN_MEMORY(TYPE) \
504 (TARGET_64BIT ? int_size_in_bytes (TYPE) > 16 : int_size_in_bytes (TYPE) > 8)
506 /* Register in which address to store a structure value
507 is passed to a function. */
508 #define STRUCT_VALUE_REGNUM 28
510 /* The letters I, J, K, L and M in a register constraint string
511 can be used to stand for particular ranges of immediate operands.
512 This macro defines what the ranges are.
513 C is the letter, and VALUE is a constant value.
514 Return 1 if VALUE is in the range specified by C.
516 `I' is used for the 11 bit constants.
517 `J' is used for the 14 bit constants.
518 `K' is used for values that can be moved with a zdepi insn.
519 `L' is used for the 5 bit constants.
520 `M' is used for 0.
521 `N' is used for values with the least significant 11 bits equal to zero
522 and when sign extended from 32 to 64 bits the
523 value does not change.
524 `O' is used for numbers n such that n+1 is a power of 2.
527 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
528 ((C) == 'I' ? VAL_11_BITS_P (VALUE) \
529 : (C) == 'J' ? VAL_14_BITS_P (VALUE) \
530 : (C) == 'K' ? zdepi_cint_p (VALUE) \
531 : (C) == 'L' ? VAL_5_BITS_P (VALUE) \
532 : (C) == 'M' ? (VALUE) == 0 \
533 : (C) == 'N' ? (((VALUE) & (unsigned long)0x7ff) == 0 \
534 && (VALUE) == ((((VALUE) & 0xffffffff) ^ (~0x7fffffff)) \
535 + 0x80000000)) \
536 : (C) == 'O' ? (((VALUE) & ((VALUE) + (long)1)) == 0) \
537 : (C) == 'P' ? and_mask_p (VALUE) \
538 : 0)
540 /* Similar, but for floating or large integer constants, and defining letters
541 G and H. Here VALUE is the CONST_DOUBLE rtx itself.
543 For PA, `G' is the floating-point constant zero. `H' is undefined. */
545 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
546 ((C) == 'G' ? (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \
547 && (VALUE) == CONST0_RTX (GET_MODE (VALUE))) \
548 : 0)
550 /* The class value for index registers, and the one for base regs. */
551 #define INDEX_REG_CLASS GENERAL_REGS
552 #define BASE_REG_CLASS GENERAL_REGS
554 #define FP_REG_CLASS_P(CLASS) \
555 ((CLASS) == FP_REGS || (CLASS) == FPUPPER_REGS)
557 /* True if register is floating-point. */
558 #define FP_REGNO_P(N) ((N) >= FP_REG_FIRST && (N) <= FP_REG_LAST)
560 /* Given an rtx X being reloaded into a reg required to be
561 in class CLASS, return the class of reg to actually use.
562 In general this is just CLASS; but on some machines
563 in some cases it is preferable to use a more restrictive class. */
564 #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
566 /* Return the register class of a scratch register needed to copy IN into
567 or out of a register in CLASS in MODE. If it can be done directly
568 NO_REGS is returned.
570 Avoid doing any work for the common case calls. */
572 #define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
573 ((CLASS == BASE_REG_CLASS && GET_CODE (IN) == REG \
574 && REGNO (IN) < FIRST_PSEUDO_REGISTER) \
575 ? NO_REGS : secondary_reload_class (CLASS, MODE, IN))
577 /* On the PA it is not possible to directly move data between
578 GENERAL_REGS and FP_REGS. */
579 #define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \
580 (FP_REG_CLASS_P (CLASS1) != FP_REG_CLASS_P (CLASS2))
582 /* Return the stack location to use for secondary memory needed reloads. */
583 #define SECONDARY_MEMORY_NEEDED_RTX(MODE) \
584 gen_rtx_MEM (MODE, gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (-16)))
587 /* Stack layout; function entry, exit and calling. */
589 /* Define this if pushing a word on the stack
590 makes the stack pointer a smaller address. */
591 /* #define STACK_GROWS_DOWNWARD */
593 /* Believe it or not. */
594 #define ARGS_GROW_DOWNWARD
596 /* Define this if the nominal address of the stack frame
597 is at the high-address end of the local variables;
598 that is, each additional local variable allocated
599 goes at a more negative offset in the frame. */
600 /* #define FRAME_GROWS_DOWNWARD */
602 /* Offset within stack frame to start allocating local variables at.
603 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
604 first local allocated. Otherwise, it is the offset to the BEGINNING
605 of the first local allocated. */
606 #define STARTING_FRAME_OFFSET 8
608 /* If we generate an insn to push BYTES bytes,
609 this says how many the stack pointer really advances by.
610 On the HP-PA, don't define this because there are no push insns. */
611 /* #define PUSH_ROUNDING(BYTES) */
613 /* Offset of first parameter from the argument pointer register value.
614 This value will be negated because the arguments grow down.
615 Also note that on STACK_GROWS_UPWARD machines (such as this one)
616 this is the distance from the frame pointer to the end of the first
617 argument, not it's beginning. To get the real offset of the first
618 argument, the size of the argument must be added. */
620 #define FIRST_PARM_OFFSET(FNDECL) (TARGET_64BIT ? -64 : -32)
622 /* When a parameter is passed in a register, stack space is still
623 allocated for it. */
624 #define REG_PARM_STACK_SPACE(DECL) (TARGET_64BIT ? 64 : 16)
626 /* Define this if the above stack space is to be considered part of the
627 space allocated by the caller. */
628 #define OUTGOING_REG_PARM_STACK_SPACE
630 /* Keep the stack pointer constant throughout the function.
631 This is both an optimization and a necessity: longjmp
632 doesn't behave itself when the stack pointer moves within
633 the function! */
634 #define ACCUMULATE_OUTGOING_ARGS 1
636 /* The weird HPPA calling conventions require a minimum of 48 bytes on
637 the stack: 16 bytes for register saves, and 32 bytes for magic.
638 This is the difference between the logical top of stack and the
639 actual sp. */
640 #define STACK_POINTER_OFFSET \
641 (TARGET_64BIT ? -(current_function_outgoing_args_size + 16): -32)
643 #define STACK_DYNAMIC_OFFSET(FNDECL) \
644 (TARGET_64BIT \
645 ? (STACK_POINTER_OFFSET) \
646 : ((STACK_POINTER_OFFSET) - current_function_outgoing_args_size))
648 /* Value is 1 if returning from a function call automatically
649 pops the arguments described by the number-of-args field in the call.
650 FUNDECL is the declaration node of the function (as a tree),
651 FUNTYPE is the data type of the function (as a tree),
652 or for a library call it is an identifier node for the subroutine name. */
654 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
656 /* Define how to find the value returned by a function.
657 VALTYPE is the data type of the value (as a tree).
658 If the precise function being called is known, FUNC is its FUNCTION_DECL;
659 otherwise, FUNC is 0. */
661 /* On the HP-PA the value is found in register(s) 28(-29), unless
662 the mode is SF or DF. Then the value is returned in fr4 (32, ) */
664 /* This must perform the same promotions as PROMOTE_MODE, else
665 PROMOTE_FUNCTION_RETURN will not work correctly. */
666 #define FUNCTION_VALUE(VALTYPE, FUNC) \
667 gen_rtx_REG (((INTEGRAL_TYPE_P (VALTYPE) \
668 && TYPE_PRECISION (VALTYPE) < BITS_PER_WORD) \
669 || POINTER_TYPE_P (VALTYPE)) \
670 ? word_mode : TYPE_MODE (VALTYPE), \
671 TREE_CODE (VALTYPE) == REAL_TYPE && !TARGET_SOFT_FLOAT ? 32 : 28)
673 /* Define how to find the value returned by a library function
674 assuming the value has mode MODE. */
676 #define LIBCALL_VALUE(MODE) \
677 gen_rtx_REG (MODE, \
678 (! TARGET_SOFT_FLOAT \
679 && ((MODE) == SFmode || (MODE) == DFmode) ? 32 : 28))
681 /* 1 if N is a possible register number for a function value
682 as seen by the caller. */
684 #define FUNCTION_VALUE_REGNO_P(N) \
685 ((N) == 28 || (! TARGET_SOFT_FLOAT && (N) == 32))
688 /* Define a data type for recording info about an argument list
689 during the scan of that argument list. This data type should
690 hold all necessary information about the function itself
691 and about the args processed so far, enough to enable macros
692 such as FUNCTION_ARG to determine where the next arg should go.
694 On the HP-PA, this is a single integer, which is a number of words
695 of arguments scanned so far (including the invisible argument,
696 if any, which holds the structure-value-address).
697 Thus 4 or more means all following args should go on the stack. */
699 struct hppa_args {int words, nargs_prototype, indirect; };
701 #define CUMULATIVE_ARGS struct hppa_args
703 /* Initialize a variable CUM of type CUMULATIVE_ARGS
704 for a call to a function whose data type is FNTYPE.
705 For a library call, FNTYPE is 0. */
707 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
708 (CUM).words = 0, \
709 (CUM).indirect = INDIRECT, \
710 (CUM).nargs_prototype = (FNTYPE && TYPE_ARG_TYPES (FNTYPE) \
711 ? (list_length (TYPE_ARG_TYPES (FNTYPE)) - 1 \
712 + (TYPE_MODE (TREE_TYPE (FNTYPE)) == BLKmode \
713 || RETURN_IN_MEMORY (TREE_TYPE (FNTYPE)))) \
714 : 0)
718 /* Similar, but when scanning the definition of a procedure. We always
719 set NARGS_PROTOTYPE large so we never return a PARALLEL. */
721 #define INIT_CUMULATIVE_INCOMING_ARGS(CUM,FNTYPE,IGNORE) \
722 (CUM).words = 0, \
723 (CUM).indirect = 0, \
724 (CUM).nargs_prototype = 1000
726 /* Figure out the size in words of the function argument. */
728 #define FUNCTION_ARG_SIZE(MODE, TYPE) \
729 ((((MODE) != BLKmode \
730 ? GET_MODE_SIZE (MODE) \
731 : int_size_in_bytes (TYPE)) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
733 /* Update the data in CUM to advance over an argument
734 of mode MODE and data type TYPE.
735 (TYPE is null for libcalls where that information may not be available.) */
737 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
738 { (CUM).nargs_prototype--; \
739 (CUM).words += FUNCTION_ARG_SIZE(MODE, TYPE) \
740 + (((CUM).words & 01) && (TYPE) != 0 \
741 && FUNCTION_ARG_SIZE(MODE, TYPE) > 1); \
744 /* Determine where to put an argument to a function.
745 Value is zero to push the argument on the stack,
746 or a hard register in which to store the argument.
748 MODE is the argument's machine mode.
749 TYPE is the data type of the argument (as a tree).
750 This is null for libcalls where that information may
751 not be available.
752 CUM is a variable of type CUMULATIVE_ARGS which gives info about
753 the preceding args and about the function being called.
754 NAMED is nonzero if this argument is a named parameter
755 (otherwise it is an extra parameter matching an ellipsis).
757 On the HP-PA the first four words of args are normally in registers
758 and the rest are pushed. But any arg that won't entirely fit in regs
759 is pushed.
761 Arguments passed in registers are either 1 or 2 words long.
763 The caller must make a distinction between calls to explicitly named
764 functions and calls through pointers to functions -- the conventions
765 are different! Calls through pointers to functions only use general
766 registers for the first four argument words.
768 Of course all this is different for the portable runtime model
769 HP wants everyone to use for ELF. Ugh. Here's a quick description
770 of how it's supposed to work.
772 1) callee side remains unchanged. It expects integer args to be
773 in the integer registers, float args in the float registers and
774 unnamed args in integer registers.
776 2) caller side now depends on if the function being called has
777 a prototype in scope (rather than if it's being called indirectly).
779 2a) If there is a prototype in scope, then arguments are passed
780 according to their type (ints in integer registers, floats in float
781 registers, unnamed args in integer registers.
783 2b) If there is no prototype in scope, then floating point arguments
784 are passed in both integer and float registers. egad.
786 FYI: The portable parameter passing conventions are almost exactly like
787 the standard parameter passing conventions on the RS6000. That's why
788 you'll see lots of similar code in rs6000.h. */
790 #define FUNCTION_ARG_PADDING(MODE, TYPE) function_arg_padding ((MODE), (TYPE))
792 /* Do not expect to understand this without reading it several times. I'm
793 tempted to try and simply it, but I worry about breaking something. */
795 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
796 function_arg (&CUM, MODE, TYPE, NAMED, 0)
798 #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
799 function_arg (&CUM, MODE, TYPE, NAMED, 1)
801 /* For an arg passed partly in registers and partly in memory,
802 this is the number of registers used.
803 For args passed entirely in registers or entirely in memory, zero. */
805 /* For PA32 there are never split arguments. PA64, on the other hand, can
806 pass arguments partially in registers and partially in memory. */
807 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
808 (TARGET_64BIT ? function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED) : 0)
810 /* If defined, a C expression that gives the alignment boundary, in
811 bits, of an argument with the specified mode and type. If it is
812 not defined, `PARM_BOUNDARY' is used for all arguments. */
814 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
815 (((TYPE) != 0) \
816 ? ((integer_zerop (TYPE_SIZE (TYPE)) \
817 || ! TREE_CONSTANT (TYPE_SIZE (TYPE))) \
818 ? BITS_PER_UNIT \
819 : (((int_size_in_bytes (TYPE)) + UNITS_PER_WORD - 1) \
820 / UNITS_PER_WORD) * BITS_PER_WORD) \
821 : ((GET_MODE_ALIGNMENT(MODE) <= PARM_BOUNDARY) \
822 ? PARM_BOUNDARY : GET_MODE_ALIGNMENT(MODE)))
824 /* Arguments larger than eight bytes are passed by invisible reference */
826 /* PA64 does not pass anything by invisible reference. */
827 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
828 (TARGET_64BIT \
829 ? 0 \
830 : (((TYPE) && int_size_in_bytes (TYPE) > 8) \
831 || ((MODE) && GET_MODE_SIZE (MODE) > 8)))
833 /* PA64 does not pass anything by invisible reference.
834 This should be undef'ed for 64bit, but we'll see if this works. The
835 problem is that we can't test TARGET_64BIT from the preprocessor. */
836 #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \
837 (TARGET_64BIT \
838 ? 0 \
839 : (((TYPE) && int_size_in_bytes (TYPE) > 8) \
840 || ((MODE) && GET_MODE_SIZE (MODE) > 8)))
843 extern struct rtx_def *hppa_compare_op0, *hppa_compare_op1;
844 extern enum cmp_type hppa_branch_type;
846 #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
847 { const char *target_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0); \
848 STRIP_NAME_ENCODING (target_name, target_name); \
849 output_function_prologue (FILE, 0); \
850 if (VAL_14_BITS_P (DELTA)) \
851 fprintf (FILE, "\tb %s\n\tldo %d(%%r26),%%r26\n", target_name, DELTA); \
852 else \
853 fprintf (FILE, "\taddil L%%%d,%%r26\n\tb %s\n\tldo R%%%d(%%r1),%%r26\n", \
854 DELTA, target_name, DELTA); \
855 fprintf (FILE, "\n\t.EXIT\n\t.PROCEND\n"); \
858 /* This macro generates the assembly code for function entry.
859 FILE is a stdio stream to output the code to.
860 SIZE is an int: how many units of temporary storage to allocate.
861 Refer to the array `regs_ever_live' to determine which registers
862 to save; `regs_ever_live[I]' is nonzero if register number I
863 is ever used in the function. This macro is responsible for
864 knowing which registers should not be saved even if used. */
866 /* On HP-PA, move-double insns between fpu and cpu need an 8-byte block
867 of memory. If any fpu reg is used in the function, we allocate
868 such a block here, at the bottom of the frame, just in case it's needed.
870 If this function is a leaf procedure, then we may choose not
871 to do a "save" insn. The decision about whether or not
872 to do this is made in regclass.c. */
874 #define FUNCTION_PROLOGUE(FILE, SIZE) \
875 output_function_prologue (FILE, SIZE)
877 /* Output assembler code to FILE to increment profiler label # LABELNO
878 for profiling a function entry.
880 Because HPUX _mcount is so different, we actually emit the
881 profiling code in function_prologue. This just stores LABELNO for
882 that. */
884 #define PROFILE_BEFORE_PROLOGUE
885 #define FUNCTION_PROFILER(FILE, LABELNO) \
886 { extern int hp_profile_labelno; hp_profile_labelno = (LABELNO);}
888 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
889 the stack pointer does not matter. The value is tested only in
890 functions that have frame pointers.
891 No definition is equivalent to always zero. */
893 extern int may_call_alloca;
895 #define EXIT_IGNORE_STACK \
896 (get_frame_size () != 0 \
897 || current_function_calls_alloca || current_function_outgoing_args_size)
900 /* This macro generates the assembly code for function exit,
901 on machines that need it. If FUNCTION_EPILOGUE is not defined
902 then individual return instructions are generated for each
903 return statement. Args are same as for FUNCTION_PROLOGUE.
905 The function epilogue should not depend on the current stack pointer!
906 It should use the frame pointer only. This is mandatory because
907 of alloca; we also take advantage of it to omit stack adjustments
908 before returning. */
910 #define FUNCTION_EPILOGUE(FILE, SIZE) \
911 output_function_epilogue (FILE, SIZE)
913 /* Output assembler code for a block containing the constant parts
914 of a trampoline, leaving space for the variable parts.\
916 The trampoline sets the static chain pointer to STATIC_CHAIN_REGNUM
917 and then branches to the specified routine.
919 This code template is copied from text segment to stack location
920 and then patched with INITIALIZE_TRAMPOLINE to contain
921 valid values, and then entered as a subroutine.
923 It is best to keep this as small as possible to avoid having to
924 flush multiple lines in the cache. */
926 #define TRAMPOLINE_TEMPLATE(FILE) \
928 if (! TARGET_64BIT) \
930 fputs ("\tldw 36(%r22),%r21\n", FILE); \
931 fputs ("\tbb,>=,n %r21,30,.+16\n", FILE); \
932 if (ASSEMBLER_DIALECT == 0) \
933 fputs ("\tdepi 0,31,2,%r21\n", FILE); \
934 else \
935 fputs ("\tdepwi 0,31,2,%r21\n", FILE); \
936 fputs ("\tldw 4(%r21),%r19\n", FILE); \
937 fputs ("\tldw 0(%r21),%r21\n", FILE); \
938 fputs ("\tldsid (%r21),%r1\n", FILE); \
939 fputs ("\tmtsp %r1,%sr0\n", FILE); \
940 fputs ("\tbe 0(%sr0,%r21)\n", FILE); \
941 fputs ("\tldw 40(%r22),%r29\n", FILE); \
942 fputs ("\t.word 0\n", FILE); \
943 fputs ("\t.word 0\n", FILE); \
945 else \
947 fputs ("\t.dword 0\n", FILE); \
948 fputs ("\t.dword 0\n", FILE); \
949 fputs ("\t.dword 0\n", FILE); \
950 fputs ("\t.dword 0\n", FILE); \
951 fputs ("\tmfia %r31\n", FILE); \
952 fputs ("\tldd 24(%r31),%r1\n", FILE); \
953 fputs ("\tldd 24(%r1),%r27\n", FILE); \
954 fputs ("\tldd 16(%r1),%r1\n", FILE); \
955 fputs ("\tbve (%r1)\n", FILE); \
956 fputs ("\tldd 32(%r31),%r31\n", FILE); \
957 fputs ("\t.dword 0 ; fptr\n", FILE); \
958 fputs ("\t.dword 0 ; static link\n", FILE); \
962 /* Length in units of the trampoline for entering a nested function.
964 Flush the cache entries corresponding to the first and last addresses
965 of the trampoline. This is necessary as the trampoline may cross two
966 cache lines.
968 If the code part of the trampoline ever grows to > 32 bytes, then it
969 will become necessary to hack on the cacheflush pattern in pa.md. */
971 #define TRAMPOLINE_SIZE (TARGET_64BIT ? 72 : 11 * 4)
973 /* Emit RTL insns to initialize the variable parts of a trampoline.
974 FNADDR is an RTX for the address of the function's pure code.
975 CXT is an RTX for the static chain value for the function.
977 Move the function address to the trampoline template at offset 12.
978 Move the static chain value to trampoline template at offset 16. */
980 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
982 if (! TARGET_64BIT) \
984 rtx start_addr, end_addr; \
986 start_addr = memory_address (Pmode, plus_constant ((TRAMP), 36)); \
987 emit_move_insn (gen_rtx_MEM (Pmode, start_addr), (FNADDR)); \
988 start_addr = memory_address (Pmode, plus_constant ((TRAMP), 40)); \
989 emit_move_insn (gen_rtx_MEM (Pmode, start_addr), (CXT)); \
990 /* fdc and fic only use registers for the address to flush, \
991 they do not accept integer displacements. */ \
992 start_addr = force_reg (Pmode, (TRAMP)); \
993 end_addr = force_reg (Pmode, plus_constant ((TRAMP), 32)); \
994 emit_insn (gen_dcacheflush (start_addr, end_addr)); \
995 end_addr = force_reg (Pmode, plus_constant (start_addr, 32)); \
996 emit_insn (gen_icacheflush (start_addr, end_addr, start_addr, \
997 gen_reg_rtx (Pmode), gen_reg_rtx (Pmode)));\
999 else \
1001 rtx start_addr, end_addr; \
1003 start_addr = memory_address (Pmode, plus_constant ((TRAMP), 56)); \
1004 emit_move_insn (gen_rtx_MEM (Pmode, start_addr), (FNADDR)); \
1005 start_addr = memory_address (Pmode, plus_constant ((TRAMP), 64)); \
1006 emit_move_insn (gen_rtx_MEM (Pmode, start_addr), (CXT)); \
1007 /* Create a fat pointer for the trampoline. */ \
1008 end_addr = force_reg (Pmode, plus_constant ((TRAMP), 32)); \
1009 start_addr = memory_address (Pmode, plus_constant ((TRAMP), 16)); \
1010 emit_move_insn (gen_rtx_MEM (Pmode, start_addr), end_addr); \
1011 end_addr = gen_rtx_REG (Pmode, 27); \
1012 start_addr = memory_address (Pmode, plus_constant ((TRAMP), 24)); \
1013 emit_move_insn (gen_rtx_MEM (Pmode, start_addr), end_addr); \
1014 /* fdc and fic only use registers for the address to flush, \
1015 they do not accept integer displacements. */ \
1016 start_addr = force_reg (Pmode, (TRAMP)); \
1017 end_addr = force_reg (Pmode, plus_constant ((TRAMP), 32)); \
1018 emit_insn (gen_dcacheflush (start_addr, end_addr)); \
1019 end_addr = force_reg (Pmode, plus_constant (start_addr, 32)); \
1020 emit_insn (gen_icacheflush (start_addr, end_addr, start_addr, \
1021 gen_reg_rtx (Pmode), gen_reg_rtx (Pmode)));\
1025 /* Emit code for a call to builtin_saveregs. We must emit USE insns which
1026 reference the 4 integer arg registers and 4 fp arg registers.
1027 Ordinarily they are not call used registers, but they are for
1028 _builtin_saveregs, so we must make this explicit. */
1030 #define EXPAND_BUILTIN_SAVEREGS() hppa_builtin_saveregs ()
1032 /* Implement `va_start' for varargs and stdarg. */
1034 #define EXPAND_BUILTIN_VA_START(stdarg, valist, nextarg) \
1035 hppa_va_start (stdarg, valist, nextarg)
1037 /* Implement `va_arg'. */
1039 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
1040 hppa_va_arg (valist, type)
1042 /* Addressing modes, and classification of registers for them.
1044 Using autoincrement addressing modes on PA8000 class machines is
1045 not profitable. */
1047 #define HAVE_POST_INCREMENT (pa_cpu < PROCESSOR_8000)
1048 #define HAVE_POST_DECREMENT (pa_cpu < PROCESSOR_8000)
1050 #define HAVE_PRE_DECREMENT (pa_cpu < PROCESSOR_8000)
1051 #define HAVE_PRE_INCREMENT (pa_cpu < PROCESSOR_8000)
1053 /* Macros to check register numbers against specific register classes. */
1055 /* These assume that REGNO is a hard or pseudo reg number.
1056 They give nonzero only if REGNO is a hard reg of the suitable class
1057 or a pseudo reg currently allocated to a suitable hard reg.
1058 Since they use reg_renumber, they are safe only once reg_renumber
1059 has been allocated, which happens in local-alloc.c. */
1061 #define REGNO_OK_FOR_INDEX_P(REGNO) \
1062 ((REGNO) && ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32))
1063 #define REGNO_OK_FOR_BASE_P(REGNO) \
1064 ((REGNO) && ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32))
1065 #define REGNO_OK_FOR_FP_P(REGNO) \
1066 (FP_REGNO_P (REGNO) || FP_REGNO_P (reg_renumber[REGNO]))
1068 /* Now macros that check whether X is a register and also,
1069 strictly, whether it is in a specified class.
1071 These macros are specific to the HP-PA, and may be used only
1072 in code for printing assembler insns and in conditions for
1073 define_optimization. */
1075 /* 1 if X is an fp register. */
1077 #define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
1079 /* Maximum number of registers that can appear in a valid memory address. */
1081 #define MAX_REGS_PER_ADDRESS 2
1083 /* Recognize any constant value that is a valid address except
1084 for symbolic addresses. We get better CSE by rejecting them
1085 here and allowing hppa_legitimize_address to break them up. We
1086 use most of the constants accepted by CONSTANT_P, except CONST_DOUBLE. */
1088 #define CONSTANT_ADDRESS_P(X) \
1089 ((GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1090 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
1091 || GET_CODE (X) == HIGH) \
1092 && (reload_in_progress || reload_completed || ! symbolic_expression_p (X)))
1094 /* Include all constant integers and constant doubles, but not
1095 floating-point, except for floating-point zero.
1097 Reject LABEL_REFs if we're not using gas or the new HP assembler.
1099 ?!? For now also reject CONST_DOUBLES in 64bit mode. This will need
1100 further work. */
1101 #ifdef NEW_HP_ASSEMBLER
1102 #define LEGITIMATE_CONSTANT_P(X) \
1103 ((GET_MODE_CLASS (GET_MODE (X)) != MODE_FLOAT \
1104 || (X) == CONST0_RTX (GET_MODE (X))) \
1105 && !(TARGET_64BIT && GET_CODE (X) == CONST_DOUBLE) \
1106 && !(TARGET_64BIT && GET_CODE (X) == CONST_INT \
1107 && !(cint_ok_for_move (INTVAL (X)) \
1108 || ((INTVAL (X) & 0xffffffff80000000L) == 0xffffffff80000000L) \
1109 || ((INTVAL (X) & 0xffffffff00000000L) == 0x0000000000000000L))) \
1110 && !function_label_operand (X, VOIDmode))
1111 #else
1112 #define LEGITIMATE_CONSTANT_P(X) \
1113 ((GET_MODE_CLASS (GET_MODE (X)) != MODE_FLOAT \
1114 || (X) == CONST0_RTX (GET_MODE (X))) \
1115 && (GET_CODE (X) != LABEL_REF || TARGET_GAS)\
1116 && !(TARGET_64BIT && GET_CODE (X) == CONST_DOUBLE) \
1117 && !(TARGET_64BIT && GET_CODE (X) == CONST_INT \
1118 && !(cint_ok_for_move (INTVAL (X)) \
1119 || ((INTVAL (X) & 0xffffffff80000000L) == 0xffffffff80000000L) \
1120 || ((INTVAL (X) & 0xffffffff00000000L) == 0x0000000000000000L))) \
1121 && !function_label_operand (X, VOIDmode))
1122 #endif
1124 /* Subroutine for EXTRA_CONSTRAINT.
1126 Return 1 iff OP is a pseudo which did not get a hard register and
1127 we are running the reload pass. */
1129 #define IS_RELOADING_PSEUDO_P(OP) \
1130 ((reload_in_progress \
1131 && GET_CODE (OP) == REG \
1132 && REGNO (OP) >= FIRST_PSEUDO_REGISTER \
1133 && reg_renumber [REGNO (OP)] < 0))
1135 /* Optional extra constraints for this machine. Borrowed from sparc.h.
1137 For the HPPA, `Q' means that this is a memory operand but not a
1138 symbolic memory operand. Note that an unassigned pseudo register
1139 is such a memory operand. Needed because reload will generate
1140 these things in insns and then not re-recognize the insns, causing
1141 constrain_operands to fail.
1143 `R' is used for scaled indexed addresses.
1145 `S' is the constant 31.
1147 `T' is for fp loads and stores. */
1148 #define EXTRA_CONSTRAINT(OP, C) \
1149 ((C) == 'Q' ? \
1150 (IS_RELOADING_PSEUDO_P (OP) \
1151 || (GET_CODE (OP) == MEM \
1152 && (memory_address_p (GET_MODE (OP), XEXP (OP, 0))\
1153 || reload_in_progress) \
1154 && ! symbolic_memory_operand (OP, VOIDmode) \
1155 && !(GET_CODE (XEXP (OP, 0)) == PLUS \
1156 && (GET_CODE (XEXP (XEXP (OP, 0), 0)) == MULT\
1157 || GET_CODE (XEXP (XEXP (OP, 0), 1)) == MULT))))\
1158 : ((C) == 'R' ? \
1159 (GET_CODE (OP) == MEM \
1160 && GET_CODE (XEXP (OP, 0)) == PLUS \
1161 && (GET_CODE (XEXP (XEXP (OP, 0), 0)) == MULT \
1162 || GET_CODE (XEXP (XEXP (OP, 0), 1)) == MULT) \
1163 && (move_operand (OP, GET_MODE (OP)) \
1164 || memory_address_p (GET_MODE (OP), XEXP (OP, 0))\
1165 || reload_in_progress)) \
1166 : ((C) == 'T' ? \
1167 (GET_CODE (OP) == MEM \
1168 /* Using DFmode forces only short displacements \
1169 to be recognized as valid in reg+d addresses. \
1170 However, this is not necessary for PA2.0 since\
1171 it has long FP loads/stores. */ \
1172 && memory_address_p ((TARGET_PA_20 \
1173 ? GET_MODE (OP) \
1174 : DFmode), \
1175 XEXP (OP, 0)) \
1176 && !(GET_CODE (XEXP (OP, 0)) == PLUS \
1177 && (GET_CODE (XEXP (XEXP (OP, 0), 0)) == MULT\
1178 || GET_CODE (XEXP (XEXP (OP, 0), 1)) == MULT)))\
1179 : ((C) == 'U' ? \
1180 (GET_CODE (OP) == CONST_INT && INTVAL (OP) == 63) \
1181 : ((C) == 'S' ? \
1182 (GET_CODE (OP) == CONST_INT && INTVAL (OP) == 31) : 0)))))
1185 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1186 and check its validity for a certain class.
1187 We have two alternate definitions for each of them.
1188 The usual definition accepts all pseudo regs; the other rejects
1189 them unless they have been allocated suitable hard regs.
1190 The symbol REG_OK_STRICT causes the latter definition to be used.
1192 Most source files want to accept pseudo regs in the hope that
1193 they will get allocated to the class that the insn wants them to be in.
1194 Source files for reload pass need to be strict.
1195 After reload, it makes no difference, since pseudo regs have
1196 been eliminated by then. */
1198 #ifndef REG_OK_STRICT
1200 /* Nonzero if X is a hard reg that can be used as an index
1201 or if it is a pseudo reg. */
1202 #define REG_OK_FOR_INDEX_P(X) \
1203 (REGNO (X) && (REGNO (X) < 32 || REGNO (X) >= FIRST_PSEUDO_REGISTER))
1204 /* Nonzero if X is a hard reg that can be used as a base reg
1205 or if it is a pseudo reg. */
1206 #define REG_OK_FOR_BASE_P(X) \
1207 (REGNO (X) && (REGNO (X) < 32 || REGNO (X) >= FIRST_PSEUDO_REGISTER))
1209 #else
1211 /* Nonzero if X is a hard reg that can be used as an index. */
1212 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1213 /* Nonzero if X is a hard reg that can be used as a base reg. */
1214 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1216 #endif
1218 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1219 that is a valid memory address for an instruction.
1220 The MODE argument is the machine mode for the MEM expression
1221 that wants to use this address.
1223 On the HP-PA, the actual legitimate addresses must be
1224 REG+REG, REG+(REG*SCALE) or REG+SMALLINT.
1225 But we can treat a SYMBOL_REF as legitimate if it is part of this
1226 function's constant-pool, because such addresses can actually
1227 be output as REG+SMALLINT.
1229 Note we only allow 5 bit immediates for access to a constant address;
1230 doing so avoids losing for loading/storing a FP register at an address
1231 which will not fit in 5 bits. */
1233 #define VAL_5_BITS_P(X) ((unsigned HOST_WIDE_INT)(X) + 0x10 < 0x20)
1234 #define INT_5_BITS(X) VAL_5_BITS_P (INTVAL (X))
1236 #define VAL_U5_BITS_P(X) ((unsigned HOST_WIDE_INT)(X) < 0x20)
1237 #define INT_U5_BITS(X) VAL_U5_BITS_P (INTVAL (X))
1239 #define VAL_11_BITS_P(X) ((unsigned HOST_WIDE_INT)(X) + 0x400 < 0x800)
1240 #define INT_11_BITS(X) VAL_11_BITS_P (INTVAL (X))
1242 #define VAL_14_BITS_P(X) ((unsigned HOST_WIDE_INT)(X) + 0x2000 < 0x4000)
1243 #define INT_14_BITS(X) VAL_14_BITS_P (INTVAL (X))
1245 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1247 if ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \
1248 || ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_DEC \
1249 || GET_CODE (X) == PRE_INC || GET_CODE (X) == POST_INC) \
1250 && REG_P (XEXP (X, 0)) \
1251 && REG_OK_FOR_BASE_P (XEXP (X, 0)))) \
1252 goto ADDR; \
1253 else if (GET_CODE (X) == PLUS) \
1255 rtx base = 0, index = 0; \
1256 if (flag_pic && XEXP (X, 0) == pic_offset_table_rtx)\
1258 if (GET_CODE (XEXP (X, 1)) == REG \
1259 && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
1260 goto ADDR; \
1261 else if (flag_pic == 1 \
1262 && GET_CODE (XEXP (X, 1)) == SYMBOL_REF)\
1263 goto ADDR; \
1265 else if (REG_P (XEXP (X, 0)) \
1266 && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
1267 base = XEXP (X, 0), index = XEXP (X, 1); \
1268 else if (REG_P (XEXP (X, 1)) \
1269 && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
1270 base = XEXP (X, 1), index = XEXP (X, 0); \
1271 if (base != 0) \
1272 if (GET_CODE (index) == CONST_INT \
1273 && ((INT_14_BITS (index) \
1274 && (TARGET_SOFT_FLOAT \
1275 || (TARGET_PA_20 \
1276 && ((MODE == SFmode \
1277 && (INTVAL (index) % 4) == 0)\
1278 || (MODE == DFmode \
1279 && (INTVAL (index) % 8) == 0)))\
1280 || ((MODE) != SFmode && (MODE) != DFmode))) \
1281 || INT_5_BITS (index))) \
1282 goto ADDR; \
1283 if (! TARGET_SOFT_FLOAT \
1284 && ! TARGET_DISABLE_INDEXING \
1285 && base \
1286 && (mode == SFmode || mode == DFmode) \
1287 && GET_CODE (index) == MULT \
1288 && GET_CODE (XEXP (index, 0)) == REG \
1289 && REG_OK_FOR_BASE_P (XEXP (index, 0)) \
1290 && GET_CODE (XEXP (index, 1)) == CONST_INT \
1291 && INTVAL (XEXP (index, 1)) == (mode == SFmode ? 4 : 8))\
1292 goto ADDR; \
1294 else if (GET_CODE (X) == LO_SUM \
1295 && GET_CODE (XEXP (X, 0)) == REG \
1296 && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
1297 && CONSTANT_P (XEXP (X, 1)) \
1298 && (TARGET_SOFT_FLOAT \
1299 /* We can allow symbolic LO_SUM addresses\
1300 for PA2.0. */ \
1301 || (TARGET_PA_20 \
1302 && GET_CODE (XEXP (X, 1)) != CONST_INT)\
1303 || ((MODE) != SFmode \
1304 && (MODE) != DFmode))) \
1305 goto ADDR; \
1306 else if (GET_CODE (X) == LO_SUM \
1307 && GET_CODE (XEXP (X, 0)) == SUBREG \
1308 && GET_CODE (SUBREG_REG (XEXP (X, 0))) == REG\
1309 && REG_OK_FOR_BASE_P (SUBREG_REG (XEXP (X, 0)))\
1310 && CONSTANT_P (XEXP (X, 1)) \
1311 && (TARGET_SOFT_FLOAT \
1312 /* We can allow symbolic LO_SUM addresses\
1313 for PA2.0. */ \
1314 || (TARGET_PA_20 \
1315 && GET_CODE (XEXP (X, 1)) != CONST_INT)\
1316 || ((MODE) != SFmode \
1317 && (MODE) != DFmode))) \
1318 goto ADDR; \
1319 else if (GET_CODE (X) == LABEL_REF \
1320 || (GET_CODE (X) == CONST_INT \
1321 && INT_5_BITS (X))) \
1322 goto ADDR; \
1323 /* Needed for -fPIC */ \
1324 else if (GET_CODE (X) == LO_SUM \
1325 && GET_CODE (XEXP (X, 0)) == REG \
1326 && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
1327 && GET_CODE (XEXP (X, 1)) == UNSPEC) \
1328 goto ADDR; \
1331 /* Look for machine dependent ways to make the invalid address AD a
1332 valid address.
1334 For the PA, transform:
1336 memory(X + <large int>)
1338 into:
1340 if (<large int> & mask) >= 16
1341 Y = (<large int> & ~mask) + mask + 1 Round up.
1342 else
1343 Y = (<large int> & ~mask) Round down.
1344 Z = X + Y
1345 memory (Z + (<large int> - Y));
1347 This makes reload inheritance and reload_cse work better since Z
1348 can be reused.
1350 There may be more opportunities to improve code with this hook. */
1351 #define LEGITIMIZE_RELOAD_ADDRESS(AD, MODE, OPNUM, TYPE, IND, WIN) \
1352 do { \
1353 int offset, newoffset, mask; \
1354 rtx new, temp = NULL_RTX; \
1356 mask = (GET_MODE_CLASS (MODE) == MODE_FLOAT \
1357 ? (TARGET_PA_20 ? 0x3fff : 0x1f) : 0x3fff); \
1359 if (optimize \
1360 && GET_CODE (AD) == PLUS) \
1361 temp = simplify_binary_operation (PLUS, Pmode, \
1362 XEXP (AD, 0), XEXP (AD, 1)); \
1364 new = temp ? temp : AD; \
1366 if (optimize \
1367 && GET_CODE (new) == PLUS \
1368 && GET_CODE (XEXP (new, 0)) == REG \
1369 && GET_CODE (XEXP (new, 1)) == CONST_INT) \
1371 offset = INTVAL (XEXP ((new), 1)); \
1373 /* Choose rounding direction. Round up if we are >= halfway. */ \
1374 if ((offset & mask) >= ((mask + 1) / 2)) \
1375 newoffset = (offset & ~mask) + mask + 1; \
1376 else \
1377 newoffset = offset & ~mask; \
1379 if (newoffset != 0 \
1380 && VAL_14_BITS_P (newoffset)) \
1383 temp = gen_rtx_PLUS (Pmode, XEXP (new, 0), \
1384 GEN_INT (newoffset)); \
1385 AD = gen_rtx_PLUS (Pmode, temp, GEN_INT (offset - newoffset));\
1386 push_reload (XEXP (AD, 0), 0, &XEXP (AD, 0), 0, \
1387 BASE_REG_CLASS, Pmode, VOIDmode, 0, 0, \
1388 (OPNUM), (TYPE)); \
1389 goto WIN; \
1392 } while (0)
1397 /* Try machine-dependent ways of modifying an illegitimate address
1398 to be legitimate. If we find one, return the new, valid address.
1399 This macro is used in only one place: `memory_address' in explow.c.
1401 OLDX is the address as it was before break_out_memory_refs was called.
1402 In some cases it is useful to look at this to decide what needs to be done.
1404 MODE and WIN are passed so that this macro can use
1405 GO_IF_LEGITIMATE_ADDRESS.
1407 It is always safe for this macro to do nothing. It exists to recognize
1408 opportunities to optimize the output. */
1410 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
1411 { rtx orig_x = (X); \
1412 (X) = hppa_legitimize_address (X, OLDX, MODE); \
1413 if ((X) != orig_x && memory_address_p (MODE, X)) \
1414 goto WIN; }
1416 /* Go to LABEL if ADDR (a legitimate address expression)
1417 has an effect that depends on the machine mode it is used for. */
1419 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1420 if (GET_CODE (ADDR) == PRE_DEC \
1421 || GET_CODE (ADDR) == POST_DEC \
1422 || GET_CODE (ADDR) == PRE_INC \
1423 || GET_CODE (ADDR) == POST_INC) \
1424 goto LABEL
1426 /* Arghh. The hpux10 linker chokes if we have a reference to symbols
1427 in a readonly data section when the symbol is defined in a shared
1428 library. Since we can't know at compile time if a symbol will be
1429 satisfied by a shared library or main program we put any symbolic
1430 constant into the normal data section. */
1431 #define SELECT_RTX_SECTION(MODE,RTX) \
1432 if (symbolic_operand (RTX, MODE)) \
1433 data_section (); \
1434 else \
1435 readonly_data_section ();
1437 /* On hpux10, the linker will give an error if we have a reference
1438 in the read-only data section to a symbol defined in a shared
1439 library. Therefore, expressions that might require a reloc can
1440 not be placed in the read-only data section. */
1441 #define SELECT_SECTION(EXP,RELOC) \
1442 if (TREE_CODE (EXP) == VAR_DECL \
1443 && TREE_READONLY (EXP) \
1444 && !TREE_THIS_VOLATILE (EXP) \
1445 && DECL_INITIAL (EXP) \
1446 && (DECL_INITIAL (EXP) == error_mark_node \
1447 || TREE_CONSTANT (DECL_INITIAL (EXP))) \
1448 && !RELOC) \
1449 readonly_data_section (); \
1450 else if (TREE_CODE_CLASS (TREE_CODE (EXP)) == 'c' \
1451 && !(TREE_CODE (EXP) == STRING_CST && flag_writable_strings) \
1452 && !RELOC) \
1453 readonly_data_section (); \
1454 else \
1455 data_section ();
1457 /* Define this macro if references to a symbol must be treated
1458 differently depending on something about the variable or
1459 function named by the symbol (such as what section it is in).
1461 The macro definition, if any, is executed immediately after the
1462 rtl for DECL or other node is created.
1463 The value of the rtl will be a `mem' whose address is a
1464 `symbol_ref'.
1466 The usual thing for this macro to do is to a flag in the
1467 `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
1468 name string in the `symbol_ref' (if one bit is not enough
1469 information).
1471 On the HP-PA we use this to indicate if a symbol is in text or
1472 data space. Also, function labels need special treatment. */
1474 #define TEXT_SPACE_P(DECL)\
1475 (TREE_CODE (DECL) == FUNCTION_DECL \
1476 || (TREE_CODE (DECL) == VAR_DECL \
1477 && TREE_READONLY (DECL) && ! TREE_SIDE_EFFECTS (DECL) \
1478 && (! DECL_INITIAL (DECL) || ! reloc_needed (DECL_INITIAL (DECL))) \
1479 && !flag_pic) \
1480 || (TREE_CODE_CLASS (TREE_CODE (DECL)) == 'c' \
1481 && !(TREE_CODE (DECL) == STRING_CST && flag_writable_strings)))
1483 #define FUNCTION_NAME_P(NAME) \
1484 (*(NAME) == '@' || (*(NAME) == '*' && *((NAME) + 1) == '@'))
1486 #define ENCODE_SECTION_INFO(DECL)\
1487 do \
1488 { if (TEXT_SPACE_P (DECL)) \
1489 { rtx _rtl; \
1490 if (TREE_CODE (DECL) == FUNCTION_DECL \
1491 || TREE_CODE (DECL) == VAR_DECL) \
1492 _rtl = DECL_RTL (DECL); \
1493 else \
1494 _rtl = TREE_CST_RTL (DECL); \
1495 SYMBOL_REF_FLAG (XEXP (_rtl, 0)) = 1; \
1496 if (TREE_CODE (DECL) == FUNCTION_DECL) \
1497 hppa_encode_label (XEXP (DECL_RTL (DECL), 0));\
1500 while (0)
1502 /* Store the user-specified part of SYMBOL_NAME in VAR.
1503 This is sort of inverse to ENCODE_SECTION_INFO. */
1505 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
1506 (VAR) = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*' ? \
1507 1 + (SYMBOL_NAME)[1] == '@'\
1508 : (SYMBOL_NAME)[0] == '@'))
1510 /* Specify the machine mode that this machine uses
1511 for the index in the tablejump instruction. */
1512 #define CASE_VECTOR_MODE (TARGET_BIG_SWITCH ? TImode : DImode)
1514 /* Jump tables must be 32 bit aligned, no matter the size of the element. */
1515 #define ADDR_VEC_ALIGN(ADDR_VEC) 2
1517 /* Specify the tree operation to be used to convert reals to integers. */
1518 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1520 /* This is the kind of divide that is easiest to do in the general case. */
1521 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1523 /* Define this as 1 if `char' should by default be signed; else as 0. */
1524 #define DEFAULT_SIGNED_CHAR 1
1526 /* Max number of bytes we can move from memory to memory
1527 in one reasonably fast instruction. */
1528 #define MOVE_MAX 8
1530 /* Higher than the default as we prefer to use simple move insns
1531 (better scheduling and delay slot filling) and because our
1532 built-in block move is really a 2X unrolled loop.
1534 Believe it or not, this has to be big enough to allow for copying all
1535 arguments passed in registers to avoid infinite recursion during argument
1536 setup for a function call. Why? Consider how we copy the stack slots
1537 reserved for parameters when they may be trashed by a call. */
1538 #define MOVE_RATIO (TARGET_64BIT ? 8 : 4)
1540 /* Define if operations between registers always perform the operation
1541 on the full register even if a narrower mode is specified. */
1542 #define WORD_REGISTER_OPERATIONS
1544 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
1545 will either zero-extend or sign-extend. The value of this macro should
1546 be the code that says which one of the two operations is implicitly
1547 done, NIL if none. */
1548 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
1550 /* Nonzero if access to memory by bytes is slow and undesirable. */
1551 #define SLOW_BYTE_ACCESS 1
1553 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1554 is done just by pretending it is already truncated. */
1555 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1557 /* We assume that the store-condition-codes instructions store 0 for false
1558 and some other value for true. This is the value stored for true. */
1560 #define STORE_FLAG_VALUE 1
1562 /* When a prototype says `char' or `short', really pass an `int'. */
1563 #define PROMOTE_PROTOTYPES 1
1564 #define PROMOTE_FUNCTION_RETURN 1
1566 /* Specify the machine mode that pointers have.
1567 After generation of rtl, the compiler makes no further distinction
1568 between pointers and any other objects of this machine mode. */
1569 #define Pmode word_mode
1571 /* Add any extra modes needed to represent the condition code.
1573 HPPA floating comparisons produce condition codes. */
1574 #define EXTRA_CC_MODES CC(CCFPmode, "CCFP")
1576 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
1577 return the mode to be used for the comparison. For floating-point, CCFPmode
1578 should be used. CC_NOOVmode should be used when the first operand is a
1579 PLUS, MINUS, or NEG. CCmode should be used when no special processing is
1580 needed. */
1581 #define SELECT_CC_MODE(OP,X,Y) \
1582 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT ? CCFPmode : CCmode) \
1584 /* A function address in a call instruction
1585 is a byte address (for indexing purposes)
1586 so give the MEM rtx a byte's mode. */
1587 #define FUNCTION_MODE SImode
1589 /* Define this if addresses of constant functions
1590 shouldn't be put through pseudo regs where they can be cse'd.
1591 Desirable on machines where ordinary constants are expensive
1592 but a CALL with constant address is cheap. */
1593 #define NO_FUNCTION_CSE
1595 /* Define this to be nonzero if shift instructions ignore all but the low-order
1596 few bits. */
1597 #define SHIFT_COUNT_TRUNCATED 1
1599 /* Compute the cost of computing a constant rtl expression RTX
1600 whose rtx-code is CODE. The body of this macro is a portion
1601 of a switch statement. If the code is computed here,
1602 return it with a return statement. Otherwise, break from the switch. */
1604 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1605 case CONST_INT: \
1606 if (INTVAL (RTX) == 0) return 0; \
1607 if (INT_14_BITS (RTX)) return 1; \
1608 case HIGH: \
1609 return 2; \
1610 case CONST: \
1611 case LABEL_REF: \
1612 case SYMBOL_REF: \
1613 return 4; \
1614 case CONST_DOUBLE: \
1615 if ((RTX == CONST0_RTX (DFmode) || RTX == CONST0_RTX (SFmode)) \
1616 && OUTER_CODE != SET) \
1617 return 0; \
1618 else \
1619 return 8;
1621 #define ADDRESS_COST(RTX) \
1622 (GET_CODE (RTX) == REG ? 1 : hppa_address_cost (RTX))
1624 /* Compute extra cost of moving data between one register class
1625 and another.
1627 Make moves from SAR so expensive they should never happen. We used to
1628 have 0xffff here, but that generates overflow in rare cases.
1630 Copies involving a FP register and a non-FP register are relatively
1631 expensive because they must go through memory.
1633 Other copies are reasonably cheap. */
1634 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
1635 (CLASS1 == SHIFT_REGS ? 0x100 \
1636 : FP_REG_CLASS_P (CLASS1) && ! FP_REG_CLASS_P (CLASS2) ? 16 \
1637 : FP_REG_CLASS_P (CLASS2) && ! FP_REG_CLASS_P (CLASS1) ? 16 \
1638 : 2)
1641 /* Provide the costs of a rtl expression. This is in the body of a
1642 switch on CODE. The purpose for the cost of MULT is to encourage
1643 `synth_mult' to find a synthetic multiply when reasonable. */
1645 #define RTX_COSTS(X,CODE,OUTER_CODE) \
1646 case MULT: \
1647 if (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
1648 return COSTS_N_INSNS (3); \
1649 return (TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT) \
1650 ? COSTS_N_INSNS (8) : COSTS_N_INSNS (20); \
1651 case DIV: \
1652 if (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
1653 return COSTS_N_INSNS (14); \
1654 case UDIV: \
1655 case MOD: \
1656 case UMOD: \
1657 return COSTS_N_INSNS (60); \
1658 case PLUS: /* this includes shNadd insns */ \
1659 case MINUS: \
1660 if (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
1661 return COSTS_N_INSNS (3); \
1662 return COSTS_N_INSNS (1); \
1663 case ASHIFT: \
1664 case ASHIFTRT: \
1665 case LSHIFTRT: \
1666 return COSTS_N_INSNS (1);
1668 /* Adjust the cost of branches. */
1669 #define BRANCH_COST (pa_cpu == PROCESSOR_8000 ? 2 : 1)
1671 /* Adjust the cost of dependencies. */
1673 #define ADJUST_COST(INSN,LINK,DEP,COST) \
1674 (COST) = pa_adjust_cost (INSN, LINK, DEP, COST)
1676 /* Adjust scheduling priorities. We use this to try and keep addil
1677 and the next use of %r1 close together. */
1678 #define ADJUST_PRIORITY(PREV) \
1680 rtx set = single_set (PREV); \
1681 rtx src, dest; \
1682 if (set) \
1684 src = SET_SRC (set); \
1685 dest = SET_DEST (set); \
1686 if (GET_CODE (src) == LO_SUM \
1687 && symbolic_operand (XEXP (src, 1), VOIDmode) \
1688 && ! read_only_operand (XEXP (src, 1), VOIDmode)) \
1689 INSN_PRIORITY (PREV) >>= 3; \
1690 else if (GET_CODE (src) == MEM \
1691 && GET_CODE (XEXP (src, 0)) == LO_SUM \
1692 && symbolic_operand (XEXP (XEXP (src, 0), 1), VOIDmode)\
1693 && ! read_only_operand (XEXP (XEXP (src, 0), 1), VOIDmode))\
1694 INSN_PRIORITY (PREV) >>= 1; \
1695 else if (GET_CODE (dest) == MEM \
1696 && GET_CODE (XEXP (dest, 0)) == LO_SUM \
1697 && symbolic_operand (XEXP (XEXP (dest, 0), 1), VOIDmode)\
1698 && ! read_only_operand (XEXP (XEXP (dest, 0), 1), VOIDmode))\
1699 INSN_PRIORITY (PREV) >>= 3; \
1703 /* Handling the special cases is going to get too complicated for a macro,
1704 just call `pa_adjust_insn_length' to do the real work. */
1705 #define ADJUST_INSN_LENGTH(INSN, LENGTH) \
1706 LENGTH += pa_adjust_insn_length (INSN, LENGTH);
1708 /* Millicode insns are actually function calls with some special
1709 constraints on arguments and register usage.
1711 Millicode calls always expect their arguments in the integer argument
1712 registers, and always return their result in %r29 (ret1). They
1713 are expected to clobber their arguments, %r1, %r29, and %r31 and
1714 nothing else.
1716 This macro tells reorg that the references to arguments and
1717 millicode calls do not appear to happen until after the millicode call.
1718 This allows reorg to put insns which set the argument registers into the
1719 delay slot of the millicode call -- thus they act more like traditional
1720 CALL_INSNs.
1722 Note we can not consider side effects of the insn to be delayed because
1723 the branch and link insn will clobber the return pointer. If we happened
1724 to use the return pointer in the delay slot of the call, then we lose.
1726 get_attr_type will try to recognize the given insn, so make sure to
1727 filter out things it will not accept -- SEQUENCE, USE and CLOBBER insns
1728 in particular. */
1729 #define INSN_REFERENCES_ARE_DELAYED(X) (insn_refs_are_delayed (X))
1732 /* Control the assembler format that we output. */
1734 /* Output to assembler file text saying following lines
1735 may contain character constants, extra white space, comments, etc. */
1737 #define ASM_APP_ON ""
1739 /* Output to assembler file text saying following lines
1740 no longer contain unusual constructs. */
1742 #define ASM_APP_OFF ""
1744 /* This is how to output the definition of a user-level label named NAME,
1745 such as the label on a static function or variable NAME. */
1747 #define ASM_OUTPUT_LABEL(FILE, NAME) \
1748 do { assemble_name (FILE, NAME); \
1749 fputc ('\n', FILE); } while (0)
1751 /* This is how to output a reference to a user-level label named NAME.
1752 `assemble_name' uses this. */
1754 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
1755 fprintf ((FILE), "%s", (NAME) + (FUNCTION_NAME_P (NAME) ? 1 : 0))
1757 /* This is how to output an internal numbered label where
1758 PREFIX is the class of label and NUM is the number within the class. */
1760 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1761 {fprintf (FILE, "%c$%s%04d\n", (PREFIX)[0], (PREFIX) + 1, NUM);}
1763 /* This is how to store into the string LABEL
1764 the symbol_ref name of an internal numbered label where
1765 PREFIX is the class of label and NUM is the number within the class.
1766 This is suitable for output with `assemble_name'. */
1768 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1769 sprintf (LABEL, "*%c$%s%04d", (PREFIX)[0], (PREFIX) + 1, NUM)
1771 /* This is how to output an assembler line defining a `double' constant. */
1773 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
1774 do { long l[2]; \
1775 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
1776 fprintf (FILE, "\t.word 0x%lx\n\t.word 0x%lx\n", l[0], l[1]); \
1777 } while (0)
1779 /* This is how to output an assembler line defining a `float' constant. */
1781 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
1782 do { long l; \
1783 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
1784 fprintf (FILE, "\t.word 0x%lx\n", l); \
1785 } while (0)
1787 /* This is how to output an assembler line defining an `int' constant.
1789 This is made more complicated by the fact that functions must be
1790 prefixed by a P% as well as code label references for the exception
1791 table -- otherwise the linker chokes. */
1793 #define ASM_OUTPUT_INT(FILE,VALUE) \
1794 { fputs ("\t.word ", FILE); \
1795 if (function_label_operand (VALUE, VOIDmode)) \
1796 fputs ("P%", FILE); \
1797 output_addr_const (FILE, (VALUE)); \
1798 fputs ("\n", FILE);}
1800 /* Likewise for `short' and `char' constants. */
1802 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
1803 ( fputs ("\t.half ", FILE), \
1804 output_addr_const (FILE, (VALUE)), \
1805 fputs ("\n", FILE))
1807 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
1808 ( fputs ("\t.byte ", FILE), \
1809 output_addr_const (FILE, (VALUE)), \
1810 fputs ("\n", FILE))
1812 /* This is how to output an assembler line for a numeric constant byte. */
1814 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
1815 fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1817 #define ASM_GLOBALIZE_LABEL(FILE, NAME) \
1818 do { \
1819 /* We only handle DATA objects here, functions are globalized in \
1820 ASM_DECLARE_FUNCTION_NAME. */ \
1821 if (! FUNCTION_NAME_P (NAME)) \
1823 fputs ("\t.EXPORT ", FILE); \
1824 assemble_name (FILE, NAME); \
1825 fputs (",DATA\n", FILE); \
1827 } while (0)
1829 #define ASM_OUTPUT_ASCII(FILE, P, SIZE) \
1830 output_ascii ((FILE), (P), (SIZE))
1832 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)
1833 #define ASM_OUTPUT_REG_POP(FILE,REGNO)
1834 /* This is how to output an element of a case-vector that is absolute.
1835 Note that this method makes filling these branch delay slots
1836 impossible. */
1838 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1839 if (TARGET_BIG_SWITCH) \
1840 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); \
1841 else \
1842 fprintf (FILE, "\tb L$%04d\n\tnop\n", VALUE)
1844 /* Jump tables are executable code and live in the TEXT section on the PA. */
1845 #define JUMP_TABLES_IN_TEXT_SECTION 1
1847 /* This is how to output an element of a case-vector that is relative.
1848 This must be defined correctly as it is used when generating PIC code.
1850 I believe it safe to use the same definition as ASM_OUTPUT_ADDR_VEC_ELT
1851 on the PA since ASM_OUTPUT_ADDR_VEC_ELT uses pc-relative jump instructions
1852 rather than a table of absolute addresses. */
1854 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1855 if (TARGET_BIG_SWITCH) \
1856 fprintf (FILE, "\tstw %%r1,-16(%%r30)\n\tldw T'L$%04d(%%r19),%%r1\n\tbv %%r0(%%r1)\n\tldw -16(%%r30),%%r1\n", VALUE); \
1857 else \
1858 fprintf (FILE, "\tb L$%04d\n\tnop\n", VALUE)
1860 /* This is how to output an assembler line
1861 that says to advance the location counter
1862 to a multiple of 2**LOG bytes. */
1864 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1865 fprintf (FILE, "\t.align %d\n", (1<<(LOG)))
1867 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1868 fprintf (FILE, "\t.blockz %d\n", (SIZE))
1870 /* This says how to output an assembler line to define a global common symbol
1871 with size SIZE (in bytes) and alignment ALIGN (in bits). */
1873 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGNED) \
1874 { bss_section (); \
1875 assemble_name ((FILE), (NAME)); \
1876 fputs ("\t.comm ", (FILE)); \
1877 fprintf ((FILE), "%d\n", MAX ((SIZE), ((ALIGNED) / BITS_PER_UNIT)));}
1879 /* This says how to output an assembler line to define a local common symbol
1880 with size SIZE (in bytes) and alignment ALIGN (in bits). */
1882 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGNED) \
1883 { bss_section (); \
1884 fprintf ((FILE), "\t.align %d\n", ((ALIGNED) / BITS_PER_UNIT)); \
1885 assemble_name ((FILE), (NAME)); \
1886 fprintf ((FILE), "\n\t.block %d\n", (SIZE));}
1888 /* Store in OUTPUT a string (made with alloca) containing
1889 an assembler-name for a local static variable named NAME.
1890 LABELNO is an integer which is different for each call. */
1892 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1893 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
1894 sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
1896 /* Define the parentheses used to group arithmetic operations
1897 in assembler code. */
1899 #define ASM_OPEN_PAREN "("
1900 #define ASM_CLOSE_PAREN ")"
1902 /* All HP assemblers use "!" to separate logical lines. */
1903 #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '!')
1905 /* Define results of standard character escape sequences. */
1906 #define TARGET_BELL 007
1907 #define TARGET_BS 010
1908 #define TARGET_TAB 011
1909 #define TARGET_NEWLINE 012
1910 #define TARGET_VT 013
1911 #define TARGET_FF 014
1912 #define TARGET_CR 015
1914 #define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
1915 ((CHAR) == '@' || (CHAR) == '#' || (CHAR) == '*' || (CHAR) == '^')
1917 /* Print operand X (an rtx) in assembler syntax to file FILE.
1918 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1919 For `%' followed by punctuation, CODE is the punctuation and X is null.
1921 On the HP-PA, the CODE can be `r', meaning this is a register-only operand
1922 and an immediate zero should be represented as `r0'.
1924 Several % codes are defined:
1925 O an operation
1926 C compare conditions
1927 N extract conditions
1928 M modifier to handle preincrement addressing for memory refs.
1929 F modifier to handle preincrement addressing for fp memory refs */
1931 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
1934 /* Print a memory address as an operand to reference that memory location. */
1936 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1937 { register rtx addr = ADDR; \
1938 register rtx base; \
1939 int offset; \
1940 switch (GET_CODE (addr)) \
1942 case REG: \
1943 fprintf (FILE, "0(%s)", reg_names [REGNO (addr)]); \
1944 break; \
1945 case PLUS: \
1946 if (GET_CODE (XEXP (addr, 0)) == CONST_INT) \
1947 offset = INTVAL (XEXP (addr, 0)), base = XEXP (addr, 1); \
1948 else if (GET_CODE (XEXP (addr, 1)) == CONST_INT) \
1949 offset = INTVAL (XEXP (addr, 1)), base = XEXP (addr, 0); \
1950 else \
1951 abort (); \
1952 fprintf (FILE, "%d(%s)", offset, reg_names [REGNO (base)]); \
1953 break; \
1954 case LO_SUM: \
1955 if (!symbolic_operand (XEXP (addr, 1), VOIDmode)) \
1956 fputs ("R'", FILE); \
1957 else if (flag_pic == 0) \
1958 fputs ("RR'", FILE); \
1959 else if (flag_pic == 1) \
1960 abort (); \
1961 else if (flag_pic == 2) \
1962 fputs ("RT'", FILE); \
1963 output_global_address (FILE, XEXP (addr, 1), 0); \
1964 fputs ("(", FILE); \
1965 output_operand (XEXP (addr, 0), 0); \
1966 fputs (")", FILE); \
1967 break; \
1968 case CONST_INT: \
1969 fprintf (FILE, "%d(%%r0)", INTVAL (addr)); \
1970 break; \
1971 default: \
1972 output_addr_const (FILE, addr); \
1976 /* Find the return address associated with the frame given by
1977 FRAMEADDR. */
1978 #define RETURN_ADDR_RTX(COUNT, FRAMEADDR) \
1979 (return_addr_rtx (COUNT, FRAMEADDR))
1981 /* Used to mask out junk bits from the return address, such as
1982 processor state, interrupt status, condition codes and the like. */
1983 #define MASK_RETURN_ADDR \
1984 /* The privilege level is in the two low order bits, mask em out \
1985 of the return address. */ \
1986 (GEN_INT (-4))
1988 /* The number of Pmode words for the setjmp buffer. */
1989 #define JMP_BUF_SIZE 50
1991 /* Only direct calls to static functions are allowed to be sibling (tail)
1992 call optimized.
1994 This restriction is necessary because some linker generated stubs will
1995 store return pointers into rp' in some cases which might clobber a
1996 live value already in rp'.
1998 In a sibcall the current function and the target function share stack
1999 space. Thus if the path to the current function and the path to the
2000 target function save a value in rp', they save the value into the
2001 same stack slot, which has undesirable consequences.
2003 Because of the deferred binding nature of shared libraries any function
2004 with external scope could be in a different load module and thus require
2005 rp' to be saved when calling that function. So sibcall optimizations
2006 can only be safe for static function.
2008 Note that GCC never needs return value relocations, so we don't have to
2009 worry about static calls with return value relocations (which require
2010 saving rp').
2012 It is safe to perform a sibcall optimization when the target function
2013 will never return. */
2014 #define FUNCTION_OK_FOR_SIBCALL(DECL) \
2015 (DECL \
2016 && ! TARGET_64BIT \
2017 && ! TREE_PUBLIC (DECL))
2019 #define PREDICATE_CODES \
2020 {"reg_or_0_operand", {SUBREG, REG, CONST_INT}}, \
2021 {"call_operand_address", {LABEL_REF, SYMBOL_REF, CONST_INT, \
2022 CONST_DOUBLE, CONST, HIGH, CONSTANT_P_RTX}}, \
2023 {"symbolic_operand", {SYMBOL_REF, LABEL_REF, CONST}}, \
2024 {"symbolic_memory_operand", {SUBREG, MEM}}, \
2025 {"reg_or_nonsymb_mem_operand", {SUBREG, REG, MEM}}, \
2026 {"reg_or_0_or_nonsymb_mem_operand", {SUBREG, REG, MEM, CONST_INT, \
2027 CONST_DOUBLE}}, \
2028 {"move_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT, MEM}}, \
2029 {"reg_or_cint_move_operand", {SUBREG, REG, CONST_INT}}, \
2030 {"pic_label_operand", {LABEL_REF, CONST}}, \
2031 {"fp_reg_operand", {REG}}, \
2032 {"arith_operand", {SUBREG, REG, CONST_INT}}, \
2033 {"arith11_operand", {SUBREG, REG, CONST_INT}}, \
2034 {"pre_cint_operand", {CONST_INT}}, \
2035 {"post_cint_operand", {CONST_INT}}, \
2036 {"arith_double_operand", {SUBREG, REG, CONST_DOUBLE}}, \
2037 {"ireg_or_int5_operand", {CONST_INT, REG}}, \
2038 {"int5_operand", {CONST_INT}}, \
2039 {"uint5_operand", {CONST_INT}}, \
2040 {"int11_operand", {CONST_INT}}, \
2041 {"uint32_operand", {CONST_INT, \
2042 HOST_BITS_PER_WIDE_INT > 32 ? 0 : CONST_DOUBLE}}, \
2043 {"arith5_operand", {SUBREG, REG, CONST_INT}}, \
2044 {"and_operand", {SUBREG, REG, CONST_INT}}, \
2045 {"ior_operand", {CONST_INT}}, \
2046 {"lhs_lshift_cint_operand", {CONST_INT}}, \
2047 {"lhs_lshift_operand", {SUBREG, REG, CONST_INT}}, \
2048 {"arith32_operand", {SUBREG, REG, CONST_INT}}, \
2049 {"pc_or_label_operand", {PC, LABEL_REF}}, \
2050 {"plus_xor_ior_operator", {PLUS, XOR, IOR}}, \
2051 {"shadd_operand", {CONST_INT}}, \
2052 {"basereg_operand", {REG}}, \
2053 {"div_operand", {REG, CONST_INT}}, \
2054 {"ireg_operand", {REG}}, \
2055 {"cmpib_comparison_operator", {EQ, NE, LT, LE, LEU, \
2056 GT, GTU, GE}}, \
2057 {"movb_comparison_operator", {EQ, NE, LT, GE}},