2014-08-12 Thomas Preud'homme <thomas.preudhomme@arm.com>
[official-gcc.git] / gcc / rtl.h
blobb6555ea97aab9e6a43172622e9d0bb8e1b6a9d26
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[2];
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)"))) 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 JUMP_INSN if it is a crossing jump.
280 1 in a CALL_INSN if it is a sibling call.
281 1 in a SET that is for a return.
282 In a CODE_LABEL, part of the two-bit alternate entry field.
283 1 in a CONCAT is VAL_EXPR_IS_COPIED in var-tracking.c.
284 1 in a VALUE is SP_BASED_VALUE_P in cselib.c.
285 1 in a SUBREG generated by LRA for reload insns. */
286 unsigned int jump : 1;
287 /* In a CODE_LABEL, part of the two-bit alternate entry field.
288 1 in a MEM if it cannot trap.
289 1 in a CALL_INSN logically equivalent to
290 ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P. */
291 unsigned int call : 1;
292 /* 1 in a REG, MEM, or CONCAT if the value is set at most once, anywhere.
293 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P.
294 1 in a SYMBOL_REF if it addresses something in the per-function
295 constants pool.
296 1 in a CALL_INSN logically equivalent to ECF_CONST and TREE_READONLY.
297 1 in a NOTE, or EXPR_LIST for a const call.
298 1 in a JUMP_INSN of an annulling branch.
299 1 in a CONCAT is VAL_EXPR_IS_CLOBBERED in var-tracking.c.
300 1 in a preserved VALUE is PRESERVED_VALUE_P in cselib.c.
301 1 in a clobber temporarily created for LRA. */
302 unsigned int unchanging : 1;
303 /* 1 in a MEM or ASM_OPERANDS expression if the memory reference is volatile.
304 1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL, BARRIER, or NOTE
305 if it has been deleted.
306 1 in a REG expression if corresponds to a variable declared by the user,
307 0 for an internally generated temporary.
308 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P.
309 1 in a LABEL_REF, REG_LABEL_TARGET or REG_LABEL_OPERAND note for a
310 non-local label.
311 In a SYMBOL_REF, this flag is used for machine-specific purposes.
312 In a PREFETCH, this flag indicates that it should be considered a scheduling
313 barrier.
314 1 in a CONCAT is VAL_NEEDS_RESOLUTION in var-tracking.c. */
315 unsigned int volatil : 1;
316 /* 1 in a REG if the register is used only in exit code a loop.
317 1 in a SUBREG expression if was generated from a variable with a
318 promoted mode.
319 1 in a CODE_LABEL if the label is used for nonlocal gotos
320 and must not be deleted even if its count is zero.
321 1 in an INSN, JUMP_INSN or CALL_INSN if this insn must be scheduled
322 together with the preceding insn. Valid only within sched.
323 1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and
324 from the target of a branch. Valid from reorg until end of compilation;
325 cleared before used.
327 The name of the field is historical. It used to be used in MEMs
328 to record whether the MEM accessed part of a structure. */
329 unsigned int in_struct : 1;
330 /* At the end of RTL generation, 1 if this rtx is used. This is used for
331 copying shared structure. See `unshare_all_rtl'.
332 In a REG, this is not needed for that purpose, and used instead
333 in `leaf_renumber_regs_insn'.
334 1 in a SYMBOL_REF, means that emit_library_call
335 has used it as the function.
336 1 in a CONCAT is VAL_HOLDS_TRACK_EXPR in var-tracking.c.
337 1 in a VALUE or DEBUG_EXPR is VALUE_RECURSED_INTO in var-tracking.c. */
338 unsigned int used : 1;
339 /* 1 in an INSN or a SET if this rtx is related to the call frame,
340 either changing how we compute the frame address or saving and
341 restoring registers in the prologue and epilogue.
342 1 in a REG or MEM if it is a pointer.
343 1 in a SYMBOL_REF if it addresses something in the per-function
344 constant string pool.
345 1 in a VALUE is VALUE_CHANGED in var-tracking.c. */
346 unsigned frame_related : 1;
347 /* 1 in a REG or PARALLEL that is the current function's return value.
348 1 in a SYMBOL_REF for a weak symbol.
349 1 in a CALL_INSN logically equivalent to ECF_PURE and DECL_PURE_P.
350 1 in a CONCAT is VAL_EXPR_HAS_REVERSE in var-tracking.c.
351 1 in a VALUE or DEBUG_EXPR is NO_LOC_P in var-tracking.c. */
352 unsigned return_val : 1;
354 union {
355 /* The final union field is aligned to 64 bits on LP64 hosts,
356 giving a 32-bit gap after the fields above. We optimize the
357 layout for that case and use the gap for extra code-specific
358 information. */
360 /* The ORIGINAL_REGNO of a REG. */
361 unsigned int original_regno;
363 /* The INSN_UID of an RTX_INSN-class code. */
364 int insn_uid;
366 /* The SYMBOL_REF_FLAGS of a SYMBOL_REF. */
367 unsigned int symbol_ref_flags;
369 /* The PAT_VAR_LOCATION_STATUS of a VAR_LOCATION. */
370 enum var_init_status var_location_status;
372 /* In a CONST_WIDE_INT (aka hwivec_def), this is the number of
373 HOST_WIDE_INTs in the hwivec_def. */
374 unsigned int num_elem;
375 } GTY ((skip)) u2;
377 /* The first element of the operands of this rtx.
378 The number of operands and their types are controlled
379 by the `code' field, according to rtl.def. */
380 union u {
381 rtunion fld[1];
382 HOST_WIDE_INT hwint[1];
383 struct block_symbol block_sym;
384 struct real_value rv;
385 struct fixed_value fv;
386 struct hwivec_def hwiv;
387 } GTY ((special ("rtx_def"), desc ("GET_CODE (&%0)"))) u;
390 /* The size in bytes of an rtx header (code, mode and flags). */
391 #define RTX_HDR_SIZE offsetof (struct rtx_def, u)
393 /* The size in bytes of an rtx with code CODE. */
394 #define RTX_CODE_SIZE(CODE) rtx_code_size[CODE]
396 #define NULL_RTX (rtx) 0
398 /* The "next" and "previous" RTX, relative to this one. */
400 #define RTX_NEXT(X) (rtx_next[GET_CODE (X)] == 0 ? NULL \
401 : *(rtx *)(((char *)X) + rtx_next[GET_CODE (X)]))
403 /* FIXME: the "NEXT_INSN (PREV_INSN (X)) == X" condition shouldn't be needed.
405 #define RTX_PREV(X) ((INSN_P (X) \
406 || NOTE_P (X) \
407 || JUMP_TABLE_DATA_P (X) \
408 || BARRIER_P (X) \
409 || LABEL_P (X)) \
410 && PREV_INSN (X) != NULL \
411 && NEXT_INSN (PREV_INSN (X)) == X \
412 ? PREV_INSN (X) : NULL)
414 /* Define macros to access the `code' field of the rtx. */
416 #define GET_CODE(RTX) ((enum rtx_code) (RTX)->code)
417 #define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE))
419 #define GET_MODE(RTX) ((enum machine_mode) (RTX)->mode)
420 #define PUT_MODE(RTX, MODE) ((RTX)->mode = (MODE))
422 /* RTL vector. These appear inside RTX's when there is a need
423 for a variable number of things. The principle use is inside
424 PARALLEL expressions. */
426 struct GTY(()) rtvec_def {
427 int num_elem; /* number of elements */
428 rtx GTY ((length ("%h.num_elem"))) elem[1];
431 #define NULL_RTVEC (rtvec) 0
433 #define GET_NUM_ELEM(RTVEC) ((RTVEC)->num_elem)
434 #define PUT_NUM_ELEM(RTVEC, NUM) ((RTVEC)->num_elem = (NUM))
436 /* Predicate yielding nonzero iff X is an rtx for a register. */
437 #define REG_P(X) (GET_CODE (X) == REG)
439 /* Predicate yielding nonzero iff X is an rtx for a memory location. */
440 #define MEM_P(X) (GET_CODE (X) == MEM)
442 #if TARGET_SUPPORTS_WIDE_INT
444 /* Match CONST_*s that can represent compile-time constant integers. */
445 #define CASE_CONST_SCALAR_INT \
446 case CONST_INT: \
447 case CONST_WIDE_INT
449 /* Match CONST_*s for which pointer equality corresponds to value
450 equality. */
451 #define CASE_CONST_UNIQUE \
452 case CONST_INT: \
453 case CONST_WIDE_INT: \
454 case CONST_DOUBLE: \
455 case CONST_FIXED
457 /* Match all CONST_* rtxes. */
458 #define CASE_CONST_ANY \
459 case CONST_INT: \
460 case CONST_WIDE_INT: \
461 case CONST_DOUBLE: \
462 case CONST_FIXED: \
463 case CONST_VECTOR
465 #else
467 /* Match CONST_*s that can represent compile-time constant integers. */
468 #define CASE_CONST_SCALAR_INT \
469 case CONST_INT: \
470 case CONST_DOUBLE
472 /* Match CONST_*s for which pointer equality corresponds to value
473 equality. */
474 #define CASE_CONST_UNIQUE \
475 case CONST_INT: \
476 case CONST_DOUBLE: \
477 case CONST_FIXED
479 /* Match all CONST_* rtxes. */
480 #define CASE_CONST_ANY \
481 case CONST_INT: \
482 case CONST_DOUBLE: \
483 case CONST_FIXED: \
484 case CONST_VECTOR
485 #endif
487 /* Predicate yielding nonzero iff X is an rtx for a constant integer. */
488 #define CONST_INT_P(X) (GET_CODE (X) == CONST_INT)
490 /* Predicate yielding nonzero iff X is an rtx for a constant integer. */
491 #define CONST_WIDE_INT_P(X) (GET_CODE (X) == CONST_WIDE_INT)
493 /* Predicate yielding nonzero iff X is an rtx for a constant fixed-point. */
494 #define CONST_FIXED_P(X) (GET_CODE (X) == CONST_FIXED)
496 /* Predicate yielding true iff X is an rtx for a double-int
497 or floating point constant. */
498 #define CONST_DOUBLE_P(X) (GET_CODE (X) == CONST_DOUBLE)
500 /* Predicate yielding true iff X is an rtx for a double-int. */
501 #define CONST_DOUBLE_AS_INT_P(X) \
502 (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == VOIDmode)
504 /* Predicate yielding true iff X is an rtx for a integer const. */
505 #if TARGET_SUPPORTS_WIDE_INT
506 #define CONST_SCALAR_INT_P(X) \
507 (CONST_INT_P (X) || CONST_WIDE_INT_P (X))
508 #else
509 #define CONST_SCALAR_INT_P(X) \
510 (CONST_INT_P (X) || CONST_DOUBLE_AS_INT_P (X))
511 #endif
513 /* Predicate yielding true iff X is an rtx for a double-int. */
514 #define CONST_DOUBLE_AS_FLOAT_P(X) \
515 (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode)
517 /* Predicate yielding nonzero iff X is a label insn. */
518 #define LABEL_P(X) (GET_CODE (X) == CODE_LABEL)
520 /* Predicate yielding nonzero iff X is a jump insn. */
521 #define JUMP_P(X) (GET_CODE (X) == JUMP_INSN)
523 /* Predicate yielding nonzero iff X is a call insn. */
524 #define CALL_P(X) (GET_CODE (X) == CALL_INSN)
526 /* Predicate yielding nonzero iff X is an insn that cannot jump. */
527 #define NONJUMP_INSN_P(X) (GET_CODE (X) == INSN)
529 /* Predicate yielding nonzero iff X is a debug note/insn. */
530 #define DEBUG_INSN_P(X) (GET_CODE (X) == DEBUG_INSN)
532 /* Predicate yielding nonzero iff X is an insn that is not a debug insn. */
533 #define NONDEBUG_INSN_P(X) (INSN_P (X) && !DEBUG_INSN_P (X))
535 /* Nonzero if DEBUG_INSN_P may possibly hold. */
536 #define MAY_HAVE_DEBUG_INSNS (flag_var_tracking_assignments)
538 /* Predicate yielding nonzero iff X is a real insn. */
539 #define INSN_P(X) \
540 (NONJUMP_INSN_P (X) || DEBUG_INSN_P (X) || JUMP_P (X) || CALL_P (X))
542 /* Predicate yielding nonzero iff X is a note insn. */
543 #define NOTE_P(X) (GET_CODE (X) == NOTE)
545 /* Predicate yielding nonzero iff X is a barrier insn. */
546 #define BARRIER_P(X) (GET_CODE (X) == BARRIER)
548 /* Predicate yielding nonzero iff X is a data for a jump table. */
549 #define JUMP_TABLE_DATA_P(INSN) (GET_CODE (INSN) == JUMP_TABLE_DATA)
551 /* Predicate yielding nonzero iff X is a return or simple_return. */
552 #define ANY_RETURN_P(X) \
553 (GET_CODE (X) == RETURN || GET_CODE (X) == SIMPLE_RETURN)
555 /* 1 if X is a unary operator. */
557 #define UNARY_P(X) \
558 (GET_RTX_CLASS (GET_CODE (X)) == RTX_UNARY)
560 /* 1 if X is a binary operator. */
562 #define BINARY_P(X) \
563 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_BINARY_MASK) == RTX_BINARY_RESULT)
565 /* 1 if X is an arithmetic operator. */
567 #define ARITHMETIC_P(X) \
568 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_ARITHMETIC_MASK) \
569 == RTX_ARITHMETIC_RESULT)
571 /* 1 if X is an arithmetic operator. */
573 #define COMMUTATIVE_ARITH_P(X) \
574 (GET_RTX_CLASS (GET_CODE (X)) == RTX_COMM_ARITH)
576 /* 1 if X is a commutative arithmetic operator or a comparison operator.
577 These two are sometimes selected together because it is possible to
578 swap the two operands. */
580 #define SWAPPABLE_OPERANDS_P(X) \
581 ((1 << GET_RTX_CLASS (GET_CODE (X))) \
582 & ((1 << RTX_COMM_ARITH) | (1 << RTX_COMM_COMPARE) \
583 | (1 << RTX_COMPARE)))
585 /* 1 if X is a non-commutative operator. */
587 #define NON_COMMUTATIVE_P(X) \
588 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \
589 == RTX_NON_COMMUTATIVE_RESULT)
591 /* 1 if X is a commutative operator on integers. */
593 #define COMMUTATIVE_P(X) \
594 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \
595 == RTX_COMMUTATIVE_RESULT)
597 /* 1 if X is a relational operator. */
599 #define COMPARISON_P(X) \
600 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMPARE_MASK) == RTX_COMPARE_RESULT)
602 /* 1 if X is a constant value that is an integer. */
604 #define CONSTANT_P(X) \
605 (GET_RTX_CLASS (GET_CODE (X)) == RTX_CONST_OBJ)
607 /* 1 if X can be used to represent an object. */
608 #define OBJECT_P(X) \
609 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_OBJ_MASK) == RTX_OBJ_RESULT)
611 /* General accessor macros for accessing the fields of an rtx. */
613 #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
614 /* The bit with a star outside the statement expr and an & inside is
615 so that N can be evaluated only once. */
616 #define RTL_CHECK1(RTX, N, C1) __extension__ \
617 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
618 const enum rtx_code _code = GET_CODE (_rtx); \
619 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
620 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
621 __FUNCTION__); \
622 if (GET_RTX_FORMAT (_code)[_n] != C1) \
623 rtl_check_failed_type1 (_rtx, _n, C1, __FILE__, __LINE__, \
624 __FUNCTION__); \
625 &_rtx->u.fld[_n]; }))
627 #define RTL_CHECK2(RTX, N, C1, C2) __extension__ \
628 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
629 const enum rtx_code _code = GET_CODE (_rtx); \
630 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
631 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
632 __FUNCTION__); \
633 if (GET_RTX_FORMAT (_code)[_n] != C1 \
634 && GET_RTX_FORMAT (_code)[_n] != C2) \
635 rtl_check_failed_type2 (_rtx, _n, C1, C2, __FILE__, __LINE__, \
636 __FUNCTION__); \
637 &_rtx->u.fld[_n]; }))
639 #define RTL_CHECKC1(RTX, N, C) __extension__ \
640 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
641 if (GET_CODE (_rtx) != (C)) \
642 rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
643 __FUNCTION__); \
644 &_rtx->u.fld[_n]; }))
646 #define RTL_CHECKC2(RTX, N, C1, C2) __extension__ \
647 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
648 const enum rtx_code _code = GET_CODE (_rtx); \
649 if (_code != (C1) && _code != (C2)) \
650 rtl_check_failed_code2 (_rtx, (C1), (C2), __FILE__, __LINE__, \
651 __FUNCTION__); \
652 &_rtx->u.fld[_n]; }))
654 #define RTVEC_ELT(RTVEC, I) __extension__ \
655 (*({ __typeof (RTVEC) const _rtvec = (RTVEC); const int _i = (I); \
656 if (_i < 0 || _i >= GET_NUM_ELEM (_rtvec)) \
657 rtvec_check_failed_bounds (_rtvec, _i, __FILE__, __LINE__, \
658 __FUNCTION__); \
659 &_rtvec->elem[_i]; }))
661 #define XWINT(RTX, N) __extension__ \
662 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
663 const enum rtx_code _code = GET_CODE (_rtx); \
664 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
665 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
666 __FUNCTION__); \
667 if (GET_RTX_FORMAT (_code)[_n] != 'w') \
668 rtl_check_failed_type1 (_rtx, _n, 'w', __FILE__, __LINE__, \
669 __FUNCTION__); \
670 &_rtx->u.hwint[_n]; }))
672 #define CWI_ELT(RTX, I) __extension__ \
673 (*({ __typeof (RTX) const _cwi = (RTX); \
674 int _max = CWI_GET_NUM_ELEM (_cwi); \
675 const int _i = (I); \
676 if (_i < 0 || _i >= _max) \
677 cwi_check_failed_bounds (_cwi, _i, __FILE__, __LINE__, \
678 __FUNCTION__); \
679 &_cwi->u.hwiv.elem[_i]; }))
681 #define XCWINT(RTX, N, C) __extension__ \
682 (*({ __typeof (RTX) const _rtx = (RTX); \
683 if (GET_CODE (_rtx) != (C)) \
684 rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
685 __FUNCTION__); \
686 &_rtx->u.hwint[N]; }))
688 #define XCMWINT(RTX, N, C, M) __extension__ \
689 (*({ __typeof (RTX) const _rtx = (RTX); \
690 if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) != (M)) \
691 rtl_check_failed_code_mode (_rtx, (C), (M), false, __FILE__, \
692 __LINE__, __FUNCTION__); \
693 &_rtx->u.hwint[N]; }))
695 #define XCNMPRV(RTX, C, M) __extension__ \
696 ({ __typeof (RTX) const _rtx = (RTX); \
697 if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \
698 rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \
699 __LINE__, __FUNCTION__); \
700 &_rtx->u.rv; })
702 #define XCNMPFV(RTX, C, M) __extension__ \
703 ({ __typeof (RTX) const _rtx = (RTX); \
704 if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \
705 rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \
706 __LINE__, __FUNCTION__); \
707 &_rtx->u.fv; })
709 #define BLOCK_SYMBOL_CHECK(RTX) __extension__ \
710 ({ __typeof (RTX) const _symbol = (RTX); \
711 const unsigned int flags = SYMBOL_REF_FLAGS (_symbol); \
712 if ((flags & SYMBOL_FLAG_HAS_BLOCK_INFO) == 0) \
713 rtl_check_failed_block_symbol (__FILE__, __LINE__, \
714 __FUNCTION__); \
715 &_symbol->u.block_sym; })
717 #define HWIVEC_CHECK(RTX,C) __extension__ \
718 ({ __typeof (RTX) const _symbol = (RTX); \
719 RTL_CHECKC1 (_symbol, 0, C); \
720 &_symbol->u.hwiv; })
722 extern void rtl_check_failed_bounds (const_rtx, int, const char *, int,
723 const char *)
724 ATTRIBUTE_NORETURN;
725 extern void rtl_check_failed_type1 (const_rtx, int, int, const char *, int,
726 const char *)
727 ATTRIBUTE_NORETURN;
728 extern void rtl_check_failed_type2 (const_rtx, int, int, int, const char *,
729 int, const char *)
730 ATTRIBUTE_NORETURN;
731 extern void rtl_check_failed_code1 (const_rtx, enum rtx_code, const char *,
732 int, const char *)
733 ATTRIBUTE_NORETURN;
734 extern void rtl_check_failed_code2 (const_rtx, enum rtx_code, enum rtx_code,
735 const char *, int, const char *)
736 ATTRIBUTE_NORETURN;
737 extern void rtl_check_failed_code_mode (const_rtx, enum rtx_code, enum machine_mode,
738 bool, const char *, int, const char *)
739 ATTRIBUTE_NORETURN;
740 extern void rtl_check_failed_block_symbol (const char *, int, const char *)
741 ATTRIBUTE_NORETURN;
742 extern void cwi_check_failed_bounds (const_rtx, int, const char *, int,
743 const char *)
744 ATTRIBUTE_NORETURN;
745 extern void rtvec_check_failed_bounds (const_rtvec, int, const char *, int,
746 const char *)
747 ATTRIBUTE_NORETURN;
749 #else /* not ENABLE_RTL_CHECKING */
751 #define RTL_CHECK1(RTX, N, C1) ((RTX)->u.fld[N])
752 #define RTL_CHECK2(RTX, N, C1, C2) ((RTX)->u.fld[N])
753 #define RTL_CHECKC1(RTX, N, C) ((RTX)->u.fld[N])
754 #define RTL_CHECKC2(RTX, N, C1, C2) ((RTX)->u.fld[N])
755 #define RTVEC_ELT(RTVEC, I) ((RTVEC)->elem[I])
756 #define XWINT(RTX, N) ((RTX)->u.hwint[N])
757 #define CWI_ELT(RTX, I) ((RTX)->u.hwiv.elem[I])
758 #define XCWINT(RTX, N, C) ((RTX)->u.hwint[N])
759 #define XCMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
760 #define XCNMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
761 #define XCNMPRV(RTX, C, M) (&(RTX)->u.rv)
762 #define XCNMPFV(RTX, C, M) (&(RTX)->u.fv)
763 #define BLOCK_SYMBOL_CHECK(RTX) (&(RTX)->u.block_sym)
764 #define HWIVEC_CHECK(RTX,C) (&(RTX)->u.hwiv)
766 #endif
768 /* General accessor macros for accessing the flags of an rtx. */
770 /* Access an individual rtx flag, with no checking of any kind. */
771 #define RTX_FLAG(RTX, FLAG) ((RTX)->FLAG)
773 #if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION >= 2007)
774 #define RTL_FLAG_CHECK1(NAME, RTX, C1) __extension__ \
775 ({ __typeof (RTX) const _rtx = (RTX); \
776 if (GET_CODE (_rtx) != C1) \
777 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
778 __FUNCTION__); \
779 _rtx; })
781 #define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) __extension__ \
782 ({ __typeof (RTX) const _rtx = (RTX); \
783 if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2) \
784 rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
785 __FUNCTION__); \
786 _rtx; })
788 #define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) __extension__ \
789 ({ __typeof (RTX) const _rtx = (RTX); \
790 if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \
791 && GET_CODE (_rtx) != C3) \
792 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
793 __FUNCTION__); \
794 _rtx; })
796 #define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) __extension__ \
797 ({ __typeof (RTX) const _rtx = (RTX); \
798 if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \
799 && GET_CODE (_rtx) != C3 && GET_CODE(_rtx) != C4) \
800 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
801 __FUNCTION__); \
802 _rtx; })
804 #define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) __extension__ \
805 ({ __typeof (RTX) const _rtx = (RTX); \
806 if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
807 && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
808 && GET_CODE (_rtx) != C5) \
809 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
810 __FUNCTION__); \
811 _rtx; })
813 #define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) \
814 __extension__ \
815 ({ __typeof (RTX) const _rtx = (RTX); \
816 if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
817 && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
818 && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6) \
819 rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
820 __FUNCTION__); \
821 _rtx; })
823 #define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) \
824 __extension__ \
825 ({ __typeof (RTX) const _rtx = (RTX); \
826 if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
827 && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
828 && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6 \
829 && GET_CODE (_rtx) != C7) \
830 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
831 __FUNCTION__); \
832 _rtx; })
834 #define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) \
835 __extension__ \
836 ({ __typeof (RTX) const _rtx = (RTX); \
837 if (!INSN_CHAIN_CODE_P (GET_CODE (_rtx))) \
838 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
839 __FUNCTION__); \
840 _rtx; })
842 extern void rtl_check_failed_flag (const char *, const_rtx, const char *,
843 int, const char *)
844 ATTRIBUTE_NORETURN
847 #else /* not ENABLE_RTL_FLAG_CHECKING */
849 #define RTL_FLAG_CHECK1(NAME, RTX, C1) (RTX)
850 #define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) (RTX)
851 #define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) (RTX)
852 #define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) (RTX)
853 #define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) (RTX)
854 #define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) (RTX)
855 #define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) (RTX)
856 #define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) (RTX)
857 #endif
859 #define XINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rt_int)
860 #define XUINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rt_uint)
861 #define XSTR(RTX, N) (RTL_CHECK2 (RTX, N, 's', 'S').rt_str)
862 #define XEXP(RTX, N) (RTL_CHECK2 (RTX, N, 'e', 'u').rt_rtx)
863 #define XVEC(RTX, N) (RTL_CHECK2 (RTX, N, 'E', 'V').rt_rtvec)
864 #define XMODE(RTX, N) (RTL_CHECK1 (RTX, N, 'M').rt_type)
865 #define XTREE(RTX, N) (RTL_CHECK1 (RTX, N, 't').rt_tree)
866 #define XBBDEF(RTX, N) (RTL_CHECK1 (RTX, N, 'B').rt_bb)
867 #define XTMPL(RTX, N) (RTL_CHECK1 (RTX, N, 'T').rt_str)
868 #define XCFI(RTX, N) (RTL_CHECK1 (RTX, N, 'C').rt_cfi)
870 #define XVECEXP(RTX, N, M) RTVEC_ELT (XVEC (RTX, N), M)
871 #define XVECLEN(RTX, N) GET_NUM_ELEM (XVEC (RTX, N))
873 /* These are like XINT, etc. except that they expect a '0' field instead
874 of the normal type code. */
876 #define X0INT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_int)
877 #define X0UINT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_uint)
878 #define X0STR(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_str)
879 #define X0EXP(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtx)
880 #define X0VEC(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtvec)
881 #define X0MODE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_type)
882 #define X0TREE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_tree)
883 #define X0BBDEF(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_bb)
884 #define X0ADVFLAGS(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_addr_diff_vec_flags)
885 #define X0CSELIB(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_cselib)
886 #define X0MEMATTR(RTX, N) (RTL_CHECKC1 (RTX, N, MEM).rt_mem)
887 #define X0REGATTR(RTX, N) (RTL_CHECKC1 (RTX, N, REG).rt_reg)
888 #define X0CONSTANT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_constant)
890 /* Access a '0' field with any type. */
891 #define X0ANY(RTX, N) RTL_CHECK1 (RTX, N, '0')
893 #define XCINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_int)
894 #define XCUINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_uint)
895 #define XCSTR(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_str)
896 #define XCEXP(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtx)
897 #define XCVEC(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtvec)
898 #define XCMODE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_type)
899 #define XCTREE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_tree)
900 #define XCBBDEF(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_bb)
901 #define XCCFI(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_cfi)
902 #define XCCSELIB(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_cselib)
904 #define XCVECEXP(RTX, N, M, C) RTVEC_ELT (XCVEC (RTX, N, C), M)
905 #define XCVECLEN(RTX, N, C) GET_NUM_ELEM (XCVEC (RTX, N, C))
907 #define XC2EXP(RTX, N, C1, C2) (RTL_CHECKC2 (RTX, N, C1, C2).rt_rtx)
909 /* ACCESS MACROS for particular fields of insns. */
911 /* Holds a unique number for each insn.
912 These are not necessarily sequentially increasing. */
913 #define INSN_UID(INSN) \
914 (RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID", (INSN))->u2.insn_uid)
916 /* Chain insns together in sequence. */
917 #define PREV_INSN(INSN) XEXP (INSN, 0)
918 #define NEXT_INSN(INSN) XEXP (INSN, 1)
920 #define BLOCK_FOR_INSN(INSN) XBBDEF (INSN, 2)
922 /* The body of an insn. */
923 #define PATTERN(INSN) XEXP (INSN, 3)
925 #define INSN_LOCATION(INSN) XUINT (INSN, 4)
927 #define INSN_HAS_LOCATION(INSN) ((LOCATION_LOCUS (INSN_LOCATION (INSN)))\
928 != UNKNOWN_LOCATION)
930 /* LOCATION of an RTX if relevant. */
931 #define RTL_LOCATION(X) (INSN_P (X) ? \
932 INSN_LOCATION (X) : UNKNOWN_LOCATION)
934 /* Code number of instruction, from when it was recognized.
935 -1 means this instruction has not been recognized yet. */
936 #define INSN_CODE(INSN) XINT (INSN, 5)
938 #define RTX_FRAME_RELATED_P(RTX) \
939 (RTL_FLAG_CHECK6 ("RTX_FRAME_RELATED_P", (RTX), DEBUG_INSN, INSN, \
940 CALL_INSN, JUMP_INSN, BARRIER, SET)->frame_related)
942 /* 1 if RTX is an insn that has been deleted. */
943 #define INSN_DELETED_P(RTX) \
944 (RTL_INSN_CHAIN_FLAG_CHECK ("INSN_DELETED_P", (RTX))->volatil)
946 /* 1 if JUMP RTX is a crossing jump. */
947 #define CROSSING_JUMP_P(RTX) \
948 (RTL_FLAG_CHECK1 ("CROSSING_JUMP_P", (RTX), JUMP_INSN)->jump)
950 /* 1 if RTX is a call to a const function. Built from ECF_CONST and
951 TREE_READONLY. */
952 #define RTL_CONST_CALL_P(RTX) \
953 (RTL_FLAG_CHECK1 ("RTL_CONST_CALL_P", (RTX), CALL_INSN)->unchanging)
955 /* 1 if RTX is a call to a pure function. Built from ECF_PURE and
956 DECL_PURE_P. */
957 #define RTL_PURE_CALL_P(RTX) \
958 (RTL_FLAG_CHECK1 ("RTL_PURE_CALL_P", (RTX), CALL_INSN)->return_val)
960 /* 1 if RTX is a call to a const or pure function. */
961 #define RTL_CONST_OR_PURE_CALL_P(RTX) \
962 (RTL_CONST_CALL_P (RTX) || RTL_PURE_CALL_P (RTX))
964 /* 1 if RTX is a call to a looping const or pure function. Built from
965 ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P. */
966 #define RTL_LOOPING_CONST_OR_PURE_CALL_P(RTX) \
967 (RTL_FLAG_CHECK1 ("CONST_OR_PURE_CALL_P", (RTX), CALL_INSN)->call)
969 /* 1 if RTX is a call_insn for a sibling call. */
970 #define SIBLING_CALL_P(RTX) \
971 (RTL_FLAG_CHECK1 ("SIBLING_CALL_P", (RTX), CALL_INSN)->jump)
973 /* 1 if RTX is a jump_insn, call_insn, or insn that is an annulling branch. */
974 #define INSN_ANNULLED_BRANCH_P(RTX) \
975 (RTL_FLAG_CHECK1 ("INSN_ANNULLED_BRANCH_P", (RTX), JUMP_INSN)->unchanging)
977 /* 1 if RTX is an insn in a delay slot and is from the target of the branch.
978 If the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be
979 executed if the branch is taken. For annulled branches with this bit
980 clear, the insn should be executed only if the branch is not taken. */
981 #define INSN_FROM_TARGET_P(RTX) \
982 (RTL_FLAG_CHECK3 ("INSN_FROM_TARGET_P", (RTX), INSN, JUMP_INSN, \
983 CALL_INSN)->in_struct)
985 /* In an ADDR_DIFF_VEC, the flags for RTX for use by branch shortening.
986 See the comments for ADDR_DIFF_VEC in rtl.def. */
987 #define ADDR_DIFF_VEC_FLAGS(RTX) X0ADVFLAGS (RTX, 4)
989 /* In a VALUE, the value cselib has assigned to RTX.
990 This is a "struct cselib_val", see cselib.h. */
991 #define CSELIB_VAL_PTR(RTX) X0CSELIB (RTX, 0)
993 /* Holds a list of notes on what this insn does to various REGs.
994 It is a chain of EXPR_LIST rtx's, where the second operand is the
995 chain pointer and the first operand is the REG being described.
996 The mode field of the EXPR_LIST contains not a real machine mode
997 but a value from enum reg_note. */
998 #define REG_NOTES(INSN) XEXP(INSN, 6)
1000 /* In an ENTRY_VALUE this is the DECL_INCOMING_RTL of the argument in
1001 question. */
1002 #define ENTRY_VALUE_EXP(RTX) (RTL_CHECKC1 (RTX, 0, ENTRY_VALUE).rt_rtx)
1004 enum reg_note
1006 #define DEF_REG_NOTE(NAME) NAME,
1007 #include "reg-notes.def"
1008 #undef DEF_REG_NOTE
1009 REG_NOTE_MAX
1012 /* Define macros to extract and insert the reg-note kind in an EXPR_LIST. */
1013 #define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK))
1014 #define PUT_REG_NOTE_KIND(LINK, KIND) \
1015 PUT_MODE (LINK, (enum machine_mode) (KIND))
1017 /* Names for REG_NOTE's in EXPR_LIST insn's. */
1019 extern const char * const reg_note_name[];
1020 #define GET_REG_NOTE_NAME(MODE) (reg_note_name[(int) (MODE)])
1022 /* This field is only present on CALL_INSNs. It holds a chain of EXPR_LIST of
1023 USE and CLOBBER expressions.
1024 USE expressions list the registers filled with arguments that
1025 are passed to the function.
1026 CLOBBER expressions document the registers explicitly clobbered
1027 by this CALL_INSN.
1028 Pseudo registers can not be mentioned in this list. */
1029 #define CALL_INSN_FUNCTION_USAGE(INSN) XEXP(INSN, 7)
1031 /* The label-number of a code-label. The assembler label
1032 is made from `L' and the label-number printed in decimal.
1033 Label numbers are unique in a compilation. */
1034 #define CODE_LABEL_NUMBER(INSN) XINT (INSN, 5)
1036 /* In a NOTE that is a line number, this is a string for the file name that the
1037 line is in. We use the same field to record block numbers temporarily in
1038 NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes. (We avoid lots of casts
1039 between ints and pointers if we use a different macro for the block number.)
1042 /* Opaque data. */
1043 #define NOTE_DATA(INSN) RTL_CHECKC1 (INSN, 3, NOTE)
1044 #define NOTE_DELETED_LABEL_NAME(INSN) XCSTR (INSN, 3, NOTE)
1045 #define SET_INSN_DELETED(INSN) set_insn_deleted (INSN);
1046 #define NOTE_BLOCK(INSN) XCTREE (INSN, 3, NOTE)
1047 #define NOTE_EH_HANDLER(INSN) XCINT (INSN, 3, NOTE)
1048 #define NOTE_BASIC_BLOCK(INSN) XCBBDEF (INSN, 3, NOTE)
1049 #define NOTE_VAR_LOCATION(INSN) XCEXP (INSN, 3, NOTE)
1050 #define NOTE_CFI(INSN) XCCFI (INSN, 3, NOTE)
1051 #define NOTE_LABEL_NUMBER(INSN) XCINT (INSN, 3, NOTE)
1053 /* In a NOTE that is a line number, this is the line number.
1054 Other kinds of NOTEs are identified by negative numbers here. */
1055 #define NOTE_KIND(INSN) XCINT (INSN, 4, NOTE)
1057 /* Nonzero if INSN is a note marking the beginning of a basic block. */
1058 #define NOTE_INSN_BASIC_BLOCK_P(INSN) \
1059 (NOTE_P (INSN) && NOTE_KIND (INSN) == NOTE_INSN_BASIC_BLOCK)
1061 /* Variable declaration and the location of a variable. */
1062 #define PAT_VAR_LOCATION_DECL(PAT) (XCTREE ((PAT), 0, VAR_LOCATION))
1063 #define PAT_VAR_LOCATION_LOC(PAT) (XCEXP ((PAT), 1, VAR_LOCATION))
1065 /* Initialization status of the variable in the location. Status
1066 can be unknown, uninitialized or initialized. See enumeration
1067 type below. */
1068 #define PAT_VAR_LOCATION_STATUS(PAT) \
1069 (RTL_FLAG_CHECK1 ("PAT_VAR_LOCATION_STATUS", PAT, VAR_LOCATION) \
1070 ->u2.var_location_status)
1072 /* Accessors for a NOTE_INSN_VAR_LOCATION. */
1073 #define NOTE_VAR_LOCATION_DECL(NOTE) \
1074 PAT_VAR_LOCATION_DECL (NOTE_VAR_LOCATION (NOTE))
1075 #define NOTE_VAR_LOCATION_LOC(NOTE) \
1076 PAT_VAR_LOCATION_LOC (NOTE_VAR_LOCATION (NOTE))
1077 #define NOTE_VAR_LOCATION_STATUS(NOTE) \
1078 PAT_VAR_LOCATION_STATUS (NOTE_VAR_LOCATION (NOTE))
1080 /* The VAR_LOCATION rtx in a DEBUG_INSN. */
1081 #define INSN_VAR_LOCATION(INSN) PATTERN (INSN)
1083 /* Accessors for a tree-expanded var location debug insn. */
1084 #define INSN_VAR_LOCATION_DECL(INSN) \
1085 PAT_VAR_LOCATION_DECL (INSN_VAR_LOCATION (INSN))
1086 #define INSN_VAR_LOCATION_LOC(INSN) \
1087 PAT_VAR_LOCATION_LOC (INSN_VAR_LOCATION (INSN))
1088 #define INSN_VAR_LOCATION_STATUS(INSN) \
1089 PAT_VAR_LOCATION_STATUS (INSN_VAR_LOCATION (INSN))
1091 /* Expand to the RTL that denotes an unknown variable location in a
1092 DEBUG_INSN. */
1093 #define gen_rtx_UNKNOWN_VAR_LOC() (gen_rtx_CLOBBER (VOIDmode, const0_rtx))
1095 /* Determine whether X is such an unknown location. */
1096 #define VAR_LOC_UNKNOWN_P(X) \
1097 (GET_CODE (X) == CLOBBER && XEXP ((X), 0) == const0_rtx)
1099 /* 1 if RTX is emitted after a call, but it should take effect before
1100 the call returns. */
1101 #define NOTE_DURING_CALL_P(RTX) \
1102 (RTL_FLAG_CHECK1 ("NOTE_VAR_LOCATION_DURING_CALL_P", (RTX), NOTE)->call)
1104 /* DEBUG_EXPR_DECL corresponding to a DEBUG_EXPR RTX. */
1105 #define DEBUG_EXPR_TREE_DECL(RTX) XCTREE (RTX, 0, DEBUG_EXPR)
1107 /* VAR_DECL/PARM_DECL DEBUG_IMPLICIT_PTR takes address of. */
1108 #define DEBUG_IMPLICIT_PTR_DECL(RTX) XCTREE (RTX, 0, DEBUG_IMPLICIT_PTR)
1110 /* PARM_DECL DEBUG_PARAMETER_REF references. */
1111 #define DEBUG_PARAMETER_REF_DECL(RTX) XCTREE (RTX, 0, DEBUG_PARAMETER_REF)
1113 /* Codes that appear in the NOTE_KIND field for kinds of notes
1114 that are not line numbers. These codes are all negative.
1116 Notice that we do not try to use zero here for any of
1117 the special note codes because sometimes the source line
1118 actually can be zero! This happens (for example) when we
1119 are generating code for the per-translation-unit constructor
1120 and destructor routines for some C++ translation unit. */
1122 enum insn_note
1124 #define DEF_INSN_NOTE(NAME) NAME,
1125 #include "insn-notes.def"
1126 #undef DEF_INSN_NOTE
1128 NOTE_INSN_MAX
1131 /* Names for NOTE insn's other than line numbers. */
1133 extern const char * const note_insn_name[NOTE_INSN_MAX];
1134 #define GET_NOTE_INSN_NAME(NOTE_CODE) \
1135 (note_insn_name[(NOTE_CODE)])
1137 /* The name of a label, in case it corresponds to an explicit label
1138 in the input source code. */
1139 #define LABEL_NAME(RTX) XCSTR (RTX, 6, CODE_LABEL)
1141 /* In jump.c, each label contains a count of the number
1142 of LABEL_REFs that point at it, so unused labels can be deleted. */
1143 #define LABEL_NUSES(RTX) XCINT (RTX, 4, CODE_LABEL)
1145 /* Labels carry a two-bit field composed of the ->jump and ->call
1146 bits. This field indicates whether the label is an alternate
1147 entry point, and if so, what kind. */
1148 enum label_kind
1150 LABEL_NORMAL = 0, /* ordinary label */
1151 LABEL_STATIC_ENTRY, /* alternate entry point, not exported */
1152 LABEL_GLOBAL_ENTRY, /* alternate entry point, exported */
1153 LABEL_WEAK_ENTRY /* alternate entry point, exported as weak symbol */
1156 #if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION > 2007)
1158 /* Retrieve the kind of LABEL. */
1159 #define LABEL_KIND(LABEL) __extension__ \
1160 ({ __typeof (LABEL) const _label = (LABEL); \
1161 if (! LABEL_P (_label)) \
1162 rtl_check_failed_flag ("LABEL_KIND", _label, __FILE__, __LINE__, \
1163 __FUNCTION__); \
1164 (enum label_kind) ((_label->jump << 1) | _label->call); })
1166 /* Set the kind of LABEL. */
1167 #define SET_LABEL_KIND(LABEL, KIND) do { \
1168 __typeof (LABEL) const _label = (LABEL); \
1169 const unsigned int _kind = (KIND); \
1170 if (! LABEL_P (_label)) \
1171 rtl_check_failed_flag ("SET_LABEL_KIND", _label, __FILE__, __LINE__, \
1172 __FUNCTION__); \
1173 _label->jump = ((_kind >> 1) & 1); \
1174 _label->call = (_kind & 1); \
1175 } while (0)
1177 #else
1179 /* Retrieve the kind of LABEL. */
1180 #define LABEL_KIND(LABEL) \
1181 ((enum label_kind) (((LABEL)->jump << 1) | (LABEL)->call))
1183 /* Set the kind of LABEL. */
1184 #define SET_LABEL_KIND(LABEL, KIND) do { \
1185 rtx const _label = (LABEL); \
1186 const unsigned int _kind = (KIND); \
1187 _label->jump = ((_kind >> 1) & 1); \
1188 _label->call = (_kind & 1); \
1189 } while (0)
1191 #endif /* rtl flag checking */
1193 #define LABEL_ALT_ENTRY_P(LABEL) (LABEL_KIND (LABEL) != LABEL_NORMAL)
1195 /* In jump.c, each JUMP_INSN can point to a label that it can jump to,
1196 so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
1197 be decremented and possibly the label can be deleted. */
1198 #define JUMP_LABEL(INSN) XCEXP (INSN, 7, JUMP_INSN)
1200 /* Once basic blocks are found, each CODE_LABEL starts a chain that
1201 goes through all the LABEL_REFs that jump to that label. The chain
1202 eventually winds up at the CODE_LABEL: it is circular. */
1203 #define LABEL_REFS(LABEL) XCEXP (LABEL, 3, CODE_LABEL)
1205 /* For a REG rtx, REGNO extracts the register number. REGNO can only
1206 be used on RHS. Use SET_REGNO to change the value. */
1207 #define REGNO(RTX) (rhs_regno(RTX))
1208 #define SET_REGNO(RTX,N) \
1209 (df_ref_change_reg_with_loc (REGNO (RTX), N, RTX), XCUINT (RTX, 0, REG) = N)
1210 #define SET_REGNO_RAW(RTX,N) (XCUINT (RTX, 0, REG) = N)
1212 /* ORIGINAL_REGNO holds the number the register originally had; for a
1213 pseudo register turned into a hard reg this will hold the old pseudo
1214 register number. */
1215 #define ORIGINAL_REGNO(RTX) \
1216 (RTL_FLAG_CHECK1 ("ORIGINAL_REGNO", (RTX), REG)->u2.original_regno)
1218 /* Force the REGNO macro to only be used on the lhs. */
1219 static inline unsigned int
1220 rhs_regno (const_rtx x)
1222 return XCUINT (x, 0, REG);
1226 /* 1 if RTX is a reg or parallel that is the current function's return
1227 value. */
1228 #define REG_FUNCTION_VALUE_P(RTX) \
1229 (RTL_FLAG_CHECK2 ("REG_FUNCTION_VALUE_P", (RTX), REG, PARALLEL)->return_val)
1231 /* 1 if RTX is a reg that corresponds to a variable declared by the user. */
1232 #define REG_USERVAR_P(RTX) \
1233 (RTL_FLAG_CHECK1 ("REG_USERVAR_P", (RTX), REG)->volatil)
1235 /* 1 if RTX is a reg that holds a pointer value. */
1236 #define REG_POINTER(RTX) \
1237 (RTL_FLAG_CHECK1 ("REG_POINTER", (RTX), REG)->frame_related)
1239 /* 1 if RTX is a mem that holds a pointer value. */
1240 #define MEM_POINTER(RTX) \
1241 (RTL_FLAG_CHECK1 ("MEM_POINTER", (RTX), MEM)->frame_related)
1243 /* 1 if the given register REG corresponds to a hard register. */
1244 #define HARD_REGISTER_P(REG) (HARD_REGISTER_NUM_P (REGNO (REG)))
1246 /* 1 if the given register number REG_NO corresponds to a hard register. */
1247 #define HARD_REGISTER_NUM_P(REG_NO) ((REG_NO) < FIRST_PSEUDO_REGISTER)
1249 /* For a CONST_INT rtx, INTVAL extracts the integer. */
1250 #define INTVAL(RTX) XCWINT (RTX, 0, CONST_INT)
1251 #define UINTVAL(RTX) ((unsigned HOST_WIDE_INT) INTVAL (RTX))
1253 /* For a CONST_WIDE_INT, CONST_WIDE_INT_NUNITS is the number of
1254 elements actually needed to represent the constant.
1255 CONST_WIDE_INT_ELT gets one of the elements. 0 is the least
1256 significant HOST_WIDE_INT. */
1257 #define CONST_WIDE_INT_VEC(RTX) HWIVEC_CHECK (RTX, CONST_WIDE_INT)
1258 #define CONST_WIDE_INT_NUNITS(RTX) CWI_GET_NUM_ELEM (RTX)
1259 #define CONST_WIDE_INT_ELT(RTX, N) CWI_ELT (RTX, N)
1261 /* For a CONST_DOUBLE:
1262 #if TARGET_SUPPORTS_WIDE_INT == 0
1263 For a VOIDmode, there are two integers CONST_DOUBLE_LOW is the
1264 low-order word and ..._HIGH the high-order.
1265 #endif
1266 For a float, there is a REAL_VALUE_TYPE structure, and
1267 CONST_DOUBLE_REAL_VALUE(r) is a pointer to it. */
1268 #define CONST_DOUBLE_LOW(r) XCMWINT (r, 0, CONST_DOUBLE, VOIDmode)
1269 #define CONST_DOUBLE_HIGH(r) XCMWINT (r, 1, CONST_DOUBLE, VOIDmode)
1270 #define CONST_DOUBLE_REAL_VALUE(r) \
1271 ((const struct real_value *) XCNMPRV (r, CONST_DOUBLE, VOIDmode))
1273 #define CONST_FIXED_VALUE(r) \
1274 ((const struct fixed_value *) XCNMPFV (r, CONST_FIXED, VOIDmode))
1275 #define CONST_FIXED_VALUE_HIGH(r) \
1276 ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.high))
1277 #define CONST_FIXED_VALUE_LOW(r) \
1278 ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.low))
1280 /* For a CONST_VECTOR, return element #n. */
1281 #define CONST_VECTOR_ELT(RTX, N) XCVECEXP (RTX, 0, N, CONST_VECTOR)
1283 /* For a CONST_VECTOR, return the number of elements in a vector. */
1284 #define CONST_VECTOR_NUNITS(RTX) XCVECLEN (RTX, 0, CONST_VECTOR)
1286 /* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of.
1287 SUBREG_BYTE extracts the byte-number. */
1289 #define SUBREG_REG(RTX) XCEXP (RTX, 0, SUBREG)
1290 #define SUBREG_BYTE(RTX) XCUINT (RTX, 1, SUBREG)
1292 /* in rtlanal.c */
1293 /* Return the right cost to give to an operation
1294 to make the cost of the corresponding register-to-register instruction
1295 N times that of a fast register-to-register instruction. */
1296 #define COSTS_N_INSNS(N) ((N) * 4)
1298 /* Maximum cost of an rtl expression. This value has the special meaning
1299 not to use an rtx with this cost under any circumstances. */
1300 #define MAX_COST INT_MAX
1302 /* A structure to hold all available cost information about an rtl
1303 expression. */
1304 struct full_rtx_costs
1306 int speed;
1307 int size;
1310 /* Initialize a full_rtx_costs structure C to the maximum cost. */
1311 static inline void
1312 init_costs_to_max (struct full_rtx_costs *c)
1314 c->speed = MAX_COST;
1315 c->size = MAX_COST;
1318 /* Initialize a full_rtx_costs structure C to zero cost. */
1319 static inline void
1320 init_costs_to_zero (struct full_rtx_costs *c)
1322 c->speed = 0;
1323 c->size = 0;
1326 /* Compare two full_rtx_costs structures A and B, returning true
1327 if A < B when optimizing for speed. */
1328 static inline bool
1329 costs_lt_p (struct full_rtx_costs *a, struct full_rtx_costs *b,
1330 bool speed)
1332 if (speed)
1333 return (a->speed < b->speed
1334 || (a->speed == b->speed && a->size < b->size));
1335 else
1336 return (a->size < b->size
1337 || (a->size == b->size && a->speed < b->speed));
1340 /* Increase both members of the full_rtx_costs structure C by the
1341 cost of N insns. */
1342 static inline void
1343 costs_add_n_insns (struct full_rtx_costs *c, int n)
1345 c->speed += COSTS_N_INSNS (n);
1346 c->size += COSTS_N_INSNS (n);
1349 /* Information about an address. This structure is supposed to be able
1350 to represent all supported target addresses. Please extend it if it
1351 is not yet general enough. */
1352 struct address_info {
1353 /* The mode of the value being addressed, or VOIDmode if this is
1354 a load-address operation with no known address mode. */
1355 enum machine_mode mode;
1357 /* The address space. */
1358 addr_space_t as;
1360 /* A pointer to the top-level address. */
1361 rtx *outer;
1363 /* A pointer to the inner address, after all address mutations
1364 have been stripped from the top-level address. It can be one
1365 of the following:
1367 - A {PRE,POST}_{INC,DEC} of *BASE. SEGMENT, INDEX and DISP are null.
1369 - A {PRE,POST}_MODIFY of *BASE. In this case either INDEX or DISP
1370 points to the step value, depending on whether the step is variable
1371 or constant respectively. SEGMENT is null.
1373 - A plain sum of the form SEGMENT + BASE + INDEX + DISP,
1374 with null fields evaluating to 0. */
1375 rtx *inner;
1377 /* Components that make up *INNER. Each one may be null or nonnull.
1378 When nonnull, their meanings are as follows:
1380 - *SEGMENT is the "segment" of memory to which the address refers.
1381 This value is entirely target-specific and is only called a "segment"
1382 because that's its most typical use. It contains exactly one UNSPEC,
1383 pointed to by SEGMENT_TERM. The contents of *SEGMENT do not need
1384 reloading.
1386 - *BASE is a variable expression representing a base address.
1387 It contains exactly one REG, SUBREG or MEM, pointed to by BASE_TERM.
1389 - *INDEX is a variable expression representing an index value.
1390 It may be a scaled expression, such as a MULT. It has exactly
1391 one REG, SUBREG or MEM, pointed to by INDEX_TERM.
1393 - *DISP is a constant, possibly mutated. DISP_TERM points to the
1394 unmutated RTX_CONST_OBJ. */
1395 rtx *segment;
1396 rtx *base;
1397 rtx *index;
1398 rtx *disp;
1400 rtx *segment_term;
1401 rtx *base_term;
1402 rtx *index_term;
1403 rtx *disp_term;
1405 /* In a {PRE,POST}_MODIFY address, this points to a second copy
1406 of BASE_TERM, otherwise it is null. */
1407 rtx *base_term2;
1409 /* ADDRESS if this structure describes an address operand, MEM if
1410 it describes a MEM address. */
1411 enum rtx_code addr_outer_code;
1413 /* If BASE is nonnull, this is the code of the rtx that contains it. */
1414 enum rtx_code base_outer_code;
1416 /* True if this is an RTX_AUTOINC address. */
1417 bool autoinc_p;
1420 /* This is used to bundle an rtx and a mode together so that the pair
1421 can be used with the wi:: routines. If we ever put modes into rtx
1422 integer constants, this should go away and then just pass an rtx in. */
1423 typedef std::pair <rtx, enum machine_mode> rtx_mode_t;
1425 namespace wi
1427 template <>
1428 struct int_traits <rtx_mode_t>
1430 static const enum precision_type precision_type = VAR_PRECISION;
1431 static const bool host_dependent_precision = false;
1432 /* This ought to be true, except for the special case that BImode
1433 is canonicalized to STORE_FLAG_VALUE, which might be 1. */
1434 static const bool is_sign_extended = false;
1435 static unsigned int get_precision (const rtx_mode_t &);
1436 static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int,
1437 const rtx_mode_t &);
1441 inline unsigned int
1442 wi::int_traits <rtx_mode_t>::get_precision (const rtx_mode_t &x)
1444 return GET_MODE_PRECISION (x.second);
1447 inline wi::storage_ref
1448 wi::int_traits <rtx_mode_t>::decompose (HOST_WIDE_INT *,
1449 unsigned int precision,
1450 const rtx_mode_t &x)
1452 gcc_checking_assert (precision == get_precision (x));
1453 switch (GET_CODE (x.first))
1455 case CONST_INT:
1456 if (precision < HOST_BITS_PER_WIDE_INT)
1457 /* Nonzero BImodes are stored as STORE_FLAG_VALUE, which on many
1458 targets is 1 rather than -1. */
1459 gcc_checking_assert (INTVAL (x.first)
1460 == sext_hwi (INTVAL (x.first), precision)
1461 || (x.second == BImode && INTVAL (x.first) == 1));
1463 return wi::storage_ref (&INTVAL (x.first), 1, precision);
1465 case CONST_WIDE_INT:
1466 return wi::storage_ref (&CONST_WIDE_INT_ELT (x.first, 0),
1467 CONST_WIDE_INT_NUNITS (x.first), precision);
1469 #if TARGET_SUPPORTS_WIDE_INT == 0
1470 case CONST_DOUBLE:
1471 return wi::storage_ref (&CONST_DOUBLE_LOW (x.first), 2, precision);
1472 #endif
1474 default:
1475 gcc_unreachable ();
1479 namespace wi
1481 hwi_with_prec shwi (HOST_WIDE_INT, enum machine_mode mode);
1482 wide_int min_value (enum machine_mode, signop);
1483 wide_int max_value (enum machine_mode, signop);
1486 inline wi::hwi_with_prec
1487 wi::shwi (HOST_WIDE_INT val, enum machine_mode mode)
1489 return shwi (val, GET_MODE_PRECISION (mode));
1492 /* Produce the smallest number that is represented in MODE. The precision
1493 is taken from MODE and the sign from SGN. */
1494 inline wide_int
1495 wi::min_value (enum machine_mode mode, signop sgn)
1497 return min_value (GET_MODE_PRECISION (mode), sgn);
1500 /* Produce the largest number that is represented in MODE. The precision
1501 is taken from MODE and the sign from SGN. */
1502 inline wide_int
1503 wi::max_value (enum machine_mode mode, signop sgn)
1505 return max_value (GET_MODE_PRECISION (mode), sgn);
1508 extern void init_rtlanal (void);
1509 extern int rtx_cost (rtx, enum rtx_code, int, bool);
1510 extern int address_cost (rtx, enum machine_mode, addr_space_t, bool);
1511 extern void get_full_rtx_cost (rtx, enum rtx_code, int,
1512 struct full_rtx_costs *);
1513 extern unsigned int subreg_lsb (const_rtx);
1514 extern unsigned int subreg_lsb_1 (enum machine_mode, enum machine_mode,
1515 unsigned int);
1516 extern unsigned int subreg_regno_offset (unsigned int, enum machine_mode,
1517 unsigned int, enum machine_mode);
1518 extern bool subreg_offset_representable_p (unsigned int, enum machine_mode,
1519 unsigned int, enum machine_mode);
1520 extern unsigned int subreg_regno (const_rtx);
1521 extern int simplify_subreg_regno (unsigned int, enum machine_mode,
1522 unsigned int, enum machine_mode);
1523 extern unsigned int subreg_nregs (const_rtx);
1524 extern unsigned int subreg_nregs_with_regno (unsigned int, const_rtx);
1525 extern unsigned HOST_WIDE_INT nonzero_bits (const_rtx, enum machine_mode);
1526 extern unsigned int num_sign_bit_copies (const_rtx, enum machine_mode);
1527 extern bool constant_pool_constant_p (rtx);
1528 extern bool truncated_to_mode (enum machine_mode, const_rtx);
1529 extern int low_bitmask_len (enum machine_mode, unsigned HOST_WIDE_INT);
1530 extern void split_double (rtx, rtx *, rtx *);
1531 extern rtx *strip_address_mutations (rtx *, enum rtx_code * = 0);
1532 extern void decompose_address (struct address_info *, rtx *,
1533 enum machine_mode, addr_space_t, enum rtx_code);
1534 extern void decompose_lea_address (struct address_info *, rtx *);
1535 extern void decompose_mem_address (struct address_info *, rtx);
1536 extern void update_address (struct address_info *);
1537 extern HOST_WIDE_INT get_index_scale (const struct address_info *);
1538 extern enum rtx_code get_index_code (const struct address_info *);
1540 #ifndef GENERATOR_FILE
1541 /* Return the cost of SET X. SPEED_P is true if optimizing for speed
1542 rather than size. */
1544 static inline int
1545 set_rtx_cost (rtx x, bool speed_p)
1547 return rtx_cost (x, INSN, 4, speed_p);
1550 /* Like set_rtx_cost, but return both the speed and size costs in C. */
1552 static inline void
1553 get_full_set_rtx_cost (rtx x, struct full_rtx_costs *c)
1555 get_full_rtx_cost (x, INSN, 4, c);
1558 /* Return the cost of moving X into a register, relative to the cost
1559 of a register move. SPEED_P is true if optimizing for speed rather
1560 than size. */
1562 static inline int
1563 set_src_cost (rtx x, bool speed_p)
1565 return rtx_cost (x, SET, 1, speed_p);
1568 /* Like set_src_cost, but return both the speed and size costs in C. */
1570 static inline void
1571 get_full_set_src_cost (rtx x, struct full_rtx_costs *c)
1573 get_full_rtx_cost (x, SET, 1, c);
1575 #endif
1577 /* 1 if RTX is a subreg containing a reg that is already known to be
1578 sign- or zero-extended from the mode of the subreg to the mode of
1579 the reg. SUBREG_PROMOTED_UNSIGNED_P gives the signedness of the
1580 extension.
1582 When used as a LHS, is means that this extension must be done
1583 when assigning to SUBREG_REG. */
1585 #define SUBREG_PROMOTED_VAR_P(RTX) \
1586 (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED", (RTX), SUBREG)->in_struct)
1588 /* Valid for subregs which are SUBREG_PROMOTED_VAR_P(). In that case
1589 this gives the necessary extensions:
1590 0 - signed (SPR_SIGNED)
1591 1 - normal unsigned (SPR_UNSIGNED)
1592 2 - value is both sign and unsign extended for mode
1593 (SPR_SIGNED_AND_UNSIGNED).
1594 -1 - pointer unsigned, which most often can be handled like unsigned
1595 extension, except for generating instructions where we need to
1596 emit special code (ptr_extend insns) on some architectures
1597 (SPR_POINTER). */
1599 const int SRP_POINTER = -1;
1600 const int SRP_SIGNED = 0;
1601 const int SRP_UNSIGNED = 1;
1602 const int SRP_SIGNED_AND_UNSIGNED = 2;
1604 /* Sets promoted mode for SUBREG_PROMOTED_VAR_P(). */
1605 #define SUBREG_PROMOTED_SET(RTX, VAL) \
1606 do { \
1607 rtx const _rtx = RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SET", \
1608 (RTX), SUBREG); \
1609 switch (VAL) \
1611 case SRP_POINTER: \
1612 _rtx->volatil = 0; \
1613 _rtx->unchanging = 0; \
1614 break; \
1615 case SRP_SIGNED: \
1616 _rtx->volatil = 0; \
1617 _rtx->unchanging = 1; \
1618 break; \
1619 case SRP_UNSIGNED: \
1620 _rtx->volatil = 1; \
1621 _rtx->unchanging = 0; \
1622 break; \
1623 case SRP_SIGNED_AND_UNSIGNED: \
1624 _rtx->volatil = 1; \
1625 _rtx->unchanging = 1; \
1626 break; \
1628 } while (0)
1630 /* Gets the value stored in promoted mode for SUBREG_PROMOTED_VAR_P(),
1631 including SRP_SIGNED_AND_UNSIGNED if promoted for
1632 both signed and unsigned. */
1633 #define SUBREG_PROMOTED_GET(RTX) \
1634 (2 * (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_GET", (RTX), SUBREG)->volatil)\
1635 + (RTX)->unchanging - 1)
1637 /* Returns sign of promoted mode for SUBREG_PROMOTED_VAR_P(). */
1638 #define SUBREG_PROMOTED_SIGN(RTX) \
1639 ((RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SIGN", (RTX), SUBREG)->volatil) ? 1\
1640 : (RTX)->unchanging - 1)
1642 /* Predicate to check if RTX of SUBREG_PROMOTED_VAR_P() is promoted
1643 for SIGNED type. */
1644 #define SUBREG_PROMOTED_SIGNED_P(RTX) \
1645 (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SIGNED_P", (RTX), SUBREG)->unchanging)
1647 /* Predicate to check if RTX of SUBREG_PROMOTED_VAR_P() is promoted
1648 for UNSIGNED type. */
1649 #define SUBREG_PROMOTED_UNSIGNED_P(RTX) \
1650 (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_P", (RTX), SUBREG)->volatil)
1652 /* Checks if RTX of SUBREG_PROMOTED_VAR_P() is promoted for given SIGN. */
1653 #define SUBREG_CHECK_PROMOTED_SIGN(RTX, SIGN) \
1654 ((SIGN) == SRP_POINTER ? SUBREG_PROMOTED_GET (RTX) == SRP_POINTER \
1655 : (SIGN) == SRP_SIGNED ? SUBREG_PROMOTED_SIGNED_P (RTX) \
1656 : SUBREG_PROMOTED_UNSIGNED_P (RTX))
1658 /* True if the subreg was generated by LRA for reload insns. Such
1659 subregs are valid only during LRA. */
1660 #define LRA_SUBREG_P(RTX) \
1661 (RTL_FLAG_CHECK1 ("LRA_SUBREG_P", (RTX), SUBREG)->jump)
1663 /* Access various components of an ASM_OPERANDS rtx. */
1665 #define ASM_OPERANDS_TEMPLATE(RTX) XCSTR (RTX, 0, ASM_OPERANDS)
1666 #define ASM_OPERANDS_OUTPUT_CONSTRAINT(RTX) XCSTR (RTX, 1, ASM_OPERANDS)
1667 #define ASM_OPERANDS_OUTPUT_IDX(RTX) XCINT (RTX, 2, ASM_OPERANDS)
1668 #define ASM_OPERANDS_INPUT_VEC(RTX) XCVEC (RTX, 3, ASM_OPERANDS)
1669 #define ASM_OPERANDS_INPUT_CONSTRAINT_VEC(RTX) XCVEC (RTX, 4, ASM_OPERANDS)
1670 #define ASM_OPERANDS_INPUT(RTX, N) XCVECEXP (RTX, 3, N, ASM_OPERANDS)
1671 #define ASM_OPERANDS_INPUT_LENGTH(RTX) XCVECLEN (RTX, 3, ASM_OPERANDS)
1672 #define ASM_OPERANDS_INPUT_CONSTRAINT_EXP(RTX, N) \
1673 XCVECEXP (RTX, 4, N, ASM_OPERANDS)
1674 #define ASM_OPERANDS_INPUT_CONSTRAINT(RTX, N) \
1675 XSTR (XCVECEXP (RTX, 4, N, ASM_OPERANDS), 0)
1676 #define ASM_OPERANDS_INPUT_MODE(RTX, N) \
1677 GET_MODE (XCVECEXP (RTX, 4, N, ASM_OPERANDS))
1678 #define ASM_OPERANDS_LABEL_VEC(RTX) XCVEC (RTX, 5, ASM_OPERANDS)
1679 #define ASM_OPERANDS_LABEL_LENGTH(RTX) XCVECLEN (RTX, 5, ASM_OPERANDS)
1680 #define ASM_OPERANDS_LABEL(RTX, N) XCVECEXP (RTX, 5, N, ASM_OPERANDS)
1681 #define ASM_OPERANDS_SOURCE_LOCATION(RTX) XCUINT (RTX, 6, ASM_OPERANDS)
1682 #define ASM_INPUT_SOURCE_LOCATION(RTX) XCUINT (RTX, 1, ASM_INPUT)
1684 /* 1 if RTX is a mem that is statically allocated in read-only memory. */
1685 #define MEM_READONLY_P(RTX) \
1686 (RTL_FLAG_CHECK1 ("MEM_READONLY_P", (RTX), MEM)->unchanging)
1688 /* 1 if RTX is a mem and we should keep the alias set for this mem
1689 unchanged when we access a component. Set to 1, or example, when we
1690 are already in a non-addressable component of an aggregate. */
1691 #define MEM_KEEP_ALIAS_SET_P(RTX) \
1692 (RTL_FLAG_CHECK1 ("MEM_KEEP_ALIAS_SET_P", (RTX), MEM)->jump)
1694 /* 1 if RTX is a mem or asm_operand for a volatile reference. */
1695 #define MEM_VOLATILE_P(RTX) \
1696 (RTL_FLAG_CHECK3 ("MEM_VOLATILE_P", (RTX), MEM, ASM_OPERANDS, \
1697 ASM_INPUT)->volatil)
1699 /* 1 if RTX is a mem that cannot trap. */
1700 #define MEM_NOTRAP_P(RTX) \
1701 (RTL_FLAG_CHECK1 ("MEM_NOTRAP_P", (RTX), MEM)->call)
1703 /* The memory attribute block. We provide access macros for each value
1704 in the block and provide defaults if none specified. */
1705 #define MEM_ATTRS(RTX) X0MEMATTR (RTX, 1)
1707 /* The register attribute block. We provide access macros for each value
1708 in the block and provide defaults if none specified. */
1709 #define REG_ATTRS(RTX) X0REGATTR (RTX, 1)
1711 #ifndef GENERATOR_FILE
1712 /* For a MEM rtx, the alias set. If 0, this MEM is not in any alias
1713 set, and may alias anything. Otherwise, the MEM can only alias
1714 MEMs in a conflicting alias set. This value is set in a
1715 language-dependent manner in the front-end, and should not be
1716 altered in the back-end. These set numbers are tested with
1717 alias_sets_conflict_p. */
1718 #define MEM_ALIAS_SET(RTX) (get_mem_attrs (RTX)->alias)
1720 /* For a MEM rtx, the decl it is known to refer to, if it is known to
1721 refer to part of a DECL. It may also be a COMPONENT_REF. */
1722 #define MEM_EXPR(RTX) (get_mem_attrs (RTX)->expr)
1724 /* For a MEM rtx, true if its MEM_OFFSET is known. */
1725 #define MEM_OFFSET_KNOWN_P(RTX) (get_mem_attrs (RTX)->offset_known_p)
1727 /* For a MEM rtx, the offset from the start of MEM_EXPR. */
1728 #define MEM_OFFSET(RTX) (get_mem_attrs (RTX)->offset)
1730 /* For a MEM rtx, the address space. */
1731 #define MEM_ADDR_SPACE(RTX) (get_mem_attrs (RTX)->addrspace)
1733 /* For a MEM rtx, true if its MEM_SIZE is known. */
1734 #define MEM_SIZE_KNOWN_P(RTX) (get_mem_attrs (RTX)->size_known_p)
1736 /* For a MEM rtx, the size in bytes of the MEM. */
1737 #define MEM_SIZE(RTX) (get_mem_attrs (RTX)->size)
1739 /* For a MEM rtx, the alignment in bits. We can use the alignment of the
1740 mode as a default when STRICT_ALIGNMENT, but not if not. */
1741 #define MEM_ALIGN(RTX) (get_mem_attrs (RTX)->align)
1742 #else
1743 #define MEM_ADDR_SPACE(RTX) ADDR_SPACE_GENERIC
1744 #endif
1746 /* For a REG rtx, the decl it is known to refer to, if it is known to
1747 refer to part of a DECL. */
1748 #define REG_EXPR(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->decl)
1750 /* For a REG rtx, the offset from the start of REG_EXPR, if known, as an
1751 HOST_WIDE_INT. */
1752 #define REG_OFFSET(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->offset)
1754 /* Copy the attributes that apply to memory locations from RHS to LHS. */
1755 #define MEM_COPY_ATTRIBUTES(LHS, RHS) \
1756 (MEM_VOLATILE_P (LHS) = MEM_VOLATILE_P (RHS), \
1757 MEM_NOTRAP_P (LHS) = MEM_NOTRAP_P (RHS), \
1758 MEM_READONLY_P (LHS) = MEM_READONLY_P (RHS), \
1759 MEM_KEEP_ALIAS_SET_P (LHS) = MEM_KEEP_ALIAS_SET_P (RHS), \
1760 MEM_POINTER (LHS) = MEM_POINTER (RHS), \
1761 MEM_ATTRS (LHS) = MEM_ATTRS (RHS))
1763 /* 1 if RTX is a label_ref for a nonlocal label. */
1764 /* Likewise in an expr_list for a REG_LABEL_OPERAND or
1765 REG_LABEL_TARGET note. */
1766 #define LABEL_REF_NONLOCAL_P(RTX) \
1767 (RTL_FLAG_CHECK1 ("LABEL_REF_NONLOCAL_P", (RTX), LABEL_REF)->volatil)
1769 /* 1 if RTX is a code_label that should always be considered to be needed. */
1770 #define LABEL_PRESERVE_P(RTX) \
1771 (RTL_FLAG_CHECK2 ("LABEL_PRESERVE_P", (RTX), CODE_LABEL, NOTE)->in_struct)
1773 /* During sched, 1 if RTX is an insn that must be scheduled together
1774 with the preceding insn. */
1775 #define SCHED_GROUP_P(RTX) \
1776 (RTL_FLAG_CHECK4 ("SCHED_GROUP_P", (RTX), DEBUG_INSN, INSN, \
1777 JUMP_INSN, CALL_INSN)->in_struct)
1779 /* For a SET rtx, SET_DEST is the place that is set
1780 and SET_SRC is the value it is set to. */
1781 #define SET_DEST(RTX) XC2EXP (RTX, 0, SET, CLOBBER)
1782 #define SET_SRC(RTX) XCEXP (RTX, 1, SET)
1783 #define SET_IS_RETURN_P(RTX) \
1784 (RTL_FLAG_CHECK1 ("SET_IS_RETURN_P", (RTX), SET)->jump)
1786 /* For a TRAP_IF rtx, TRAP_CONDITION is an expression. */
1787 #define TRAP_CONDITION(RTX) XCEXP (RTX, 0, TRAP_IF)
1788 #define TRAP_CODE(RTX) XCEXP (RTX, 1, TRAP_IF)
1790 /* For a COND_EXEC rtx, COND_EXEC_TEST is the condition to base
1791 conditionally executing the code on, COND_EXEC_CODE is the code
1792 to execute if the condition is true. */
1793 #define COND_EXEC_TEST(RTX) XCEXP (RTX, 0, COND_EXEC)
1794 #define COND_EXEC_CODE(RTX) XCEXP (RTX, 1, COND_EXEC)
1796 /* 1 if RTX is a symbol_ref that addresses this function's rtl
1797 constants pool. */
1798 #define CONSTANT_POOL_ADDRESS_P(RTX) \
1799 (RTL_FLAG_CHECK1 ("CONSTANT_POOL_ADDRESS_P", (RTX), SYMBOL_REF)->unchanging)
1801 /* 1 if RTX is a symbol_ref that addresses a value in the file's
1802 tree constant pool. This information is private to varasm.c. */
1803 #define TREE_CONSTANT_POOL_ADDRESS_P(RTX) \
1804 (RTL_FLAG_CHECK1 ("TREE_CONSTANT_POOL_ADDRESS_P", \
1805 (RTX), SYMBOL_REF)->frame_related)
1807 /* Used if RTX is a symbol_ref, for machine-specific purposes. */
1808 #define SYMBOL_REF_FLAG(RTX) \
1809 (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAG", (RTX), SYMBOL_REF)->volatil)
1811 /* 1 if RTX is a symbol_ref that has been the library function in
1812 emit_library_call. */
1813 #define SYMBOL_REF_USED(RTX) \
1814 (RTL_FLAG_CHECK1 ("SYMBOL_REF_USED", (RTX), SYMBOL_REF)->used)
1816 /* 1 if RTX is a symbol_ref for a weak symbol. */
1817 #define SYMBOL_REF_WEAK(RTX) \
1818 (RTL_FLAG_CHECK1 ("SYMBOL_REF_WEAK", (RTX), SYMBOL_REF)->return_val)
1820 /* A pointer attached to the SYMBOL_REF; either SYMBOL_REF_DECL or
1821 SYMBOL_REF_CONSTANT. */
1822 #define SYMBOL_REF_DATA(RTX) X0ANY ((RTX), 1)
1824 /* Set RTX's SYMBOL_REF_DECL to DECL. RTX must not be a constant
1825 pool symbol. */
1826 #define SET_SYMBOL_REF_DECL(RTX, DECL) \
1827 (gcc_assert (!CONSTANT_POOL_ADDRESS_P (RTX)), X0TREE ((RTX), 1) = (DECL))
1829 /* The tree (decl or constant) associated with the symbol, or null. */
1830 #define SYMBOL_REF_DECL(RTX) \
1831 (CONSTANT_POOL_ADDRESS_P (RTX) ? NULL : X0TREE ((RTX), 1))
1833 /* Set RTX's SYMBOL_REF_CONSTANT to C. RTX must be a constant pool symbol. */
1834 #define SET_SYMBOL_REF_CONSTANT(RTX, C) \
1835 (gcc_assert (CONSTANT_POOL_ADDRESS_P (RTX)), X0CONSTANT ((RTX), 1) = (C))
1837 /* The rtx constant pool entry for a symbol, or null. */
1838 #define SYMBOL_REF_CONSTANT(RTX) \
1839 (CONSTANT_POOL_ADDRESS_P (RTX) ? X0CONSTANT ((RTX), 1) : NULL)
1841 /* A set of flags on a symbol_ref that are, in some respects, redundant with
1842 information derivable from the tree decl associated with this symbol.
1843 Except that we build a *lot* of SYMBOL_REFs that aren't associated with a
1844 decl. In some cases this is a bug. But beyond that, it's nice to cache
1845 this information to avoid recomputing it. Finally, this allows space for
1846 the target to store more than one bit of information, as with
1847 SYMBOL_REF_FLAG. */
1848 #define SYMBOL_REF_FLAGS(RTX) \
1849 (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAGS", (RTX), SYMBOL_REF) \
1850 ->u2.symbol_ref_flags)
1852 /* These flags are common enough to be defined for all targets. They
1853 are computed by the default version of targetm.encode_section_info. */
1855 /* Set if this symbol is a function. */
1856 #define SYMBOL_FLAG_FUNCTION (1 << 0)
1857 #define SYMBOL_REF_FUNCTION_P(RTX) \
1858 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_FUNCTION) != 0)
1859 /* Set if targetm.binds_local_p is true. */
1860 #define SYMBOL_FLAG_LOCAL (1 << 1)
1861 #define SYMBOL_REF_LOCAL_P(RTX) \
1862 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_LOCAL) != 0)
1863 /* Set if targetm.in_small_data_p is true. */
1864 #define SYMBOL_FLAG_SMALL (1 << 2)
1865 #define SYMBOL_REF_SMALL_P(RTX) \
1866 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_SMALL) != 0)
1867 /* The three-bit field at [5:3] is true for TLS variables; use
1868 SYMBOL_REF_TLS_MODEL to extract the field as an enum tls_model. */
1869 #define SYMBOL_FLAG_TLS_SHIFT 3
1870 #define SYMBOL_REF_TLS_MODEL(RTX) \
1871 ((enum tls_model) ((SYMBOL_REF_FLAGS (RTX) >> SYMBOL_FLAG_TLS_SHIFT) & 7))
1872 /* Set if this symbol is not defined in this translation unit. */
1873 #define SYMBOL_FLAG_EXTERNAL (1 << 6)
1874 #define SYMBOL_REF_EXTERNAL_P(RTX) \
1875 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_EXTERNAL) != 0)
1876 /* Set if this symbol has a block_symbol structure associated with it. */
1877 #define SYMBOL_FLAG_HAS_BLOCK_INFO (1 << 7)
1878 #define SYMBOL_REF_HAS_BLOCK_INFO_P(RTX) \
1879 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_HAS_BLOCK_INFO) != 0)
1880 /* Set if this symbol is a section anchor. SYMBOL_REF_ANCHOR_P implies
1881 SYMBOL_REF_HAS_BLOCK_INFO_P. */
1882 #define SYMBOL_FLAG_ANCHOR (1 << 8)
1883 #define SYMBOL_REF_ANCHOR_P(RTX) \
1884 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_ANCHOR) != 0)
1886 /* Subsequent bits are available for the target to use. */
1887 #define SYMBOL_FLAG_MACH_DEP_SHIFT 9
1888 #define SYMBOL_FLAG_MACH_DEP (1 << SYMBOL_FLAG_MACH_DEP_SHIFT)
1890 /* If SYMBOL_REF_HAS_BLOCK_INFO_P (RTX), this is the object_block
1891 structure to which the symbol belongs, or NULL if it has not been
1892 assigned a block. */
1893 #define SYMBOL_REF_BLOCK(RTX) (BLOCK_SYMBOL_CHECK (RTX)->block)
1895 /* If SYMBOL_REF_HAS_BLOCK_INFO_P (RTX), this is the offset of RTX from
1896 the first object in SYMBOL_REF_BLOCK (RTX). The value is negative if
1897 RTX has not yet been assigned to a block, or it has not been given an
1898 offset within that block. */
1899 #define SYMBOL_REF_BLOCK_OFFSET(RTX) (BLOCK_SYMBOL_CHECK (RTX)->offset)
1901 /* True if RTX is flagged to be a scheduling barrier. */
1902 #define PREFETCH_SCHEDULE_BARRIER_P(RTX) \
1903 (RTL_FLAG_CHECK1 ("PREFETCH_SCHEDULE_BARRIER_P", (RTX), PREFETCH)->volatil)
1905 /* Indicate whether the machine has any sort of auto increment addressing.
1906 If not, we can avoid checking for REG_INC notes. */
1908 #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) \
1909 || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT) \
1910 || defined (HAVE_PRE_MODIFY_DISP) || defined (HAVE_POST_MODIFY_DISP) \
1911 || defined (HAVE_PRE_MODIFY_REG) || defined (HAVE_POST_MODIFY_REG))
1912 #define AUTO_INC_DEC
1913 #endif
1915 /* Define a macro to look for REG_INC notes,
1916 but save time on machines where they never exist. */
1918 #ifdef AUTO_INC_DEC
1919 #define FIND_REG_INC_NOTE(INSN, REG) \
1920 ((REG) != NULL_RTX && REG_P ((REG)) \
1921 ? find_regno_note ((INSN), REG_INC, REGNO (REG)) \
1922 : find_reg_note ((INSN), REG_INC, (REG)))
1923 #else
1924 #define FIND_REG_INC_NOTE(INSN, REG) 0
1925 #endif
1927 #ifndef HAVE_PRE_INCREMENT
1928 #define HAVE_PRE_INCREMENT 0
1929 #endif
1931 #ifndef HAVE_PRE_DECREMENT
1932 #define HAVE_PRE_DECREMENT 0
1933 #endif
1935 #ifndef HAVE_POST_INCREMENT
1936 #define HAVE_POST_INCREMENT 0
1937 #endif
1939 #ifndef HAVE_POST_DECREMENT
1940 #define HAVE_POST_DECREMENT 0
1941 #endif
1943 #ifndef HAVE_POST_MODIFY_DISP
1944 #define HAVE_POST_MODIFY_DISP 0
1945 #endif
1947 #ifndef HAVE_POST_MODIFY_REG
1948 #define HAVE_POST_MODIFY_REG 0
1949 #endif
1951 #ifndef HAVE_PRE_MODIFY_DISP
1952 #define HAVE_PRE_MODIFY_DISP 0
1953 #endif
1955 #ifndef HAVE_PRE_MODIFY_REG
1956 #define HAVE_PRE_MODIFY_REG 0
1957 #endif
1960 /* Some architectures do not have complete pre/post increment/decrement
1961 instruction sets, or only move some modes efficiently. These macros
1962 allow us to tune autoincrement generation. */
1964 #ifndef USE_LOAD_POST_INCREMENT
1965 #define USE_LOAD_POST_INCREMENT(MODE) HAVE_POST_INCREMENT
1966 #endif
1968 #ifndef USE_LOAD_POST_DECREMENT
1969 #define USE_LOAD_POST_DECREMENT(MODE) HAVE_POST_DECREMENT
1970 #endif
1972 #ifndef USE_LOAD_PRE_INCREMENT
1973 #define USE_LOAD_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT
1974 #endif
1976 #ifndef USE_LOAD_PRE_DECREMENT
1977 #define USE_LOAD_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT
1978 #endif
1980 #ifndef USE_STORE_POST_INCREMENT
1981 #define USE_STORE_POST_INCREMENT(MODE) HAVE_POST_INCREMENT
1982 #endif
1984 #ifndef USE_STORE_POST_DECREMENT
1985 #define USE_STORE_POST_DECREMENT(MODE) HAVE_POST_DECREMENT
1986 #endif
1988 #ifndef USE_STORE_PRE_INCREMENT
1989 #define USE_STORE_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT
1990 #endif
1992 #ifndef USE_STORE_PRE_DECREMENT
1993 #define USE_STORE_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT
1994 #endif
1996 /* Nonzero when we are generating CONCATs. */
1997 extern int generating_concat_p;
1999 /* Nonzero when we are expanding trees to RTL. */
2000 extern int currently_expanding_to_rtl;
2002 /* Generally useful functions. */
2004 /* In explow.c */
2005 extern HOST_WIDE_INT trunc_int_for_mode (HOST_WIDE_INT, enum machine_mode);
2006 extern rtx plus_constant (enum machine_mode, rtx, HOST_WIDE_INT, bool = false);
2008 /* In rtl.c */
2009 extern rtx rtx_alloc_stat (RTX_CODE MEM_STAT_DECL);
2010 #define rtx_alloc(c) rtx_alloc_stat (c MEM_STAT_INFO)
2011 extern rtx rtx_alloc_stat_v (RTX_CODE MEM_STAT_DECL, int);
2012 #define rtx_alloc_v(c, SZ) rtx_alloc_stat_v (c MEM_STAT_INFO, SZ)
2013 #define const_wide_int_alloc(NWORDS) \
2014 rtx_alloc_v (CONST_WIDE_INT, \
2015 (sizeof (struct hwivec_def) \
2016 + ((NWORDS)-1) * sizeof (HOST_WIDE_INT))) \
2018 extern rtvec rtvec_alloc (int);
2019 extern rtvec shallow_copy_rtvec (rtvec);
2020 extern bool shared_const_p (const_rtx);
2021 extern rtx copy_rtx (rtx);
2022 extern void dump_rtx_statistics (void);
2024 /* In emit-rtl.c */
2025 extern rtx copy_rtx_if_shared (rtx);
2027 /* In rtl.c */
2028 extern unsigned int rtx_size (const_rtx);
2029 extern rtx shallow_copy_rtx_stat (const_rtx MEM_STAT_DECL);
2030 #define shallow_copy_rtx(a) shallow_copy_rtx_stat (a MEM_STAT_INFO)
2031 extern int rtx_equal_p (const_rtx, const_rtx);
2033 /* In emit-rtl.c */
2034 extern rtvec gen_rtvec_v (int, rtx *);
2035 extern rtx gen_reg_rtx (enum machine_mode);
2036 extern rtx gen_rtx_REG_offset (rtx, enum machine_mode, unsigned int, int);
2037 extern rtx gen_reg_rtx_offset (rtx, enum machine_mode, int);
2038 extern rtx gen_reg_rtx_and_attrs (rtx);
2039 extern rtx gen_label_rtx (void);
2040 extern rtx gen_lowpart_common (enum machine_mode, rtx);
2042 /* In cse.c */
2043 extern rtx gen_lowpart_if_possible (enum machine_mode, rtx);
2045 /* In emit-rtl.c */
2046 extern rtx gen_highpart (enum machine_mode, rtx);
2047 extern rtx gen_highpart_mode (enum machine_mode, enum machine_mode, rtx);
2048 extern rtx operand_subword (rtx, unsigned int, int, enum machine_mode);
2050 /* In emit-rtl.c */
2051 extern rtx operand_subword_force (rtx, unsigned int, enum machine_mode);
2052 extern bool paradoxical_subreg_p (const_rtx);
2053 extern int subreg_lowpart_p (const_rtx);
2054 extern unsigned int subreg_lowpart_offset (enum machine_mode,
2055 enum machine_mode);
2056 extern unsigned int subreg_highpart_offset (enum machine_mode,
2057 enum machine_mode);
2058 extern int byte_lowpart_offset (enum machine_mode, enum machine_mode);
2059 extern rtx make_safe_from (rtx, rtx);
2060 extern rtx convert_memory_address_addr_space (enum machine_mode, rtx,
2061 addr_space_t);
2062 #define convert_memory_address(to_mode,x) \
2063 convert_memory_address_addr_space ((to_mode), (x), ADDR_SPACE_GENERIC)
2064 extern const char *get_insn_name (int);
2065 extern rtx get_last_insn_anywhere (void);
2066 extern rtx get_first_nonnote_insn (void);
2067 extern rtx get_last_nonnote_insn (void);
2068 extern void start_sequence (void);
2069 extern void push_to_sequence (rtx);
2070 extern void push_to_sequence2 (rtx, rtx);
2071 extern void end_sequence (void);
2072 #if TARGET_SUPPORTS_WIDE_INT == 0
2073 extern double_int rtx_to_double_int (const_rtx);
2074 #endif
2075 extern void cwi_output_hex (FILE *, const_rtx);
2076 #ifndef GENERATOR_FILE
2077 extern rtx immed_wide_int_const (const wide_int_ref &, enum machine_mode);
2078 #endif
2079 #if TARGET_SUPPORTS_WIDE_INT == 0
2080 extern rtx immed_double_const (HOST_WIDE_INT, HOST_WIDE_INT,
2081 enum machine_mode);
2082 #endif
2084 /* In loop-iv.c */
2086 extern rtx lowpart_subreg (enum machine_mode, rtx, enum machine_mode);
2088 /* In varasm.c */
2089 extern rtx force_const_mem (enum machine_mode, rtx);
2091 /* In varasm.c */
2093 struct function;
2094 extern rtx get_pool_constant (rtx);
2095 extern rtx get_pool_constant_mark (rtx, bool *);
2096 extern enum machine_mode get_pool_mode (const_rtx);
2097 extern rtx simplify_subtraction (rtx);
2098 extern void decide_function_section (tree);
2100 /* In function.c */
2101 extern rtx assign_stack_local (enum machine_mode, HOST_WIDE_INT, int);
2102 #define ASLK_REDUCE_ALIGN 1
2103 #define ASLK_RECORD_PAD 2
2104 extern rtx assign_stack_local_1 (enum machine_mode, HOST_WIDE_INT, int, int);
2105 extern rtx assign_stack_temp (enum machine_mode, HOST_WIDE_INT);
2106 extern rtx assign_stack_temp_for_type (enum machine_mode, HOST_WIDE_INT, tree);
2107 extern rtx assign_temp (tree, int, int);
2109 /* In emit-rtl.c */
2110 extern rtx emit_insn_before (rtx, rtx);
2111 extern rtx emit_insn_before_noloc (rtx, rtx, basic_block);
2112 extern rtx emit_insn_before_setloc (rtx, rtx, int);
2113 extern rtx emit_jump_insn_before (rtx, rtx);
2114 extern rtx emit_jump_insn_before_noloc (rtx, rtx);
2115 extern rtx emit_jump_insn_before_setloc (rtx, rtx, int);
2116 extern rtx emit_call_insn_before (rtx, rtx);
2117 extern rtx emit_call_insn_before_noloc (rtx, rtx);
2118 extern rtx emit_call_insn_before_setloc (rtx, rtx, int);
2119 extern rtx emit_debug_insn_before (rtx, rtx);
2120 extern rtx emit_debug_insn_before_noloc (rtx, rtx);
2121 extern rtx emit_debug_insn_before_setloc (rtx, rtx, int);
2122 extern rtx emit_barrier_before (rtx);
2123 extern rtx emit_label_before (rtx, rtx);
2124 extern rtx emit_note_before (enum insn_note, rtx);
2125 extern rtx emit_insn_after (rtx, rtx);
2126 extern rtx emit_insn_after_noloc (rtx, rtx, basic_block);
2127 extern rtx emit_insn_after_setloc (rtx, rtx, int);
2128 extern rtx emit_jump_insn_after (rtx, rtx);
2129 extern rtx emit_jump_insn_after_noloc (rtx, rtx);
2130 extern rtx emit_jump_insn_after_setloc (rtx, rtx, int);
2131 extern rtx emit_call_insn_after (rtx, rtx);
2132 extern rtx emit_call_insn_after_noloc (rtx, rtx);
2133 extern rtx emit_call_insn_after_setloc (rtx, rtx, int);
2134 extern rtx emit_debug_insn_after (rtx, rtx);
2135 extern rtx emit_debug_insn_after_noloc (rtx, rtx);
2136 extern rtx emit_debug_insn_after_setloc (rtx, rtx, int);
2137 extern rtx emit_barrier_after (rtx);
2138 extern rtx emit_label_after (rtx, rtx);
2139 extern rtx emit_note_after (enum insn_note, rtx);
2140 extern rtx emit_insn (rtx);
2141 extern rtx emit_debug_insn (rtx);
2142 extern rtx emit_jump_insn (rtx);
2143 extern rtx emit_call_insn (rtx);
2144 extern rtx emit_label (rtx);
2145 extern rtx emit_jump_table_data (rtx);
2146 extern rtx emit_barrier (void);
2147 extern rtx emit_note (enum insn_note);
2148 extern rtx emit_note_copy (rtx);
2149 extern rtx gen_clobber (rtx);
2150 extern rtx emit_clobber (rtx);
2151 extern rtx gen_use (rtx);
2152 extern rtx emit_use (rtx);
2153 extern rtx make_insn_raw (rtx);
2154 extern void add_function_usage_to (rtx, rtx);
2155 extern rtx last_call_insn (void);
2156 extern rtx previous_insn (rtx);
2157 extern rtx next_insn (rtx);
2158 extern rtx prev_nonnote_insn (rtx);
2159 extern rtx prev_nonnote_insn_bb (rtx);
2160 extern rtx next_nonnote_insn (rtx);
2161 extern rtx next_nonnote_insn_bb (rtx);
2162 extern rtx prev_nondebug_insn (rtx);
2163 extern rtx next_nondebug_insn (rtx);
2164 extern rtx prev_nonnote_nondebug_insn (rtx);
2165 extern rtx next_nonnote_nondebug_insn (rtx);
2166 extern rtx prev_real_insn (rtx);
2167 extern rtx next_real_insn (rtx);
2168 extern rtx prev_active_insn (rtx);
2169 extern rtx next_active_insn (rtx);
2170 extern int active_insn_p (const_rtx);
2171 extern rtx next_cc0_user (rtx);
2172 extern rtx prev_cc0_setter (rtx);
2174 /* In emit-rtl.c */
2175 extern int insn_line (const_rtx);
2176 extern const char * insn_file (const_rtx);
2177 extern tree insn_scope (const_rtx);
2178 extern expanded_location insn_location (const_rtx);
2179 extern location_t prologue_location, epilogue_location;
2181 /* In jump.c */
2182 extern enum rtx_code reverse_condition (enum rtx_code);
2183 extern enum rtx_code reverse_condition_maybe_unordered (enum rtx_code);
2184 extern enum rtx_code swap_condition (enum rtx_code);
2185 extern enum rtx_code unsigned_condition (enum rtx_code);
2186 extern enum rtx_code signed_condition (enum rtx_code);
2187 extern void mark_jump_label (rtx, rtx, int);
2189 /* In jump.c */
2190 extern rtx delete_related_insns (rtx);
2192 /* In recog.c */
2193 extern rtx *find_constant_term_loc (rtx *);
2195 /* In emit-rtl.c */
2196 extern rtx try_split (rtx, rtx, int);
2197 extern int split_branch_probability;
2199 /* In unknown file */
2200 extern rtx split_insns (rtx, rtx);
2202 /* In simplify-rtx.c */
2203 extern rtx simplify_const_unary_operation (enum rtx_code, enum machine_mode,
2204 rtx, enum machine_mode);
2205 extern rtx simplify_unary_operation (enum rtx_code, enum machine_mode, rtx,
2206 enum machine_mode);
2207 extern rtx simplify_const_binary_operation (enum rtx_code, enum machine_mode,
2208 rtx, rtx);
2209 extern rtx simplify_binary_operation (enum rtx_code, enum machine_mode, rtx,
2210 rtx);
2211 extern rtx simplify_ternary_operation (enum rtx_code, enum machine_mode,
2212 enum machine_mode, rtx, rtx, rtx);
2213 extern rtx simplify_const_relational_operation (enum rtx_code,
2214 enum machine_mode, rtx, rtx);
2215 extern rtx simplify_relational_operation (enum rtx_code, enum machine_mode,
2216 enum machine_mode, rtx, rtx);
2217 extern rtx simplify_gen_binary (enum rtx_code, enum machine_mode, rtx, rtx);
2218 extern rtx simplify_gen_unary (enum rtx_code, enum machine_mode, rtx,
2219 enum machine_mode);
2220 extern rtx simplify_gen_ternary (enum rtx_code, enum machine_mode,
2221 enum machine_mode, rtx, rtx, rtx);
2222 extern rtx simplify_gen_relational (enum rtx_code, enum machine_mode,
2223 enum machine_mode, rtx, rtx);
2224 extern rtx simplify_subreg (enum machine_mode, rtx, enum machine_mode,
2225 unsigned int);
2226 extern rtx simplify_gen_subreg (enum machine_mode, rtx, enum machine_mode,
2227 unsigned int);
2228 extern rtx simplify_replace_fn_rtx (rtx, const_rtx,
2229 rtx (*fn) (rtx, const_rtx, void *), void *);
2230 extern rtx simplify_replace_rtx (rtx, const_rtx, rtx);
2231 extern rtx simplify_rtx (const_rtx);
2232 extern rtx avoid_constant_pool_reference (rtx);
2233 extern rtx delegitimize_mem_from_attrs (rtx);
2234 extern bool mode_signbit_p (enum machine_mode, const_rtx);
2235 extern bool val_signbit_p (enum machine_mode, unsigned HOST_WIDE_INT);
2236 extern bool val_signbit_known_set_p (enum machine_mode,
2237 unsigned HOST_WIDE_INT);
2238 extern bool val_signbit_known_clear_p (enum machine_mode,
2239 unsigned HOST_WIDE_INT);
2241 /* In reginfo.c */
2242 extern enum machine_mode choose_hard_reg_mode (unsigned int, unsigned int,
2243 bool);
2245 /* In emit-rtl.c */
2246 extern rtx set_for_reg_notes (rtx);
2247 extern rtx set_unique_reg_note (rtx, enum reg_note, rtx);
2248 extern rtx set_dst_reg_note (rtx, enum reg_note, rtx, rtx);
2249 extern void set_insn_deleted (rtx);
2251 /* Functions in rtlanal.c */
2253 /* Single set is implemented as macro for performance reasons. */
2254 #define single_set(I) (INSN_P (I) \
2255 ? (GET_CODE (PATTERN (I)) == SET \
2256 ? PATTERN (I) : single_set_1 (I)) \
2257 : NULL_RTX)
2258 #define single_set_1(I) single_set_2 (I, PATTERN (I))
2260 /* Structure used for passing data to REPLACE_LABEL. */
2261 struct replace_label_data
2263 rtx r1;
2264 rtx r2;
2265 bool update_label_nuses;
2268 extern enum machine_mode get_address_mode (rtx mem);
2269 extern int rtx_addr_can_trap_p (const_rtx);
2270 extern bool nonzero_address_p (const_rtx);
2271 extern int rtx_unstable_p (const_rtx);
2272 extern bool rtx_varies_p (const_rtx, bool);
2273 extern bool rtx_addr_varies_p (const_rtx, bool);
2274 extern rtx get_call_rtx_from (rtx);
2275 extern HOST_WIDE_INT get_integer_term (const_rtx);
2276 extern rtx get_related_value (const_rtx);
2277 extern bool offset_within_block_p (const_rtx, HOST_WIDE_INT);
2278 extern void split_const (rtx, rtx *, rtx *);
2279 extern bool unsigned_reg_p (rtx);
2280 extern int reg_mentioned_p (const_rtx, const_rtx);
2281 extern int count_occurrences (const_rtx, const_rtx, int);
2282 extern int reg_referenced_p (const_rtx, const_rtx);
2283 extern int reg_used_between_p (const_rtx, const_rtx, const_rtx);
2284 extern int reg_set_between_p (const_rtx, const_rtx, const_rtx);
2285 extern int commutative_operand_precedence (rtx);
2286 extern bool swap_commutative_operands_p (rtx, rtx);
2287 extern int modified_between_p (const_rtx, const_rtx, const_rtx);
2288 extern int no_labels_between_p (const_rtx, const_rtx);
2289 extern int modified_in_p (const_rtx, const_rtx);
2290 extern int reg_set_p (const_rtx, const_rtx);
2291 extern rtx single_set_2 (const_rtx, const_rtx);
2292 extern int multiple_sets (const_rtx);
2293 extern int set_noop_p (const_rtx);
2294 extern int noop_move_p (const_rtx);
2295 extern rtx find_last_value (rtx, rtx *, rtx, int);
2296 extern int refers_to_regno_p (unsigned int, unsigned int, const_rtx, rtx *);
2297 extern int reg_overlap_mentioned_p (const_rtx, const_rtx);
2298 extern const_rtx set_of (const_rtx, const_rtx);
2299 extern void record_hard_reg_sets (rtx, const_rtx, void *);
2300 extern void record_hard_reg_uses (rtx *, void *);
2301 #ifdef HARD_CONST
2302 extern void find_all_hard_reg_sets (const_rtx, HARD_REG_SET *, bool);
2303 #endif
2304 extern void note_stores (const_rtx, void (*) (rtx, const_rtx, void *), void *);
2305 extern void note_uses (rtx *, void (*) (rtx *, void *), void *);
2306 extern int dead_or_set_p (const_rtx, const_rtx);
2307 extern int dead_or_set_regno_p (const_rtx, unsigned int);
2308 extern rtx find_reg_note (const_rtx, enum reg_note, const_rtx);
2309 extern rtx find_regno_note (const_rtx, enum reg_note, unsigned int);
2310 extern rtx find_reg_equal_equiv_note (const_rtx);
2311 extern rtx find_constant_src (const_rtx);
2312 extern int find_reg_fusage (const_rtx, enum rtx_code, const_rtx);
2313 extern int find_regno_fusage (const_rtx, enum rtx_code, unsigned int);
2314 extern rtx alloc_reg_note (enum reg_note, rtx, rtx);
2315 extern void add_reg_note (rtx, enum reg_note, rtx);
2316 extern void add_int_reg_note (rtx, enum reg_note, int);
2317 extern void add_shallow_copy_of_reg_note (rtx, rtx);
2318 extern void remove_note (rtx, const_rtx);
2319 extern void remove_reg_equal_equiv_notes (rtx);
2320 extern void remove_reg_equal_equiv_notes_for_regno (unsigned int);
2321 extern int side_effects_p (const_rtx);
2322 extern int volatile_refs_p (const_rtx);
2323 extern int volatile_insn_p (const_rtx);
2324 extern int may_trap_p_1 (const_rtx, unsigned);
2325 extern int may_trap_p (const_rtx);
2326 extern int may_trap_or_fault_p (const_rtx);
2327 extern bool can_throw_internal (const_rtx);
2328 extern bool can_throw_external (const_rtx);
2329 extern bool insn_could_throw_p (const_rtx);
2330 extern bool insn_nothrow_p (const_rtx);
2331 extern bool can_nonlocal_goto (const_rtx);
2332 extern void copy_reg_eh_region_note_forward (rtx, rtx, rtx);
2333 extern void copy_reg_eh_region_note_backward (rtx, rtx, rtx);
2334 extern int inequality_comparisons_p (const_rtx);
2335 extern rtx replace_rtx (rtx, rtx, rtx);
2336 extern int replace_label (rtx *, void *);
2337 extern int rtx_referenced_p (rtx, rtx);
2338 extern bool tablejump_p (const_rtx, rtx *, rtx *);
2339 extern int computed_jump_p (const_rtx);
2340 extern bool tls_referenced_p (rtx);
2342 typedef int (*rtx_function) (rtx *, void *);
2343 extern int for_each_rtx (rtx *, rtx_function, void *);
2345 /* Callback for for_each_inc_dec, to process the autoinc operation OP
2346 within MEM that sets DEST to SRC + SRCOFF, or SRC if SRCOFF is
2347 NULL. The callback is passed the same opaque ARG passed to
2348 for_each_inc_dec. Return zero to continue looking for other
2349 autoinc operations, -1 to skip OP's operands, and any other value
2350 to interrupt the traversal and return that value to the caller of
2351 for_each_inc_dec. */
2352 typedef int (*for_each_inc_dec_fn) (rtx mem, rtx op, rtx dest, rtx src,
2353 rtx srcoff, void *arg);
2354 extern int for_each_inc_dec (rtx *, for_each_inc_dec_fn, void *arg);
2356 typedef int (*rtx_equal_p_callback_function) (const_rtx *, const_rtx *,
2357 rtx *, rtx *);
2358 extern int rtx_equal_p_cb (const_rtx, const_rtx,
2359 rtx_equal_p_callback_function);
2361 typedef int (*hash_rtx_callback_function) (const_rtx, enum machine_mode, rtx *,
2362 enum machine_mode *);
2363 extern unsigned hash_rtx_cb (const_rtx, enum machine_mode, int *, int *,
2364 bool, hash_rtx_callback_function);
2366 extern rtx regno_use_in (unsigned int, rtx);
2367 extern int auto_inc_p (const_rtx);
2368 extern int in_expr_list_p (const_rtx, const_rtx);
2369 extern void remove_node_from_expr_list (const_rtx, rtx *);
2370 extern int loc_mentioned_in_p (rtx *, const_rtx);
2371 extern rtx find_first_parameter_load (rtx, rtx);
2372 extern bool keep_with_call_p (const_rtx);
2373 extern bool label_is_jump_target_p (const_rtx, const_rtx);
2374 extern int insn_rtx_cost (rtx, bool);
2376 /* Given an insn and condition, return a canonical description of
2377 the test being made. */
2378 extern rtx canonicalize_condition (rtx, rtx, int, rtx *, rtx, int, int);
2380 /* Given a JUMP_INSN, return a canonical description of the test
2381 being made. */
2382 extern rtx get_condition (rtx, rtx *, int, int);
2384 /* Information about a subreg of a hard register. */
2385 struct subreg_info
2387 /* Offset of first hard register involved in the subreg. */
2388 int offset;
2389 /* Number of hard registers involved in the subreg. */
2390 int nregs;
2391 /* Whether this subreg can be represented as a hard reg with the new
2392 mode. */
2393 bool representable_p;
2396 extern void subreg_get_info (unsigned int, enum machine_mode,
2397 unsigned int, enum machine_mode,
2398 struct subreg_info *);
2400 /* lists.c */
2402 extern void free_EXPR_LIST_list (rtx *);
2403 extern void free_INSN_LIST_list (rtx *);
2404 extern void free_EXPR_LIST_node (rtx);
2405 extern void free_INSN_LIST_node (rtx);
2406 extern rtx alloc_INSN_LIST (rtx, rtx);
2407 extern rtx copy_INSN_LIST (rtx);
2408 extern rtx concat_INSN_LIST (rtx, rtx);
2409 extern rtx alloc_EXPR_LIST (int, rtx, rtx);
2410 extern void remove_free_INSN_LIST_elem (rtx, rtx *);
2411 extern rtx remove_list_elem (rtx, rtx *);
2412 extern rtx remove_free_INSN_LIST_node (rtx *);
2413 extern rtx remove_free_EXPR_LIST_node (rtx *);
2416 /* reginfo.c */
2418 /* Resize reg info. */
2419 extern bool resize_reg_info (void);
2420 /* Free up register info memory. */
2421 extern void free_reg_info (void);
2422 extern void init_subregs_of_mode (void);
2423 extern void finish_subregs_of_mode (void);
2425 /* recog.c */
2426 extern rtx extract_asm_operands (rtx);
2427 extern int asm_noperands (const_rtx);
2428 extern const char *decode_asm_operands (rtx, rtx *, rtx **, const char **,
2429 enum machine_mode *, location_t *);
2430 extern void get_referenced_operands (const char *, bool *, unsigned int);
2432 extern enum reg_class reg_preferred_class (int);
2433 extern enum reg_class reg_alternate_class (int);
2434 extern enum reg_class reg_allocno_class (int);
2435 extern void setup_reg_classes (int, enum reg_class, enum reg_class,
2436 enum reg_class);
2438 extern void split_all_insns (void);
2439 extern unsigned int split_all_insns_noflow (void);
2441 #define MAX_SAVED_CONST_INT 64
2442 extern GTY(()) rtx const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1];
2444 #define const0_rtx (const_int_rtx[MAX_SAVED_CONST_INT])
2445 #define const1_rtx (const_int_rtx[MAX_SAVED_CONST_INT+1])
2446 #define const2_rtx (const_int_rtx[MAX_SAVED_CONST_INT+2])
2447 #define constm1_rtx (const_int_rtx[MAX_SAVED_CONST_INT-1])
2448 extern GTY(()) rtx const_true_rtx;
2450 extern GTY(()) rtx const_tiny_rtx[4][(int) MAX_MACHINE_MODE];
2452 /* Returns a constant 0 rtx in mode MODE. Integer modes are treated the
2453 same as VOIDmode. */
2455 #define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)])
2457 /* Likewise, for the constants 1 and 2 and -1. */
2459 #define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)])
2460 #define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)])
2461 #define CONSTM1_RTX(MODE) (const_tiny_rtx[3][(int) (MODE)])
2463 extern GTY(()) rtx pc_rtx;
2464 extern GTY(()) rtx cc0_rtx;
2465 extern GTY(()) rtx ret_rtx;
2466 extern GTY(()) rtx simple_return_rtx;
2468 /* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg
2469 is used to represent the frame pointer. This is because the
2470 hard frame pointer and the automatic variables are separated by an amount
2471 that cannot be determined until after register allocation. We can assume
2472 that in this case ELIMINABLE_REGS will be defined, one action of which
2473 will be to eliminate FRAME_POINTER_REGNUM into HARD_FRAME_POINTER_REGNUM. */
2474 #ifndef HARD_FRAME_POINTER_REGNUM
2475 #define HARD_FRAME_POINTER_REGNUM FRAME_POINTER_REGNUM
2476 #endif
2478 #ifndef HARD_FRAME_POINTER_IS_FRAME_POINTER
2479 #define HARD_FRAME_POINTER_IS_FRAME_POINTER \
2480 (HARD_FRAME_POINTER_REGNUM == FRAME_POINTER_REGNUM)
2481 #endif
2483 #ifndef HARD_FRAME_POINTER_IS_ARG_POINTER
2484 #define HARD_FRAME_POINTER_IS_ARG_POINTER \
2485 (HARD_FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM)
2486 #endif
2488 /* Index labels for global_rtl. */
2489 enum global_rtl_index
2491 GR_STACK_POINTER,
2492 GR_FRAME_POINTER,
2493 /* For register elimination to work properly these hard_frame_pointer_rtx,
2494 frame_pointer_rtx, and arg_pointer_rtx must be the same if they refer to
2495 the same register. */
2496 #if FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM
2497 GR_ARG_POINTER = GR_FRAME_POINTER,
2498 #endif
2499 #if HARD_FRAME_POINTER_IS_FRAME_POINTER
2500 GR_HARD_FRAME_POINTER = GR_FRAME_POINTER,
2501 #else
2502 GR_HARD_FRAME_POINTER,
2503 #endif
2504 #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
2505 #if HARD_FRAME_POINTER_IS_ARG_POINTER
2506 GR_ARG_POINTER = GR_HARD_FRAME_POINTER,
2507 #else
2508 GR_ARG_POINTER,
2509 #endif
2510 #endif
2511 GR_VIRTUAL_INCOMING_ARGS,
2512 GR_VIRTUAL_STACK_ARGS,
2513 GR_VIRTUAL_STACK_DYNAMIC,
2514 GR_VIRTUAL_OUTGOING_ARGS,
2515 GR_VIRTUAL_CFA,
2516 GR_VIRTUAL_PREFERRED_STACK_BOUNDARY,
2518 GR_MAX
2521 /* Target-dependent globals. */
2522 struct GTY(()) target_rtl {
2523 /* All references to the hard registers in global_rtl_index go through
2524 these unique rtl objects. On machines where the frame-pointer and
2525 arg-pointer are the same register, they use the same unique object.
2527 After register allocation, other rtl objects which used to be pseudo-regs
2528 may be clobbered to refer to the frame-pointer register.
2529 But references that were originally to the frame-pointer can be
2530 distinguished from the others because they contain frame_pointer_rtx.
2532 When to use frame_pointer_rtx and hard_frame_pointer_rtx is a little
2533 tricky: until register elimination has taken place hard_frame_pointer_rtx
2534 should be used if it is being set, and frame_pointer_rtx otherwise. After
2535 register elimination hard_frame_pointer_rtx should always be used.
2536 On machines where the two registers are same (most) then these are the
2537 same. */
2538 rtx x_global_rtl[GR_MAX];
2540 /* A unique representation of (REG:Pmode PIC_OFFSET_TABLE_REGNUM). */
2541 rtx x_pic_offset_table_rtx;
2543 /* A unique representation of (REG:Pmode RETURN_ADDRESS_POINTER_REGNUM).
2544 This is used to implement __builtin_return_address for some machines;
2545 see for instance the MIPS port. */
2546 rtx x_return_address_pointer_rtx;
2548 /* Commonly used RTL for hard registers. These objects are not
2549 necessarily unique, so we allocate them separately from global_rtl.
2550 They are initialized once per compilation unit, then copied into
2551 regno_reg_rtx at the beginning of each function. */
2552 rtx x_initial_regno_reg_rtx[FIRST_PSEUDO_REGISTER];
2554 /* A sample (mem:M stack_pointer_rtx) rtx for each mode M. */
2555 rtx x_top_of_stack[MAX_MACHINE_MODE];
2557 /* Static hunks of RTL used by the aliasing code; these are treated
2558 as persistent to avoid unnecessary RTL allocations. */
2559 rtx x_static_reg_base_value[FIRST_PSEUDO_REGISTER];
2561 /* The default memory attributes for each mode. */
2562 struct mem_attrs *x_mode_mem_attrs[(int) MAX_MACHINE_MODE];
2564 /* Track if RTL has been initialized. */
2565 bool target_specific_initialized;
2568 extern GTY(()) struct target_rtl default_target_rtl;
2569 #if SWITCHABLE_TARGET
2570 extern struct target_rtl *this_target_rtl;
2571 #else
2572 #define this_target_rtl (&default_target_rtl)
2573 #endif
2575 #define global_rtl \
2576 (this_target_rtl->x_global_rtl)
2577 #define pic_offset_table_rtx \
2578 (this_target_rtl->x_pic_offset_table_rtx)
2579 #define return_address_pointer_rtx \
2580 (this_target_rtl->x_return_address_pointer_rtx)
2581 #define top_of_stack \
2582 (this_target_rtl->x_top_of_stack)
2583 #define mode_mem_attrs \
2584 (this_target_rtl->x_mode_mem_attrs)
2586 /* All references to certain hard regs, except those created
2587 by allocating pseudo regs into them (when that's possible),
2588 go through these unique rtx objects. */
2589 #define stack_pointer_rtx (global_rtl[GR_STACK_POINTER])
2590 #define frame_pointer_rtx (global_rtl[GR_FRAME_POINTER])
2591 #define hard_frame_pointer_rtx (global_rtl[GR_HARD_FRAME_POINTER])
2592 #define arg_pointer_rtx (global_rtl[GR_ARG_POINTER])
2594 #ifndef GENERATOR_FILE
2595 /* Return the attributes of a MEM rtx. */
2596 static inline struct mem_attrs *
2597 get_mem_attrs (const_rtx x)
2599 struct mem_attrs *attrs;
2601 attrs = MEM_ATTRS (x);
2602 if (!attrs)
2603 attrs = mode_mem_attrs[(int) GET_MODE (x)];
2604 return attrs;
2606 #endif
2608 /* Include the RTL generation functions. */
2610 #ifndef GENERATOR_FILE
2611 #include "genrtl.h"
2612 #undef gen_rtx_ASM_INPUT
2613 #define gen_rtx_ASM_INPUT(MODE, ARG0) \
2614 gen_rtx_fmt_si (ASM_INPUT, (MODE), (ARG0), 0)
2615 #define gen_rtx_ASM_INPUT_loc(MODE, ARG0, LOC) \
2616 gen_rtx_fmt_si (ASM_INPUT, (MODE), (ARG0), (LOC))
2617 #endif
2619 /* There are some RTL codes that require special attention; the
2620 generation functions included above do the raw handling. If you
2621 add to this list, modify special_rtx in gengenrtl.c as well. */
2623 extern rtx gen_rtx_CONST_INT (enum machine_mode, HOST_WIDE_INT);
2624 extern rtx gen_rtx_CONST_VECTOR (enum machine_mode, rtvec);
2625 extern rtx gen_raw_REG (enum machine_mode, int);
2626 extern rtx gen_rtx_REG (enum machine_mode, unsigned);
2627 extern rtx gen_rtx_SUBREG (enum machine_mode, rtx, int);
2628 extern rtx gen_rtx_MEM (enum machine_mode, rtx);
2629 extern rtx gen_rtx_VAR_LOCATION (enum machine_mode, tree, rtx,
2630 enum var_init_status);
2632 #define GEN_INT(N) gen_rtx_CONST_INT (VOIDmode, (N))
2634 /* Virtual registers are used during RTL generation to refer to locations into
2635 the stack frame when the actual location isn't known until RTL generation
2636 is complete. The routine instantiate_virtual_regs replaces these with
2637 the proper value, which is normally {frame,arg,stack}_pointer_rtx plus
2638 a constant. */
2640 #define FIRST_VIRTUAL_REGISTER (FIRST_PSEUDO_REGISTER)
2642 /* This points to the first word of the incoming arguments passed on the stack,
2643 either by the caller or by the callee when pretending it was passed by the
2644 caller. */
2646 #define virtual_incoming_args_rtx (global_rtl[GR_VIRTUAL_INCOMING_ARGS])
2648 #define VIRTUAL_INCOMING_ARGS_REGNUM (FIRST_VIRTUAL_REGISTER)
2650 /* If FRAME_GROWS_DOWNWARD, this points to immediately above the first
2651 variable on the stack. Otherwise, it points to the first variable on
2652 the stack. */
2654 #define virtual_stack_vars_rtx (global_rtl[GR_VIRTUAL_STACK_ARGS])
2656 #define VIRTUAL_STACK_VARS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 1)
2658 /* This points to the location of dynamically-allocated memory on the stack
2659 immediately after the stack pointer has been adjusted by the amount
2660 desired. */
2662 #define virtual_stack_dynamic_rtx (global_rtl[GR_VIRTUAL_STACK_DYNAMIC])
2664 #define VIRTUAL_STACK_DYNAMIC_REGNUM ((FIRST_VIRTUAL_REGISTER) + 2)
2666 /* This points to the location in the stack at which outgoing arguments should
2667 be written when the stack is pre-pushed (arguments pushed using push
2668 insns always use sp). */
2670 #define virtual_outgoing_args_rtx (global_rtl[GR_VIRTUAL_OUTGOING_ARGS])
2672 #define VIRTUAL_OUTGOING_ARGS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 3)
2674 /* This points to the Canonical Frame Address of the function. This
2675 should correspond to the CFA produced by INCOMING_FRAME_SP_OFFSET,
2676 but is calculated relative to the arg pointer for simplicity; the
2677 frame pointer nor stack pointer are necessarily fixed relative to
2678 the CFA until after reload. */
2680 #define virtual_cfa_rtx (global_rtl[GR_VIRTUAL_CFA])
2682 #define VIRTUAL_CFA_REGNUM ((FIRST_VIRTUAL_REGISTER) + 4)
2684 #define LAST_VIRTUAL_POINTER_REGISTER ((FIRST_VIRTUAL_REGISTER) + 4)
2686 /* This is replaced by crtl->preferred_stack_boundary / BITS_PER_UNIT
2687 when finalized. */
2689 #define virtual_preferred_stack_boundary_rtx \
2690 (global_rtl[GR_VIRTUAL_PREFERRED_STACK_BOUNDARY])
2692 #define VIRTUAL_PREFERRED_STACK_BOUNDARY_REGNUM \
2693 ((FIRST_VIRTUAL_REGISTER) + 5)
2695 #define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 5)
2697 /* Nonzero if REGNUM is a pointer into the stack frame. */
2698 #define REGNO_PTR_FRAME_P(REGNUM) \
2699 ((REGNUM) == STACK_POINTER_REGNUM \
2700 || (REGNUM) == FRAME_POINTER_REGNUM \
2701 || (REGNUM) == HARD_FRAME_POINTER_REGNUM \
2702 || (REGNUM) == ARG_POINTER_REGNUM \
2703 || ((REGNUM) >= FIRST_VIRTUAL_REGISTER \
2704 && (REGNUM) <= LAST_VIRTUAL_POINTER_REGISTER))
2706 /* REGNUM never really appearing in the INSN stream. */
2707 #define INVALID_REGNUM (~(unsigned int) 0)
2709 /* REGNUM for which no debug information can be generated. */
2710 #define IGNORED_DWARF_REGNUM (INVALID_REGNUM - 1)
2712 extern rtx output_constant_def (tree, int);
2713 extern rtx lookup_constant_def (tree);
2715 /* Nonzero after end of reload pass.
2716 Set to 1 or 0 by reload1.c. */
2718 extern int reload_completed;
2720 /* Nonzero after thread_prologue_and_epilogue_insns has run. */
2721 extern int epilogue_completed;
2723 /* Set to 1 while reload_as_needed is operating.
2724 Required by some machines to handle any generated moves differently. */
2726 extern int reload_in_progress;
2728 /* Set to 1 while in lra. */
2729 extern int lra_in_progress;
2731 /* This macro indicates whether you may create a new
2732 pseudo-register. */
2734 #define can_create_pseudo_p() (!reload_in_progress && !reload_completed)
2736 #ifdef STACK_REGS
2737 /* Nonzero after end of regstack pass.
2738 Set to 1 or 0 by reg-stack.c. */
2739 extern int regstack_completed;
2740 #endif
2742 /* If this is nonzero, we do not bother generating VOLATILE
2743 around volatile memory references, and we are willing to
2744 output indirect addresses. If cse is to follow, we reject
2745 indirect addresses so a useful potential cse is generated;
2746 if it is used only once, instruction combination will produce
2747 the same indirect address eventually. */
2748 extern int cse_not_expected;
2750 /* Translates rtx code to tree code, for those codes needed by
2751 REAL_ARITHMETIC. The function returns an int because the caller may not
2752 know what `enum tree_code' means. */
2754 extern int rtx_to_tree_code (enum rtx_code);
2756 /* In cse.c */
2757 extern int delete_trivially_dead_insns (rtx, int);
2758 extern int exp_equiv_p (const_rtx, const_rtx, int, bool);
2759 extern unsigned hash_rtx (const_rtx x, enum machine_mode, int *, int *, bool);
2761 /* In dse.c */
2762 extern bool check_for_inc_dec (rtx insn);
2764 /* In jump.c */
2765 extern int comparison_dominates_p (enum rtx_code, enum rtx_code);
2766 extern bool jump_to_label_p (rtx);
2767 extern int condjump_p (const_rtx);
2768 extern int any_condjump_p (const_rtx);
2769 extern int any_uncondjump_p (const_rtx);
2770 extern rtx pc_set (const_rtx);
2771 extern rtx condjump_label (const_rtx);
2772 extern int simplejump_p (const_rtx);
2773 extern int returnjump_p (rtx);
2774 extern int eh_returnjump_p (rtx);
2775 extern int onlyjump_p (const_rtx);
2776 extern int only_sets_cc0_p (const_rtx);
2777 extern int sets_cc0_p (const_rtx);
2778 extern int invert_jump_1 (rtx, rtx);
2779 extern int invert_jump (rtx, rtx, int);
2780 extern int rtx_renumbered_equal_p (const_rtx, const_rtx);
2781 extern int true_regnum (const_rtx);
2782 extern unsigned int reg_or_subregno (const_rtx);
2783 extern int redirect_jump_1 (rtx, rtx);
2784 extern void redirect_jump_2 (rtx, rtx, rtx, int, int);
2785 extern int redirect_jump (rtx, rtx, int);
2786 extern void rebuild_jump_labels (rtx);
2787 extern void rebuild_jump_labels_chain (rtx);
2788 extern rtx reversed_comparison (const_rtx, enum machine_mode);
2789 extern enum rtx_code reversed_comparison_code (const_rtx, const_rtx);
2790 extern enum rtx_code reversed_comparison_code_parts (enum rtx_code, const_rtx,
2791 const_rtx, const_rtx);
2792 extern void delete_for_peephole (rtx, rtx);
2793 extern int condjump_in_parallel_p (const_rtx);
2795 /* In emit-rtl.c. */
2796 extern int max_reg_num (void);
2797 extern int max_label_num (void);
2798 extern int get_first_label_num (void);
2799 extern void maybe_set_first_label_num (rtx);
2800 extern void delete_insns_since (rtx);
2801 extern void mark_reg_pointer (rtx, int);
2802 extern void mark_user_reg (rtx);
2803 extern void reset_used_flags (rtx);
2804 extern void set_used_flags (rtx);
2805 extern void reorder_insns (rtx, rtx, rtx);
2806 extern void reorder_insns_nobb (rtx, rtx, rtx);
2807 extern int get_max_insn_count (void);
2808 extern int in_sequence_p (void);
2809 extern void init_emit (void);
2810 extern void init_emit_regs (void);
2811 extern void init_derived_machine_modes (void);
2812 extern void init_emit_once (void);
2813 extern void push_topmost_sequence (void);
2814 extern void pop_topmost_sequence (void);
2815 extern void set_new_first_and_last_insn (rtx, rtx);
2816 extern unsigned int unshare_all_rtl (void);
2817 extern void unshare_all_rtl_again (rtx);
2818 extern void unshare_all_rtl_in_chain (rtx);
2819 extern void verify_rtl_sharing (void);
2820 extern void add_insn (rtx);
2821 extern void add_insn_before (rtx, rtx, basic_block);
2822 extern void add_insn_after (rtx, rtx, basic_block);
2823 extern void remove_insn (rtx);
2824 extern rtx emit (rtx);
2825 extern void delete_insn (rtx);
2826 extern rtx entry_of_function (void);
2827 extern void emit_insn_at_entry (rtx);
2828 extern void delete_insn_chain (rtx, rtx, bool);
2829 extern rtx unlink_insn_chain (rtx, rtx);
2830 extern void delete_insn_and_edges (rtx);
2831 extern rtx gen_lowpart_SUBREG (enum machine_mode, rtx);
2832 extern rtx gen_const_mem (enum machine_mode, rtx);
2833 extern rtx gen_frame_mem (enum machine_mode, rtx);
2834 extern rtx gen_tmp_stack_mem (enum machine_mode, rtx);
2835 extern bool validate_subreg (enum machine_mode, enum machine_mode,
2836 const_rtx, unsigned int);
2838 /* In combine.c */
2839 extern unsigned int extended_count (const_rtx, enum machine_mode, int);
2840 extern rtx remove_death (unsigned int, rtx);
2841 extern void dump_combine_stats (FILE *);
2842 extern void dump_combine_total_stats (FILE *);
2843 extern rtx make_compound_operation (rtx, enum rtx_code);
2845 /* In cfgcleanup.c */
2846 extern void delete_dead_jumptables (void);
2848 /* In sched-rgn.c. */
2849 extern void schedule_insns (void);
2851 /* In sched-ebb.c. */
2852 extern void schedule_ebbs (void);
2854 /* In sel-sched-dump.c. */
2855 extern void sel_sched_fix_param (const char *param, const char *val);
2857 /* In print-rtl.c */
2858 extern const char *print_rtx_head;
2859 extern void debug (const rtx_def &ref);
2860 extern void debug (const rtx_def *ptr);
2861 extern void debug_rtx (const_rtx);
2862 extern void debug_rtx_list (const_rtx, int);
2863 extern void debug_rtx_range (const_rtx, const_rtx);
2864 extern const_rtx debug_rtx_find (const_rtx, int);
2865 extern void print_mem_expr (FILE *, const_tree);
2866 extern void print_rtl (FILE *, const_rtx);
2867 extern void print_simple_rtl (FILE *, const_rtx);
2868 extern int print_rtl_single (FILE *, const_rtx);
2869 extern int print_rtl_single_with_indent (FILE *, const_rtx, int);
2870 extern void print_inline_rtx (FILE *, const_rtx, int);
2872 /* Functions in sched-vis.c. FIXME: Ideally these functions would
2873 not be in sched-vis.c but in rtl.c, because they are not only used
2874 by the scheduler anymore but for all "slim" RTL dumping. */
2875 extern void dump_value_slim (FILE *, const_rtx, int);
2876 extern void dump_insn_slim (FILE *, const_rtx);
2877 extern void dump_rtl_slim (FILE *, const_rtx, const_rtx, int, int);
2878 extern void print_value (pretty_printer *, const_rtx, int);
2879 extern void print_pattern (pretty_printer *, const_rtx, int);
2880 extern void print_insn (pretty_printer *, const_rtx, int);
2881 extern void rtl_dump_bb_for_graph (pretty_printer *, basic_block);
2882 extern const char *str_pattern_slim (const_rtx);
2884 /* In function.c */
2885 extern void reposition_prologue_and_epilogue_notes (void);
2886 extern int prologue_epilogue_contains (const_rtx);
2887 extern int sibcall_epilogue_contains (const_rtx);
2888 extern void update_temp_slot_address (rtx, rtx);
2889 extern void maybe_copy_prologue_epilogue_insn (rtx, rtx);
2890 extern void set_return_jump_label (rtx);
2892 /* In stmt.c */
2893 extern void expand_null_return (void);
2894 extern void expand_naked_return (void);
2895 extern void emit_jump (rtx);
2897 /* In expr.c */
2898 extern rtx move_by_pieces (rtx, rtx, unsigned HOST_WIDE_INT,
2899 unsigned int, int);
2900 extern HOST_WIDE_INT find_args_size_adjust (rtx);
2901 extern int fixup_args_size_notes (rtx, rtx, int);
2903 /* In cfgrtl.c */
2904 extern void print_rtl_with_bb (FILE *, const_rtx, int);
2905 extern rtx duplicate_insn_chain (rtx, rtx);
2907 /* In expmed.c */
2908 extern void init_expmed (void);
2909 extern void expand_inc (rtx, rtx);
2910 extern void expand_dec (rtx, rtx);
2912 /* In lower-subreg.c */
2913 extern void init_lower_subreg (void);
2915 /* In gcse.c */
2916 extern bool can_copy_p (enum machine_mode);
2917 extern bool can_assign_to_reg_without_clobbers_p (rtx);
2918 extern rtx fis_get_condition (rtx);
2920 /* In ira.c */
2921 #ifdef HARD_CONST
2922 extern HARD_REG_SET eliminable_regset;
2923 #endif
2924 extern void mark_elimination (int, int);
2926 /* In reginfo.c */
2927 extern int reg_classes_intersect_p (reg_class_t, reg_class_t);
2928 extern int reg_class_subset_p (reg_class_t, reg_class_t);
2929 extern void globalize_reg (tree, int);
2930 extern void init_reg_modes_target (void);
2931 extern void init_regs (void);
2932 extern void reinit_regs (void);
2933 extern void init_fake_stack_mems (void);
2934 extern void save_register_info (void);
2935 extern void init_reg_sets (void);
2936 extern void regclass (rtx, int);
2937 extern void reg_scan (rtx, unsigned int);
2938 extern void fix_register (const char *, int, int);
2939 extern bool invalid_mode_change_p (unsigned int, enum reg_class);
2941 /* In reload1.c */
2942 extern int function_invariant_p (const_rtx);
2944 /* In calls.c */
2945 enum libcall_type
2947 LCT_NORMAL = 0,
2948 LCT_CONST = 1,
2949 LCT_PURE = 2,
2950 LCT_NORETURN = 3,
2951 LCT_THROW = 4,
2952 LCT_RETURNS_TWICE = 5
2955 extern void emit_library_call (rtx, enum libcall_type, enum machine_mode, int,
2956 ...);
2957 extern rtx emit_library_call_value (rtx, rtx, enum libcall_type,
2958 enum machine_mode, int, ...);
2960 /* In varasm.c */
2961 extern void init_varasm_once (void);
2963 extern rtx make_debug_expr_from_rtl (const_rtx);
2965 /* In read-rtl.c */
2966 extern bool read_rtx (const char *, rtx *);
2968 /* In alias.c */
2969 extern rtx canon_rtx (rtx);
2970 extern int true_dependence (const_rtx, enum machine_mode, const_rtx);
2971 extern rtx get_addr (rtx);
2972 extern int canon_true_dependence (const_rtx, enum machine_mode, rtx,
2973 const_rtx, rtx);
2974 extern int read_dependence (const_rtx, const_rtx);
2975 extern int anti_dependence (const_rtx, const_rtx);
2976 extern int canon_anti_dependence (const_rtx, bool,
2977 const_rtx, enum machine_mode, rtx);
2978 extern int output_dependence (const_rtx, const_rtx);
2979 extern int may_alias_p (const_rtx, const_rtx);
2980 extern void init_alias_target (void);
2981 extern void init_alias_analysis (void);
2982 extern void end_alias_analysis (void);
2983 extern void vt_equate_reg_base_value (const_rtx, const_rtx);
2984 extern bool memory_modified_in_insn_p (const_rtx, const_rtx);
2985 extern bool memory_must_be_modified_in_insn_p (const_rtx, const_rtx);
2986 extern bool may_be_sp_based_p (rtx);
2987 extern rtx gen_hard_reg_clobber (enum machine_mode, unsigned int);
2988 extern rtx get_reg_known_value (unsigned int);
2989 extern bool get_reg_known_equiv_p (unsigned int);
2990 extern rtx get_reg_base_value (unsigned int);
2992 #ifdef STACK_REGS
2993 extern int stack_regs_mentioned (const_rtx insn);
2994 #endif
2996 /* In toplev.c */
2997 extern GTY(()) rtx stack_limit_rtx;
2999 /* In predict.c */
3000 extern void invert_br_probabilities (rtx);
3001 extern bool expensive_function_p (int);
3003 /* In var-tracking.c */
3004 extern unsigned int variable_tracking_main (void);
3006 /* In stor-layout.c. */
3007 extern void get_mode_bounds (enum machine_mode, int, enum machine_mode,
3008 rtx *, rtx *);
3010 /* In loop-iv.c */
3011 extern rtx canon_condition (rtx);
3012 extern void simplify_using_condition (rtx, rtx *, bitmap);
3014 /* In final.c */
3015 extern unsigned int compute_alignments (void);
3016 extern void update_alignments (vec<rtx> &);
3017 extern int asm_str_count (const char *templ);
3019 struct rtl_hooks
3021 rtx (*gen_lowpart) (enum machine_mode, rtx);
3022 rtx (*gen_lowpart_no_emit) (enum machine_mode, rtx);
3023 rtx (*reg_nonzero_bits) (const_rtx, enum machine_mode, const_rtx, enum machine_mode,
3024 unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT *);
3025 rtx (*reg_num_sign_bit_copies) (const_rtx, enum machine_mode, const_rtx, enum machine_mode,
3026 unsigned int, unsigned int *);
3027 bool (*reg_truncated_to_mode) (enum machine_mode, const_rtx);
3029 /* Whenever you add entries here, make sure you adjust rtlhooks-def.h. */
3032 /* Each pass can provide its own. */
3033 extern struct rtl_hooks rtl_hooks;
3035 /* ... but then it has to restore these. */
3036 extern const struct rtl_hooks general_rtl_hooks;
3038 /* Keep this for the nonce. */
3039 #define gen_lowpart rtl_hooks.gen_lowpart
3041 extern void insn_locations_init (void);
3042 extern void insn_locations_finalize (void);
3043 extern void set_curr_insn_location (location_t);
3044 extern location_t curr_insn_location (void);
3045 extern bool optimize_insn_for_size_p (void);
3046 extern bool optimize_insn_for_speed_p (void);
3048 /* rtl-error.c */
3049 extern void _fatal_insn_not_found (const_rtx, const char *, int, const char *)
3050 ATTRIBUTE_NORETURN;
3051 extern void _fatal_insn (const char *, const_rtx, const char *, int, const char *)
3052 ATTRIBUTE_NORETURN;
3054 #define fatal_insn(msgid, insn) \
3055 _fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__)
3056 #define fatal_insn_not_found(insn) \
3057 _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__)
3059 /* reginfo.c */
3060 extern tree GTY(()) global_regs_decl[FIRST_PSEUDO_REGISTER];
3063 #endif /* ! GCC_RTL_H */