gcc/
[official-gcc.git] / gcc / rtl.h
blob6e97dcd997825e90f4c0bbec4bffa37ca202f8a6
1 /* Register Transfer Language (RTL) definitions for GCC
2 Copyright (C) 1987-2014 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_RTL_H
21 #define GCC_RTL_H
23 #include <utility>
24 #include "statistics.h"
25 #include "machmode.h"
26 #include "input.h"
27 #include "real.h"
28 #include "vec.h"
29 #include "fixed-value.h"
30 #include "alias.h"
31 #include "hashtab.h"
32 #include "wide-int.h"
33 #include "flags.h"
35 /* Value used by some passes to "recognize" noop moves as valid
36 instructions. */
37 #define NOOP_MOVE_INSN_CODE INT_MAX
39 /* Register Transfer Language EXPRESSIONS CODES */
41 #define RTX_CODE enum rtx_code
42 enum rtx_code {
44 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) ENUM ,
45 #include "rtl.def" /* rtl expressions are documented here */
46 #undef DEF_RTL_EXPR
48 LAST_AND_UNUSED_RTX_CODE}; /* A convenient way to get a value for
49 NUM_RTX_CODE.
50 Assumes default enum value assignment. */
52 /* The cast here, saves many elsewhere. */
53 #define NUM_RTX_CODE ((int) LAST_AND_UNUSED_RTX_CODE)
55 /* Similar, but since generator files get more entries... */
56 #ifdef GENERATOR_FILE
57 # define NON_GENERATOR_NUM_RTX_CODE ((int) MATCH_OPERAND)
58 #endif
60 /* Register Transfer Language EXPRESSIONS CODE CLASSES */
62 enum rtx_class {
63 /* We check bit 0-1 of some rtx class codes in the predicates below. */
65 /* Bit 0 = comparison if 0, arithmetic is 1
66 Bit 1 = 1 if commutative. */
67 RTX_COMPARE, /* 0 */
68 RTX_COMM_COMPARE,
69 RTX_BIN_ARITH,
70 RTX_COMM_ARITH,
72 /* Must follow the four preceding values. */
73 RTX_UNARY, /* 4 */
75 RTX_EXTRA,
76 RTX_MATCH,
77 RTX_INSN,
79 /* Bit 0 = 1 if constant. */
80 RTX_OBJ, /* 8 */
81 RTX_CONST_OBJ,
83 RTX_TERNARY,
84 RTX_BITFIELD_OPS,
85 RTX_AUTOINC
88 #define RTX_OBJ_MASK (~1)
89 #define RTX_OBJ_RESULT (RTX_OBJ & RTX_OBJ_MASK)
90 #define RTX_COMPARE_MASK (~1)
91 #define RTX_COMPARE_RESULT (RTX_COMPARE & RTX_COMPARE_MASK)
92 #define RTX_ARITHMETIC_MASK (~1)
93 #define RTX_ARITHMETIC_RESULT (RTX_COMM_ARITH & RTX_ARITHMETIC_MASK)
94 #define RTX_BINARY_MASK (~3)
95 #define RTX_BINARY_RESULT (RTX_COMPARE & RTX_BINARY_MASK)
96 #define RTX_COMMUTATIVE_MASK (~2)
97 #define RTX_COMMUTATIVE_RESULT (RTX_COMM_COMPARE & RTX_COMMUTATIVE_MASK)
98 #define RTX_NON_COMMUTATIVE_RESULT (RTX_COMPARE & RTX_COMMUTATIVE_MASK)
100 extern const unsigned char rtx_length[NUM_RTX_CODE];
101 #define GET_RTX_LENGTH(CODE) (rtx_length[(int) (CODE)])
103 extern const char * const rtx_name[NUM_RTX_CODE];
104 #define GET_RTX_NAME(CODE) (rtx_name[(int) (CODE)])
106 extern const char * const rtx_format[NUM_RTX_CODE];
107 #define GET_RTX_FORMAT(CODE) (rtx_format[(int) (CODE)])
109 extern const enum rtx_class rtx_class[NUM_RTX_CODE];
110 #define GET_RTX_CLASS(CODE) (rtx_class[(int) (CODE)])
112 /* True if CODE is part of the insn chain (i.e. has INSN_UID, PREV_INSN
113 and NEXT_INSN fields). */
114 #define INSN_CHAIN_CODE_P(CODE) IN_RANGE (CODE, DEBUG_INSN, NOTE)
116 extern const unsigned char rtx_code_size[NUM_RTX_CODE];
117 extern const unsigned char rtx_next[NUM_RTX_CODE];
119 /* The flags and bitfields of an ADDR_DIFF_VEC. BASE is the base label
120 relative to which the offsets are calculated, as explained in rtl.def. */
121 struct addr_diff_vec_flags
123 /* Set at the start of shorten_branches - ONLY WHEN OPTIMIZING - : */
124 unsigned min_align: 8;
125 /* Flags: */
126 unsigned base_after_vec: 1; /* BASE is after the ADDR_DIFF_VEC. */
127 unsigned min_after_vec: 1; /* minimum address target label is
128 after the ADDR_DIFF_VEC. */
129 unsigned max_after_vec: 1; /* maximum address target label is
130 after the ADDR_DIFF_VEC. */
131 unsigned min_after_base: 1; /* minimum address target label is
132 after BASE. */
133 unsigned max_after_base: 1; /* maximum address target label is
134 after BASE. */
135 /* Set by the actual branch shortening process - ONLY WHEN OPTIMIZING - : */
136 unsigned offset_unsigned: 1; /* offsets have to be treated as unsigned. */
137 unsigned : 2;
138 unsigned scale : 8;
141 /* Structure used to describe the attributes of a MEM. These are hashed
142 so MEMs that the same attributes share a data structure. This means
143 they cannot be modified in place. */
144 struct GTY(()) mem_attrs
146 /* The expression that the MEM accesses, or null if not known.
147 This expression might be larger than the memory reference itself.
148 (In other words, the MEM might access only part of the object.) */
149 tree expr;
151 /* The offset of the memory reference from the start of EXPR.
152 Only valid if OFFSET_KNOWN_P. */
153 HOST_WIDE_INT offset;
155 /* The size of the memory reference in bytes. Only valid if
156 SIZE_KNOWN_P. */
157 HOST_WIDE_INT size;
159 /* The alias set of the memory reference. */
160 alias_set_type alias;
162 /* The alignment of the reference in bits. Always a multiple of
163 BITS_PER_UNIT. Note that EXPR may have a stricter alignment
164 than the memory reference itself. */
165 unsigned int align;
167 /* The address space that the memory reference uses. */
168 unsigned char addrspace;
170 /* True if OFFSET is known. */
171 bool offset_known_p;
173 /* True if SIZE is known. */
174 bool size_known_p;
177 /* Structure used to describe the attributes of a REG in similar way as
178 mem_attrs does for MEM above. Note that the OFFSET field is calculated
179 in the same way as for mem_attrs, rather than in the same way as a
180 SUBREG_BYTE. For example, if a big-endian target stores a byte
181 object in the low part of a 4-byte register, the OFFSET field
182 will be -3 rather than 0. */
184 struct GTY(()) reg_attrs {
185 tree decl; /* decl corresponding to REG. */
186 HOST_WIDE_INT offset; /* Offset from start of DECL. */
189 /* Common union for an element of an rtx. */
191 union rtunion
193 int rt_int;
194 unsigned int rt_uint;
195 const char *rt_str;
196 rtx rt_rtx;
197 rtvec rt_rtvec;
198 enum machine_mode rt_type;
199 addr_diff_vec_flags rt_addr_diff_vec_flags;
200 struct cselib_val *rt_cselib;
201 tree rt_tree;
202 basic_block rt_bb;
203 mem_attrs *rt_mem;
204 reg_attrs *rt_reg;
205 struct constant_descriptor_rtx *rt_constant;
206 struct dw_cfi_node *rt_cfi;
209 /* This structure remembers the position of a SYMBOL_REF within an
210 object_block structure. A SYMBOL_REF only provides this information
211 if SYMBOL_REF_HAS_BLOCK_INFO_P is true. */
212 struct GTY(()) block_symbol {
213 /* The usual SYMBOL_REF fields. */
214 rtunion GTY ((skip)) fld[3];
216 /* The block that contains this object. */
217 struct object_block *block;
219 /* The offset of this object from the start of its block. It is negative
220 if the symbol has not yet been assigned an offset. */
221 HOST_WIDE_INT offset;
224 /* Describes a group of objects that are to be placed together in such
225 a way that their relative positions are known. */
226 struct GTY(()) object_block {
227 /* The section in which these objects should be placed. */
228 section *sect;
230 /* The alignment of the first object, measured in bits. */
231 unsigned int alignment;
233 /* The total size of the objects, measured in bytes. */
234 HOST_WIDE_INT size;
236 /* The SYMBOL_REFs for each object. The vector is sorted in
237 order of increasing offset and the following conditions will
238 hold for each element X:
240 SYMBOL_REF_HAS_BLOCK_INFO_P (X)
241 !SYMBOL_REF_ANCHOR_P (X)
242 SYMBOL_REF_BLOCK (X) == [address of this structure]
243 SYMBOL_REF_BLOCK_OFFSET (X) >= 0. */
244 vec<rtx, va_gc> *objects;
246 /* All the anchor SYMBOL_REFs used to address these objects, sorted
247 in order of increasing offset, and then increasing TLS model.
248 The following conditions will hold for each element X in this vector:
250 SYMBOL_REF_HAS_BLOCK_INFO_P (X)
251 SYMBOL_REF_ANCHOR_P (X)
252 SYMBOL_REF_BLOCK (X) == [address of this structure]
253 SYMBOL_REF_BLOCK_OFFSET (X) >= 0. */
254 vec<rtx, va_gc> *anchors;
257 struct GTY((variable_size)) hwivec_def {
258 HOST_WIDE_INT elem[1];
261 /* Number of elements of the HWIVEC if RTX is a CONST_WIDE_INT. */
262 #define CWI_GET_NUM_ELEM(RTX) \
263 ((int)RTL_FLAG_CHECK1("CWI_GET_NUM_ELEM", (RTX), CONST_WIDE_INT)->u2.num_elem)
264 #define CWI_PUT_NUM_ELEM(RTX, NUM) \
265 (RTL_FLAG_CHECK1("CWI_PUT_NUM_ELEM", (RTX), CONST_WIDE_INT)->u2.num_elem = (NUM))
267 /* RTL expression ("rtx"). */
269 struct GTY((chain_next ("RTX_NEXT (&%h)"),
270 chain_prev ("RTX_PREV (&%h)"), variable_size)) rtx_def {
271 /* The kind of expression this is. */
272 ENUM_BITFIELD(rtx_code) code: 16;
274 /* The kind of value the expression has. */
275 ENUM_BITFIELD(machine_mode) mode : 8;
277 /* 1 in a MEM if we should keep the alias set for this mem unchanged
278 when we access a component.
279 1 in a CALL_INSN if it is a sibling call.
280 1 in a SET that is for a return.
281 In a CODE_LABEL, part of the two-bit alternate entry field.
282 1 in a CONCAT is VAL_EXPR_IS_COPIED in var-tracking.c.
283 1 in a VALUE is SP_BASED_VALUE_P in cselib.c.
284 1 in a SUBREG generated by LRA for reload insns. */
285 unsigned int jump : 1;
286 /* In a CODE_LABEL, part of the two-bit alternate entry field.
287 1 in a MEM if it cannot trap.
288 1 in a CALL_INSN logically equivalent to
289 ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P. */
290 unsigned int call : 1;
291 /* 1 in a REG, MEM, or CONCAT if the value is set at most once, anywhere.
292 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P.
293 1 in a SYMBOL_REF if it addresses something in the per-function
294 constants pool.
295 1 in a CALL_INSN logically equivalent to ECF_CONST and TREE_READONLY.
296 1 in a NOTE, or EXPR_LIST for a const call.
297 1 in a JUMP_INSN of an annulling branch.
298 1 in a CONCAT is VAL_EXPR_IS_CLOBBERED in var-tracking.c.
299 1 in a preserved VALUE is PRESERVED_VALUE_P in cselib.c.
300 1 in a clobber temporarily created for LRA. */
301 unsigned int unchanging : 1;
302 /* 1 in a MEM or ASM_OPERANDS expression if the memory reference is volatile.
303 1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL, BARRIER, or NOTE
304 if it has been deleted.
305 1 in a REG expression if corresponds to a variable declared by the user,
306 0 for an internally generated temporary.
307 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P.
308 1 in a LABEL_REF, REG_LABEL_TARGET or REG_LABEL_OPERAND note for a
309 non-local label.
310 In a SYMBOL_REF, this flag is used for machine-specific purposes.
311 In a PREFETCH, this flag indicates that it should be considered a scheduling
312 barrier.
313 1 in a CONCAT is VAL_NEEDS_RESOLUTION in var-tracking.c. */
314 unsigned int volatil : 1;
315 /* 1 in a REG if the register is used only in exit code a loop.
316 1 in a SUBREG expression if was generated from a variable with a
317 promoted mode.
318 1 in a CODE_LABEL if the label is used for nonlocal gotos
319 and must not be deleted even if its count is zero.
320 1 in an INSN, JUMP_INSN or CALL_INSN if this insn must be scheduled
321 together with the preceding insn. Valid only within sched.
322 1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and
323 from the target of a branch. Valid from reorg until end of compilation;
324 cleared before used.
326 The name of the field is historical. It used to be used in MEMs
327 to record whether the MEM accessed part of a structure. */
328 unsigned int in_struct : 1;
329 /* At the end of RTL generation, 1 if this rtx is used. This is used for
330 copying shared structure. See `unshare_all_rtl'.
331 In a REG, this is not needed for that purpose, and used instead
332 in `leaf_renumber_regs_insn'.
333 1 in a SYMBOL_REF, means that emit_library_call
334 has used it as the function.
335 1 in a CONCAT is VAL_HOLDS_TRACK_EXPR in var-tracking.c.
336 1 in a VALUE or DEBUG_EXPR is VALUE_RECURSED_INTO in var-tracking.c. */
337 unsigned int used : 1;
338 /* 1 in an INSN or a SET if this rtx is related to the call frame,
339 either changing how we compute the frame address or saving and
340 restoring registers in the prologue and epilogue.
341 1 in a REG or MEM if it is a pointer.
342 1 in a SYMBOL_REF if it addresses something in the per-function
343 constant string pool.
344 1 in a VALUE is VALUE_CHANGED in var-tracking.c. */
345 unsigned frame_related : 1;
346 /* 1 in a REG or PARALLEL that is the current function's return value.
347 1 in a SYMBOL_REF for a weak symbol.
348 1 in a CALL_INSN logically equivalent to ECF_PURE and DECL_PURE_P.
349 1 in a CONCAT is VAL_EXPR_HAS_REVERSE in var-tracking.c.
350 1 in a VALUE or DEBUG_EXPR is NO_LOC_P in var-tracking.c. */
351 unsigned return_val : 1;
353 union {
354 /* The final union field is aligned to 64 bits on LP64 hosts,
355 giving a 32-bit gap after the fields above. We optimize the
356 layout for that case and use the gap for extra code-specific
357 information. */
359 /* The ORIGINAL_REGNO of a REG. */
360 unsigned int original_regno;
362 /* The INSN_UID of an RTX_INSN-class code. */
363 int insn_uid;
365 /* The PAT_VAR_LOCATION_STATUS of a VAR_LOCATION. */
366 enum var_init_status var_location_status;
368 /* In a CONST_WIDE_INT (aka hwivec_def), this is the number of
369 HOST_WIDE_INTs in the hwivec_def. */
370 unsigned int num_elem;
371 } GTY ((skip)) u2;
373 /* The first element of the operands of this rtx.
374 The number of operands and their types are controlled
375 by the `code' field, according to rtl.def. */
376 union u {
377 rtunion fld[1];
378 HOST_WIDE_INT hwint[1];
379 struct block_symbol block_sym;
380 struct real_value rv;
381 struct fixed_value fv;
382 struct hwivec_def hwiv;
383 } GTY ((special ("rtx_def"), desc ("GET_CODE (&%0)"))) u;
386 /* The size in bytes of an rtx header (code, mode and flags). */
387 #define RTX_HDR_SIZE offsetof (struct rtx_def, u)
389 /* The size in bytes of an rtx with code CODE. */
390 #define RTX_CODE_SIZE(CODE) rtx_code_size[CODE]
392 #define NULL_RTX (rtx) 0
394 /* The "next" and "previous" RTX, relative to this one. */
396 #define RTX_NEXT(X) (rtx_next[GET_CODE (X)] == 0 ? NULL \
397 : *(rtx *)(((char *)X) + rtx_next[GET_CODE (X)]))
399 /* FIXME: the "NEXT_INSN (PREV_INSN (X)) == X" condition shouldn't be needed.
401 #define RTX_PREV(X) ((INSN_P (X) \
402 || NOTE_P (X) \
403 || JUMP_TABLE_DATA_P (X) \
404 || BARRIER_P (X) \
405 || LABEL_P (X)) \
406 && PREV_INSN (X) != NULL \
407 && NEXT_INSN (PREV_INSN (X)) == X \
408 ? PREV_INSN (X) : NULL)
410 /* Define macros to access the `code' field of the rtx. */
412 #define GET_CODE(RTX) ((enum rtx_code) (RTX)->code)
413 #define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE))
415 #define GET_MODE(RTX) ((enum machine_mode) (RTX)->mode)
416 #define PUT_MODE(RTX, MODE) ((RTX)->mode = (MODE))
418 /* RTL vector. These appear inside RTX's when there is a need
419 for a variable number of things. The principle use is inside
420 PARALLEL expressions. */
422 struct GTY((variable_size)) rtvec_def {
423 int num_elem; /* number of elements */
424 rtx GTY ((length ("%h.num_elem"))) elem[1];
427 #define NULL_RTVEC (rtvec) 0
429 #define GET_NUM_ELEM(RTVEC) ((RTVEC)->num_elem)
430 #define PUT_NUM_ELEM(RTVEC, NUM) ((RTVEC)->num_elem = (NUM))
432 /* Predicate yielding nonzero iff X is an rtx for a register. */
433 #define REG_P(X) (GET_CODE (X) == REG)
435 /* Predicate yielding nonzero iff X is an rtx for a memory location. */
436 #define MEM_P(X) (GET_CODE (X) == MEM)
438 #if TARGET_SUPPORTS_WIDE_INT
440 /* Match CONST_*s that can represent compile-time constant integers. */
441 #define CASE_CONST_SCALAR_INT \
442 case CONST_INT: \
443 case CONST_WIDE_INT
445 /* Match CONST_*s for which pointer equality corresponds to value
446 equality. */
447 #define CASE_CONST_UNIQUE \
448 case CONST_INT: \
449 case CONST_WIDE_INT: \
450 case CONST_DOUBLE: \
451 case CONST_FIXED
453 /* Match all CONST_* rtxes. */
454 #define CASE_CONST_ANY \
455 case CONST_INT: \
456 case CONST_WIDE_INT: \
457 case CONST_DOUBLE: \
458 case CONST_FIXED: \
459 case CONST_VECTOR
461 #else
463 /* Match CONST_*s that can represent compile-time constant integers. */
464 #define CASE_CONST_SCALAR_INT \
465 case CONST_INT: \
466 case CONST_DOUBLE
468 /* Match CONST_*s for which pointer equality corresponds to value
469 equality. */
470 #define CASE_CONST_UNIQUE \
471 case CONST_INT: \
472 case CONST_DOUBLE: \
473 case CONST_FIXED
475 /* Match all CONST_* rtxes. */
476 #define CASE_CONST_ANY \
477 case CONST_INT: \
478 case CONST_DOUBLE: \
479 case CONST_FIXED: \
480 case CONST_VECTOR
481 #endif
483 /* Predicate yielding nonzero iff X is an rtx for a constant integer. */
484 #define CONST_INT_P(X) (GET_CODE (X) == CONST_INT)
486 /* Predicate yielding nonzero iff X is an rtx for a constant integer. */
487 #define CONST_WIDE_INT_P(X) (GET_CODE (X) == CONST_WIDE_INT)
489 /* Predicate yielding nonzero iff X is an rtx for a constant fixed-point. */
490 #define CONST_FIXED_P(X) (GET_CODE (X) == CONST_FIXED)
492 /* Predicate yielding true iff X is an rtx for a double-int
493 or floating point constant. */
494 #define CONST_DOUBLE_P(X) (GET_CODE (X) == CONST_DOUBLE)
496 /* Predicate yielding true iff X is an rtx for a double-int. */
497 #define CONST_DOUBLE_AS_INT_P(X) \
498 (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == VOIDmode)
500 /* Predicate yielding true iff X is an rtx for a integer const. */
501 #if TARGET_SUPPORTS_WIDE_INT
502 #define CONST_SCALAR_INT_P(X) \
503 (CONST_INT_P (X) || CONST_WIDE_INT_P (X))
504 #else
505 #define CONST_SCALAR_INT_P(X) \
506 (CONST_INT_P (X) || CONST_DOUBLE_AS_INT_P (X))
507 #endif
509 /* Predicate yielding true iff X is an rtx for a double-int. */
510 #define CONST_DOUBLE_AS_FLOAT_P(X) \
511 (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode)
513 /* Predicate yielding nonzero iff X is a label insn. */
514 #define LABEL_P(X) (GET_CODE (X) == CODE_LABEL)
516 /* Predicate yielding nonzero iff X is a jump insn. */
517 #define JUMP_P(X) (GET_CODE (X) == JUMP_INSN)
519 /* Predicate yielding nonzero iff X is a call insn. */
520 #define CALL_P(X) (GET_CODE (X) == CALL_INSN)
522 /* Predicate yielding nonzero iff X is an insn that cannot jump. */
523 #define NONJUMP_INSN_P(X) (GET_CODE (X) == INSN)
525 /* Predicate yielding nonzero iff X is a debug note/insn. */
526 #define DEBUG_INSN_P(X) (GET_CODE (X) == DEBUG_INSN)
528 /* Predicate yielding nonzero iff X is an insn that is not a debug insn. */
529 #define NONDEBUG_INSN_P(X) (INSN_P (X) && !DEBUG_INSN_P (X))
531 /* Nonzero if DEBUG_INSN_P may possibly hold. */
532 #define MAY_HAVE_DEBUG_INSNS (flag_var_tracking_assignments)
534 /* Predicate yielding nonzero iff X is a real insn. */
535 #define INSN_P(X) \
536 (NONJUMP_INSN_P (X) || DEBUG_INSN_P (X) || JUMP_P (X) || CALL_P (X))
538 /* Predicate yielding nonzero iff X is a note insn. */
539 #define NOTE_P(X) (GET_CODE (X) == NOTE)
541 /* Predicate yielding nonzero iff X is a barrier insn. */
542 #define BARRIER_P(X) (GET_CODE (X) == BARRIER)
544 /* Predicate yielding nonzero iff X is a data for a jump table. */
545 #define JUMP_TABLE_DATA_P(INSN) (GET_CODE (INSN) == JUMP_TABLE_DATA)
547 /* Predicate yielding nonzero iff X is a return or simple_return. */
548 #define ANY_RETURN_P(X) \
549 (GET_CODE (X) == RETURN || GET_CODE (X) == SIMPLE_RETURN)
551 /* 1 if X is a unary operator. */
553 #define UNARY_P(X) \
554 (GET_RTX_CLASS (GET_CODE (X)) == RTX_UNARY)
556 /* 1 if X is a binary operator. */
558 #define BINARY_P(X) \
559 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_BINARY_MASK) == RTX_BINARY_RESULT)
561 /* 1 if X is an arithmetic operator. */
563 #define ARITHMETIC_P(X) \
564 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_ARITHMETIC_MASK) \
565 == RTX_ARITHMETIC_RESULT)
567 /* 1 if X is an arithmetic operator. */
569 #define COMMUTATIVE_ARITH_P(X) \
570 (GET_RTX_CLASS (GET_CODE (X)) == RTX_COMM_ARITH)
572 /* 1 if X is a commutative arithmetic operator or a comparison operator.
573 These two are sometimes selected together because it is possible to
574 swap the two operands. */
576 #define SWAPPABLE_OPERANDS_P(X) \
577 ((1 << GET_RTX_CLASS (GET_CODE (X))) \
578 & ((1 << RTX_COMM_ARITH) | (1 << RTX_COMM_COMPARE) \
579 | (1 << RTX_COMPARE)))
581 /* 1 if X is a non-commutative operator. */
583 #define NON_COMMUTATIVE_P(X) \
584 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \
585 == RTX_NON_COMMUTATIVE_RESULT)
587 /* 1 if X is a commutative operator on integers. */
589 #define COMMUTATIVE_P(X) \
590 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \
591 == RTX_COMMUTATIVE_RESULT)
593 /* 1 if X is a relational operator. */
595 #define COMPARISON_P(X) \
596 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMPARE_MASK) == RTX_COMPARE_RESULT)
598 /* 1 if X is a constant value that is an integer. */
600 #define CONSTANT_P(X) \
601 (GET_RTX_CLASS (GET_CODE (X)) == RTX_CONST_OBJ)
603 /* 1 if X can be used to represent an object. */
604 #define OBJECT_P(X) \
605 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_OBJ_MASK) == RTX_OBJ_RESULT)
607 /* General accessor macros for accessing the fields of an rtx. */
609 #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
610 /* The bit with a star outside the statement expr and an & inside is
611 so that N can be evaluated only once. */
612 #define RTL_CHECK1(RTX, N, C1) __extension__ \
613 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
614 const enum rtx_code _code = GET_CODE (_rtx); \
615 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
616 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
617 __FUNCTION__); \
618 if (GET_RTX_FORMAT (_code)[_n] != C1) \
619 rtl_check_failed_type1 (_rtx, _n, C1, __FILE__, __LINE__, \
620 __FUNCTION__); \
621 &_rtx->u.fld[_n]; }))
623 #define RTL_CHECK2(RTX, N, C1, C2) __extension__ \
624 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
625 const enum rtx_code _code = GET_CODE (_rtx); \
626 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
627 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
628 __FUNCTION__); \
629 if (GET_RTX_FORMAT (_code)[_n] != C1 \
630 && GET_RTX_FORMAT (_code)[_n] != C2) \
631 rtl_check_failed_type2 (_rtx, _n, C1, C2, __FILE__, __LINE__, \
632 __FUNCTION__); \
633 &_rtx->u.fld[_n]; }))
635 #define RTL_CHECKC1(RTX, N, C) __extension__ \
636 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
637 if (GET_CODE (_rtx) != (C)) \
638 rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
639 __FUNCTION__); \
640 &_rtx->u.fld[_n]; }))
642 #define RTL_CHECKC2(RTX, N, C1, C2) __extension__ \
643 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
644 const enum rtx_code _code = GET_CODE (_rtx); \
645 if (_code != (C1) && _code != (C2)) \
646 rtl_check_failed_code2 (_rtx, (C1), (C2), __FILE__, __LINE__, \
647 __FUNCTION__); \
648 &_rtx->u.fld[_n]; }))
650 #define RTVEC_ELT(RTVEC, I) __extension__ \
651 (*({ __typeof (RTVEC) const _rtvec = (RTVEC); const int _i = (I); \
652 if (_i < 0 || _i >= GET_NUM_ELEM (_rtvec)) \
653 rtvec_check_failed_bounds (_rtvec, _i, __FILE__, __LINE__, \
654 __FUNCTION__); \
655 &_rtvec->elem[_i]; }))
657 #define XWINT(RTX, N) __extension__ \
658 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
659 const enum rtx_code _code = GET_CODE (_rtx); \
660 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
661 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
662 __FUNCTION__); \
663 if (GET_RTX_FORMAT (_code)[_n] != 'w') \
664 rtl_check_failed_type1 (_rtx, _n, 'w', __FILE__, __LINE__, \
665 __FUNCTION__); \
666 &_rtx->u.hwint[_n]; }))
668 #define CWI_ELT(RTX, I) __extension__ \
669 (*({ __typeof (RTX) const _cwi = (RTX); \
670 int _max = CWI_GET_NUM_ELEM (_cwi); \
671 const int _i = (I); \
672 if (_i < 0 || _i >= _max) \
673 cwi_check_failed_bounds (_cwi, _i, __FILE__, __LINE__, \
674 __FUNCTION__); \
675 &_cwi->u.hwiv.elem[_i]; }))
677 #define XCWINT(RTX, N, C) __extension__ \
678 (*({ __typeof (RTX) const _rtx = (RTX); \
679 if (GET_CODE (_rtx) != (C)) \
680 rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
681 __FUNCTION__); \
682 &_rtx->u.hwint[N]; }))
684 #define XCMWINT(RTX, N, C, M) __extension__ \
685 (*({ __typeof (RTX) const _rtx = (RTX); \
686 if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) != (M)) \
687 rtl_check_failed_code_mode (_rtx, (C), (M), false, __FILE__, \
688 __LINE__, __FUNCTION__); \
689 &_rtx->u.hwint[N]; }))
691 #define XCNMPRV(RTX, C, M) __extension__ \
692 ({ __typeof (RTX) const _rtx = (RTX); \
693 if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \
694 rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \
695 __LINE__, __FUNCTION__); \
696 &_rtx->u.rv; })
698 #define XCNMPFV(RTX, C, M) __extension__ \
699 ({ __typeof (RTX) const _rtx = (RTX); \
700 if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \
701 rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \
702 __LINE__, __FUNCTION__); \
703 &_rtx->u.fv; })
705 #define BLOCK_SYMBOL_CHECK(RTX) __extension__ \
706 ({ __typeof (RTX) const _symbol = (RTX); \
707 const unsigned int flags = RTL_CHECKC1 (_symbol, 1, SYMBOL_REF).rt_int; \
708 if ((flags & SYMBOL_FLAG_HAS_BLOCK_INFO) == 0) \
709 rtl_check_failed_block_symbol (__FILE__, __LINE__, \
710 __FUNCTION__); \
711 &_symbol->u.block_sym; })
713 #define HWIVEC_CHECK(RTX,C) __extension__ \
714 ({ __typeof (RTX) const _symbol = (RTX); \
715 RTL_CHECKC1 (_symbol, 0, C); \
716 &_symbol->u.hwiv; })
718 extern void rtl_check_failed_bounds (const_rtx, int, const char *, int,
719 const char *)
720 ATTRIBUTE_NORETURN;
721 extern void rtl_check_failed_type1 (const_rtx, int, int, const char *, int,
722 const char *)
723 ATTRIBUTE_NORETURN;
724 extern void rtl_check_failed_type2 (const_rtx, int, int, int, const char *,
725 int, const char *)
726 ATTRIBUTE_NORETURN;
727 extern void rtl_check_failed_code1 (const_rtx, enum rtx_code, const char *,
728 int, const char *)
729 ATTRIBUTE_NORETURN;
730 extern void rtl_check_failed_code2 (const_rtx, enum rtx_code, enum rtx_code,
731 const char *, int, const char *)
732 ATTRIBUTE_NORETURN;
733 extern void rtl_check_failed_code_mode (const_rtx, enum rtx_code, enum machine_mode,
734 bool, const char *, int, const char *)
735 ATTRIBUTE_NORETURN;
736 extern void rtl_check_failed_block_symbol (const char *, int, const char *)
737 ATTRIBUTE_NORETURN;
738 extern void cwi_check_failed_bounds (const_rtx, int, const char *, int,
739 const char *)
740 ATTRIBUTE_NORETURN;
741 extern void rtvec_check_failed_bounds (const_rtvec, int, const char *, int,
742 const char *)
743 ATTRIBUTE_NORETURN;
745 #else /* not ENABLE_RTL_CHECKING */
747 #define RTL_CHECK1(RTX, N, C1) ((RTX)->u.fld[N])
748 #define RTL_CHECK2(RTX, N, C1, C2) ((RTX)->u.fld[N])
749 #define RTL_CHECKC1(RTX, N, C) ((RTX)->u.fld[N])
750 #define RTL_CHECKC2(RTX, N, C1, C2) ((RTX)->u.fld[N])
751 #define RTVEC_ELT(RTVEC, I) ((RTVEC)->elem[I])
752 #define XWINT(RTX, N) ((RTX)->u.hwint[N])
753 #define CWI_ELT(RTX, I) ((RTX)->u.hwiv.elem[I])
754 #define XCWINT(RTX, N, C) ((RTX)->u.hwint[N])
755 #define XCMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
756 #define XCNMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
757 #define XCNMPRV(RTX, C, M) (&(RTX)->u.rv)
758 #define XCNMPFV(RTX, C, M) (&(RTX)->u.fv)
759 #define BLOCK_SYMBOL_CHECK(RTX) (&(RTX)->u.block_sym)
760 #define HWIVEC_CHECK(RTX,C) (&(RTX)->u.hwiv)
762 #endif
764 /* General accessor macros for accessing the flags of an rtx. */
766 /* Access an individual rtx flag, with no checking of any kind. */
767 #define RTX_FLAG(RTX, FLAG) ((RTX)->FLAG)
769 #if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION >= 2007)
770 #define RTL_FLAG_CHECK1(NAME, RTX, C1) __extension__ \
771 ({ __typeof (RTX) const _rtx = (RTX); \
772 if (GET_CODE (_rtx) != C1) \
773 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
774 __FUNCTION__); \
775 _rtx; })
777 #define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) __extension__ \
778 ({ __typeof (RTX) const _rtx = (RTX); \
779 if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2) \
780 rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
781 __FUNCTION__); \
782 _rtx; })
784 #define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) __extension__ \
785 ({ __typeof (RTX) const _rtx = (RTX); \
786 if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \
787 && GET_CODE (_rtx) != C3) \
788 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
789 __FUNCTION__); \
790 _rtx; })
792 #define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) __extension__ \
793 ({ __typeof (RTX) const _rtx = (RTX); \
794 if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \
795 && GET_CODE (_rtx) != C3 && GET_CODE(_rtx) != C4) \
796 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
797 __FUNCTION__); \
798 _rtx; })
800 #define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) __extension__ \
801 ({ __typeof (RTX) const _rtx = (RTX); \
802 if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
803 && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
804 && GET_CODE (_rtx) != C5) \
805 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
806 __FUNCTION__); \
807 _rtx; })
809 #define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) \
810 __extension__ \
811 ({ __typeof (RTX) const _rtx = (RTX); \
812 if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
813 && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
814 && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6) \
815 rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
816 __FUNCTION__); \
817 _rtx; })
819 #define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) \
820 __extension__ \
821 ({ __typeof (RTX) const _rtx = (RTX); \
822 if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
823 && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
824 && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6 \
825 && GET_CODE (_rtx) != C7) \
826 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
827 __FUNCTION__); \
828 _rtx; })
830 #define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) \
831 __extension__ \
832 ({ __typeof (RTX) const _rtx = (RTX); \
833 if (!INSN_CHAIN_CODE_P (GET_CODE (_rtx))) \
834 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
835 __FUNCTION__); \
836 _rtx; })
838 extern void rtl_check_failed_flag (const char *, const_rtx, const char *,
839 int, const char *)
840 ATTRIBUTE_NORETURN
843 #else /* not ENABLE_RTL_FLAG_CHECKING */
845 #define RTL_FLAG_CHECK1(NAME, RTX, C1) (RTX)
846 #define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) (RTX)
847 #define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) (RTX)
848 #define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) (RTX)
849 #define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) (RTX)
850 #define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) (RTX)
851 #define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) (RTX)
852 #define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) (RTX)
853 #endif
855 #define XINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rt_int)
856 #define XUINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rt_uint)
857 #define XSTR(RTX, N) (RTL_CHECK2 (RTX, N, 's', 'S').rt_str)
858 #define XEXP(RTX, N) (RTL_CHECK2 (RTX, N, 'e', 'u').rt_rtx)
859 #define XVEC(RTX, N) (RTL_CHECK2 (RTX, N, 'E', 'V').rt_rtvec)
860 #define XMODE(RTX, N) (RTL_CHECK1 (RTX, N, 'M').rt_type)
861 #define XTREE(RTX, N) (RTL_CHECK1 (RTX, N, 't').rt_tree)
862 #define XBBDEF(RTX, N) (RTL_CHECK1 (RTX, N, 'B').rt_bb)
863 #define XTMPL(RTX, N) (RTL_CHECK1 (RTX, N, 'T').rt_str)
864 #define XCFI(RTX, N) (RTL_CHECK1 (RTX, N, 'C').rt_cfi)
866 #define XVECEXP(RTX, N, M) RTVEC_ELT (XVEC (RTX, N), M)
867 #define XVECLEN(RTX, N) GET_NUM_ELEM (XVEC (RTX, N))
869 /* These are like XINT, etc. except that they expect a '0' field instead
870 of the normal type code. */
872 #define X0INT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_int)
873 #define X0UINT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_uint)
874 #define X0STR(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_str)
875 #define X0EXP(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtx)
876 #define X0VEC(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtvec)
877 #define X0MODE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_type)
878 #define X0TREE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_tree)
879 #define X0BBDEF(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_bb)
880 #define X0ADVFLAGS(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_addr_diff_vec_flags)
881 #define X0CSELIB(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_cselib)
882 #define X0MEMATTR(RTX, N) (RTL_CHECKC1 (RTX, N, MEM).rt_mem)
883 #define X0REGATTR(RTX, N) (RTL_CHECKC1 (RTX, N, REG).rt_reg)
884 #define X0CONSTANT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_constant)
886 /* Access a '0' field with any type. */
887 #define X0ANY(RTX, N) RTL_CHECK1 (RTX, N, '0')
889 #define XCINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_int)
890 #define XCUINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_uint)
891 #define XCSTR(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_str)
892 #define XCEXP(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtx)
893 #define XCVEC(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtvec)
894 #define XCMODE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_type)
895 #define XCTREE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_tree)
896 #define XCBBDEF(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_bb)
897 #define XCCFI(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_cfi)
898 #define XCCSELIB(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_cselib)
900 #define XCVECEXP(RTX, N, M, C) RTVEC_ELT (XCVEC (RTX, N, C), M)
901 #define XCVECLEN(RTX, N, C) GET_NUM_ELEM (XCVEC (RTX, N, C))
903 #define XC2EXP(RTX, N, C1, C2) (RTL_CHECKC2 (RTX, N, C1, C2).rt_rtx)
905 /* ACCESS MACROS for particular fields of insns. */
907 /* Holds a unique number for each insn.
908 These are not necessarily sequentially increasing. */
909 #define INSN_UID(INSN) \
910 (RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID", (INSN))->u2.insn_uid)
912 /* Chain insns together in sequence. */
913 #define PREV_INSN(INSN) XEXP (INSN, 0)
914 #define NEXT_INSN(INSN) XEXP (INSN, 1)
916 #define BLOCK_FOR_INSN(INSN) XBBDEF (INSN, 2)
918 /* The body of an insn. */
919 #define PATTERN(INSN) XEXP (INSN, 3)
921 #define INSN_LOCATION(INSN) XUINT (INSN, 4)
923 #define INSN_HAS_LOCATION(INSN) ((LOCATION_LOCUS (INSN_LOCATION (INSN)))\
924 != UNKNOWN_LOCATION)
926 /* LOCATION of an RTX if relevant. */
927 #define RTL_LOCATION(X) (INSN_P (X) ? \
928 INSN_LOCATION (X) : UNKNOWN_LOCATION)
930 /* Code number of instruction, from when it was recognized.
931 -1 means this instruction has not been recognized yet. */
932 #define INSN_CODE(INSN) XINT (INSN, 5)
934 #define RTX_FRAME_RELATED_P(RTX) \
935 (RTL_FLAG_CHECK6 ("RTX_FRAME_RELATED_P", (RTX), DEBUG_INSN, INSN, \
936 CALL_INSN, JUMP_INSN, BARRIER, SET)->frame_related)
938 /* 1 if RTX is an insn that has been deleted. */
939 #define INSN_DELETED_P(RTX) \
940 (RTL_INSN_CHAIN_FLAG_CHECK ("INSN_DELETED_P", (RTX))->volatil)
942 /* 1 if RTX is a call to a const function. Built from ECF_CONST and
943 TREE_READONLY. */
944 #define RTL_CONST_CALL_P(RTX) \
945 (RTL_FLAG_CHECK1 ("RTL_CONST_CALL_P", (RTX), CALL_INSN)->unchanging)
947 /* 1 if RTX is a call to a pure function. Built from ECF_PURE and
948 DECL_PURE_P. */
949 #define RTL_PURE_CALL_P(RTX) \
950 (RTL_FLAG_CHECK1 ("RTL_PURE_CALL_P", (RTX), CALL_INSN)->return_val)
952 /* 1 if RTX is a call to a const or pure function. */
953 #define RTL_CONST_OR_PURE_CALL_P(RTX) \
954 (RTL_CONST_CALL_P (RTX) || RTL_PURE_CALL_P (RTX))
956 /* 1 if RTX is a call to a looping const or pure function. Built from
957 ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P. */
958 #define RTL_LOOPING_CONST_OR_PURE_CALL_P(RTX) \
959 (RTL_FLAG_CHECK1 ("CONST_OR_PURE_CALL_P", (RTX), CALL_INSN)->call)
961 /* 1 if RTX is a call_insn for a sibling call. */
962 #define SIBLING_CALL_P(RTX) \
963 (RTL_FLAG_CHECK1 ("SIBLING_CALL_P", (RTX), CALL_INSN)->jump)
965 /* 1 if RTX is a jump_insn, call_insn, or insn that is an annulling branch. */
966 #define INSN_ANNULLED_BRANCH_P(RTX) \
967 (RTL_FLAG_CHECK1 ("INSN_ANNULLED_BRANCH_P", (RTX), JUMP_INSN)->unchanging)
969 /* 1 if RTX is an insn in a delay slot and is from the target of the branch.
970 If the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be
971 executed if the branch is taken. For annulled branches with this bit
972 clear, the insn should be executed only if the branch is not taken. */
973 #define INSN_FROM_TARGET_P(RTX) \
974 (RTL_FLAG_CHECK3 ("INSN_FROM_TARGET_P", (RTX), INSN, JUMP_INSN, \
975 CALL_INSN)->in_struct)
977 /* In an ADDR_DIFF_VEC, the flags for RTX for use by branch shortening.
978 See the comments for ADDR_DIFF_VEC in rtl.def. */
979 #define ADDR_DIFF_VEC_FLAGS(RTX) X0ADVFLAGS (RTX, 4)
981 /* In a VALUE, the value cselib has assigned to RTX.
982 This is a "struct cselib_val", see cselib.h. */
983 #define CSELIB_VAL_PTR(RTX) X0CSELIB (RTX, 0)
985 /* Holds a list of notes on what this insn does to various REGs.
986 It is a chain of EXPR_LIST rtx's, where the second operand is the
987 chain pointer and the first operand is the REG being described.
988 The mode field of the EXPR_LIST contains not a real machine mode
989 but a value from enum reg_note. */
990 #define REG_NOTES(INSN) XEXP(INSN, 6)
992 /* In an ENTRY_VALUE this is the DECL_INCOMING_RTL of the argument in
993 question. */
994 #define ENTRY_VALUE_EXP(RTX) (RTL_CHECKC1 (RTX, 0, ENTRY_VALUE).rt_rtx)
996 enum reg_note
998 #define DEF_REG_NOTE(NAME) NAME,
999 #include "reg-notes.def"
1000 #undef DEF_REG_NOTE
1001 REG_NOTE_MAX
1004 /* Define macros to extract and insert the reg-note kind in an EXPR_LIST. */
1005 #define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK))
1006 #define PUT_REG_NOTE_KIND(LINK, KIND) \
1007 PUT_MODE (LINK, (enum machine_mode) (KIND))
1009 /* Names for REG_NOTE's in EXPR_LIST insn's. */
1011 extern const char * const reg_note_name[];
1012 #define GET_REG_NOTE_NAME(MODE) (reg_note_name[(int) (MODE)])
1014 /* This field is only present on CALL_INSNs. It holds a chain of EXPR_LIST of
1015 USE and CLOBBER expressions.
1016 USE expressions list the registers filled with arguments that
1017 are passed to the function.
1018 CLOBBER expressions document the registers explicitly clobbered
1019 by this CALL_INSN.
1020 Pseudo registers can not be mentioned in this list. */
1021 #define CALL_INSN_FUNCTION_USAGE(INSN) XEXP(INSN, 7)
1023 /* The label-number of a code-label. The assembler label
1024 is made from `L' and the label-number printed in decimal.
1025 Label numbers are unique in a compilation. */
1026 #define CODE_LABEL_NUMBER(INSN) XINT (INSN, 5)
1028 /* In a NOTE that is a line number, this is a string for the file name that the
1029 line is in. We use the same field to record block numbers temporarily in
1030 NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes. (We avoid lots of casts
1031 between ints and pointers if we use a different macro for the block number.)
1034 /* Opaque data. */
1035 #define NOTE_DATA(INSN) RTL_CHECKC1 (INSN, 3, NOTE)
1036 #define NOTE_DELETED_LABEL_NAME(INSN) XCSTR (INSN, 3, NOTE)
1037 #define SET_INSN_DELETED(INSN) set_insn_deleted (INSN);
1038 #define NOTE_BLOCK(INSN) XCTREE (INSN, 3, NOTE)
1039 #define NOTE_EH_HANDLER(INSN) XCINT (INSN, 3, NOTE)
1040 #define NOTE_BASIC_BLOCK(INSN) XCBBDEF (INSN, 3, NOTE)
1041 #define NOTE_VAR_LOCATION(INSN) XCEXP (INSN, 3, NOTE)
1042 #define NOTE_CFI(INSN) XCCFI (INSN, 3, NOTE)
1043 #define NOTE_LABEL_NUMBER(INSN) XCINT (INSN, 3, NOTE)
1045 /* In a NOTE that is a line number, this is the line number.
1046 Other kinds of NOTEs are identified by negative numbers here. */
1047 #define NOTE_KIND(INSN) XCINT (INSN, 4, NOTE)
1049 /* Nonzero if INSN is a note marking the beginning of a basic block. */
1050 #define NOTE_INSN_BASIC_BLOCK_P(INSN) \
1051 (NOTE_P (INSN) && NOTE_KIND (INSN) == NOTE_INSN_BASIC_BLOCK)
1053 /* Variable declaration and the location of a variable. */
1054 #define PAT_VAR_LOCATION_DECL(PAT) (XCTREE ((PAT), 0, VAR_LOCATION))
1055 #define PAT_VAR_LOCATION_LOC(PAT) (XCEXP ((PAT), 1, VAR_LOCATION))
1057 /* Initialization status of the variable in the location. Status
1058 can be unknown, uninitialized or initialized. See enumeration
1059 type below. */
1060 #define PAT_VAR_LOCATION_STATUS(PAT) \
1061 (RTL_FLAG_CHECK1 ("PAT_VAR_LOCATION_STATUS", PAT, VAR_LOCATION) \
1062 ->u2.var_location_status)
1064 /* Accessors for a NOTE_INSN_VAR_LOCATION. */
1065 #define NOTE_VAR_LOCATION_DECL(NOTE) \
1066 PAT_VAR_LOCATION_DECL (NOTE_VAR_LOCATION (NOTE))
1067 #define NOTE_VAR_LOCATION_LOC(NOTE) \
1068 PAT_VAR_LOCATION_LOC (NOTE_VAR_LOCATION (NOTE))
1069 #define NOTE_VAR_LOCATION_STATUS(NOTE) \
1070 PAT_VAR_LOCATION_STATUS (NOTE_VAR_LOCATION (NOTE))
1072 /* The VAR_LOCATION rtx in a DEBUG_INSN. */
1073 #define INSN_VAR_LOCATION(INSN) PATTERN (INSN)
1075 /* Accessors for a tree-expanded var location debug insn. */
1076 #define INSN_VAR_LOCATION_DECL(INSN) \
1077 PAT_VAR_LOCATION_DECL (INSN_VAR_LOCATION (INSN))
1078 #define INSN_VAR_LOCATION_LOC(INSN) \
1079 PAT_VAR_LOCATION_LOC (INSN_VAR_LOCATION (INSN))
1080 #define INSN_VAR_LOCATION_STATUS(INSN) \
1081 PAT_VAR_LOCATION_STATUS (INSN_VAR_LOCATION (INSN))
1083 /* Expand to the RTL that denotes an unknown variable location in a
1084 DEBUG_INSN. */
1085 #define gen_rtx_UNKNOWN_VAR_LOC() (gen_rtx_CLOBBER (VOIDmode, const0_rtx))
1087 /* Determine whether X is such an unknown location. */
1088 #define VAR_LOC_UNKNOWN_P(X) \
1089 (GET_CODE (X) == CLOBBER && XEXP ((X), 0) == const0_rtx)
1091 /* 1 if RTX is emitted after a call, but it should take effect before
1092 the call returns. */
1093 #define NOTE_DURING_CALL_P(RTX) \
1094 (RTL_FLAG_CHECK1 ("NOTE_VAR_LOCATION_DURING_CALL_P", (RTX), NOTE)->call)
1096 /* DEBUG_EXPR_DECL corresponding to a DEBUG_EXPR RTX. */
1097 #define DEBUG_EXPR_TREE_DECL(RTX) XCTREE (RTX, 0, DEBUG_EXPR)
1099 /* VAR_DECL/PARM_DECL DEBUG_IMPLICIT_PTR takes address of. */
1100 #define DEBUG_IMPLICIT_PTR_DECL(RTX) XCTREE (RTX, 0, DEBUG_IMPLICIT_PTR)
1102 /* PARM_DECL DEBUG_PARAMETER_REF references. */
1103 #define DEBUG_PARAMETER_REF_DECL(RTX) XCTREE (RTX, 0, DEBUG_PARAMETER_REF)
1105 /* Codes that appear in the NOTE_KIND field for kinds of notes
1106 that are not line numbers. These codes are all negative.
1108 Notice that we do not try to use zero here for any of
1109 the special note codes because sometimes the source line
1110 actually can be zero! This happens (for example) when we
1111 are generating code for the per-translation-unit constructor
1112 and destructor routines for some C++ translation unit. */
1114 enum insn_note
1116 #define DEF_INSN_NOTE(NAME) NAME,
1117 #include "insn-notes.def"
1118 #undef DEF_INSN_NOTE
1120 NOTE_INSN_MAX
1123 /* Names for NOTE insn's other than line numbers. */
1125 extern const char * const note_insn_name[NOTE_INSN_MAX];
1126 #define GET_NOTE_INSN_NAME(NOTE_CODE) \
1127 (note_insn_name[(NOTE_CODE)])
1129 /* The name of a label, in case it corresponds to an explicit label
1130 in the input source code. */
1131 #define LABEL_NAME(RTX) XCSTR (RTX, 6, CODE_LABEL)
1133 /* In jump.c, each label contains a count of the number
1134 of LABEL_REFs that point at it, so unused labels can be deleted. */
1135 #define LABEL_NUSES(RTX) XCINT (RTX, 4, CODE_LABEL)
1137 /* Labels carry a two-bit field composed of the ->jump and ->call
1138 bits. This field indicates whether the label is an alternate
1139 entry point, and if so, what kind. */
1140 enum label_kind
1142 LABEL_NORMAL = 0, /* ordinary label */
1143 LABEL_STATIC_ENTRY, /* alternate entry point, not exported */
1144 LABEL_GLOBAL_ENTRY, /* alternate entry point, exported */
1145 LABEL_WEAK_ENTRY /* alternate entry point, exported as weak symbol */
1148 #if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION > 2007)
1150 /* Retrieve the kind of LABEL. */
1151 #define LABEL_KIND(LABEL) __extension__ \
1152 ({ __typeof (LABEL) const _label = (LABEL); \
1153 if (! LABEL_P (_label)) \
1154 rtl_check_failed_flag ("LABEL_KIND", _label, __FILE__, __LINE__, \
1155 __FUNCTION__); \
1156 (enum label_kind) ((_label->jump << 1) | _label->call); })
1158 /* Set the kind of LABEL. */
1159 #define SET_LABEL_KIND(LABEL, KIND) do { \
1160 __typeof (LABEL) const _label = (LABEL); \
1161 const unsigned int _kind = (KIND); \
1162 if (! LABEL_P (_label)) \
1163 rtl_check_failed_flag ("SET_LABEL_KIND", _label, __FILE__, __LINE__, \
1164 __FUNCTION__); \
1165 _label->jump = ((_kind >> 1) & 1); \
1166 _label->call = (_kind & 1); \
1167 } while (0)
1169 #else
1171 /* Retrieve the kind of LABEL. */
1172 #define LABEL_KIND(LABEL) \
1173 ((enum label_kind) (((LABEL)->jump << 1) | (LABEL)->call))
1175 /* Set the kind of LABEL. */
1176 #define SET_LABEL_KIND(LABEL, KIND) do { \
1177 rtx const _label = (LABEL); \
1178 const unsigned int _kind = (KIND); \
1179 _label->jump = ((_kind >> 1) & 1); \
1180 _label->call = (_kind & 1); \
1181 } while (0)
1183 #endif /* rtl flag checking */
1185 #define LABEL_ALT_ENTRY_P(LABEL) (LABEL_KIND (LABEL) != LABEL_NORMAL)
1187 /* In jump.c, each JUMP_INSN can point to a label that it can jump to,
1188 so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
1189 be decremented and possibly the label can be deleted. */
1190 #define JUMP_LABEL(INSN) XCEXP (INSN, 7, JUMP_INSN)
1192 /* Once basic blocks are found, each CODE_LABEL starts a chain that
1193 goes through all the LABEL_REFs that jump to that label. The chain
1194 eventually winds up at the CODE_LABEL: it is circular. */
1195 #define LABEL_REFS(LABEL) XCEXP (LABEL, 3, CODE_LABEL)
1197 /* For a REG rtx, REGNO extracts the register number. REGNO can only
1198 be used on RHS. Use SET_REGNO to change the value. */
1199 #define REGNO(RTX) (rhs_regno(RTX))
1200 #define SET_REGNO(RTX,N) \
1201 (df_ref_change_reg_with_loc (REGNO (RTX), N, RTX), XCUINT (RTX, 0, REG) = N)
1202 #define SET_REGNO_RAW(RTX,N) (XCUINT (RTX, 0, REG) = N)
1204 /* ORIGINAL_REGNO holds the number the register originally had; for a
1205 pseudo register turned into a hard reg this will hold the old pseudo
1206 register number. */
1207 #define ORIGINAL_REGNO(RTX) \
1208 (RTL_FLAG_CHECK1 ("ORIGINAL_REGNO", (RTX), REG)->u2.original_regno)
1210 /* Force the REGNO macro to only be used on the lhs. */
1211 static inline unsigned int
1212 rhs_regno (const_rtx x)
1214 return XCUINT (x, 0, REG);
1218 /* 1 if RTX is a reg or parallel that is the current function's return
1219 value. */
1220 #define REG_FUNCTION_VALUE_P(RTX) \
1221 (RTL_FLAG_CHECK2 ("REG_FUNCTION_VALUE_P", (RTX), REG, PARALLEL)->return_val)
1223 /* 1 if RTX is a reg that corresponds to a variable declared by the user. */
1224 #define REG_USERVAR_P(RTX) \
1225 (RTL_FLAG_CHECK1 ("REG_USERVAR_P", (RTX), REG)->volatil)
1227 /* 1 if RTX is a reg that holds a pointer value. */
1228 #define REG_POINTER(RTX) \
1229 (RTL_FLAG_CHECK1 ("REG_POINTER", (RTX), REG)->frame_related)
1231 /* 1 if RTX is a mem that holds a pointer value. */
1232 #define MEM_POINTER(RTX) \
1233 (RTL_FLAG_CHECK1 ("MEM_POINTER", (RTX), MEM)->frame_related)
1235 /* 1 if the given register REG corresponds to a hard register. */
1236 #define HARD_REGISTER_P(REG) (HARD_REGISTER_NUM_P (REGNO (REG)))
1238 /* 1 if the given register number REG_NO corresponds to a hard register. */
1239 #define HARD_REGISTER_NUM_P(REG_NO) ((REG_NO) < FIRST_PSEUDO_REGISTER)
1241 /* For a CONST_INT rtx, INTVAL extracts the integer. */
1242 #define INTVAL(RTX) XCWINT (RTX, 0, CONST_INT)
1243 #define UINTVAL(RTX) ((unsigned HOST_WIDE_INT) INTVAL (RTX))
1245 /* For a CONST_WIDE_INT, CONST_WIDE_INT_NUNITS is the number of
1246 elements actually needed to represent the constant.
1247 CONST_WIDE_INT_ELT gets one of the elements. 0 is the least
1248 significant HOST_WIDE_INT. */
1249 #define CONST_WIDE_INT_VEC(RTX) HWIVEC_CHECK (RTX, CONST_WIDE_INT)
1250 #define CONST_WIDE_INT_NUNITS(RTX) CWI_GET_NUM_ELEM (RTX)
1251 #define CONST_WIDE_INT_ELT(RTX, N) CWI_ELT (RTX, N)
1253 /* For a CONST_DOUBLE:
1254 #if TARGET_SUPPORTS_WIDE_INT == 0
1255 For a VOIDmode, there are two integers CONST_DOUBLE_LOW is the
1256 low-order word and ..._HIGH the high-order.
1257 #endif
1258 For a float, there is a REAL_VALUE_TYPE structure, and
1259 CONST_DOUBLE_REAL_VALUE(r) is a pointer to it. */
1260 #define CONST_DOUBLE_LOW(r) XCMWINT (r, 0, CONST_DOUBLE, VOIDmode)
1261 #define CONST_DOUBLE_HIGH(r) XCMWINT (r, 1, CONST_DOUBLE, VOIDmode)
1262 #define CONST_DOUBLE_REAL_VALUE(r) \
1263 ((const struct real_value *) XCNMPRV (r, CONST_DOUBLE, VOIDmode))
1265 #define CONST_FIXED_VALUE(r) \
1266 ((const struct fixed_value *) XCNMPFV (r, CONST_FIXED, VOIDmode))
1267 #define CONST_FIXED_VALUE_HIGH(r) \
1268 ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.high))
1269 #define CONST_FIXED_VALUE_LOW(r) \
1270 ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.low))
1272 /* For a CONST_VECTOR, return element #n. */
1273 #define CONST_VECTOR_ELT(RTX, N) XCVECEXP (RTX, 0, N, CONST_VECTOR)
1275 /* For a CONST_VECTOR, return the number of elements in a vector. */
1276 #define CONST_VECTOR_NUNITS(RTX) XCVECLEN (RTX, 0, CONST_VECTOR)
1278 /* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of.
1279 SUBREG_BYTE extracts the byte-number. */
1281 #define SUBREG_REG(RTX) XCEXP (RTX, 0, SUBREG)
1282 #define SUBREG_BYTE(RTX) XCUINT (RTX, 1, SUBREG)
1284 /* in rtlanal.c */
1285 /* Return the right cost to give to an operation
1286 to make the cost of the corresponding register-to-register instruction
1287 N times that of a fast register-to-register instruction. */
1288 #define COSTS_N_INSNS(N) ((N) * 4)
1290 /* Maximum cost of an rtl expression. This value has the special meaning
1291 not to use an rtx with this cost under any circumstances. */
1292 #define MAX_COST INT_MAX
1294 /* A structure to hold all available cost information about an rtl
1295 expression. */
1296 struct full_rtx_costs
1298 int speed;
1299 int size;
1302 /* Initialize a full_rtx_costs structure C to the maximum cost. */
1303 static inline void
1304 init_costs_to_max (struct full_rtx_costs *c)
1306 c->speed = MAX_COST;
1307 c->size = MAX_COST;
1310 /* Initialize a full_rtx_costs structure C to zero cost. */
1311 static inline void
1312 init_costs_to_zero (struct full_rtx_costs *c)
1314 c->speed = 0;
1315 c->size = 0;
1318 /* Compare two full_rtx_costs structures A and B, returning true
1319 if A < B when optimizing for speed. */
1320 static inline bool
1321 costs_lt_p (struct full_rtx_costs *a, struct full_rtx_costs *b,
1322 bool speed)
1324 if (speed)
1325 return (a->speed < b->speed
1326 || (a->speed == b->speed && a->size < b->size));
1327 else
1328 return (a->size < b->size
1329 || (a->size == b->size && a->speed < b->speed));
1332 /* Increase both members of the full_rtx_costs structure C by the
1333 cost of N insns. */
1334 static inline void
1335 costs_add_n_insns (struct full_rtx_costs *c, int n)
1337 c->speed += COSTS_N_INSNS (n);
1338 c->size += COSTS_N_INSNS (n);
1341 /* Information about an address. This structure is supposed to be able
1342 to represent all supported target addresses. Please extend it if it
1343 is not yet general enough. */
1344 struct address_info {
1345 /* The mode of the value being addressed, or VOIDmode if this is
1346 a load-address operation with no known address mode. */
1347 enum machine_mode mode;
1349 /* The address space. */
1350 addr_space_t as;
1352 /* A pointer to the top-level address. */
1353 rtx *outer;
1355 /* A pointer to the inner address, after all address mutations
1356 have been stripped from the top-level address. It can be one
1357 of the following:
1359 - A {PRE,POST}_{INC,DEC} of *BASE. SEGMENT, INDEX and DISP are null.
1361 - A {PRE,POST}_MODIFY of *BASE. In this case either INDEX or DISP
1362 points to the step value, depending on whether the step is variable
1363 or constant respectively. SEGMENT is null.
1365 - A plain sum of the form SEGMENT + BASE + INDEX + DISP,
1366 with null fields evaluating to 0. */
1367 rtx *inner;
1369 /* Components that make up *INNER. Each one may be null or nonnull.
1370 When nonnull, their meanings are as follows:
1372 - *SEGMENT is the "segment" of memory to which the address refers.
1373 This value is entirely target-specific and is only called a "segment"
1374 because that's its most typical use. It contains exactly one UNSPEC,
1375 pointed to by SEGMENT_TERM. The contents of *SEGMENT do not need
1376 reloading.
1378 - *BASE is a variable expression representing a base address.
1379 It contains exactly one REG, SUBREG or MEM, pointed to by BASE_TERM.
1381 - *INDEX is a variable expression representing an index value.
1382 It may be a scaled expression, such as a MULT. It has exactly
1383 one REG, SUBREG or MEM, pointed to by INDEX_TERM.
1385 - *DISP is a constant, possibly mutated. DISP_TERM points to the
1386 unmutated RTX_CONST_OBJ. */
1387 rtx *segment;
1388 rtx *base;
1389 rtx *index;
1390 rtx *disp;
1392 rtx *segment_term;
1393 rtx *base_term;
1394 rtx *index_term;
1395 rtx *disp_term;
1397 /* In a {PRE,POST}_MODIFY address, this points to a second copy
1398 of BASE_TERM, otherwise it is null. */
1399 rtx *base_term2;
1401 /* ADDRESS if this structure describes an address operand, MEM if
1402 it describes a MEM address. */
1403 enum rtx_code addr_outer_code;
1405 /* If BASE is nonnull, this is the code of the rtx that contains it. */
1406 enum rtx_code base_outer_code;
1408 /* True if this is an RTX_AUTOINC address. */
1409 bool autoinc_p;
1412 /* This is used to bundle an rtx and a mode together so that the pair
1413 can be used with the wi:: routines. If we ever put modes into rtx
1414 integer constants, this should go away and then just pass an rtx in. */
1415 typedef std::pair <rtx, enum machine_mode> rtx_mode_t;
1417 namespace wi
1419 template <>
1420 struct int_traits <rtx_mode_t>
1422 static const enum precision_type precision_type = VAR_PRECISION;
1423 static const bool host_dependent_precision = false;
1424 /* This ought to be true, except for the special case that BImode
1425 is canonicalized to STORE_FLAG_VALUE, which might be 1. */
1426 static const bool is_sign_extended = false;
1427 static unsigned int get_precision (const rtx_mode_t &);
1428 static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int,
1429 const rtx_mode_t &);
1433 inline unsigned int
1434 wi::int_traits <rtx_mode_t>::get_precision (const rtx_mode_t &x)
1436 return GET_MODE_PRECISION (x.second);
1439 inline wi::storage_ref
1440 wi::int_traits <rtx_mode_t>::decompose (HOST_WIDE_INT *,
1441 unsigned int precision,
1442 const rtx_mode_t &x)
1444 gcc_checking_assert (precision == get_precision (x));
1445 switch (GET_CODE (x.first))
1447 case CONST_INT:
1448 if (precision < HOST_BITS_PER_WIDE_INT)
1449 /* Nonzero BImodes are stored as STORE_FLAG_VALUE, which on many
1450 targets is 1 rather than -1. */
1451 gcc_checking_assert (INTVAL (x.first)
1452 == sext_hwi (INTVAL (x.first), precision)
1453 || (x.second == BImode && INTVAL (x.first) == 1));
1455 return wi::storage_ref (&INTVAL (x.first), 1, precision);
1457 case CONST_WIDE_INT:
1458 return wi::storage_ref (&CONST_WIDE_INT_ELT (x.first, 0),
1459 CONST_WIDE_INT_NUNITS (x.first), precision);
1461 #if TARGET_SUPPORTS_WIDE_INT == 0
1462 case CONST_DOUBLE:
1463 return wi::storage_ref (&CONST_DOUBLE_LOW (x.first), 2, precision);
1464 #endif
1466 default:
1467 gcc_unreachable ();
1471 namespace wi
1473 hwi_with_prec shwi (HOST_WIDE_INT, enum machine_mode mode);
1474 wide_int min_value (enum machine_mode, signop);
1475 wide_int max_value (enum machine_mode, signop);
1478 inline wi::hwi_with_prec
1479 wi::shwi (HOST_WIDE_INT val, enum machine_mode mode)
1481 return shwi (val, GET_MODE_PRECISION (mode));
1484 /* Produce the smallest number that is represented in MODE. The precision
1485 is taken from MODE and the sign from SGN. */
1486 inline wide_int
1487 wi::min_value (enum machine_mode mode, signop sgn)
1489 return min_value (GET_MODE_PRECISION (mode), sgn);
1492 /* Produce the largest number that is represented in MODE. The precision
1493 is taken from MODE and the sign from SGN. */
1494 inline wide_int
1495 wi::max_value (enum machine_mode mode, signop sgn)
1497 return max_value (GET_MODE_PRECISION (mode), sgn);
1500 extern void init_rtlanal (void);
1501 extern int rtx_cost (rtx, enum rtx_code, int, bool);
1502 extern int address_cost (rtx, enum machine_mode, addr_space_t, bool);
1503 extern void get_full_rtx_cost (rtx, enum rtx_code, int,
1504 struct full_rtx_costs *);
1505 extern unsigned int subreg_lsb (const_rtx);
1506 extern unsigned int subreg_lsb_1 (enum machine_mode, enum machine_mode,
1507 unsigned int);
1508 extern unsigned int subreg_regno_offset (unsigned int, enum machine_mode,
1509 unsigned int, enum machine_mode);
1510 extern bool subreg_offset_representable_p (unsigned int, enum machine_mode,
1511 unsigned int, enum machine_mode);
1512 extern unsigned int subreg_regno (const_rtx);
1513 extern int simplify_subreg_regno (unsigned int, enum machine_mode,
1514 unsigned int, enum machine_mode);
1515 extern unsigned int subreg_nregs (const_rtx);
1516 extern unsigned int subreg_nregs_with_regno (unsigned int, const_rtx);
1517 extern unsigned HOST_WIDE_INT nonzero_bits (const_rtx, enum machine_mode);
1518 extern unsigned int num_sign_bit_copies (const_rtx, enum machine_mode);
1519 extern bool constant_pool_constant_p (rtx);
1520 extern bool truncated_to_mode (enum machine_mode, const_rtx);
1521 extern int low_bitmask_len (enum machine_mode, unsigned HOST_WIDE_INT);
1522 extern void split_double (rtx, rtx *, rtx *);
1523 extern rtx *strip_address_mutations (rtx *, enum rtx_code * = 0);
1524 extern void decompose_address (struct address_info *, rtx *,
1525 enum machine_mode, addr_space_t, enum rtx_code);
1526 extern void decompose_lea_address (struct address_info *, rtx *);
1527 extern void decompose_mem_address (struct address_info *, rtx);
1528 extern void update_address (struct address_info *);
1529 extern HOST_WIDE_INT get_index_scale (const struct address_info *);
1530 extern enum rtx_code get_index_code (const struct address_info *);
1532 #ifndef GENERATOR_FILE
1533 /* Return the cost of SET X. SPEED_P is true if optimizing for speed
1534 rather than size. */
1536 static inline int
1537 set_rtx_cost (rtx x, bool speed_p)
1539 return rtx_cost (x, INSN, 4, speed_p);
1542 /* Like set_rtx_cost, but return both the speed and size costs in C. */
1544 static inline void
1545 get_full_set_rtx_cost (rtx x, struct full_rtx_costs *c)
1547 get_full_rtx_cost (x, INSN, 4, c);
1550 /* Return the cost of moving X into a register, relative to the cost
1551 of a register move. SPEED_P is true if optimizing for speed rather
1552 than size. */
1554 static inline int
1555 set_src_cost (rtx x, bool speed_p)
1557 return rtx_cost (x, SET, 1, speed_p);
1560 /* Like set_src_cost, but return both the speed and size costs in C. */
1562 static inline void
1563 get_full_set_src_cost (rtx x, struct full_rtx_costs *c)
1565 get_full_rtx_cost (x, SET, 1, c);
1567 #endif
1569 /* 1 if RTX is a subreg containing a reg that is already known to be
1570 sign- or zero-extended from the mode of the subreg to the mode of
1571 the reg. SUBREG_PROMOTED_UNSIGNED_P gives the signedness of the
1572 extension.
1574 When used as a LHS, is means that this extension must be done
1575 when assigning to SUBREG_REG. */
1577 #define SUBREG_PROMOTED_VAR_P(RTX) \
1578 (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED", (RTX), SUBREG)->in_struct)
1580 #define SUBREG_PROMOTED_UNSIGNED_SET(RTX, VAL) \
1581 do { \
1582 rtx const _rtx = RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_SET", \
1583 (RTX), SUBREG); \
1584 if ((VAL) < 0) \
1585 _rtx->volatil = 1; \
1586 else { \
1587 _rtx->volatil = 0; \
1588 _rtx->unchanging = (VAL); \
1590 } while (0)
1592 /* Valid for subregs which are SUBREG_PROMOTED_VAR_P(). In that case
1593 this gives the necessary extensions:
1594 0 - signed
1595 1 - normal unsigned
1596 -1 - pointer unsigned, which most often can be handled like unsigned
1597 extension, except for generating instructions where we need to
1598 emit special code (ptr_extend insns) on some architectures. */
1600 #define SUBREG_PROMOTED_UNSIGNED_P(RTX) \
1601 ((RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_P", (RTX), SUBREG)->volatil) \
1602 ? -1 : (int) (RTX)->unchanging)
1604 /* True if the subreg was generated by LRA for reload insns. Such
1605 subregs are valid only during LRA. */
1606 #define LRA_SUBREG_P(RTX) \
1607 (RTL_FLAG_CHECK1 ("LRA_SUBREG_P", (RTX), SUBREG)->jump)
1609 /* Access various components of an ASM_OPERANDS rtx. */
1611 #define ASM_OPERANDS_TEMPLATE(RTX) XCSTR (RTX, 0, ASM_OPERANDS)
1612 #define ASM_OPERANDS_OUTPUT_CONSTRAINT(RTX) XCSTR (RTX, 1, ASM_OPERANDS)
1613 #define ASM_OPERANDS_OUTPUT_IDX(RTX) XCINT (RTX, 2, ASM_OPERANDS)
1614 #define ASM_OPERANDS_INPUT_VEC(RTX) XCVEC (RTX, 3, ASM_OPERANDS)
1615 #define ASM_OPERANDS_INPUT_CONSTRAINT_VEC(RTX) XCVEC (RTX, 4, ASM_OPERANDS)
1616 #define ASM_OPERANDS_INPUT(RTX, N) XCVECEXP (RTX, 3, N, ASM_OPERANDS)
1617 #define ASM_OPERANDS_INPUT_LENGTH(RTX) XCVECLEN (RTX, 3, ASM_OPERANDS)
1618 #define ASM_OPERANDS_INPUT_CONSTRAINT_EXP(RTX, N) \
1619 XCVECEXP (RTX, 4, N, ASM_OPERANDS)
1620 #define ASM_OPERANDS_INPUT_CONSTRAINT(RTX, N) \
1621 XSTR (XCVECEXP (RTX, 4, N, ASM_OPERANDS), 0)
1622 #define ASM_OPERANDS_INPUT_MODE(RTX, N) \
1623 GET_MODE (XCVECEXP (RTX, 4, N, ASM_OPERANDS))
1624 #define ASM_OPERANDS_LABEL_VEC(RTX) XCVEC (RTX, 5, ASM_OPERANDS)
1625 #define ASM_OPERANDS_LABEL_LENGTH(RTX) XCVECLEN (RTX, 5, ASM_OPERANDS)
1626 #define ASM_OPERANDS_LABEL(RTX, N) XCVECEXP (RTX, 5, N, ASM_OPERANDS)
1627 #define ASM_OPERANDS_SOURCE_LOCATION(RTX) XCUINT (RTX, 6, ASM_OPERANDS)
1628 #define ASM_INPUT_SOURCE_LOCATION(RTX) XCUINT (RTX, 1, ASM_INPUT)
1630 /* 1 if RTX is a mem that is statically allocated in read-only memory. */
1631 #define MEM_READONLY_P(RTX) \
1632 (RTL_FLAG_CHECK1 ("MEM_READONLY_P", (RTX), MEM)->unchanging)
1634 /* 1 if RTX is a mem and we should keep the alias set for this mem
1635 unchanged when we access a component. Set to 1, or example, when we
1636 are already in a non-addressable component of an aggregate. */
1637 #define MEM_KEEP_ALIAS_SET_P(RTX) \
1638 (RTL_FLAG_CHECK1 ("MEM_KEEP_ALIAS_SET_P", (RTX), MEM)->jump)
1640 /* 1 if RTX is a mem or asm_operand for a volatile reference. */
1641 #define MEM_VOLATILE_P(RTX) \
1642 (RTL_FLAG_CHECK3 ("MEM_VOLATILE_P", (RTX), MEM, ASM_OPERANDS, \
1643 ASM_INPUT)->volatil)
1645 /* 1 if RTX is a mem that cannot trap. */
1646 #define MEM_NOTRAP_P(RTX) \
1647 (RTL_FLAG_CHECK1 ("MEM_NOTRAP_P", (RTX), MEM)->call)
1649 /* The memory attribute block. We provide access macros for each value
1650 in the block and provide defaults if none specified. */
1651 #define MEM_ATTRS(RTX) X0MEMATTR (RTX, 1)
1653 /* The register attribute block. We provide access macros for each value
1654 in the block and provide defaults if none specified. */
1655 #define REG_ATTRS(RTX) X0REGATTR (RTX, 1)
1657 #ifndef GENERATOR_FILE
1658 /* For a MEM rtx, the alias set. If 0, this MEM is not in any alias
1659 set, and may alias anything. Otherwise, the MEM can only alias
1660 MEMs in a conflicting alias set. This value is set in a
1661 language-dependent manner in the front-end, and should not be
1662 altered in the back-end. These set numbers are tested with
1663 alias_sets_conflict_p. */
1664 #define MEM_ALIAS_SET(RTX) (get_mem_attrs (RTX)->alias)
1666 /* For a MEM rtx, the decl it is known to refer to, if it is known to
1667 refer to part of a DECL. It may also be a COMPONENT_REF. */
1668 #define MEM_EXPR(RTX) (get_mem_attrs (RTX)->expr)
1670 /* For a MEM rtx, true if its MEM_OFFSET is known. */
1671 #define MEM_OFFSET_KNOWN_P(RTX) (get_mem_attrs (RTX)->offset_known_p)
1673 /* For a MEM rtx, the offset from the start of MEM_EXPR. */
1674 #define MEM_OFFSET(RTX) (get_mem_attrs (RTX)->offset)
1676 /* For a MEM rtx, the address space. */
1677 #define MEM_ADDR_SPACE(RTX) (get_mem_attrs (RTX)->addrspace)
1679 /* For a MEM rtx, true if its MEM_SIZE is known. */
1680 #define MEM_SIZE_KNOWN_P(RTX) (get_mem_attrs (RTX)->size_known_p)
1682 /* For a MEM rtx, the size in bytes of the MEM. */
1683 #define MEM_SIZE(RTX) (get_mem_attrs (RTX)->size)
1685 /* For a MEM rtx, the alignment in bits. We can use the alignment of the
1686 mode as a default when STRICT_ALIGNMENT, but not if not. */
1687 #define MEM_ALIGN(RTX) (get_mem_attrs (RTX)->align)
1688 #else
1689 #define MEM_ADDR_SPACE(RTX) ADDR_SPACE_GENERIC
1690 #endif
1692 /* For a REG rtx, the decl it is known to refer to, if it is known to
1693 refer to part of a DECL. */
1694 #define REG_EXPR(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->decl)
1696 /* For a REG rtx, the offset from the start of REG_EXPR, if known, as an
1697 HOST_WIDE_INT. */
1698 #define REG_OFFSET(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->offset)
1700 /* Copy the attributes that apply to memory locations from RHS to LHS. */
1701 #define MEM_COPY_ATTRIBUTES(LHS, RHS) \
1702 (MEM_VOLATILE_P (LHS) = MEM_VOLATILE_P (RHS), \
1703 MEM_NOTRAP_P (LHS) = MEM_NOTRAP_P (RHS), \
1704 MEM_READONLY_P (LHS) = MEM_READONLY_P (RHS), \
1705 MEM_KEEP_ALIAS_SET_P (LHS) = MEM_KEEP_ALIAS_SET_P (RHS), \
1706 MEM_POINTER (LHS) = MEM_POINTER (RHS), \
1707 MEM_ATTRS (LHS) = MEM_ATTRS (RHS))
1709 /* 1 if RTX is a label_ref for a nonlocal label. */
1710 /* Likewise in an expr_list for a REG_LABEL_OPERAND or
1711 REG_LABEL_TARGET note. */
1712 #define LABEL_REF_NONLOCAL_P(RTX) \
1713 (RTL_FLAG_CHECK1 ("LABEL_REF_NONLOCAL_P", (RTX), LABEL_REF)->volatil)
1715 /* 1 if RTX is a code_label that should always be considered to be needed. */
1716 #define LABEL_PRESERVE_P(RTX) \
1717 (RTL_FLAG_CHECK2 ("LABEL_PRESERVE_P", (RTX), CODE_LABEL, NOTE)->in_struct)
1719 /* During sched, 1 if RTX is an insn that must be scheduled together
1720 with the preceding insn. */
1721 #define SCHED_GROUP_P(RTX) \
1722 (RTL_FLAG_CHECK4 ("SCHED_GROUP_P", (RTX), DEBUG_INSN, INSN, \
1723 JUMP_INSN, CALL_INSN)->in_struct)
1725 /* For a SET rtx, SET_DEST is the place that is set
1726 and SET_SRC is the value it is set to. */
1727 #define SET_DEST(RTX) XC2EXP (RTX, 0, SET, CLOBBER)
1728 #define SET_SRC(RTX) XCEXP (RTX, 1, SET)
1729 #define SET_IS_RETURN_P(RTX) \
1730 (RTL_FLAG_CHECK1 ("SET_IS_RETURN_P", (RTX), SET)->jump)
1732 /* For a TRAP_IF rtx, TRAP_CONDITION is an expression. */
1733 #define TRAP_CONDITION(RTX) XCEXP (RTX, 0, TRAP_IF)
1734 #define TRAP_CODE(RTX) XCEXP (RTX, 1, TRAP_IF)
1736 /* For a COND_EXEC rtx, COND_EXEC_TEST is the condition to base
1737 conditionally executing the code on, COND_EXEC_CODE is the code
1738 to execute if the condition is true. */
1739 #define COND_EXEC_TEST(RTX) XCEXP (RTX, 0, COND_EXEC)
1740 #define COND_EXEC_CODE(RTX) XCEXP (RTX, 1, COND_EXEC)
1742 /* 1 if RTX is a symbol_ref that addresses this function's rtl
1743 constants pool. */
1744 #define CONSTANT_POOL_ADDRESS_P(RTX) \
1745 (RTL_FLAG_CHECK1 ("CONSTANT_POOL_ADDRESS_P", (RTX), SYMBOL_REF)->unchanging)
1747 /* 1 if RTX is a symbol_ref that addresses a value in the file's
1748 tree constant pool. This information is private to varasm.c. */
1749 #define TREE_CONSTANT_POOL_ADDRESS_P(RTX) \
1750 (RTL_FLAG_CHECK1 ("TREE_CONSTANT_POOL_ADDRESS_P", \
1751 (RTX), SYMBOL_REF)->frame_related)
1753 /* Used if RTX is a symbol_ref, for machine-specific purposes. */
1754 #define SYMBOL_REF_FLAG(RTX) \
1755 (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAG", (RTX), SYMBOL_REF)->volatil)
1757 /* 1 if RTX is a symbol_ref that has been the library function in
1758 emit_library_call. */
1759 #define SYMBOL_REF_USED(RTX) \
1760 (RTL_FLAG_CHECK1 ("SYMBOL_REF_USED", (RTX), SYMBOL_REF)->used)
1762 /* 1 if RTX is a symbol_ref for a weak symbol. */
1763 #define SYMBOL_REF_WEAK(RTX) \
1764 (RTL_FLAG_CHECK1 ("SYMBOL_REF_WEAK", (RTX), SYMBOL_REF)->return_val)
1766 /* A pointer attached to the SYMBOL_REF; either SYMBOL_REF_DECL or
1767 SYMBOL_REF_CONSTANT. */
1768 #define SYMBOL_REF_DATA(RTX) X0ANY ((RTX), 2)
1770 /* Set RTX's SYMBOL_REF_DECL to DECL. RTX must not be a constant
1771 pool symbol. */
1772 #define SET_SYMBOL_REF_DECL(RTX, DECL) \
1773 (gcc_assert (!CONSTANT_POOL_ADDRESS_P (RTX)), X0TREE ((RTX), 2) = (DECL))
1775 /* The tree (decl or constant) associated with the symbol, or null. */
1776 #define SYMBOL_REF_DECL(RTX) \
1777 (CONSTANT_POOL_ADDRESS_P (RTX) ? NULL : X0TREE ((RTX), 2))
1779 /* Set RTX's SYMBOL_REF_CONSTANT to C. RTX must be a constant pool symbol. */
1780 #define SET_SYMBOL_REF_CONSTANT(RTX, C) \
1781 (gcc_assert (CONSTANT_POOL_ADDRESS_P (RTX)), X0CONSTANT ((RTX), 2) = (C))
1783 /* The rtx constant pool entry for a symbol, or null. */
1784 #define SYMBOL_REF_CONSTANT(RTX) \
1785 (CONSTANT_POOL_ADDRESS_P (RTX) ? X0CONSTANT ((RTX), 2) : NULL)
1787 /* A set of flags on a symbol_ref that are, in some respects, redundant with
1788 information derivable from the tree decl associated with this symbol.
1789 Except that we build a *lot* of SYMBOL_REFs that aren't associated with a
1790 decl. In some cases this is a bug. But beyond that, it's nice to cache
1791 this information to avoid recomputing it. Finally, this allows space for
1792 the target to store more than one bit of information, as with
1793 SYMBOL_REF_FLAG. */
1794 #define SYMBOL_REF_FLAGS(RTX) X0INT ((RTX), 1)
1796 /* These flags are common enough to be defined for all targets. They
1797 are computed by the default version of targetm.encode_section_info. */
1799 /* Set if this symbol is a function. */
1800 #define SYMBOL_FLAG_FUNCTION (1 << 0)
1801 #define SYMBOL_REF_FUNCTION_P(RTX) \
1802 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_FUNCTION) != 0)
1803 /* Set if targetm.binds_local_p is true. */
1804 #define SYMBOL_FLAG_LOCAL (1 << 1)
1805 #define SYMBOL_REF_LOCAL_P(RTX) \
1806 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_LOCAL) != 0)
1807 /* Set if targetm.in_small_data_p is true. */
1808 #define SYMBOL_FLAG_SMALL (1 << 2)
1809 #define SYMBOL_REF_SMALL_P(RTX) \
1810 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_SMALL) != 0)
1811 /* The three-bit field at [5:3] is true for TLS variables; use
1812 SYMBOL_REF_TLS_MODEL to extract the field as an enum tls_model. */
1813 #define SYMBOL_FLAG_TLS_SHIFT 3
1814 #define SYMBOL_REF_TLS_MODEL(RTX) \
1815 ((enum tls_model) ((SYMBOL_REF_FLAGS (RTX) >> SYMBOL_FLAG_TLS_SHIFT) & 7))
1816 /* Set if this symbol is not defined in this translation unit. */
1817 #define SYMBOL_FLAG_EXTERNAL (1 << 6)
1818 #define SYMBOL_REF_EXTERNAL_P(RTX) \
1819 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_EXTERNAL) != 0)
1820 /* Set if this symbol has a block_symbol structure associated with it. */
1821 #define SYMBOL_FLAG_HAS_BLOCK_INFO (1 << 7)
1822 #define SYMBOL_REF_HAS_BLOCK_INFO_P(RTX) \
1823 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_HAS_BLOCK_INFO) != 0)
1824 /* Set if this symbol is a section anchor. SYMBOL_REF_ANCHOR_P implies
1825 SYMBOL_REF_HAS_BLOCK_INFO_P. */
1826 #define SYMBOL_FLAG_ANCHOR (1 << 8)
1827 #define SYMBOL_REF_ANCHOR_P(RTX) \
1828 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_ANCHOR) != 0)
1830 /* Subsequent bits are available for the target to use. */
1831 #define SYMBOL_FLAG_MACH_DEP_SHIFT 9
1832 #define SYMBOL_FLAG_MACH_DEP (1 << SYMBOL_FLAG_MACH_DEP_SHIFT)
1834 /* If SYMBOL_REF_HAS_BLOCK_INFO_P (RTX), this is the object_block
1835 structure to which the symbol belongs, or NULL if it has not been
1836 assigned a block. */
1837 #define SYMBOL_REF_BLOCK(RTX) (BLOCK_SYMBOL_CHECK (RTX)->block)
1839 /* If SYMBOL_REF_HAS_BLOCK_INFO_P (RTX), this is the offset of RTX from
1840 the first object in SYMBOL_REF_BLOCK (RTX). The value is negative if
1841 RTX has not yet been assigned to a block, or it has not been given an
1842 offset within that block. */
1843 #define SYMBOL_REF_BLOCK_OFFSET(RTX) (BLOCK_SYMBOL_CHECK (RTX)->offset)
1845 /* True if RTX is flagged to be a scheduling barrier. */
1846 #define PREFETCH_SCHEDULE_BARRIER_P(RTX) \
1847 (RTL_FLAG_CHECK1 ("PREFETCH_SCHEDULE_BARRIER_P", (RTX), PREFETCH)->volatil)
1849 /* Indicate whether the machine has any sort of auto increment addressing.
1850 If not, we can avoid checking for REG_INC notes. */
1852 #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) \
1853 || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT) \
1854 || defined (HAVE_PRE_MODIFY_DISP) || defined (HAVE_POST_MODIFY_DISP) \
1855 || defined (HAVE_PRE_MODIFY_REG) || defined (HAVE_POST_MODIFY_REG))
1856 #define AUTO_INC_DEC
1857 #endif
1859 /* Define a macro to look for REG_INC notes,
1860 but save time on machines where they never exist. */
1862 #ifdef AUTO_INC_DEC
1863 #define FIND_REG_INC_NOTE(INSN, REG) \
1864 ((REG) != NULL_RTX && REG_P ((REG)) \
1865 ? find_regno_note ((INSN), REG_INC, REGNO (REG)) \
1866 : find_reg_note ((INSN), REG_INC, (REG)))
1867 #else
1868 #define FIND_REG_INC_NOTE(INSN, REG) 0
1869 #endif
1871 #ifndef HAVE_PRE_INCREMENT
1872 #define HAVE_PRE_INCREMENT 0
1873 #endif
1875 #ifndef HAVE_PRE_DECREMENT
1876 #define HAVE_PRE_DECREMENT 0
1877 #endif
1879 #ifndef HAVE_POST_INCREMENT
1880 #define HAVE_POST_INCREMENT 0
1881 #endif
1883 #ifndef HAVE_POST_DECREMENT
1884 #define HAVE_POST_DECREMENT 0
1885 #endif
1887 #ifndef HAVE_POST_MODIFY_DISP
1888 #define HAVE_POST_MODIFY_DISP 0
1889 #endif
1891 #ifndef HAVE_POST_MODIFY_REG
1892 #define HAVE_POST_MODIFY_REG 0
1893 #endif
1895 #ifndef HAVE_PRE_MODIFY_DISP
1896 #define HAVE_PRE_MODIFY_DISP 0
1897 #endif
1899 #ifndef HAVE_PRE_MODIFY_REG
1900 #define HAVE_PRE_MODIFY_REG 0
1901 #endif
1904 /* Some architectures do not have complete pre/post increment/decrement
1905 instruction sets, or only move some modes efficiently. These macros
1906 allow us to tune autoincrement generation. */
1908 #ifndef USE_LOAD_POST_INCREMENT
1909 #define USE_LOAD_POST_INCREMENT(MODE) HAVE_POST_INCREMENT
1910 #endif
1912 #ifndef USE_LOAD_POST_DECREMENT
1913 #define USE_LOAD_POST_DECREMENT(MODE) HAVE_POST_DECREMENT
1914 #endif
1916 #ifndef USE_LOAD_PRE_INCREMENT
1917 #define USE_LOAD_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT
1918 #endif
1920 #ifndef USE_LOAD_PRE_DECREMENT
1921 #define USE_LOAD_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT
1922 #endif
1924 #ifndef USE_STORE_POST_INCREMENT
1925 #define USE_STORE_POST_INCREMENT(MODE) HAVE_POST_INCREMENT
1926 #endif
1928 #ifndef USE_STORE_POST_DECREMENT
1929 #define USE_STORE_POST_DECREMENT(MODE) HAVE_POST_DECREMENT
1930 #endif
1932 #ifndef USE_STORE_PRE_INCREMENT
1933 #define USE_STORE_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT
1934 #endif
1936 #ifndef USE_STORE_PRE_DECREMENT
1937 #define USE_STORE_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT
1938 #endif
1940 /* Nonzero when we are generating CONCATs. */
1941 extern int generating_concat_p;
1943 /* Nonzero when we are expanding trees to RTL. */
1944 extern int currently_expanding_to_rtl;
1946 /* Generally useful functions. */
1948 /* In explow.c */
1949 extern HOST_WIDE_INT trunc_int_for_mode (HOST_WIDE_INT, enum machine_mode);
1950 extern rtx plus_constant (enum machine_mode, rtx, HOST_WIDE_INT);
1952 /* In rtl.c */
1953 extern rtx rtx_alloc_stat (RTX_CODE MEM_STAT_DECL);
1954 #define rtx_alloc(c) rtx_alloc_stat (c MEM_STAT_INFO)
1955 extern rtx rtx_alloc_stat_v (RTX_CODE MEM_STAT_DECL, int);
1956 #define rtx_alloc_v(c, SZ) rtx_alloc_stat_v (c MEM_STAT_INFO, SZ)
1957 #define const_wide_int_alloc(NWORDS) \
1958 rtx_alloc_v (CONST_WIDE_INT, \
1959 (sizeof (struct hwivec_def) \
1960 + ((NWORDS)-1) * sizeof (HOST_WIDE_INT))) \
1962 extern rtvec rtvec_alloc (int);
1963 extern rtvec shallow_copy_rtvec (rtvec);
1964 extern bool shared_const_p (const_rtx);
1965 extern rtx copy_rtx (rtx);
1966 extern void dump_rtx_statistics (void);
1968 /* In emit-rtl.c */
1969 extern rtx copy_rtx_if_shared (rtx);
1971 /* In rtl.c */
1972 extern unsigned int rtx_size (const_rtx);
1973 extern rtx shallow_copy_rtx_stat (const_rtx MEM_STAT_DECL);
1974 #define shallow_copy_rtx(a) shallow_copy_rtx_stat (a MEM_STAT_INFO)
1975 extern int rtx_equal_p (const_rtx, const_rtx);
1976 extern hashval_t iterative_hash_rtx (const_rtx, hashval_t);
1978 /* In emit-rtl.c */
1979 extern rtvec gen_rtvec_v (int, rtx *);
1980 extern rtx gen_reg_rtx (enum machine_mode);
1981 extern rtx gen_rtx_REG_offset (rtx, enum machine_mode, unsigned int, int);
1982 extern rtx gen_reg_rtx_offset (rtx, enum machine_mode, int);
1983 extern rtx gen_reg_rtx_and_attrs (rtx);
1984 extern rtx gen_label_rtx (void);
1985 extern rtx gen_lowpart_common (enum machine_mode, rtx);
1987 /* In cse.c */
1988 extern rtx gen_lowpart_if_possible (enum machine_mode, rtx);
1990 /* In emit-rtl.c */
1991 extern rtx gen_highpart (enum machine_mode, rtx);
1992 extern rtx gen_highpart_mode (enum machine_mode, enum machine_mode, rtx);
1993 extern rtx operand_subword (rtx, unsigned int, int, enum machine_mode);
1995 /* In emit-rtl.c */
1996 extern rtx operand_subword_force (rtx, unsigned int, enum machine_mode);
1997 extern bool paradoxical_subreg_p (const_rtx);
1998 extern int subreg_lowpart_p (const_rtx);
1999 extern unsigned int subreg_lowpart_offset (enum machine_mode,
2000 enum machine_mode);
2001 extern unsigned int subreg_highpart_offset (enum machine_mode,
2002 enum machine_mode);
2003 extern int byte_lowpart_offset (enum machine_mode, enum machine_mode);
2004 extern rtx make_safe_from (rtx, rtx);
2005 extern rtx convert_memory_address_addr_space (enum machine_mode, rtx,
2006 addr_space_t);
2007 #define convert_memory_address(to_mode,x) \
2008 convert_memory_address_addr_space ((to_mode), (x), ADDR_SPACE_GENERIC)
2009 extern const char *get_insn_name (int);
2010 extern rtx get_last_insn_anywhere (void);
2011 extern rtx get_first_nonnote_insn (void);
2012 extern rtx get_last_nonnote_insn (void);
2013 extern void start_sequence (void);
2014 extern void push_to_sequence (rtx);
2015 extern void push_to_sequence2 (rtx, rtx);
2016 extern void end_sequence (void);
2017 #if TARGET_SUPPORTS_WIDE_INT == 0
2018 extern double_int rtx_to_double_int (const_rtx);
2019 #endif
2020 extern void cwi_output_hex (FILE *, const_rtx);
2021 #ifndef GENERATOR_FILE
2022 extern rtx immed_wide_int_const (const wide_int_ref &, enum machine_mode);
2023 #endif
2024 #if TARGET_SUPPORTS_WIDE_INT == 0
2025 extern rtx immed_double_const (HOST_WIDE_INT, HOST_WIDE_INT,
2026 enum machine_mode);
2027 #endif
2029 /* In loop-iv.c */
2031 extern rtx lowpart_subreg (enum machine_mode, rtx, enum machine_mode);
2033 /* In varasm.c */
2034 extern rtx force_const_mem (enum machine_mode, rtx);
2036 /* In varasm.c */
2038 struct function;
2039 extern rtx get_pool_constant (rtx);
2040 extern rtx get_pool_constant_mark (rtx, bool *);
2041 extern enum machine_mode get_pool_mode (const_rtx);
2042 extern rtx simplify_subtraction (rtx);
2043 extern void decide_function_section (tree);
2045 /* In function.c */
2046 extern rtx assign_stack_local (enum machine_mode, HOST_WIDE_INT, int);
2047 #define ASLK_REDUCE_ALIGN 1
2048 #define ASLK_RECORD_PAD 2
2049 extern rtx assign_stack_local_1 (enum machine_mode, HOST_WIDE_INT, int, int);
2050 extern rtx assign_stack_temp (enum machine_mode, HOST_WIDE_INT);
2051 extern rtx assign_stack_temp_for_type (enum machine_mode, HOST_WIDE_INT, tree);
2052 extern rtx assign_temp (tree, int, int);
2054 /* In emit-rtl.c */
2055 extern rtx emit_insn_before (rtx, rtx);
2056 extern rtx emit_insn_before_noloc (rtx, rtx, basic_block);
2057 extern rtx emit_insn_before_setloc (rtx, rtx, int);
2058 extern rtx emit_jump_insn_before (rtx, rtx);
2059 extern rtx emit_jump_insn_before_noloc (rtx, rtx);
2060 extern rtx emit_jump_insn_before_setloc (rtx, rtx, int);
2061 extern rtx emit_call_insn_before (rtx, rtx);
2062 extern rtx emit_call_insn_before_noloc (rtx, rtx);
2063 extern rtx emit_call_insn_before_setloc (rtx, rtx, int);
2064 extern rtx emit_debug_insn_before (rtx, rtx);
2065 extern rtx emit_debug_insn_before_noloc (rtx, rtx);
2066 extern rtx emit_debug_insn_before_setloc (rtx, rtx, int);
2067 extern rtx emit_barrier_before (rtx);
2068 extern rtx emit_label_before (rtx, rtx);
2069 extern rtx emit_note_before (enum insn_note, rtx);
2070 extern rtx emit_insn_after (rtx, rtx);
2071 extern rtx emit_insn_after_noloc (rtx, rtx, basic_block);
2072 extern rtx emit_insn_after_setloc (rtx, rtx, int);
2073 extern rtx emit_jump_insn_after (rtx, rtx);
2074 extern rtx emit_jump_insn_after_noloc (rtx, rtx);
2075 extern rtx emit_jump_insn_after_setloc (rtx, rtx, int);
2076 extern rtx emit_call_insn_after (rtx, rtx);
2077 extern rtx emit_call_insn_after_noloc (rtx, rtx);
2078 extern rtx emit_call_insn_after_setloc (rtx, rtx, int);
2079 extern rtx emit_debug_insn_after (rtx, rtx);
2080 extern rtx emit_debug_insn_after_noloc (rtx, rtx);
2081 extern rtx emit_debug_insn_after_setloc (rtx, rtx, int);
2082 extern rtx emit_barrier_after (rtx);
2083 extern rtx emit_label_after (rtx, rtx);
2084 extern rtx emit_note_after (enum insn_note, rtx);
2085 extern rtx emit_insn (rtx);
2086 extern rtx emit_debug_insn (rtx);
2087 extern rtx emit_jump_insn (rtx);
2088 extern rtx emit_call_insn (rtx);
2089 extern rtx emit_label (rtx);
2090 extern rtx emit_jump_table_data (rtx);
2091 extern rtx emit_barrier (void);
2092 extern rtx emit_note (enum insn_note);
2093 extern rtx emit_note_copy (rtx);
2094 extern rtx gen_clobber (rtx);
2095 extern rtx emit_clobber (rtx);
2096 extern rtx gen_use (rtx);
2097 extern rtx emit_use (rtx);
2098 extern rtx make_insn_raw (rtx);
2099 extern void add_function_usage_to (rtx, rtx);
2100 extern rtx last_call_insn (void);
2101 extern rtx previous_insn (rtx);
2102 extern rtx next_insn (rtx);
2103 extern rtx prev_nonnote_insn (rtx);
2104 extern rtx prev_nonnote_insn_bb (rtx);
2105 extern rtx next_nonnote_insn (rtx);
2106 extern rtx next_nonnote_insn_bb (rtx);
2107 extern rtx prev_nondebug_insn (rtx);
2108 extern rtx next_nondebug_insn (rtx);
2109 extern rtx prev_nonnote_nondebug_insn (rtx);
2110 extern rtx next_nonnote_nondebug_insn (rtx);
2111 extern rtx prev_real_insn (rtx);
2112 extern rtx next_real_insn (rtx);
2113 extern rtx prev_active_insn (rtx);
2114 extern rtx next_active_insn (rtx);
2115 extern int active_insn_p (const_rtx);
2116 extern rtx next_cc0_user (rtx);
2117 extern rtx prev_cc0_setter (rtx);
2119 /* In emit-rtl.c */
2120 extern int insn_line (const_rtx);
2121 extern const char * insn_file (const_rtx);
2122 extern tree insn_scope (const_rtx);
2123 extern location_t prologue_location, epilogue_location;
2125 /* In jump.c */
2126 extern enum rtx_code reverse_condition (enum rtx_code);
2127 extern enum rtx_code reverse_condition_maybe_unordered (enum rtx_code);
2128 extern enum rtx_code swap_condition (enum rtx_code);
2129 extern enum rtx_code unsigned_condition (enum rtx_code);
2130 extern enum rtx_code signed_condition (enum rtx_code);
2131 extern void mark_jump_label (rtx, rtx, int);
2133 /* In jump.c */
2134 extern rtx delete_related_insns (rtx);
2136 /* In recog.c */
2137 extern rtx *find_constant_term_loc (rtx *);
2139 /* In emit-rtl.c */
2140 extern rtx try_split (rtx, rtx, int);
2141 extern int split_branch_probability;
2143 /* In unknown file */
2144 extern rtx split_insns (rtx, rtx);
2146 /* In simplify-rtx.c */
2147 extern rtx simplify_const_unary_operation (enum rtx_code, enum machine_mode,
2148 rtx, enum machine_mode);
2149 extern rtx simplify_unary_operation (enum rtx_code, enum machine_mode, rtx,
2150 enum machine_mode);
2151 extern rtx simplify_const_binary_operation (enum rtx_code, enum machine_mode,
2152 rtx, rtx);
2153 extern rtx simplify_binary_operation (enum rtx_code, enum machine_mode, rtx,
2154 rtx);
2155 extern rtx simplify_ternary_operation (enum rtx_code, enum machine_mode,
2156 enum machine_mode, rtx, rtx, rtx);
2157 extern rtx simplify_const_relational_operation (enum rtx_code,
2158 enum machine_mode, rtx, rtx);
2159 extern rtx simplify_relational_operation (enum rtx_code, enum machine_mode,
2160 enum machine_mode, rtx, rtx);
2161 extern rtx simplify_gen_binary (enum rtx_code, enum machine_mode, rtx, rtx);
2162 extern rtx simplify_gen_unary (enum rtx_code, enum machine_mode, rtx,
2163 enum machine_mode);
2164 extern rtx simplify_gen_ternary (enum rtx_code, enum machine_mode,
2165 enum machine_mode, rtx, rtx, rtx);
2166 extern rtx simplify_gen_relational (enum rtx_code, enum machine_mode,
2167 enum machine_mode, rtx, rtx);
2168 extern rtx simplify_subreg (enum machine_mode, rtx, enum machine_mode,
2169 unsigned int);
2170 extern rtx simplify_gen_subreg (enum machine_mode, rtx, enum machine_mode,
2171 unsigned int);
2172 extern rtx simplify_replace_fn_rtx (rtx, const_rtx,
2173 rtx (*fn) (rtx, const_rtx, void *), void *);
2174 extern rtx simplify_replace_rtx (rtx, const_rtx, rtx);
2175 extern rtx simplify_rtx (const_rtx);
2176 extern rtx avoid_constant_pool_reference (rtx);
2177 extern rtx delegitimize_mem_from_attrs (rtx);
2178 extern bool mode_signbit_p (enum machine_mode, const_rtx);
2179 extern bool val_signbit_p (enum machine_mode, unsigned HOST_WIDE_INT);
2180 extern bool val_signbit_known_set_p (enum machine_mode,
2181 unsigned HOST_WIDE_INT);
2182 extern bool val_signbit_known_clear_p (enum machine_mode,
2183 unsigned HOST_WIDE_INT);
2185 /* In reginfo.c */
2186 extern enum machine_mode choose_hard_reg_mode (unsigned int, unsigned int,
2187 bool);
2189 /* In emit-rtl.c */
2190 extern rtx set_unique_reg_note (rtx, enum reg_note, rtx);
2191 extern rtx set_dst_reg_note (rtx, enum reg_note, rtx, rtx);
2192 extern void set_insn_deleted (rtx);
2194 /* Functions in rtlanal.c */
2196 /* Single set is implemented as macro for performance reasons. */
2197 #define single_set(I) (INSN_P (I) \
2198 ? (GET_CODE (PATTERN (I)) == SET \
2199 ? PATTERN (I) : single_set_1 (I)) \
2200 : NULL_RTX)
2201 #define single_set_1(I) single_set_2 (I, PATTERN (I))
2203 /* Structure used for passing data to REPLACE_LABEL. */
2204 struct replace_label_data
2206 rtx r1;
2207 rtx r2;
2208 bool update_label_nuses;
2211 extern enum machine_mode get_address_mode (rtx mem);
2212 extern int rtx_addr_can_trap_p (const_rtx);
2213 extern bool nonzero_address_p (const_rtx);
2214 extern int rtx_unstable_p (const_rtx);
2215 extern bool rtx_varies_p (const_rtx, bool);
2216 extern bool rtx_addr_varies_p (const_rtx, bool);
2217 extern rtx get_call_rtx_from (rtx);
2218 extern HOST_WIDE_INT get_integer_term (const_rtx);
2219 extern rtx get_related_value (const_rtx);
2220 extern bool offset_within_block_p (const_rtx, HOST_WIDE_INT);
2221 extern void split_const (rtx, rtx *, rtx *);
2222 extern bool unsigned_reg_p (rtx);
2223 extern int reg_mentioned_p (const_rtx, const_rtx);
2224 extern int count_occurrences (const_rtx, const_rtx, int);
2225 extern int reg_referenced_p (const_rtx, const_rtx);
2226 extern int reg_used_between_p (const_rtx, const_rtx, const_rtx);
2227 extern int reg_set_between_p (const_rtx, const_rtx, const_rtx);
2228 extern int commutative_operand_precedence (rtx);
2229 extern bool swap_commutative_operands_p (rtx, rtx);
2230 extern int modified_between_p (const_rtx, const_rtx, const_rtx);
2231 extern int no_labels_between_p (const_rtx, const_rtx);
2232 extern int modified_in_p (const_rtx, const_rtx);
2233 extern int reg_set_p (const_rtx, const_rtx);
2234 extern rtx single_set_2 (const_rtx, const_rtx);
2235 extern int multiple_sets (const_rtx);
2236 extern int set_noop_p (const_rtx);
2237 extern int noop_move_p (const_rtx);
2238 extern rtx find_last_value (rtx, rtx *, rtx, int);
2239 extern int refers_to_regno_p (unsigned int, unsigned int, const_rtx, rtx *);
2240 extern int reg_overlap_mentioned_p (const_rtx, const_rtx);
2241 extern const_rtx set_of (const_rtx, const_rtx);
2242 extern void record_hard_reg_sets (rtx, const_rtx, void *);
2243 extern void record_hard_reg_uses (rtx *, void *);
2244 #ifdef HARD_CONST
2245 extern void find_all_hard_reg_sets (const_rtx, HARD_REG_SET *, bool);
2246 #endif
2247 extern void note_stores (const_rtx, void (*) (rtx, const_rtx, void *), void *);
2248 extern void note_uses (rtx *, void (*) (rtx *, void *), void *);
2249 extern int dead_or_set_p (const_rtx, const_rtx);
2250 extern int dead_or_set_regno_p (const_rtx, unsigned int);
2251 extern rtx find_reg_note (const_rtx, enum reg_note, const_rtx);
2252 extern rtx find_regno_note (const_rtx, enum reg_note, unsigned int);
2253 extern rtx find_reg_equal_equiv_note (const_rtx);
2254 extern rtx find_constant_src (const_rtx);
2255 extern int find_reg_fusage (const_rtx, enum rtx_code, const_rtx);
2256 extern int find_regno_fusage (const_rtx, enum rtx_code, unsigned int);
2257 extern rtx alloc_reg_note (enum reg_note, rtx, rtx);
2258 extern void add_reg_note (rtx, enum reg_note, rtx);
2259 extern void add_int_reg_note (rtx, enum reg_note, int);
2260 extern void add_shallow_copy_of_reg_note (rtx, rtx);
2261 extern void remove_note (rtx, const_rtx);
2262 extern void remove_reg_equal_equiv_notes (rtx);
2263 extern void remove_reg_equal_equiv_notes_for_regno (unsigned int);
2264 extern int side_effects_p (const_rtx);
2265 extern int volatile_refs_p (const_rtx);
2266 extern int volatile_insn_p (const_rtx);
2267 extern int may_trap_p_1 (const_rtx, unsigned);
2268 extern int may_trap_p (const_rtx);
2269 extern int may_trap_or_fault_p (const_rtx);
2270 extern bool can_throw_internal (const_rtx);
2271 extern bool can_throw_external (const_rtx);
2272 extern bool insn_could_throw_p (const_rtx);
2273 extern bool insn_nothrow_p (const_rtx);
2274 extern bool can_nonlocal_goto (const_rtx);
2275 extern void copy_reg_eh_region_note_forward (rtx, rtx, rtx);
2276 extern void copy_reg_eh_region_note_backward (rtx, rtx, rtx);
2277 extern int inequality_comparisons_p (const_rtx);
2278 extern rtx replace_rtx (rtx, rtx, rtx);
2279 extern int replace_label (rtx *, void *);
2280 extern int rtx_referenced_p (rtx, rtx);
2281 extern bool tablejump_p (const_rtx, rtx *, rtx *);
2282 extern int computed_jump_p (const_rtx);
2284 typedef int (*rtx_function) (rtx *, void *);
2285 extern int for_each_rtx (rtx *, rtx_function, void *);
2287 /* Callback for for_each_inc_dec, to process the autoinc operation OP
2288 within MEM that sets DEST to SRC + SRCOFF, or SRC if SRCOFF is
2289 NULL. The callback is passed the same opaque ARG passed to
2290 for_each_inc_dec. Return zero to continue looking for other
2291 autoinc operations, -1 to skip OP's operands, and any other value
2292 to interrupt the traversal and return that value to the caller of
2293 for_each_inc_dec. */
2294 typedef int (*for_each_inc_dec_fn) (rtx mem, rtx op, rtx dest, rtx src,
2295 rtx srcoff, void *arg);
2296 extern int for_each_inc_dec (rtx *, for_each_inc_dec_fn, void *arg);
2298 typedef int (*rtx_equal_p_callback_function) (const_rtx *, const_rtx *,
2299 rtx *, rtx *);
2300 extern int rtx_equal_p_cb (const_rtx, const_rtx,
2301 rtx_equal_p_callback_function);
2303 typedef int (*hash_rtx_callback_function) (const_rtx, enum machine_mode, rtx *,
2304 enum machine_mode *);
2305 extern unsigned hash_rtx_cb (const_rtx, enum machine_mode, int *, int *,
2306 bool, hash_rtx_callback_function);
2308 extern rtx regno_use_in (unsigned int, rtx);
2309 extern int auto_inc_p (const_rtx);
2310 extern int in_expr_list_p (const_rtx, const_rtx);
2311 extern void remove_node_from_expr_list (const_rtx, rtx *);
2312 extern int loc_mentioned_in_p (rtx *, const_rtx);
2313 extern rtx find_first_parameter_load (rtx, rtx);
2314 extern bool keep_with_call_p (const_rtx);
2315 extern bool label_is_jump_target_p (const_rtx, const_rtx);
2316 extern int insn_rtx_cost (rtx, bool);
2318 /* Given an insn and condition, return a canonical description of
2319 the test being made. */
2320 extern rtx canonicalize_condition (rtx, rtx, int, rtx *, rtx, int, int);
2322 /* Given a JUMP_INSN, return a canonical description of the test
2323 being made. */
2324 extern rtx get_condition (rtx, rtx *, int, int);
2326 /* Information about a subreg of a hard register. */
2327 struct subreg_info
2329 /* Offset of first hard register involved in the subreg. */
2330 int offset;
2331 /* Number of hard registers involved in the subreg. */
2332 int nregs;
2333 /* Whether this subreg can be represented as a hard reg with the new
2334 mode. */
2335 bool representable_p;
2338 extern void subreg_get_info (unsigned int, enum machine_mode,
2339 unsigned int, enum machine_mode,
2340 struct subreg_info *);
2342 /* lists.c */
2344 extern void free_EXPR_LIST_list (rtx *);
2345 extern void free_INSN_LIST_list (rtx *);
2346 extern void free_EXPR_LIST_node (rtx);
2347 extern void free_INSN_LIST_node (rtx);
2348 extern rtx alloc_INSN_LIST (rtx, rtx);
2349 extern rtx copy_INSN_LIST (rtx);
2350 extern rtx concat_INSN_LIST (rtx, rtx);
2351 extern rtx alloc_EXPR_LIST (int, rtx, rtx);
2352 extern void remove_free_INSN_LIST_elem (rtx, rtx *);
2353 extern rtx remove_list_elem (rtx, rtx *);
2354 extern rtx remove_free_INSN_LIST_node (rtx *);
2355 extern rtx remove_free_EXPR_LIST_node (rtx *);
2358 /* reginfo.c */
2360 /* Resize reg info. */
2361 extern bool resize_reg_info (void);
2362 /* Free up register info memory. */
2363 extern void free_reg_info (void);
2364 extern void init_subregs_of_mode (void);
2365 extern void finish_subregs_of_mode (void);
2367 /* recog.c */
2368 extern rtx extract_asm_operands (rtx);
2369 extern int asm_noperands (const_rtx);
2370 extern const char *decode_asm_operands (rtx, rtx *, rtx **, const char **,
2371 enum machine_mode *, location_t *);
2372 extern void get_referenced_operands (const char *, bool *, unsigned int);
2374 extern enum reg_class reg_preferred_class (int);
2375 extern enum reg_class reg_alternate_class (int);
2376 extern enum reg_class reg_allocno_class (int);
2377 extern void setup_reg_classes (int, enum reg_class, enum reg_class,
2378 enum reg_class);
2380 extern void split_all_insns (void);
2381 extern unsigned int split_all_insns_noflow (void);
2383 #define MAX_SAVED_CONST_INT 64
2384 extern GTY(()) rtx const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1];
2386 #define const0_rtx (const_int_rtx[MAX_SAVED_CONST_INT])
2387 #define const1_rtx (const_int_rtx[MAX_SAVED_CONST_INT+1])
2388 #define const2_rtx (const_int_rtx[MAX_SAVED_CONST_INT+2])
2389 #define constm1_rtx (const_int_rtx[MAX_SAVED_CONST_INT-1])
2390 extern GTY(()) rtx const_true_rtx;
2392 extern GTY(()) rtx const_tiny_rtx[4][(int) MAX_MACHINE_MODE];
2394 /* Returns a constant 0 rtx in mode MODE. Integer modes are treated the
2395 same as VOIDmode. */
2397 #define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)])
2399 /* Likewise, for the constants 1 and 2 and -1. */
2401 #define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)])
2402 #define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)])
2403 #define CONSTM1_RTX(MODE) (const_tiny_rtx[3][(int) (MODE)])
2405 extern GTY(()) rtx pc_rtx;
2406 extern GTY(()) rtx cc0_rtx;
2407 extern GTY(()) rtx ret_rtx;
2408 extern GTY(()) rtx simple_return_rtx;
2410 /* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg
2411 is used to represent the frame pointer. This is because the
2412 hard frame pointer and the automatic variables are separated by an amount
2413 that cannot be determined until after register allocation. We can assume
2414 that in this case ELIMINABLE_REGS will be defined, one action of which
2415 will be to eliminate FRAME_POINTER_REGNUM into HARD_FRAME_POINTER_REGNUM. */
2416 #ifndef HARD_FRAME_POINTER_REGNUM
2417 #define HARD_FRAME_POINTER_REGNUM FRAME_POINTER_REGNUM
2418 #endif
2420 #ifndef HARD_FRAME_POINTER_IS_FRAME_POINTER
2421 #define HARD_FRAME_POINTER_IS_FRAME_POINTER \
2422 (HARD_FRAME_POINTER_REGNUM == FRAME_POINTER_REGNUM)
2423 #endif
2425 #ifndef HARD_FRAME_POINTER_IS_ARG_POINTER
2426 #define HARD_FRAME_POINTER_IS_ARG_POINTER \
2427 (HARD_FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM)
2428 #endif
2430 /* Index labels for global_rtl. */
2431 enum global_rtl_index
2433 GR_STACK_POINTER,
2434 GR_FRAME_POINTER,
2435 /* For register elimination to work properly these hard_frame_pointer_rtx,
2436 frame_pointer_rtx, and arg_pointer_rtx must be the same if they refer to
2437 the same register. */
2438 #if FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM
2439 GR_ARG_POINTER = GR_FRAME_POINTER,
2440 #endif
2441 #if HARD_FRAME_POINTER_IS_FRAME_POINTER
2442 GR_HARD_FRAME_POINTER = GR_FRAME_POINTER,
2443 #else
2444 GR_HARD_FRAME_POINTER,
2445 #endif
2446 #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
2447 #if HARD_FRAME_POINTER_IS_ARG_POINTER
2448 GR_ARG_POINTER = GR_HARD_FRAME_POINTER,
2449 #else
2450 GR_ARG_POINTER,
2451 #endif
2452 #endif
2453 GR_VIRTUAL_INCOMING_ARGS,
2454 GR_VIRTUAL_STACK_ARGS,
2455 GR_VIRTUAL_STACK_DYNAMIC,
2456 GR_VIRTUAL_OUTGOING_ARGS,
2457 GR_VIRTUAL_CFA,
2458 GR_VIRTUAL_PREFERRED_STACK_BOUNDARY,
2460 GR_MAX
2463 /* Target-dependent globals. */
2464 struct GTY(()) target_rtl {
2465 /* All references to the hard registers in global_rtl_index go through
2466 these unique rtl objects. On machines where the frame-pointer and
2467 arg-pointer are the same register, they use the same unique object.
2469 After register allocation, other rtl objects which used to be pseudo-regs
2470 may be clobbered to refer to the frame-pointer register.
2471 But references that were originally to the frame-pointer can be
2472 distinguished from the others because they contain frame_pointer_rtx.
2474 When to use frame_pointer_rtx and hard_frame_pointer_rtx is a little
2475 tricky: until register elimination has taken place hard_frame_pointer_rtx
2476 should be used if it is being set, and frame_pointer_rtx otherwise. After
2477 register elimination hard_frame_pointer_rtx should always be used.
2478 On machines where the two registers are same (most) then these are the
2479 same. */
2480 rtx x_global_rtl[GR_MAX];
2482 /* A unique representation of (REG:Pmode PIC_OFFSET_TABLE_REGNUM). */
2483 rtx x_pic_offset_table_rtx;
2485 /* A unique representation of (REG:Pmode RETURN_ADDRESS_POINTER_REGNUM).
2486 This is used to implement __builtin_return_address for some machines;
2487 see for instance the MIPS port. */
2488 rtx x_return_address_pointer_rtx;
2490 /* Commonly used RTL for hard registers. These objects are not
2491 necessarily unique, so we allocate them separately from global_rtl.
2492 They are initialized once per compilation unit, then copied into
2493 regno_reg_rtx at the beginning of each function. */
2494 rtx x_initial_regno_reg_rtx[FIRST_PSEUDO_REGISTER];
2496 /* A sample (mem:M stack_pointer_rtx) rtx for each mode M. */
2497 rtx x_top_of_stack[MAX_MACHINE_MODE];
2499 /* Static hunks of RTL used by the aliasing code; these are treated
2500 as persistent to avoid unnecessary RTL allocations. */
2501 rtx x_static_reg_base_value[FIRST_PSEUDO_REGISTER];
2503 /* The default memory attributes for each mode. */
2504 struct mem_attrs *x_mode_mem_attrs[(int) MAX_MACHINE_MODE];
2507 extern GTY(()) struct target_rtl default_target_rtl;
2508 #if SWITCHABLE_TARGET
2509 extern struct target_rtl *this_target_rtl;
2510 #else
2511 #define this_target_rtl (&default_target_rtl)
2512 #endif
2514 #define global_rtl \
2515 (this_target_rtl->x_global_rtl)
2516 #define pic_offset_table_rtx \
2517 (this_target_rtl->x_pic_offset_table_rtx)
2518 #define return_address_pointer_rtx \
2519 (this_target_rtl->x_return_address_pointer_rtx)
2520 #define top_of_stack \
2521 (this_target_rtl->x_top_of_stack)
2522 #define mode_mem_attrs \
2523 (this_target_rtl->x_mode_mem_attrs)
2525 /* All references to certain hard regs, except those created
2526 by allocating pseudo regs into them (when that's possible),
2527 go through these unique rtx objects. */
2528 #define stack_pointer_rtx (global_rtl[GR_STACK_POINTER])
2529 #define frame_pointer_rtx (global_rtl[GR_FRAME_POINTER])
2530 #define hard_frame_pointer_rtx (global_rtl[GR_HARD_FRAME_POINTER])
2531 #define arg_pointer_rtx (global_rtl[GR_ARG_POINTER])
2533 #ifndef GENERATOR_FILE
2534 /* Return the attributes of a MEM rtx. */
2535 static inline struct mem_attrs *
2536 get_mem_attrs (const_rtx x)
2538 struct mem_attrs *attrs;
2540 attrs = MEM_ATTRS (x);
2541 if (!attrs)
2542 attrs = mode_mem_attrs[(int) GET_MODE (x)];
2543 return attrs;
2545 #endif
2547 /* Include the RTL generation functions. */
2549 #ifndef GENERATOR_FILE
2550 #include "genrtl.h"
2551 #undef gen_rtx_ASM_INPUT
2552 #define gen_rtx_ASM_INPUT(MODE, ARG0) \
2553 gen_rtx_fmt_si (ASM_INPUT, (MODE), (ARG0), 0)
2554 #define gen_rtx_ASM_INPUT_loc(MODE, ARG0, LOC) \
2555 gen_rtx_fmt_si (ASM_INPUT, (MODE), (ARG0), (LOC))
2556 #endif
2558 /* There are some RTL codes that require special attention; the
2559 generation functions included above do the raw handling. If you
2560 add to this list, modify special_rtx in gengenrtl.c as well. */
2562 extern rtx gen_rtx_CONST_INT (enum machine_mode, HOST_WIDE_INT);
2563 extern rtx gen_rtx_CONST_VECTOR (enum machine_mode, rtvec);
2564 extern rtx gen_raw_REG (enum machine_mode, int);
2565 extern rtx gen_rtx_REG (enum machine_mode, unsigned);
2566 extern rtx gen_rtx_SUBREG (enum machine_mode, rtx, int);
2567 extern rtx gen_rtx_MEM (enum machine_mode, rtx);
2568 extern rtx gen_rtx_VAR_LOCATION (enum machine_mode, tree, rtx,
2569 enum var_init_status);
2571 #define GEN_INT(N) gen_rtx_CONST_INT (VOIDmode, (N))
2573 /* Virtual registers are used during RTL generation to refer to locations into
2574 the stack frame when the actual location isn't known until RTL generation
2575 is complete. The routine instantiate_virtual_regs replaces these with
2576 the proper value, which is normally {frame,arg,stack}_pointer_rtx plus
2577 a constant. */
2579 #define FIRST_VIRTUAL_REGISTER (FIRST_PSEUDO_REGISTER)
2581 /* This points to the first word of the incoming arguments passed on the stack,
2582 either by the caller or by the callee when pretending it was passed by the
2583 caller. */
2585 #define virtual_incoming_args_rtx (global_rtl[GR_VIRTUAL_INCOMING_ARGS])
2587 #define VIRTUAL_INCOMING_ARGS_REGNUM (FIRST_VIRTUAL_REGISTER)
2589 /* If FRAME_GROWS_DOWNWARD, this points to immediately above the first
2590 variable on the stack. Otherwise, it points to the first variable on
2591 the stack. */
2593 #define virtual_stack_vars_rtx (global_rtl[GR_VIRTUAL_STACK_ARGS])
2595 #define VIRTUAL_STACK_VARS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 1)
2597 /* This points to the location of dynamically-allocated memory on the stack
2598 immediately after the stack pointer has been adjusted by the amount
2599 desired. */
2601 #define virtual_stack_dynamic_rtx (global_rtl[GR_VIRTUAL_STACK_DYNAMIC])
2603 #define VIRTUAL_STACK_DYNAMIC_REGNUM ((FIRST_VIRTUAL_REGISTER) + 2)
2605 /* This points to the location in the stack at which outgoing arguments should
2606 be written when the stack is pre-pushed (arguments pushed using push
2607 insns always use sp). */
2609 #define virtual_outgoing_args_rtx (global_rtl[GR_VIRTUAL_OUTGOING_ARGS])
2611 #define VIRTUAL_OUTGOING_ARGS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 3)
2613 /* This points to the Canonical Frame Address of the function. This
2614 should correspond to the CFA produced by INCOMING_FRAME_SP_OFFSET,
2615 but is calculated relative to the arg pointer for simplicity; the
2616 frame pointer nor stack pointer are necessarily fixed relative to
2617 the CFA until after reload. */
2619 #define virtual_cfa_rtx (global_rtl[GR_VIRTUAL_CFA])
2621 #define VIRTUAL_CFA_REGNUM ((FIRST_VIRTUAL_REGISTER) + 4)
2623 #define LAST_VIRTUAL_POINTER_REGISTER ((FIRST_VIRTUAL_REGISTER) + 4)
2625 /* This is replaced by crtl->preferred_stack_boundary / BITS_PER_UNIT
2626 when finalized. */
2628 #define virtual_preferred_stack_boundary_rtx \
2629 (global_rtl[GR_VIRTUAL_PREFERRED_STACK_BOUNDARY])
2631 #define VIRTUAL_PREFERRED_STACK_BOUNDARY_REGNUM \
2632 ((FIRST_VIRTUAL_REGISTER) + 5)
2634 #define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 5)
2636 /* Nonzero if REGNUM is a pointer into the stack frame. */
2637 #define REGNO_PTR_FRAME_P(REGNUM) \
2638 ((REGNUM) == STACK_POINTER_REGNUM \
2639 || (REGNUM) == FRAME_POINTER_REGNUM \
2640 || (REGNUM) == HARD_FRAME_POINTER_REGNUM \
2641 || (REGNUM) == ARG_POINTER_REGNUM \
2642 || ((REGNUM) >= FIRST_VIRTUAL_REGISTER \
2643 && (REGNUM) <= LAST_VIRTUAL_POINTER_REGISTER))
2645 /* REGNUM never really appearing in the INSN stream. */
2646 #define INVALID_REGNUM (~(unsigned int) 0)
2648 /* REGNUM for which no debug information can be generated. */
2649 #define IGNORED_DWARF_REGNUM (INVALID_REGNUM - 1)
2651 extern rtx output_constant_def (tree, int);
2652 extern rtx lookup_constant_def (tree);
2654 /* Nonzero after end of reload pass.
2655 Set to 1 or 0 by reload1.c. */
2657 extern int reload_completed;
2659 /* Nonzero after thread_prologue_and_epilogue_insns has run. */
2660 extern int epilogue_completed;
2662 /* Set to 1 while reload_as_needed is operating.
2663 Required by some machines to handle any generated moves differently. */
2665 extern int reload_in_progress;
2667 /* Set to 1 while in lra. */
2668 extern int lra_in_progress;
2670 /* This macro indicates whether you may create a new
2671 pseudo-register. */
2673 #define can_create_pseudo_p() (!reload_in_progress && !reload_completed)
2675 #ifdef STACK_REGS
2676 /* Nonzero after end of regstack pass.
2677 Set to 1 or 0 by reg-stack.c. */
2678 extern int regstack_completed;
2679 #endif
2681 /* If this is nonzero, we do not bother generating VOLATILE
2682 around volatile memory references, and we are willing to
2683 output indirect addresses. If cse is to follow, we reject
2684 indirect addresses so a useful potential cse is generated;
2685 if it is used only once, instruction combination will produce
2686 the same indirect address eventually. */
2687 extern int cse_not_expected;
2689 /* Translates rtx code to tree code, for those codes needed by
2690 REAL_ARITHMETIC. The function returns an int because the caller may not
2691 know what `enum tree_code' means. */
2693 extern int rtx_to_tree_code (enum rtx_code);
2695 /* In cse.c */
2696 extern int delete_trivially_dead_insns (rtx, int);
2697 extern int exp_equiv_p (const_rtx, const_rtx, int, bool);
2698 extern unsigned hash_rtx (const_rtx x, enum machine_mode, int *, int *, bool);
2700 /* In dse.c */
2701 extern bool check_for_inc_dec (rtx insn);
2703 /* In jump.c */
2704 extern int comparison_dominates_p (enum rtx_code, enum rtx_code);
2705 extern bool jump_to_label_p (rtx);
2706 extern int condjump_p (const_rtx);
2707 extern int any_condjump_p (const_rtx);
2708 extern int any_uncondjump_p (const_rtx);
2709 extern rtx pc_set (const_rtx);
2710 extern rtx condjump_label (const_rtx);
2711 extern int simplejump_p (const_rtx);
2712 extern int returnjump_p (rtx);
2713 extern int eh_returnjump_p (rtx);
2714 extern int onlyjump_p (const_rtx);
2715 extern int only_sets_cc0_p (const_rtx);
2716 extern int sets_cc0_p (const_rtx);
2717 extern int invert_jump_1 (rtx, rtx);
2718 extern int invert_jump (rtx, rtx, int);
2719 extern int rtx_renumbered_equal_p (const_rtx, const_rtx);
2720 extern int true_regnum (const_rtx);
2721 extern unsigned int reg_or_subregno (const_rtx);
2722 extern int redirect_jump_1 (rtx, rtx);
2723 extern void redirect_jump_2 (rtx, rtx, rtx, int, int);
2724 extern int redirect_jump (rtx, rtx, int);
2725 extern void rebuild_jump_labels (rtx);
2726 extern void rebuild_jump_labels_chain (rtx);
2727 extern rtx reversed_comparison (const_rtx, enum machine_mode);
2728 extern enum rtx_code reversed_comparison_code (const_rtx, const_rtx);
2729 extern enum rtx_code reversed_comparison_code_parts (enum rtx_code, const_rtx,
2730 const_rtx, const_rtx);
2731 extern void delete_for_peephole (rtx, rtx);
2732 extern int condjump_in_parallel_p (const_rtx);
2734 /* In emit-rtl.c. */
2735 extern int max_reg_num (void);
2736 extern int max_label_num (void);
2737 extern int get_first_label_num (void);
2738 extern void maybe_set_first_label_num (rtx);
2739 extern void delete_insns_since (rtx);
2740 extern void mark_reg_pointer (rtx, int);
2741 extern void mark_user_reg (rtx);
2742 extern void reset_used_flags (rtx);
2743 extern void set_used_flags (rtx);
2744 extern void reorder_insns (rtx, rtx, rtx);
2745 extern void reorder_insns_nobb (rtx, rtx, rtx);
2746 extern int get_max_insn_count (void);
2747 extern int in_sequence_p (void);
2748 extern void init_emit (void);
2749 extern void init_emit_regs (void);
2750 extern void init_derived_machine_modes (void);
2751 extern void init_emit_once (void);
2752 extern void push_topmost_sequence (void);
2753 extern void pop_topmost_sequence (void);
2754 extern void set_new_first_and_last_insn (rtx, rtx);
2755 extern unsigned int unshare_all_rtl (void);
2756 extern void unshare_all_rtl_again (rtx);
2757 extern void unshare_all_rtl_in_chain (rtx);
2758 extern void verify_rtl_sharing (void);
2759 extern void add_insn (rtx);
2760 extern void add_insn_before (rtx, rtx, basic_block);
2761 extern void add_insn_after (rtx, rtx, basic_block);
2762 extern void remove_insn (rtx);
2763 extern rtx emit (rtx);
2764 extern void delete_insn (rtx);
2765 extern rtx entry_of_function (void);
2766 extern void emit_insn_at_entry (rtx);
2767 extern void delete_insn_chain (rtx, rtx, bool);
2768 extern rtx unlink_insn_chain (rtx, rtx);
2769 extern void delete_insn_and_edges (rtx);
2770 extern rtx gen_lowpart_SUBREG (enum machine_mode, rtx);
2771 extern rtx gen_const_mem (enum machine_mode, rtx);
2772 extern rtx gen_frame_mem (enum machine_mode, rtx);
2773 extern rtx gen_tmp_stack_mem (enum machine_mode, rtx);
2774 extern bool validate_subreg (enum machine_mode, enum machine_mode,
2775 const_rtx, unsigned int);
2777 /* In combine.c */
2778 extern unsigned int extended_count (const_rtx, enum machine_mode, int);
2779 extern rtx remove_death (unsigned int, rtx);
2780 extern void dump_combine_stats (FILE *);
2781 extern void dump_combine_total_stats (FILE *);
2782 extern rtx make_compound_operation (rtx, enum rtx_code);
2784 /* In cfgcleanup.c */
2785 extern void delete_dead_jumptables (void);
2787 /* In sched-rgn.c. */
2788 extern void schedule_insns (void);
2790 /* In sched-ebb.c. */
2791 extern void schedule_ebbs (void);
2793 /* In sel-sched-dump.c. */
2794 extern void sel_sched_fix_param (const char *param, const char *val);
2796 /* In print-rtl.c */
2797 extern const char *print_rtx_head;
2798 extern void debug (const rtx_def &ref);
2799 extern void debug (const rtx_def *ptr);
2800 extern void debug_rtx (const_rtx);
2801 extern void debug_rtx_list (const_rtx, int);
2802 extern void debug_rtx_range (const_rtx, const_rtx);
2803 extern const_rtx debug_rtx_find (const_rtx, int);
2804 extern void print_mem_expr (FILE *, const_tree);
2805 extern void print_rtl (FILE *, const_rtx);
2806 extern void print_simple_rtl (FILE *, const_rtx);
2807 extern int print_rtl_single (FILE *, const_rtx);
2808 extern int print_rtl_single_with_indent (FILE *, const_rtx, int);
2809 extern void print_inline_rtx (FILE *, const_rtx, int);
2811 /* Functions in sched-vis.c. FIXME: Ideally these functions would
2812 not be in sched-vis.c but in rtl.c, because they are not only used
2813 by the scheduler anymore but for all "slim" RTL dumping. */
2814 extern void dump_value_slim (FILE *, const_rtx, int);
2815 extern void dump_insn_slim (FILE *, const_rtx);
2816 extern void dump_rtl_slim (FILE *, const_rtx, const_rtx, int, int);
2817 extern void print_value (pretty_printer *, const_rtx, int);
2818 extern void print_pattern (pretty_printer *, const_rtx, int);
2819 extern void print_insn (pretty_printer *, const_rtx, int);
2820 extern void rtl_dump_bb_for_graph (pretty_printer *, basic_block);
2821 extern const char *str_pattern_slim (const_rtx);
2823 /* In function.c */
2824 extern void reposition_prologue_and_epilogue_notes (void);
2825 extern int prologue_epilogue_contains (const_rtx);
2826 extern int sibcall_epilogue_contains (const_rtx);
2827 extern void update_temp_slot_address (rtx, rtx);
2828 extern void maybe_copy_prologue_epilogue_insn (rtx, rtx);
2829 extern void set_return_jump_label (rtx);
2831 /* In stmt.c */
2832 extern void expand_null_return (void);
2833 extern void expand_naked_return (void);
2834 extern void emit_jump (rtx);
2836 /* In expr.c */
2837 extern rtx move_by_pieces (rtx, rtx, unsigned HOST_WIDE_INT,
2838 unsigned int, int);
2839 extern HOST_WIDE_INT find_args_size_adjust (rtx);
2840 extern int fixup_args_size_notes (rtx, rtx, int);
2842 /* In cfgrtl.c */
2843 extern void print_rtl_with_bb (FILE *, const_rtx, int);
2844 extern rtx duplicate_insn_chain (rtx, rtx);
2846 /* In expmed.c */
2847 extern void init_expmed (void);
2848 extern void expand_inc (rtx, rtx);
2849 extern void expand_dec (rtx, rtx);
2851 /* In lower-subreg.c */
2852 extern void init_lower_subreg (void);
2854 /* In gcse.c */
2855 extern bool can_copy_p (enum machine_mode);
2856 extern bool can_assign_to_reg_without_clobbers_p (rtx);
2857 extern rtx fis_get_condition (rtx);
2859 /* In ira.c */
2860 #ifdef HARD_CONST
2861 extern HARD_REG_SET eliminable_regset;
2862 #endif
2863 extern void mark_elimination (int, int);
2865 /* In reginfo.c */
2866 extern int reg_classes_intersect_p (reg_class_t, reg_class_t);
2867 extern int reg_class_subset_p (reg_class_t, reg_class_t);
2868 extern void globalize_reg (tree, int);
2869 extern void init_reg_modes_target (void);
2870 extern void init_regs (void);
2871 extern void reinit_regs (void);
2872 extern void init_fake_stack_mems (void);
2873 extern void save_register_info (void);
2874 extern void init_reg_sets (void);
2875 extern void regclass (rtx, int);
2876 extern void reg_scan (rtx, unsigned int);
2877 extern void fix_register (const char *, int, int);
2878 extern bool invalid_mode_change_p (unsigned int, enum reg_class);
2880 /* In reload1.c */
2881 extern int function_invariant_p (const_rtx);
2883 /* In calls.c */
2884 enum libcall_type
2886 LCT_NORMAL = 0,
2887 LCT_CONST = 1,
2888 LCT_PURE = 2,
2889 LCT_NORETURN = 3,
2890 LCT_THROW = 4,
2891 LCT_RETURNS_TWICE = 5
2894 extern void emit_library_call (rtx, enum libcall_type, enum machine_mode, int,
2895 ...);
2896 extern rtx emit_library_call_value (rtx, rtx, enum libcall_type,
2897 enum machine_mode, int, ...);
2899 /* In varasm.c */
2900 extern void init_varasm_once (void);
2902 extern rtx make_debug_expr_from_rtl (const_rtx);
2904 /* In read-rtl.c */
2905 extern bool read_rtx (const char *, rtx *);
2907 /* In alias.c */
2908 extern rtx canon_rtx (rtx);
2909 extern int true_dependence (const_rtx, enum machine_mode, const_rtx);
2910 extern rtx get_addr (rtx);
2911 extern int canon_true_dependence (const_rtx, enum machine_mode, rtx,
2912 const_rtx, rtx);
2913 extern int read_dependence (const_rtx, const_rtx);
2914 extern int anti_dependence (const_rtx, const_rtx);
2915 extern int canon_anti_dependence (const_rtx, bool,
2916 const_rtx, enum machine_mode, rtx);
2917 extern int output_dependence (const_rtx, const_rtx);
2918 extern int may_alias_p (const_rtx, const_rtx);
2919 extern void init_alias_target (void);
2920 extern void init_alias_analysis (void);
2921 extern void end_alias_analysis (void);
2922 extern void vt_equate_reg_base_value (const_rtx, const_rtx);
2923 extern bool memory_modified_in_insn_p (const_rtx, const_rtx);
2924 extern bool memory_must_be_modified_in_insn_p (const_rtx, const_rtx);
2925 extern bool may_be_sp_based_p (rtx);
2926 extern rtx gen_hard_reg_clobber (enum machine_mode, unsigned int);
2927 extern rtx get_reg_known_value (unsigned int);
2928 extern bool get_reg_known_equiv_p (unsigned int);
2929 extern rtx get_reg_base_value (unsigned int);
2931 #ifdef STACK_REGS
2932 extern int stack_regs_mentioned (const_rtx insn);
2933 #endif
2935 /* In toplev.c */
2936 extern GTY(()) rtx stack_limit_rtx;
2938 /* In predict.c */
2939 extern void invert_br_probabilities (rtx);
2940 extern bool expensive_function_p (int);
2942 /* In var-tracking.c */
2943 extern unsigned int variable_tracking_main (void);
2945 /* In stor-layout.c. */
2946 extern void get_mode_bounds (enum machine_mode, int, enum machine_mode,
2947 rtx *, rtx *);
2949 /* In loop-iv.c */
2950 extern rtx canon_condition (rtx);
2951 extern void simplify_using_condition (rtx, rtx *, bitmap);
2953 /* In final.c */
2954 extern unsigned int compute_alignments (void);
2955 extern void update_alignments (vec<rtx> &);
2956 extern int asm_str_count (const char *templ);
2958 struct rtl_hooks
2960 rtx (*gen_lowpart) (enum machine_mode, rtx);
2961 rtx (*gen_lowpart_no_emit) (enum machine_mode, rtx);
2962 rtx (*reg_nonzero_bits) (const_rtx, enum machine_mode, const_rtx, enum machine_mode,
2963 unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT *);
2964 rtx (*reg_num_sign_bit_copies) (const_rtx, enum machine_mode, const_rtx, enum machine_mode,
2965 unsigned int, unsigned int *);
2966 bool (*reg_truncated_to_mode) (enum machine_mode, const_rtx);
2968 /* Whenever you add entries here, make sure you adjust rtlhooks-def.h. */
2971 /* Each pass can provide its own. */
2972 extern struct rtl_hooks rtl_hooks;
2974 /* ... but then it has to restore these. */
2975 extern const struct rtl_hooks general_rtl_hooks;
2977 /* Keep this for the nonce. */
2978 #define gen_lowpart rtl_hooks.gen_lowpart
2980 extern void insn_locations_init (void);
2981 extern void insn_locations_finalize (void);
2982 extern void set_curr_insn_location (location_t);
2983 extern location_t curr_insn_location (void);
2984 extern bool optimize_insn_for_size_p (void);
2985 extern bool optimize_insn_for_speed_p (void);
2987 /* rtl-error.c */
2988 extern void _fatal_insn_not_found (const_rtx, const char *, int, const char *)
2989 ATTRIBUTE_NORETURN;
2990 extern void _fatal_insn (const char *, const_rtx, const char *, int, const char *)
2991 ATTRIBUTE_NORETURN;
2993 #define fatal_insn(msgid, insn) \
2994 _fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__)
2995 #define fatal_insn_not_found(insn) \
2996 _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__)
2998 /* reginfo.c */
2999 extern tree GTY(()) global_regs_decl[FIRST_PSEUDO_REGISTER];
3002 #endif /* ! GCC_RTL_H */