1 /* Definitions for code generation pass of GNU compiler.
2 Copyright (C) 1987, 91-98, 1999 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* The default branch cost is 1. */
26 /* Macros to access the slots of a QUEUED rtx.
27 Here rather than in rtl.h because only the expansion pass
28 should ever encounter a QUEUED. */
30 /* The variable for which an increment is queued. */
31 #define QUEUED_VAR(P) XEXP (P, 0)
32 /* If the increment has been emitted, this is the insn
33 that does the increment. It is zero before the increment is emitted.
34 If more than one insn is emitted, this is the first insn. */
35 #define QUEUED_INSN(P) XEXP (P, 1)
36 /* If a pre-increment copy has been generated, this is the copy
37 (it is a temporary reg). Zero if no copy made yet. */
38 #define QUEUED_COPY(P) XEXP (P, 2)
39 /* This is the body to use for the insn to do the increment.
40 It is used to emit the increment. */
41 #define QUEUED_BODY(P) XEXP (P, 3)
42 /* Next QUEUED in the queue. */
43 #define QUEUED_NEXT(P) XEXP (P, 4)
45 /* This is the 4th arg to `expand_expr'.
46 EXPAND_SUM means it is ok to return a PLUS rtx or MULT rtx.
47 EXPAND_INITIALIZER is similar but also record any labels on forced_labels.
48 EXPAND_CONST_ADDRESS means it is ok to return a MEM whose address
49 is a constant that is not a legitimate address.
50 EXPAND_MEMORY_USE_* are explained below. */
51 enum expand_modifier
{EXPAND_NORMAL
, EXPAND_SUM
,
52 EXPAND_CONST_ADDRESS
, EXPAND_INITIALIZER
,
53 EXPAND_MEMORY_USE_WO
, EXPAND_MEMORY_USE_RW
,
54 EXPAND_MEMORY_USE_BAD
, EXPAND_MEMORY_USE_DONT
};
56 /* Argument for chkr_* functions.
57 MEMORY_USE_RO: the pointer reads memory.
58 MEMORY_USE_WO: the pointer writes to memory.
59 MEMORY_USE_RW: the pointer modifies memory (ie it reads and writes). An
61 MEMORY_USE_BAD: use this if you don't know the behavior of the pointer, or
62 if you know there are no pointers. Using an INDIRECT_REF
63 with MEMORY_USE_BAD will abort.
64 MEMORY_USE_TW: just test for writing, without update. Special.
65 MEMORY_USE_DONT: the memory is neither read nor written. This is used by
67 enum memory_use_mode
{MEMORY_USE_BAD
= 0, MEMORY_USE_RO
= 1,
68 MEMORY_USE_WO
= 2, MEMORY_USE_RW
= 3,
69 MEMORY_USE_TW
= 6, MEMORY_USE_DONT
= 99};
71 /* Prevent the compiler from deferring stack pops. See
72 inhibit_defer_pop for more information. */
73 #define NO_DEFER_POP (inhibit_defer_pop += 1)
75 /* Allow the compiler to defer stack pops. See inhibit_defer_pop for
77 #define OK_DEFER_POP (inhibit_defer_pop -= 1)
79 #ifdef TREE_CODE /* Don't lose if tree.h not included. */
80 /* Structure to record the size of a sequence of arguments
81 as the sum of a tree-expression and a constant. */
85 HOST_WIDE_INT constant
;
90 /* Add the value of the tree INC to the `struct args_size' TO. */
92 #define ADD_PARM_SIZE(TO, INC) \
94 if (TREE_CODE (inc) == INTEGER_CST) \
95 (TO).constant += TREE_INT_CST_LOW (inc); \
96 else if ((TO).var == 0) \
99 (TO).var = size_binop (PLUS_EXPR, (TO).var, inc); }
101 #define SUB_PARM_SIZE(TO, DEC) \
102 { tree dec = (DEC); \
103 if (TREE_CODE (dec) == INTEGER_CST) \
104 (TO).constant -= TREE_INT_CST_LOW (dec); \
105 else if ((TO).var == 0) \
106 (TO).var = size_binop (MINUS_EXPR, integer_zero_node, dec); \
108 (TO).var = size_binop (MINUS_EXPR, (TO).var, dec); }
110 /* Convert the implicit sum in a `struct args_size' into an rtx. */
111 #define ARGS_SIZE_RTX(SIZE) \
112 ((SIZE).var == 0 ? GEN_INT ((SIZE).constant) \
113 : expand_expr (size_binop (PLUS_EXPR, (SIZE).var, \
114 size_int ((SIZE).constant)), \
115 NULL_RTX, VOIDmode, EXPAND_MEMORY_USE_BAD))
117 /* Convert the implicit sum in a `struct args_size' into a tree. */
118 #define ARGS_SIZE_TREE(SIZE) \
119 ((SIZE).var == 0 ? size_int ((SIZE).constant) \
120 : size_binop (PLUS_EXPR, (SIZE).var, size_int ((SIZE).constant)))
122 /* Supply a default definition for FUNCTION_ARG_PADDING:
123 usually pad upward, but pad short args downward on
124 big-endian machines. */
126 enum direction
{none
, upward
, downward
}; /* Value has this type. */
128 #ifndef FUNCTION_ARG_PADDING
129 #define FUNCTION_ARG_PADDING(MODE, TYPE) \
130 (! BYTES_BIG_ENDIAN \
132 : (((MODE) == BLKmode \
133 ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
134 && int_size_in_bytes (TYPE) < (PARM_BOUNDARY / BITS_PER_UNIT)) \
135 : GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY) \
136 ? downward : upward))
139 /* Supply a default definition for FUNCTION_ARG_BOUNDARY. Normally, we let
140 FUNCTION_ARG_PADDING, which also pads the length, handle any needed
143 #ifndef FUNCTION_ARG_BOUNDARY
144 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) PARM_BOUNDARY
147 /* Provide a default value for STRICT_ARGUMENT_NAMING. */
148 #ifndef STRICT_ARGUMENT_NAMING
149 #define STRICT_ARGUMENT_NAMING 0
152 /* Provide a default value for PRETEND_OUTGOING_VARARGS_NAMED. */
153 #ifdef SETUP_INCOMING_VARARGS
154 #ifndef PRETEND_OUTGOING_VARARGS_NAMED
155 #define PRETEND_OUTGOING_VARARGS_NAMED 1
158 /* It is an error to define PRETEND_OUTGOING_VARARGS_NAMED without
159 defining SETUP_INCOMING_VARARGS. */
160 #define PRETEND_OUTGOING_VARARGS_NAMED 0
163 /* Nonzero if we do not know how to pass TYPE solely in registers.
164 We cannot do so in the following cases:
166 - if the type has variable size
167 - if the type is marked as addressable (it is required to be constructed
169 - if the padding and mode of the type is such that a copy into a register
170 would put it into the wrong part of the register.
172 Which padding can't be supported depends on the byte endianness.
174 A value in a register is implicitly padded at the most significant end.
175 On a big-endian machine, that is the lower end in memory.
176 So a value padded in memory at the upper end can't go in a register.
177 For a little-endian machine, the reverse is true. */
179 #ifndef MUST_PASS_IN_STACK
180 #define MUST_PASS_IN_STACK(MODE,TYPE) \
182 && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \
183 || TREE_ADDRESSABLE (TYPE) \
184 || ((MODE) == BLKmode \
185 && ! ((TYPE) != 0 && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
186 && 0 == (int_size_in_bytes (TYPE) \
187 % (PARM_BOUNDARY / BITS_PER_UNIT))) \
188 && (FUNCTION_ARG_PADDING (MODE, TYPE) \
189 == (BYTES_BIG_ENDIAN ? upward : downward)))))
192 /* Nonzero if type TYPE should be returned in memory.
193 Most machines can use the following default definition. */
195 #ifndef RETURN_IN_MEMORY
196 #define RETURN_IN_MEMORY(TYPE) (TYPE_MODE (TYPE) == BLKmode)
199 /* Supply a default definition of STACK_SAVEAREA_MODE for emit_stack_save.
200 Normally move_insn, so Pmode stack pointer. */
202 #ifndef STACK_SAVEAREA_MODE
203 #define STACK_SAVEAREA_MODE(LEVEL) Pmode
206 /* Supply a default definition of STACK_SIZE_MODE for
207 allocate_dynamic_stack_space. Normally PLUS/MINUS, so word_mode. */
209 #ifndef STACK_SIZE_MODE
210 #define STACK_SIZE_MODE word_mode
213 /* Provide default values for the macros controlling stack checking. */
215 #ifndef STACK_CHECK_BUILTIN
216 #define STACK_CHECK_BUILTIN 0
219 /* The default interval is one page. */
220 #ifndef STACK_CHECK_PROBE_INTERVAL
221 #define STACK_CHECK_PROBE_INTERVAL 4096
224 /* The default is to do a store into the stack. */
225 #ifndef STACK_CHECK_PROBE_LOAD
226 #define STACK_CHECK_PROBE_LOAD 0
229 /* This value is arbitrary, but should be sufficient for most machines. */
230 #ifndef STACK_CHECK_PROTECT
231 #define STACK_CHECK_PROTECT (75 * UNITS_PER_WORD)
234 /* Make the maximum frame size be the largest we can and still only need
235 one probe per function. */
236 #ifndef STACK_CHECK_MAX_FRAME_SIZE
237 #define STACK_CHECK_MAX_FRAME_SIZE \
238 (STACK_CHECK_PROBE_INTERVAL - UNITS_PER_WORD)
241 /* This is arbitrary, but should be large enough everywhere. */
242 #ifndef STACK_CHECK_FIXED_FRAME_SIZE
243 #define STACK_CHECK_FIXED_FRAME_SIZE (4 * UNITS_PER_WORD)
246 /* Provide a reasonable default for the maximum size of an object to
247 allocate in the fixed frame. We may need to be able to make this
248 controllable by the user at some point. */
249 #ifndef STACK_CHECK_MAX_VAR_SIZE
250 #define STACK_CHECK_MAX_VAR_SIZE (STACK_CHECK_MAX_FRAME_SIZE / 100)
253 /* Optabs are tables saying how to generate insn bodies
254 for various machine modes and numbers of operands.
255 Each optab applies to one operation.
256 For example, add_optab applies to addition.
258 The insn_code slot is the enum insn_code that says how to
259 generate an insn for this operation on a particular machine mode.
260 It is CODE_FOR_nothing if there is no such insn on the target machine.
262 The `lib_call' slot is the name of the library function that
263 can be used to perform the operation.
265 A few optabs, such as move_optab and cmp_optab, are used
268 /* Everything that uses expr.h needs to define enum insn_code
269 but we don't list it in the Makefile dependencies just for that. */
270 #include "insn-codes.h"
276 enum insn_code insn_code
;
278 } handlers
[NUM_MACHINE_MODES
];
281 /* Given an enum insn_code, access the function to construct
282 the body of that kind of insn. */
283 #ifdef FUNCTION_CONVERSION_BUG
284 /* Some compilers fail to convert a function properly to a
285 pointer-to-function when used as an argument.
286 So produce the pointer-to-function directly.
287 Luckily, these compilers seem to work properly when you
288 call the pointer-to-function. */
289 #define GEN_FCN(CODE) (insn_data[(int) (CODE)].genfun)
291 #define GEN_FCN(CODE) (*insn_data[(int) (CODE)].genfun)
294 /* Enumeration of valid indexes into optab_table. */
300 /* Signed and fp multiply */
302 /* Signed multiply, return high word */
305 /* Signed multiply with result one machine mode wider than args */
311 /* Signed divide-and-remainder in one */
315 /* Signed remainder */
318 /* Optab for floating divide. */
320 /* Convert float to integer in float fmt */
330 /* Arithmetic shift left */
332 /* Logical shift right */
334 /* Arithmetic shift right */
340 /* Signed and floating-point minimum value */
342 /* Signed and floating-point maximum value */
344 /* Unsigned minimum value */
346 /* Unsigned maximum value */
349 /* Move instruction. */
351 /* Move, preserving high part of register. */
354 /* Unary operations */
361 /* Find first bit set */
370 /* Compare insn; two operands. */
372 /* Used only for libcalls for unsigned comparisons. */
374 /* tst insn; compare one operand against 0 */
380 /* Combined compare & jump/store flags/move operations. */
388 extern optab optab_table
[OTI_MAX
];
390 #define add_optab (optab_table[OTI_add])
391 #define sub_optab (optab_table[OTI_sub])
392 #define smul_optab (optab_table[OTI_smul])
393 #define smul_highpart_optab (optab_table[OTI_smul_highpart])
394 #define umul_highpart_optab (optab_table[OTI_umul_highpart])
395 #define smul_widen_optab (optab_table[OTI_smul_widen])
396 #define umul_widen_optab (optab_table[OTI_umul_widen])
397 #define sdiv_optab (optab_table[OTI_sdiv])
398 #define sdivmod_optab (optab_table[OTI_sdivmod])
399 #define udiv_optab (optab_table[OTI_udiv])
400 #define udivmod_optab (optab_table[OTI_udivmod])
401 #define smod_optab (optab_table[OTI_smod])
402 #define umod_optab (optab_table[OTI_umod])
403 #define flodiv_optab (optab_table[OTI_flodiv])
404 #define ftrunc_optab (optab_table[OTI_ftrunc])
405 #define and_optab (optab_table[OTI_and])
406 #define ior_optab (optab_table[OTI_ior])
407 #define xor_optab (optab_table[OTI_xor])
408 #define ashl_optab (optab_table[OTI_ashl])
409 #define lshr_optab (optab_table[OTI_lshr])
410 #define ashr_optab (optab_table[OTI_ashr])
411 #define rotl_optab (optab_table[OTI_rotl])
412 #define rotr_optab (optab_table[OTI_rotr])
413 #define smin_optab (optab_table[OTI_smin])
414 #define smax_optab (optab_table[OTI_smax])
415 #define umin_optab (optab_table[OTI_umin])
416 #define umax_optab (optab_table[OTI_umax])
418 #define mov_optab (optab_table[OTI_mov])
419 #define movstrict_optab (optab_table[OTI_movstrict])
421 #define neg_optab (optab_table[OTI_neg])
422 #define abs_optab (optab_table[OTI_abs])
423 #define one_cmpl_optab (optab_table[OTI_one_cmpl])
424 #define ffs_optab (optab_table[OTI_ffs])
425 #define sqrt_optab (optab_table[OTI_sqrt])
426 #define sin_optab (optab_table[OTI_sin])
427 #define cos_optab (optab_table[OTI_cos])
429 #define cmp_optab (optab_table[OTI_cmp])
430 #define ucmp_optab (optab_table[OTI_ucmp])
431 #define tst_optab (optab_table[OTI_tst])
433 #define strlen_optab (optab_table[OTI_strlen])
435 #define cbranch_optab (optab_table[OTI_cbranch])
436 #define cmov_optab (optab_table[OTI_cmov])
437 #define cstore_optab (optab_table[OTI_cstore])
439 /* Tables of patterns for extending one integer mode to another. */
440 extern enum insn_code extendtab
[MAX_MACHINE_MODE
][MAX_MACHINE_MODE
][2];
442 /* Tables of patterns for converting between fixed and floating point. */
443 extern enum insn_code fixtab
[NUM_MACHINE_MODES
][NUM_MACHINE_MODES
][2];
444 extern enum insn_code fixtrunctab
[NUM_MACHINE_MODES
][NUM_MACHINE_MODES
][2];
445 extern enum insn_code floattab
[NUM_MACHINE_MODES
][NUM_MACHINE_MODES
][2];
447 /* Contains the optab used for each rtx code. */
448 extern optab code_to_optab
[NUM_RTX_CODE
+ 1];
450 /* Passed to expand_binop and expand_unop to say which options to try to use
451 if the requested operation can't be open-coded on the requisite mode.
452 Either OPTAB_LIB or OPTAB_LIB_WIDEN says try using a library call.
453 Either OPTAB_WIDEN or OPTAB_LIB_WIDEN says try using a wider mode.
454 OPTAB_MUST_WIDEN says try widening and don't try anything else. */
465 /* Enumeration of indexes into libfunc_table. */
581 LTI_chkr_copy_bitmap
,
585 LTI_profile_function_entry
,
586 LTI_profile_function_exit
,
591 /* SYMBOL_REF rtx's for the library functions that are called
592 implicitly and not via optabs. */
593 extern rtx libfunc_table
[LTI_MAX
];
595 /* Accessor macros for libfunc_table. */
596 #define extendsfdf2_libfunc (libfunc_table[LTI_extendsfdf2])
597 #define extendsfxf2_libfunc (libfunc_table[LTI_extendsfxf2])
598 #define extendsftf2_libfunc (libfunc_table[LTI_extendsftf2])
599 #define extenddfxf2_libfunc (libfunc_table[LTI_extenddfxf2])
600 #define extenddftf2_libfunc (libfunc_table[LTI_extenddftf2])
602 #define truncdfsf2_libfunc (libfunc_table[LTI_truncdfsf2])
603 #define truncxfsf2_libfunc (libfunc_table[LTI_truncxfsf2])
604 #define trunctfsf2_libfunc (libfunc_table[LTI_trunctfsf2])
605 #define truncxfdf2_libfunc (libfunc_table[LTI_truncxfdf2])
606 #define trunctfdf2_libfunc (libfunc_table[LTI_trunctfdf2])
608 #define memcpy_libfunc (libfunc_table[LTI_memcpy])
609 #define bcopy_libfunc (libfunc_table[LTI_bcopy])
610 #define memcmp_libfunc (libfunc_table[LTI_memcmp])
611 #define bcmp_libfunc (libfunc_table[LTI_bcmp])
612 #define memset_libfunc (libfunc_table[LTI_memset])
613 #define bzero_libfunc (libfunc_table[LTI_bzero])
615 #define throw_libfunc (libfunc_table[LTI_throw])
616 #define rethrow_libfunc (libfunc_table[LTI_rethrow])
617 #define sjthrow_libfunc (libfunc_table[LTI_sjthrow])
618 #define sjpopnthrow_libfunc (libfunc_table[LTI_sjpopnthrow])
619 #define terminate_libfunc (libfunc_table[LTI_terminate])
620 #define setjmp_libfunc (libfunc_table[LTI_setjmp])
621 #define longjmp_libfunc (libfunc_table[LTI_longjmp])
622 #define eh_rtime_match_libfunc (libfunc_table[LTI_eh_rtime_match])
624 #define eqhf2_libfunc (libfunc_table[LTI_eqhf2])
625 #define nehf2_libfunc (libfunc_table[LTI_nehf2])
626 #define gthf2_libfunc (libfunc_table[LTI_gthf2])
627 #define gehf2_libfunc (libfunc_table[LTI_gehf2])
628 #define lthf2_libfunc (libfunc_table[LTI_lthf2])
629 #define lehf2_libfunc (libfunc_table[LTI_lehf2])
631 #define eqsf2_libfunc (libfunc_table[LTI_eqsf2])
632 #define nesf2_libfunc (libfunc_table[LTI_nesf2])
633 #define gtsf2_libfunc (libfunc_table[LTI_gtsf2])
634 #define gesf2_libfunc (libfunc_table[LTI_gesf2])
635 #define ltsf2_libfunc (libfunc_table[LTI_ltsf2])
636 #define lesf2_libfunc (libfunc_table[LTI_lesf2])
638 #define eqdf2_libfunc (libfunc_table[LTI_eqdf2])
639 #define nedf2_libfunc (libfunc_table[LTI_nedf2])
640 #define gtdf2_libfunc (libfunc_table[LTI_gtdf2])
641 #define gedf2_libfunc (libfunc_table[LTI_gedf2])
642 #define ltdf2_libfunc (libfunc_table[LTI_ltdf2])
643 #define ledf2_libfunc (libfunc_table[LTI_ledf2])
645 #define eqxf2_libfunc (libfunc_table[LTI_eqxf2])
646 #define nexf2_libfunc (libfunc_table[LTI_nexf2])
647 #define gtxf2_libfunc (libfunc_table[LTI_gtxf2])
648 #define gexf2_libfunc (libfunc_table[LTI_gexf2])
649 #define ltxf2_libfunc (libfunc_table[LTI_ltxf2])
650 #define lexf2_libfunc (libfunc_table[LTI_lexf2])
652 #define eqtf2_libfunc (libfunc_table[LTI_eqtf2])
653 #define netf2_libfunc (libfunc_table[LTI_netf2])
654 #define gttf2_libfunc (libfunc_table[LTI_gttf2])
655 #define getf2_libfunc (libfunc_table[LTI_getf2])
656 #define lttf2_libfunc (libfunc_table[LTI_lttf2])
657 #define letf2_libfunc (libfunc_table[LTI_letf2])
659 #define floatsisf_libfunc (libfunc_table[LTI_floatsisf])
660 #define floatdisf_libfunc (libfunc_table[LTI_floatdisf])
661 #define floattisf_libfunc (libfunc_table[LTI_floattisf])
663 #define floatsidf_libfunc (libfunc_table[LTI_floatsidf])
664 #define floatdidf_libfunc (libfunc_table[LTI_floatdidf])
665 #define floattidf_libfunc (libfunc_table[LTI_floattidf])
667 #define floatsixf_libfunc (libfunc_table[LTI_floatsixf])
668 #define floatdixf_libfunc (libfunc_table[LTI_floatdixf])
669 #define floattixf_libfunc (libfunc_table[LTI_floattixf])
671 #define floatsitf_libfunc (libfunc_table[LTI_floatsitf])
672 #define floatditf_libfunc (libfunc_table[LTI_floatditf])
673 #define floattitf_libfunc (libfunc_table[LTI_floattitf])
675 #define fixsfsi_libfunc (libfunc_table[LTI_fixsfsi])
676 #define fixsfdi_libfunc (libfunc_table[LTI_fixsfdi])
677 #define fixsfti_libfunc (libfunc_table[LTI_fixsfti])
679 #define fixdfsi_libfunc (libfunc_table[LTI_fixdfsi])
680 #define fixdfdi_libfunc (libfunc_table[LTI_fixdfdi])
681 #define fixdfti_libfunc (libfunc_table[LTI_fixdfti])
683 #define fixxfsi_libfunc (libfunc_table[LTI_fixxfsi])
684 #define fixxfdi_libfunc (libfunc_table[LTI_fixxfdi])
685 #define fixxfti_libfunc (libfunc_table[LTI_fixxfti])
687 #define fixtfsi_libfunc (libfunc_table[LTI_fixtfsi])
688 #define fixtfdi_libfunc (libfunc_table[LTI_fixtfdi])
689 #define fixtfti_libfunc (libfunc_table[LTI_fixtfti])
691 #define fixunssfsi_libfunc (libfunc_table[LTI_fixunssfsi])
692 #define fixunssfdi_libfunc (libfunc_table[LTI_fixunssfdi])
693 #define fixunssfti_libfunc (libfunc_table[LTI_fixunssfti])
695 #define fixunsdfsi_libfunc (libfunc_table[LTI_fixunsdfsi])
696 #define fixunsdfdi_libfunc (libfunc_table[LTI_fixunsdfdi])
697 #define fixunsdfti_libfunc (libfunc_table[LTI_fixunsdfti])
699 #define fixunsxfsi_libfunc (libfunc_table[LTI_fixunsxfsi])
700 #define fixunsxfdi_libfunc (libfunc_table[LTI_fixunsxfdi])
701 #define fixunsxfti_libfunc (libfunc_table[LTI_fixunsxfti])
703 #define fixunstfsi_libfunc (libfunc_table[LTI_fixunstfsi])
704 #define fixunstfdi_libfunc (libfunc_table[LTI_fixunstfdi])
705 #define fixunstfti_libfunc (libfunc_table[LTI_fixunstfti])
707 #define chkr_check_addr_libfunc (libfunc_table[LTI_chkr_check_addr])
708 #define chkr_set_right_libfunc (libfunc_table[LTI_chkr_set_right])
709 #define chkr_copy_bitmap_libfunc (libfunc_table[LTI_chkr_copy_bitmap])
710 #define chkr_check_exec_libfunc (libfunc_table[LTI_chkr_check_exec])
711 #define chkr_check_str_libfunc (libfunc_table[LTI_chkr_check_str])
713 #define profile_function_entry_libfunc (libfunc_table[LTI_profile_function_entry])
714 #define profile_function_exit_libfunc (libfunc_table[LTI_profile_function_exit])
716 typedef rtx (*rtxfun
) PROTO ((rtx
));
718 /* Indexed by the rtx-code for a conditional (eg. EQ, LT,...)
719 gives the gen_function to make a branch to test that condition. */
721 extern rtxfun bcc_gen_fctn
[NUM_RTX_CODE
];
723 /* Indexed by the rtx-code for a conditional (eg. EQ, LT,...)
724 gives the insn code to make a store-condition insn
725 to test that condition. */
727 extern enum insn_code setcc_gen_code
[NUM_RTX_CODE
];
729 #ifdef HAVE_conditional_move
730 /* Indexed by the machine mode, gives the insn code to make a conditional
733 extern enum insn_code movcc_gen_code
[NUM_MACHINE_MODES
];
736 /* This array records the insn_code of insns to perform block moves. */
737 extern enum insn_code movstr_optab
[NUM_MACHINE_MODES
];
739 /* This array records the insn_code of insns to perform block clears. */
740 extern enum insn_code clrstr_optab
[NUM_MACHINE_MODES
];
742 /* Define functions given in optabs.c. */
744 /* Expand a binary operation given optab and rtx operands. */
745 extern rtx expand_binop
PROTO((enum machine_mode
, optab
, rtx
, rtx
, rtx
,
746 int, enum optab_methods
));
748 /* Expand a binary operation with both signed and unsigned forms. */
749 extern rtx sign_expand_binop
PROTO((enum machine_mode
, optab
, optab
, rtx
,
750 rtx
, rtx
, int, enum optab_methods
));
752 /* Generate code to perform an operation on two operands with two results. */
753 extern int expand_twoval_binop
PROTO((optab
, rtx
, rtx
, rtx
, rtx
, int));
755 /* Expand a unary arithmetic operation given optab rtx operand. */
756 extern rtx expand_unop
PROTO((enum machine_mode
, optab
, rtx
, rtx
, int));
758 /* Expand the absolute value operation. */
759 extern rtx expand_abs
PROTO((enum machine_mode
, rtx
, rtx
, int));
761 /* Expand the complex absolute value operation. */
762 extern rtx expand_complex_abs
PROTO((enum machine_mode
, rtx
, rtx
, int));
764 /* Generate an instruction with a given INSN_CODE with an output and
766 extern void emit_unop_insn
PROTO((int, rtx
, rtx
, enum rtx_code
));
768 /* Emit code to perform a series of operations on a multi-word quantity, one
770 extern rtx emit_no_conflict_block
PROTO((rtx
, rtx
, rtx
, rtx
, rtx
));
772 /* Emit code to make a call to a constant function or a library call. */
773 extern void emit_libcall_block
PROTO((rtx
, rtx
, rtx
, rtx
));
775 /* Emit one rtl instruction to store zero in specified rtx. */
776 extern void emit_clr_insn
PROTO((rtx
));
778 /* Emit one rtl insn to store 1 in specified rtx assuming it contains 0. */
779 extern void emit_0_to_1_insn
PROTO((rtx
));
781 /* Emit one rtl insn to compare two rtx's. */
782 extern void emit_cmp_insn
PROTO((rtx
, rtx
, enum rtx_code
, rtx
,
783 enum machine_mode
, int, int));
785 /* Emit a pair of rtl insns to compare two rtx's and to jump
786 to a label if the comparison is true. */
787 extern void emit_cmp_and_jump_insns
PROTO((rtx
, rtx
, enum rtx_code
, rtx
,
788 enum machine_mode
, int, int, rtx
));
790 /* The various uses that a comparison can have; used by can_compare_p:
791 jumps, conditional moves, store flag operations. */
792 enum can_compare_purpose
798 /* Nonzero if a compare of mode MODE can be done straightforwardly
799 (without splitting it into pieces). */
800 extern int can_compare_p
PROTO((enum machine_mode
, enum can_compare_purpose
));
802 extern void prepare_cmp_insn
PROTO((rtx
*, rtx
*, enum rtx_code
*, rtx
,
803 enum machine_mode
*, int *, int,
804 enum can_compare_purpose
));
806 extern rtx prepare_operand
PROTO((int, rtx
, int, enum machine_mode
,
807 enum machine_mode
, int));
809 /* Generate code to indirectly jump to a location given in the rtx LOC. */
810 extern void emit_indirect_jump
PROTO((rtx
));
812 #ifdef HAVE_conditional_move
813 /* Emit a conditional move operation. */
814 rtx emit_conditional_move
PROTO((rtx
, enum rtx_code
, rtx
, rtx
,
815 enum machine_mode
, rtx
, rtx
,
816 enum machine_mode
, int));
818 /* Return non-zero if the conditional move is supported. */
819 int can_conditionally_move_p
PROTO((enum machine_mode mode
));
823 /* Create but don't emit one rtl instruction to add one rtx into another.
824 Modes must match; operands must meet the operation's predicates.
825 Likewise for subtraction and for just copying.
826 These do not call protect_from_queue; caller must do so. */
827 extern rtx gen_add2_insn
PROTO((rtx
, rtx
));
828 extern rtx gen_sub2_insn
PROTO((rtx
, rtx
));
829 extern rtx gen_move_insn
PROTO((rtx
, rtx
));
830 extern int have_add2_insn
PROTO((enum machine_mode
));
831 extern int have_sub2_insn
PROTO((enum machine_mode
));
833 /* Return the INSN_CODE to use for an extend operation. */
834 extern enum insn_code can_extend_p
PROTO((enum machine_mode
,
835 enum machine_mode
, int));
837 /* Generate the body of an insn to extend Y (with mode MFROM)
838 into X (with mode MTO). Do zero-extension if UNSIGNEDP is nonzero. */
839 extern rtx gen_extend_insn
PROTO((rtx
, rtx
, enum machine_mode
,
840 enum machine_mode
, int));
842 /* Initialize the tables that control conversion between fixed and
844 extern void init_fixtab
PROTO((void));
845 extern void init_floattab
PROTO((void));
847 /* Generate code for a FLOAT_EXPR. */
848 extern void expand_float
PROTO((rtx
, rtx
, int));
850 /* Generate code for a FIX_EXPR. */
851 extern void expand_fix
PROTO((rtx
, rtx
, int));
853 /* Call this to initialize an optab function entry. */
854 extern rtx init_one_libfunc
PROTO ((const char *));
856 /* Call this once to initialize the contents of the optabs
857 appropriately for the current target machine. */
858 extern void init_optabs
PROTO((void));
860 /* Functions from expmed.c: */
862 /* Arguments MODE, RTX: return an rtx for the negation of that value.
864 extern rtx negate_rtx
PROTO((enum machine_mode
, rtx
));
866 /* Expand a logical AND operation. */
867 extern rtx expand_and
PROTO((rtx
, rtx
, rtx
));
869 /* Emit a store-flag operation. */
870 extern rtx emit_store_flag
PROTO((rtx
, enum rtx_code
, rtx
, rtx
,
871 enum machine_mode
, int, int));
873 /* Like emit_store_flag, but always succeeds. */
874 extern rtx emit_store_flag_force
PROTO((rtx
, enum rtx_code
, rtx
, rtx
,
875 enum machine_mode
, int, int));
877 /* Functions from loop.c: */
879 /* Given a JUMP_INSN, return a description of the test being made. */
880 extern rtx get_condition
PROTO((rtx
, rtx
*));
882 /* Generate a conditional trap instruction. */
883 extern rtx gen_cond_trap
PROTO((enum rtx_code
, rtx
, rtx
, rtx
));
885 /* Functions from builtins.c: */
887 extern rtx expand_builtin
PROTO((tree
, rtx
, rtx
, enum machine_mode
, int));
888 extern void std_expand_builtin_va_start
PROTO((int, tree
, rtx
));
889 extern rtx std_expand_builtin_va_arg
PROTO((tree
, tree
));
890 extern rtx expand_builtin_va_arg
PROTO((tree
, tree
));
893 extern rtx expand_builtin_setjmp
PROTO((rtx
, rtx
, rtx
, rtx
));
894 extern void expand_builtin_longjmp
PROTO ((rtx
, rtx
));
895 extern rtx expand_builtin_saveregs
PROTO((void));
896 extern int get_varargs_alias_set
PROTO((void));
898 /* Functions from expr.c: */
900 /* This is run once per compilation to set up which modes can be used
901 directly in memory and to initialize the block move optab. */
902 extern void init_expr_once
PROTO((void));
904 /* This is run at the start of compiling a function. */
905 extern void init_expr
PROTO((void));
907 /* This function is run once to initialize stor-layout.c. */
909 extern void init_stor_layout_once
PROTO((void));
911 /* This is run at the end of compiling a function. */
912 extern void finish_expr_for_function
PROTO((void));
914 /* Use protect_from_queue to convert a QUEUED expression
915 into something that you can put immediately into an instruction. */
916 extern rtx protect_from_queue
PROTO((rtx
, int));
918 /* Perform all the pending incrementations. */
919 extern void emit_queue
PROTO((void));
921 /* Tell if something has a queued subexpression. */
922 extern int queued_subexp_p
PROTO((rtx
));
924 /* Emit some rtl insns to move data between rtx's, converting machine modes.
925 Both modes must be floating or both fixed. */
926 extern void convert_move
PROTO((rtx
, rtx
, int));
928 /* Convert an rtx to specified machine mode and return the result. */
929 extern rtx convert_to_mode
PROTO((enum machine_mode
, rtx
, int));
931 /* Convert an rtx to MODE from OLDMODE and return the result. */
932 extern rtx convert_modes
PROTO((enum machine_mode
, enum machine_mode
, rtx
, int));
934 /* Emit code to move a block Y to a block X. */
935 extern rtx emit_block_move
PROTO((rtx
, rtx
, rtx
, int));
937 /* Copy all or part of a value X into registers starting at REGNO.
938 The number of registers to be filled is NREGS. */
939 extern void move_block_to_reg
PROTO((int, rtx
, int, enum machine_mode
));
941 /* Copy all or part of a BLKmode value X out of registers starting at REGNO.
942 The number of registers to be filled is NREGS. */
943 extern void move_block_from_reg
PROTO((int, rtx
, int, int));
945 /* Load a BLKmode value into non-consecutive registers represented by a
947 extern void emit_group_load
PROTO((rtx
, rtx
, int, int));
948 /* Store a BLKmode value from non-consecutive registers represented by a
950 extern void emit_group_store
PROTO((rtx
, rtx
, int, int));
953 /* Copy BLKmode object from a set of registers. */
954 extern rtx copy_blkmode_from_reg
PROTO((rtx
,rtx
,tree
));
957 /* Mark REG as holding a parameter for the next CALL_INSN. */
958 extern void use_reg
PROTO((rtx
*, rtx
));
959 /* Mark NREGS consecutive regs, starting at REGNO, as holding parameters
960 for the next CALL_INSN. */
961 extern void use_regs
PROTO((rtx
*, int, int));
962 /* Mark a PARALLEL as holding a parameter for the next CALL_INSN. */
963 extern void use_group_regs
PROTO((rtx
*, rtx
));
965 /* Write zeros through the storage of OBJECT.
966 If OBJECT has BLKmode, SIZE is its length in bytes and ALIGN is its
968 extern rtx clear_storage
PROTO((rtx
, rtx
, int));
970 /* Emit insns to set X from Y. */
971 extern rtx emit_move_insn
PROTO((rtx
, rtx
));
973 /* Emit insns to set X from Y, with no frills. */
974 extern rtx emit_move_insn_1
PROTO((rtx
, rtx
));
976 /* Push a block of length SIZE (perhaps variable)
977 and return an rtx to address the beginning of the block. */
978 extern rtx push_block
PROTO((rtx
, int, int));
980 /* Make an operand to push something on the stack. */
981 extern rtx gen_push_operand
PROTO((void));
984 /* Generate code to push something onto the stack, given its mode and type. */
985 extern void emit_push_insn
PROTO((rtx
, enum machine_mode
, tree
, rtx
, int,
986 int, rtx
, int, rtx
, rtx
, int));
988 /* Emit library call. */
989 extern void emit_library_call
PVPROTO((rtx orgfun
, int no_queue
,
990 enum machine_mode outmode
, int nargs
, ...));
991 extern rtx emit_library_call_value
PVPROTO((rtx orgfun
, rtx value
, int no_queue
,
992 enum machine_mode outmode
, int nargs
, ...));
994 /* Expand an assignment that stores the value of FROM into TO. */
995 extern rtx expand_assignment
PROTO((tree
, tree
, int, int));
997 /* Generate code for computing expression EXP,
998 and storing the value into TARGET.
999 If SUGGEST_REG is nonzero, copy the value through a register
1000 and return that register, if that is possible. */
1001 extern rtx store_expr
PROTO((tree
, rtx
, int));
1004 /* Given an rtx that may include add and multiply operations,
1005 generate them as insns and return a pseudo-reg containing the value.
1006 Useful after calling expand_expr with 1 as sum_ok. */
1007 extern rtx force_operand
PROTO((rtx
, rtx
));
1010 /* Generate code for computing expression EXP.
1011 An rtx for the computed value is returned. The value is never null.
1012 In the case of a void EXP, const0_rtx is returned. */
1013 extern rtx expand_expr
PROTO((tree
, rtx
, enum machine_mode
,
1014 enum expand_modifier
));
1017 /* At the start of a function, record that we have no previously-pushed
1018 arguments waiting to be popped. */
1019 extern void init_pending_stack_adjust
PROTO((void));
1021 /* When exiting from function, if safe, clear out any pending stack adjust
1022 so the adjustment won't get done. */
1023 extern void clear_pending_stack_adjust
PROTO((void));
1025 /* Pop any previously-pushed arguments that have not been popped yet. */
1026 extern void do_pending_stack_adjust
PROTO((void));
1029 /* Return the tree node and offset if a given argument corresponds to
1030 a string constant. */
1031 extern tree string_constant
PROTO((tree
, tree
*));
1033 /* Generate code to evaluate EXP and jump to LABEL if the value is zero. */
1034 extern void jumpifnot
PROTO((tree
, rtx
));
1036 /* Generate code to evaluate EXP and jump to LABEL if the value is nonzero. */
1037 extern void jumpif
PROTO((tree
, rtx
));
1039 /* Generate code to evaluate EXP and jump to IF_FALSE_LABEL if
1040 the result is zero, or IF_TRUE_LABEL if the result is one. */
1041 extern void do_jump
PROTO((tree
, rtx
, rtx
));
1044 /* Generate rtl to compare two rtx's, will call emit_cmp_insn. */
1045 extern rtx compare_from_rtx
PROTO((rtx
, rtx
, enum rtx_code
, int,
1046 enum machine_mode
, rtx
, int));
1047 extern void do_compare_rtx_and_jump
PROTO((rtx
, rtx
, enum rtx_code
, int,
1048 enum machine_mode
, rtx
, int,
1051 /* Generate a tablejump instruction (used for switch statements). */
1052 extern void do_tablejump
PROTO((rtx
, enum machine_mode
, rtx
, rtx
, rtx
));
1055 /* rtl.h and tree.h were included. */
1056 /* Return an rtx for the size in bytes of the value of an expr. */
1057 extern rtx expr_size
PROTO((tree
));
1059 extern rtx lookup_static_chain
PROTO((tree
));
1061 /* Convert a stack slot address ADDR valid in function FNDECL
1062 into an address valid in this function (using a static chain). */
1063 extern rtx fix_lexical_addr
PROTO((rtx
, tree
));
1065 /* Return the address of the trampoline for entering nested fn FUNCTION. */
1066 extern rtx trampoline_address
PROTO((tree
));
1068 /* Return an rtx that refers to the value returned by a function
1069 in its original home. This becomes invalid if any more code is emitted. */
1070 extern rtx hard_function_value
PROTO((tree
, tree
));
1072 extern rtx prepare_call_address
PROTO((rtx
, tree
, rtx
*, int));
1074 extern rtx expand_call
PROTO((tree
, rtx
, int));
1076 extern rtx expand_shift
PROTO((enum tree_code
, enum machine_mode
, rtx
, tree
, rtx
, int));
1077 extern rtx expand_divmod
PROTO((int, enum tree_code
, enum machine_mode
, rtx
, rtx
, rtx
, int));
1078 extern void locate_and_pad_parm
PROTO((enum machine_mode
, tree
, int, tree
, struct args_size
*, struct args_size
*, struct args_size
*));
1079 extern rtx expand_inline_function
PROTO((tree
, tree
, rtx
, int, tree
, rtx
));
1080 /* Return the CODE_LABEL rtx for a LABEL_DECL, creating it if necessary. */
1081 extern rtx label_rtx
PROTO((tree
));
1084 /* Indicate how an input argument register was promoted. */
1085 extern rtx promoted_input_arg
PROTO((int, enum machine_mode
*, int *));
1087 /* Return an rtx like arg but sans any constant terms.
1088 Returns the original rtx if it has no constant terms.
1089 The constant terms are added and stored via a second arg. */
1090 extern rtx eliminate_constant_term
PROTO((rtx
, rtx
*));
1092 /* Convert arg to a valid memory address for specified machine mode,
1093 by emitting insns to perform arithmetic if nec. */
1094 extern rtx memory_address
PROTO((enum machine_mode
, rtx
));
1096 /* Like `memory_address' but pretent `flag_force_addr' is 0. */
1097 extern rtx memory_address_noforce
PROTO((enum machine_mode
, rtx
));
1099 /* Return a memory reference like MEMREF, but with its mode changed
1100 to MODE and its address changed to ADDR.
1101 (VOIDmode means don't change the mode.
1102 NULL for ADDR means don't change the address.) */
1103 extern rtx change_address
PROTO((rtx
, enum machine_mode
, rtx
));
1105 /* Return a memory reference like MEMREF, but which is known to have a
1108 extern rtx validize_mem
PROTO((rtx
));
1110 /* Assemble the static constant template for function entry trampolines. */
1111 extern rtx assemble_trampoline_template
PROTO((void));
1113 /* Return 1 if two rtx's are equivalent in structure and elements. */
1114 extern int rtx_equal_p
PROTO((rtx
, rtx
));
1116 /* Given rtx, return new rtx whose address won't be affected by
1117 any side effects. It has been copied to a new temporary reg. */
1118 extern rtx stabilize
PROTO((rtx
));
1120 /* Given an rtx, copy all regs it refers to into new temps
1121 and return a modified copy that refers to the new temps. */
1122 extern rtx copy_all_regs
PROTO((rtx
));
1124 /* Copy given rtx to a new temp reg and return that. */
1125 extern rtx copy_to_reg
PROTO((rtx
));
1127 /* Like copy_to_reg but always make the reg Pmode. */
1128 extern rtx copy_addr_to_reg
PROTO((rtx
));
1130 /* Like copy_to_reg but always make the reg the specified mode MODE. */
1131 extern rtx copy_to_mode_reg
PROTO((enum machine_mode
, rtx
));
1133 /* Copy given rtx to given temp reg and return that. */
1134 extern rtx copy_to_suggested_reg
PROTO((rtx
, rtx
, enum machine_mode
));
1136 /* Copy a value to a register if it isn't already a register.
1137 Args are mode (in case value is a constant) and the value. */
1138 extern rtx force_reg
PROTO((enum machine_mode
, rtx
));
1140 /* Return given rtx, copied into a new temp reg if it was in memory. */
1141 extern rtx force_not_mem
PROTO((rtx
));
1144 /* Return mode and signedness to use when object is promoted. */
1145 extern enum machine_mode promote_mode
PROTO((tree
, enum machine_mode
,
1149 /* Remove some bytes from the stack. An rtx says how many. */
1150 extern void adjust_stack
PROTO((rtx
));
1152 /* Add some bytes to the stack. An rtx says how many. */
1153 extern void anti_adjust_stack
PROTO((rtx
));
1155 /* This enum is used for the following two functions. */
1156 enum save_level
{SAVE_BLOCK
, SAVE_FUNCTION
, SAVE_NONLOCAL
};
1158 /* Save the stack pointer at the specified level. */
1159 extern void emit_stack_save
PROTO((enum save_level
, rtx
*, rtx
));
1161 /* Restore the stack pointer from a save area of the specified level. */
1162 extern void emit_stack_restore
PROTO((enum save_level
, rtx
, rtx
));
1164 /* Allocate some space on the stack dynamically and return its address. An rtx
1165 says how many bytes. */
1166 extern rtx allocate_dynamic_stack_space
PROTO((rtx
, rtx
, int));
1168 /* Probe a range of stack addresses from FIRST to FIRST+SIZE, inclusive.
1169 FIRST is a constant and size is a Pmode RTX. These are offsets from the
1170 current stack pointer. STACK_GROWS_DOWNWARD says whether to add or
1171 subtract from the stack. If SIZE is constant, this is done
1172 with a fixed number of probes. Otherwise, we must make a loop. */
1173 extern void probe_stack_range
PROTO((HOST_WIDE_INT
, rtx
));
1175 /* Return an rtx that refers to the value returned by a library call
1176 in its original home. This becomes invalid if any more code is emitted. */
1177 extern rtx hard_libcall_value
PROTO((enum machine_mode
));
1179 /* Given an rtx, return an rtx for a value rounded up to a multiple
1180 of STACK_BOUNDARY / BITS_PER_UNIT. */
1181 extern rtx round_push
PROTO((rtx
));
1183 extern rtx store_bit_field
PROTO((rtx
, int, int, enum machine_mode
, rtx
, int, int));
1184 extern rtx extract_bit_field
PROTO((rtx
, int, int, int, rtx
, enum machine_mode
, enum machine_mode
, int, int));
1185 extern rtx expand_mult
PROTO((enum machine_mode
, rtx
, rtx
, rtx
, int));
1186 extern rtx expand_mult_add
PROTO((rtx
, rtx
, rtx
, rtx
,enum machine_mode
, int));
1187 extern rtx expand_mult_highpart_adjust
PROTO((enum machine_mode
, rtx
, rtx
, rtx
, rtx
, int));
1189 extern rtx assemble_static_space
PROTO((int));
1191 /* Hook called by expand_expr for language-specific tree codes.
1192 It is up to the language front end to install a hook
1193 if it has any such codes that expand_expr needs to know about. */
1194 extern rtx (*lang_expand_expr
) PROTO ((union tree_node
*, rtx
,
1196 enum expand_modifier modifier
));
1199 /* Hook called by output_constant for language-specific tree codes.
1200 It is up to the language front-end to install a hook if it has any
1201 such codes that output_constant needs to know about. Returns a
1202 language-independent constant equivalent to its input. */
1203 extern tree (*lang_expand_constant
) PROTO((tree
));
1206 extern void init_all_optabs
PROTO ((void));
1207 extern void do_jump_by_parts_equality_rtx
PROTO((rtx
, rtx
, rtx
));
1208 extern void do_jump_by_parts_greater_rtx
PROTO ((enum machine_mode
, int,
1209 rtx
, rtx
, rtx
, rtx
));
1211 #ifdef TREE_CODE /* Don't lose if tree.h not included. */
1212 extern void mark_seen_cases
PROTO ((tree
, unsigned char *,