1 /* Register Transfer Language (RTL) definitions for GCC
2 Copyright (C) 1987-2025 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
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
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/>. */
23 /* This file is occasionally included by generator files which expect
24 machmode.h and other files to exist and would not normally have been
25 included by coretypes.h. */
28 #include "fixed-value.h"
29 #include "statistics.h"
31 #include "hash-table.h"
35 #endif /* GENERATOR_FILE */
37 #include "hard-reg-set.h"
39 class predefined_function_abi
;
41 /* Value used by some passes to "recognize" noop moves as valid
43 #define NOOP_MOVE_INSN_CODE INT_MAX
45 /* Register Transfer Language EXPRESSIONS CODES */
47 #define RTX_CODE enum rtx_code
48 enum rtx_code
: unsigned {
50 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) ENUM ,
51 #include "rtl.def" /* rtl expressions are documented here */
54 LAST_AND_UNUSED_RTX_CODE
}; /* A convenient way to get a value for
56 Assumes default enum value assignment. */
58 /* The cast here, saves many elsewhere. */
59 #define NUM_RTX_CODE ((int) LAST_AND_UNUSED_RTX_CODE)
61 /* Similar, but since generator files get more entries... */
63 # define NON_GENERATOR_NUM_RTX_CODE ((int) MATCH_OPERAND)
66 #define RTX_CODE_BITSIZE 8
68 /* Register Transfer Language EXPRESSIONS CODE CLASSES */
71 /* We check bit 0-1 of some rtx class codes in the predicates below. */
73 /* Bit 0 = comparison if 0, arithmetic is 1
74 Bit 1 = 1 if commutative. */
80 /* Must follow the four preceding values. */
87 /* Bit 0 = 1 if constant. */
96 #define RTX_OBJ_MASK (~1)
97 #define RTX_OBJ_RESULT (RTX_OBJ & RTX_OBJ_MASK)
98 #define RTX_COMPARE_MASK (~1)
99 #define RTX_COMPARE_RESULT (RTX_COMPARE & RTX_COMPARE_MASK)
100 #define RTX_ARITHMETIC_MASK (~1)
101 #define RTX_ARITHMETIC_RESULT (RTX_COMM_ARITH & RTX_ARITHMETIC_MASK)
102 #define RTX_BINARY_MASK (~3)
103 #define RTX_BINARY_RESULT (RTX_COMPARE & RTX_BINARY_MASK)
104 #define RTX_COMMUTATIVE_MASK (~2)
105 #define RTX_COMMUTATIVE_RESULT (RTX_COMM_COMPARE & RTX_COMMUTATIVE_MASK)
106 #define RTX_NON_COMMUTATIVE_RESULT (RTX_COMPARE & RTX_COMMUTATIVE_MASK)
108 extern const unsigned char rtx_length
[NUM_RTX_CODE
];
109 #define GET_RTX_LENGTH(CODE) (rtx_length[(int) (CODE)])
111 extern const char * const rtx_name
[NUM_RTX_CODE
];
112 #define GET_RTX_NAME(CODE) (rtx_name[(int) (CODE)])
114 extern const char * const rtx_format
[NUM_RTX_CODE
];
115 #define GET_RTX_FORMAT(CODE) (rtx_format[(int) (CODE)])
117 extern const enum rtx_class rtx_class
[NUM_RTX_CODE
];
118 #define GET_RTX_CLASS(CODE) (rtx_class[(int) (CODE)])
120 /* True if CODE is part of the insn chain (i.e. has INSN_UID, PREV_INSN
121 and NEXT_INSN fields). */
122 #define INSN_CHAIN_CODE_P(CODE) IN_RANGE (CODE, DEBUG_INSN, NOTE)
124 extern const unsigned char rtx_code_size
[NUM_RTX_CODE
];
125 extern const unsigned char rtx_next
[NUM_RTX_CODE
];
127 /* The flags and bitfields of an ADDR_DIFF_VEC. BASE is the base label
128 relative to which the offsets are calculated, as explained in rtl.def. */
129 struct addr_diff_vec_flags
131 /* Set at the start of shorten_branches - ONLY WHEN OPTIMIZING - : */
132 unsigned min_align
: 8;
134 unsigned base_after_vec
: 1; /* BASE is after the ADDR_DIFF_VEC. */
135 unsigned min_after_vec
: 1; /* minimum address target label is
136 after the ADDR_DIFF_VEC. */
137 unsigned max_after_vec
: 1; /* maximum address target label is
138 after the ADDR_DIFF_VEC. */
139 unsigned min_after_base
: 1; /* minimum address target label is
141 unsigned max_after_base
: 1; /* maximum address target label is
143 /* Set by the actual branch shortening process - ONLY WHEN OPTIMIZING - : */
144 unsigned offset_unsigned
: 1; /* offsets have to be treated as unsigned. */
149 /* Structure used to describe the attributes of a MEM. These are hashed
150 so MEMs that the same attributes share a data structure. This means
151 they cannot be modified in place. */
152 class GTY(()) mem_attrs
157 /* The expression that the MEM accesses, or null if not known.
158 This expression might be larger than the memory reference itself.
159 (In other words, the MEM might access only part of the object.) */
162 /* The offset of the memory reference from the start of EXPR.
163 Only valid if OFFSET_KNOWN_P. */
166 /* The size of the memory reference in bytes. Only valid if
170 /* The alias set of the memory reference. */
171 alias_set_type alias
;
173 /* The alignment of the reference in bits. Always a multiple of
174 BITS_PER_UNIT. Note that EXPR may have a stricter alignment
175 than the memory reference itself. */
178 /* The address space that the memory reference uses. */
179 unsigned char addrspace
;
181 /* True if OFFSET is known. */
184 /* True if SIZE is known. */
188 /* Structure used to describe the attributes of a REG in similar way as
189 mem_attrs does for MEM above. Note that the OFFSET field is calculated
190 in the same way as for mem_attrs, rather than in the same way as a
191 SUBREG_BYTE. For example, if a big-endian target stores a byte
192 object in the low part of a 4-byte register, the OFFSET field
193 will be -3 rather than 0. */
195 class GTY((for_user
)) reg_attrs
{
197 tree decl
; /* decl corresponding to REG. */
198 poly_int64 offset
; /* Offset from start of DECL. */
201 /* Common union for an element of an rtx. */
206 unsigned int rt_uint
;
208 poly_uint16 rt_subreg
;
212 machine_mode rt_type
;
213 addr_diff_vec_flags rt_addr_diff_vec_flags
;
214 struct cselib_val
*rt_cselib
;
218 class constant_descriptor_rtx
*rt_constant
;
219 struct dw_cfi_node
*rt_cfi
;
222 /* Describes the properties of a REG. */
223 struct GTY(()) reg_info
{
224 /* The value of REGNO. */
227 /* The value of REG_NREGS. */
228 unsigned int nregs
: 8;
229 unsigned int unused
: 24;
231 /* The value of REG_ATTRS. */
235 /* This structure remembers the position of a SYMBOL_REF within an
236 object_block structure. A SYMBOL_REF only provides this information
237 if SYMBOL_REF_HAS_BLOCK_INFO_P is true. */
238 struct GTY(()) block_symbol
{
239 /* The usual SYMBOL_REF fields. */
240 rtunion
GTY ((skip
)) fld
[2];
242 /* The block that contains this object. */
243 struct object_block
*block
;
245 /* The offset of this object from the start of its block. It is negative
246 if the symbol has not yet been assigned an offset. */
247 HOST_WIDE_INT offset
;
250 /* Describes a group of objects that are to be placed together in such
251 a way that their relative positions are known. */
252 struct GTY((for_user
)) object_block
{
253 /* The section in which these objects should be placed. */
256 /* The alignment of the first object, measured in bits. */
257 unsigned int alignment
;
259 /* The total size of the objects, measured in bytes. */
262 /* The SYMBOL_REFs for each object. The vector is sorted in
263 order of increasing offset and the following conditions will
264 hold for each element X:
266 SYMBOL_REF_HAS_BLOCK_INFO_P (X)
267 !SYMBOL_REF_ANCHOR_P (X)
268 SYMBOL_REF_BLOCK (X) == [address of this structure]
269 SYMBOL_REF_BLOCK_OFFSET (X) >= 0. */
270 vec
<rtx
, va_gc
> *objects
;
272 /* All the anchor SYMBOL_REFs used to address these objects, sorted
273 in order of increasing offset, and then increasing TLS model.
274 The following conditions will hold for each element X in this vector:
276 SYMBOL_REF_HAS_BLOCK_INFO_P (X)
277 SYMBOL_REF_ANCHOR_P (X)
278 SYMBOL_REF_BLOCK (X) == [address of this structure]
279 SYMBOL_REF_BLOCK_OFFSET (X) >= 0. */
280 vec
<rtx
, va_gc
> *anchors
;
283 struct GTY((variable_size
)) hwivec_def
{
284 HOST_WIDE_INT elem
[1];
287 /* Number of elements of the HWIVEC if RTX is a CONST_WIDE_INT. */
288 #define CWI_GET_NUM_ELEM(RTX) \
289 ((int)RTL_FLAG_CHECK1("CWI_GET_NUM_ELEM", (RTX), CONST_WIDE_INT)->u2.num_elem)
290 #define CWI_PUT_NUM_ELEM(RTX, NUM) \
291 (RTL_FLAG_CHECK1("CWI_PUT_NUM_ELEM", (RTX), CONST_WIDE_INT)->u2.num_elem = (NUM))
293 struct GTY((variable_size
)) const_poly_int_def
{
294 trailing_wide_ints
<NUM_POLY_INT_COEFFS
> coeffs
;
297 /* RTL expression ("rtx"). */
299 /* The GTY "desc" and "tag" options below are a kludge: we need a desc
300 field for gengtype to recognize that inheritance is occurring,
301 so that all subclasses are redirected to the traversal hook for the
303 However, all of the fields are in the base class, and special-casing
304 is at work. Hence we use desc and tag of 0, generating a switch
305 statement of the form:
308 case 0: // all the work happens here
310 in order to work with the existing special-casing in gengtype. */
312 struct GTY((desc("0"), tag("0"),
313 chain_next ("RTX_NEXT (&%h)"),
314 chain_prev ("RTX_PREV (&%h)"))) rtx_def
{
315 /* The kind of value the expression has. */
316 ENUM_BITFIELD(machine_mode
) mode
: MACHINE_MODE_BITSIZE
;
318 /* The kind of expression this is. */
319 ENUM_BITFIELD(rtx_code
) code
: RTX_CODE_BITSIZE
;
321 /* 1 in a MEM if we should keep the alias set for this mem unchanged
322 when we access a component.
323 1 in a JUMP_INSN if it is a crossing jump.
324 1 in a CALL_INSN if it is a sibling call.
325 1 in a SET that is for a return.
326 In a CODE_LABEL, part of the two-bit alternate entry field.
327 1 in a CONCAT is VAL_EXPR_IS_COPIED in var-tracking.cc.
328 1 in a VALUE is SP_BASED_VALUE_P in cselib.cc.
329 1 in a SUBREG generated by LRA for reload insns.
330 1 in a REG if this is a static chain register.
331 Dumped as "/j" in RTL dumps. */
332 unsigned int jump
: 1;
333 /* In a CODE_LABEL, part of the two-bit alternate entry field.
334 1 in a MEM if it cannot trap.
335 1 in a CALL_INSN logically equivalent to
336 ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P.
337 1 in a VALUE is SP_DERIVED_VALUE_P in cselib.cc.
338 Dumped as "/c" in RTL dumps. */
339 unsigned int call
: 1;
340 /* 1 in a REG, MEM, or CONCAT if the value is set at most once, anywhere.
341 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P.
342 1 in a SYMBOL_REF if it addresses something in the per-function
344 1 in a CALL_INSN logically equivalent to ECF_CONST and TREE_READONLY.
345 1 in a NOTE, or EXPR_LIST for a const call.
346 1 in a JUMP_INSN of an annulling branch.
347 1 in a CONCAT is VAL_EXPR_IS_CLOBBERED in var-tracking.cc.
348 1 in a preserved VALUE is PRESERVED_VALUE_P in cselib.cc.
349 1 in a clobber temporarily created for LRA.
350 Dumped as "/u" in RTL dumps. */
351 unsigned int unchanging
: 1;
352 /* 1 in a MEM or ASM_OPERANDS expression if the memory reference is volatile.
353 1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL, BARRIER, or NOTE
354 if it has been deleted.
355 1 in a REG expression if corresponds to a variable declared by the user,
356 0 for an internally generated temporary.
357 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P.
358 1 in a LABEL_REF, REG_LABEL_TARGET or REG_LABEL_OPERAND note for a
360 In a SYMBOL_REF, this flag is used for machine-specific purposes.
361 In a PREFETCH, this flag indicates that it should be considered a
363 1 in a CONCAT is VAL_NEEDS_RESOLUTION in var-tracking.cc.
364 Dumped as "/v" in RTL dumps. */
365 unsigned int volatil
: 1;
366 /* 1 in a REG if the register is used only in exit code a loop.
367 1 in a SUBREG expression if was generated from a variable with a
369 1 in a CODE_LABEL if the label is used for nonlocal gotos
370 and must not be deleted even if its count is zero.
371 1 in an INSN, JUMP_INSN or CALL_INSN if this insn must be scheduled
372 together with the preceding insn. Valid only within sched.
373 1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and
374 from the target of a branch. Valid from reorg until end of compilation;
377 The name of the field is historical. It used to be used in MEMs
378 to record whether the MEM accessed part of a structure.
379 Dumped as "/s" in RTL dumps. */
380 unsigned int in_struct
: 1;
381 /* At the end of RTL generation, 1 if this rtx is used. This is used for
382 copying shared structure. See `unshare_all_rtl'.
383 In a REG, this is not needed for that purpose, and used instead
384 in `leaf_renumber_regs_insn'.
385 1 in a SYMBOL_REF, means that emit_library_call
386 has used it as the function.
387 1 in a CONCAT is VAL_HOLDS_TRACK_EXPR in var-tracking.cc.
388 1 in a VALUE or DEBUG_EXPR is VALUE_RECURSED_INTO in var-tracking.cc. */
389 unsigned int used
: 1;
390 /* 1 in an INSN or a SET if this rtx is related to the call frame,
391 either changing how we compute the frame address or saving and
392 restoring registers in the prologue and epilogue.
393 1 in a REG or MEM if it is a pointer.
394 1 in a SYMBOL_REF if it addresses something in the per-function
395 constant string pool.
396 1 in a VALUE is VALUE_CHANGED in var-tracking.cc.
397 Dumped as "/f" in RTL dumps. */
398 unsigned frame_related
: 1;
399 /* 1 in a REG or PARALLEL that is the current function's return value.
400 1 in a SYMBOL_REF for a weak symbol.
401 1 in a CALL_INSN logically equivalent to ECF_PURE and DECL_PURE_P.
402 1 in a CONCAT is VAL_EXPR_HAS_REVERSE in var-tracking.cc.
403 1 in a VALUE or DEBUG_EXPR is NO_LOC_P in var-tracking.cc.
404 Dumped as "/i" in RTL dumps. */
405 unsigned return_val
: 1;
408 /* The final union field is aligned to 64 bits on LP64 hosts,
409 giving a 32-bit gap after the fields above. We optimize the
410 layout for that case and use the gap for extra code-specific
413 /* The ORIGINAL_REGNO of a REG. */
414 unsigned int original_regno
;
416 /* The INSN_UID of an RTX_INSN-class code. */
419 /* The SYMBOL_REF_FLAGS of a SYMBOL_REF. */
420 unsigned int symbol_ref_flags
;
422 /* The PAT_VAR_LOCATION_STATUS of a VAR_LOCATION. */
423 enum var_init_status var_location_status
;
425 /* In a CONST_WIDE_INT (aka hwivec_def), this is the number of
426 HOST_WIDE_INTs in the hwivec_def. */
427 unsigned int num_elem
;
429 /* Information about a CONST_VECTOR. */
432 /* The value of CONST_VECTOR_NPATTERNS. */
433 unsigned int npatterns
: 16;
435 /* The value of CONST_VECTOR_NELTS_PER_PATTERN. */
436 unsigned int nelts_per_pattern
: 8;
438 /* For future expansion. */
439 unsigned int unused
: 8;
443 /* The first element of the operands of this rtx.
444 The number of operands and their types are controlled
445 by the `code' field, according to rtl.def. */
448 HOST_WIDE_INT hwint
[1];
450 struct block_symbol block_sym
;
451 struct real_value rv
;
452 struct fixed_value fv
;
453 struct hwivec_def hwiv
;
454 struct const_poly_int_def cpi
;
455 } GTY ((special ("rtx_def"), desc ("GET_CODE (&%0)"))) u
;
458 /* A node for constructing singly-linked lists of rtx. */
460 struct GTY(()) rtx_expr_list
: public rtx_def
463 /* No extra fields, but adds invariant: (GET_CODE (X) == EXPR_LIST). */
466 /* Get next in list. */
467 rtx_expr_list
*next () const;
469 /* Get at the underlying rtx. */
470 rtx
element () const;
476 is_a_helper
<rtx_expr_list
*>::test (rtx rt
)
478 return rt
->code
== EXPR_LIST
;
481 struct GTY(()) rtx_insn_list
: public rtx_def
484 /* No extra fields, but adds invariant: (GET_CODE (X) == INSN_LIST).
486 This is an instance of:
488 DEF_RTL_EXPR(INSN_LIST, "insn_list", "ue", RTX_EXTRA)
490 i.e. a node for constructing singly-linked lists of rtx_insn *, where
491 the list is "external" to the insn (as opposed to the doubly-linked
492 list embedded within rtx_insn itself). */
495 /* Get next in list. */
496 rtx_insn_list
*next () const;
498 /* Get at the underlying instruction. */
499 rtx_insn
*insn () const;
506 is_a_helper
<rtx_insn_list
*>::test (rtx rt
)
508 return rt
->code
== INSN_LIST
;
511 /* A node with invariant GET_CODE (X) == SEQUENCE i.e. a vector of rtx,
512 typically (but not always) of rtx_insn *, used in the late passes. */
514 struct GTY(()) rtx_sequence
: public rtx_def
517 /* No extra fields, but adds invariant: (GET_CODE (X) == SEQUENCE). */
520 /* Get number of elements in sequence. */
523 /* Get i-th element of the sequence. */
524 rtx
element (int index
) const;
526 /* Get i-th element of the sequence, with a checked cast to
528 rtx_insn
*insn (int index
) const;
534 is_a_helper
<rtx_sequence
*>::test (rtx rt
)
536 return rt
->code
== SEQUENCE
;
542 is_a_helper
<const rtx_sequence
*>::test (const_rtx rt
)
544 return rt
->code
== SEQUENCE
;
547 struct GTY(()) rtx_insn
: public rtx_def
550 /* No extra fields, but adds the invariant:
554 || JUMP_TABLE_DATA_P (X)
558 i.e. that we must be able to use the following:
562 i.e. we have an rtx that has an INSN_UID field and can be part of
563 a linked list of insns.
566 /* Returns true if this insn has been deleted. */
568 bool deleted () const { return volatil
; }
570 /* Mark this insn as deleted. */
572 void set_deleted () { volatil
= true; }
574 /* Mark this insn as not deleted. */
576 void set_undeleted () { volatil
= false; }
579 /* Subclasses of rtx_insn. */
581 struct GTY(()) rtx_debug_insn
: public rtx_insn
583 /* No extra fields, but adds the invariant:
584 DEBUG_INSN_P (X) aka (GET_CODE (X) == DEBUG_INSN)
585 i.e. an annotation for tracking variable assignments.
587 This is an instance of:
588 DEF_RTL_EXPR(DEBUG_INSN, "debug_insn", "uuBeLie", RTX_INSN)
592 struct GTY(()) rtx_nonjump_insn
: public rtx_insn
594 /* No extra fields, but adds the invariant:
595 NONJUMP_INSN_P (X) aka (GET_CODE (X) == INSN)
596 i.e an instruction that cannot jump.
598 This is an instance of:
599 DEF_RTL_EXPR(INSN, "insn", "uuBeLie", RTX_INSN)
603 struct GTY(()) rtx_jump_insn
: public rtx_insn
606 /* No extra fields, but adds the invariant:
607 JUMP_P (X) aka (GET_CODE (X) == JUMP_INSN)
608 i.e. an instruction that can possibly jump.
610 This is an instance of:
611 DEF_RTL_EXPR(JUMP_INSN, "jump_insn", "uuBeLie0", RTX_INSN)
614 /* Returns jump target of this instruction. The returned value is not
615 necessarily a code label: it may also be a RETURN or SIMPLE_RETURN
616 expression. Also, when the code label is marked "deleted", it is
617 replaced by a NOTE. In some cases the value is NULL_RTX. */
619 inline rtx
jump_label () const;
621 /* Returns jump target cast to rtx_code_label *. */
623 inline rtx_code_label
*jump_target () const;
625 /* Set jump target. */
627 inline void set_jump_target (rtx_code_label
*);
630 struct GTY(()) rtx_call_insn
: public rtx_insn
632 /* No extra fields, but adds the invariant:
633 CALL_P (X) aka (GET_CODE (X) == CALL_INSN)
634 i.e. an instruction that can possibly call a subroutine
635 but which will not change which instruction comes next
636 in the current function.
638 This is an instance of:
639 DEF_RTL_EXPR(CALL_INSN, "call_insn", "uuBeLiee", RTX_INSN)
643 struct GTY(()) rtx_jump_table_data
: public rtx_insn
645 /* No extra fields, but adds the invariant:
646 JUMP_TABLE_DATA_P (X) aka (GET_CODE (INSN) == JUMP_TABLE_DATA)
647 i.e. a data for a jump table, considered an instruction for
650 This is an instance of:
651 DEF_RTL_EXPR(JUMP_TABLE_DATA, "jump_table_data", "uuBe0000", RTX_INSN)
654 /* This can be either:
656 (a) a table of absolute jumps, in which case PATTERN (this) is an
657 ADDR_VEC with arg 0 a vector of labels, or
659 (b) a table of relative jumps (e.g. for -fPIC), in which case
660 PATTERN (this) is an ADDR_DIFF_VEC, with arg 0 a LABEL_REF and
661 arg 1 the vector of labels.
663 This method gets the underlying vec. */
665 inline rtvec
get_labels () const;
666 inline scalar_int_mode
get_data_mode () const;
669 struct GTY(()) rtx_barrier
: public rtx_insn
671 /* No extra fields, but adds the invariant:
672 BARRIER_P (X) aka (GET_CODE (X) == BARRIER)
673 i.e. a marker that indicates that control will not flow through.
675 This is an instance of:
676 DEF_RTL_EXPR(BARRIER, "barrier", "uu00000", RTX_EXTRA)
680 struct GTY(()) rtx_code_label
: public rtx_insn
682 /* No extra fields, but adds the invariant:
683 LABEL_P (X) aka (GET_CODE (X) == CODE_LABEL)
684 i.e. a label in the assembler.
686 This is an instance of:
687 DEF_RTL_EXPR(CODE_LABEL, "code_label", "uuB00is", RTX_EXTRA)
691 struct GTY(()) rtx_note
: public rtx_insn
693 /* No extra fields, but adds the invariant:
694 NOTE_P(X) aka (GET_CODE (X) == NOTE)
695 i.e. a note about the corresponding source code.
697 This is an instance of:
698 DEF_RTL_EXPR(NOTE, "note", "uuB0ni", RTX_EXTRA)
702 /* The size in bytes of an rtx header (code, mode and flags). */
703 #define RTX_HDR_SIZE offsetof (struct rtx_def, u)
705 /* The size in bytes of an rtx with code CODE. */
706 #define RTX_CODE_SIZE(CODE) rtx_code_size[CODE]
708 #define NULL_RTX (rtx) 0
710 /* The "next" and "previous" RTX, relative to this one. */
712 #define RTX_NEXT(X) (rtx_next[GET_CODE (X)] == 0 ? NULL \
713 : *(rtx *)(((char *)X) + rtx_next[GET_CODE (X)]))
715 /* FIXME: the "NEXT_INSN (PREV_INSN (X)) == X" condition shouldn't be needed.
717 #define RTX_PREV(X) ((INSN_P (X) \
719 || JUMP_TABLE_DATA_P (X) \
722 && PREV_INSN (as_a <rtx_insn *> (X)) != NULL \
723 && NEXT_INSN (PREV_INSN (as_a <rtx_insn *> (X))) == X \
724 ? PREV_INSN (as_a <rtx_insn *> (X)) : NULL)
726 /* Define macros to access the `code' field of the rtx. */
728 #define GET_CODE(RTX) ((enum rtx_code) (RTX)->code)
729 #define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE))
731 #define GET_MODE(RTX) ((machine_mode) (RTX)->mode)
732 #define PUT_MODE_RAW(RTX, MODE) ((RTX)->mode = (MODE))
734 /* RTL vector. These appear inside RTX's when there is a need
735 for a variable number of things. The principle use is inside
736 PARALLEL expressions. */
738 struct GTY(()) rtvec_def
{
739 int num_elem
; /* number of elements */
740 rtx
GTY ((length ("%h.num_elem"))) elem
[1];
743 #define NULL_RTVEC (rtvec) 0
745 #define GET_NUM_ELEM(RTVEC) ((RTVEC)->num_elem)
746 #define PUT_NUM_ELEM(RTVEC, NUM) ((RTVEC)->num_elem = (NUM))
748 /* Predicate yielding nonzero iff X is an rtx for a register. */
749 #define REG_P(X) (GET_CODE (X) == REG)
751 /* Predicate yielding nonzero iff X is an rtx for a memory location. */
752 #define MEM_P(X) (GET_CODE (X) == MEM)
754 #if TARGET_SUPPORTS_WIDE_INT
756 /* Match CONST_*s that can represent compile-time constant integers. */
757 #define CASE_CONST_SCALAR_INT \
761 /* Match CONST_*s for which pointer equality corresponds to value
763 #define CASE_CONST_UNIQUE \
765 case CONST_WIDE_INT: \
766 case CONST_POLY_INT: \
770 /* Match all CONST_* rtxes. */
771 #define CASE_CONST_ANY \
773 case CONST_WIDE_INT: \
774 case CONST_POLY_INT: \
781 /* Match CONST_*s that can represent compile-time constant integers. */
782 #define CASE_CONST_SCALAR_INT \
786 /* Match CONST_*s for which pointer equality corresponds to value
788 #define CASE_CONST_UNIQUE \
793 /* Match all CONST_* rtxes. */
794 #define CASE_CONST_ANY \
801 /* Predicate yielding nonzero iff X is an rtx for a constant integer. */
802 #define CONST_INT_P(X) (GET_CODE (X) == CONST_INT)
804 /* Predicate yielding nonzero iff X is an rtx for a constant integer. */
805 #define CONST_WIDE_INT_P(X) (GET_CODE (X) == CONST_WIDE_INT)
807 /* Predicate yielding nonzero iff X is an rtx for a polynomial constant
809 #define CONST_POLY_INT_P(X) \
810 (NUM_POLY_INT_COEFFS > 1 && GET_CODE (X) == CONST_POLY_INT)
812 /* Predicate yielding nonzero iff X is an rtx for a constant fixed-point. */
813 #define CONST_FIXED_P(X) (GET_CODE (X) == CONST_FIXED)
815 /* Predicate yielding true iff X is an rtx for a double-int
816 or floating point constant. */
817 #define CONST_DOUBLE_P(X) (GET_CODE (X) == CONST_DOUBLE)
819 /* Predicate yielding true iff X is an rtx for a double-int. */
820 #define CONST_DOUBLE_AS_INT_P(X) \
821 (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == VOIDmode)
823 /* Predicate yielding true iff X is an rtx for a integer const. */
824 #if TARGET_SUPPORTS_WIDE_INT
825 #define CONST_SCALAR_INT_P(X) \
826 (CONST_INT_P (X) || CONST_WIDE_INT_P (X))
828 #define CONST_SCALAR_INT_P(X) \
829 (CONST_INT_P (X) || CONST_DOUBLE_AS_INT_P (X))
832 /* Predicate yielding true iff X is an rtx for a double-int. */
833 #define CONST_DOUBLE_AS_FLOAT_P(X) \
834 (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode)
836 /* Predicate yielding nonzero iff X is an rtx for a constant vector. */
837 #define CONST_VECTOR_P(X) (GET_CODE (X) == CONST_VECTOR)
839 /* Predicate yielding nonzero iff X is a label insn. */
840 #define LABEL_P(X) (GET_CODE (X) == CODE_LABEL)
842 /* Predicate yielding nonzero iff X is a jump insn. */
843 #define JUMP_P(X) (GET_CODE (X) == JUMP_INSN)
845 /* Predicate yielding nonzero iff X is a call insn. */
846 #define CALL_P(X) (GET_CODE (X) == CALL_INSN)
848 /* 1 if RTX is a call_insn for a fake call.
849 CALL_INSN use "used" flag to indicate it's a fake call. */
850 #define FAKE_CALL_P(RTX) \
851 (RTL_FLAG_CHECK1 ("FAKE_CALL_P", (RTX), CALL_INSN)->used)
853 /* Predicate yielding nonzero iff X is an insn that cannot jump. */
854 #define NONJUMP_INSN_P(X) (GET_CODE (X) == INSN)
856 /* Predicate yielding nonzero iff X is a debug note/insn. */
857 #define DEBUG_INSN_P(X) (GET_CODE (X) == DEBUG_INSN)
859 /* Predicate yielding nonzero iff X is an insn that is not a debug insn. */
860 #define NONDEBUG_INSN_P(X) (NONJUMP_INSN_P (X) || JUMP_P (X) || CALL_P (X))
862 /* Nonzero if DEBUG_MARKER_INSN_P may possibly hold. */
863 #define MAY_HAVE_DEBUG_MARKER_INSNS debug_nonbind_markers_p
864 /* Nonzero if DEBUG_BIND_INSN_P may possibly hold. */
865 #define MAY_HAVE_DEBUG_BIND_INSNS flag_var_tracking_assignments
866 /* Nonzero if DEBUG_INSN_P may possibly hold. */
867 #define MAY_HAVE_DEBUG_INSNS \
868 (MAY_HAVE_DEBUG_MARKER_INSNS || MAY_HAVE_DEBUG_BIND_INSNS)
870 /* Predicate yielding nonzero iff X is a real insn. */
871 #define INSN_P(X) (NONDEBUG_INSN_P (X) || DEBUG_INSN_P (X))
873 /* Predicate yielding nonzero iff X is a note insn. */
874 #define NOTE_P(X) (GET_CODE (X) == NOTE)
876 /* Predicate yielding nonzero iff X is a barrier insn. */
877 #define BARRIER_P(X) (GET_CODE (X) == BARRIER)
879 /* Predicate yielding nonzero iff X is a data for a jump table. */
880 #define JUMP_TABLE_DATA_P(INSN) (GET_CODE (INSN) == JUMP_TABLE_DATA)
882 /* Predicate yielding nonzero iff RTX is a subreg. */
883 #define SUBREG_P(RTX) (GET_CODE (RTX) == SUBREG)
885 /* Predicate yielding true iff RTX is a symbol ref. */
886 #define SYMBOL_REF_P(RTX) (GET_CODE (RTX) == SYMBOL_REF)
891 is_a_helper
<rtx_insn
*>::test (rtx rt
)
895 || JUMP_TABLE_DATA_P (rt
)
903 is_a_helper
<const rtx_insn
*>::test (const_rtx rt
)
907 || JUMP_TABLE_DATA_P (rt
)
915 is_a_helper
<rtx_debug_insn
*>::test (rtx rt
)
917 return DEBUG_INSN_P (rt
);
923 is_a_helper
<rtx_nonjump_insn
*>::test (rtx rt
)
925 return NONJUMP_INSN_P (rt
);
931 is_a_helper
<rtx_jump_insn
*>::test (rtx rt
)
939 is_a_helper
<rtx_jump_insn
*>::test (rtx_insn
*insn
)
941 return JUMP_P (insn
);
947 is_a_helper
<rtx_call_insn
*>::test (rtx rt
)
955 is_a_helper
<rtx_call_insn
*>::test (rtx_insn
*insn
)
957 return CALL_P (insn
);
963 is_a_helper
<rtx_jump_table_data
*>::test (rtx rt
)
965 return JUMP_TABLE_DATA_P (rt
);
971 is_a_helper
<rtx_jump_table_data
*>::test (rtx_insn
*insn
)
973 return JUMP_TABLE_DATA_P (insn
);
979 is_a_helper
<rtx_barrier
*>::test (rtx rt
)
981 return BARRIER_P (rt
);
987 is_a_helper
<rtx_code_label
*>::test (rtx rt
)
995 is_a_helper
<rtx_code_label
*>::test (rtx_insn
*insn
)
997 return LABEL_P (insn
);
1003 is_a_helper
<rtx_note
*>::test (rtx rt
)
1011 is_a_helper
<rtx_note
*>::test (rtx_insn
*insn
)
1013 return NOTE_P (insn
);
1016 /* Predicate yielding nonzero iff X is a return or simple_return. */
1017 #define ANY_RETURN_P(X) \
1018 (GET_CODE (X) == RETURN || GET_CODE (X) == SIMPLE_RETURN)
1020 /* 1 if X is a unary operator. */
1022 #define UNARY_P(X) \
1023 (GET_RTX_CLASS (GET_CODE (X)) == RTX_UNARY)
1025 /* 1 if X is a binary operator. */
1027 #define BINARY_P(X) \
1028 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_BINARY_MASK) == RTX_BINARY_RESULT)
1030 /* 1 if X is an arithmetic operator. */
1032 #define ARITHMETIC_P(X) \
1033 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_ARITHMETIC_MASK) \
1034 == RTX_ARITHMETIC_RESULT)
1036 /* 1 if X is an arithmetic operator. */
1038 #define COMMUTATIVE_ARITH_P(X) \
1039 (GET_RTX_CLASS (GET_CODE (X)) == RTX_COMM_ARITH)
1041 /* 1 if X is a commutative arithmetic operator or a comparison operator.
1042 These two are sometimes selected together because it is possible to
1043 swap the two operands. */
1045 #define SWAPPABLE_OPERANDS_P(X) \
1046 ((1 << GET_RTX_CLASS (GET_CODE (X))) \
1047 & ((1 << RTX_COMM_ARITH) | (1 << RTX_COMM_COMPARE) \
1048 | (1 << RTX_COMPARE)))
1050 /* 1 if X is a non-commutative operator. */
1052 #define NON_COMMUTATIVE_P(X) \
1053 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \
1054 == RTX_NON_COMMUTATIVE_RESULT)
1056 /* 1 if X is a commutative operator on integers. */
1058 #define COMMUTATIVE_P(X) \
1059 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \
1060 == RTX_COMMUTATIVE_RESULT)
1062 /* 1 if X is a relational operator. */
1064 #define COMPARISON_P(X) \
1065 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMPARE_MASK) == RTX_COMPARE_RESULT)
1067 /* 1 if X is a constant value that is an integer. */
1069 #define CONSTANT_P(X) \
1070 (GET_RTX_CLASS (GET_CODE (X)) == RTX_CONST_OBJ)
1072 /* 1 if X is a LABEL_REF. */
1073 #define LABEL_REF_P(X) \
1074 (GET_CODE (X) == LABEL_REF)
1076 /* 1 if X can be used to represent an object. */
1077 #define OBJECT_P(X) \
1078 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_OBJ_MASK) == RTX_OBJ_RESULT)
1080 /* General accessor macros for accessing the fields of an rtx. */
1082 #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
1083 /* The bit with a star outside the statement expr and an & inside is
1084 so that N can be evaluated only once. */
1085 #define RTL_CHECK1(RTX, N, C1) __extension__ \
1086 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
1087 const enum rtx_code _code = GET_CODE (_rtx); \
1088 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
1089 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
1091 if (GET_RTX_FORMAT (_code)[_n] != C1) \
1092 rtl_check_failed_type1 (_rtx, _n, C1, __FILE__, __LINE__, \
1094 &_rtx->u.fld[_n]; }))
1096 #define RTL_CHECK2(RTX, N, C1, C2) __extension__ \
1097 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
1098 const enum rtx_code _code = GET_CODE (_rtx); \
1099 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
1100 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
1102 if (GET_RTX_FORMAT (_code)[_n] != C1 \
1103 && GET_RTX_FORMAT (_code)[_n] != C2) \
1104 rtl_check_failed_type2 (_rtx, _n, C1, C2, __FILE__, __LINE__, \
1106 &_rtx->u.fld[_n]; }))
1108 #define RTL_CHECKC1(RTX, N, C) __extension__ \
1109 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
1110 if (GET_CODE (_rtx) != (C)) \
1111 rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
1113 &_rtx->u.fld[_n]; }))
1115 #define RTL_CHECKC2(RTX, N, C1, C2) __extension__ \
1116 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
1117 const enum rtx_code _code = GET_CODE (_rtx); \
1118 if (_code != (C1) && _code != (C2)) \
1119 rtl_check_failed_code2 (_rtx, (C1), (C2), __FILE__, __LINE__, \
1121 &_rtx->u.fld[_n]; }))
1123 #define RTL_CHECKC3(RTX, N, C1, C2, C3) __extension__ \
1124 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
1125 const enum rtx_code _code = GET_CODE (_rtx); \
1126 if (_code != (C1) && _code != (C2) && _code != (C3)) \
1127 rtl_check_failed_code3 (_rtx, (C1), (C2), (C3), __FILE__, \
1128 __LINE__, __FUNCTION__); \
1129 &_rtx->u.fld[_n]; }))
1131 #define RTVEC_ELT(RTVEC, I) __extension__ \
1132 (*({ __typeof (RTVEC) const _rtvec = (RTVEC); const int _i = (I); \
1133 if (_i < 0 || _i >= GET_NUM_ELEM (_rtvec)) \
1134 rtvec_check_failed_bounds (_rtvec, _i, __FILE__, __LINE__, \
1136 &_rtvec->elem[_i]; }))
1138 #define XWINT(RTX, N) __extension__ \
1139 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
1140 const enum rtx_code _code = GET_CODE (_rtx); \
1141 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
1142 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
1144 if (GET_RTX_FORMAT (_code)[_n] != 'w') \
1145 rtl_check_failed_type1 (_rtx, _n, 'w', __FILE__, __LINE__, \
1147 &_rtx->u.hwint[_n]; }))
1149 #define CWI_ELT(RTX, I) __extension__ \
1150 (*({ __typeof (RTX) const _cwi = (RTX); \
1151 int _max = CWI_GET_NUM_ELEM (_cwi); \
1152 const int _i = (I); \
1153 if (_i < 0 || _i >= _max) \
1154 cwi_check_failed_bounds (_cwi, _i, __FILE__, __LINE__, \
1156 &_cwi->u.hwiv.elem[_i]; }))
1158 #define XCWINT(RTX, N, C) __extension__ \
1159 (*({ __typeof (RTX) const _rtx = (RTX); \
1160 if (GET_CODE (_rtx) != (C)) \
1161 rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
1163 &_rtx->u.hwint[N]; }))
1165 #define XCMWINT(RTX, N, C, M) __extension__ \
1166 (*({ __typeof (RTX) const _rtx = (RTX); \
1167 if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) != (M)) \
1168 rtl_check_failed_code_mode (_rtx, (C), (M), false, __FILE__, \
1169 __LINE__, __FUNCTION__); \
1170 &_rtx->u.hwint[N]; }))
1172 #define XCNMPRV(RTX, C, M) __extension__ \
1173 ({ __typeof (RTX) const _rtx = (RTX); \
1174 if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \
1175 rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \
1176 __LINE__, __FUNCTION__); \
1179 #define XCNMPFV(RTX, C, M) __extension__ \
1180 ({ __typeof (RTX) const _rtx = (RTX); \
1181 if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \
1182 rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \
1183 __LINE__, __FUNCTION__); \
1186 #define REG_CHECK(RTX) __extension__ \
1187 ({ __typeof (RTX) const _rtx = (RTX); \
1188 if (GET_CODE (_rtx) != REG) \
1189 rtl_check_failed_code1 (_rtx, REG, __FILE__, __LINE__, \
1193 #define BLOCK_SYMBOL_CHECK(RTX) __extension__ \
1194 ({ __typeof (RTX) const _symbol = (RTX); \
1195 const unsigned int flags = SYMBOL_REF_FLAGS (_symbol); \
1196 if ((flags & SYMBOL_FLAG_HAS_BLOCK_INFO) == 0) \
1197 rtl_check_failed_block_symbol (__FILE__, __LINE__, \
1199 &_symbol->u.block_sym; })
1201 #define HWIVEC_CHECK(RTX,C) __extension__ \
1202 ({ __typeof (RTX) const _symbol = (RTX); \
1203 RTL_CHECKC1 (_symbol, 0, C); \
1204 &_symbol->u.hwiv; })
1206 extern void rtl_check_failed_bounds (const_rtx
, int, const char *, int,
1208 ATTRIBUTE_NORETURN ATTRIBUTE_COLD
;
1209 extern void rtl_check_failed_type1 (const_rtx
, int, int, const char *, int,
1211 ATTRIBUTE_NORETURN ATTRIBUTE_COLD
;
1212 extern void rtl_check_failed_type2 (const_rtx
, int, int, int, const char *,
1214 ATTRIBUTE_NORETURN ATTRIBUTE_COLD
;
1215 extern void rtl_check_failed_code1 (const_rtx
, enum rtx_code
, const char *,
1217 ATTRIBUTE_NORETURN ATTRIBUTE_COLD
;
1218 extern void rtl_check_failed_code2 (const_rtx
, enum rtx_code
, enum rtx_code
,
1219 const char *, int, const char *)
1220 ATTRIBUTE_NORETURN ATTRIBUTE_COLD
;
1221 extern void rtl_check_failed_code3 (const_rtx
, enum rtx_code
, enum rtx_code
,
1222 enum rtx_code
, const char *, int,
1224 ATTRIBUTE_NORETURN ATTRIBUTE_COLD
;
1225 extern void rtl_check_failed_code_mode (const_rtx
, enum rtx_code
, machine_mode
,
1226 bool, const char *, int, const char *)
1227 ATTRIBUTE_NORETURN ATTRIBUTE_COLD
;
1228 extern void rtl_check_failed_block_symbol (const char *, int, const char *)
1229 ATTRIBUTE_NORETURN ATTRIBUTE_COLD
;
1230 extern void cwi_check_failed_bounds (const_rtx
, int, const char *, int,
1232 ATTRIBUTE_NORETURN ATTRIBUTE_COLD
;
1233 extern void rtvec_check_failed_bounds (const_rtvec
, int, const char *, int,
1235 ATTRIBUTE_NORETURN ATTRIBUTE_COLD
;
1237 #else /* not ENABLE_RTL_CHECKING */
1239 #define RTL_CHECK1(RTX, N, C1) ((RTX)->u.fld[N])
1240 #define RTL_CHECK2(RTX, N, C1, C2) ((RTX)->u.fld[N])
1241 #define RTL_CHECKC1(RTX, N, C) ((RTX)->u.fld[N])
1242 #define RTL_CHECKC2(RTX, N, C1, C2) ((RTX)->u.fld[N])
1243 #define RTL_CHECKC3(RTX, N, C1, C2, C3) ((RTX)->u.fld[N])
1244 #define RTVEC_ELT(RTVEC, I) ((RTVEC)->elem[I])
1245 #define XWINT(RTX, N) ((RTX)->u.hwint[N])
1246 #define CWI_ELT(RTX, I) ((RTX)->u.hwiv.elem[I])
1247 #define XCWINT(RTX, N, C) ((RTX)->u.hwint[N])
1248 #define XCMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
1249 #define XCNMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
1250 #define XCNMPRV(RTX, C, M) (&(RTX)->u.rv)
1251 #define XCNMPFV(RTX, C, M) (&(RTX)->u.fv)
1252 #define REG_CHECK(RTX) (&(RTX)->u.reg)
1253 #define BLOCK_SYMBOL_CHECK(RTX) (&(RTX)->u.block_sym)
1254 #define HWIVEC_CHECK(RTX,C) (&(RTX)->u.hwiv)
1258 /* General accessor macros for accessing the flags of an rtx. */
1260 /* Access an individual rtx flag, with no checking of any kind. */
1261 #define RTX_FLAG(RTX, FLAG) ((RTX)->FLAG)
1263 #if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION >= 2007)
1264 #define RTL_FLAG_CHECK1(NAME, RTX, C1) __extension__ \
1265 ({ __typeof (RTX) const _rtx = (RTX); \
1266 if (GET_CODE (_rtx) != C1) \
1267 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1271 #define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) __extension__ \
1272 ({ __typeof (RTX) const _rtx = (RTX); \
1273 if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2) \
1274 rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
1278 #define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) __extension__ \
1279 ({ __typeof (RTX) const _rtx = (RTX); \
1280 if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \
1281 && GET_CODE (_rtx) != C3) \
1282 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1286 #define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) __extension__ \
1287 ({ __typeof (RTX) const _rtx = (RTX); \
1288 if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \
1289 && GET_CODE (_rtx) != C3 && GET_CODE(_rtx) != C4) \
1290 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1294 #define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) __extension__ \
1295 ({ __typeof (RTX) const _rtx = (RTX); \
1296 if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
1297 && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
1298 && GET_CODE (_rtx) != C5) \
1299 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1303 #define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) \
1305 ({ __typeof (RTX) const _rtx = (RTX); \
1306 if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
1307 && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
1308 && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6) \
1309 rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
1313 #define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) \
1315 ({ __typeof (RTX) const _rtx = (RTX); \
1316 if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
1317 && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
1318 && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6 \
1319 && GET_CODE (_rtx) != C7) \
1320 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1324 #define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) \
1326 ({ __typeof (RTX) const _rtx = (RTX); \
1327 if (!INSN_CHAIN_CODE_P (GET_CODE (_rtx))) \
1328 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1332 extern void rtl_check_failed_flag (const char *, const_rtx
, const char *,
1334 ATTRIBUTE_NORETURN ATTRIBUTE_COLD
1337 #else /* not ENABLE_RTL_FLAG_CHECKING */
1339 #define RTL_FLAG_CHECK1(NAME, RTX, C1) (RTX)
1340 #define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) (RTX)
1341 #define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) (RTX)
1342 #define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) (RTX)
1343 #define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) (RTX)
1344 #define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) (RTX)
1345 #define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) (RTX)
1346 #define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) (RTX)
1349 #define XINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rt_int)
1350 #define XUINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rt_uint)
1351 #define XLOC(RTX, N) (RTL_CHECK1 (RTX, N, 'L').rt_loc)
1352 #define XSTR(RTX, N) (RTL_CHECK2 (RTX, N, 's', 'S').rt_str)
1353 #define XEXP(RTX, N) (RTL_CHECK2 (RTX, N, 'e', 'u').rt_rtx)
1354 #define XVEC(RTX, N) (RTL_CHECK2 (RTX, N, 'E', 'V').rt_rtvec)
1355 #define XMODE(RTX, N) (RTL_CHECK1 (RTX, N, 'M').rt_type)
1356 #define XTREE(RTX, N) (RTL_CHECK1 (RTX, N, 't').rt_tree)
1357 #define XBBDEF(RTX, N) (RTL_CHECK1 (RTX, N, 'B').rt_bb)
1358 #define XTMPL(RTX, N) (RTL_CHECK1 (RTX, N, 'T').rt_str)
1359 #define XCFI(RTX, N) (RTL_CHECK1 (RTX, N, 'C').rt_cfi)
1361 #define XVECEXP(RTX, N, M) RTVEC_ELT (XVEC (RTX, N), M)
1362 #define XVECLEN(RTX, N) GET_NUM_ELEM (XVEC (RTX, N))
1364 /* These are like XINT, etc. except that they expect a '0' field instead
1365 of the normal type code. */
1367 #define X0INT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_int)
1368 #define X0UINT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_uint)
1369 #define X0LOC(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_loc)
1370 #define X0STR(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_str)
1371 #define X0EXP(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtx)
1372 #define X0VEC(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtvec)
1373 #define X0MODE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_type)
1374 #define X0TREE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_tree)
1375 #define X0BBDEF(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_bb)
1376 #define X0ADVFLAGS(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_addr_diff_vec_flags)
1377 #define X0CSELIB(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_cselib)
1378 #define X0MEMATTR(RTX, N) (RTL_CHECKC1 (RTX, N, MEM).rt_mem)
1379 #define X0CONSTANT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_constant)
1381 /* Access a '0' field with any type. */
1382 #define X0ANY(RTX, N) RTL_CHECK1 (RTX, N, '0')
1384 #define XCINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_int)
1385 #define XCUINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_uint)
1386 #define XCLOC(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_loc)
1387 #define XCSUBREG(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_subreg)
1388 #define XCSTR(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_str)
1389 #define XCEXP(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtx)
1390 #define XCVEC(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtvec)
1391 #define XCMODE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_type)
1392 #define XCTREE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_tree)
1393 #define XCBBDEF(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_bb)
1394 #define XCCFI(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_cfi)
1395 #define XCCSELIB(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_cselib)
1397 #define XCVECEXP(RTX, N, M, C) RTVEC_ELT (XCVEC (RTX, N, C), M)
1398 #define XCVECLEN(RTX, N, C) GET_NUM_ELEM (XCVEC (RTX, N, C))
1400 #define XC2EXP(RTX, N, C1, C2) (RTL_CHECKC2 (RTX, N, C1, C2).rt_rtx)
1401 #define XC3EXP(RTX, N, C1, C2, C3) (RTL_CHECKC3 (RTX, N, C1, C2, C3).rt_rtx)
1404 /* Methods of rtx_expr_list. */
1406 inline rtx_expr_list
*rtx_expr_list::next () const
1408 rtx tmp
= XEXP (this, 1);
1409 return safe_as_a
<rtx_expr_list
*> (tmp
);
1412 inline rtx
rtx_expr_list::element () const
1414 return XEXP (this, 0);
1417 /* Methods of rtx_insn_list. */
1419 inline rtx_insn_list
*rtx_insn_list::next () const
1421 rtx tmp
= XEXP (this, 1);
1422 return safe_as_a
<rtx_insn_list
*> (tmp
);
1425 inline rtx_insn
*rtx_insn_list::insn () const
1427 rtx tmp
= XEXP (this, 0);
1428 return safe_as_a
<rtx_insn
*> (tmp
);
1431 /* Methods of rtx_sequence. */
1433 inline int rtx_sequence::len () const
1435 return XVECLEN (this, 0);
1438 inline rtx
rtx_sequence::element (int index
) const
1440 return XVECEXP (this, 0, index
);
1443 inline rtx_insn
*rtx_sequence::insn (int index
) const
1445 return as_a
<rtx_insn
*> (XVECEXP (this, 0, index
));
1448 /* ACCESS MACROS for particular fields of insns. */
1450 /* Holds a unique number for each insn.
1451 These are not necessarily sequentially increasing. */
1452 inline int INSN_UID (const_rtx insn
)
1454 return RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID",
1455 (insn
))->u2
.insn_uid
;
1457 inline int& INSN_UID (rtx insn
)
1459 return RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID",
1460 (insn
))->u2
.insn_uid
;
1463 /* Chain insns together in sequence. */
1465 /* For now these are split in two: an rvalue form:
1468 SET_NEXT_INSN/SET_PREV_INSN. */
1470 inline rtx_insn
*PREV_INSN (const rtx_insn
*insn
)
1472 rtx prev
= XEXP (insn
, 0);
1473 return safe_as_a
<rtx_insn
*> (prev
);
1476 inline rtx
& SET_PREV_INSN (rtx_insn
*insn
)
1478 return XEXP (insn
, 0);
1481 inline rtx_insn
*NEXT_INSN (const rtx_insn
*insn
)
1483 rtx next
= XEXP (insn
, 1);
1484 return safe_as_a
<rtx_insn
*> (next
);
1487 inline rtx
& SET_NEXT_INSN (rtx_insn
*insn
)
1489 return XEXP (insn
, 1);
1492 inline basic_block
BLOCK_FOR_INSN (const_rtx insn
)
1494 return XBBDEF (insn
, 2);
1497 inline basic_block
& BLOCK_FOR_INSN (rtx insn
)
1499 return XBBDEF (insn
, 2);
1502 inline void set_block_for_insn (rtx_insn
*insn
, basic_block bb
)
1504 BLOCK_FOR_INSN (insn
) = bb
;
1507 /* The body of an insn. */
1508 inline rtx
PATTERN (const_rtx insn
)
1510 return XEXP (insn
, 3);
1513 inline rtx
& PATTERN (rtx insn
)
1515 return XEXP (insn
, 3);
1518 inline location_t
INSN_LOCATION (const rtx_insn
*insn
)
1520 return XLOC (insn
, 4);
1523 inline location_t
& INSN_LOCATION (rtx_insn
*insn
)
1525 return XLOC (insn
, 4);
1528 inline bool INSN_HAS_LOCATION (const rtx_insn
*insn
)
1530 return LOCATION_LOCUS (INSN_LOCATION (insn
)) != UNKNOWN_LOCATION
;
1533 /* LOCATION of an RTX if relevant. */
1534 #define RTL_LOCATION(X) (INSN_P (X) ? \
1535 INSN_LOCATION (as_a <rtx_insn *> (X)) \
1538 /* Code number of instruction, from when it was recognized.
1539 -1 means this instruction has not been recognized yet. */
1540 #define INSN_CODE(INSN) XINT (INSN, 5)
1542 inline rtvec
rtx_jump_table_data::get_labels () const
1544 rtx pat
= PATTERN (this);
1545 if (GET_CODE (pat
) == ADDR_VEC
)
1546 return XVEC (pat
, 0);
1548 return XVEC (pat
, 1); /* presumably an ADDR_DIFF_VEC */
1551 /* Return the mode of the data in the table, which is always a scalar
1554 inline scalar_int_mode
1555 rtx_jump_table_data::get_data_mode () const
1557 return as_a
<scalar_int_mode
> (GET_MODE (PATTERN (this)));
1560 /* If LABEL is followed by a jump table, return the table, otherwise
1563 inline rtx_jump_table_data
*
1564 jump_table_for_label (const rtx_code_label
*label
)
1566 return safe_dyn_cast
<rtx_jump_table_data
*> (NEXT_INSN (label
));
1569 #define RTX_FRAME_RELATED_P(RTX) \
1570 (RTL_FLAG_CHECK6 ("RTX_FRAME_RELATED_P", (RTX), DEBUG_INSN, INSN, \
1571 CALL_INSN, JUMP_INSN, BARRIER, SET)->frame_related)
1573 /* 1 if JUMP RTX is a crossing jump. */
1574 #define CROSSING_JUMP_P(RTX) \
1575 (RTL_FLAG_CHECK1 ("CROSSING_JUMP_P", (RTX), JUMP_INSN)->jump)
1577 /* 1 if RTX is a call to a const function. Built from ECF_CONST and
1579 #define RTL_CONST_CALL_P(RTX) \
1580 (RTL_FLAG_CHECK1 ("RTL_CONST_CALL_P", (RTX), CALL_INSN)->unchanging)
1582 /* 1 if RTX is a call to a pure function. Built from ECF_PURE and
1584 #define RTL_PURE_CALL_P(RTX) \
1585 (RTL_FLAG_CHECK1 ("RTL_PURE_CALL_P", (RTX), CALL_INSN)->return_val)
1587 /* 1 if RTX is a call to a const or pure function. */
1588 #define RTL_CONST_OR_PURE_CALL_P(RTX) \
1589 (RTL_CONST_CALL_P (RTX) || RTL_PURE_CALL_P (RTX))
1591 /* 1 if RTX is a call to a looping const or pure function. Built from
1592 ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P. */
1593 #define RTL_LOOPING_CONST_OR_PURE_CALL_P(RTX) \
1594 (RTL_FLAG_CHECK1 ("CONST_OR_PURE_CALL_P", (RTX), CALL_INSN)->call)
1596 /* 1 if RTX is a call_insn for a sibling call. */
1597 #define SIBLING_CALL_P(RTX) \
1598 (RTL_FLAG_CHECK1 ("SIBLING_CALL_P", (RTX), CALL_INSN)->jump)
1600 /* 1 if RTX is a jump_insn, call_insn, or insn that is an annulling branch. */
1601 #define INSN_ANNULLED_BRANCH_P(RTX) \
1602 (RTL_FLAG_CHECK1 ("INSN_ANNULLED_BRANCH_P", (RTX), JUMP_INSN)->unchanging)
1604 /* 1 if RTX is an insn in a delay slot and is from the target of the branch.
1605 If the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be
1606 executed if the branch is taken. For annulled branches with this bit
1607 clear, the insn should be executed only if the branch is not taken. */
1608 #define INSN_FROM_TARGET_P(RTX) \
1609 (RTL_FLAG_CHECK3 ("INSN_FROM_TARGET_P", (RTX), INSN, JUMP_INSN, \
1610 CALL_INSN)->in_struct)
1612 /* In an ADDR_DIFF_VEC, the flags for RTX for use by branch shortening.
1613 See the comments for ADDR_DIFF_VEC in rtl.def. */
1614 #define ADDR_DIFF_VEC_FLAGS(RTX) X0ADVFLAGS (RTX, 4)
1616 /* In a VALUE, the value cselib has assigned to RTX.
1617 This is a "struct cselib_val", see cselib.h. */
1618 #define CSELIB_VAL_PTR(RTX) X0CSELIB (RTX, 0)
1620 /* Holds a list of notes on what this insn does to various REGs.
1621 It is a chain of EXPR_LIST rtx's, where the second operand is the
1622 chain pointer and the first operand is the REG being described.
1623 The mode field of the EXPR_LIST contains not a real machine mode
1624 but a value from enum reg_note. */
1625 #define REG_NOTES(INSN) XEXP(INSN, 6)
1627 /* In an ENTRY_VALUE this is the DECL_INCOMING_RTL of the argument in
1629 #define ENTRY_VALUE_EXP(RTX) (RTL_CHECKC1 (RTX, 0, ENTRY_VALUE).rt_rtx)
1633 #define DEF_REG_NOTE(NAME) NAME,
1634 #include "reg-notes.def"
1639 /* Define macros to extract and insert the reg-note kind in an EXPR_LIST. */
1640 #define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK))
1641 #define PUT_REG_NOTE_KIND(LINK, KIND) \
1642 PUT_MODE_RAW (LINK, (machine_mode) (KIND))
1644 /* Names for REG_NOTE's in EXPR_LIST insn's. */
1646 extern const char * const reg_note_name
[];
1647 #define GET_REG_NOTE_NAME(MODE) (reg_note_name[(int) (MODE)])
1649 /* This field is only present on CALL_INSNs. It holds a chain of EXPR_LIST of
1650 USE, CLOBBER and SET expressions.
1651 USE expressions list the registers filled with arguments that
1652 are passed to the function.
1653 CLOBBER expressions document the registers explicitly clobbered
1655 SET expressions say that the return value of the call (the SET_DEST)
1656 is equivalent to a value available before the call (the SET_SRC).
1657 This kind of SET is used when the return value is predictable in
1658 advance. It is purely an optimisation hint; unlike USEs and CLOBBERs,
1659 it does not affect register liveness.
1661 Pseudo registers cannot be mentioned in this list. */
1662 #define CALL_INSN_FUNCTION_USAGE(INSN) XEXP(INSN, 7)
1664 /* The label-number of a code-label. The assembler label
1665 is made from `L' and the label-number printed in decimal.
1666 Label numbers are unique in a compilation. */
1667 #define CODE_LABEL_NUMBER(INSN) XINT (INSN, 5)
1669 /* In a NOTE that is a line number, this is a string for the file name that the
1670 line is in. We use the same field to record block numbers temporarily in
1671 NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes. (We avoid lots of casts
1672 between ints and pointers if we use a different macro for the block number.)
1676 #define NOTE_DATA(INSN) RTL_CHECKC1 (INSN, 3, NOTE)
1677 #define NOTE_DELETED_LABEL_NAME(INSN) XCSTR (INSN, 3, NOTE)
1678 #define SET_INSN_DELETED(INSN) set_insn_deleted (INSN);
1679 #define NOTE_BLOCK(INSN) XCTREE (INSN, 3, NOTE)
1680 #define NOTE_EH_HANDLER(INSN) XCINT (INSN, 3, NOTE)
1681 #define NOTE_BASIC_BLOCK(INSN) XCBBDEF (INSN, 3, NOTE)
1682 #define NOTE_VAR_LOCATION(INSN) XCEXP (INSN, 3, NOTE)
1683 #define NOTE_MARKER_LOCATION(INSN) XCLOC (INSN, 3, NOTE)
1684 #define NOTE_CFI(INSN) XCCFI (INSN, 3, NOTE)
1685 #define NOTE_LABEL_NUMBER(INSN) XCINT (INSN, 3, NOTE)
1687 /* In a NOTE that is a line number, this is the line number.
1688 Other kinds of NOTEs are identified by negative numbers here. */
1689 #define NOTE_KIND(INSN) XCINT (INSN, 4, NOTE)
1691 /* Nonzero if INSN is a note marking the beginning of a basic block. */
1692 #define NOTE_INSN_BASIC_BLOCK_P(INSN) \
1693 (NOTE_P (INSN) && NOTE_KIND (INSN) == NOTE_INSN_BASIC_BLOCK)
1695 /* Nonzero if INSN is a debug nonbind marker note,
1696 for which NOTE_MARKER_LOCATION can be used. */
1697 #define NOTE_MARKER_P(INSN) \
1699 (NOTE_KIND (INSN) == NOTE_INSN_BEGIN_STMT \
1700 || NOTE_KIND (INSN) == NOTE_INSN_INLINE_ENTRY))
1702 /* Variable declaration and the location of a variable. */
1703 #define PAT_VAR_LOCATION_DECL(PAT) (XCTREE ((PAT), 0, VAR_LOCATION))
1704 #define PAT_VAR_LOCATION_LOC(PAT) (XCEXP ((PAT), 1, VAR_LOCATION))
1706 /* Initialization status of the variable in the location. Status
1707 can be unknown, uninitialized or initialized. See enumeration
1709 #define PAT_VAR_LOCATION_STATUS(PAT) \
1710 (RTL_FLAG_CHECK1 ("PAT_VAR_LOCATION_STATUS", PAT, VAR_LOCATION) \
1711 ->u2.var_location_status)
1713 /* Accessors for a NOTE_INSN_VAR_LOCATION. */
1714 #define NOTE_VAR_LOCATION_DECL(NOTE) \
1715 PAT_VAR_LOCATION_DECL (NOTE_VAR_LOCATION (NOTE))
1716 #define NOTE_VAR_LOCATION_LOC(NOTE) \
1717 PAT_VAR_LOCATION_LOC (NOTE_VAR_LOCATION (NOTE))
1718 #define NOTE_VAR_LOCATION_STATUS(NOTE) \
1719 PAT_VAR_LOCATION_STATUS (NOTE_VAR_LOCATION (NOTE))
1721 /* Evaluate to TRUE if INSN is a debug insn that denotes a variable
1722 location/value tracking annotation. */
1723 #define DEBUG_BIND_INSN_P(INSN) \
1724 (DEBUG_INSN_P (INSN) \
1725 && (GET_CODE (PATTERN (INSN)) \
1727 /* Evaluate to TRUE if INSN is a debug insn that denotes a program
1728 source location marker. */
1729 #define DEBUG_MARKER_INSN_P(INSN) \
1730 (DEBUG_INSN_P (INSN) \
1731 && (GET_CODE (PATTERN (INSN)) \
1733 /* Evaluate to the marker kind. */
1734 #define INSN_DEBUG_MARKER_KIND(INSN) \
1735 (GET_CODE (PATTERN (INSN)) == DEBUG_MARKER \
1736 ? (GET_MODE (PATTERN (INSN)) == VOIDmode \
1737 ? NOTE_INSN_BEGIN_STMT \
1738 : GET_MODE (PATTERN (INSN)) == BLKmode \
1739 ? NOTE_INSN_INLINE_ENTRY \
1740 : (enum insn_note)-1) \
1741 : (enum insn_note)-1)
1742 /* Create patterns for debug markers. These and the above abstract
1743 the representation, so that it's easier to get rid of the abuse of
1744 the mode to hold the marker kind. Other marker types are
1745 envisioned, so a single bit flag won't do; maybe separate RTL codes
1746 wouldn't be a problem. */
1747 #define GEN_RTX_DEBUG_MARKER_BEGIN_STMT_PAT() \
1748 gen_rtx_DEBUG_MARKER (VOIDmode)
1749 #define GEN_RTX_DEBUG_MARKER_INLINE_ENTRY_PAT() \
1750 gen_rtx_DEBUG_MARKER (BLKmode)
1752 /* The VAR_LOCATION rtx in a DEBUG_INSN. */
1753 #define INSN_VAR_LOCATION(INSN) \
1754 (RTL_FLAG_CHECK1 ("INSN_VAR_LOCATION", PATTERN (INSN), VAR_LOCATION))
1755 /* A pointer to the VAR_LOCATION rtx in a DEBUG_INSN. */
1756 #define INSN_VAR_LOCATION_PTR(INSN) \
1759 /* Accessors for a tree-expanded var location debug insn. */
1760 #define INSN_VAR_LOCATION_DECL(INSN) \
1761 PAT_VAR_LOCATION_DECL (INSN_VAR_LOCATION (INSN))
1762 #define INSN_VAR_LOCATION_LOC(INSN) \
1763 PAT_VAR_LOCATION_LOC (INSN_VAR_LOCATION (INSN))
1764 #define INSN_VAR_LOCATION_STATUS(INSN) \
1765 PAT_VAR_LOCATION_STATUS (INSN_VAR_LOCATION (INSN))
1767 /* Expand to the RTL that denotes an unknown variable location in a
1769 #define gen_rtx_UNKNOWN_VAR_LOC() (gen_rtx_CLOBBER (VOIDmode, const0_rtx))
1771 /* Determine whether X is such an unknown location. */
1772 #define VAR_LOC_UNKNOWN_P(X) \
1773 (GET_CODE (X) == CLOBBER && XEXP ((X), 0) == const0_rtx)
1775 /* 1 if RTX is emitted after a call, but it should take effect before
1776 the call returns. */
1777 #define NOTE_DURING_CALL_P(RTX) \
1778 (RTL_FLAG_CHECK1 ("NOTE_VAR_LOCATION_DURING_CALL_P", (RTX), NOTE)->call)
1780 /* DEBUG_EXPR_DECL corresponding to a DEBUG_EXPR RTX. */
1781 #define DEBUG_EXPR_TREE_DECL(RTX) XCTREE (RTX, 0, DEBUG_EXPR)
1783 /* VAR_DECL/PARM_DECL DEBUG_IMPLICIT_PTR takes address of. */
1784 #define DEBUG_IMPLICIT_PTR_DECL(RTX) XCTREE (RTX, 0, DEBUG_IMPLICIT_PTR)
1786 /* PARM_DECL DEBUG_PARAMETER_REF references. */
1787 #define DEBUG_PARAMETER_REF_DECL(RTX) XCTREE (RTX, 0, DEBUG_PARAMETER_REF)
1789 /* Codes that appear in the NOTE_KIND field for kinds of notes
1790 that are not line numbers. These codes are all negative.
1792 Notice that we do not try to use zero here for any of
1793 the special note codes because sometimes the source line
1794 actually can be zero! This happens (for example) when we
1795 are generating code for the per-translation-unit constructor
1796 and destructor routines for some C++ translation unit. */
1800 #define DEF_INSN_NOTE(NAME) NAME,
1801 #include "insn-notes.def"
1802 #undef DEF_INSN_NOTE
1807 /* Names for NOTE insn's other than line numbers. */
1809 extern const char * const note_insn_name
[NOTE_INSN_MAX
];
1810 #define GET_NOTE_INSN_NAME(NOTE_CODE) \
1811 (note_insn_name[(NOTE_CODE)])
1813 /* The name of a label, in case it corresponds to an explicit label
1814 in the input source code. */
1815 #define LABEL_NAME(RTX) XCSTR (RTX, 6, CODE_LABEL)
1817 /* In jump.cc, each label contains a count of the number
1818 of LABEL_REFs that point at it, so unused labels can be deleted. */
1819 #define LABEL_NUSES(RTX) XCINT (RTX, 4, CODE_LABEL)
1821 /* Labels carry a two-bit field composed of the ->jump and ->call
1822 bits. This field indicates whether the label is an alternate
1823 entry point, and if so, what kind. */
1826 LABEL_NORMAL
= 0, /* ordinary label */
1827 LABEL_STATIC_ENTRY
, /* alternate entry point, not exported */
1828 LABEL_GLOBAL_ENTRY
, /* alternate entry point, exported */
1829 LABEL_WEAK_ENTRY
/* alternate entry point, exported as weak symbol */
1832 #if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION > 2007)
1834 /* Retrieve the kind of LABEL. */
1835 #define LABEL_KIND(LABEL) __extension__ \
1836 ({ __typeof (LABEL) const _label = (LABEL); \
1837 if (! LABEL_P (_label)) \
1838 rtl_check_failed_flag ("LABEL_KIND", _label, __FILE__, __LINE__, \
1840 (enum label_kind) ((_label->jump << 1) | _label->call); })
1842 /* Set the kind of LABEL. */
1843 #define SET_LABEL_KIND(LABEL, KIND) do { \
1844 __typeof (LABEL) const _label = (LABEL); \
1845 const unsigned int _kind = (KIND); \
1846 if (! LABEL_P (_label)) \
1847 rtl_check_failed_flag ("SET_LABEL_KIND", _label, __FILE__, __LINE__, \
1849 _label->jump = ((_kind >> 1) & 1); \
1850 _label->call = (_kind & 1); \
1855 /* Retrieve the kind of LABEL. */
1856 #define LABEL_KIND(LABEL) \
1857 ((enum label_kind) (((LABEL)->jump << 1) | (LABEL)->call))
1859 /* Set the kind of LABEL. */
1860 #define SET_LABEL_KIND(LABEL, KIND) do { \
1861 rtx const _label = (LABEL); \
1862 const unsigned int _kind = (KIND); \
1863 _label->jump = ((_kind >> 1) & 1); \
1864 _label->call = (_kind & 1); \
1867 #endif /* rtl flag checking */
1869 #define LABEL_ALT_ENTRY_P(LABEL) (LABEL_KIND (LABEL) != LABEL_NORMAL)
1871 /* In jump.cc, each JUMP_INSN can point to a label that it can jump to,
1872 so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
1873 be decremented and possibly the label can be deleted. */
1874 #define JUMP_LABEL(INSN) XCEXP (INSN, 7, JUMP_INSN)
1876 inline rtx_insn
*JUMP_LABEL_AS_INSN (const rtx_insn
*insn
)
1878 return safe_as_a
<rtx_insn
*> (JUMP_LABEL (insn
));
1881 /* Methods of rtx_jump_insn. */
1883 inline rtx
rtx_jump_insn::jump_label () const
1885 return JUMP_LABEL (this);
1888 inline rtx_code_label
*rtx_jump_insn::jump_target () const
1890 return safe_as_a
<rtx_code_label
*> (JUMP_LABEL (this));
1893 inline void rtx_jump_insn::set_jump_target (rtx_code_label
*target
)
1895 JUMP_LABEL (this) = target
;
1898 /* Once basic blocks are found, each CODE_LABEL starts a chain that
1899 goes through all the LABEL_REFs that jump to that label. The chain
1900 eventually winds up at the CODE_LABEL: it is circular. */
1901 #define LABEL_REFS(LABEL) XCEXP (LABEL, 3, CODE_LABEL)
1903 /* Get the label that a LABEL_REF references. */
1905 label_ref_label (const_rtx ref
)
1907 return as_a
<rtx_insn
*> (XCEXP (ref
, 0, LABEL_REF
));
1910 /* Set the label that LABEL_REF ref refers to. */
1913 set_label_ref_label (rtx ref
, rtx_insn
*label
)
1915 XCEXP (ref
, 0, LABEL_REF
) = label
;
1918 /* For a REG rtx, REGNO extracts the register number. REGNO can only
1919 be used on RHS. Use SET_REGNO to change the value. */
1920 #define REGNO(RTX) (rhs_regno(RTX))
1921 #define SET_REGNO(RTX, N) (df_ref_change_reg_with_loc (RTX, N))
1923 /* Return the number of consecutive registers in a REG. This is always
1924 1 for pseudo registers and is determined by TARGET_HARD_REGNO_NREGS for
1926 #define REG_NREGS(RTX) (REG_CHECK (RTX)->nregs)
1928 /* ORIGINAL_REGNO holds the number the register originally had; for a
1929 pseudo register turned into a hard reg this will hold the old pseudo
1931 #define ORIGINAL_REGNO(RTX) \
1932 (RTL_FLAG_CHECK1 ("ORIGINAL_REGNO", (RTX), REG)->u2.original_regno)
1934 /* Force the REGNO macro to only be used on the lhs. */
1936 rhs_regno (const_rtx x
)
1938 return REG_CHECK (x
)->regno
;
1941 /* Return the final register in REG X plus one. */
1943 END_REGNO (const_rtx x
)
1945 return REGNO (x
) + REG_NREGS (x
);
1948 /* Change the REGNO and REG_NREGS of REG X to the specified values,
1949 bypassing the df machinery. */
1951 set_regno_raw (rtx x
, unsigned int regno
, unsigned int nregs
)
1953 reg_info
*reg
= REG_CHECK (x
);
1958 /* 1 if RTX is a reg or parallel that is the current function's return
1960 #define REG_FUNCTION_VALUE_P(RTX) \
1961 (RTL_FLAG_CHECK2 ("REG_FUNCTION_VALUE_P", (RTX), REG, PARALLEL)->return_val)
1963 /* 1 if RTX is a reg that corresponds to a variable declared by the user. */
1964 #define REG_USERVAR_P(RTX) \
1965 (RTL_FLAG_CHECK1 ("REG_USERVAR_P", (RTX), REG)->volatil)
1967 /* 1 if RTX is a reg that holds a pointer value. */
1968 #define REG_POINTER(RTX) \
1969 (RTL_FLAG_CHECK1 ("REG_POINTER", (RTX), REG)->frame_related)
1971 /* 1 if RTX is a mem that holds a pointer value. */
1972 #define MEM_POINTER(RTX) \
1973 (RTL_FLAG_CHECK1 ("MEM_POINTER", (RTX), MEM)->frame_related)
1975 /* 1 if the given register REG corresponds to a hard register. */
1976 #define HARD_REGISTER_P(REG) HARD_REGISTER_NUM_P (REGNO (REG))
1978 /* 1 if the given register number REG_NO corresponds to a hard register. */
1979 #define HARD_REGISTER_NUM_P(REG_NO) ((REG_NO) < FIRST_PSEUDO_REGISTER)
1981 /* 1 if the given register REG corresponds to a virtual register. */
1982 #define VIRTUAL_REGISTER_P(REG) VIRTUAL_REGISTER_NUM_P (REGNO (REG))
1984 /* 1 if the given register number REG_NO corresponds to a virtual register. */
1985 #define VIRTUAL_REGISTER_NUM_P(REG_NO) \
1986 IN_RANGE (REG_NO, FIRST_VIRTUAL_REGISTER, LAST_VIRTUAL_REGISTER)
1988 /* For a CONST_INT rtx, INTVAL extracts the integer. */
1989 #define INTVAL(RTX) XCWINT (RTX, 0, CONST_INT)
1990 #define UINTVAL(RTX) ((unsigned HOST_WIDE_INT) INTVAL (RTX))
1992 /* For a CONST_WIDE_INT, CONST_WIDE_INT_NUNITS is the number of
1993 elements actually needed to represent the constant.
1994 CONST_WIDE_INT_ELT gets one of the elements. 0 is the least
1995 significant HOST_WIDE_INT. */
1996 #define CONST_WIDE_INT_VEC(RTX) HWIVEC_CHECK (RTX, CONST_WIDE_INT)
1997 #define CONST_WIDE_INT_NUNITS(RTX) CWI_GET_NUM_ELEM (RTX)
1998 #define CONST_WIDE_INT_ELT(RTX, N) CWI_ELT (RTX, N)
2000 /* For a CONST_POLY_INT, CONST_POLY_INT_COEFFS gives access to the
2001 individual coefficients, in the form of a trailing_wide_ints structure. */
2002 #define CONST_POLY_INT_COEFFS(RTX) \
2003 (RTL_FLAG_CHECK1("CONST_POLY_INT_COEFFS", (RTX), \
2004 CONST_POLY_INT)->u.cpi.coeffs)
2006 /* For a CONST_DOUBLE:
2007 #if TARGET_SUPPORTS_WIDE_INT == 0
2008 For a VOIDmode, there are two integers CONST_DOUBLE_LOW is the
2009 low-order word and ..._HIGH the high-order.
2011 For a float, there is a REAL_VALUE_TYPE structure, and
2012 CONST_DOUBLE_REAL_VALUE(r) is a pointer to it. */
2013 #define CONST_DOUBLE_LOW(r) XCMWINT (r, 0, CONST_DOUBLE, VOIDmode)
2014 #define CONST_DOUBLE_HIGH(r) XCMWINT (r, 1, CONST_DOUBLE, VOIDmode)
2015 #define CONST_DOUBLE_REAL_VALUE(r) \
2016 ((const struct real_value *) XCNMPRV (r, CONST_DOUBLE, VOIDmode))
2018 #define CONST_FIXED_VALUE(r) \
2019 ((const struct fixed_value *) XCNMPFV (r, CONST_FIXED, VOIDmode))
2020 #define CONST_FIXED_VALUE_HIGH(r) \
2021 ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.high))
2022 #define CONST_FIXED_VALUE_LOW(r) \
2023 ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.low))
2025 /* For a CONST_VECTOR, return element #n. */
2026 #define CONST_VECTOR_ELT(RTX, N) const_vector_elt (RTX, N)
2028 /* See rtl.texi for a description of these macros. */
2029 #define CONST_VECTOR_NPATTERNS(RTX) \
2030 (RTL_FLAG_CHECK1 ("CONST_VECTOR_NPATTERNS", (RTX), CONST_VECTOR) \
2031 ->u2.const_vector.npatterns)
2033 #define CONST_VECTOR_NELTS_PER_PATTERN(RTX) \
2034 (RTL_FLAG_CHECK1 ("CONST_VECTOR_NELTS_PER_PATTERN", (RTX), CONST_VECTOR) \
2035 ->u2.const_vector.nelts_per_pattern)
2037 #define CONST_VECTOR_DUPLICATE_P(RTX) \
2038 (CONST_VECTOR_NELTS_PER_PATTERN (RTX) == 1)
2040 #define CONST_VECTOR_STEPPED_P(RTX) \
2041 (CONST_VECTOR_NELTS_PER_PATTERN (RTX) == 3)
2043 #define CONST_VECTOR_ENCODED_ELT(RTX, N) XCVECEXP (RTX, 0, N, CONST_VECTOR)
2045 /* Return the number of elements encoded directly in a CONST_VECTOR. */
2048 const_vector_encoded_nelts (const_rtx x
)
2050 return CONST_VECTOR_NPATTERNS (x
) * CONST_VECTOR_NELTS_PER_PATTERN (x
);
2053 /* For a CONST_VECTOR, return the number of elements in a vector. */
2054 #define CONST_VECTOR_NUNITS(RTX) GET_MODE_NUNITS (GET_MODE (RTX))
2056 /* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of.
2057 SUBREG_BYTE extracts the byte-number. */
2059 #define SUBREG_REG(RTX) XCEXP (RTX, 0, SUBREG)
2060 #define SUBREG_BYTE(RTX) XCSUBREG (RTX, 1, SUBREG)
2063 /* Return the right cost to give to an operation
2064 to make the cost of the corresponding register-to-register instruction
2065 N times that of a fast register-to-register instruction. */
2066 #define COSTS_N_INSNS(N) ((N) * 4)
2068 /* Maximum cost of an rtl expression. This value has the special meaning
2069 not to use an rtx with this cost under any circumstances. */
2070 #define MAX_COST INT_MAX
2072 /* Return true if CODE always has VOIDmode. */
2075 always_void_p (enum rtx_code code
)
2080 /* A structure to hold all available cost information about an rtl
2082 struct full_rtx_costs
2088 /* Initialize a full_rtx_costs structure C to the maximum cost. */
2090 init_costs_to_max (struct full_rtx_costs
*c
)
2092 c
->speed
= MAX_COST
;
2096 /* Initialize a full_rtx_costs structure C to zero cost. */
2098 init_costs_to_zero (struct full_rtx_costs
*c
)
2104 /* Compare two full_rtx_costs structures A and B, returning true
2105 if A < B when optimizing for speed. */
2107 costs_lt_p (struct full_rtx_costs
*a
, struct full_rtx_costs
*b
,
2111 return (a
->speed
< b
->speed
2112 || (a
->speed
== b
->speed
&& a
->size
< b
->size
));
2114 return (a
->size
< b
->size
2115 || (a
->size
== b
->size
&& a
->speed
< b
->speed
));
2118 /* Increase both members of the full_rtx_costs structure C by the
2121 costs_add_n_insns (struct full_rtx_costs
*c
, int n
)
2123 c
->speed
+= COSTS_N_INSNS (n
);
2124 c
->size
+= COSTS_N_INSNS (n
);
2127 /* Describes the shape of a subreg:
2129 inner_mode == the mode of the SUBREG_REG
2130 offset == the SUBREG_BYTE
2131 outer_mode == the mode of the SUBREG itself. */
2132 class subreg_shape
{
2134 subreg_shape (machine_mode
, poly_uint16
, machine_mode
);
2135 bool operator == (const subreg_shape
&) const;
2136 bool operator != (const subreg_shape
&) const;
2137 unsigned HOST_WIDE_INT
unique_id () const;
2139 machine_mode inner_mode
;
2141 machine_mode outer_mode
;
2145 subreg_shape::subreg_shape (machine_mode inner_mode_in
,
2146 poly_uint16 offset_in
,
2147 machine_mode outer_mode_in
)
2148 : inner_mode (inner_mode_in
), offset (offset_in
), outer_mode (outer_mode_in
)
2152 subreg_shape::operator == (const subreg_shape
&other
) const
2154 return (inner_mode
== other
.inner_mode
2155 && known_eq (offset
, other
.offset
)
2156 && outer_mode
== other
.outer_mode
);
2160 subreg_shape::operator != (const subreg_shape
&other
) const
2162 return !operator == (other
);
2165 /* Return an integer that uniquely identifies this shape. Structures
2166 like rtx_def assume that a mode can fit in an 8-bit bitfield and no
2167 current mode is anywhere near being 65536 bytes in size, so the
2168 id comfortably fits in an int. */
2170 inline unsigned HOST_WIDE_INT
2171 subreg_shape::unique_id () const
2173 { STATIC_ASSERT (MAX_MACHINE_MODE
<= (1 << MACHINE_MODE_BITSIZE
)); }
2174 { STATIC_ASSERT (NUM_POLY_INT_COEFFS
<= 3); }
2175 { STATIC_ASSERT (sizeof (offset
.coeffs
[0]) <= 2); }
2176 int res
= (int) inner_mode
+ ((int) outer_mode
<< 8);
2177 for (int i
= 0; i
< NUM_POLY_INT_COEFFS
; ++i
)
2178 res
+= (HOST_WIDE_INT
) offset
.coeffs
[i
] << ((1 + i
) * 16);
2182 /* Return the shape of a SUBREG rtx. */
2185 shape_of_subreg (const_rtx x
)
2187 return subreg_shape (GET_MODE (SUBREG_REG (x
)),
2188 SUBREG_BYTE (x
), GET_MODE (x
));
2191 /* Information about an address. This structure is supposed to be able
2192 to represent all supported target addresses. Please extend it if it
2193 is not yet general enough. */
2194 struct address_info
{
2195 /* The mode of the value being addressed, or VOIDmode if this is
2196 a load-address operation with no known address mode. */
2199 /* The address space. */
2202 /* True if this is an RTX_AUTOINC address. */
2205 /* A pointer to the top-level address. */
2208 /* A pointer to the inner address, after all address mutations
2209 have been stripped from the top-level address. It can be one
2212 - A {PRE,POST}_{INC,DEC} of *BASE. SEGMENT, INDEX and DISP are null.
2214 - A {PRE,POST}_MODIFY of *BASE. In this case either INDEX or DISP
2215 points to the step value, depending on whether the step is variable
2216 or constant respectively. SEGMENT is null.
2218 - A plain sum of the form SEGMENT + BASE + INDEX + DISP,
2219 with null fields evaluating to 0. */
2222 /* Components that make up *INNER. Each one may be null or nonnull.
2223 When nonnull, their meanings are as follows:
2225 - *SEGMENT is the "segment" of memory to which the address refers.
2226 This value is entirely target-specific and is only called a "segment"
2227 because that's its most typical use. It contains exactly one UNSPEC,
2228 pointed to by SEGMENT_TERM. The contents of *SEGMENT do not need
2231 - *BASE is a variable expression representing a base address.
2232 It contains exactly one "term", pointed to by BASE_TERM.
2233 This term can be one of the following:
2235 (1) a REG, or a SUBREG of a REG
2236 (2) an eliminated REG (a PLUS of (1) and a constant)
2237 (3) a MEM, or a SUBREG of a MEM
2240 This term is the one that base_reg_class constrains.
2242 - *INDEX is a variable expression representing an index value.
2243 It may be a scaled expression, such as a MULT. It has exactly
2244 one "term", pointed to by INDEX_TERM. The possible terms are
2245 the same as for BASE. This term is the one that index_reg_class
2248 - *DISP is a constant, possibly mutated. DISP_TERM points to the
2249 unmutated RTX_CONST_OBJ. */
2260 /* In a {PRE,POST}_MODIFY address, this points to a second copy
2261 of BASE_TERM, otherwise it is null. */
2264 /* ADDRESS if this structure describes an address operand, MEM if
2265 it describes a MEM address. */
2266 enum rtx_code addr_outer_code
;
2268 /* If BASE is nonnull, this is the code of the rtx that contains it. */
2269 enum rtx_code base_outer_code
;
2272 /* This is used to bundle an rtx and a mode together so that the pair
2273 can be used with the wi:: routines. If we ever put modes into rtx
2274 integer constants, this should go away and then just pass an rtx in. */
2275 typedef std::pair
<rtx
, machine_mode
> rtx_mode_t
;
2280 struct int_traits
<rtx_mode_t
>
2282 static const enum precision_type precision_type
= VAR_PRECISION
;
2283 static const bool host_dependent_precision
= false;
2284 /* This ought to be true, except for the special case that BImode
2285 is canonicalized to STORE_FLAG_VALUE, which might be 1. */
2286 static const bool is_sign_extended
= false;
2287 static const bool needs_write_val_arg
= false;
2288 static unsigned int get_precision (const rtx_mode_t
&);
2289 static wi::storage_ref
decompose (HOST_WIDE_INT
*, unsigned int,
2290 const rtx_mode_t
&);
2295 wi::int_traits
<rtx_mode_t
>::get_precision (const rtx_mode_t
&x
)
2297 return GET_MODE_PRECISION (as_a
<scalar_mode
> (x
.second
));
2300 inline wi::storage_ref
2301 wi::int_traits
<rtx_mode_t
>::decompose (HOST_WIDE_INT
*,
2302 unsigned int precision
,
2303 const rtx_mode_t
&x
)
2305 gcc_checking_assert (precision
== get_precision (x
));
2306 switch (GET_CODE (x
.first
))
2309 if (precision
< HOST_BITS_PER_WIDE_INT
)
2310 /* Nonzero BImodes are stored as STORE_FLAG_VALUE, which on many
2311 targets is 1 rather than -1. */
2312 gcc_checking_assert (INTVAL (x
.first
)
2313 == sext_hwi (INTVAL (x
.first
), precision
)
2314 || (x
.second
== BImode
&& INTVAL (x
.first
) == 1));
2316 return wi::storage_ref (&INTVAL (x
.first
), 1, precision
);
2318 case CONST_WIDE_INT
:
2319 return wi::storage_ref (&CONST_WIDE_INT_ELT (x
.first
, 0),
2320 CONST_WIDE_INT_NUNITS (x
.first
), precision
);
2322 #if TARGET_SUPPORTS_WIDE_INT == 0
2324 return wi::storage_ref (&CONST_DOUBLE_LOW (x
.first
), 2, precision
);
2334 hwi_with_prec
shwi (HOST_WIDE_INT
, machine_mode mode
);
2335 wide_int
min_value (machine_mode
, signop
);
2336 wide_int
max_value (machine_mode
, signop
);
2339 inline wi::hwi_with_prec
2340 wi::shwi (HOST_WIDE_INT val
, machine_mode mode
)
2342 return shwi (val
, GET_MODE_PRECISION (as_a
<scalar_mode
> (mode
)));
2345 /* Produce the smallest number that is represented in MODE. The precision
2346 is taken from MODE and the sign from SGN. */
2348 wi::min_value (machine_mode mode
, signop sgn
)
2350 return min_value (GET_MODE_PRECISION (as_a
<scalar_mode
> (mode
)), sgn
);
2353 /* Produce the largest number that is represented in MODE. The precision
2354 is taken from MODE and the sign from SGN. */
2356 wi::max_value (machine_mode mode
, signop sgn
)
2358 return max_value (GET_MODE_PRECISION (as_a
<scalar_mode
> (mode
)), sgn
);
2363 typedef poly_int
<NUM_POLY_INT_COEFFS
,
2364 generic_wide_int
<wide_int_ref_storage
<false, false> > >
2365 rtx_to_poly_wide_ref
;
2366 rtx_to_poly_wide_ref
to_poly_wide (const_rtx
, machine_mode
);
2369 /* Return the value of a CONST_POLY_INT in its native precision. */
2371 inline wi::rtx_to_poly_wide_ref
2372 const_poly_int_value (const_rtx x
)
2374 poly_int
<NUM_POLY_INT_COEFFS
, WIDE_INT_REF_FOR (wide_int
)> res
;
2375 for (unsigned int i
= 0; i
< NUM_POLY_INT_COEFFS
; ++i
)
2376 res
.coeffs
[i
] = CONST_POLY_INT_COEFFS (x
)[i
];
2380 /* Return true if X is a scalar integer or a CONST_POLY_INT. The value
2381 can then be extracted using wi::to_poly_wide. */
2384 poly_int_rtx_p (const_rtx x
)
2386 return CONST_SCALAR_INT_P (x
) || CONST_POLY_INT_P (x
);
2389 /* Access X (which satisfies poly_int_rtx_p) as a poly_wide_int.
2390 MODE is the mode of X. */
2392 inline wi::rtx_to_poly_wide_ref
2393 wi::to_poly_wide (const_rtx x
, machine_mode mode
)
2395 if (CONST_POLY_INT_P (x
))
2396 return const_poly_int_value (x
);
2397 return rtx_mode_t (const_cast<rtx
> (x
), mode
);
2400 /* Return the value of X as a poly_int64. */
2403 rtx_to_poly_int64 (const_rtx x
)
2405 if (CONST_POLY_INT_P (x
))
2408 for (unsigned int i
= 0; i
< NUM_POLY_INT_COEFFS
; ++i
)
2409 res
.coeffs
[i
] = CONST_POLY_INT_COEFFS (x
)[i
].to_shwi ();
2415 /* Return true if arbitrary value X is an integer constant that can
2416 be represented as a poly_int64. Store the value in *RES if so,
2417 otherwise leave it unmodified. */
2420 poly_int_rtx_p (const_rtx x
, poly_int64
*res
)
2422 if (CONST_INT_P (x
))
2427 if (CONST_POLY_INT_P (x
))
2429 for (unsigned int i
= 0; i
< NUM_POLY_INT_COEFFS
; ++i
)
2430 if (!wi::fits_shwi_p (CONST_POLY_INT_COEFFS (x
)[i
]))
2432 for (unsigned int i
= 0; i
< NUM_POLY_INT_COEFFS
; ++i
)
2433 res
->coeffs
[i
] = CONST_POLY_INT_COEFFS (x
)[i
].to_shwi ();
2439 extern void init_rtlanal (void);
2440 extern int rtx_cost (rtx
, machine_mode
, enum rtx_code
, int, bool);
2441 extern int address_cost (rtx
, machine_mode
, addr_space_t
, bool);
2442 extern void get_full_rtx_cost (rtx
, machine_mode
, enum rtx_code
, int,
2443 struct full_rtx_costs
*);
2444 extern bool native_encode_rtx (machine_mode
, rtx
, vec
<target_unit
> &,
2445 unsigned int, unsigned int);
2446 extern rtx
native_decode_rtx (machine_mode
, const vec
<target_unit
> &,
2448 extern rtx
native_decode_vector_rtx (machine_mode
, const vec
<target_unit
> &,
2449 unsigned int, unsigned int, unsigned int);
2450 extern poly_uint64
subreg_lsb (const_rtx
);
2451 extern poly_uint64
subreg_size_lsb (poly_uint64
, poly_uint64
, poly_uint64
);
2452 extern poly_uint64
subreg_size_offset_from_lsb (poly_uint64
, poly_uint64
,
2454 extern bool read_modify_subreg_p (const_rtx
);
2456 /* Given a subreg's OUTER_MODE, INNER_MODE, and SUBREG_BYTE, return the
2457 bit offset at which the subreg begins (counting from the least significant
2458 bit of the operand). */
2461 subreg_lsb_1 (machine_mode outer_mode
, machine_mode inner_mode
,
2462 poly_uint64 subreg_byte
)
2464 return subreg_size_lsb (GET_MODE_SIZE (outer_mode
),
2465 GET_MODE_SIZE (inner_mode
), subreg_byte
);
2468 /* Return the subreg byte offset for a subreg whose outer mode is
2469 OUTER_MODE, whose inner mode is INNER_MODE, and where there are
2470 LSB_SHIFT *bits* between the lsb of the outer value and the lsb of
2471 the inner value. This is the inverse of subreg_lsb_1 (which converts
2472 byte offsets to bit shifts). */
2475 subreg_offset_from_lsb (machine_mode outer_mode
,
2476 machine_mode inner_mode
,
2477 poly_uint64 lsb_shift
)
2479 return subreg_size_offset_from_lsb (GET_MODE_SIZE (outer_mode
),
2480 GET_MODE_SIZE (inner_mode
), lsb_shift
);
2483 extern unsigned int subreg_regno_offset (unsigned int, machine_mode
,
2484 poly_uint64
, machine_mode
);
2485 extern bool subreg_offset_representable_p (unsigned int, machine_mode
,
2486 poly_uint64
, machine_mode
);
2487 extern unsigned int subreg_regno (const_rtx
);
2488 extern int simplify_subreg_regno (unsigned int, machine_mode
,
2489 poly_uint64
, machine_mode
);
2490 extern int lowpart_subreg_regno (unsigned int, machine_mode
,
2492 extern unsigned int subreg_nregs (const_rtx
);
2493 extern unsigned int subreg_nregs_with_regno (unsigned int, const_rtx
);
2494 extern unsigned HOST_WIDE_INT
nonzero_bits (const_rtx
, machine_mode
);
2495 extern unsigned int num_sign_bit_copies (const_rtx
, machine_mode
);
2496 extern bool constant_pool_constant_p (rtx
);
2497 extern bool truncated_to_mode (machine_mode
, const_rtx
);
2498 extern int low_bitmask_len (machine_mode
, unsigned HOST_WIDE_INT
);
2499 extern void split_double (rtx
, rtx
*, rtx
*);
2500 extern rtx
*strip_address_mutations (rtx
*, enum rtx_code
* = 0);
2501 extern void decompose_address (struct address_info
*, rtx
*,
2502 machine_mode
, addr_space_t
, enum rtx_code
);
2503 extern void decompose_lea_address (struct address_info
*, rtx
*);
2504 extern void decompose_mem_address (struct address_info
*, rtx
);
2505 extern void update_address (struct address_info
*);
2506 extern HOST_WIDE_INT
get_index_scale (const struct address_info
*);
2507 extern enum rtx_code
get_index_code (const struct address_info
*);
2509 /* 1 if RTX is a subreg containing a reg that is already known to be
2510 sign- or zero-extended from the mode of the subreg to the mode of
2511 the reg. SUBREG_PROMOTED_UNSIGNED_P gives the signedness of the
2514 When used as a LHS, is means that this extension must be done
2515 when assigning to SUBREG_REG. */
2517 #define SUBREG_PROMOTED_VAR_P(RTX) \
2518 (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED", (RTX), SUBREG)->in_struct)
2520 /* Valid for subregs which are SUBREG_PROMOTED_VAR_P(). In that case
2521 this gives the necessary extensions:
2522 0 - signed (SPR_SIGNED)
2523 1 - normal unsigned (SPR_UNSIGNED)
2524 2 - value is both sign and unsign extended for mode
2525 (SPR_SIGNED_AND_UNSIGNED).
2526 -1 - pointer unsigned, which most often can be handled like unsigned
2527 extension, except for generating instructions where we need to
2528 emit special code (ptr_extend insns) on some architectures
2531 const int SRP_POINTER
= -1;
2532 const int SRP_SIGNED
= 0;
2533 const int SRP_UNSIGNED
= 1;
2534 const int SRP_SIGNED_AND_UNSIGNED
= 2;
2536 /* Sets promoted mode for SUBREG_PROMOTED_VAR_P(). */
2537 #define SUBREG_PROMOTED_SET(RTX, VAL) \
2539 rtx const _rtx = RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SET", \
2544 _rtx->volatil = 0; \
2545 _rtx->unchanging = 0; \
2548 _rtx->volatil = 0; \
2549 _rtx->unchanging = 1; \
2551 case SRP_UNSIGNED: \
2552 _rtx->volatil = 1; \
2553 _rtx->unchanging = 0; \
2555 case SRP_SIGNED_AND_UNSIGNED: \
2556 _rtx->volatil = 1; \
2557 _rtx->unchanging = 1; \
2562 /* Gets the value stored in promoted mode for SUBREG_PROMOTED_VAR_P(),
2563 including SRP_SIGNED_AND_UNSIGNED if promoted for
2564 both signed and unsigned. */
2565 #define SUBREG_PROMOTED_GET(RTX) \
2566 (2 * (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_GET", (RTX), SUBREG)->volatil)\
2567 + (RTX)->unchanging - 1)
2569 /* Returns sign of promoted mode for SUBREG_PROMOTED_VAR_P(). */
2570 #define SUBREG_PROMOTED_SIGN(RTX) \
2571 ((RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SIGN", (RTX), SUBREG)->volatil) ? 1\
2572 : (RTX)->unchanging - 1)
2574 /* Predicate to check if RTX of SUBREG_PROMOTED_VAR_P() is promoted
2576 #define SUBREG_PROMOTED_SIGNED_P(RTX) \
2577 (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SIGNED_P", (RTX), SUBREG)->unchanging)
2579 /* Predicate to check if RTX of SUBREG_PROMOTED_VAR_P() is promoted
2580 for UNSIGNED type. */
2581 #define SUBREG_PROMOTED_UNSIGNED_P(RTX) \
2582 (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_P", (RTX), SUBREG)->volatil)
2584 /* Checks if RTX of SUBREG_PROMOTED_VAR_P() is promoted for given SIGN. */
2585 #define SUBREG_CHECK_PROMOTED_SIGN(RTX, SIGN) \
2586 ((SIGN) == SRP_POINTER ? SUBREG_PROMOTED_GET (RTX) == SRP_POINTER \
2587 : (SIGN) == SRP_SIGNED ? SUBREG_PROMOTED_SIGNED_P (RTX) \
2588 : SUBREG_PROMOTED_UNSIGNED_P (RTX))
2590 /* True if the REG is the static chain register for some CALL_INSN. */
2591 #define STATIC_CHAIN_REG_P(RTX) \
2592 (RTL_FLAG_CHECK1 ("STATIC_CHAIN_REG_P", (RTX), REG)->jump)
2594 /* True if the subreg was generated by LRA for reload insns. Such
2595 subregs are valid only during LRA. */
2596 #define LRA_SUBREG_P(RTX) \
2597 (RTL_FLAG_CHECK1 ("LRA_SUBREG_P", (RTX), SUBREG)->jump)
2599 /* Access various components of an ASM_OPERANDS rtx. */
2601 #define ASM_OPERANDS_TEMPLATE(RTX) XCSTR (RTX, 0, ASM_OPERANDS)
2602 #define ASM_OPERANDS_OUTPUT_CONSTRAINT(RTX) XCSTR (RTX, 1, ASM_OPERANDS)
2603 #define ASM_OPERANDS_OUTPUT_IDX(RTX) XCINT (RTX, 2, ASM_OPERANDS)
2604 #define ASM_OPERANDS_INPUT_VEC(RTX) XCVEC (RTX, 3, ASM_OPERANDS)
2605 #define ASM_OPERANDS_INPUT_CONSTRAINT_VEC(RTX) XCVEC (RTX, 4, ASM_OPERANDS)
2606 #define ASM_OPERANDS_INPUT(RTX, N) XCVECEXP (RTX, 3, N, ASM_OPERANDS)
2607 #define ASM_OPERANDS_INPUT_LENGTH(RTX) XCVECLEN (RTX, 3, ASM_OPERANDS)
2608 #define ASM_OPERANDS_INPUT_CONSTRAINT_EXP(RTX, N) \
2609 XCVECEXP (RTX, 4, N, ASM_OPERANDS)
2610 #define ASM_OPERANDS_INPUT_CONSTRAINT(RTX, N) \
2611 XSTR (XCVECEXP (RTX, 4, N, ASM_OPERANDS), 0)
2612 #define ASM_OPERANDS_INPUT_MODE(RTX, N) \
2613 GET_MODE (XCVECEXP (RTX, 4, N, ASM_OPERANDS))
2614 #define ASM_OPERANDS_LABEL_VEC(RTX) XCVEC (RTX, 5, ASM_OPERANDS)
2615 #define ASM_OPERANDS_LABEL_LENGTH(RTX) XCVECLEN (RTX, 5, ASM_OPERANDS)
2616 #define ASM_OPERANDS_LABEL(RTX, N) XCVECEXP (RTX, 5, N, ASM_OPERANDS)
2617 #define ASM_OPERANDS_SOURCE_LOCATION(RTX) XCLOC (RTX, 6, ASM_OPERANDS)
2618 #define ASM_INPUT_SOURCE_LOCATION(RTX) XCLOC (RTX, 1, ASM_INPUT)
2620 /* 1 if RTX is a mem that is statically allocated in read-only memory. */
2621 #define MEM_READONLY_P(RTX) \
2622 (RTL_FLAG_CHECK1 ("MEM_READONLY_P", (RTX), MEM)->unchanging)
2624 /* 1 if RTX is a mem and we should keep the alias set for this mem
2625 unchanged when we access a component. Set to 1, or example, when we
2626 are already in a non-addressable component of an aggregate. */
2627 #define MEM_KEEP_ALIAS_SET_P(RTX) \
2628 (RTL_FLAG_CHECK1 ("MEM_KEEP_ALIAS_SET_P", (RTX), MEM)->jump)
2630 /* 1 if RTX is a mem or asm_operand for a volatile reference. */
2631 #define MEM_VOLATILE_P(RTX) \
2632 (RTL_FLAG_CHECK3 ("MEM_VOLATILE_P", (RTX), MEM, ASM_OPERANDS, \
2633 ASM_INPUT)->volatil)
2635 /* 1 if RTX is a mem that cannot trap. */
2636 #define MEM_NOTRAP_P(RTX) \
2637 (RTL_FLAG_CHECK1 ("MEM_NOTRAP_P", (RTX), MEM)->call)
2639 /* The memory attribute block. We provide access macros for each value
2640 in the block and provide defaults if none specified. */
2641 #define MEM_ATTRS(RTX) X0MEMATTR (RTX, 1)
2643 /* The register attribute block. We provide access macros for each value
2644 in the block and provide defaults if none specified. */
2645 #define REG_ATTRS(RTX) (REG_CHECK (RTX)->attrs)
2647 #ifndef GENERATOR_FILE
2648 /* For a MEM rtx, the alias set. If 0, this MEM is not in any alias
2649 set, and may alias anything. Otherwise, the MEM can only alias
2650 MEMs in a conflicting alias set. This value is set in a
2651 language-dependent manner in the front-end, and should not be
2652 altered in the back-end. These set numbers are tested with
2653 alias_sets_conflict_p. */
2654 #define MEM_ALIAS_SET(RTX) (get_mem_attrs (RTX)->alias)
2656 /* For a MEM rtx, the decl it is known to refer to, if it is known to
2657 refer to part of a DECL. It may also be a COMPONENT_REF. */
2658 #define MEM_EXPR(RTX) (get_mem_attrs (RTX)->expr)
2660 /* For a MEM rtx, true if its MEM_OFFSET is known. */
2661 #define MEM_OFFSET_KNOWN_P(RTX) (get_mem_attrs (RTX)->offset_known_p)
2663 /* For a MEM rtx, the offset from the start of MEM_EXPR. */
2664 #define MEM_OFFSET(RTX) (get_mem_attrs (RTX)->offset)
2666 /* For a MEM rtx, the address space. */
2667 #define MEM_ADDR_SPACE(RTX) (get_mem_attrs (RTX)->addrspace)
2669 /* For a MEM rtx, true if its MEM_SIZE is known. */
2670 #define MEM_SIZE_KNOWN_P(RTX) (get_mem_attrs (RTX)->size_known_p)
2672 /* For a MEM rtx, the size in bytes of the MEM. */
2673 #define MEM_SIZE(RTX) (get_mem_attrs (RTX)->size)
2675 /* For a MEM rtx, the alignment in bits. We can use the alignment of the
2676 mode as a default when STRICT_ALIGNMENT, but not if not. */
2677 #define MEM_ALIGN(RTX) (get_mem_attrs (RTX)->align)
2679 #define MEM_ADDR_SPACE(RTX) ADDR_SPACE_GENERIC
2682 /* For a REG rtx, the decl it is known to refer to, if it is known to
2683 refer to part of a DECL. */
2684 #define REG_EXPR(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->decl)
2686 /* For a REG rtx, the offset from the start of REG_EXPR, if known, as an
2688 #define REG_OFFSET(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->offset)
2690 /* Copy the attributes that apply to memory locations from RHS to LHS. */
2691 #define MEM_COPY_ATTRIBUTES(LHS, RHS) \
2692 (MEM_VOLATILE_P (LHS) = MEM_VOLATILE_P (RHS), \
2693 MEM_NOTRAP_P (LHS) = MEM_NOTRAP_P (RHS), \
2694 MEM_READONLY_P (LHS) = MEM_READONLY_P (RHS), \
2695 MEM_KEEP_ALIAS_SET_P (LHS) = MEM_KEEP_ALIAS_SET_P (RHS), \
2696 MEM_POINTER (LHS) = MEM_POINTER (RHS), \
2697 MEM_ATTRS (LHS) = MEM_ATTRS (RHS))
2699 /* 1 if RTX is a label_ref for a nonlocal label. */
2700 /* Likewise in an expr_list for a REG_LABEL_OPERAND or
2701 REG_LABEL_TARGET note. */
2702 #define LABEL_REF_NONLOCAL_P(RTX) \
2703 (RTL_FLAG_CHECK1 ("LABEL_REF_NONLOCAL_P", (RTX), LABEL_REF)->volatil)
2705 /* 1 if RTX is a code_label that should always be considered to be needed. */
2706 #define LABEL_PRESERVE_P(RTX) \
2707 (RTL_FLAG_CHECK2 ("LABEL_PRESERVE_P", (RTX), CODE_LABEL, NOTE)->in_struct)
2709 /* During sched, 1 if RTX is an insn that must be scheduled together
2710 with the preceding insn. */
2711 #define SCHED_GROUP_P(RTX) \
2712 (RTL_FLAG_CHECK4 ("SCHED_GROUP_P", (RTX), DEBUG_INSN, INSN, \
2713 JUMP_INSN, CALL_INSN)->in_struct)
2715 /* For a SET rtx, SET_DEST is the place that is set
2716 and SET_SRC is the value it is set to. */
2717 #define SET_DEST(RTX) XC2EXP (RTX, 0, SET, CLOBBER)
2718 #define SET_SRC(RTX) XCEXP (RTX, 1, SET)
2719 #define SET_IS_RETURN_P(RTX) \
2720 (RTL_FLAG_CHECK1 ("SET_IS_RETURN_P", (RTX), SET)->jump)
2722 /* For a TRAP_IF rtx, TRAP_CONDITION is an expression. */
2723 #define TRAP_CONDITION(RTX) XCEXP (RTX, 0, TRAP_IF)
2724 #define TRAP_CODE(RTX) XCEXP (RTX, 1, TRAP_IF)
2726 /* For a COND_EXEC rtx, COND_EXEC_TEST is the condition to base
2727 conditionally executing the code on, COND_EXEC_CODE is the code
2728 to execute if the condition is true. */
2729 #define COND_EXEC_TEST(RTX) XCEXP (RTX, 0, COND_EXEC)
2730 #define COND_EXEC_CODE(RTX) XCEXP (RTX, 1, COND_EXEC)
2732 /* 1 if RTX is a symbol_ref that addresses this function's rtl
2734 #define CONSTANT_POOL_ADDRESS_P(RTX) \
2735 (RTL_FLAG_CHECK1 ("CONSTANT_POOL_ADDRESS_P", (RTX), SYMBOL_REF)->unchanging)
2737 /* 1 if RTX is a symbol_ref that addresses a value in the file's
2738 tree constant pool. This information is private to varasm.cc. */
2739 #define TREE_CONSTANT_POOL_ADDRESS_P(RTX) \
2740 (RTL_FLAG_CHECK1 ("TREE_CONSTANT_POOL_ADDRESS_P", \
2741 (RTX), SYMBOL_REF)->frame_related)
2743 /* Used if RTX is a symbol_ref, for machine-specific purposes. */
2744 #define SYMBOL_REF_FLAG(RTX) \
2745 (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAG", (RTX), SYMBOL_REF)->volatil)
2747 /* 1 if RTX is a symbol_ref that has been the library function in
2748 emit_library_call. */
2749 #define SYMBOL_REF_USED(RTX) \
2750 (RTL_FLAG_CHECK1 ("SYMBOL_REF_USED", (RTX), SYMBOL_REF)->used)
2752 /* 1 if RTX is a symbol_ref for a weak symbol. */
2753 #define SYMBOL_REF_WEAK(RTX) \
2754 (RTL_FLAG_CHECK1 ("SYMBOL_REF_WEAK", (RTX), SYMBOL_REF)->return_val)
2756 /* A pointer attached to the SYMBOL_REF; either SYMBOL_REF_DECL or
2757 SYMBOL_REF_CONSTANT. */
2758 #define SYMBOL_REF_DATA(RTX) X0ANY ((RTX), 1)
2760 /* Set RTX's SYMBOL_REF_DECL to DECL. RTX must not be a constant
2762 #define SET_SYMBOL_REF_DECL(RTX, DECL) \
2763 (gcc_assert (!CONSTANT_POOL_ADDRESS_P (RTX)), X0TREE ((RTX), 1) = (DECL))
2765 /* The tree (decl or constant) associated with the symbol, or null. */
2766 #define SYMBOL_REF_DECL(RTX) \
2767 (CONSTANT_POOL_ADDRESS_P (RTX) ? NULL : X0TREE ((RTX), 1))
2769 /* Set RTX's SYMBOL_REF_CONSTANT to C. RTX must be a constant pool symbol. */
2770 #define SET_SYMBOL_REF_CONSTANT(RTX, C) \
2771 (gcc_assert (CONSTANT_POOL_ADDRESS_P (RTX)), X0CONSTANT ((RTX), 1) = (C))
2773 /* The rtx constant pool entry for a symbol, or null. */
2774 #define SYMBOL_REF_CONSTANT(RTX) \
2775 (CONSTANT_POOL_ADDRESS_P (RTX) ? X0CONSTANT ((RTX), 1) : NULL)
2777 /* A set of flags on a symbol_ref that are, in some respects, redundant with
2778 information derivable from the tree decl associated with this symbol.
2779 Except that we build a *lot* of SYMBOL_REFs that aren't associated with a
2780 decl. In some cases this is a bug. But beyond that, it's nice to cache
2781 this information to avoid recomputing it. Finally, this allows space for
2782 the target to store more than one bit of information, as with
2784 #define SYMBOL_REF_FLAGS(RTX) \
2785 (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAGS", (RTX), SYMBOL_REF) \
2786 ->u2.symbol_ref_flags)
2788 /* These flags are common enough to be defined for all targets. They
2789 are computed by the default version of targetm.encode_section_info. */
2791 /* Set if this symbol is a function. */
2792 #define SYMBOL_FLAG_FUNCTION (1 << 0)
2793 #define SYMBOL_REF_FUNCTION_P(RTX) \
2794 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_FUNCTION) != 0)
2795 /* Set if targetm.binds_local_p is true. */
2796 #define SYMBOL_FLAG_LOCAL (1 << 1)
2797 #define SYMBOL_REF_LOCAL_P(RTX) \
2798 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_LOCAL) != 0)
2799 /* Set if targetm.in_small_data_p is true. */
2800 #define SYMBOL_FLAG_SMALL (1 << 2)
2801 #define SYMBOL_REF_SMALL_P(RTX) \
2802 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_SMALL) != 0)
2803 /* The three-bit field at [5:3] is true for TLS variables; use
2804 SYMBOL_REF_TLS_MODEL to extract the field as an enum tls_model. */
2805 #define SYMBOL_FLAG_TLS_SHIFT 3
2806 #define SYMBOL_REF_TLS_MODEL(RTX) \
2807 ((enum tls_model) ((SYMBOL_REF_FLAGS (RTX) >> SYMBOL_FLAG_TLS_SHIFT) & 7))
2808 /* Set if this symbol is not defined in this translation unit. */
2809 #define SYMBOL_FLAG_EXTERNAL (1 << 6)
2810 #define SYMBOL_REF_EXTERNAL_P(RTX) \
2811 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_EXTERNAL) != 0)
2812 /* Set if this symbol has a block_symbol structure associated with it. */
2813 #define SYMBOL_FLAG_HAS_BLOCK_INFO (1 << 7)
2814 #define SYMBOL_REF_HAS_BLOCK_INFO_P(RTX) \
2815 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_HAS_BLOCK_INFO) != 0)
2816 /* Set if this symbol is a section anchor. SYMBOL_REF_ANCHOR_P implies
2817 SYMBOL_REF_HAS_BLOCK_INFO_P. */
2818 #define SYMBOL_FLAG_ANCHOR (1 << 8)
2819 #define SYMBOL_REF_ANCHOR_P(RTX) \
2820 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_ANCHOR) != 0)
2822 /* Subsequent bits are available for the target to use. */
2823 #define SYMBOL_FLAG_MACH_DEP_SHIFT 9
2824 #define SYMBOL_FLAG_MACH_DEP (1 << SYMBOL_FLAG_MACH_DEP_SHIFT)
2826 /* If SYMBOL_REF_HAS_BLOCK_INFO_P (RTX), this is the object_block
2827 structure to which the symbol belongs, or NULL if it has not been
2828 assigned a block. */
2829 #define SYMBOL_REF_BLOCK(RTX) (BLOCK_SYMBOL_CHECK (RTX)->block)
2831 /* If SYMBOL_REF_HAS_BLOCK_INFO_P (RTX), this is the offset of RTX from
2832 the first object in SYMBOL_REF_BLOCK (RTX). The value is negative if
2833 RTX has not yet been assigned to a block, or it has not been given an
2834 offset within that block. */
2835 #define SYMBOL_REF_BLOCK_OFFSET(RTX) (BLOCK_SYMBOL_CHECK (RTX)->offset)
2837 /* True if RTX is flagged to be a scheduling barrier. */
2838 #define PREFETCH_SCHEDULE_BARRIER_P(RTX) \
2839 (RTL_FLAG_CHECK1 ("PREFETCH_SCHEDULE_BARRIER_P", (RTX), PREFETCH)->volatil)
2841 /* Indicate whether the machine has any sort of auto increment addressing.
2842 If not, we can avoid checking for REG_INC notes. */
2844 #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) \
2845 || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT) \
2846 || defined (HAVE_PRE_MODIFY_DISP) || defined (HAVE_POST_MODIFY_DISP) \
2847 || defined (HAVE_PRE_MODIFY_REG) || defined (HAVE_POST_MODIFY_REG))
2848 #define AUTO_INC_DEC 1
2850 #define AUTO_INC_DEC 0
2853 /* Define a macro to look for REG_INC notes,
2854 but save time on machines where they never exist. */
2857 #define FIND_REG_INC_NOTE(INSN, REG) \
2858 ((REG) != NULL_RTX && REG_P ((REG)) \
2859 ? find_regno_note ((INSN), REG_INC, REGNO (REG)) \
2860 : find_reg_note ((INSN), REG_INC, (REG)))
2862 #define FIND_REG_INC_NOTE(INSN, REG) 0
2865 #ifndef HAVE_PRE_INCREMENT
2866 #define HAVE_PRE_INCREMENT 0
2869 #ifndef HAVE_PRE_DECREMENT
2870 #define HAVE_PRE_DECREMENT 0
2873 #ifndef HAVE_POST_INCREMENT
2874 #define HAVE_POST_INCREMENT 0
2877 #ifndef HAVE_POST_DECREMENT
2878 #define HAVE_POST_DECREMENT 0
2881 #ifndef HAVE_POST_MODIFY_DISP
2882 #define HAVE_POST_MODIFY_DISP 0
2885 #ifndef HAVE_POST_MODIFY_REG
2886 #define HAVE_POST_MODIFY_REG 0
2889 #ifndef HAVE_PRE_MODIFY_DISP
2890 #define HAVE_PRE_MODIFY_DISP 0
2893 #ifndef HAVE_PRE_MODIFY_REG
2894 #define HAVE_PRE_MODIFY_REG 0
2898 /* Some architectures do not have complete pre/post increment/decrement
2899 instruction sets, or only move some modes efficiently. These macros
2900 allow us to tune autoincrement generation. */
2902 #ifndef USE_LOAD_POST_INCREMENT
2903 #define USE_LOAD_POST_INCREMENT(MODE) HAVE_POST_INCREMENT
2906 #ifndef USE_LOAD_POST_DECREMENT
2907 #define USE_LOAD_POST_DECREMENT(MODE) HAVE_POST_DECREMENT
2910 #ifndef USE_LOAD_PRE_INCREMENT
2911 #define USE_LOAD_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT
2914 #ifndef USE_LOAD_PRE_DECREMENT
2915 #define USE_LOAD_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT
2918 #ifndef USE_STORE_POST_INCREMENT
2919 #define USE_STORE_POST_INCREMENT(MODE) HAVE_POST_INCREMENT
2922 #ifndef USE_STORE_POST_DECREMENT
2923 #define USE_STORE_POST_DECREMENT(MODE) HAVE_POST_DECREMENT
2926 #ifndef USE_STORE_PRE_INCREMENT
2927 #define USE_STORE_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT
2930 #ifndef USE_STORE_PRE_DECREMENT
2931 #define USE_STORE_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT
2934 /* Nonzero when we are generating CONCATs. */
2935 extern int generating_concat_p
;
2937 /* Nonzero when we are expanding trees to RTL. */
2938 extern int currently_expanding_to_rtl
;
2940 /* Generally useful functions. */
2942 #ifndef GENERATOR_FILE
2943 /* Return the cost of SET X. SPEED_P is true if optimizing for speed
2944 rather than size. */
2947 set_rtx_cost (rtx x
, bool speed_p
)
2949 return rtx_cost (x
, VOIDmode
, INSN
, 4, speed_p
);
2952 /* Like set_rtx_cost, but return both the speed and size costs in C. */
2955 get_full_set_rtx_cost (rtx x
, struct full_rtx_costs
*c
)
2957 get_full_rtx_cost (x
, VOIDmode
, INSN
, 4, c
);
2960 /* Return the cost of moving X into a register, relative to the cost
2961 of a register move. SPEED_P is true if optimizing for speed rather
2965 set_src_cost (rtx x
, machine_mode mode
, bool speed_p
)
2967 return rtx_cost (x
, mode
, SET
, 1, speed_p
);
2970 /* Like set_src_cost, but return both the speed and size costs in C. */
2973 get_full_set_src_cost (rtx x
, machine_mode mode
, struct full_rtx_costs
*c
)
2975 get_full_rtx_cost (x
, mode
, SET
, 1, c
);
2979 /* A convenience macro to validate the arguments of a zero_extract
2980 expression. It determines whether SIZE lies inclusively within
2981 [1, RANGE], POS lies inclusively within between [0, RANGE - 1]
2982 and the sum lies inclusively within [1, RANGE]. RANGE must be
2983 >= 1, but SIZE and POS may be negative. */
2984 #define EXTRACT_ARGS_IN_RANGE(SIZE, POS, RANGE) \
2985 (IN_RANGE ((POS), 0, (unsigned HOST_WIDE_INT) (RANGE) - 1) \
2986 && IN_RANGE ((SIZE), 1, (unsigned HOST_WIDE_INT) (RANGE) \
2987 - (unsigned HOST_WIDE_INT)(POS)))
2990 extern HOST_WIDE_INT
trunc_int_for_mode (HOST_WIDE_INT
, machine_mode
);
2991 extern poly_int64
trunc_int_for_mode (poly_int64
, machine_mode
);
2992 extern rtx
plus_constant (machine_mode
, rtx
, poly_int64
, bool = false);
2993 extern HOST_WIDE_INT
get_stack_check_protect (void);
2996 extern rtx
rtx_alloc (RTX_CODE CXX_MEM_STAT_INFO
);
2998 rtx_init (rtx rt
, RTX_CODE code
)
3000 memset (rt
, 0, RTX_HDR_SIZE
);
3001 PUT_CODE (rt
, code
);
3004 #define rtx_alloca(code) \
3005 rtx_init ((rtx) alloca (RTX_CODE_SIZE ((code))), (code))
3006 extern rtx
rtx_alloc_stat_v (RTX_CODE MEM_STAT_DECL
, int);
3007 #define rtx_alloc_v(c, SZ) rtx_alloc_stat_v (c MEM_STAT_INFO, SZ)
3008 #define const_wide_int_alloc(NWORDS) \
3009 rtx_alloc_v (CONST_WIDE_INT, \
3010 (sizeof (struct hwivec_def) \
3011 + ((NWORDS)-1) * sizeof (HOST_WIDE_INT))) \
3013 extern rtvec rtvec_alloc (size_t);
3014 extern rtvec
shallow_copy_rtvec (rtvec
);
3015 extern bool shared_const_p (const_rtx
);
3016 extern rtx
copy_rtx (rtx
);
3017 extern enum rtx_code
classify_insn (rtx
);
3018 extern void dump_rtx_statistics (void);
3020 /* In emit-rtl.cc */
3021 extern rtx
copy_rtx_if_shared (rtx
);
3024 extern unsigned int rtx_size (const_rtx
);
3025 extern rtx
shallow_copy_rtx (const_rtx CXX_MEM_STAT_INFO
);
3027 typedef bool (*rtx_equal_p_callback_function
) (const_rtx
*, const_rtx
*,
3029 extern bool rtx_equal_p (const_rtx
, const_rtx
,
3030 rtx_equal_p_callback_function
= NULL
);
3032 extern bool rtvec_all_equal_p (const_rtvec
);
3033 extern bool rtvec_series_p (rtvec
, int);
3035 /* Return true if X is a vector constant with a duplicated element value. */
3038 const_vec_duplicate_p (const_rtx x
)
3040 return (GET_CODE (x
) == CONST_VECTOR
3041 && CONST_VECTOR_NPATTERNS (x
) == 1
3042 && CONST_VECTOR_DUPLICATE_P (x
));
3045 /* Return true if X is a vector constant with a duplicated element value.
3046 Store the duplicated element in *ELT if so. */
3048 template <typename T
>
3050 const_vec_duplicate_p (T x
, T
*elt
)
3052 if (const_vec_duplicate_p (x
))
3054 *elt
= CONST_VECTOR_ENCODED_ELT (x
, 0);
3060 /* Return true if X is a vector with a duplicated element value, either
3061 constant or nonconstant. Store the duplicated element in *ELT if so. */
3063 template <typename T
>
3065 vec_duplicate_p (T x
, T
*elt
)
3067 if (GET_CODE (x
) == VEC_DUPLICATE
3068 && !VECTOR_MODE_P (GET_MODE (XEXP (x
, 0))))
3073 return const_vec_duplicate_p (x
, elt
);
3076 /* If X is a vector constant with a duplicated element value, return that
3077 element value, otherwise return X. */
3079 template <typename T
>
3081 unwrap_const_vec_duplicate (T x
)
3083 if (const_vec_duplicate_p (x
))
3084 x
= CONST_VECTOR_ELT (x
, 0);
3088 /* In emit-rtl.cc. */
3089 extern wide_int
const_vector_int_elt (const_rtx
, unsigned int);
3090 extern rtx
const_vector_elt (const_rtx
, unsigned int);
3091 extern bool const_vec_series_p_1 (const_rtx
, rtx
*, rtx
*);
3093 /* Return true if X is an integer constant vector that contains a linear
3096 { B, B + S, B + 2 * S, B + 3 * S, ... }
3098 for a nonzero S. Store B and S in *BASE_OUT and *STEP_OUT on sucess. */
3101 const_vec_series_p (const_rtx x
, rtx
*base_out
, rtx
*step_out
)
3103 if (GET_CODE (x
) == CONST_VECTOR
3104 && CONST_VECTOR_NPATTERNS (x
) == 1
3105 && !CONST_VECTOR_DUPLICATE_P (x
))
3106 return const_vec_series_p_1 (x
, base_out
, step_out
);
3110 /* Return true if X is a vector that contains a linear series of the
3113 { B, B + S, B + 2 * S, B + 3 * S, ... }
3115 where B and S are constant or nonconstant. Store B and S in
3116 *BASE_OUT and *STEP_OUT on sucess. */
3119 vec_series_p (const_rtx x
, rtx
*base_out
, rtx
*step_out
)
3121 if (GET_CODE (x
) == VEC_SERIES
)
3123 *base_out
= XEXP (x
, 0);
3124 *step_out
= XEXP (x
, 1);
3127 return const_vec_series_p (x
, base_out
, step_out
);
3130 /* Return true if CONST_VECTORs X and Y, which are known to have the same mode,
3131 also have the same encoding. This means that they are equal whenever their
3132 operands are equal. */
3135 same_vector_encodings_p (const_rtx x
, const_rtx y
)
3137 /* Don't be fussy about the encoding of constant-length vectors,
3138 since XVECEXP (X, 0) and XVECEXP (Y, 0) list all the elements anyway. */
3139 if (poly_uint64 (CONST_VECTOR_NUNITS (x
)).is_constant ())
3142 return (CONST_VECTOR_NPATTERNS (x
) == CONST_VECTOR_NPATTERNS (y
)
3143 && (CONST_VECTOR_NELTS_PER_PATTERN (x
)
3144 == CONST_VECTOR_NELTS_PER_PATTERN (y
)));
3147 /* Return the unpromoted (outer) mode of SUBREG_PROMOTED_VAR_P subreg X. */
3149 inline scalar_int_mode
3150 subreg_unpromoted_mode (rtx x
)
3152 gcc_checking_assert (SUBREG_PROMOTED_VAR_P (x
));
3153 return as_a
<scalar_int_mode
> (GET_MODE (x
));
3156 /* Return the promoted (inner) mode of SUBREG_PROMOTED_VAR_P subreg X. */
3158 inline scalar_int_mode
3159 subreg_promoted_mode (rtx x
)
3161 gcc_checking_assert (SUBREG_PROMOTED_VAR_P (x
));
3162 return as_a
<scalar_int_mode
> (GET_MODE (SUBREG_REG (x
)));
3165 /* In emit-rtl.cc */
3166 extern rtvec
gen_rtvec_v (int, rtx
*);
3167 extern rtvec
gen_rtvec_v (int, rtx_insn
**);
3168 extern rtx
gen_reg_rtx (machine_mode
);
3169 extern rtx
gen_rtx_REG_offset (rtx
, machine_mode
, unsigned int, poly_int64
);
3170 extern rtx
gen_reg_rtx_offset (rtx
, machine_mode
, int);
3171 extern rtx
gen_reg_rtx_and_attrs (rtx
);
3172 extern rtx_code_label
*gen_label_rtx (void);
3173 extern rtx
gen_lowpart_common (machine_mode
, rtx
);
3176 extern rtx
gen_lowpart_if_possible (machine_mode
, rtx
);
3178 /* In emit-rtl.cc */
3179 extern rtx
gen_highpart (machine_mode
, rtx
);
3180 extern rtx
gen_highpart_mode (machine_mode
, machine_mode
, rtx
);
3181 extern rtx
operand_subword (rtx
, poly_uint64
, int, machine_mode
);
3183 /* In emit-rtl.cc */
3184 extern rtx
operand_subword_force (rtx
, poly_uint64
, machine_mode
);
3185 extern bool subreg_lowpart_p (const_rtx
);
3186 extern poly_uint64
subreg_size_lowpart_offset (poly_uint64
, poly_uint64
);
3188 /* Return true if a subreg of mode OUTERMODE would only access part of
3189 an inner register with mode INNERMODE. The other bits of the inner
3190 register would then be "don't care" on read. The behavior for writes
3191 depends on REGMODE_NATURAL_SIZE; bits in the same REGMODE_NATURAL_SIZE-d
3192 chunk would be clobbered but other bits would be preserved. */
3195 partial_subreg_p (machine_mode outermode
, machine_mode innermode
)
3197 /* Modes involved in a subreg must be ordered. In particular, we must
3198 always know at compile time whether the subreg is paradoxical. */
3199 poly_int64 outer_prec
= GET_MODE_PRECISION (outermode
);
3200 poly_int64 inner_prec
= GET_MODE_PRECISION (innermode
);
3201 gcc_checking_assert (ordered_p (outer_prec
, inner_prec
));
3202 return maybe_lt (outer_prec
, inner_prec
);
3205 /* Likewise return true if X is a subreg that is smaller than the inner
3206 register. Use read_modify_subreg_p to test whether writing to such
3207 a subreg preserves any part of the inner register. */
3210 partial_subreg_p (const_rtx x
)
3212 if (GET_CODE (x
) != SUBREG
)
3214 return partial_subreg_p (GET_MODE (x
), GET_MODE (SUBREG_REG (x
)));
3217 /* Return true if a subreg with the given outer and inner modes is
3221 paradoxical_subreg_p (machine_mode outermode
, machine_mode innermode
)
3223 /* Modes involved in a subreg must be ordered. In particular, we must
3224 always know at compile time whether the subreg is paradoxical. */
3225 poly_int64 outer_prec
= GET_MODE_PRECISION (outermode
);
3226 poly_int64 inner_prec
= GET_MODE_PRECISION (innermode
);
3227 gcc_checking_assert (ordered_p (outer_prec
, inner_prec
));
3228 return maybe_gt (outer_prec
, inner_prec
);
3231 /* Return true if X is a paradoxical subreg, false otherwise. */
3234 paradoxical_subreg_p (const_rtx x
)
3236 if (GET_CODE (x
) != SUBREG
)
3238 return paradoxical_subreg_p (GET_MODE (x
), GET_MODE (SUBREG_REG (x
)));
3241 /* Return the SUBREG_BYTE for an OUTERMODE lowpart of an INNERMODE value. */
3244 subreg_lowpart_offset (machine_mode outermode
, machine_mode innermode
)
3246 return subreg_size_lowpart_offset (GET_MODE_SIZE (outermode
),
3247 GET_MODE_SIZE (innermode
));
3250 /* Given that a subreg has outer mode OUTERMODE and inner mode INNERMODE,
3251 return the smaller of the two modes if they are different sizes,
3252 otherwise return the outer mode. */
3255 narrower_subreg_mode (machine_mode outermode
, machine_mode innermode
)
3257 return paradoxical_subreg_p (outermode
, innermode
) ? innermode
: outermode
;
3260 /* Given that a subreg has outer mode OUTERMODE and inner mode INNERMODE,
3261 return the mode that is big enough to hold both the outer and inner
3262 values. Prefer the outer mode in the event of a tie. */
3265 wider_subreg_mode (machine_mode outermode
, machine_mode innermode
)
3267 return partial_subreg_p (outermode
, innermode
) ? innermode
: outermode
;
3270 /* Likewise for subreg X. */
3273 wider_subreg_mode (const_rtx x
)
3275 return wider_subreg_mode (GET_MODE (x
), GET_MODE (SUBREG_REG (x
)));
3278 extern poly_uint64
subreg_size_highpart_offset (poly_uint64
, poly_uint64
);
3280 /* Return the SUBREG_BYTE for an OUTERMODE highpart of an INNERMODE value. */
3283 subreg_highpart_offset (machine_mode outermode
, machine_mode innermode
)
3285 return subreg_size_highpart_offset (GET_MODE_SIZE (outermode
),
3286 GET_MODE_SIZE (innermode
));
3289 extern poly_int64
byte_lowpart_offset (machine_mode
, machine_mode
);
3290 extern poly_int64
subreg_memory_offset (machine_mode
, machine_mode
,
3292 extern poly_int64
subreg_memory_offset (const_rtx
);
3293 extern rtx
make_safe_from (rtx
, rtx
);
3294 extern rtx
convert_memory_address_addr_space_1 (scalar_int_mode
, rtx
,
3295 addr_space_t
, bool, bool);
3296 extern rtx
convert_memory_address_addr_space (scalar_int_mode
, rtx
,
3298 #define convert_memory_address(to_mode,x) \
3299 convert_memory_address_addr_space ((to_mode), (x), ADDR_SPACE_GENERIC)
3300 extern const char *get_insn_name (int);
3301 extern rtx_insn
*get_last_insn_anywhere (void);
3302 extern rtx_insn
*get_first_nonnote_insn (void);
3303 extern rtx_insn
*get_last_nonnote_insn (void);
3304 extern void start_sequence (void);
3305 extern void push_to_sequence (rtx_insn
*);
3306 extern void push_to_sequence2 (rtx_insn
*, rtx_insn
*);
3307 extern void end_sequence (void);
3308 #if TARGET_SUPPORTS_WIDE_INT == 0
3309 extern double_int
rtx_to_double_int (const_rtx
);
3311 extern void cwi_output_hex (FILE *, const_rtx
);
3312 #if TARGET_SUPPORTS_WIDE_INT == 0
3313 extern rtx
immed_double_const (HOST_WIDE_INT
, HOST_WIDE_INT
,
3316 extern rtx
immed_wide_int_const (const poly_wide_int_ref
&, machine_mode
);
3319 extern rtx
force_const_mem (machine_mode
, rtx
);
3324 extern rtx
get_pool_constant (const_rtx
);
3325 extern rtx
get_pool_constant_mark (rtx
, bool *);
3326 extern fixed_size_mode
get_pool_mode (const_rtx
);
3327 extern rtx
simplify_subtraction (rtx
);
3328 extern void decide_function_section (tree
);
3330 /* In emit-rtl.cc */
3331 extern rtx_insn
*emit_insn_before (rtx
, rtx_insn
*);
3332 extern rtx_insn
*emit_insn_before_noloc (rtx
, rtx_insn
*, basic_block
);
3333 extern rtx_insn
*emit_insn_before_setloc (rtx
, rtx_insn
*, location_t
);
3334 extern rtx_jump_insn
*emit_jump_insn_before (rtx
, rtx_insn
*);
3335 extern rtx_jump_insn
*emit_jump_insn_before_noloc (rtx
, rtx_insn
*);
3336 extern rtx_jump_insn
*emit_jump_insn_before_setloc (rtx
, rtx_insn
*,
3338 extern rtx_insn
*emit_call_insn_before (rtx
, rtx_insn
*);
3339 extern rtx_insn
*emit_call_insn_before_noloc (rtx
, rtx_insn
*);
3340 extern rtx_insn
*emit_call_insn_before_setloc (rtx
, rtx_insn
*, location_t
);
3341 extern rtx_insn
*emit_debug_insn_before (rtx
, rtx_insn
*);
3342 extern rtx_insn
*emit_debug_insn_before_noloc (rtx
, rtx_insn
*);
3343 extern rtx_insn
*emit_debug_insn_before_setloc (rtx
, rtx_insn
*, location_t
);
3344 extern rtx_barrier
*emit_barrier_before (rtx_insn
*);
3345 extern rtx_code_label
*emit_label_before (rtx_code_label
*, rtx_insn
*);
3346 extern rtx_note
*emit_note_before (enum insn_note
, rtx_insn
*);
3347 extern rtx_insn
*emit_insn_after (rtx
, rtx_insn
*);
3348 extern rtx_insn
*emit_insn_after_noloc (rtx
, rtx_insn
*, basic_block
);
3349 extern rtx_insn
*emit_insn_after_setloc (rtx
, rtx_insn
*, location_t
);
3350 extern rtx_jump_insn
*emit_jump_insn_after (rtx
, rtx_insn
*);
3351 extern rtx_jump_insn
*emit_jump_insn_after_noloc (rtx
, rtx_insn
*);
3352 extern rtx_jump_insn
*emit_jump_insn_after_setloc (rtx
, rtx_insn
*, location_t
);
3353 extern rtx_insn
*emit_call_insn_after (rtx
, rtx_insn
*);
3354 extern rtx_insn
*emit_call_insn_after_noloc (rtx
, rtx_insn
*);
3355 extern rtx_insn
*emit_call_insn_after_setloc (rtx
, rtx_insn
*, location_t
);
3356 extern rtx_insn
*emit_debug_insn_after (rtx
, rtx_insn
*);
3357 extern rtx_insn
*emit_debug_insn_after_noloc (rtx
, rtx_insn
*);
3358 extern rtx_insn
*emit_debug_insn_after_setloc (rtx
, rtx_insn
*, location_t
);
3359 extern rtx_barrier
*emit_barrier_after (rtx_insn
*);
3360 extern rtx_insn
*emit_label_after (rtx_insn
*, rtx_insn
*);
3361 extern rtx_note
*emit_note_after (enum insn_note
, rtx_insn
*);
3362 extern rtx_insn
*emit_insn (rtx
);
3363 extern rtx_insn
*emit_debug_insn (rtx
);
3364 extern rtx_insn
*emit_jump_insn (rtx
);
3365 extern rtx_insn
*emit_likely_jump_insn (rtx
);
3366 extern rtx_insn
*emit_unlikely_jump_insn (rtx
);
3367 extern rtx_insn
*emit_call_insn (rtx
);
3368 extern rtx_code_label
*emit_label (rtx
);
3369 extern rtx_jump_table_data
*emit_jump_table_data (rtx
);
3370 extern rtx_barrier
*emit_barrier (void);
3371 extern rtx_note
*emit_note (enum insn_note
);
3372 extern rtx_note
*emit_note_copy (rtx_note
*);
3373 extern rtx_insn
*gen_clobber (rtx
);
3374 extern rtx_insn
*emit_clobber (rtx
);
3375 extern rtx_insn
*gen_use (rtx
);
3376 extern rtx_insn
*emit_use (rtx
);
3377 extern rtx_insn
*make_insn_raw (rtx
);
3378 extern void add_function_usage_to (rtx
, rtx
);
3379 extern rtx_call_insn
*last_call_insn (void);
3380 extern rtx_insn
*previous_insn (rtx_insn
*);
3381 extern rtx_insn
*next_insn (rtx_insn
*);
3382 extern rtx_insn
*prev_nonnote_insn (rtx_insn
*);
3383 extern rtx_insn
*next_nonnote_insn (rtx_insn
*);
3384 extern rtx_insn
*prev_nondebug_insn (rtx_insn
*);
3385 extern rtx_insn
*next_nondebug_insn (rtx_insn
*);
3386 extern rtx_insn
*prev_nonnote_nondebug_insn (rtx_insn
*);
3387 extern rtx_insn
*prev_nonnote_nondebug_insn_bb (rtx_insn
*);
3388 extern rtx_insn
*next_nonnote_nondebug_insn (rtx_insn
*);
3389 extern rtx_insn
*next_nonnote_nondebug_insn_bb (rtx_insn
*);
3390 extern rtx_insn
*prev_real_insn (rtx_insn
*);
3391 extern rtx_insn
*next_real_insn (rtx_insn
*);
3392 extern rtx_insn
*prev_real_nondebug_insn (rtx_insn
*);
3393 extern rtx_insn
*next_real_nondebug_insn (rtx
);
3394 extern rtx_insn
*prev_active_insn (rtx_insn
*);
3395 extern rtx_insn
*next_active_insn (rtx_insn
*);
3396 extern bool active_insn_p (const rtx_insn
*);
3398 /* In emit-rtl.cc */
3399 extern int insn_line (const rtx_insn
*);
3400 extern const char * insn_file (const rtx_insn
*);
3401 extern tree
insn_scope (const rtx_insn
*);
3402 extern expanded_location
insn_location (const rtx_insn
*);
3403 extern int insn_discriminator (const rtx_insn
*);
3404 extern location_t prologue_location
, epilogue_location
;
3407 extern enum rtx_code
reverse_condition (enum rtx_code
);
3408 extern enum rtx_code
reverse_condition_maybe_unordered (enum rtx_code
);
3409 extern enum rtx_code
swap_condition (enum rtx_code
);
3410 extern enum rtx_code
unsigned_condition (enum rtx_code
);
3411 extern enum rtx_code
signed_condition (enum rtx_code
);
3412 extern void mark_jump_label (rtx
, rtx_insn
*, int);
3414 /* Return true if integer comparison operator CODE interprets its operands
3418 unsigned_condition_p (enum rtx_code code
)
3420 return unsigned_condition (code
) == code
;
3424 extern rtx_insn
*delete_related_insns (rtx
);
3427 extern rtx
*find_constant_term_loc (rtx
*);
3429 /* In emit-rtl.cc */
3430 extern rtx_insn
*try_split (rtx
, rtx_insn
*, int);
3432 /* In insn-recog.cc (generated by genrecog). */
3433 extern rtx_insn
*split_insns (rtx
, rtx_insn
*);
3435 /* In simplify-rtx.cc */
3437 /* A class that records the context in which a simplification
3439 class simplify_context
3442 rtx
simplify_unary_operation (rtx_code
, machine_mode
, rtx
, machine_mode
);
3443 rtx
simplify_binary_operation (rtx_code
, machine_mode
, rtx
, rtx
);
3444 rtx
simplify_ternary_operation (rtx_code
, machine_mode
, machine_mode
,
3446 rtx
simplify_relational_operation (rtx_code
, machine_mode
, machine_mode
,
3448 rtx
simplify_subreg (machine_mode
, rtx
, machine_mode
, poly_uint64
);
3450 rtx
lowpart_subreg (machine_mode
, rtx
, machine_mode
);
3452 rtx
simplify_merge_mask (rtx
, rtx
, int);
3454 rtx
simplify_gen_unary (rtx_code
, machine_mode
, rtx
, machine_mode
);
3455 rtx
simplify_gen_binary (rtx_code
, machine_mode
, rtx
, rtx
);
3456 rtx
simplify_gen_ternary (rtx_code
, machine_mode
, machine_mode
,
3458 rtx
simplify_gen_relational (rtx_code
, machine_mode
, machine_mode
, rtx
, rtx
);
3459 rtx
simplify_gen_subreg (machine_mode
, rtx
, machine_mode
, poly_uint64
);
3460 rtx
simplify_gen_vec_select (rtx
, unsigned int);
3462 /* Tracks the level of MEM nesting for the value being simplified:
3463 0 means the value is not in a MEM, >0 means it is. This is needed
3464 because the canonical representation of multiplication is different
3465 inside a MEM than outside. */
3466 unsigned int mem_depth
= 0;
3468 /* Tracks number of simplify_associative_operation calls performed during
3469 outermost simplify* call. */
3470 unsigned int assoc_count
= 0;
3472 /* Limit for the above number, return NULL from
3473 simplify_associative_operation after we reach that assoc_count. */
3474 static const unsigned int max_assoc_count
= 64;
3477 rtx
simplify_truncation (machine_mode
, rtx
, machine_mode
);
3478 rtx
simplify_byte_swapping_operation (rtx_code
, machine_mode
, rtx
, rtx
);
3479 rtx
simplify_associative_operation (rtx_code
, machine_mode
, rtx
, rtx
);
3480 rtx
simplify_distributive_operation (rtx_code
, machine_mode
, rtx
, rtx
);
3481 rtx
simplify_logical_relational_operation (rtx_code
, machine_mode
, rtx
, rtx
,
3483 rtx
simplify_binary_operation_series (rtx_code
, machine_mode
, rtx
, rtx
);
3484 rtx
simplify_distribute_over_subregs (rtx_code
, machine_mode
, rtx
, rtx
);
3485 rtx
simplify_shift_const_int (rtx_code
, machine_mode
, rtx
, unsigned int);
3486 rtx
simplify_plus_minus (rtx_code
, machine_mode
, rtx
, rtx
);
3487 rtx
simplify_cond_clz_ctz (rtx
, rtx_code
, rtx
, rtx
);
3489 rtx
simplify_unary_operation_1 (rtx_code
, machine_mode
, rtx
);
3490 rtx
simplify_binary_operation_1 (rtx_code
, machine_mode
, rtx
, rtx
, rtx
, rtx
);
3491 rtx
simplify_ternary_operation_1 (rtx_code
, machine_mode
, machine_mode
,
3493 rtx
simplify_relational_operation_1 (rtx_code
, machine_mode
, machine_mode
,
3498 simplify_unary_operation (rtx_code code
, machine_mode mode
, rtx op
,
3499 machine_mode op_mode
)
3501 return simplify_context ().simplify_unary_operation (code
, mode
, op
,
3506 simplify_binary_operation (rtx_code code
, machine_mode mode
, rtx op0
, rtx op1
)
3508 return simplify_context ().simplify_binary_operation (code
, mode
, op0
, op1
);
3512 simplify_ternary_operation (rtx_code code
, machine_mode mode
,
3513 machine_mode op0_mode
, rtx op0
, rtx op1
, rtx op2
)
3515 return simplify_context ().simplify_ternary_operation (code
, mode
, op0_mode
,
3520 simplify_relational_operation (rtx_code code
, machine_mode mode
,
3521 machine_mode op_mode
, rtx op0
, rtx op1
)
3523 return simplify_context ().simplify_relational_operation (code
, mode
,
3528 simplify_subreg (machine_mode outermode
, rtx op
, machine_mode innermode
,
3531 return simplify_context ().simplify_subreg (outermode
, op
, innermode
, byte
);
3535 simplify_gen_unary (rtx_code code
, machine_mode mode
, rtx op
,
3536 machine_mode op_mode
)
3538 return simplify_context ().simplify_gen_unary (code
, mode
, op
, op_mode
);
3542 simplify_gen_binary (rtx_code code
, machine_mode mode
, rtx op0
, rtx op1
)
3544 return simplify_context ().simplify_gen_binary (code
, mode
, op0
, op1
);
3548 simplify_gen_ternary (rtx_code code
, machine_mode mode
, machine_mode op0_mode
,
3549 rtx op0
, rtx op1
, rtx op2
)
3551 return simplify_context ().simplify_gen_ternary (code
, mode
, op0_mode
,
3556 simplify_gen_relational (rtx_code code
, machine_mode mode
,
3557 machine_mode op_mode
, rtx op0
, rtx op1
)
3559 return simplify_context ().simplify_gen_relational (code
, mode
, op_mode
,
3564 simplify_gen_subreg (machine_mode outermode
, rtx op
, machine_mode innermode
,
3567 return simplify_context ().simplify_gen_subreg (outermode
, op
,
3572 simplify_gen_vec_select (rtx op
, unsigned int index
)
3574 return simplify_context ().simplify_gen_vec_select (op
, index
);
3578 lowpart_subreg (machine_mode outermode
, rtx op
, machine_mode innermode
)
3580 return simplify_context ().lowpart_subreg (outermode
, op
, innermode
);
3583 extern rtx
simplify_const_unary_operation (enum rtx_code
, machine_mode
,
3585 extern rtx
simplify_const_binary_operation (enum rtx_code
, machine_mode
,
3587 extern rtx
simplify_const_relational_operation (enum rtx_code
,
3588 machine_mode
, rtx
, rtx
);
3589 extern rtx
simplify_replace_fn_rtx (rtx
, const_rtx
,
3590 rtx (*fn
) (rtx
, const_rtx
, void *), void *);
3591 extern rtx
simplify_replace_rtx (rtx
, const_rtx
, rtx
);
3592 extern rtx
simplify_rtx (const_rtx
);
3593 extern rtx
avoid_constant_pool_reference (rtx
);
3594 extern rtx
delegitimize_mem_from_attrs (rtx
);
3595 extern bool mode_signbit_p (machine_mode
, const_rtx
);
3596 extern bool val_signbit_p (machine_mode
, unsigned HOST_WIDE_INT
);
3597 extern bool val_signbit_known_set_p (machine_mode
,
3598 unsigned HOST_WIDE_INT
);
3599 extern bool val_signbit_known_clear_p (machine_mode
,
3600 unsigned HOST_WIDE_INT
);
3601 extern bool reverse_rotate_by_imm_p (machine_mode
, unsigned int, rtx
);
3604 extern machine_mode
choose_hard_reg_mode (unsigned int, unsigned int,
3605 const predefined_function_abi
*);
3606 extern const HARD_REG_SET
&simplifiable_subregs (const subreg_shape
&);
3608 /* In emit-rtl.cc */
3609 extern rtx
set_for_reg_notes (rtx
);
3610 extern rtx
set_unique_reg_note (rtx
, enum reg_note
, rtx
);
3611 extern rtx
set_dst_reg_note (rtx
, enum reg_note
, rtx
, rtx
);
3612 extern void set_insn_deleted (rtx_insn
*);
3614 /* Functions in rtlanal.cc */
3616 extern rtx
single_set_2 (const rtx_insn
*, const_rtx
);
3617 extern rtx
simple_regno_set (rtx
, unsigned int);
3618 extern bool contains_symbol_ref_p (const_rtx
);
3619 extern bool contains_symbolic_reference_p (const_rtx
);
3620 extern bool contains_constant_pool_address_p (const_rtx
);
3621 extern void add_auto_inc_notes (rtx_insn
*, rtx
);
3623 /* Handle the cheap and common cases inline for performance. */
3625 inline rtx
single_set (const rtx_insn
*insn
)
3630 if (GET_CODE (PATTERN (insn
)) == SET
)
3631 return PATTERN (insn
);
3633 /* Defer to the more expensive case. */
3634 return single_set_2 (insn
, PATTERN (insn
));
3637 extern scalar_int_mode
get_address_mode (rtx mem
);
3638 extern bool rtx_addr_can_trap_p (const_rtx
);
3639 extern bool nonzero_address_p (const_rtx
);
3640 extern bool rtx_unstable_p (const_rtx
);
3641 extern bool rtx_varies_p (const_rtx
, bool);
3642 extern bool rtx_addr_varies_p (const_rtx
, bool);
3643 extern rtx
get_call_rtx_from (const rtx_insn
*);
3644 extern tree
get_call_fndecl (const rtx_insn
*);
3645 extern HOST_WIDE_INT
get_integer_term (const_rtx
);
3646 extern rtx
get_related_value (const_rtx
);
3647 extern bool offset_within_block_p (const_rtx
, HOST_WIDE_INT
);
3648 extern void split_const (rtx
, rtx
*, rtx
*);
3649 extern rtx
strip_offset (rtx
, poly_int64
*);
3650 extern poly_int64
get_args_size (const_rtx
);
3651 extern bool unsigned_reg_p (rtx
);
3652 extern bool reg_mentioned_p (const_rtx
, const_rtx
);
3653 extern int count_occurrences (const_rtx
, const_rtx
, int);
3654 extern bool reg_referenced_p (const_rtx
, const_rtx
);
3655 extern bool reg_used_between_p (const_rtx
, const rtx_insn
*, const rtx_insn
*);
3656 extern bool reg_set_between_p (const_rtx
, const rtx_insn
*, const rtx_insn
*);
3657 extern int commutative_operand_precedence (rtx
);
3658 extern bool swap_commutative_operands_p (rtx
, rtx
);
3659 extern bool modified_between_p (const_rtx
, const rtx_insn
*, const rtx_insn
*);
3660 extern bool no_labels_between_p (const rtx_insn
*, const rtx_insn
*);
3661 extern bool modified_in_p (const_rtx
, const_rtx
);
3662 extern bool reg_set_p (const_rtx
, const_rtx
);
3663 extern bool multiple_sets (const_rtx
);
3664 extern bool set_noop_p (const_rtx
);
3665 extern bool noop_move_p (const rtx_insn
*);
3666 extern bool refers_to_regno_p (unsigned int, unsigned int, const_rtx
, rtx
*);
3667 extern bool reg_overlap_mentioned_p (const_rtx
, const_rtx
);
3668 extern const_rtx
set_of (const_rtx
, const_rtx
);
3669 extern void record_hard_reg_sets (rtx
, const_rtx
, void *);
3670 extern void record_hard_reg_uses (rtx
*, void *);
3671 extern void find_all_hard_regs (const_rtx
, HARD_REG_SET
*);
3672 extern void find_all_hard_reg_sets (const rtx_insn
*, HARD_REG_SET
*, bool);
3673 extern void note_pattern_stores (const_rtx
,
3674 void (*) (rtx
, const_rtx
, void *), void *);
3675 extern void note_stores (const rtx_insn
*,
3676 void (*) (rtx
, const_rtx
, void *), void *);
3677 extern void note_uses (rtx
*, void (*) (rtx
*, void *), void *);
3678 extern bool dead_or_set_p (const rtx_insn
*, const_rtx
);
3679 extern bool dead_or_set_regno_p (const rtx_insn
*, unsigned int);
3680 extern rtx
find_reg_note (const_rtx
, enum reg_note
, const_rtx
);
3681 extern rtx
find_regno_note (const_rtx
, enum reg_note
, unsigned int);
3682 extern rtx
find_reg_equal_equiv_note (const_rtx
);
3683 extern rtx
find_constant_src (const rtx_insn
*);
3684 extern bool find_reg_fusage (const_rtx
, enum rtx_code
, const_rtx
);
3685 extern bool find_regno_fusage (const_rtx
, enum rtx_code
, unsigned int);
3686 extern rtx
alloc_reg_note (enum reg_note
, rtx
, rtx
);
3687 extern void add_reg_note (rtx
, enum reg_note
, rtx
);
3688 extern void add_int_reg_note (rtx_insn
*, enum reg_note
, int);
3689 extern void add_args_size_note (rtx_insn
*, poly_int64
);
3690 extern void add_shallow_copy_of_reg_note (rtx_insn
*, rtx
);
3691 extern rtx
duplicate_reg_note (rtx
);
3692 extern void remove_note (rtx_insn
*, const_rtx
);
3693 extern bool remove_reg_equal_equiv_notes (rtx_insn
*, bool = false);
3694 extern void remove_reg_equal_equiv_notes_for_regno (unsigned int);
3695 extern bool side_effects_p (const_rtx
);
3696 extern bool volatile_refs_p (const_rtx
);
3697 extern bool volatile_insn_p (const_rtx
);
3698 extern bool may_trap_p_1 (const_rtx
, unsigned);
3699 extern bool may_trap_p (const_rtx
);
3700 extern bool may_trap_or_fault_p (const_rtx
);
3701 extern bool can_throw_internal (const_rtx
);
3702 extern bool can_throw_external (const_rtx
);
3703 extern bool insn_could_throw_p (const_rtx
);
3704 extern bool insn_nothrow_p (const_rtx
);
3705 extern bool can_nonlocal_goto (const rtx_insn
*);
3706 extern void copy_reg_eh_region_note_forward (rtx
, rtx_insn
*, rtx
);
3707 extern void copy_reg_eh_region_note_backward (rtx
, rtx_insn
*, rtx
);
3708 extern rtx
replace_rtx (rtx
, rtx
, rtx
, bool = false);
3709 extern void replace_label (rtx
*, rtx
, rtx
, bool);
3710 extern void replace_label_in_insn (rtx_insn
*, rtx_insn
*, rtx_insn
*, bool);
3711 extern bool rtx_referenced_p (const_rtx
, const_rtx
);
3712 extern bool tablejump_p (const rtx_insn
*, rtx_insn
**, rtx_jump_table_data
**);
3713 extern rtx
tablejump_casesi_pattern (const rtx_insn
*insn
);
3714 extern bool computed_jump_p (const rtx_insn
*);
3715 extern bool tls_referenced_p (const_rtx
);
3716 extern bool contains_mem_rtx_p (rtx x
);
3717 extern bool register_asm_p (const_rtx
);
3719 /* Overload for refers_to_regno_p for checking a single register. */
3721 refers_to_regno_p (unsigned int regnum
, const_rtx x
, rtx
* loc
= NULL
)
3723 return refers_to_regno_p (regnum
, regnum
+ 1, x
, loc
);
3726 /* Callback for for_each_inc_dec, to process the autoinc operation OP
3727 within MEM that sets DEST to SRC + SRCOFF, or SRC if SRCOFF is
3728 NULL. The callback is passed the same opaque ARG passed to
3729 for_each_inc_dec. Return zero to continue looking for other
3730 autoinc operations or any other value to interrupt the traversal and
3731 return that value to the caller of for_each_inc_dec. */
3732 typedef int (*for_each_inc_dec_fn
) (rtx mem
, rtx op
, rtx dest
, rtx src
,
3733 rtx srcoff
, void *arg
);
3734 extern int for_each_inc_dec (rtx
, for_each_inc_dec_fn
, void *arg
);
3736 extern rtx
regno_use_in (unsigned int, rtx
);
3737 extern bool auto_inc_p (const_rtx
);
3738 extern bool in_insn_list_p (const rtx_insn_list
*, const rtx_insn
*);
3739 extern void remove_node_from_insn_list (const rtx_insn
*, rtx_insn_list
**);
3740 extern bool loc_mentioned_in_p (rtx
*, const_rtx
);
3741 extern rtx_insn
*find_first_parameter_load (rtx_insn
*, rtx_insn
*);
3742 extern bool keep_with_call_p (const rtx_insn
*);
3743 extern bool label_is_jump_target_p (const_rtx
, const rtx_insn
*);
3744 extern int pattern_cost (rtx
, bool);
3745 extern int insn_cost (rtx_insn
*, bool);
3746 extern unsigned seq_cost (const rtx_insn
*, bool);
3748 /* Given an insn and condition, return a canonical description of
3749 the test being made. */
3750 extern rtx
canonicalize_condition (rtx_insn
*, rtx
, int, rtx_insn
**, rtx
,
3753 /* Given a JUMP_INSN, return a canonical description of the test
3755 extern rtx
get_condition (rtx_insn
*, rtx_insn
**, int, int);
3757 /* Information about a subreg of a hard register. */
3760 /* Offset of first hard register involved in the subreg. */
3762 /* Number of hard registers involved in the subreg. In the case of
3763 a paradoxical subreg, this is the number of registers that would
3764 be modified by writing to the subreg; some of them may be don't-care
3765 when reading from the subreg. */
3767 /* Whether this subreg can be represented as a hard reg with the new
3768 mode (by adding OFFSET to the original hard register). */
3769 bool representable_p
;
3772 extern void subreg_get_info (unsigned int, machine_mode
,
3773 poly_uint64
, machine_mode
,
3774 struct subreg_info
*);
3778 extern void free_EXPR_LIST_list (rtx_expr_list
**);
3779 extern void free_INSN_LIST_list (rtx_insn_list
**);
3780 extern void free_EXPR_LIST_node (rtx
);
3781 extern void free_INSN_LIST_node (rtx
);
3782 extern rtx_insn_list
*alloc_INSN_LIST (rtx
, rtx
);
3783 extern rtx_insn_list
*copy_INSN_LIST (rtx_insn_list
*);
3784 extern rtx_insn_list
*concat_INSN_LIST (rtx_insn_list
*, rtx_insn_list
*);
3785 extern rtx_expr_list
*alloc_EXPR_LIST (int, rtx
, rtx
);
3786 extern void remove_free_INSN_LIST_elem (rtx_insn
*, rtx_insn_list
**);
3787 extern rtx
remove_list_elem (rtx
, rtx
*);
3788 extern rtx_insn
*remove_free_INSN_LIST_node (rtx_insn_list
**);
3789 extern rtx
remove_free_EXPR_LIST_node (rtx_expr_list
**);
3794 /* Resize reg info. */
3795 extern bool resize_reg_info (void);
3796 /* Free up register info memory. */
3797 extern void free_reg_info (void);
3798 extern void init_subregs_of_mode (void);
3799 extern void finish_subregs_of_mode (void);
3800 extern void reginfo_cc_finalize (void);
3803 extern rtx
extract_asm_operands (rtx
);
3804 extern int asm_noperands (const_rtx
);
3805 extern const char *decode_asm_operands (rtx
, rtx
*, rtx
**, const char **,
3806 machine_mode
*, location_t
*);
3807 extern void get_referenced_operands (const char *, bool *, unsigned int);
3809 extern enum reg_class
reg_preferred_class (int);
3810 extern enum reg_class
reg_alternate_class (int);
3811 extern enum reg_class
reg_allocno_class (int);
3812 extern void setup_reg_classes (int, enum reg_class
, enum reg_class
,
3815 extern void split_all_insns (void);
3816 extern void split_all_insns_noflow (void);
3818 #define MAX_SAVED_CONST_INT 64
3819 extern GTY(()) rtx const_int_rtx
[MAX_SAVED_CONST_INT
* 2 + 1];
3821 #define const0_rtx (const_int_rtx[MAX_SAVED_CONST_INT])
3822 #define const1_rtx (const_int_rtx[MAX_SAVED_CONST_INT+1])
3823 #define const2_rtx (const_int_rtx[MAX_SAVED_CONST_INT+2])
3824 #define constm1_rtx (const_int_rtx[MAX_SAVED_CONST_INT-1])
3825 extern GTY(()) rtx const_true_rtx
;
3827 extern GTY(()) rtx const_tiny_rtx
[4][(int) MAX_MACHINE_MODE
];
3829 /* Returns a constant 0 rtx in mode MODE. Integer modes are treated the
3830 same as VOIDmode. */
3832 #define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)])
3834 /* Likewise, for the constants 1 and 2 and -1. */
3836 #define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)])
3837 #define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)])
3838 #define CONSTM1_RTX(MODE) (const_tiny_rtx[3][(int) (MODE)])
3840 extern GTY(()) rtx pc_rtx
;
3841 extern GTY(()) rtx ret_rtx
;
3842 extern GTY(()) rtx simple_return_rtx
;
3843 extern GTY(()) rtx_insn
*invalid_insn_rtx
;
3845 /* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg
3846 is used to represent the frame pointer. This is because the
3847 hard frame pointer and the automatic variables are separated by an amount
3848 that cannot be determined until after register allocation. We can assume
3849 that in this case ELIMINABLE_REGS will be defined, one action of which
3850 will be to eliminate FRAME_POINTER_REGNUM into HARD_FRAME_POINTER_REGNUM. */
3851 #ifndef HARD_FRAME_POINTER_REGNUM
3852 #define HARD_FRAME_POINTER_REGNUM FRAME_POINTER_REGNUM
3855 #ifndef HARD_FRAME_POINTER_IS_FRAME_POINTER
3856 #define HARD_FRAME_POINTER_IS_FRAME_POINTER \
3857 (HARD_FRAME_POINTER_REGNUM == FRAME_POINTER_REGNUM)
3860 #ifndef HARD_FRAME_POINTER_IS_ARG_POINTER
3861 #define HARD_FRAME_POINTER_IS_ARG_POINTER \
3862 (HARD_FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM)
3865 /* Index labels for global_rtl. */
3866 enum global_rtl_index
3870 /* For register elimination to work properly these hard_frame_pointer_rtx,
3871 frame_pointer_rtx, and arg_pointer_rtx must be the same if they refer to
3872 the same register. */
3873 #if FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM
3874 GR_ARG_POINTER
= GR_FRAME_POINTER
,
3876 #if HARD_FRAME_POINTER_IS_FRAME_POINTER
3877 GR_HARD_FRAME_POINTER
= GR_FRAME_POINTER
,
3879 GR_HARD_FRAME_POINTER
,
3881 #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
3882 #if HARD_FRAME_POINTER_IS_ARG_POINTER
3883 GR_ARG_POINTER
= GR_HARD_FRAME_POINTER
,
3888 GR_VIRTUAL_INCOMING_ARGS
,
3889 GR_VIRTUAL_STACK_ARGS
,
3890 GR_VIRTUAL_STACK_DYNAMIC
,
3891 GR_VIRTUAL_OUTGOING_ARGS
,
3893 GR_VIRTUAL_PREFERRED_STACK_BOUNDARY
,
3898 /* Target-dependent globals. */
3899 struct GTY(()) target_rtl
{
3900 /* All references to the hard registers in global_rtl_index go through
3901 these unique rtl objects. On machines where the frame-pointer and
3902 arg-pointer are the same register, they use the same unique object.
3904 After register allocation, other rtl objects which used to be pseudo-regs
3905 may be clobbered to refer to the frame-pointer register.
3906 But references that were originally to the frame-pointer can be
3907 distinguished from the others because they contain frame_pointer_rtx.
3909 When to use frame_pointer_rtx and hard_frame_pointer_rtx is a little
3910 tricky: until register elimination has taken place hard_frame_pointer_rtx
3911 should be used if it is being set, and frame_pointer_rtx otherwise. After
3912 register elimination hard_frame_pointer_rtx should always be used.
3913 On machines where the two registers are same (most) then these are the
3915 rtx x_global_rtl
[GR_MAX
];
3917 /* A unique representation of (REG:Pmode PIC_OFFSET_TABLE_REGNUM). */
3918 rtx x_pic_offset_table_rtx
;
3920 /* A unique representation of (REG:Pmode RETURN_ADDRESS_POINTER_REGNUM).
3921 This is used to implement __builtin_return_address for some machines;
3922 see for instance the MIPS port. */
3923 rtx x_return_address_pointer_rtx
;
3925 /* Commonly used RTL for hard registers. These objects are not
3926 necessarily unique, so we allocate them separately from global_rtl.
3927 They are initialized once per compilation unit, then copied into
3928 regno_reg_rtx at the beginning of each function. */
3929 rtx x_initial_regno_reg_rtx
[FIRST_PSEUDO_REGISTER
];
3931 /* A sample (mem:M stack_pointer_rtx) rtx for each mode M. */
3932 rtx x_top_of_stack
[MAX_MACHINE_MODE
];
3934 /* Static hunks of RTL used by the aliasing code; these are treated
3935 as persistent to avoid unnecessary RTL allocations. */
3936 rtx x_static_reg_base_value
[FIRST_PSEUDO_REGISTER
];
3938 /* The default memory attributes for each mode. */
3939 class mem_attrs
*x_mode_mem_attrs
[(int) MAX_MACHINE_MODE
];
3941 /* Track if RTL has been initialized. */
3942 bool target_specific_initialized
;
3945 extern GTY(()) struct target_rtl default_target_rtl
;
3946 #if SWITCHABLE_TARGET
3947 extern struct target_rtl
*this_target_rtl
;
3949 #define this_target_rtl (&default_target_rtl)
3952 #define global_rtl \
3953 (this_target_rtl->x_global_rtl)
3954 #define pic_offset_table_rtx \
3955 (this_target_rtl->x_pic_offset_table_rtx)
3956 #define return_address_pointer_rtx \
3957 (this_target_rtl->x_return_address_pointer_rtx)
3958 #define top_of_stack \
3959 (this_target_rtl->x_top_of_stack)
3960 #define mode_mem_attrs \
3961 (this_target_rtl->x_mode_mem_attrs)
3963 /* All references to certain hard regs, except those created
3964 by allocating pseudo regs into them (when that's possible),
3965 go through these unique rtx objects. */
3966 #define stack_pointer_rtx (global_rtl[GR_STACK_POINTER])
3967 #define frame_pointer_rtx (global_rtl[GR_FRAME_POINTER])
3968 #define hard_frame_pointer_rtx (global_rtl[GR_HARD_FRAME_POINTER])
3969 #define arg_pointer_rtx (global_rtl[GR_ARG_POINTER])
3971 #ifndef GENERATOR_FILE
3972 /* Return the attributes of a MEM rtx. */
3973 inline const class mem_attrs
*
3974 get_mem_attrs (const_rtx x
)
3976 class mem_attrs
*attrs
;
3978 attrs
= MEM_ATTRS (x
);
3980 attrs
= mode_mem_attrs
[(int) GET_MODE (x
)];
3985 /* Include the RTL generation functions. */
3987 #ifndef GENERATOR_FILE
3989 #undef gen_rtx_ASM_INPUT
3990 #define gen_rtx_ASM_INPUT(MODE, ARG0) \
3991 gen_rtx_fmt_sL (ASM_INPUT, (MODE), (ARG0), 0)
3992 #define gen_rtx_ASM_INPUT_loc(MODE, ARG0, LOC) \
3993 gen_rtx_fmt_sL (ASM_INPUT, (MODE), (ARG0), (LOC))
3996 /* There are some RTL codes that require special attention; the
3997 generation functions included above do the raw handling. If you
3998 add to this list, modify special_rtx in gengenrtl.cc as well. */
4000 extern rtx_expr_list
*gen_rtx_EXPR_LIST (machine_mode
, rtx
, rtx
);
4001 extern rtx_insn_list
*gen_rtx_INSN_LIST (machine_mode
, rtx
, rtx
);
4003 gen_rtx_INSN (machine_mode mode
, rtx_insn
*prev_insn
, rtx_insn
*next_insn
,
4004 basic_block bb
, rtx pattern
, location_t location
, int code
,
4006 extern rtx
gen_rtx_CONST_INT (machine_mode
, HOST_WIDE_INT
);
4007 extern rtx
gen_rtx_CONST_VECTOR (machine_mode
, rtvec
);
4008 extern void set_mode_and_regno (rtx
, machine_mode
, unsigned int);
4009 extern rtx
init_raw_REG (rtx
, machine_mode
, unsigned int);
4010 extern rtx
gen_raw_REG (machine_mode
, unsigned int);
4011 #define alloca_raw_REG(mode, regno) \
4012 init_raw_REG (rtx_alloca (REG), (mode), (regno))
4013 extern rtx
gen_rtx_REG (machine_mode
, unsigned int);
4014 extern rtx
gen_rtx_SUBREG (machine_mode
, rtx
, poly_uint64
);
4015 extern rtx
gen_rtx_MEM (machine_mode
, rtx
);
4016 extern rtx
gen_rtx_VAR_LOCATION (machine_mode
, tree
, rtx
,
4017 enum var_init_status
);
4019 #ifdef GENERATOR_FILE
4020 #define PUT_MODE(RTX, MODE) PUT_MODE_RAW (RTX, MODE)
4023 PUT_MODE (rtx x
, machine_mode mode
)
4026 set_mode_and_regno (x
, mode
, REGNO (x
));
4028 PUT_MODE_RAW (x
, mode
);
4032 #define GEN_INT(N) gen_rtx_CONST_INT (VOIDmode, (N))
4034 /* Virtual registers are used during RTL generation to refer to locations into
4035 the stack frame when the actual location isn't known until RTL generation
4036 is complete. The routine instantiate_virtual_regs replaces these with
4037 the proper value, which is normally {frame,arg,stack}_pointer_rtx plus
4040 #define FIRST_VIRTUAL_REGISTER (FIRST_PSEUDO_REGISTER)
4042 /* This points to the first word of the incoming arguments passed on the stack,
4043 either by the caller or by the callee when pretending it was passed by the
4046 #define virtual_incoming_args_rtx (global_rtl[GR_VIRTUAL_INCOMING_ARGS])
4048 #define VIRTUAL_INCOMING_ARGS_REGNUM (FIRST_VIRTUAL_REGISTER)
4050 /* If FRAME_GROWS_DOWNWARD, this points to immediately above the first
4051 variable on the stack. Otherwise, it points to the first variable on
4054 #define virtual_stack_vars_rtx (global_rtl[GR_VIRTUAL_STACK_ARGS])
4056 #define VIRTUAL_STACK_VARS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 1)
4058 /* This points to the location of dynamically-allocated memory on the stack
4059 immediately after the stack pointer has been adjusted by the amount
4062 #define virtual_stack_dynamic_rtx (global_rtl[GR_VIRTUAL_STACK_DYNAMIC])
4064 #define VIRTUAL_STACK_DYNAMIC_REGNUM ((FIRST_VIRTUAL_REGISTER) + 2)
4066 /* This points to the location in the stack at which outgoing arguments should
4067 be written when the stack is pre-pushed (arguments pushed using push
4068 insns always use sp). */
4070 #define virtual_outgoing_args_rtx (global_rtl[GR_VIRTUAL_OUTGOING_ARGS])
4072 #define VIRTUAL_OUTGOING_ARGS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 3)
4074 /* This points to the Canonical Frame Address of the function. This
4075 should correspond to the CFA produced by INCOMING_FRAME_SP_OFFSET,
4076 but is calculated relative to the arg pointer for simplicity; the
4077 frame pointer nor stack pointer are necessarily fixed relative to
4078 the CFA until after reload. */
4080 #define virtual_cfa_rtx (global_rtl[GR_VIRTUAL_CFA])
4082 #define VIRTUAL_CFA_REGNUM ((FIRST_VIRTUAL_REGISTER) + 4)
4084 #define LAST_VIRTUAL_POINTER_REGISTER ((FIRST_VIRTUAL_REGISTER) + 4)
4086 /* This is replaced by crtl->preferred_stack_boundary / BITS_PER_UNIT
4089 #define virtual_preferred_stack_boundary_rtx \
4090 (global_rtl[GR_VIRTUAL_PREFERRED_STACK_BOUNDARY])
4092 #define VIRTUAL_PREFERRED_STACK_BOUNDARY_REGNUM \
4093 ((FIRST_VIRTUAL_REGISTER) + 5)
4095 #define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 5)
4097 /* Nonzero if REGNUM is a pointer into the stack frame. */
4098 #define REGNO_PTR_FRAME_P(REGNUM) \
4099 ((REGNUM) == STACK_POINTER_REGNUM \
4100 || (REGNUM) == FRAME_POINTER_REGNUM \
4101 || (REGNUM) == HARD_FRAME_POINTER_REGNUM \
4102 || (REGNUM) == ARG_POINTER_REGNUM \
4103 || VIRTUAL_REGISTER_NUM_P (REGNUM))
4105 /* REGNUM never really appearing in the INSN stream. */
4106 #define INVALID_REGNUM (~(unsigned int) 0)
4108 /* REGNUM for which no debug information can be generated. */
4109 #define IGNORED_DWARF_REGNUM (INVALID_REGNUM - 1)
4111 extern rtx
output_constant_def (tree
, int);
4112 extern rtx
lookup_constant_def (tree
);
4114 /* Nonzero after end of reload pass.
4115 Set to 1 or 0 by reload1.cc. */
4117 extern int reload_completed
;
4119 /* Nonzero after thread_prologue_and_epilogue_insns has run. */
4120 extern int epilogue_completed
;
4122 /* Set to 1 while reload_as_needed is operating.
4123 Required by some machines to handle any generated moves differently. */
4125 extern int reload_in_progress
;
4127 /* Set to true while in IRA. */
4128 extern bool ira_in_progress
;
4130 /* Set to true while in LRA. */
4131 extern bool lra_in_progress
;
4133 /* This macro indicates whether you may create a new
4136 #define can_create_pseudo_p() (!reload_in_progress && !reload_completed)
4139 /* Nonzero after end of regstack pass.
4140 Set to 1 or 0 by reg-stack.cc. */
4141 extern int regstack_completed
;
4144 /* If this is nonzero, we do not bother generating VOLATILE
4145 around volatile memory references, and we are willing to
4146 output indirect addresses. If cse is to follow, we reject
4147 indirect addresses so a useful potential cse is generated;
4148 if it is used only once, instruction combination will produce
4149 the same indirect address eventually. */
4150 extern int cse_not_expected
;
4152 /* Translates rtx code to tree code, for those codes needed by
4153 real_arithmetic. The function returns an int because the caller may not
4154 know what `enum tree_code' means. */
4156 extern int rtx_to_tree_code (enum rtx_code
);
4159 extern int delete_trivially_dead_insns (rtx_insn
*, int);
4160 extern bool exp_equiv_p (const_rtx
, const_rtx
, int, bool);
4162 typedef bool (*hash_rtx_callback_function
) (const_rtx
, machine_mode
, rtx
*,
4164 extern unsigned hash_rtx (const_rtx
, machine_mode
, int *, int *,
4165 bool, hash_rtx_callback_function
= NULL
);
4168 extern bool check_for_inc_dec (rtx_insn
*insn
);
4171 extern bool comparison_dominates_p (enum rtx_code
, enum rtx_code
);
4172 extern bool jump_to_label_p (const rtx_insn
*);
4173 extern bool condjump_p (const rtx_insn
*);
4174 extern bool any_condjump_p (const rtx_insn
*);
4175 extern bool any_uncondjump_p (const rtx_insn
*);
4176 extern rtx
pc_set (const rtx_insn
*);
4177 extern rtx
condjump_label (const rtx_insn
*);
4178 extern bool simplejump_p (const rtx_insn
*);
4179 extern bool returnjump_p (const rtx_insn
*);
4180 extern bool eh_returnjump_p (rtx_insn
*);
4181 extern bool onlyjump_p (const rtx_insn
*);
4182 extern bool invert_jump_1 (rtx_jump_insn
*, rtx
);
4183 extern bool invert_jump (rtx_jump_insn
*, rtx
, int);
4184 extern bool rtx_renumbered_equal_p (const_rtx
, const_rtx
);
4185 extern int true_regnum (const_rtx
);
4186 extern unsigned int reg_or_subregno (const_rtx
);
4187 extern bool redirect_jump_1 (rtx_insn
*, rtx
);
4188 extern void redirect_jump_2 (rtx_jump_insn
*, rtx
, rtx
, int, int);
4189 extern bool redirect_jump (rtx_jump_insn
*, rtx
, int);
4190 extern void rebuild_jump_labels (rtx_insn
*);
4191 extern void rebuild_jump_labels_chain (rtx_insn
*);
4192 extern rtx
reversed_comparison (const_rtx
, machine_mode
);
4193 extern enum rtx_code
reversed_comparison_code (const_rtx
, const rtx_insn
*);
4194 extern enum rtx_code
reversed_comparison_code_parts (enum rtx_code
, const_rtx
,
4195 const_rtx
, const rtx_insn
*);
4196 extern void delete_for_peephole (rtx_insn
*, rtx_insn
*);
4197 extern bool condjump_in_parallel_p (const rtx_insn
*);
4199 /* In emit-rtl.cc. */
4200 extern int max_reg_num (void);
4201 extern int max_label_num (void);
4202 extern int get_first_label_num (void);
4203 extern void maybe_set_first_label_num (rtx_code_label
*);
4204 extern void delete_insns_since (rtx_insn
*);
4205 extern void mark_reg_pointer (rtx
, int);
4206 extern void mark_user_reg (rtx
);
4207 extern void reset_used_flags (rtx
);
4208 extern void set_used_flags (rtx
);
4209 extern void reorder_insns (rtx_insn
*, rtx_insn
*, rtx_insn
*);
4210 extern void reorder_insns_nobb (rtx_insn
*, rtx_insn
*, rtx_insn
*);
4211 extern int get_max_insn_count (void);
4212 extern bool in_sequence_p (void);
4213 extern void init_emit (void);
4214 extern void init_emit_regs (void);
4215 extern void init_derived_machine_modes (void);
4216 extern void init_emit_once (void);
4217 extern void push_topmost_sequence (void);
4218 extern void pop_topmost_sequence (void);
4219 extern void set_new_first_and_last_insn (rtx_insn
*, rtx_insn
*);
4220 extern void unshare_all_rtl (void);
4221 extern void unshare_all_rtl_again (rtx_insn
*);
4222 extern void unshare_all_rtl_in_chain (rtx_insn
*);
4223 extern void verify_rtl_sharing (void);
4224 extern void add_insn (rtx_insn
*);
4225 extern void add_insn_before (rtx_insn
*, rtx_insn
*, basic_block
);
4226 extern void add_insn_after (rtx_insn
*, rtx_insn
*, basic_block
);
4227 extern void remove_insn (rtx_insn
*);
4228 extern rtx_insn
*emit (rtx
, bool = true);
4229 extern void emit_insn_at_entry (rtx
);
4230 extern rtx
gen_lowpart_SUBREG (machine_mode
, rtx
);
4231 extern rtx
gen_const_mem (machine_mode
, rtx
);
4232 extern rtx
gen_frame_mem (machine_mode
, rtx
);
4233 extern rtx
gen_tmp_stack_mem (machine_mode
, rtx
);
4234 extern bool validate_subreg (machine_mode
, machine_mode
,
4235 const_rtx
, poly_uint64
);
4238 extern unsigned int extended_count (const_rtx
, machine_mode
, bool);
4239 extern rtx
remove_death (unsigned int, rtx_insn
*);
4240 extern rtx
make_compound_operation (rtx
, enum rtx_code
);
4242 /* In sched-rgn.cc. */
4243 extern void schedule_insns (void);
4245 /* In sched-ebb.cc. */
4246 extern void schedule_ebbs (void);
4248 /* In sel-sched-dump.cc. */
4249 extern void sel_sched_fix_param (const char *param
, const char *val
);
4251 /* In print-rtl.cc */
4252 extern const char *print_rtx_head
;
4253 extern void debug (const rtx_def
&ref
);
4254 extern void debug (const rtx_def
*ptr
);
4255 extern void debug_rtx (const_rtx
);
4256 extern void debug_rtx_list (const rtx_insn
*, int);
4257 extern void debug_rtx_range (const rtx_insn
*, const rtx_insn
*);
4258 extern const rtx_insn
*debug_rtx_find (const rtx_insn
*, int);
4259 extern void print_mem_expr (FILE *, const_tree
);
4260 extern void print_rtl (FILE *, const_rtx
);
4261 extern void print_simple_rtl (FILE *, const_rtx
);
4262 extern void print_rtl_single (FILE *, const_rtx
);
4263 extern void print_rtl_single_with_indent (FILE *, const_rtx
, int);
4264 extern void print_inline_rtx (FILE *, const_rtx
, int);
4267 extern void expand_null_return (void);
4268 extern void expand_naked_return (void);
4269 extern void emit_jump (rtx
);
4271 /* Memory operation built-ins differ by return value. Mapping
4272 of the enum values is following:
4273 - RETURN_BEGIN - return destination, e.g. memcpy
4274 - RETURN_END - return destination + n, e.g. mempcpy
4275 - RETURN_END_MINUS_ONE - return a pointer to the terminating
4276 null byte of the string, e.g. strcpy
4283 RETURN_END_MINUS_ONE
4287 extern rtx
move_by_pieces (rtx
, rtx
, unsigned HOST_WIDE_INT
,
4288 unsigned int, memop_ret
);
4289 extern poly_int64
find_args_size_adjust (rtx_insn
*);
4290 extern poly_int64
fixup_args_size_notes (rtx_insn
*, rtx_insn
*, poly_int64
);
4293 extern void init_expmed (void);
4294 extern void expand_inc (rtx
, rtx
);
4295 extern void expand_dec (rtx
, rtx
);
4297 /* In lower-subreg.cc */
4298 extern void init_lower_subreg (void);
4301 extern bool can_copy_p (machine_mode
);
4302 extern bool can_assign_to_reg_without_clobbers_p (rtx
, machine_mode
);
4303 extern rtx_insn
*prepare_copy_insn (rtx
, rtx
);
4306 extern rtx
fis_get_condition (rtx_insn
*);
4309 extern HARD_REG_SET eliminable_regset
;
4310 extern void mark_elimination (int, int);
4313 extern bool reg_classes_intersect_p (reg_class_t
, reg_class_t
);
4314 extern bool reg_class_subset_p (reg_class_t
, reg_class_t
);
4315 extern void globalize_reg (tree
, int);
4316 extern void init_reg_modes_target (void);
4317 extern void init_regs (void);
4318 extern void reinit_regs (void);
4319 extern void init_fake_stack_mems (void);
4320 extern void save_register_info (void);
4321 extern void init_reg_sets (void);
4322 extern void regclass (rtx
, int);
4323 extern void reg_scan (rtx_insn
*, unsigned int);
4324 extern void fix_register (const char *, int, int);
4325 extern const HARD_REG_SET
*valid_mode_changes_for_regno (unsigned int);
4328 extern bool function_invariant_p (const_rtx
);
4338 LCT_RETURNS_TWICE
= 5
4341 extern rtx
emit_library_call_value_1 (int, rtx
, rtx
, enum libcall_type
,
4342 machine_mode
, int, rtx_mode_t
*);
4344 /* Output a library call and discard the returned value. FUN is the
4345 address of the function, as a SYMBOL_REF rtx, and OUTMODE is the mode
4346 of the (discarded) return value. FN_TYPE is LCT_NORMAL for `normal'
4347 calls, LCT_CONST for `const' calls, LCT_PURE for `pure' calls, or
4348 another LCT_ value for other types of library calls.
4350 There are different overloads of this function for different numbers
4351 of arguments. In each case the argument value is followed by its mode. */
4354 emit_library_call (rtx fun
, libcall_type fn_type
, machine_mode outmode
)
4356 emit_library_call_value_1 (0, fun
, NULL_RTX
, fn_type
, outmode
, 0, NULL
);
4360 emit_library_call (rtx fun
, libcall_type fn_type
, machine_mode outmode
,
4361 rtx arg1
, machine_mode arg1_mode
)
4363 rtx_mode_t args
[] = { rtx_mode_t (arg1
, arg1_mode
) };
4364 emit_library_call_value_1 (0, fun
, NULL_RTX
, fn_type
, outmode
, 1, args
);
4368 emit_library_call (rtx fun
, libcall_type fn_type
, machine_mode outmode
,
4369 rtx arg1
, machine_mode arg1_mode
,
4370 rtx arg2
, machine_mode arg2_mode
)
4372 rtx_mode_t args
[] = {
4373 rtx_mode_t (arg1
, arg1_mode
),
4374 rtx_mode_t (arg2
, arg2_mode
)
4376 emit_library_call_value_1 (0, fun
, NULL_RTX
, fn_type
, outmode
, 2, args
);
4380 emit_library_call (rtx fun
, libcall_type fn_type
, machine_mode outmode
,
4381 rtx arg1
, machine_mode arg1_mode
,
4382 rtx arg2
, machine_mode arg2_mode
,
4383 rtx arg3
, machine_mode arg3_mode
)
4385 rtx_mode_t args
[] = {
4386 rtx_mode_t (arg1
, arg1_mode
),
4387 rtx_mode_t (arg2
, arg2_mode
),
4388 rtx_mode_t (arg3
, arg3_mode
)
4390 emit_library_call_value_1 (0, fun
, NULL_RTX
, fn_type
, outmode
, 3, args
);
4394 emit_library_call (rtx fun
, libcall_type fn_type
, machine_mode outmode
,
4395 rtx arg1
, machine_mode arg1_mode
,
4396 rtx arg2
, machine_mode arg2_mode
,
4397 rtx arg3
, machine_mode arg3_mode
,
4398 rtx arg4
, machine_mode arg4_mode
)
4400 rtx_mode_t args
[] = {
4401 rtx_mode_t (arg1
, arg1_mode
),
4402 rtx_mode_t (arg2
, arg2_mode
),
4403 rtx_mode_t (arg3
, arg3_mode
),
4404 rtx_mode_t (arg4
, arg4_mode
)
4406 emit_library_call_value_1 (0, fun
, NULL_RTX
, fn_type
, outmode
, 4, args
);
4409 /* Like emit_library_call, but return the value produced by the call.
4410 Use VALUE to store the result if it is nonnull, otherwise pick a
4411 convenient location. */
4414 emit_library_call_value (rtx fun
, rtx value
, libcall_type fn_type
,
4415 machine_mode outmode
)
4417 return emit_library_call_value_1 (1, fun
, value
, fn_type
, outmode
, 0, NULL
);
4421 emit_library_call_value (rtx fun
, rtx value
, libcall_type fn_type
,
4422 machine_mode outmode
,
4423 rtx arg1
, machine_mode arg1_mode
)
4425 rtx_mode_t args
[] = { rtx_mode_t (arg1
, arg1_mode
) };
4426 return emit_library_call_value_1 (1, fun
, value
, fn_type
, outmode
, 1, args
);
4430 emit_library_call_value (rtx fun
, rtx value
, libcall_type fn_type
,
4431 machine_mode outmode
,
4432 rtx arg1
, machine_mode arg1_mode
,
4433 rtx arg2
, machine_mode arg2_mode
)
4435 rtx_mode_t args
[] = {
4436 rtx_mode_t (arg1
, arg1_mode
),
4437 rtx_mode_t (arg2
, arg2_mode
)
4439 return emit_library_call_value_1 (1, fun
, value
, fn_type
, outmode
, 2, args
);
4443 emit_library_call_value (rtx fun
, rtx value
, libcall_type fn_type
,
4444 machine_mode outmode
,
4445 rtx arg1
, machine_mode arg1_mode
,
4446 rtx arg2
, machine_mode arg2_mode
,
4447 rtx arg3
, machine_mode arg3_mode
)
4449 rtx_mode_t args
[] = {
4450 rtx_mode_t (arg1
, arg1_mode
),
4451 rtx_mode_t (arg2
, arg2_mode
),
4452 rtx_mode_t (arg3
, arg3_mode
)
4454 return emit_library_call_value_1 (1, fun
, value
, fn_type
, outmode
, 3, args
);
4458 emit_library_call_value (rtx fun
, rtx value
, libcall_type fn_type
,
4459 machine_mode outmode
,
4460 rtx arg1
, machine_mode arg1_mode
,
4461 rtx arg2
, machine_mode arg2_mode
,
4462 rtx arg3
, machine_mode arg3_mode
,
4463 rtx arg4
, machine_mode arg4_mode
)
4465 rtx_mode_t args
[] = {
4466 rtx_mode_t (arg1
, arg1_mode
),
4467 rtx_mode_t (arg2
, arg2_mode
),
4468 rtx_mode_t (arg3
, arg3_mode
),
4469 rtx_mode_t (arg4
, arg4_mode
)
4471 return emit_library_call_value_1 (1, fun
, value
, fn_type
, outmode
, 4, args
);
4475 extern void init_varasm_once (void);
4477 extern rtx
make_debug_expr_from_rtl (const_rtx
);
4479 /* In read-rtl.cc */
4480 #ifdef GENERATOR_FILE
4481 extern bool read_rtx (const char *, vec
<rtx
> *);
4485 extern rtx
canon_rtx (rtx
);
4486 extern rtx
get_addr (rtx
);
4487 extern bool read_dependence (const_rtx
, const_rtx
);
4488 extern bool true_dependence (const_rtx
, machine_mode
, const_rtx
);
4489 extern bool canon_true_dependence (const_rtx
, machine_mode
, rtx
,
4491 extern bool anti_dependence (const_rtx
, const_rtx
);
4492 extern bool canon_anti_dependence (const_rtx
, bool,
4493 const_rtx
, machine_mode
, rtx
);
4494 extern bool output_dependence (const_rtx
, const_rtx
);
4495 extern bool canon_output_dependence (const_rtx
, bool,
4496 const_rtx
, machine_mode
, rtx
);
4497 extern bool may_alias_p (const_rtx
, const_rtx
);
4498 extern void init_alias_target (void);
4499 extern void init_alias_analysis (void);
4500 extern void end_alias_analysis (void);
4501 extern void vt_equate_reg_base_value (const_rtx
, const_rtx
);
4502 extern bool memory_modified_in_insn_p (const_rtx
, const_rtx
);
4503 extern bool may_be_sp_based_p (rtx
);
4504 extern rtx
gen_hard_reg_clobber (machine_mode
, unsigned int);
4505 extern rtx
get_reg_known_value (unsigned int);
4506 extern bool get_reg_known_equiv_p (unsigned int);
4507 extern rtx
get_reg_base_value (unsigned int);
4508 extern rtx
extract_mem_from_operand (rtx
);
4511 extern bool stack_regs_mentioned (const_rtx insn
);
4515 extern GTY(()) rtx stack_limit_rtx
;
4517 /* In var-tracking.cc */
4518 extern unsigned int variable_tracking_main (void);
4519 extern void delete_vta_debug_insns (bool);
4521 /* In stor-layout.cc. */
4522 extern void get_mode_bounds (scalar_int_mode
, int,
4523 scalar_int_mode
, rtx
*, rtx
*);
4526 extern rtx
canon_condition (rtx
);
4527 extern void simplify_using_condition (rtx
, rtx
*, bitmap
);
4530 extern void compute_alignments (void);
4531 extern void update_alignments (vec
<rtx
> &);
4532 extern int asm_str_count (const char *templ
);
4536 rtx (*gen_lowpart
) (machine_mode
, rtx
);
4537 rtx (*gen_lowpart_no_emit
) (machine_mode
, rtx
);
4538 rtx (*reg_nonzero_bits
) (const_rtx
, scalar_int_mode
, scalar_int_mode
,
4539 unsigned HOST_WIDE_INT
*);
4540 rtx (*reg_num_sign_bit_copies
) (const_rtx
, scalar_int_mode
, scalar_int_mode
,
4542 bool (*reg_truncated_to_mode
) (machine_mode
, const_rtx
);
4544 /* Whenever you add entries here, make sure you adjust rtlhooks-def.h. */
4547 /* Each pass can provide its own. */
4548 extern struct rtl_hooks rtl_hooks
;
4550 /* ... but then it has to restore these. */
4551 extern const struct rtl_hooks general_rtl_hooks
;
4553 /* Keep this for the nonce. */
4554 #define gen_lowpart rtl_hooks.gen_lowpart
4556 extern void insn_locations_init (void);
4557 extern void insn_locations_finalize (void);
4558 extern void set_curr_insn_location (location_t
);
4559 extern location_t
curr_insn_location (void);
4560 extern void set_insn_locations (rtx_insn
*, location_t
);
4563 extern void _fatal_insn_not_found (const_rtx
, const char *, int, const char *)
4564 ATTRIBUTE_NORETURN ATTRIBUTE_COLD
;
4565 extern void _fatal_insn (const char *, const_rtx
, const char *, int, const char *)
4566 ATTRIBUTE_NORETURN ATTRIBUTE_COLD
;
4568 #define fatal_insn(msgid, insn) \
4569 _fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__)
4570 #define fatal_insn_not_found(insn) \
4571 _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__)
4574 extern tree
GTY(()) global_regs_decl
[FIRST_PSEUDO_REGISTER
];
4576 /* Information about the function that is propagated by the RTL backend.
4577 Available only for functions that has been already assembled. */
4579 struct GTY(()) cgraph_rtl_info
{
4580 unsigned int preferred_incoming_stack_boundary
;
4582 /* Which registers the function clobbers, either directly or by
4583 calling another function. */
4584 HARD_REG_SET function_used_regs
;
4587 /* If loads from memories of mode MODE always sign or zero extend,
4588 return SIGN_EXTEND or ZERO_EXTEND as appropriate. Return UNKNOWN
4592 load_extend_op (machine_mode mode
)
4594 scalar_int_mode int_mode
;
4595 if (is_a
<scalar_int_mode
> (mode
, &int_mode
)
4596 && GET_MODE_PRECISION (int_mode
) < BITS_PER_WORD
)
4597 return LOAD_EXTEND_OP (int_mode
);
4601 /* If X is a PLUS of a base and a constant offset, add the constant to *OFFSET
4602 and return the base. Return X otherwise. */
4605 strip_offset_and_add (rtx x
, poly_int64
*offset
)
4607 if (GET_CODE (x
) == PLUS
)
4609 poly_int64 suboffset
;
4610 x
= strip_offset (x
, &suboffset
);
4611 *offset
= poly_uint64 (*offset
) + suboffset
;
4616 /* Return true if X is an operation that always operates on the full
4617 registers for WORD_REGISTER_OPERATIONS architectures. */
4620 word_register_operation_p (const_rtx x
)
4622 switch (GET_CODE (x
))
4636 /* Holds an rtx comparison to simplify passing many parameters pertaining to a
4637 single comparison. */
4639 struct rtx_comparison
{
4645 /* gtype-desc.cc. */
4646 extern void gt_ggc_mx (rtx
&);
4647 extern void gt_pch_nx (rtx
&);
4648 extern void gt_pch_nx (rtx
&, gt_pointer_operator
, void *);
4650 #endif /* ! GCC_RTL_H */