poly_int: MEM_OFFSET and MEM_SIZE
[official-gcc.git] / gcc / rtl.h
blob408298a8f7ad26d72742e3466d2f214aa41570f6
1 /* Register Transfer Language (RTL) definitions for GCC
2 Copyright (C) 1987-2017 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_RTL_H
21 #define GCC_RTL_H
23 /* 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. */
26 #ifdef GENERATOR_FILE
27 #include "real.h"
28 #include "fixed-value.h"
29 #include "statistics.h"
30 #include "vec.h"
31 #include "hash-table.h"
32 #include "hash-set.h"
33 #include "input.h"
34 #include "is-a.h"
35 #endif /* GENERATOR_FILE */
37 #include "hard-reg-set.h"
39 /* Value used by some passes to "recognize" noop moves as valid
40 instructions. */
41 #define NOOP_MOVE_INSN_CODE INT_MAX
43 /* Register Transfer Language EXPRESSIONS CODES */
45 #define RTX_CODE enum rtx_code
46 enum rtx_code {
48 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) ENUM ,
49 #include "rtl.def" /* rtl expressions are documented here */
50 #undef DEF_RTL_EXPR
52 LAST_AND_UNUSED_RTX_CODE}; /* A convenient way to get a value for
53 NUM_RTX_CODE.
54 Assumes default enum value assignment. */
56 /* The cast here, saves many elsewhere. */
57 #define NUM_RTX_CODE ((int) LAST_AND_UNUSED_RTX_CODE)
59 /* Similar, but since generator files get more entries... */
60 #ifdef GENERATOR_FILE
61 # define NON_GENERATOR_NUM_RTX_CODE ((int) MATCH_OPERAND)
62 #endif
64 /* Register Transfer Language EXPRESSIONS CODE CLASSES */
66 enum rtx_class {
67 /* We check bit 0-1 of some rtx class codes in the predicates below. */
69 /* Bit 0 = comparison if 0, arithmetic is 1
70 Bit 1 = 1 if commutative. */
71 RTX_COMPARE, /* 0 */
72 RTX_COMM_COMPARE,
73 RTX_BIN_ARITH,
74 RTX_COMM_ARITH,
76 /* Must follow the four preceding values. */
77 RTX_UNARY, /* 4 */
79 RTX_EXTRA,
80 RTX_MATCH,
81 RTX_INSN,
83 /* Bit 0 = 1 if constant. */
84 RTX_OBJ, /* 8 */
85 RTX_CONST_OBJ,
87 RTX_TERNARY,
88 RTX_BITFIELD_OPS,
89 RTX_AUTOINC
92 #define RTX_OBJ_MASK (~1)
93 #define RTX_OBJ_RESULT (RTX_OBJ & RTX_OBJ_MASK)
94 #define RTX_COMPARE_MASK (~1)
95 #define RTX_COMPARE_RESULT (RTX_COMPARE & RTX_COMPARE_MASK)
96 #define RTX_ARITHMETIC_MASK (~1)
97 #define RTX_ARITHMETIC_RESULT (RTX_COMM_ARITH & RTX_ARITHMETIC_MASK)
98 #define RTX_BINARY_MASK (~3)
99 #define RTX_BINARY_RESULT (RTX_COMPARE & RTX_BINARY_MASK)
100 #define RTX_COMMUTATIVE_MASK (~2)
101 #define RTX_COMMUTATIVE_RESULT (RTX_COMM_COMPARE & RTX_COMMUTATIVE_MASK)
102 #define RTX_NON_COMMUTATIVE_RESULT (RTX_COMPARE & RTX_COMMUTATIVE_MASK)
104 extern const unsigned char rtx_length[NUM_RTX_CODE];
105 #define GET_RTX_LENGTH(CODE) (rtx_length[(int) (CODE)])
107 extern const char * const rtx_name[NUM_RTX_CODE];
108 #define GET_RTX_NAME(CODE) (rtx_name[(int) (CODE)])
110 extern const char * const rtx_format[NUM_RTX_CODE];
111 #define GET_RTX_FORMAT(CODE) (rtx_format[(int) (CODE)])
113 extern const enum rtx_class rtx_class[NUM_RTX_CODE];
114 #define GET_RTX_CLASS(CODE) (rtx_class[(int) (CODE)])
116 /* True if CODE is part of the insn chain (i.e. has INSN_UID, PREV_INSN
117 and NEXT_INSN fields). */
118 #define INSN_CHAIN_CODE_P(CODE) IN_RANGE (CODE, DEBUG_INSN, NOTE)
120 extern const unsigned char rtx_code_size[NUM_RTX_CODE];
121 extern const unsigned char rtx_next[NUM_RTX_CODE];
123 /* The flags and bitfields of an ADDR_DIFF_VEC. BASE is the base label
124 relative to which the offsets are calculated, as explained in rtl.def. */
125 struct addr_diff_vec_flags
127 /* Set at the start of shorten_branches - ONLY WHEN OPTIMIZING - : */
128 unsigned min_align: 8;
129 /* Flags: */
130 unsigned base_after_vec: 1; /* BASE is after the ADDR_DIFF_VEC. */
131 unsigned min_after_vec: 1; /* minimum address target label is
132 after the ADDR_DIFF_VEC. */
133 unsigned max_after_vec: 1; /* maximum address target label is
134 after the ADDR_DIFF_VEC. */
135 unsigned min_after_base: 1; /* minimum address target label is
136 after BASE. */
137 unsigned max_after_base: 1; /* maximum address target label is
138 after BASE. */
139 /* Set by the actual branch shortening process - ONLY WHEN OPTIMIZING - : */
140 unsigned offset_unsigned: 1; /* offsets have to be treated as unsigned. */
141 unsigned : 2;
142 unsigned scale : 8;
145 /* Structure used to describe the attributes of a MEM. These are hashed
146 so MEMs that the same attributes share a data structure. This means
147 they cannot be modified in place. */
148 struct GTY(()) mem_attrs
150 mem_attrs ();
152 /* The expression that the MEM accesses, or null if not known.
153 This expression might be larger than the memory reference itself.
154 (In other words, the MEM might access only part of the object.) */
155 tree expr;
157 /* The offset of the memory reference from the start of EXPR.
158 Only valid if OFFSET_KNOWN_P. */
159 poly_int64 offset;
161 /* The size of the memory reference in bytes. Only valid if
162 SIZE_KNOWN_P. */
163 poly_int64 size;
165 /* The alias set of the memory reference. */
166 alias_set_type alias;
168 /* The alignment of the reference in bits. Always a multiple of
169 BITS_PER_UNIT. Note that EXPR may have a stricter alignment
170 than the memory reference itself. */
171 unsigned int align;
173 /* The address space that the memory reference uses. */
174 unsigned char addrspace;
176 /* True if OFFSET is known. */
177 bool offset_known_p;
179 /* True if SIZE is known. */
180 bool size_known_p;
183 /* Structure used to describe the attributes of a REG in similar way as
184 mem_attrs does for MEM above. Note that the OFFSET field is calculated
185 in the same way as for mem_attrs, rather than in the same way as a
186 SUBREG_BYTE. For example, if a big-endian target stores a byte
187 object in the low part of a 4-byte register, the OFFSET field
188 will be -3 rather than 0. */
190 struct GTY((for_user)) reg_attrs {
191 tree decl; /* decl corresponding to REG. */
192 poly_int64 offset; /* Offset from start of DECL. */
195 /* Common union for an element of an rtx. */
197 union rtunion
199 int rt_int;
200 unsigned int rt_uint;
201 const char *rt_str;
202 rtx rt_rtx;
203 rtvec rt_rtvec;
204 machine_mode rt_type;
205 addr_diff_vec_flags rt_addr_diff_vec_flags;
206 struct cselib_val *rt_cselib;
207 tree rt_tree;
208 basic_block rt_bb;
209 mem_attrs *rt_mem;
210 struct constant_descriptor_rtx *rt_constant;
211 struct dw_cfi_node *rt_cfi;
214 /* Describes the properties of a REG. */
215 struct GTY(()) reg_info {
216 /* The value of REGNO. */
217 unsigned int regno;
219 /* The value of REG_NREGS. */
220 unsigned int nregs : 8;
221 unsigned int unused : 24;
223 /* The value of REG_ATTRS. */
224 reg_attrs *attrs;
227 /* This structure remembers the position of a SYMBOL_REF within an
228 object_block structure. A SYMBOL_REF only provides this information
229 if SYMBOL_REF_HAS_BLOCK_INFO_P is true. */
230 struct GTY(()) block_symbol {
231 /* The usual SYMBOL_REF fields. */
232 rtunion GTY ((skip)) fld[2];
234 /* The block that contains this object. */
235 struct object_block *block;
237 /* The offset of this object from the start of its block. It is negative
238 if the symbol has not yet been assigned an offset. */
239 HOST_WIDE_INT offset;
242 /* Describes a group of objects that are to be placed together in such
243 a way that their relative positions are known. */
244 struct GTY((for_user)) object_block {
245 /* The section in which these objects should be placed. */
246 section *sect;
248 /* The alignment of the first object, measured in bits. */
249 unsigned int alignment;
251 /* The total size of the objects, measured in bytes. */
252 HOST_WIDE_INT size;
254 /* The SYMBOL_REFs for each object. The vector is sorted in
255 order of increasing offset and the following conditions will
256 hold for each element X:
258 SYMBOL_REF_HAS_BLOCK_INFO_P (X)
259 !SYMBOL_REF_ANCHOR_P (X)
260 SYMBOL_REF_BLOCK (X) == [address of this structure]
261 SYMBOL_REF_BLOCK_OFFSET (X) >= 0. */
262 vec<rtx, va_gc> *objects;
264 /* All the anchor SYMBOL_REFs used to address these objects, sorted
265 in order of increasing offset, and then increasing TLS model.
266 The following conditions will hold for each element X in this vector:
268 SYMBOL_REF_HAS_BLOCK_INFO_P (X)
269 SYMBOL_REF_ANCHOR_P (X)
270 SYMBOL_REF_BLOCK (X) == [address of this structure]
271 SYMBOL_REF_BLOCK_OFFSET (X) >= 0. */
272 vec<rtx, va_gc> *anchors;
275 struct GTY((variable_size)) hwivec_def {
276 HOST_WIDE_INT elem[1];
279 /* Number of elements of the HWIVEC if RTX is a CONST_WIDE_INT. */
280 #define CWI_GET_NUM_ELEM(RTX) \
281 ((int)RTL_FLAG_CHECK1("CWI_GET_NUM_ELEM", (RTX), CONST_WIDE_INT)->u2.num_elem)
282 #define CWI_PUT_NUM_ELEM(RTX, NUM) \
283 (RTL_FLAG_CHECK1("CWI_PUT_NUM_ELEM", (RTX), CONST_WIDE_INT)->u2.num_elem = (NUM))
285 struct GTY((variable_size)) const_poly_int_def {
286 trailing_wide_ints<NUM_POLY_INT_COEFFS> coeffs;
289 /* RTL expression ("rtx"). */
291 /* The GTY "desc" and "tag" options below are a kludge: we need a desc
292 field for gengtype to recognize that inheritance is occurring,
293 so that all subclasses are redirected to the traversal hook for the
294 base class.
295 However, all of the fields are in the base class, and special-casing
296 is at work. Hence we use desc and tag of 0, generating a switch
297 statement of the form:
298 switch (0)
300 case 0: // all the work happens here
302 in order to work with the existing special-casing in gengtype. */
304 struct GTY((desc("0"), tag("0"),
305 chain_next ("RTX_NEXT (&%h)"),
306 chain_prev ("RTX_PREV (&%h)"))) rtx_def {
307 /* The kind of expression this is. */
308 ENUM_BITFIELD(rtx_code) code: 16;
310 /* The kind of value the expression has. */
311 ENUM_BITFIELD(machine_mode) mode : 8;
313 /* 1 in a MEM if we should keep the alias set for this mem unchanged
314 when we access a component.
315 1 in a JUMP_INSN if it is a crossing jump.
316 1 in a CALL_INSN if it is a sibling call.
317 1 in a SET that is for a return.
318 In a CODE_LABEL, part of the two-bit alternate entry field.
319 1 in a CONCAT is VAL_EXPR_IS_COPIED in var-tracking.c.
320 1 in a VALUE is SP_BASED_VALUE_P in cselib.c.
321 1 in a SUBREG generated by LRA for reload insns.
322 1 in a REG if this is a static chain register.
323 1 in a CALL for calls instrumented by Pointer Bounds Checker.
324 Dumped as "/j" in RTL dumps. */
325 unsigned int jump : 1;
326 /* In a CODE_LABEL, part of the two-bit alternate entry field.
327 1 in a MEM if it cannot trap.
328 1 in a CALL_INSN logically equivalent to
329 ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P.
330 Dumped as "/c" in RTL dumps. */
331 unsigned int call : 1;
332 /* 1 in a REG, MEM, or CONCAT if the value is set at most once, anywhere.
333 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P.
334 1 in a SYMBOL_REF if it addresses something in the per-function
335 constants pool.
336 1 in a CALL_INSN logically equivalent to ECF_CONST and TREE_READONLY.
337 1 in a NOTE, or EXPR_LIST for a const call.
338 1 in a JUMP_INSN of an annulling branch.
339 1 in a CONCAT is VAL_EXPR_IS_CLOBBERED in var-tracking.c.
340 1 in a preserved VALUE is PRESERVED_VALUE_P in cselib.c.
341 1 in a clobber temporarily created for LRA.
342 Dumped as "/u" in RTL dumps. */
343 unsigned int unchanging : 1;
344 /* 1 in a MEM or ASM_OPERANDS expression if the memory reference is volatile.
345 1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL, BARRIER, or NOTE
346 if it has been deleted.
347 1 in a REG expression if corresponds to a variable declared by the user,
348 0 for an internally generated temporary.
349 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P.
350 1 in a LABEL_REF, REG_LABEL_TARGET or REG_LABEL_OPERAND note for a
351 non-local label.
352 In a SYMBOL_REF, this flag is used for machine-specific purposes.
353 In a PREFETCH, this flag indicates that it should be considered a
354 scheduling barrier.
355 1 in a CONCAT is VAL_NEEDS_RESOLUTION in var-tracking.c.
356 Dumped as "/v" in RTL dumps. */
357 unsigned int volatil : 1;
358 /* 1 in a REG if the register is used only in exit code a loop.
359 1 in a SUBREG expression if was generated from a variable with a
360 promoted mode.
361 1 in a CODE_LABEL if the label is used for nonlocal gotos
362 and must not be deleted even if its count is zero.
363 1 in an INSN, JUMP_INSN or CALL_INSN if this insn must be scheduled
364 together with the preceding insn. Valid only within sched.
365 1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and
366 from the target of a branch. Valid from reorg until end of compilation;
367 cleared before used.
369 The name of the field is historical. It used to be used in MEMs
370 to record whether the MEM accessed part of a structure.
371 Dumped as "/s" in RTL dumps. */
372 unsigned int in_struct : 1;
373 /* At the end of RTL generation, 1 if this rtx is used. This is used for
374 copying shared structure. See `unshare_all_rtl'.
375 In a REG, this is not needed for that purpose, and used instead
376 in `leaf_renumber_regs_insn'.
377 1 in a SYMBOL_REF, means that emit_library_call
378 has used it as the function.
379 1 in a CONCAT is VAL_HOLDS_TRACK_EXPR in var-tracking.c.
380 1 in a VALUE or DEBUG_EXPR is VALUE_RECURSED_INTO in var-tracking.c. */
381 unsigned int used : 1;
382 /* 1 in an INSN or a SET if this rtx is related to the call frame,
383 either changing how we compute the frame address or saving and
384 restoring registers in the prologue and epilogue.
385 1 in a REG or MEM if it is a pointer.
386 1 in a SYMBOL_REF if it addresses something in the per-function
387 constant string pool.
388 1 in a VALUE is VALUE_CHANGED in var-tracking.c.
389 Dumped as "/f" in RTL dumps. */
390 unsigned frame_related : 1;
391 /* 1 in a REG or PARALLEL that is the current function's return value.
392 1 in a SYMBOL_REF for a weak symbol.
393 1 in a CALL_INSN logically equivalent to ECF_PURE and DECL_PURE_P.
394 1 in a CONCAT is VAL_EXPR_HAS_REVERSE in var-tracking.c.
395 1 in a VALUE or DEBUG_EXPR is NO_LOC_P in var-tracking.c.
396 Dumped as "/i" in RTL dumps. */
397 unsigned return_val : 1;
399 union {
400 /* The final union field is aligned to 64 bits on LP64 hosts,
401 giving a 32-bit gap after the fields above. We optimize the
402 layout for that case and use the gap for extra code-specific
403 information. */
405 /* The ORIGINAL_REGNO of a REG. */
406 unsigned int original_regno;
408 /* The INSN_UID of an RTX_INSN-class code. */
409 int insn_uid;
411 /* The SYMBOL_REF_FLAGS of a SYMBOL_REF. */
412 unsigned int symbol_ref_flags;
414 /* The PAT_VAR_LOCATION_STATUS of a VAR_LOCATION. */
415 enum var_init_status var_location_status;
417 /* In a CONST_WIDE_INT (aka hwivec_def), this is the number of
418 HOST_WIDE_INTs in the hwivec_def. */
419 unsigned int num_elem;
420 } GTY ((skip)) u2;
422 /* The first element of the operands of this rtx.
423 The number of operands and their types are controlled
424 by the `code' field, according to rtl.def. */
425 union u {
426 rtunion fld[1];
427 HOST_WIDE_INT hwint[1];
428 struct reg_info reg;
429 struct block_symbol block_sym;
430 struct real_value rv;
431 struct fixed_value fv;
432 struct hwivec_def hwiv;
433 struct const_poly_int_def cpi;
434 } GTY ((special ("rtx_def"), desc ("GET_CODE (&%0)"))) u;
437 /* A node for constructing singly-linked lists of rtx. */
439 class GTY(()) rtx_expr_list : public rtx_def
441 /* No extra fields, but adds invariant: (GET_CODE (X) == EXPR_LIST). */
443 public:
444 /* Get next in list. */
445 rtx_expr_list *next () const;
447 /* Get at the underlying rtx. */
448 rtx element () const;
451 template <>
452 template <>
453 inline bool
454 is_a_helper <rtx_expr_list *>::test (rtx rt)
456 return rt->code == EXPR_LIST;
459 class GTY(()) rtx_insn_list : public rtx_def
461 /* No extra fields, but adds invariant: (GET_CODE (X) == INSN_LIST).
463 This is an instance of:
465 DEF_RTL_EXPR(INSN_LIST, "insn_list", "ue", RTX_EXTRA)
467 i.e. a node for constructing singly-linked lists of rtx_insn *, where
468 the list is "external" to the insn (as opposed to the doubly-linked
469 list embedded within rtx_insn itself). */
471 public:
472 /* Get next in list. */
473 rtx_insn_list *next () const;
475 /* Get at the underlying instruction. */
476 rtx_insn *insn () const;
480 template <>
481 template <>
482 inline bool
483 is_a_helper <rtx_insn_list *>::test (rtx rt)
485 return rt->code == INSN_LIST;
488 /* A node with invariant GET_CODE (X) == SEQUENCE i.e. a vector of rtx,
489 typically (but not always) of rtx_insn *, used in the late passes. */
491 class GTY(()) rtx_sequence : public rtx_def
493 /* No extra fields, but adds invariant: (GET_CODE (X) == SEQUENCE). */
495 public:
496 /* Get number of elements in sequence. */
497 int len () const;
499 /* Get i-th element of the sequence. */
500 rtx element (int index) const;
502 /* Get i-th element of the sequence, with a checked cast to
503 rtx_insn *. */
504 rtx_insn *insn (int index) const;
507 template <>
508 template <>
509 inline bool
510 is_a_helper <rtx_sequence *>::test (rtx rt)
512 return rt->code == SEQUENCE;
515 template <>
516 template <>
517 inline bool
518 is_a_helper <const rtx_sequence *>::test (const_rtx rt)
520 return rt->code == SEQUENCE;
523 class GTY(()) rtx_insn : public rtx_def
525 public:
526 /* No extra fields, but adds the invariant:
528 (INSN_P (X)
529 || NOTE_P (X)
530 || JUMP_TABLE_DATA_P (X)
531 || BARRIER_P (X)
532 || LABEL_P (X))
534 i.e. that we must be able to use the following:
535 INSN_UID ()
536 NEXT_INSN ()
537 PREV_INSN ()
538 i.e. we have an rtx that has an INSN_UID field and can be part of
539 a linked list of insns.
542 /* Returns true if this insn has been deleted. */
544 bool deleted () const { return volatil; }
546 /* Mark this insn as deleted. */
548 void set_deleted () { volatil = true; }
550 /* Mark this insn as not deleted. */
552 void set_undeleted () { volatil = false; }
555 /* Subclasses of rtx_insn. */
557 class GTY(()) rtx_debug_insn : public rtx_insn
559 /* No extra fields, but adds the invariant:
560 DEBUG_INSN_P (X) aka (GET_CODE (X) == DEBUG_INSN)
561 i.e. an annotation for tracking variable assignments.
563 This is an instance of:
564 DEF_RTL_EXPR(DEBUG_INSN, "debug_insn", "uuBeiie", RTX_INSN)
565 from rtl.def. */
568 class GTY(()) rtx_nonjump_insn : public rtx_insn
570 /* No extra fields, but adds the invariant:
571 NONJUMP_INSN_P (X) aka (GET_CODE (X) == INSN)
572 i.e an instruction that cannot jump.
574 This is an instance of:
575 DEF_RTL_EXPR(INSN, "insn", "uuBeiie", RTX_INSN)
576 from rtl.def. */
579 class GTY(()) rtx_jump_insn : public rtx_insn
581 public:
582 /* No extra fields, but adds the invariant:
583 JUMP_P (X) aka (GET_CODE (X) == JUMP_INSN)
584 i.e. an instruction that can possibly jump.
586 This is an instance of:
587 DEF_RTL_EXPR(JUMP_INSN, "jump_insn", "uuBeiie0", RTX_INSN)
588 from rtl.def. */
590 /* Returns jump target of this instruction. The returned value is not
591 necessarily a code label: it may also be a RETURN or SIMPLE_RETURN
592 expression. Also, when the code label is marked "deleted", it is
593 replaced by a NOTE. In some cases the value is NULL_RTX. */
595 inline rtx jump_label () const;
597 /* Returns jump target cast to rtx_code_label *. */
599 inline rtx_code_label *jump_target () const;
601 /* Set jump target. */
603 inline void set_jump_target (rtx_code_label *);
606 class GTY(()) rtx_call_insn : public rtx_insn
608 /* No extra fields, but adds the invariant:
609 CALL_P (X) aka (GET_CODE (X) == CALL_INSN)
610 i.e. an instruction that can possibly call a subroutine
611 but which will not change which instruction comes next
612 in the current function.
614 This is an instance of:
615 DEF_RTL_EXPR(CALL_INSN, "call_insn", "uuBeiiee", RTX_INSN)
616 from rtl.def. */
619 class GTY(()) rtx_jump_table_data : public rtx_insn
621 /* No extra fields, but adds the invariant:
622 JUMP_TABLE_DATA_P (X) aka (GET_CODE (INSN) == JUMP_TABLE_DATA)
623 i.e. a data for a jump table, considered an instruction for
624 historical reasons.
626 This is an instance of:
627 DEF_RTL_EXPR(JUMP_TABLE_DATA, "jump_table_data", "uuBe0000", RTX_INSN)
628 from rtl.def. */
630 public:
632 /* This can be either:
634 (a) a table of absolute jumps, in which case PATTERN (this) is an
635 ADDR_VEC with arg 0 a vector of labels, or
637 (b) a table of relative jumps (e.g. for -fPIC), in which case
638 PATTERN (this) is an ADDR_DIFF_VEC, with arg 0 a LABEL_REF and
639 arg 1 the vector of labels.
641 This method gets the underlying vec. */
643 inline rtvec get_labels () const;
644 inline scalar_int_mode get_data_mode () const;
647 class GTY(()) rtx_barrier : public rtx_insn
649 /* No extra fields, but adds the invariant:
650 BARRIER_P (X) aka (GET_CODE (X) == BARRIER)
651 i.e. a marker that indicates that control will not flow through.
653 This is an instance of:
654 DEF_RTL_EXPR(BARRIER, "barrier", "uu00000", RTX_EXTRA)
655 from rtl.def. */
658 class GTY(()) rtx_code_label : public rtx_insn
660 /* No extra fields, but adds the invariant:
661 LABEL_P (X) aka (GET_CODE (X) == CODE_LABEL)
662 i.e. a label in the assembler.
664 This is an instance of:
665 DEF_RTL_EXPR(CODE_LABEL, "code_label", "uuB00is", RTX_EXTRA)
666 from rtl.def. */
669 class GTY(()) rtx_note : public rtx_insn
671 /* No extra fields, but adds the invariant:
672 NOTE_P(X) aka (GET_CODE (X) == NOTE)
673 i.e. a note about the corresponding source code.
675 This is an instance of:
676 DEF_RTL_EXPR(NOTE, "note", "uuB0ni", RTX_EXTRA)
677 from rtl.def. */
680 /* The size in bytes of an rtx header (code, mode and flags). */
681 #define RTX_HDR_SIZE offsetof (struct rtx_def, u)
683 /* The size in bytes of an rtx with code CODE. */
684 #define RTX_CODE_SIZE(CODE) rtx_code_size[CODE]
686 #define NULL_RTX (rtx) 0
688 /* The "next" and "previous" RTX, relative to this one. */
690 #define RTX_NEXT(X) (rtx_next[GET_CODE (X)] == 0 ? NULL \
691 : *(rtx *)(((char *)X) + rtx_next[GET_CODE (X)]))
693 /* FIXME: the "NEXT_INSN (PREV_INSN (X)) == X" condition shouldn't be needed.
695 #define RTX_PREV(X) ((INSN_P (X) \
696 || NOTE_P (X) \
697 || JUMP_TABLE_DATA_P (X) \
698 || BARRIER_P (X) \
699 || LABEL_P (X)) \
700 && PREV_INSN (as_a <rtx_insn *> (X)) != NULL \
701 && NEXT_INSN (PREV_INSN (as_a <rtx_insn *> (X))) == X \
702 ? PREV_INSN (as_a <rtx_insn *> (X)) : NULL)
704 /* Define macros to access the `code' field of the rtx. */
706 #define GET_CODE(RTX) ((enum rtx_code) (RTX)->code)
707 #define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE))
709 #define GET_MODE(RTX) ((machine_mode) (RTX)->mode)
710 #define PUT_MODE_RAW(RTX, MODE) ((RTX)->mode = (MODE))
712 /* RTL vector. These appear inside RTX's when there is a need
713 for a variable number of things. The principle use is inside
714 PARALLEL expressions. */
716 struct GTY(()) rtvec_def {
717 int num_elem; /* number of elements */
718 rtx GTY ((length ("%h.num_elem"))) elem[1];
721 #define NULL_RTVEC (rtvec) 0
723 #define GET_NUM_ELEM(RTVEC) ((RTVEC)->num_elem)
724 #define PUT_NUM_ELEM(RTVEC, NUM) ((RTVEC)->num_elem = (NUM))
726 /* Predicate yielding nonzero iff X is an rtx for a register. */
727 #define REG_P(X) (GET_CODE (X) == REG)
729 /* Predicate yielding nonzero iff X is an rtx for a memory location. */
730 #define MEM_P(X) (GET_CODE (X) == MEM)
732 #if TARGET_SUPPORTS_WIDE_INT
734 /* Match CONST_*s that can represent compile-time constant integers. */
735 #define CASE_CONST_SCALAR_INT \
736 case CONST_INT: \
737 case CONST_WIDE_INT
739 /* Match CONST_*s for which pointer equality corresponds to value
740 equality. */
741 #define CASE_CONST_UNIQUE \
742 case CONST_INT: \
743 case CONST_WIDE_INT: \
744 case CONST_POLY_INT: \
745 case CONST_DOUBLE: \
746 case CONST_FIXED
748 /* Match all CONST_* rtxes. */
749 #define CASE_CONST_ANY \
750 case CONST_INT: \
751 case CONST_WIDE_INT: \
752 case CONST_POLY_INT: \
753 case CONST_DOUBLE: \
754 case CONST_FIXED: \
755 case CONST_VECTOR
757 #else
759 /* Match CONST_*s that can represent compile-time constant integers. */
760 #define CASE_CONST_SCALAR_INT \
761 case CONST_INT: \
762 case CONST_DOUBLE
764 /* Match CONST_*s for which pointer equality corresponds to value
765 equality. */
766 #define CASE_CONST_UNIQUE \
767 case CONST_INT: \
768 case CONST_DOUBLE: \
769 case CONST_FIXED
771 /* Match all CONST_* rtxes. */
772 #define CASE_CONST_ANY \
773 case CONST_INT: \
774 case CONST_DOUBLE: \
775 case CONST_FIXED: \
776 case CONST_VECTOR
777 #endif
779 /* Predicate yielding nonzero iff X is an rtx for a constant integer. */
780 #define CONST_INT_P(X) (GET_CODE (X) == CONST_INT)
782 /* Predicate yielding nonzero iff X is an rtx for a constant integer. */
783 #define CONST_WIDE_INT_P(X) (GET_CODE (X) == CONST_WIDE_INT)
785 /* Predicate yielding nonzero iff X is an rtx for a polynomial constant
786 integer. */
787 #define CONST_POLY_INT_P(X) \
788 (NUM_POLY_INT_COEFFS > 1 && GET_CODE (X) == CONST_POLY_INT)
790 /* Predicate yielding nonzero iff X is an rtx for a constant fixed-point. */
791 #define CONST_FIXED_P(X) (GET_CODE (X) == CONST_FIXED)
793 /* Predicate yielding true iff X is an rtx for a double-int
794 or floating point constant. */
795 #define CONST_DOUBLE_P(X) (GET_CODE (X) == CONST_DOUBLE)
797 /* Predicate yielding true iff X is an rtx for a double-int. */
798 #define CONST_DOUBLE_AS_INT_P(X) \
799 (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == VOIDmode)
801 /* Predicate yielding true iff X is an rtx for a integer const. */
802 #if TARGET_SUPPORTS_WIDE_INT
803 #define CONST_SCALAR_INT_P(X) \
804 (CONST_INT_P (X) || CONST_WIDE_INT_P (X))
805 #else
806 #define CONST_SCALAR_INT_P(X) \
807 (CONST_INT_P (X) || CONST_DOUBLE_AS_INT_P (X))
808 #endif
810 /* Predicate yielding true iff X is an rtx for a double-int. */
811 #define CONST_DOUBLE_AS_FLOAT_P(X) \
812 (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode)
814 /* Predicate yielding nonzero iff X is a label insn. */
815 #define LABEL_P(X) (GET_CODE (X) == CODE_LABEL)
817 /* Predicate yielding nonzero iff X is a jump insn. */
818 #define JUMP_P(X) (GET_CODE (X) == JUMP_INSN)
820 /* Predicate yielding nonzero iff X is a call insn. */
821 #define CALL_P(X) (GET_CODE (X) == CALL_INSN)
823 /* Predicate yielding nonzero iff X is an insn that cannot jump. */
824 #define NONJUMP_INSN_P(X) (GET_CODE (X) == INSN)
826 /* Predicate yielding nonzero iff X is a debug note/insn. */
827 #define DEBUG_INSN_P(X) (GET_CODE (X) == DEBUG_INSN)
829 /* Predicate yielding nonzero iff X is an insn that is not a debug insn. */
830 #define NONDEBUG_INSN_P(X) (INSN_P (X) && !DEBUG_INSN_P (X))
832 /* Nonzero if DEBUG_MARKER_INSN_P may possibly hold. */
833 #define MAY_HAVE_DEBUG_MARKER_INSNS debug_nonbind_markers_p
834 /* Nonzero if DEBUG_BIND_INSN_P may possibly hold. */
835 #define MAY_HAVE_DEBUG_BIND_INSNS flag_var_tracking_assignments
836 /* Nonzero if DEBUG_INSN_P may possibly hold. */
837 #define MAY_HAVE_DEBUG_INSNS \
838 (MAY_HAVE_DEBUG_MARKER_INSNS || MAY_HAVE_DEBUG_BIND_INSNS)
840 /* Predicate yielding nonzero iff X is a real insn. */
841 #define INSN_P(X) \
842 (NONJUMP_INSN_P (X) || DEBUG_INSN_P (X) || JUMP_P (X) || CALL_P (X))
844 /* Predicate yielding nonzero iff X is a note insn. */
845 #define NOTE_P(X) (GET_CODE (X) == NOTE)
847 /* Predicate yielding nonzero iff X is a barrier insn. */
848 #define BARRIER_P(X) (GET_CODE (X) == BARRIER)
850 /* Predicate yielding nonzero iff X is a data for a jump table. */
851 #define JUMP_TABLE_DATA_P(INSN) (GET_CODE (INSN) == JUMP_TABLE_DATA)
853 /* Predicate yielding nonzero iff RTX is a subreg. */
854 #define SUBREG_P(RTX) (GET_CODE (RTX) == SUBREG)
856 /* Predicate yielding true iff RTX is a symbol ref. */
857 #define SYMBOL_REF_P(RTX) (GET_CODE (RTX) == SYMBOL_REF)
859 template <>
860 template <>
861 inline bool
862 is_a_helper <rtx_insn *>::test (rtx rt)
864 return (INSN_P (rt)
865 || NOTE_P (rt)
866 || JUMP_TABLE_DATA_P (rt)
867 || BARRIER_P (rt)
868 || LABEL_P (rt));
871 template <>
872 template <>
873 inline bool
874 is_a_helper <const rtx_insn *>::test (const_rtx rt)
876 return (INSN_P (rt)
877 || NOTE_P (rt)
878 || JUMP_TABLE_DATA_P (rt)
879 || BARRIER_P (rt)
880 || LABEL_P (rt));
883 template <>
884 template <>
885 inline bool
886 is_a_helper <rtx_debug_insn *>::test (rtx rt)
888 return DEBUG_INSN_P (rt);
891 template <>
892 template <>
893 inline bool
894 is_a_helper <rtx_nonjump_insn *>::test (rtx rt)
896 return NONJUMP_INSN_P (rt);
899 template <>
900 template <>
901 inline bool
902 is_a_helper <rtx_jump_insn *>::test (rtx rt)
904 return JUMP_P (rt);
907 template <>
908 template <>
909 inline bool
910 is_a_helper <rtx_jump_insn *>::test (rtx_insn *insn)
912 return JUMP_P (insn);
915 template <>
916 template <>
917 inline bool
918 is_a_helper <rtx_call_insn *>::test (rtx rt)
920 return CALL_P (rt);
923 template <>
924 template <>
925 inline bool
926 is_a_helper <rtx_call_insn *>::test (rtx_insn *insn)
928 return CALL_P (insn);
931 template <>
932 template <>
933 inline bool
934 is_a_helper <rtx_jump_table_data *>::test (rtx rt)
936 return JUMP_TABLE_DATA_P (rt);
939 template <>
940 template <>
941 inline bool
942 is_a_helper <rtx_jump_table_data *>::test (rtx_insn *insn)
944 return JUMP_TABLE_DATA_P (insn);
947 template <>
948 template <>
949 inline bool
950 is_a_helper <rtx_barrier *>::test (rtx rt)
952 return BARRIER_P (rt);
955 template <>
956 template <>
957 inline bool
958 is_a_helper <rtx_code_label *>::test (rtx rt)
960 return LABEL_P (rt);
963 template <>
964 template <>
965 inline bool
966 is_a_helper <rtx_code_label *>::test (rtx_insn *insn)
968 return LABEL_P (insn);
971 template <>
972 template <>
973 inline bool
974 is_a_helper <rtx_note *>::test (rtx rt)
976 return NOTE_P (rt);
979 template <>
980 template <>
981 inline bool
982 is_a_helper <rtx_note *>::test (rtx_insn *insn)
984 return NOTE_P (insn);
987 /* Predicate yielding nonzero iff X is a return or simple_return. */
988 #define ANY_RETURN_P(X) \
989 (GET_CODE (X) == RETURN || GET_CODE (X) == SIMPLE_RETURN)
991 /* 1 if X is a unary operator. */
993 #define UNARY_P(X) \
994 (GET_RTX_CLASS (GET_CODE (X)) == RTX_UNARY)
996 /* 1 if X is a binary operator. */
998 #define BINARY_P(X) \
999 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_BINARY_MASK) == RTX_BINARY_RESULT)
1001 /* 1 if X is an arithmetic operator. */
1003 #define ARITHMETIC_P(X) \
1004 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_ARITHMETIC_MASK) \
1005 == RTX_ARITHMETIC_RESULT)
1007 /* 1 if X is an arithmetic operator. */
1009 #define COMMUTATIVE_ARITH_P(X) \
1010 (GET_RTX_CLASS (GET_CODE (X)) == RTX_COMM_ARITH)
1012 /* 1 if X is a commutative arithmetic operator or a comparison operator.
1013 These two are sometimes selected together because it is possible to
1014 swap the two operands. */
1016 #define SWAPPABLE_OPERANDS_P(X) \
1017 ((1 << GET_RTX_CLASS (GET_CODE (X))) \
1018 & ((1 << RTX_COMM_ARITH) | (1 << RTX_COMM_COMPARE) \
1019 | (1 << RTX_COMPARE)))
1021 /* 1 if X is a non-commutative operator. */
1023 #define NON_COMMUTATIVE_P(X) \
1024 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \
1025 == RTX_NON_COMMUTATIVE_RESULT)
1027 /* 1 if X is a commutative operator on integers. */
1029 #define COMMUTATIVE_P(X) \
1030 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \
1031 == RTX_COMMUTATIVE_RESULT)
1033 /* 1 if X is a relational operator. */
1035 #define COMPARISON_P(X) \
1036 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMPARE_MASK) == RTX_COMPARE_RESULT)
1038 /* 1 if X is a constant value that is an integer. */
1040 #define CONSTANT_P(X) \
1041 (GET_RTX_CLASS (GET_CODE (X)) == RTX_CONST_OBJ)
1043 /* 1 if X can be used to represent an object. */
1044 #define OBJECT_P(X) \
1045 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_OBJ_MASK) == RTX_OBJ_RESULT)
1047 /* General accessor macros for accessing the fields of an rtx. */
1049 #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
1050 /* The bit with a star outside the statement expr and an & inside is
1051 so that N can be evaluated only once. */
1052 #define RTL_CHECK1(RTX, N, C1) __extension__ \
1053 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
1054 const enum rtx_code _code = GET_CODE (_rtx); \
1055 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
1056 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
1057 __FUNCTION__); \
1058 if (GET_RTX_FORMAT (_code)[_n] != C1) \
1059 rtl_check_failed_type1 (_rtx, _n, C1, __FILE__, __LINE__, \
1060 __FUNCTION__); \
1061 &_rtx->u.fld[_n]; }))
1063 #define RTL_CHECK2(RTX, N, C1, C2) __extension__ \
1064 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
1065 const enum rtx_code _code = GET_CODE (_rtx); \
1066 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
1067 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
1068 __FUNCTION__); \
1069 if (GET_RTX_FORMAT (_code)[_n] != C1 \
1070 && GET_RTX_FORMAT (_code)[_n] != C2) \
1071 rtl_check_failed_type2 (_rtx, _n, C1, C2, __FILE__, __LINE__, \
1072 __FUNCTION__); \
1073 &_rtx->u.fld[_n]; }))
1075 #define RTL_CHECKC1(RTX, N, C) __extension__ \
1076 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
1077 if (GET_CODE (_rtx) != (C)) \
1078 rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
1079 __FUNCTION__); \
1080 &_rtx->u.fld[_n]; }))
1082 #define RTL_CHECKC2(RTX, N, C1, C2) __extension__ \
1083 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
1084 const enum rtx_code _code = GET_CODE (_rtx); \
1085 if (_code != (C1) && _code != (C2)) \
1086 rtl_check_failed_code2 (_rtx, (C1), (C2), __FILE__, __LINE__, \
1087 __FUNCTION__); \
1088 &_rtx->u.fld[_n]; }))
1090 #define RTVEC_ELT(RTVEC, I) __extension__ \
1091 (*({ __typeof (RTVEC) const _rtvec = (RTVEC); const int _i = (I); \
1092 if (_i < 0 || _i >= GET_NUM_ELEM (_rtvec)) \
1093 rtvec_check_failed_bounds (_rtvec, _i, __FILE__, __LINE__, \
1094 __FUNCTION__); \
1095 &_rtvec->elem[_i]; }))
1097 #define XWINT(RTX, N) __extension__ \
1098 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
1099 const enum rtx_code _code = GET_CODE (_rtx); \
1100 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
1101 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
1102 __FUNCTION__); \
1103 if (GET_RTX_FORMAT (_code)[_n] != 'w') \
1104 rtl_check_failed_type1 (_rtx, _n, 'w', __FILE__, __LINE__, \
1105 __FUNCTION__); \
1106 &_rtx->u.hwint[_n]; }))
1108 #define CWI_ELT(RTX, I) __extension__ \
1109 (*({ __typeof (RTX) const _cwi = (RTX); \
1110 int _max = CWI_GET_NUM_ELEM (_cwi); \
1111 const int _i = (I); \
1112 if (_i < 0 || _i >= _max) \
1113 cwi_check_failed_bounds (_cwi, _i, __FILE__, __LINE__, \
1114 __FUNCTION__); \
1115 &_cwi->u.hwiv.elem[_i]; }))
1117 #define XCWINT(RTX, N, C) __extension__ \
1118 (*({ __typeof (RTX) const _rtx = (RTX); \
1119 if (GET_CODE (_rtx) != (C)) \
1120 rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
1121 __FUNCTION__); \
1122 &_rtx->u.hwint[N]; }))
1124 #define XCMWINT(RTX, N, C, M) __extension__ \
1125 (*({ __typeof (RTX) const _rtx = (RTX); \
1126 if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) != (M)) \
1127 rtl_check_failed_code_mode (_rtx, (C), (M), false, __FILE__, \
1128 __LINE__, __FUNCTION__); \
1129 &_rtx->u.hwint[N]; }))
1131 #define XCNMPRV(RTX, C, M) __extension__ \
1132 ({ __typeof (RTX) const _rtx = (RTX); \
1133 if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \
1134 rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \
1135 __LINE__, __FUNCTION__); \
1136 &_rtx->u.rv; })
1138 #define XCNMPFV(RTX, C, M) __extension__ \
1139 ({ __typeof (RTX) const _rtx = (RTX); \
1140 if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \
1141 rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \
1142 __LINE__, __FUNCTION__); \
1143 &_rtx->u.fv; })
1145 #define REG_CHECK(RTX) __extension__ \
1146 ({ __typeof (RTX) const _rtx = (RTX); \
1147 if (GET_CODE (_rtx) != REG) \
1148 rtl_check_failed_code1 (_rtx, REG, __FILE__, __LINE__, \
1149 __FUNCTION__); \
1150 &_rtx->u.reg; })
1152 #define BLOCK_SYMBOL_CHECK(RTX) __extension__ \
1153 ({ __typeof (RTX) const _symbol = (RTX); \
1154 const unsigned int flags = SYMBOL_REF_FLAGS (_symbol); \
1155 if ((flags & SYMBOL_FLAG_HAS_BLOCK_INFO) == 0) \
1156 rtl_check_failed_block_symbol (__FILE__, __LINE__, \
1157 __FUNCTION__); \
1158 &_symbol->u.block_sym; })
1160 #define HWIVEC_CHECK(RTX,C) __extension__ \
1161 ({ __typeof (RTX) const _symbol = (RTX); \
1162 RTL_CHECKC1 (_symbol, 0, C); \
1163 &_symbol->u.hwiv; })
1165 extern void rtl_check_failed_bounds (const_rtx, int, const char *, int,
1166 const char *)
1167 ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1168 extern void rtl_check_failed_type1 (const_rtx, int, int, const char *, int,
1169 const char *)
1170 ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1171 extern void rtl_check_failed_type2 (const_rtx, int, int, int, const char *,
1172 int, const char *)
1173 ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1174 extern void rtl_check_failed_code1 (const_rtx, enum rtx_code, const char *,
1175 int, const char *)
1176 ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1177 extern void rtl_check_failed_code2 (const_rtx, enum rtx_code, enum rtx_code,
1178 const char *, int, const char *)
1179 ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1180 extern void rtl_check_failed_code_mode (const_rtx, enum rtx_code, machine_mode,
1181 bool, const char *, int, const char *)
1182 ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1183 extern void rtl_check_failed_block_symbol (const char *, int, const char *)
1184 ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1185 extern void cwi_check_failed_bounds (const_rtx, int, const char *, int,
1186 const char *)
1187 ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1188 extern void rtvec_check_failed_bounds (const_rtvec, int, const char *, int,
1189 const char *)
1190 ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1192 #else /* not ENABLE_RTL_CHECKING */
1194 #define RTL_CHECK1(RTX, N, C1) ((RTX)->u.fld[N])
1195 #define RTL_CHECK2(RTX, N, C1, C2) ((RTX)->u.fld[N])
1196 #define RTL_CHECKC1(RTX, N, C) ((RTX)->u.fld[N])
1197 #define RTL_CHECKC2(RTX, N, C1, C2) ((RTX)->u.fld[N])
1198 #define RTVEC_ELT(RTVEC, I) ((RTVEC)->elem[I])
1199 #define XWINT(RTX, N) ((RTX)->u.hwint[N])
1200 #define CWI_ELT(RTX, I) ((RTX)->u.hwiv.elem[I])
1201 #define XCWINT(RTX, N, C) ((RTX)->u.hwint[N])
1202 #define XCMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
1203 #define XCNMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
1204 #define XCNMPRV(RTX, C, M) (&(RTX)->u.rv)
1205 #define XCNMPFV(RTX, C, M) (&(RTX)->u.fv)
1206 #define REG_CHECK(RTX) (&(RTX)->u.reg)
1207 #define BLOCK_SYMBOL_CHECK(RTX) (&(RTX)->u.block_sym)
1208 #define HWIVEC_CHECK(RTX,C) (&(RTX)->u.hwiv)
1210 #endif
1212 /* General accessor macros for accessing the flags of an rtx. */
1214 /* Access an individual rtx flag, with no checking of any kind. */
1215 #define RTX_FLAG(RTX, FLAG) ((RTX)->FLAG)
1217 #if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION >= 2007)
1218 #define RTL_FLAG_CHECK1(NAME, RTX, C1) __extension__ \
1219 ({ __typeof (RTX) const _rtx = (RTX); \
1220 if (GET_CODE (_rtx) != C1) \
1221 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1222 __FUNCTION__); \
1223 _rtx; })
1225 #define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) __extension__ \
1226 ({ __typeof (RTX) const _rtx = (RTX); \
1227 if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2) \
1228 rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
1229 __FUNCTION__); \
1230 _rtx; })
1232 #define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) __extension__ \
1233 ({ __typeof (RTX) const _rtx = (RTX); \
1234 if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \
1235 && GET_CODE (_rtx) != C3) \
1236 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1237 __FUNCTION__); \
1238 _rtx; })
1240 #define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) __extension__ \
1241 ({ __typeof (RTX) const _rtx = (RTX); \
1242 if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \
1243 && GET_CODE (_rtx) != C3 && GET_CODE(_rtx) != C4) \
1244 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1245 __FUNCTION__); \
1246 _rtx; })
1248 #define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) __extension__ \
1249 ({ __typeof (RTX) const _rtx = (RTX); \
1250 if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
1251 && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
1252 && GET_CODE (_rtx) != C5) \
1253 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1254 __FUNCTION__); \
1255 _rtx; })
1257 #define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) \
1258 __extension__ \
1259 ({ __typeof (RTX) const _rtx = (RTX); \
1260 if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
1261 && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
1262 && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6) \
1263 rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
1264 __FUNCTION__); \
1265 _rtx; })
1267 #define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) \
1268 __extension__ \
1269 ({ __typeof (RTX) const _rtx = (RTX); \
1270 if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
1271 && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
1272 && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6 \
1273 && GET_CODE (_rtx) != C7) \
1274 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1275 __FUNCTION__); \
1276 _rtx; })
1278 #define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) \
1279 __extension__ \
1280 ({ __typeof (RTX) const _rtx = (RTX); \
1281 if (!INSN_CHAIN_CODE_P (GET_CODE (_rtx))) \
1282 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1283 __FUNCTION__); \
1284 _rtx; })
1286 extern void rtl_check_failed_flag (const char *, const_rtx, const char *,
1287 int, const char *)
1288 ATTRIBUTE_NORETURN ATTRIBUTE_COLD
1291 #else /* not ENABLE_RTL_FLAG_CHECKING */
1293 #define RTL_FLAG_CHECK1(NAME, RTX, C1) (RTX)
1294 #define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) (RTX)
1295 #define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) (RTX)
1296 #define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) (RTX)
1297 #define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) (RTX)
1298 #define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) (RTX)
1299 #define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) (RTX)
1300 #define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) (RTX)
1301 #endif
1303 #define XINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rt_int)
1304 #define XUINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rt_uint)
1305 #define XSTR(RTX, N) (RTL_CHECK2 (RTX, N, 's', 'S').rt_str)
1306 #define XEXP(RTX, N) (RTL_CHECK2 (RTX, N, 'e', 'u').rt_rtx)
1307 #define XVEC(RTX, N) (RTL_CHECK2 (RTX, N, 'E', 'V').rt_rtvec)
1308 #define XMODE(RTX, N) (RTL_CHECK1 (RTX, N, 'M').rt_type)
1309 #define XTREE(RTX, N) (RTL_CHECK1 (RTX, N, 't').rt_tree)
1310 #define XBBDEF(RTX, N) (RTL_CHECK1 (RTX, N, 'B').rt_bb)
1311 #define XTMPL(RTX, N) (RTL_CHECK1 (RTX, N, 'T').rt_str)
1312 #define XCFI(RTX, N) (RTL_CHECK1 (RTX, N, 'C').rt_cfi)
1314 #define XVECEXP(RTX, N, M) RTVEC_ELT (XVEC (RTX, N), M)
1315 #define XVECLEN(RTX, N) GET_NUM_ELEM (XVEC (RTX, N))
1317 /* These are like XINT, etc. except that they expect a '0' field instead
1318 of the normal type code. */
1320 #define X0INT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_int)
1321 #define X0UINT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_uint)
1322 #define X0STR(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_str)
1323 #define X0EXP(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtx)
1324 #define X0VEC(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtvec)
1325 #define X0MODE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_type)
1326 #define X0TREE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_tree)
1327 #define X0BBDEF(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_bb)
1328 #define X0ADVFLAGS(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_addr_diff_vec_flags)
1329 #define X0CSELIB(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_cselib)
1330 #define X0MEMATTR(RTX, N) (RTL_CHECKC1 (RTX, N, MEM).rt_mem)
1331 #define X0CONSTANT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_constant)
1333 /* Access a '0' field with any type. */
1334 #define X0ANY(RTX, N) RTL_CHECK1 (RTX, N, '0')
1336 #define XCINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_int)
1337 #define XCUINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_uint)
1338 #define XCSTR(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_str)
1339 #define XCEXP(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtx)
1340 #define XCVEC(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtvec)
1341 #define XCMODE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_type)
1342 #define XCTREE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_tree)
1343 #define XCBBDEF(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_bb)
1344 #define XCCFI(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_cfi)
1345 #define XCCSELIB(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_cselib)
1347 #define XCVECEXP(RTX, N, M, C) RTVEC_ELT (XCVEC (RTX, N, C), M)
1348 #define XCVECLEN(RTX, N, C) GET_NUM_ELEM (XCVEC (RTX, N, C))
1350 #define XC2EXP(RTX, N, C1, C2) (RTL_CHECKC2 (RTX, N, C1, C2).rt_rtx)
1353 /* Methods of rtx_expr_list. */
1355 inline rtx_expr_list *rtx_expr_list::next () const
1357 rtx tmp = XEXP (this, 1);
1358 return safe_as_a <rtx_expr_list *> (tmp);
1361 inline rtx rtx_expr_list::element () const
1363 return XEXP (this, 0);
1366 /* Methods of rtx_insn_list. */
1368 inline rtx_insn_list *rtx_insn_list::next () const
1370 rtx tmp = XEXP (this, 1);
1371 return safe_as_a <rtx_insn_list *> (tmp);
1374 inline rtx_insn *rtx_insn_list::insn () const
1376 rtx tmp = XEXP (this, 0);
1377 return safe_as_a <rtx_insn *> (tmp);
1380 /* Methods of rtx_sequence. */
1382 inline int rtx_sequence::len () const
1384 return XVECLEN (this, 0);
1387 inline rtx rtx_sequence::element (int index) const
1389 return XVECEXP (this, 0, index);
1392 inline rtx_insn *rtx_sequence::insn (int index) const
1394 return as_a <rtx_insn *> (XVECEXP (this, 0, index));
1397 /* ACCESS MACROS for particular fields of insns. */
1399 /* Holds a unique number for each insn.
1400 These are not necessarily sequentially increasing. */
1401 inline int INSN_UID (const_rtx insn)
1403 return RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID",
1404 (insn))->u2.insn_uid;
1406 inline int& INSN_UID (rtx insn)
1408 return RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID",
1409 (insn))->u2.insn_uid;
1412 /* Chain insns together in sequence. */
1414 /* For now these are split in two: an rvalue form:
1415 PREV_INSN/NEXT_INSN
1416 and an lvalue form:
1417 SET_NEXT_INSN/SET_PREV_INSN. */
1419 inline rtx_insn *PREV_INSN (const rtx_insn *insn)
1421 rtx prev = XEXP (insn, 0);
1422 return safe_as_a <rtx_insn *> (prev);
1425 inline rtx& SET_PREV_INSN (rtx_insn *insn)
1427 return XEXP (insn, 0);
1430 inline rtx_insn *NEXT_INSN (const rtx_insn *insn)
1432 rtx next = XEXP (insn, 1);
1433 return safe_as_a <rtx_insn *> (next);
1436 inline rtx& SET_NEXT_INSN (rtx_insn *insn)
1438 return XEXP (insn, 1);
1441 inline basic_block BLOCK_FOR_INSN (const_rtx insn)
1443 return XBBDEF (insn, 2);
1446 inline basic_block& BLOCK_FOR_INSN (rtx insn)
1448 return XBBDEF (insn, 2);
1451 inline void set_block_for_insn (rtx_insn *insn, basic_block bb)
1453 BLOCK_FOR_INSN (insn) = bb;
1456 /* The body of an insn. */
1457 inline rtx PATTERN (const_rtx insn)
1459 return XEXP (insn, 3);
1462 inline rtx& PATTERN (rtx insn)
1464 return XEXP (insn, 3);
1467 inline unsigned int INSN_LOCATION (const rtx_insn *insn)
1469 return XUINT (insn, 4);
1472 inline unsigned int& INSN_LOCATION (rtx_insn *insn)
1474 return XUINT (insn, 4);
1477 inline bool INSN_HAS_LOCATION (const rtx_insn *insn)
1479 return LOCATION_LOCUS (INSN_LOCATION (insn)) != UNKNOWN_LOCATION;
1482 /* LOCATION of an RTX if relevant. */
1483 #define RTL_LOCATION(X) (INSN_P (X) ? \
1484 INSN_LOCATION (as_a <rtx_insn *> (X)) \
1485 : UNKNOWN_LOCATION)
1487 /* Code number of instruction, from when it was recognized.
1488 -1 means this instruction has not been recognized yet. */
1489 #define INSN_CODE(INSN) XINT (INSN, 5)
1491 inline rtvec rtx_jump_table_data::get_labels () const
1493 rtx pat = PATTERN (this);
1494 if (GET_CODE (pat) == ADDR_VEC)
1495 return XVEC (pat, 0);
1496 else
1497 return XVEC (pat, 1); /* presumably an ADDR_DIFF_VEC */
1500 /* Return the mode of the data in the table, which is always a scalar
1501 integer. */
1503 inline scalar_int_mode
1504 rtx_jump_table_data::get_data_mode () const
1506 return as_a <scalar_int_mode> (GET_MODE (PATTERN (this)));
1509 /* If LABEL is followed by a jump table, return the table, otherwise
1510 return null. */
1512 inline rtx_jump_table_data *
1513 jump_table_for_label (const rtx_code_label *label)
1515 return safe_dyn_cast <rtx_jump_table_data *> (NEXT_INSN (label));
1518 #define RTX_FRAME_RELATED_P(RTX) \
1519 (RTL_FLAG_CHECK6 ("RTX_FRAME_RELATED_P", (RTX), DEBUG_INSN, INSN, \
1520 CALL_INSN, JUMP_INSN, BARRIER, SET)->frame_related)
1522 /* 1 if JUMP RTX is a crossing jump. */
1523 #define CROSSING_JUMP_P(RTX) \
1524 (RTL_FLAG_CHECK1 ("CROSSING_JUMP_P", (RTX), JUMP_INSN)->jump)
1526 /* 1 if RTX is a call to a const function. Built from ECF_CONST and
1527 TREE_READONLY. */
1528 #define RTL_CONST_CALL_P(RTX) \
1529 (RTL_FLAG_CHECK1 ("RTL_CONST_CALL_P", (RTX), CALL_INSN)->unchanging)
1531 /* 1 if RTX is a call to a pure function. Built from ECF_PURE and
1532 DECL_PURE_P. */
1533 #define RTL_PURE_CALL_P(RTX) \
1534 (RTL_FLAG_CHECK1 ("RTL_PURE_CALL_P", (RTX), CALL_INSN)->return_val)
1536 /* 1 if RTX is a call to a const or pure function. */
1537 #define RTL_CONST_OR_PURE_CALL_P(RTX) \
1538 (RTL_CONST_CALL_P (RTX) || RTL_PURE_CALL_P (RTX))
1540 /* 1 if RTX is a call to a looping const or pure function. Built from
1541 ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P. */
1542 #define RTL_LOOPING_CONST_OR_PURE_CALL_P(RTX) \
1543 (RTL_FLAG_CHECK1 ("CONST_OR_PURE_CALL_P", (RTX), CALL_INSN)->call)
1545 /* 1 if RTX is a call_insn for a sibling call. */
1546 #define SIBLING_CALL_P(RTX) \
1547 (RTL_FLAG_CHECK1 ("SIBLING_CALL_P", (RTX), CALL_INSN)->jump)
1549 /* 1 if RTX is a jump_insn, call_insn, or insn that is an annulling branch. */
1550 #define INSN_ANNULLED_BRANCH_P(RTX) \
1551 (RTL_FLAG_CHECK1 ("INSN_ANNULLED_BRANCH_P", (RTX), JUMP_INSN)->unchanging)
1553 /* 1 if RTX is an insn in a delay slot and is from the target of the branch.
1554 If the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be
1555 executed if the branch is taken. For annulled branches with this bit
1556 clear, the insn should be executed only if the branch is not taken. */
1557 #define INSN_FROM_TARGET_P(RTX) \
1558 (RTL_FLAG_CHECK3 ("INSN_FROM_TARGET_P", (RTX), INSN, JUMP_INSN, \
1559 CALL_INSN)->in_struct)
1561 /* In an ADDR_DIFF_VEC, the flags for RTX for use by branch shortening.
1562 See the comments for ADDR_DIFF_VEC in rtl.def. */
1563 #define ADDR_DIFF_VEC_FLAGS(RTX) X0ADVFLAGS (RTX, 4)
1565 /* In a VALUE, the value cselib has assigned to RTX.
1566 This is a "struct cselib_val", see cselib.h. */
1567 #define CSELIB_VAL_PTR(RTX) X0CSELIB (RTX, 0)
1569 /* Holds a list of notes on what this insn does to various REGs.
1570 It is a chain of EXPR_LIST rtx's, where the second operand is the
1571 chain pointer and the first operand is the REG being described.
1572 The mode field of the EXPR_LIST contains not a real machine mode
1573 but a value from enum reg_note. */
1574 #define REG_NOTES(INSN) XEXP(INSN, 6)
1576 /* In an ENTRY_VALUE this is the DECL_INCOMING_RTL of the argument in
1577 question. */
1578 #define ENTRY_VALUE_EXP(RTX) (RTL_CHECKC1 (RTX, 0, ENTRY_VALUE).rt_rtx)
1580 enum reg_note
1582 #define DEF_REG_NOTE(NAME) NAME,
1583 #include "reg-notes.def"
1584 #undef DEF_REG_NOTE
1585 REG_NOTE_MAX
1588 /* Define macros to extract and insert the reg-note kind in an EXPR_LIST. */
1589 #define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK))
1590 #define PUT_REG_NOTE_KIND(LINK, KIND) \
1591 PUT_MODE_RAW (LINK, (machine_mode) (KIND))
1593 /* Names for REG_NOTE's in EXPR_LIST insn's. */
1595 extern const char * const reg_note_name[];
1596 #define GET_REG_NOTE_NAME(MODE) (reg_note_name[(int) (MODE)])
1598 /* This field is only present on CALL_INSNs. It holds a chain of EXPR_LIST of
1599 USE and CLOBBER expressions.
1600 USE expressions list the registers filled with arguments that
1601 are passed to the function.
1602 CLOBBER expressions document the registers explicitly clobbered
1603 by this CALL_INSN.
1604 Pseudo registers can not be mentioned in this list. */
1605 #define CALL_INSN_FUNCTION_USAGE(INSN) XEXP(INSN, 7)
1607 /* The label-number of a code-label. The assembler label
1608 is made from `L' and the label-number printed in decimal.
1609 Label numbers are unique in a compilation. */
1610 #define CODE_LABEL_NUMBER(INSN) XINT (INSN, 5)
1612 /* In a NOTE that is a line number, this is a string for the file name that the
1613 line is in. We use the same field to record block numbers temporarily in
1614 NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes. (We avoid lots of casts
1615 between ints and pointers if we use a different macro for the block number.)
1618 /* Opaque data. */
1619 #define NOTE_DATA(INSN) RTL_CHECKC1 (INSN, 3, NOTE)
1620 #define NOTE_DELETED_LABEL_NAME(INSN) XCSTR (INSN, 3, NOTE)
1621 #define SET_INSN_DELETED(INSN) set_insn_deleted (INSN);
1622 #define NOTE_BLOCK(INSN) XCTREE (INSN, 3, NOTE)
1623 #define NOTE_EH_HANDLER(INSN) XCINT (INSN, 3, NOTE)
1624 #define NOTE_BASIC_BLOCK(INSN) XCBBDEF (INSN, 3, NOTE)
1625 #define NOTE_VAR_LOCATION(INSN) XCEXP (INSN, 3, NOTE)
1626 #define NOTE_MARKER_LOCATION(INSN) XCUINT (INSN, 3, NOTE)
1627 #define NOTE_CFI(INSN) XCCFI (INSN, 3, NOTE)
1628 #define NOTE_LABEL_NUMBER(INSN) XCINT (INSN, 3, NOTE)
1630 /* In a NOTE that is a line number, this is the line number.
1631 Other kinds of NOTEs are identified by negative numbers here. */
1632 #define NOTE_KIND(INSN) XCINT (INSN, 4, NOTE)
1634 /* Nonzero if INSN is a note marking the beginning of a basic block. */
1635 #define NOTE_INSN_BASIC_BLOCK_P(INSN) \
1636 (NOTE_P (INSN) && NOTE_KIND (INSN) == NOTE_INSN_BASIC_BLOCK)
1638 /* Nonzero if INSN is a debug nonbind marker note,
1639 for which NOTE_MARKER_LOCATION can be used. */
1640 #define NOTE_MARKER_P(INSN) \
1641 (NOTE_P (INSN) && \
1642 (NOTE_KIND (INSN) == NOTE_INSN_BEGIN_STMT))
1644 /* Variable declaration and the location of a variable. */
1645 #define PAT_VAR_LOCATION_DECL(PAT) (XCTREE ((PAT), 0, VAR_LOCATION))
1646 #define PAT_VAR_LOCATION_LOC(PAT) (XCEXP ((PAT), 1, VAR_LOCATION))
1648 /* Initialization status of the variable in the location. Status
1649 can be unknown, uninitialized or initialized. See enumeration
1650 type below. */
1651 #define PAT_VAR_LOCATION_STATUS(PAT) \
1652 (RTL_FLAG_CHECK1 ("PAT_VAR_LOCATION_STATUS", PAT, VAR_LOCATION) \
1653 ->u2.var_location_status)
1655 /* Accessors for a NOTE_INSN_VAR_LOCATION. */
1656 #define NOTE_VAR_LOCATION_DECL(NOTE) \
1657 PAT_VAR_LOCATION_DECL (NOTE_VAR_LOCATION (NOTE))
1658 #define NOTE_VAR_LOCATION_LOC(NOTE) \
1659 PAT_VAR_LOCATION_LOC (NOTE_VAR_LOCATION (NOTE))
1660 #define NOTE_VAR_LOCATION_STATUS(NOTE) \
1661 PAT_VAR_LOCATION_STATUS (NOTE_VAR_LOCATION (NOTE))
1663 /* Evaluate to TRUE if INSN is a debug insn that denotes a variable
1664 location/value tracking annotation. */
1665 #define DEBUG_BIND_INSN_P(INSN) \
1666 (DEBUG_INSN_P (INSN) \
1667 && (GET_CODE (PATTERN (INSN)) \
1668 == VAR_LOCATION))
1669 /* Evaluate to TRUE if INSN is a debug insn that denotes a program
1670 source location marker. */
1671 #define DEBUG_MARKER_INSN_P(INSN) \
1672 (DEBUG_INSN_P (INSN) \
1673 && (GET_CODE (PATTERN (INSN)) \
1674 != VAR_LOCATION))
1675 /* Evaluate to the marker kind. */
1676 #define INSN_DEBUG_MARKER_KIND(INSN) \
1677 (GET_CODE (PATTERN (INSN)) == DEBUG_MARKER \
1678 ? (GET_MODE (PATTERN (INSN)) == VOIDmode \
1679 ? NOTE_INSN_BEGIN_STMT \
1680 : (enum insn_note)-1) \
1681 : (enum insn_note)-1)
1682 /* Create patterns for debug markers. These and the above abstract
1683 the representation, so that it's easier to get rid of the abuse of
1684 the mode to hold the marker kind. Other marker types are
1685 envisioned, so a single bit flag won't do; maybe separate RTL codes
1686 wouldn't be a problem. */
1687 #define GEN_RTX_DEBUG_MARKER_BEGIN_STMT_PAT() \
1688 gen_rtx_DEBUG_MARKER (VOIDmode)
1690 /* The VAR_LOCATION rtx in a DEBUG_INSN. */
1691 #define INSN_VAR_LOCATION(INSN) \
1692 (RTL_FLAG_CHECK1 ("INSN_VAR_LOCATION", PATTERN (INSN), VAR_LOCATION))
1693 /* A pointer to the VAR_LOCATION rtx in a DEBUG_INSN. */
1694 #define INSN_VAR_LOCATION_PTR(INSN) \
1695 (&PATTERN (INSN))
1697 /* Accessors for a tree-expanded var location debug insn. */
1698 #define INSN_VAR_LOCATION_DECL(INSN) \
1699 PAT_VAR_LOCATION_DECL (INSN_VAR_LOCATION (INSN))
1700 #define INSN_VAR_LOCATION_LOC(INSN) \
1701 PAT_VAR_LOCATION_LOC (INSN_VAR_LOCATION (INSN))
1702 #define INSN_VAR_LOCATION_STATUS(INSN) \
1703 PAT_VAR_LOCATION_STATUS (INSN_VAR_LOCATION (INSN))
1705 /* Expand to the RTL that denotes an unknown variable location in a
1706 DEBUG_INSN. */
1707 #define gen_rtx_UNKNOWN_VAR_LOC() (gen_rtx_CLOBBER (VOIDmode, const0_rtx))
1709 /* Determine whether X is such an unknown location. */
1710 #define VAR_LOC_UNKNOWN_P(X) \
1711 (GET_CODE (X) == CLOBBER && XEXP ((X), 0) == const0_rtx)
1713 /* 1 if RTX is emitted after a call, but it should take effect before
1714 the call returns. */
1715 #define NOTE_DURING_CALL_P(RTX) \
1716 (RTL_FLAG_CHECK1 ("NOTE_VAR_LOCATION_DURING_CALL_P", (RTX), NOTE)->call)
1718 /* DEBUG_EXPR_DECL corresponding to a DEBUG_EXPR RTX. */
1719 #define DEBUG_EXPR_TREE_DECL(RTX) XCTREE (RTX, 0, DEBUG_EXPR)
1721 /* VAR_DECL/PARM_DECL DEBUG_IMPLICIT_PTR takes address of. */
1722 #define DEBUG_IMPLICIT_PTR_DECL(RTX) XCTREE (RTX, 0, DEBUG_IMPLICIT_PTR)
1724 /* PARM_DECL DEBUG_PARAMETER_REF references. */
1725 #define DEBUG_PARAMETER_REF_DECL(RTX) XCTREE (RTX, 0, DEBUG_PARAMETER_REF)
1727 /* Codes that appear in the NOTE_KIND field for kinds of notes
1728 that are not line numbers. These codes are all negative.
1730 Notice that we do not try to use zero here for any of
1731 the special note codes because sometimes the source line
1732 actually can be zero! This happens (for example) when we
1733 are generating code for the per-translation-unit constructor
1734 and destructor routines for some C++ translation unit. */
1736 enum insn_note
1738 #define DEF_INSN_NOTE(NAME) NAME,
1739 #include "insn-notes.def"
1740 #undef DEF_INSN_NOTE
1742 NOTE_INSN_MAX
1745 /* Names for NOTE insn's other than line numbers. */
1747 extern const char * const note_insn_name[NOTE_INSN_MAX];
1748 #define GET_NOTE_INSN_NAME(NOTE_CODE) \
1749 (note_insn_name[(NOTE_CODE)])
1751 /* The name of a label, in case it corresponds to an explicit label
1752 in the input source code. */
1753 #define LABEL_NAME(RTX) XCSTR (RTX, 6, CODE_LABEL)
1755 /* In jump.c, each label contains a count of the number
1756 of LABEL_REFs that point at it, so unused labels can be deleted. */
1757 #define LABEL_NUSES(RTX) XCINT (RTX, 4, CODE_LABEL)
1759 /* Labels carry a two-bit field composed of the ->jump and ->call
1760 bits. This field indicates whether the label is an alternate
1761 entry point, and if so, what kind. */
1762 enum label_kind
1764 LABEL_NORMAL = 0, /* ordinary label */
1765 LABEL_STATIC_ENTRY, /* alternate entry point, not exported */
1766 LABEL_GLOBAL_ENTRY, /* alternate entry point, exported */
1767 LABEL_WEAK_ENTRY /* alternate entry point, exported as weak symbol */
1770 #if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION > 2007)
1772 /* Retrieve the kind of LABEL. */
1773 #define LABEL_KIND(LABEL) __extension__ \
1774 ({ __typeof (LABEL) const _label = (LABEL); \
1775 if (! LABEL_P (_label)) \
1776 rtl_check_failed_flag ("LABEL_KIND", _label, __FILE__, __LINE__, \
1777 __FUNCTION__); \
1778 (enum label_kind) ((_label->jump << 1) | _label->call); })
1780 /* Set the kind of LABEL. */
1781 #define SET_LABEL_KIND(LABEL, KIND) do { \
1782 __typeof (LABEL) const _label = (LABEL); \
1783 const unsigned int _kind = (KIND); \
1784 if (! LABEL_P (_label)) \
1785 rtl_check_failed_flag ("SET_LABEL_KIND", _label, __FILE__, __LINE__, \
1786 __FUNCTION__); \
1787 _label->jump = ((_kind >> 1) & 1); \
1788 _label->call = (_kind & 1); \
1789 } while (0)
1791 #else
1793 /* Retrieve the kind of LABEL. */
1794 #define LABEL_KIND(LABEL) \
1795 ((enum label_kind) (((LABEL)->jump << 1) | (LABEL)->call))
1797 /* Set the kind of LABEL. */
1798 #define SET_LABEL_KIND(LABEL, KIND) do { \
1799 rtx const _label = (LABEL); \
1800 const unsigned int _kind = (KIND); \
1801 _label->jump = ((_kind >> 1) & 1); \
1802 _label->call = (_kind & 1); \
1803 } while (0)
1805 #endif /* rtl flag checking */
1807 #define LABEL_ALT_ENTRY_P(LABEL) (LABEL_KIND (LABEL) != LABEL_NORMAL)
1809 /* In jump.c, each JUMP_INSN can point to a label that it can jump to,
1810 so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
1811 be decremented and possibly the label can be deleted. */
1812 #define JUMP_LABEL(INSN) XCEXP (INSN, 7, JUMP_INSN)
1814 inline rtx_insn *JUMP_LABEL_AS_INSN (const rtx_insn *insn)
1816 return safe_as_a <rtx_insn *> (JUMP_LABEL (insn));
1819 /* Methods of rtx_jump_insn. */
1821 inline rtx rtx_jump_insn::jump_label () const
1823 return JUMP_LABEL (this);
1826 inline rtx_code_label *rtx_jump_insn::jump_target () const
1828 return safe_as_a <rtx_code_label *> (JUMP_LABEL (this));
1831 inline void rtx_jump_insn::set_jump_target (rtx_code_label *target)
1833 JUMP_LABEL (this) = target;
1836 /* Once basic blocks are found, each CODE_LABEL starts a chain that
1837 goes through all the LABEL_REFs that jump to that label. The chain
1838 eventually winds up at the CODE_LABEL: it is circular. */
1839 #define LABEL_REFS(LABEL) XCEXP (LABEL, 3, CODE_LABEL)
1841 /* Get the label that a LABEL_REF references. */
1842 static inline rtx_insn *
1843 label_ref_label (const_rtx ref)
1845 return as_a<rtx_insn *> (XCEXP (ref, 0, LABEL_REF));
1848 /* Set the label that LABEL_REF ref refers to. */
1850 static inline void
1851 set_label_ref_label (rtx ref, rtx_insn *label)
1853 XCEXP (ref, 0, LABEL_REF) = label;
1856 /* For a REG rtx, REGNO extracts the register number. REGNO can only
1857 be used on RHS. Use SET_REGNO to change the value. */
1858 #define REGNO(RTX) (rhs_regno(RTX))
1859 #define SET_REGNO(RTX, N) (df_ref_change_reg_with_loc (RTX, N))
1861 /* Return the number of consecutive registers in a REG. This is always
1862 1 for pseudo registers and is determined by TARGET_HARD_REGNO_NREGS for
1863 hard registers. */
1864 #define REG_NREGS(RTX) (REG_CHECK (RTX)->nregs)
1866 /* ORIGINAL_REGNO holds the number the register originally had; for a
1867 pseudo register turned into a hard reg this will hold the old pseudo
1868 register number. */
1869 #define ORIGINAL_REGNO(RTX) \
1870 (RTL_FLAG_CHECK1 ("ORIGINAL_REGNO", (RTX), REG)->u2.original_regno)
1872 /* Force the REGNO macro to only be used on the lhs. */
1873 static inline unsigned int
1874 rhs_regno (const_rtx x)
1876 return REG_CHECK (x)->regno;
1879 /* Return the final register in REG X plus one. */
1880 static inline unsigned int
1881 END_REGNO (const_rtx x)
1883 return REGNO (x) + REG_NREGS (x);
1886 /* Change the REGNO and REG_NREGS of REG X to the specified values,
1887 bypassing the df machinery. */
1888 static inline void
1889 set_regno_raw (rtx x, unsigned int regno, unsigned int nregs)
1891 reg_info *reg = REG_CHECK (x);
1892 reg->regno = regno;
1893 reg->nregs = nregs;
1896 /* 1 if RTX is a reg or parallel that is the current function's return
1897 value. */
1898 #define REG_FUNCTION_VALUE_P(RTX) \
1899 (RTL_FLAG_CHECK2 ("REG_FUNCTION_VALUE_P", (RTX), REG, PARALLEL)->return_val)
1901 /* 1 if RTX is a reg that corresponds to a variable declared by the user. */
1902 #define REG_USERVAR_P(RTX) \
1903 (RTL_FLAG_CHECK1 ("REG_USERVAR_P", (RTX), REG)->volatil)
1905 /* 1 if RTX is a reg that holds a pointer value. */
1906 #define REG_POINTER(RTX) \
1907 (RTL_FLAG_CHECK1 ("REG_POINTER", (RTX), REG)->frame_related)
1909 /* 1 if RTX is a mem that holds a pointer value. */
1910 #define MEM_POINTER(RTX) \
1911 (RTL_FLAG_CHECK1 ("MEM_POINTER", (RTX), MEM)->frame_related)
1913 /* 1 if the given register REG corresponds to a hard register. */
1914 #define HARD_REGISTER_P(REG) (HARD_REGISTER_NUM_P (REGNO (REG)))
1916 /* 1 if the given register number REG_NO corresponds to a hard register. */
1917 #define HARD_REGISTER_NUM_P(REG_NO) ((REG_NO) < FIRST_PSEUDO_REGISTER)
1919 /* For a CONST_INT rtx, INTVAL extracts the integer. */
1920 #define INTVAL(RTX) XCWINT (RTX, 0, CONST_INT)
1921 #define UINTVAL(RTX) ((unsigned HOST_WIDE_INT) INTVAL (RTX))
1923 /* For a CONST_WIDE_INT, CONST_WIDE_INT_NUNITS is the number of
1924 elements actually needed to represent the constant.
1925 CONST_WIDE_INT_ELT gets one of the elements. 0 is the least
1926 significant HOST_WIDE_INT. */
1927 #define CONST_WIDE_INT_VEC(RTX) HWIVEC_CHECK (RTX, CONST_WIDE_INT)
1928 #define CONST_WIDE_INT_NUNITS(RTX) CWI_GET_NUM_ELEM (RTX)
1929 #define CONST_WIDE_INT_ELT(RTX, N) CWI_ELT (RTX, N)
1931 /* For a CONST_POLY_INT, CONST_POLY_INT_COEFFS gives access to the
1932 individual coefficients, in the form of a trailing_wide_ints structure. */
1933 #define CONST_POLY_INT_COEFFS(RTX) \
1934 (RTL_FLAG_CHECK1("CONST_POLY_INT_COEFFS", (RTX), \
1935 CONST_POLY_INT)->u.cpi.coeffs)
1937 /* For a CONST_DOUBLE:
1938 #if TARGET_SUPPORTS_WIDE_INT == 0
1939 For a VOIDmode, there are two integers CONST_DOUBLE_LOW is the
1940 low-order word and ..._HIGH the high-order.
1941 #endif
1942 For a float, there is a REAL_VALUE_TYPE structure, and
1943 CONST_DOUBLE_REAL_VALUE(r) is a pointer to it. */
1944 #define CONST_DOUBLE_LOW(r) XCMWINT (r, 0, CONST_DOUBLE, VOIDmode)
1945 #define CONST_DOUBLE_HIGH(r) XCMWINT (r, 1, CONST_DOUBLE, VOIDmode)
1946 #define CONST_DOUBLE_REAL_VALUE(r) \
1947 ((const struct real_value *) XCNMPRV (r, CONST_DOUBLE, VOIDmode))
1949 #define CONST_FIXED_VALUE(r) \
1950 ((const struct fixed_value *) XCNMPFV (r, CONST_FIXED, VOIDmode))
1951 #define CONST_FIXED_VALUE_HIGH(r) \
1952 ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.high))
1953 #define CONST_FIXED_VALUE_LOW(r) \
1954 ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.low))
1956 /* For a CONST_VECTOR, return element #n. */
1957 #define CONST_VECTOR_ELT(RTX, N) XCVECEXP (RTX, 0, N, CONST_VECTOR)
1959 /* For a CONST_VECTOR, return the number of elements in a vector. */
1960 #define CONST_VECTOR_NUNITS(RTX) XCVECLEN (RTX, 0, CONST_VECTOR)
1962 /* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of.
1963 SUBREG_BYTE extracts the byte-number. */
1965 #define SUBREG_REG(RTX) XCEXP (RTX, 0, SUBREG)
1966 #define SUBREG_BYTE(RTX) XCUINT (RTX, 1, SUBREG)
1968 /* in rtlanal.c */
1969 /* Return the right cost to give to an operation
1970 to make the cost of the corresponding register-to-register instruction
1971 N times that of a fast register-to-register instruction. */
1972 #define COSTS_N_INSNS(N) ((N) * 4)
1974 /* Maximum cost of an rtl expression. This value has the special meaning
1975 not to use an rtx with this cost under any circumstances. */
1976 #define MAX_COST INT_MAX
1978 /* Return true if CODE always has VOIDmode. */
1980 static inline bool
1981 always_void_p (enum rtx_code code)
1983 return code == SET;
1986 /* A structure to hold all available cost information about an rtl
1987 expression. */
1988 struct full_rtx_costs
1990 int speed;
1991 int size;
1994 /* Initialize a full_rtx_costs structure C to the maximum cost. */
1995 static inline void
1996 init_costs_to_max (struct full_rtx_costs *c)
1998 c->speed = MAX_COST;
1999 c->size = MAX_COST;
2002 /* Initialize a full_rtx_costs structure C to zero cost. */
2003 static inline void
2004 init_costs_to_zero (struct full_rtx_costs *c)
2006 c->speed = 0;
2007 c->size = 0;
2010 /* Compare two full_rtx_costs structures A and B, returning true
2011 if A < B when optimizing for speed. */
2012 static inline bool
2013 costs_lt_p (struct full_rtx_costs *a, struct full_rtx_costs *b,
2014 bool speed)
2016 if (speed)
2017 return (a->speed < b->speed
2018 || (a->speed == b->speed && a->size < b->size));
2019 else
2020 return (a->size < b->size
2021 || (a->size == b->size && a->speed < b->speed));
2024 /* Increase both members of the full_rtx_costs structure C by the
2025 cost of N insns. */
2026 static inline void
2027 costs_add_n_insns (struct full_rtx_costs *c, int n)
2029 c->speed += COSTS_N_INSNS (n);
2030 c->size += COSTS_N_INSNS (n);
2033 /* Describes the shape of a subreg:
2035 inner_mode == the mode of the SUBREG_REG
2036 offset == the SUBREG_BYTE
2037 outer_mode == the mode of the SUBREG itself. */
2038 struct subreg_shape {
2039 subreg_shape (machine_mode, unsigned int, machine_mode);
2040 bool operator == (const subreg_shape &) const;
2041 bool operator != (const subreg_shape &) const;
2042 unsigned int unique_id () const;
2044 machine_mode inner_mode;
2045 unsigned int offset;
2046 machine_mode outer_mode;
2049 inline
2050 subreg_shape::subreg_shape (machine_mode inner_mode_in,
2051 unsigned int offset_in,
2052 machine_mode outer_mode_in)
2053 : inner_mode (inner_mode_in), offset (offset_in), outer_mode (outer_mode_in)
2056 inline bool
2057 subreg_shape::operator == (const subreg_shape &other) const
2059 return (inner_mode == other.inner_mode
2060 && offset == other.offset
2061 && outer_mode == other.outer_mode);
2064 inline bool
2065 subreg_shape::operator != (const subreg_shape &other) const
2067 return !operator == (other);
2070 /* Return an integer that uniquely identifies this shape. Structures
2071 like rtx_def assume that a mode can fit in an 8-bit bitfield and no
2072 current mode is anywhere near being 65536 bytes in size, so the
2073 id comfortably fits in an int. */
2075 inline unsigned int
2076 subreg_shape::unique_id () const
2078 STATIC_ASSERT (MAX_MACHINE_MODE <= 256);
2079 return (int) inner_mode + ((int) outer_mode << 8) + (offset << 16);
2082 /* Return the shape of a SUBREG rtx. */
2084 static inline subreg_shape
2085 shape_of_subreg (const_rtx x)
2087 return subreg_shape (GET_MODE (SUBREG_REG (x)),
2088 SUBREG_BYTE (x), GET_MODE (x));
2091 /* Information about an address. This structure is supposed to be able
2092 to represent all supported target addresses. Please extend it if it
2093 is not yet general enough. */
2094 struct address_info {
2095 /* The mode of the value being addressed, or VOIDmode if this is
2096 a load-address operation with no known address mode. */
2097 machine_mode mode;
2099 /* The address space. */
2100 addr_space_t as;
2102 /* True if this is an RTX_AUTOINC address. */
2103 bool autoinc_p;
2105 /* A pointer to the top-level address. */
2106 rtx *outer;
2108 /* A pointer to the inner address, after all address mutations
2109 have been stripped from the top-level address. It can be one
2110 of the following:
2112 - A {PRE,POST}_{INC,DEC} of *BASE. SEGMENT, INDEX and DISP are null.
2114 - A {PRE,POST}_MODIFY of *BASE. In this case either INDEX or DISP
2115 points to the step value, depending on whether the step is variable
2116 or constant respectively. SEGMENT is null.
2118 - A plain sum of the form SEGMENT + BASE + INDEX + DISP,
2119 with null fields evaluating to 0. */
2120 rtx *inner;
2122 /* Components that make up *INNER. Each one may be null or nonnull.
2123 When nonnull, their meanings are as follows:
2125 - *SEGMENT is the "segment" of memory to which the address refers.
2126 This value is entirely target-specific and is only called a "segment"
2127 because that's its most typical use. It contains exactly one UNSPEC,
2128 pointed to by SEGMENT_TERM. The contents of *SEGMENT do not need
2129 reloading.
2131 - *BASE is a variable expression representing a base address.
2132 It contains exactly one REG, SUBREG or MEM, pointed to by BASE_TERM.
2134 - *INDEX is a variable expression representing an index value.
2135 It may be a scaled expression, such as a MULT. It has exactly
2136 one REG, SUBREG or MEM, pointed to by INDEX_TERM.
2138 - *DISP is a constant, possibly mutated. DISP_TERM points to the
2139 unmutated RTX_CONST_OBJ. */
2140 rtx *segment;
2141 rtx *base;
2142 rtx *index;
2143 rtx *disp;
2145 rtx *segment_term;
2146 rtx *base_term;
2147 rtx *index_term;
2148 rtx *disp_term;
2150 /* In a {PRE,POST}_MODIFY address, this points to a second copy
2151 of BASE_TERM, otherwise it is null. */
2152 rtx *base_term2;
2154 /* ADDRESS if this structure describes an address operand, MEM if
2155 it describes a MEM address. */
2156 enum rtx_code addr_outer_code;
2158 /* If BASE is nonnull, this is the code of the rtx that contains it. */
2159 enum rtx_code base_outer_code;
2162 /* This is used to bundle an rtx and a mode together so that the pair
2163 can be used with the wi:: routines. If we ever put modes into rtx
2164 integer constants, this should go away and then just pass an rtx in. */
2165 typedef std::pair <rtx, machine_mode> rtx_mode_t;
2167 namespace wi
2169 template <>
2170 struct int_traits <rtx_mode_t>
2172 static const enum precision_type precision_type = VAR_PRECISION;
2173 static const bool host_dependent_precision = false;
2174 /* This ought to be true, except for the special case that BImode
2175 is canonicalized to STORE_FLAG_VALUE, which might be 1. */
2176 static const bool is_sign_extended = false;
2177 static unsigned int get_precision (const rtx_mode_t &);
2178 static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int,
2179 const rtx_mode_t &);
2183 inline unsigned int
2184 wi::int_traits <rtx_mode_t>::get_precision (const rtx_mode_t &x)
2186 return GET_MODE_PRECISION (as_a <scalar_mode> (x.second));
2189 inline wi::storage_ref
2190 wi::int_traits <rtx_mode_t>::decompose (HOST_WIDE_INT *,
2191 unsigned int precision,
2192 const rtx_mode_t &x)
2194 gcc_checking_assert (precision == get_precision (x));
2195 switch (GET_CODE (x.first))
2197 case CONST_INT:
2198 if (precision < HOST_BITS_PER_WIDE_INT)
2199 /* Nonzero BImodes are stored as STORE_FLAG_VALUE, which on many
2200 targets is 1 rather than -1. */
2201 gcc_checking_assert (INTVAL (x.first)
2202 == sext_hwi (INTVAL (x.first), precision)
2203 || (x.second == BImode && INTVAL (x.first) == 1));
2205 return wi::storage_ref (&INTVAL (x.first), 1, precision);
2207 case CONST_WIDE_INT:
2208 return wi::storage_ref (&CONST_WIDE_INT_ELT (x.first, 0),
2209 CONST_WIDE_INT_NUNITS (x.first), precision);
2211 #if TARGET_SUPPORTS_WIDE_INT == 0
2212 case CONST_DOUBLE:
2213 return wi::storage_ref (&CONST_DOUBLE_LOW (x.first), 2, precision);
2214 #endif
2216 default:
2217 gcc_unreachable ();
2221 namespace wi
2223 hwi_with_prec shwi (HOST_WIDE_INT, machine_mode mode);
2224 wide_int min_value (machine_mode, signop);
2225 wide_int max_value (machine_mode, signop);
2228 inline wi::hwi_with_prec
2229 wi::shwi (HOST_WIDE_INT val, machine_mode mode)
2231 return shwi (val, GET_MODE_PRECISION (as_a <scalar_mode> (mode)));
2234 /* Produce the smallest number that is represented in MODE. The precision
2235 is taken from MODE and the sign from SGN. */
2236 inline wide_int
2237 wi::min_value (machine_mode mode, signop sgn)
2239 return min_value (GET_MODE_PRECISION (as_a <scalar_mode> (mode)), sgn);
2242 /* Produce the largest number that is represented in MODE. The precision
2243 is taken from MODE and the sign from SGN. */
2244 inline wide_int
2245 wi::max_value (machine_mode mode, signop sgn)
2247 return max_value (GET_MODE_PRECISION (as_a <scalar_mode> (mode)), sgn);
2250 namespace wi
2252 typedef poly_int<NUM_POLY_INT_COEFFS,
2253 generic_wide_int <wide_int_ref_storage <false, false> > >
2254 rtx_to_poly_wide_ref;
2255 rtx_to_poly_wide_ref to_poly_wide (const_rtx, machine_mode);
2258 /* Return the value of a CONST_POLY_INT in its native precision. */
2260 inline wi::rtx_to_poly_wide_ref
2261 const_poly_int_value (const_rtx x)
2263 poly_int<NUM_POLY_INT_COEFFS, WIDE_INT_REF_FOR (wide_int)> res;
2264 for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
2265 res.coeffs[i] = CONST_POLY_INT_COEFFS (x)[i];
2266 return res;
2269 /* Return true if X is a scalar integer or a CONST_POLY_INT. The value
2270 can then be extracted using wi::to_poly_wide. */
2272 inline bool
2273 poly_int_rtx_p (const_rtx x)
2275 return CONST_SCALAR_INT_P (x) || CONST_POLY_INT_P (x);
2278 /* Access X (which satisfies poly_int_rtx_p) as a poly_wide_int.
2279 MODE is the mode of X. */
2281 inline wi::rtx_to_poly_wide_ref
2282 wi::to_poly_wide (const_rtx x, machine_mode mode)
2284 if (CONST_POLY_INT_P (x))
2285 return const_poly_int_value (x);
2286 return rtx_mode_t (const_cast<rtx> (x), mode);
2289 /* Return the value of X as a poly_int64. */
2291 inline poly_int64
2292 rtx_to_poly_int64 (const_rtx x)
2294 if (CONST_POLY_INT_P (x))
2296 poly_int64 res;
2297 for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
2298 res.coeffs[i] = CONST_POLY_INT_COEFFS (x)[i].to_shwi ();
2299 return res;
2301 return INTVAL (x);
2304 /* Return true if arbitrary value X is an integer constant that can
2305 be represented as a poly_int64. Store the value in *RES if so,
2306 otherwise leave it unmodified. */
2308 inline bool
2309 poly_int_rtx_p (const_rtx x, poly_int64_pod *res)
2311 if (CONST_INT_P (x))
2313 *res = INTVAL (x);
2314 return true;
2316 if (CONST_POLY_INT_P (x))
2318 for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
2319 if (!wi::fits_shwi_p (CONST_POLY_INT_COEFFS (x)[i]))
2320 return false;
2321 for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
2322 res->coeffs[i] = CONST_POLY_INT_COEFFS (x)[i].to_shwi ();
2323 return true;
2325 return false;
2328 extern void init_rtlanal (void);
2329 extern int rtx_cost (rtx, machine_mode, enum rtx_code, int, bool);
2330 extern int address_cost (rtx, machine_mode, addr_space_t, bool);
2331 extern void get_full_rtx_cost (rtx, machine_mode, enum rtx_code, int,
2332 struct full_rtx_costs *);
2333 extern unsigned int subreg_lsb (const_rtx);
2334 extern unsigned int subreg_lsb_1 (machine_mode, machine_mode,
2335 unsigned int);
2336 extern unsigned int subreg_size_offset_from_lsb (unsigned int, unsigned int,
2337 unsigned int);
2338 extern bool read_modify_subreg_p (const_rtx);
2340 /* Return the subreg byte offset for a subreg whose outer mode is
2341 OUTER_MODE, whose inner mode is INNER_MODE, and where there are
2342 LSB_SHIFT *bits* between the lsb of the outer value and the lsb of
2343 the inner value. This is the inverse of subreg_lsb_1 (which converts
2344 byte offsets to bit shifts). */
2346 inline unsigned int
2347 subreg_offset_from_lsb (machine_mode outer_mode,
2348 machine_mode inner_mode,
2349 unsigned int lsb_shift)
2351 return subreg_size_offset_from_lsb (GET_MODE_SIZE (outer_mode),
2352 GET_MODE_SIZE (inner_mode), lsb_shift);
2355 extern unsigned int subreg_regno_offset (unsigned int, machine_mode,
2356 unsigned int, machine_mode);
2357 extern bool subreg_offset_representable_p (unsigned int, machine_mode,
2358 unsigned int, machine_mode);
2359 extern unsigned int subreg_regno (const_rtx);
2360 extern int simplify_subreg_regno (unsigned int, machine_mode,
2361 unsigned int, machine_mode);
2362 extern unsigned int subreg_nregs (const_rtx);
2363 extern unsigned int subreg_nregs_with_regno (unsigned int, const_rtx);
2364 extern unsigned HOST_WIDE_INT nonzero_bits (const_rtx, machine_mode);
2365 extern unsigned int num_sign_bit_copies (const_rtx, machine_mode);
2366 extern bool constant_pool_constant_p (rtx);
2367 extern bool truncated_to_mode (machine_mode, const_rtx);
2368 extern int low_bitmask_len (machine_mode, unsigned HOST_WIDE_INT);
2369 extern void split_double (rtx, rtx *, rtx *);
2370 extern rtx *strip_address_mutations (rtx *, enum rtx_code * = 0);
2371 extern void decompose_address (struct address_info *, rtx *,
2372 machine_mode, addr_space_t, enum rtx_code);
2373 extern void decompose_lea_address (struct address_info *, rtx *);
2374 extern void decompose_mem_address (struct address_info *, rtx);
2375 extern void update_address (struct address_info *);
2376 extern HOST_WIDE_INT get_index_scale (const struct address_info *);
2377 extern enum rtx_code get_index_code (const struct address_info *);
2379 /* 1 if RTX is a subreg containing a reg that is already known to be
2380 sign- or zero-extended from the mode of the subreg to the mode of
2381 the reg. SUBREG_PROMOTED_UNSIGNED_P gives the signedness of the
2382 extension.
2384 When used as a LHS, is means that this extension must be done
2385 when assigning to SUBREG_REG. */
2387 #define SUBREG_PROMOTED_VAR_P(RTX) \
2388 (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED", (RTX), SUBREG)->in_struct)
2390 /* Valid for subregs which are SUBREG_PROMOTED_VAR_P(). In that case
2391 this gives the necessary extensions:
2392 0 - signed (SPR_SIGNED)
2393 1 - normal unsigned (SPR_UNSIGNED)
2394 2 - value is both sign and unsign extended for mode
2395 (SPR_SIGNED_AND_UNSIGNED).
2396 -1 - pointer unsigned, which most often can be handled like unsigned
2397 extension, except for generating instructions where we need to
2398 emit special code (ptr_extend insns) on some architectures
2399 (SPR_POINTER). */
2401 const int SRP_POINTER = -1;
2402 const int SRP_SIGNED = 0;
2403 const int SRP_UNSIGNED = 1;
2404 const int SRP_SIGNED_AND_UNSIGNED = 2;
2406 /* Sets promoted mode for SUBREG_PROMOTED_VAR_P(). */
2407 #define SUBREG_PROMOTED_SET(RTX, VAL) \
2408 do { \
2409 rtx const _rtx = RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SET", \
2410 (RTX), SUBREG); \
2411 switch (VAL) \
2413 case SRP_POINTER: \
2414 _rtx->volatil = 0; \
2415 _rtx->unchanging = 0; \
2416 break; \
2417 case SRP_SIGNED: \
2418 _rtx->volatil = 0; \
2419 _rtx->unchanging = 1; \
2420 break; \
2421 case SRP_UNSIGNED: \
2422 _rtx->volatil = 1; \
2423 _rtx->unchanging = 0; \
2424 break; \
2425 case SRP_SIGNED_AND_UNSIGNED: \
2426 _rtx->volatil = 1; \
2427 _rtx->unchanging = 1; \
2428 break; \
2430 } while (0)
2432 /* Gets the value stored in promoted mode for SUBREG_PROMOTED_VAR_P(),
2433 including SRP_SIGNED_AND_UNSIGNED if promoted for
2434 both signed and unsigned. */
2435 #define SUBREG_PROMOTED_GET(RTX) \
2436 (2 * (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_GET", (RTX), SUBREG)->volatil)\
2437 + (RTX)->unchanging - 1)
2439 /* Returns sign of promoted mode for SUBREG_PROMOTED_VAR_P(). */
2440 #define SUBREG_PROMOTED_SIGN(RTX) \
2441 ((RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SIGN", (RTX), SUBREG)->volatil) ? 1\
2442 : (RTX)->unchanging - 1)
2444 /* Predicate to check if RTX of SUBREG_PROMOTED_VAR_P() is promoted
2445 for SIGNED type. */
2446 #define SUBREG_PROMOTED_SIGNED_P(RTX) \
2447 (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SIGNED_P", (RTX), SUBREG)->unchanging)
2449 /* Predicate to check if RTX of SUBREG_PROMOTED_VAR_P() is promoted
2450 for UNSIGNED type. */
2451 #define SUBREG_PROMOTED_UNSIGNED_P(RTX) \
2452 (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_P", (RTX), SUBREG)->volatil)
2454 /* Checks if RTX of SUBREG_PROMOTED_VAR_P() is promoted for given SIGN. */
2455 #define SUBREG_CHECK_PROMOTED_SIGN(RTX, SIGN) \
2456 ((SIGN) == SRP_POINTER ? SUBREG_PROMOTED_GET (RTX) == SRP_POINTER \
2457 : (SIGN) == SRP_SIGNED ? SUBREG_PROMOTED_SIGNED_P (RTX) \
2458 : SUBREG_PROMOTED_UNSIGNED_P (RTX))
2460 /* True if the REG is the static chain register for some CALL_INSN. */
2461 #define STATIC_CHAIN_REG_P(RTX) \
2462 (RTL_FLAG_CHECK1 ("STATIC_CHAIN_REG_P", (RTX), REG)->jump)
2464 /* True if the subreg was generated by LRA for reload insns. Such
2465 subregs are valid only during LRA. */
2466 #define LRA_SUBREG_P(RTX) \
2467 (RTL_FLAG_CHECK1 ("LRA_SUBREG_P", (RTX), SUBREG)->jump)
2469 /* True if call is instrumented by Pointer Bounds Checker. */
2470 #define CALL_EXPR_WITH_BOUNDS_P(RTX) \
2471 (RTL_FLAG_CHECK1 ("CALL_EXPR_WITH_BOUNDS_P", (RTX), CALL)->jump)
2473 /* Access various components of an ASM_OPERANDS rtx. */
2475 #define ASM_OPERANDS_TEMPLATE(RTX) XCSTR (RTX, 0, ASM_OPERANDS)
2476 #define ASM_OPERANDS_OUTPUT_CONSTRAINT(RTX) XCSTR (RTX, 1, ASM_OPERANDS)
2477 #define ASM_OPERANDS_OUTPUT_IDX(RTX) XCINT (RTX, 2, ASM_OPERANDS)
2478 #define ASM_OPERANDS_INPUT_VEC(RTX) XCVEC (RTX, 3, ASM_OPERANDS)
2479 #define ASM_OPERANDS_INPUT_CONSTRAINT_VEC(RTX) XCVEC (RTX, 4, ASM_OPERANDS)
2480 #define ASM_OPERANDS_INPUT(RTX, N) XCVECEXP (RTX, 3, N, ASM_OPERANDS)
2481 #define ASM_OPERANDS_INPUT_LENGTH(RTX) XCVECLEN (RTX, 3, ASM_OPERANDS)
2482 #define ASM_OPERANDS_INPUT_CONSTRAINT_EXP(RTX, N) \
2483 XCVECEXP (RTX, 4, N, ASM_OPERANDS)
2484 #define ASM_OPERANDS_INPUT_CONSTRAINT(RTX, N) \
2485 XSTR (XCVECEXP (RTX, 4, N, ASM_OPERANDS), 0)
2486 #define ASM_OPERANDS_INPUT_MODE(RTX, N) \
2487 GET_MODE (XCVECEXP (RTX, 4, N, ASM_OPERANDS))
2488 #define ASM_OPERANDS_LABEL_VEC(RTX) XCVEC (RTX, 5, ASM_OPERANDS)
2489 #define ASM_OPERANDS_LABEL_LENGTH(RTX) XCVECLEN (RTX, 5, ASM_OPERANDS)
2490 #define ASM_OPERANDS_LABEL(RTX, N) XCVECEXP (RTX, 5, N, ASM_OPERANDS)
2491 #define ASM_OPERANDS_SOURCE_LOCATION(RTX) XCUINT (RTX, 6, ASM_OPERANDS)
2492 #define ASM_INPUT_SOURCE_LOCATION(RTX) XCUINT (RTX, 1, ASM_INPUT)
2494 /* 1 if RTX is a mem that is statically allocated in read-only memory. */
2495 #define MEM_READONLY_P(RTX) \
2496 (RTL_FLAG_CHECK1 ("MEM_READONLY_P", (RTX), MEM)->unchanging)
2498 /* 1 if RTX is a mem and we should keep the alias set for this mem
2499 unchanged when we access a component. Set to 1, or example, when we
2500 are already in a non-addressable component of an aggregate. */
2501 #define MEM_KEEP_ALIAS_SET_P(RTX) \
2502 (RTL_FLAG_CHECK1 ("MEM_KEEP_ALIAS_SET_P", (RTX), MEM)->jump)
2504 /* 1 if RTX is a mem or asm_operand for a volatile reference. */
2505 #define MEM_VOLATILE_P(RTX) \
2506 (RTL_FLAG_CHECK3 ("MEM_VOLATILE_P", (RTX), MEM, ASM_OPERANDS, \
2507 ASM_INPUT)->volatil)
2509 /* 1 if RTX is a mem that cannot trap. */
2510 #define MEM_NOTRAP_P(RTX) \
2511 (RTL_FLAG_CHECK1 ("MEM_NOTRAP_P", (RTX), MEM)->call)
2513 /* The memory attribute block. We provide access macros for each value
2514 in the block and provide defaults if none specified. */
2515 #define MEM_ATTRS(RTX) X0MEMATTR (RTX, 1)
2517 /* The register attribute block. We provide access macros for each value
2518 in the block and provide defaults if none specified. */
2519 #define REG_ATTRS(RTX) (REG_CHECK (RTX)->attrs)
2521 #ifndef GENERATOR_FILE
2522 /* For a MEM rtx, the alias set. If 0, this MEM is not in any alias
2523 set, and may alias anything. Otherwise, the MEM can only alias
2524 MEMs in a conflicting alias set. This value is set in a
2525 language-dependent manner in the front-end, and should not be
2526 altered in the back-end. These set numbers are tested with
2527 alias_sets_conflict_p. */
2528 #define MEM_ALIAS_SET(RTX) (get_mem_attrs (RTX)->alias)
2530 /* For a MEM rtx, the decl it is known to refer to, if it is known to
2531 refer to part of a DECL. It may also be a COMPONENT_REF. */
2532 #define MEM_EXPR(RTX) (get_mem_attrs (RTX)->expr)
2534 /* For a MEM rtx, true if its MEM_OFFSET is known. */
2535 #define MEM_OFFSET_KNOWN_P(RTX) (get_mem_attrs (RTX)->offset_known_p)
2537 /* For a MEM rtx, the offset from the start of MEM_EXPR. */
2538 #define MEM_OFFSET(RTX) (get_mem_attrs (RTX)->offset)
2540 /* For a MEM rtx, the address space. */
2541 #define MEM_ADDR_SPACE(RTX) (get_mem_attrs (RTX)->addrspace)
2543 /* For a MEM rtx, true if its MEM_SIZE is known. */
2544 #define MEM_SIZE_KNOWN_P(RTX) (get_mem_attrs (RTX)->size_known_p)
2546 /* For a MEM rtx, the size in bytes of the MEM. */
2547 #define MEM_SIZE(RTX) (get_mem_attrs (RTX)->size)
2549 /* For a MEM rtx, the alignment in bits. We can use the alignment of the
2550 mode as a default when STRICT_ALIGNMENT, but not if not. */
2551 #define MEM_ALIGN(RTX) (get_mem_attrs (RTX)->align)
2552 #else
2553 #define MEM_ADDR_SPACE(RTX) ADDR_SPACE_GENERIC
2554 #endif
2556 /* For a REG rtx, the decl it is known to refer to, if it is known to
2557 refer to part of a DECL. */
2558 #define REG_EXPR(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->decl)
2560 /* For a REG rtx, the offset from the start of REG_EXPR, if known, as an
2561 HOST_WIDE_INT. */
2562 #define REG_OFFSET(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->offset)
2564 /* Copy the attributes that apply to memory locations from RHS to LHS. */
2565 #define MEM_COPY_ATTRIBUTES(LHS, RHS) \
2566 (MEM_VOLATILE_P (LHS) = MEM_VOLATILE_P (RHS), \
2567 MEM_NOTRAP_P (LHS) = MEM_NOTRAP_P (RHS), \
2568 MEM_READONLY_P (LHS) = MEM_READONLY_P (RHS), \
2569 MEM_KEEP_ALIAS_SET_P (LHS) = MEM_KEEP_ALIAS_SET_P (RHS), \
2570 MEM_POINTER (LHS) = MEM_POINTER (RHS), \
2571 MEM_ATTRS (LHS) = MEM_ATTRS (RHS))
2573 /* 1 if RTX is a label_ref for a nonlocal label. */
2574 /* Likewise in an expr_list for a REG_LABEL_OPERAND or
2575 REG_LABEL_TARGET note. */
2576 #define LABEL_REF_NONLOCAL_P(RTX) \
2577 (RTL_FLAG_CHECK1 ("LABEL_REF_NONLOCAL_P", (RTX), LABEL_REF)->volatil)
2579 /* 1 if RTX is a code_label that should always be considered to be needed. */
2580 #define LABEL_PRESERVE_P(RTX) \
2581 (RTL_FLAG_CHECK2 ("LABEL_PRESERVE_P", (RTX), CODE_LABEL, NOTE)->in_struct)
2583 /* During sched, 1 if RTX is an insn that must be scheduled together
2584 with the preceding insn. */
2585 #define SCHED_GROUP_P(RTX) \
2586 (RTL_FLAG_CHECK4 ("SCHED_GROUP_P", (RTX), DEBUG_INSN, INSN, \
2587 JUMP_INSN, CALL_INSN)->in_struct)
2589 /* For a SET rtx, SET_DEST is the place that is set
2590 and SET_SRC is the value it is set to. */
2591 #define SET_DEST(RTX) XC2EXP (RTX, 0, SET, CLOBBER)
2592 #define SET_SRC(RTX) XCEXP (RTX, 1, SET)
2593 #define SET_IS_RETURN_P(RTX) \
2594 (RTL_FLAG_CHECK1 ("SET_IS_RETURN_P", (RTX), SET)->jump)
2596 /* For a TRAP_IF rtx, TRAP_CONDITION is an expression. */
2597 #define TRAP_CONDITION(RTX) XCEXP (RTX, 0, TRAP_IF)
2598 #define TRAP_CODE(RTX) XCEXP (RTX, 1, TRAP_IF)
2600 /* For a COND_EXEC rtx, COND_EXEC_TEST is the condition to base
2601 conditionally executing the code on, COND_EXEC_CODE is the code
2602 to execute if the condition is true. */
2603 #define COND_EXEC_TEST(RTX) XCEXP (RTX, 0, COND_EXEC)
2604 #define COND_EXEC_CODE(RTX) XCEXP (RTX, 1, COND_EXEC)
2606 /* 1 if RTX is a symbol_ref that addresses this function's rtl
2607 constants pool. */
2608 #define CONSTANT_POOL_ADDRESS_P(RTX) \
2609 (RTL_FLAG_CHECK1 ("CONSTANT_POOL_ADDRESS_P", (RTX), SYMBOL_REF)->unchanging)
2611 /* 1 if RTX is a symbol_ref that addresses a value in the file's
2612 tree constant pool. This information is private to varasm.c. */
2613 #define TREE_CONSTANT_POOL_ADDRESS_P(RTX) \
2614 (RTL_FLAG_CHECK1 ("TREE_CONSTANT_POOL_ADDRESS_P", \
2615 (RTX), SYMBOL_REF)->frame_related)
2617 /* Used if RTX is a symbol_ref, for machine-specific purposes. */
2618 #define SYMBOL_REF_FLAG(RTX) \
2619 (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAG", (RTX), SYMBOL_REF)->volatil)
2621 /* 1 if RTX is a symbol_ref that has been the library function in
2622 emit_library_call. */
2623 #define SYMBOL_REF_USED(RTX) \
2624 (RTL_FLAG_CHECK1 ("SYMBOL_REF_USED", (RTX), SYMBOL_REF)->used)
2626 /* 1 if RTX is a symbol_ref for a weak symbol. */
2627 #define SYMBOL_REF_WEAK(RTX) \
2628 (RTL_FLAG_CHECK1 ("SYMBOL_REF_WEAK", (RTX), SYMBOL_REF)->return_val)
2630 /* A pointer attached to the SYMBOL_REF; either SYMBOL_REF_DECL or
2631 SYMBOL_REF_CONSTANT. */
2632 #define SYMBOL_REF_DATA(RTX) X0ANY ((RTX), 1)
2634 /* Set RTX's SYMBOL_REF_DECL to DECL. RTX must not be a constant
2635 pool symbol. */
2636 #define SET_SYMBOL_REF_DECL(RTX, DECL) \
2637 (gcc_assert (!CONSTANT_POOL_ADDRESS_P (RTX)), X0TREE ((RTX), 1) = (DECL))
2639 /* The tree (decl or constant) associated with the symbol, or null. */
2640 #define SYMBOL_REF_DECL(RTX) \
2641 (CONSTANT_POOL_ADDRESS_P (RTX) ? NULL : X0TREE ((RTX), 1))
2643 /* Set RTX's SYMBOL_REF_CONSTANT to C. RTX must be a constant pool symbol. */
2644 #define SET_SYMBOL_REF_CONSTANT(RTX, C) \
2645 (gcc_assert (CONSTANT_POOL_ADDRESS_P (RTX)), X0CONSTANT ((RTX), 1) = (C))
2647 /* The rtx constant pool entry for a symbol, or null. */
2648 #define SYMBOL_REF_CONSTANT(RTX) \
2649 (CONSTANT_POOL_ADDRESS_P (RTX) ? X0CONSTANT ((RTX), 1) : NULL)
2651 /* A set of flags on a symbol_ref that are, in some respects, redundant with
2652 information derivable from the tree decl associated with this symbol.
2653 Except that we build a *lot* of SYMBOL_REFs that aren't associated with a
2654 decl. In some cases this is a bug. But beyond that, it's nice to cache
2655 this information to avoid recomputing it. Finally, this allows space for
2656 the target to store more than one bit of information, as with
2657 SYMBOL_REF_FLAG. */
2658 #define SYMBOL_REF_FLAGS(RTX) \
2659 (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAGS", (RTX), SYMBOL_REF) \
2660 ->u2.symbol_ref_flags)
2662 /* These flags are common enough to be defined for all targets. They
2663 are computed by the default version of targetm.encode_section_info. */
2665 /* Set if this symbol is a function. */
2666 #define SYMBOL_FLAG_FUNCTION (1 << 0)
2667 #define SYMBOL_REF_FUNCTION_P(RTX) \
2668 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_FUNCTION) != 0)
2669 /* Set if targetm.binds_local_p is true. */
2670 #define SYMBOL_FLAG_LOCAL (1 << 1)
2671 #define SYMBOL_REF_LOCAL_P(RTX) \
2672 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_LOCAL) != 0)
2673 /* Set if targetm.in_small_data_p is true. */
2674 #define SYMBOL_FLAG_SMALL (1 << 2)
2675 #define SYMBOL_REF_SMALL_P(RTX) \
2676 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_SMALL) != 0)
2677 /* The three-bit field at [5:3] is true for TLS variables; use
2678 SYMBOL_REF_TLS_MODEL to extract the field as an enum tls_model. */
2679 #define SYMBOL_FLAG_TLS_SHIFT 3
2680 #define SYMBOL_REF_TLS_MODEL(RTX) \
2681 ((enum tls_model) ((SYMBOL_REF_FLAGS (RTX) >> SYMBOL_FLAG_TLS_SHIFT) & 7))
2682 /* Set if this symbol is not defined in this translation unit. */
2683 #define SYMBOL_FLAG_EXTERNAL (1 << 6)
2684 #define SYMBOL_REF_EXTERNAL_P(RTX) \
2685 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_EXTERNAL) != 0)
2686 /* Set if this symbol has a block_symbol structure associated with it. */
2687 #define SYMBOL_FLAG_HAS_BLOCK_INFO (1 << 7)
2688 #define SYMBOL_REF_HAS_BLOCK_INFO_P(RTX) \
2689 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_HAS_BLOCK_INFO) != 0)
2690 /* Set if this symbol is a section anchor. SYMBOL_REF_ANCHOR_P implies
2691 SYMBOL_REF_HAS_BLOCK_INFO_P. */
2692 #define SYMBOL_FLAG_ANCHOR (1 << 8)
2693 #define SYMBOL_REF_ANCHOR_P(RTX) \
2694 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_ANCHOR) != 0)
2696 /* Subsequent bits are available for the target to use. */
2697 #define SYMBOL_FLAG_MACH_DEP_SHIFT 9
2698 #define SYMBOL_FLAG_MACH_DEP (1 << SYMBOL_FLAG_MACH_DEP_SHIFT)
2700 /* If SYMBOL_REF_HAS_BLOCK_INFO_P (RTX), this is the object_block
2701 structure to which the symbol belongs, or NULL if it has not been
2702 assigned a block. */
2703 #define SYMBOL_REF_BLOCK(RTX) (BLOCK_SYMBOL_CHECK (RTX)->block)
2705 /* If SYMBOL_REF_HAS_BLOCK_INFO_P (RTX), this is the offset of RTX from
2706 the first object in SYMBOL_REF_BLOCK (RTX). The value is negative if
2707 RTX has not yet been assigned to a block, or it has not been given an
2708 offset within that block. */
2709 #define SYMBOL_REF_BLOCK_OFFSET(RTX) (BLOCK_SYMBOL_CHECK (RTX)->offset)
2711 /* True if RTX is flagged to be a scheduling barrier. */
2712 #define PREFETCH_SCHEDULE_BARRIER_P(RTX) \
2713 (RTL_FLAG_CHECK1 ("PREFETCH_SCHEDULE_BARRIER_P", (RTX), PREFETCH)->volatil)
2715 /* Indicate whether the machine has any sort of auto increment addressing.
2716 If not, we can avoid checking for REG_INC notes. */
2718 #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) \
2719 || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT) \
2720 || defined (HAVE_PRE_MODIFY_DISP) || defined (HAVE_POST_MODIFY_DISP) \
2721 || defined (HAVE_PRE_MODIFY_REG) || defined (HAVE_POST_MODIFY_REG))
2722 #define AUTO_INC_DEC 1
2723 #else
2724 #define AUTO_INC_DEC 0
2725 #endif
2727 /* Define a macro to look for REG_INC notes,
2728 but save time on machines where they never exist. */
2730 #if AUTO_INC_DEC
2731 #define FIND_REG_INC_NOTE(INSN, REG) \
2732 ((REG) != NULL_RTX && REG_P ((REG)) \
2733 ? find_regno_note ((INSN), REG_INC, REGNO (REG)) \
2734 : find_reg_note ((INSN), REG_INC, (REG)))
2735 #else
2736 #define FIND_REG_INC_NOTE(INSN, REG) 0
2737 #endif
2739 #ifndef HAVE_PRE_INCREMENT
2740 #define HAVE_PRE_INCREMENT 0
2741 #endif
2743 #ifndef HAVE_PRE_DECREMENT
2744 #define HAVE_PRE_DECREMENT 0
2745 #endif
2747 #ifndef HAVE_POST_INCREMENT
2748 #define HAVE_POST_INCREMENT 0
2749 #endif
2751 #ifndef HAVE_POST_DECREMENT
2752 #define HAVE_POST_DECREMENT 0
2753 #endif
2755 #ifndef HAVE_POST_MODIFY_DISP
2756 #define HAVE_POST_MODIFY_DISP 0
2757 #endif
2759 #ifndef HAVE_POST_MODIFY_REG
2760 #define HAVE_POST_MODIFY_REG 0
2761 #endif
2763 #ifndef HAVE_PRE_MODIFY_DISP
2764 #define HAVE_PRE_MODIFY_DISP 0
2765 #endif
2767 #ifndef HAVE_PRE_MODIFY_REG
2768 #define HAVE_PRE_MODIFY_REG 0
2769 #endif
2772 /* Some architectures do not have complete pre/post increment/decrement
2773 instruction sets, or only move some modes efficiently. These macros
2774 allow us to tune autoincrement generation. */
2776 #ifndef USE_LOAD_POST_INCREMENT
2777 #define USE_LOAD_POST_INCREMENT(MODE) HAVE_POST_INCREMENT
2778 #endif
2780 #ifndef USE_LOAD_POST_DECREMENT
2781 #define USE_LOAD_POST_DECREMENT(MODE) HAVE_POST_DECREMENT
2782 #endif
2784 #ifndef USE_LOAD_PRE_INCREMENT
2785 #define USE_LOAD_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT
2786 #endif
2788 #ifndef USE_LOAD_PRE_DECREMENT
2789 #define USE_LOAD_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT
2790 #endif
2792 #ifndef USE_STORE_POST_INCREMENT
2793 #define USE_STORE_POST_INCREMENT(MODE) HAVE_POST_INCREMENT
2794 #endif
2796 #ifndef USE_STORE_POST_DECREMENT
2797 #define USE_STORE_POST_DECREMENT(MODE) HAVE_POST_DECREMENT
2798 #endif
2800 #ifndef USE_STORE_PRE_INCREMENT
2801 #define USE_STORE_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT
2802 #endif
2804 #ifndef USE_STORE_PRE_DECREMENT
2805 #define USE_STORE_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT
2806 #endif
2808 /* Nonzero when we are generating CONCATs. */
2809 extern int generating_concat_p;
2811 /* Nonzero when we are expanding trees to RTL. */
2812 extern int currently_expanding_to_rtl;
2814 /* Generally useful functions. */
2816 #ifndef GENERATOR_FILE
2817 /* Return the cost of SET X. SPEED_P is true if optimizing for speed
2818 rather than size. */
2820 static inline int
2821 set_rtx_cost (rtx x, bool speed_p)
2823 return rtx_cost (x, VOIDmode, INSN, 4, speed_p);
2826 /* Like set_rtx_cost, but return both the speed and size costs in C. */
2828 static inline void
2829 get_full_set_rtx_cost (rtx x, struct full_rtx_costs *c)
2831 get_full_rtx_cost (x, VOIDmode, INSN, 4, c);
2834 /* Return the cost of moving X into a register, relative to the cost
2835 of a register move. SPEED_P is true if optimizing for speed rather
2836 than size. */
2838 static inline int
2839 set_src_cost (rtx x, machine_mode mode, bool speed_p)
2841 return rtx_cost (x, mode, SET, 1, speed_p);
2844 /* Like set_src_cost, but return both the speed and size costs in C. */
2846 static inline void
2847 get_full_set_src_cost (rtx x, machine_mode mode, struct full_rtx_costs *c)
2849 get_full_rtx_cost (x, mode, SET, 1, c);
2851 #endif
2853 /* A convenience macro to validate the arguments of a zero_extract
2854 expression. It determines whether SIZE lies inclusively within
2855 [1, RANGE], POS lies inclusively within between [0, RANGE - 1]
2856 and the sum lies inclusively within [1, RANGE]. RANGE must be
2857 >= 1, but SIZE and POS may be negative. */
2858 #define EXTRACT_ARGS_IN_RANGE(SIZE, POS, RANGE) \
2859 (IN_RANGE ((POS), 0, (unsigned HOST_WIDE_INT) (RANGE) - 1) \
2860 && IN_RANGE ((SIZE), 1, (unsigned HOST_WIDE_INT) (RANGE) \
2861 - (unsigned HOST_WIDE_INT)(POS)))
2863 /* In explow.c */
2864 extern HOST_WIDE_INT trunc_int_for_mode (HOST_WIDE_INT, machine_mode);
2865 extern poly_int64 trunc_int_for_mode (poly_int64, machine_mode);
2866 extern rtx plus_constant (machine_mode, rtx, poly_int64, bool = false);
2867 extern HOST_WIDE_INT get_stack_check_protect (void);
2869 /* In rtl.c */
2870 extern rtx rtx_alloc (RTX_CODE CXX_MEM_STAT_INFO);
2871 extern rtx rtx_alloc_stat_v (RTX_CODE MEM_STAT_DECL, int);
2872 #define rtx_alloc_v(c, SZ) rtx_alloc_stat_v (c MEM_STAT_INFO, SZ)
2873 #define const_wide_int_alloc(NWORDS) \
2874 rtx_alloc_v (CONST_WIDE_INT, \
2875 (sizeof (struct hwivec_def) \
2876 + ((NWORDS)-1) * sizeof (HOST_WIDE_INT))) \
2878 extern rtvec rtvec_alloc (int);
2879 extern rtvec shallow_copy_rtvec (rtvec);
2880 extern bool shared_const_p (const_rtx);
2881 extern rtx copy_rtx (rtx);
2882 extern enum rtx_code classify_insn (rtx);
2883 extern void dump_rtx_statistics (void);
2885 /* In emit-rtl.c */
2886 extern rtx copy_rtx_if_shared (rtx);
2888 /* In rtl.c */
2889 extern unsigned int rtx_size (const_rtx);
2890 extern rtx shallow_copy_rtx (const_rtx CXX_MEM_STAT_INFO);
2891 extern int rtx_equal_p (const_rtx, const_rtx);
2892 extern bool rtvec_all_equal_p (const_rtvec);
2894 /* Return true if X is some form of vector constant. */
2896 inline bool
2897 const_vec_p (const_rtx x)
2899 return VECTOR_MODE_P (GET_MODE (x)) && CONSTANT_P (x);
2902 /* Return true if X is a vector constant with a duplicated element value. */
2904 inline bool
2905 const_vec_duplicate_p (const_rtx x)
2907 return ((GET_CODE (x) == CONST_VECTOR && rtvec_all_equal_p (XVEC (x, 0)))
2908 || (GET_CODE (x) == CONST
2909 && GET_CODE (XEXP (x, 0)) == VEC_DUPLICATE));
2912 /* Return true if X is a vector constant with a duplicated element value.
2913 Store the duplicated element in *ELT if so. */
2915 template <typename T>
2916 inline bool
2917 const_vec_duplicate_p (T x, T *elt)
2919 if (GET_CODE (x) == CONST_VECTOR && rtvec_all_equal_p (XVEC (x, 0)))
2921 *elt = CONST_VECTOR_ELT (x, 0);
2922 return true;
2924 if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == VEC_DUPLICATE)
2926 *elt = XEXP (XEXP (x, 0), 0);
2927 return true;
2929 return false;
2932 /* Return true if X is a vector with a duplicated element value, either
2933 constant or nonconstant. Store the duplicated element in *ELT if so. */
2935 template <typename T>
2936 inline bool
2937 vec_duplicate_p (T x, T *elt)
2939 if (GET_CODE (x) == VEC_DUPLICATE)
2941 *elt = XEXP (x, 0);
2942 return true;
2944 return const_vec_duplicate_p (x, elt);
2947 /* If X is a vector constant with a duplicated element value, return that
2948 element value, otherwise return X. */
2950 template <typename T>
2951 inline T
2952 unwrap_const_vec_duplicate (T x)
2954 if (GET_CODE (x) == CONST_VECTOR && rtvec_all_equal_p (XVEC (x, 0)))
2955 return CONST_VECTOR_ELT (x, 0);
2956 if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == VEC_DUPLICATE)
2957 return XEXP (XEXP (x, 0), 0);
2958 return x;
2961 /* In emit-rtl.c. */
2962 extern bool const_vec_series_p_1 (const_rtx, rtx *, rtx *);
2964 /* Return true if X is a constant vector that contains a linear series
2965 of the form:
2967 { B, B + S, B + 2 * S, B + 3 * S, ... }
2969 for a nonzero S. Store B and S in *BASE_OUT and *STEP_OUT on sucess. */
2971 inline bool
2972 const_vec_series_p (const_rtx x, rtx *base_out, rtx *step_out)
2974 if (GET_CODE (x) == CONST_VECTOR
2975 && GET_MODE_CLASS (GET_MODE (x)) == MODE_VECTOR_INT)
2976 return const_vec_series_p_1 (x, base_out, step_out);
2977 if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == VEC_SERIES)
2979 *base_out = XEXP (XEXP (x, 0), 0);
2980 *step_out = XEXP (XEXP (x, 0), 1);
2981 return true;
2983 return false;
2986 /* Return true if X is a vector that contains a linear series of the
2987 form:
2989 { B, B + S, B + 2 * S, B + 3 * S, ... }
2991 where B and S are constant or nonconstant. Store B and S in
2992 *BASE_OUT and *STEP_OUT on sucess. */
2994 inline bool
2995 vec_series_p (const_rtx x, rtx *base_out, rtx *step_out)
2997 if (GET_CODE (x) == VEC_SERIES)
2999 *base_out = XEXP (x, 0);
3000 *step_out = XEXP (x, 1);
3001 return true;
3003 return const_vec_series_p (x, base_out, step_out);
3006 /* Return the unpromoted (outer) mode of SUBREG_PROMOTED_VAR_P subreg X. */
3008 inline scalar_int_mode
3009 subreg_unpromoted_mode (rtx x)
3011 gcc_checking_assert (SUBREG_PROMOTED_VAR_P (x));
3012 return as_a <scalar_int_mode> (GET_MODE (x));
3015 /* Return the promoted (inner) mode of SUBREG_PROMOTED_VAR_P subreg X. */
3017 inline scalar_int_mode
3018 subreg_promoted_mode (rtx x)
3020 gcc_checking_assert (SUBREG_PROMOTED_VAR_P (x));
3021 return as_a <scalar_int_mode> (GET_MODE (SUBREG_REG (x)));
3024 /* In emit-rtl.c */
3025 extern rtvec gen_rtvec_v (int, rtx *);
3026 extern rtvec gen_rtvec_v (int, rtx_insn **);
3027 extern rtx gen_reg_rtx (machine_mode);
3028 extern rtx gen_rtx_REG_offset (rtx, machine_mode, unsigned int, poly_int64);
3029 extern rtx gen_reg_rtx_offset (rtx, machine_mode, int);
3030 extern rtx gen_reg_rtx_and_attrs (rtx);
3031 extern rtx_code_label *gen_label_rtx (void);
3032 extern rtx gen_lowpart_common (machine_mode, rtx);
3034 /* In cse.c */
3035 extern rtx gen_lowpart_if_possible (machine_mode, rtx);
3037 /* In emit-rtl.c */
3038 extern rtx gen_highpart (machine_mode, rtx);
3039 extern rtx gen_highpart_mode (machine_mode, machine_mode, rtx);
3040 extern rtx operand_subword (rtx, unsigned int, int, machine_mode);
3042 /* In emit-rtl.c */
3043 extern rtx operand_subword_force (rtx, unsigned int, machine_mode);
3044 extern int subreg_lowpart_p (const_rtx);
3045 extern unsigned int subreg_size_lowpart_offset (unsigned int, unsigned int);
3047 /* Return true if a subreg of mode OUTERMODE would only access part of
3048 an inner register with mode INNERMODE. The other bits of the inner
3049 register would then be "don't care" on read. The behavior for writes
3050 depends on REGMODE_NATURAL_SIZE; bits in the same REGMODE_NATURAL_SIZE-d
3051 chunk would be clobbered but other bits would be preserved. */
3053 inline bool
3054 partial_subreg_p (machine_mode outermode, machine_mode innermode)
3056 return GET_MODE_PRECISION (outermode) < GET_MODE_PRECISION (innermode);
3059 /* Likewise return true if X is a subreg that is smaller than the inner
3060 register. Use read_modify_subreg_p to test whether writing to such
3061 a subreg preserves any part of the inner register. */
3063 inline bool
3064 partial_subreg_p (const_rtx x)
3066 if (GET_CODE (x) != SUBREG)
3067 return false;
3068 return partial_subreg_p (GET_MODE (x), GET_MODE (SUBREG_REG (x)));
3071 /* Return true if a subreg with the given outer and inner modes is
3072 paradoxical. */
3074 inline bool
3075 paradoxical_subreg_p (machine_mode outermode, machine_mode innermode)
3077 return GET_MODE_PRECISION (outermode) > GET_MODE_PRECISION (innermode);
3080 /* Return true if X is a paradoxical subreg, false otherwise. */
3082 inline bool
3083 paradoxical_subreg_p (const_rtx x)
3085 if (GET_CODE (x) != SUBREG)
3086 return false;
3087 return paradoxical_subreg_p (GET_MODE (x), GET_MODE (SUBREG_REG (x)));
3090 /* Return the SUBREG_BYTE for an OUTERMODE lowpart of an INNERMODE value. */
3092 inline unsigned int
3093 subreg_lowpart_offset (machine_mode outermode, machine_mode innermode)
3095 return subreg_size_lowpart_offset (GET_MODE_SIZE (outermode),
3096 GET_MODE_SIZE (innermode));
3099 /* Given that a subreg has outer mode OUTERMODE and inner mode INNERMODE,
3100 return the smaller of the two modes if they are different sizes,
3101 otherwise return the outer mode. */
3103 inline machine_mode
3104 narrower_subreg_mode (machine_mode outermode, machine_mode innermode)
3106 return paradoxical_subreg_p (outermode, innermode) ? innermode : outermode;
3109 /* Given that a subreg has outer mode OUTERMODE and inner mode INNERMODE,
3110 return the mode that is big enough to hold both the outer and inner
3111 values. Prefer the outer mode in the event of a tie. */
3113 inline machine_mode
3114 wider_subreg_mode (machine_mode outermode, machine_mode innermode)
3116 return partial_subreg_p (outermode, innermode) ? innermode : outermode;
3119 /* Likewise for subreg X. */
3121 inline machine_mode
3122 wider_subreg_mode (const_rtx x)
3124 return wider_subreg_mode (GET_MODE (x), GET_MODE (SUBREG_REG (x)));
3127 extern unsigned int subreg_size_highpart_offset (unsigned int, unsigned int);
3129 /* Return the SUBREG_BYTE for an OUTERMODE highpart of an INNERMODE value. */
3131 inline unsigned int
3132 subreg_highpart_offset (machine_mode outermode, machine_mode innermode)
3134 return subreg_size_highpart_offset (GET_MODE_SIZE (outermode),
3135 GET_MODE_SIZE (innermode));
3138 extern int byte_lowpart_offset (machine_mode, machine_mode);
3139 extern int subreg_memory_offset (machine_mode, machine_mode, unsigned int);
3140 extern int subreg_memory_offset (const_rtx);
3141 extern rtx make_safe_from (rtx, rtx);
3142 extern rtx convert_memory_address_addr_space_1 (scalar_int_mode, rtx,
3143 addr_space_t, bool, bool);
3144 extern rtx convert_memory_address_addr_space (scalar_int_mode, rtx,
3145 addr_space_t);
3146 #define convert_memory_address(to_mode,x) \
3147 convert_memory_address_addr_space ((to_mode), (x), ADDR_SPACE_GENERIC)
3148 extern const char *get_insn_name (int);
3149 extern rtx_insn *get_last_insn_anywhere (void);
3150 extern rtx_insn *get_first_nonnote_insn (void);
3151 extern rtx_insn *get_last_nonnote_insn (void);
3152 extern void start_sequence (void);
3153 extern void push_to_sequence (rtx_insn *);
3154 extern void push_to_sequence2 (rtx_insn *, rtx_insn *);
3155 extern void end_sequence (void);
3156 #if TARGET_SUPPORTS_WIDE_INT == 0
3157 extern double_int rtx_to_double_int (const_rtx);
3158 #endif
3159 extern void cwi_output_hex (FILE *, const_rtx);
3160 #if TARGET_SUPPORTS_WIDE_INT == 0
3161 extern rtx immed_double_const (HOST_WIDE_INT, HOST_WIDE_INT,
3162 machine_mode);
3163 #endif
3164 extern rtx immed_wide_int_const (const poly_wide_int_ref &, machine_mode);
3166 /* In varasm.c */
3167 extern rtx force_const_mem (machine_mode, rtx);
3169 /* In varasm.c */
3171 struct function;
3172 extern rtx get_pool_constant (const_rtx);
3173 extern rtx get_pool_constant_mark (rtx, bool *);
3174 extern fixed_size_mode get_pool_mode (const_rtx);
3175 extern rtx simplify_subtraction (rtx);
3176 extern void decide_function_section (tree);
3178 /* In emit-rtl.c */
3179 extern rtx_insn *emit_insn_before (rtx, rtx);
3180 extern rtx_insn *emit_insn_before_noloc (rtx, rtx_insn *, basic_block);
3181 extern rtx_insn *emit_insn_before_setloc (rtx, rtx_insn *, int);
3182 extern rtx_jump_insn *emit_jump_insn_before (rtx, rtx);
3183 extern rtx_jump_insn *emit_jump_insn_before_noloc (rtx, rtx_insn *);
3184 extern rtx_jump_insn *emit_jump_insn_before_setloc (rtx, rtx_insn *, int);
3185 extern rtx_insn *emit_call_insn_before (rtx, rtx_insn *);
3186 extern rtx_insn *emit_call_insn_before_noloc (rtx, rtx_insn *);
3187 extern rtx_insn *emit_call_insn_before_setloc (rtx, rtx_insn *, int);
3188 extern rtx_insn *emit_debug_insn_before (rtx, rtx_insn *);
3189 extern rtx_insn *emit_debug_insn_before_noloc (rtx, rtx);
3190 extern rtx_insn *emit_debug_insn_before_setloc (rtx, rtx, int);
3191 extern rtx_barrier *emit_barrier_before (rtx);
3192 extern rtx_code_label *emit_label_before (rtx, rtx_insn *);
3193 extern rtx_note *emit_note_before (enum insn_note, rtx_insn *);
3194 extern rtx_insn *emit_insn_after (rtx, rtx);
3195 extern rtx_insn *emit_insn_after_noloc (rtx, rtx, basic_block);
3196 extern rtx_insn *emit_insn_after_setloc (rtx, rtx, int);
3197 extern rtx_jump_insn *emit_jump_insn_after (rtx, rtx);
3198 extern rtx_jump_insn *emit_jump_insn_after_noloc (rtx, rtx);
3199 extern rtx_jump_insn *emit_jump_insn_after_setloc (rtx, rtx, int);
3200 extern rtx_insn *emit_call_insn_after (rtx, rtx);
3201 extern rtx_insn *emit_call_insn_after_noloc (rtx, rtx);
3202 extern rtx_insn *emit_call_insn_after_setloc (rtx, rtx, int);
3203 extern rtx_insn *emit_debug_insn_after (rtx, rtx);
3204 extern rtx_insn *emit_debug_insn_after_noloc (rtx, rtx);
3205 extern rtx_insn *emit_debug_insn_after_setloc (rtx, rtx, int);
3206 extern rtx_barrier *emit_barrier_after (rtx);
3207 extern rtx_insn *emit_label_after (rtx, rtx_insn *);
3208 extern rtx_note *emit_note_after (enum insn_note, rtx_insn *);
3209 extern rtx_insn *emit_insn (rtx);
3210 extern rtx_insn *emit_debug_insn (rtx);
3211 extern rtx_insn *emit_jump_insn (rtx);
3212 extern rtx_insn *emit_call_insn (rtx);
3213 extern rtx_code_label *emit_label (rtx);
3214 extern rtx_jump_table_data *emit_jump_table_data (rtx);
3215 extern rtx_barrier *emit_barrier (void);
3216 extern rtx_note *emit_note (enum insn_note);
3217 extern rtx_note *emit_note_copy (rtx_note *);
3218 extern rtx_insn *gen_clobber (rtx);
3219 extern rtx_insn *emit_clobber (rtx);
3220 extern rtx_insn *gen_use (rtx);
3221 extern rtx_insn *emit_use (rtx);
3222 extern rtx_insn *make_insn_raw (rtx);
3223 extern void add_function_usage_to (rtx, rtx);
3224 extern rtx_call_insn *last_call_insn (void);
3225 extern rtx_insn *previous_insn (rtx_insn *);
3226 extern rtx_insn *next_insn (rtx_insn *);
3227 extern rtx_insn *prev_nonnote_insn (rtx_insn *);
3228 extern rtx_insn *next_nonnote_insn (rtx_insn *);
3229 extern rtx_insn *prev_nondebug_insn (rtx_insn *);
3230 extern rtx_insn *next_nondebug_insn (rtx_insn *);
3231 extern rtx_insn *prev_nonnote_nondebug_insn (rtx_insn *);
3232 extern rtx_insn *prev_nonnote_nondebug_insn_bb (rtx_insn *);
3233 extern rtx_insn *next_nonnote_nondebug_insn (rtx_insn *);
3234 extern rtx_insn *next_nonnote_nondebug_insn_bb (rtx_insn *);
3235 extern rtx_insn *prev_real_insn (rtx_insn *);
3236 extern rtx_insn *next_real_insn (rtx);
3237 extern rtx_insn *prev_active_insn (rtx_insn *);
3238 extern rtx_insn *next_active_insn (rtx_insn *);
3239 extern int active_insn_p (const rtx_insn *);
3240 extern rtx_insn *next_cc0_user (rtx_insn *);
3241 extern rtx_insn *prev_cc0_setter (rtx_insn *);
3243 /* In emit-rtl.c */
3244 extern int insn_line (const rtx_insn *);
3245 extern const char * insn_file (const rtx_insn *);
3246 extern tree insn_scope (const rtx_insn *);
3247 extern expanded_location insn_location (const rtx_insn *);
3248 extern location_t prologue_location, epilogue_location;
3250 /* In jump.c */
3251 extern enum rtx_code reverse_condition (enum rtx_code);
3252 extern enum rtx_code reverse_condition_maybe_unordered (enum rtx_code);
3253 extern enum rtx_code swap_condition (enum rtx_code);
3254 extern enum rtx_code unsigned_condition (enum rtx_code);
3255 extern enum rtx_code signed_condition (enum rtx_code);
3256 extern void mark_jump_label (rtx, rtx_insn *, int);
3258 /* In jump.c */
3259 extern rtx_insn *delete_related_insns (rtx);
3261 /* In recog.c */
3262 extern rtx *find_constant_term_loc (rtx *);
3264 /* In emit-rtl.c */
3265 extern rtx_insn *try_split (rtx, rtx_insn *, int);
3267 /* In insn-recog.c (generated by genrecog). */
3268 extern rtx_insn *split_insns (rtx, rtx_insn *);
3270 /* In simplify-rtx.c */
3271 extern rtx simplify_const_unary_operation (enum rtx_code, machine_mode,
3272 rtx, machine_mode);
3273 extern rtx simplify_unary_operation (enum rtx_code, machine_mode, rtx,
3274 machine_mode);
3275 extern rtx simplify_const_binary_operation (enum rtx_code, machine_mode,
3276 rtx, rtx);
3277 extern rtx simplify_binary_operation (enum rtx_code, machine_mode, rtx,
3278 rtx);
3279 extern rtx simplify_ternary_operation (enum rtx_code, machine_mode,
3280 machine_mode, rtx, rtx, rtx);
3281 extern rtx simplify_const_relational_operation (enum rtx_code,
3282 machine_mode, rtx, rtx);
3283 extern rtx simplify_relational_operation (enum rtx_code, machine_mode,
3284 machine_mode, rtx, rtx);
3285 extern rtx simplify_gen_binary (enum rtx_code, machine_mode, rtx, rtx);
3286 extern rtx simplify_gen_unary (enum rtx_code, machine_mode, rtx,
3287 machine_mode);
3288 extern rtx simplify_gen_ternary (enum rtx_code, machine_mode,
3289 machine_mode, rtx, rtx, rtx);
3290 extern rtx simplify_gen_relational (enum rtx_code, machine_mode,
3291 machine_mode, rtx, rtx);
3292 extern rtx simplify_subreg (machine_mode, rtx, machine_mode,
3293 unsigned int);
3294 extern rtx simplify_gen_subreg (machine_mode, rtx, machine_mode,
3295 unsigned int);
3296 extern rtx lowpart_subreg (machine_mode, rtx, machine_mode);
3297 extern rtx simplify_replace_fn_rtx (rtx, const_rtx,
3298 rtx (*fn) (rtx, const_rtx, void *), void *);
3299 extern rtx simplify_replace_rtx (rtx, const_rtx, rtx);
3300 extern rtx simplify_rtx (const_rtx);
3301 extern rtx avoid_constant_pool_reference (rtx);
3302 extern rtx delegitimize_mem_from_attrs (rtx);
3303 extern bool mode_signbit_p (machine_mode, const_rtx);
3304 extern bool val_signbit_p (machine_mode, unsigned HOST_WIDE_INT);
3305 extern bool val_signbit_known_set_p (machine_mode,
3306 unsigned HOST_WIDE_INT);
3307 extern bool val_signbit_known_clear_p (machine_mode,
3308 unsigned HOST_WIDE_INT);
3310 /* In reginfo.c */
3311 extern machine_mode choose_hard_reg_mode (unsigned int, unsigned int,
3312 bool);
3313 extern const HARD_REG_SET &simplifiable_subregs (const subreg_shape &);
3315 /* In emit-rtl.c */
3316 extern rtx set_for_reg_notes (rtx);
3317 extern rtx set_unique_reg_note (rtx, enum reg_note, rtx);
3318 extern rtx set_dst_reg_note (rtx, enum reg_note, rtx, rtx);
3319 extern void set_insn_deleted (rtx);
3321 /* Functions in rtlanal.c */
3323 extern rtx single_set_2 (const rtx_insn *, const_rtx);
3324 extern bool contains_symbol_ref_p (const_rtx);
3325 extern bool contains_symbolic_reference_p (const_rtx);
3327 /* Handle the cheap and common cases inline for performance. */
3329 inline rtx single_set (const rtx_insn *insn)
3331 if (!INSN_P (insn))
3332 return NULL_RTX;
3334 if (GET_CODE (PATTERN (insn)) == SET)
3335 return PATTERN (insn);
3337 /* Defer to the more expensive case. */
3338 return single_set_2 (insn, PATTERN (insn));
3341 extern scalar_int_mode get_address_mode (rtx mem);
3342 extern int rtx_addr_can_trap_p (const_rtx);
3343 extern bool nonzero_address_p (const_rtx);
3344 extern int rtx_unstable_p (const_rtx);
3345 extern bool rtx_varies_p (const_rtx, bool);
3346 extern bool rtx_addr_varies_p (const_rtx, bool);
3347 extern rtx get_call_rtx_from (rtx);
3348 extern HOST_WIDE_INT get_integer_term (const_rtx);
3349 extern rtx get_related_value (const_rtx);
3350 extern bool offset_within_block_p (const_rtx, HOST_WIDE_INT);
3351 extern void split_const (rtx, rtx *, rtx *);
3352 extern rtx strip_offset (rtx, poly_int64_pod *);
3353 extern bool unsigned_reg_p (rtx);
3354 extern int reg_mentioned_p (const_rtx, const_rtx);
3355 extern int count_occurrences (const_rtx, const_rtx, int);
3356 extern int reg_referenced_p (const_rtx, const_rtx);
3357 extern int reg_used_between_p (const_rtx, const rtx_insn *, const rtx_insn *);
3358 extern int reg_set_between_p (const_rtx, const rtx_insn *, const rtx_insn *);
3359 extern int commutative_operand_precedence (rtx);
3360 extern bool swap_commutative_operands_p (rtx, rtx);
3361 extern int modified_between_p (const_rtx, const rtx_insn *, const rtx_insn *);
3362 extern int no_labels_between_p (const rtx_insn *, const rtx_insn *);
3363 extern int modified_in_p (const_rtx, const_rtx);
3364 extern int reg_set_p (const_rtx, const_rtx);
3365 extern int multiple_sets (const_rtx);
3366 extern int set_noop_p (const_rtx);
3367 extern int noop_move_p (const rtx_insn *);
3368 extern bool refers_to_regno_p (unsigned int, unsigned int, const_rtx, rtx *);
3369 extern int reg_overlap_mentioned_p (const_rtx, const_rtx);
3370 extern const_rtx set_of (const_rtx, const_rtx);
3371 extern void record_hard_reg_sets (rtx, const_rtx, void *);
3372 extern void record_hard_reg_uses (rtx *, void *);
3373 extern void find_all_hard_regs (const_rtx, HARD_REG_SET *);
3374 extern void find_all_hard_reg_sets (const rtx_insn *, HARD_REG_SET *, bool);
3375 extern void note_stores (const_rtx, void (*) (rtx, const_rtx, void *), void *);
3376 extern void note_uses (rtx *, void (*) (rtx *, void *), void *);
3377 extern int dead_or_set_p (const rtx_insn *, const_rtx);
3378 extern int dead_or_set_regno_p (const rtx_insn *, unsigned int);
3379 extern rtx find_reg_note (const_rtx, enum reg_note, const_rtx);
3380 extern rtx find_regno_note (const_rtx, enum reg_note, unsigned int);
3381 extern rtx find_reg_equal_equiv_note (const_rtx);
3382 extern rtx find_constant_src (const rtx_insn *);
3383 extern int find_reg_fusage (const_rtx, enum rtx_code, const_rtx);
3384 extern int find_regno_fusage (const_rtx, enum rtx_code, unsigned int);
3385 extern rtx alloc_reg_note (enum reg_note, rtx, rtx);
3386 extern void add_reg_note (rtx, enum reg_note, rtx);
3387 extern void add_int_reg_note (rtx_insn *, enum reg_note, int);
3388 extern void add_shallow_copy_of_reg_note (rtx_insn *, rtx);
3389 extern rtx duplicate_reg_note (rtx);
3390 extern void remove_note (rtx_insn *, const_rtx);
3391 extern bool remove_reg_equal_equiv_notes (rtx_insn *);
3392 extern void remove_reg_equal_equiv_notes_for_regno (unsigned int);
3393 extern int side_effects_p (const_rtx);
3394 extern int volatile_refs_p (const_rtx);
3395 extern int volatile_insn_p (const_rtx);
3396 extern int may_trap_p_1 (const_rtx, unsigned);
3397 extern int may_trap_p (const_rtx);
3398 extern int may_trap_or_fault_p (const_rtx);
3399 extern bool can_throw_internal (const_rtx);
3400 extern bool can_throw_external (const_rtx);
3401 extern bool insn_could_throw_p (const_rtx);
3402 extern bool insn_nothrow_p (const_rtx);
3403 extern bool can_nonlocal_goto (const rtx_insn *);
3404 extern void copy_reg_eh_region_note_forward (rtx, rtx_insn *, rtx);
3405 extern void copy_reg_eh_region_note_backward (rtx, rtx_insn *, rtx);
3406 extern int inequality_comparisons_p (const_rtx);
3407 extern rtx replace_rtx (rtx, rtx, rtx, bool = false);
3408 extern void replace_label (rtx *, rtx, rtx, bool);
3409 extern void replace_label_in_insn (rtx_insn *, rtx_insn *, rtx_insn *, bool);
3410 extern bool rtx_referenced_p (const_rtx, const_rtx);
3411 extern bool tablejump_p (const rtx_insn *, rtx_insn **, rtx_jump_table_data **);
3412 extern int computed_jump_p (const rtx_insn *);
3413 extern bool tls_referenced_p (const_rtx);
3414 extern bool contains_mem_rtx_p (rtx x);
3416 /* Overload for refers_to_regno_p for checking a single register. */
3417 inline bool
3418 refers_to_regno_p (unsigned int regnum, const_rtx x, rtx* loc = NULL)
3420 return refers_to_regno_p (regnum, regnum + 1, x, loc);
3423 /* Callback for for_each_inc_dec, to process the autoinc operation OP
3424 within MEM that sets DEST to SRC + SRCOFF, or SRC if SRCOFF is
3425 NULL. The callback is passed the same opaque ARG passed to
3426 for_each_inc_dec. Return zero to continue looking for other
3427 autoinc operations or any other value to interrupt the traversal and
3428 return that value to the caller of for_each_inc_dec. */
3429 typedef int (*for_each_inc_dec_fn) (rtx mem, rtx op, rtx dest, rtx src,
3430 rtx srcoff, void *arg);
3431 extern int for_each_inc_dec (rtx, for_each_inc_dec_fn, void *arg);
3433 typedef int (*rtx_equal_p_callback_function) (const_rtx *, const_rtx *,
3434 rtx *, rtx *);
3435 extern int rtx_equal_p_cb (const_rtx, const_rtx,
3436 rtx_equal_p_callback_function);
3438 typedef int (*hash_rtx_callback_function) (const_rtx, machine_mode, rtx *,
3439 machine_mode *);
3440 extern unsigned hash_rtx_cb (const_rtx, machine_mode, int *, int *,
3441 bool, hash_rtx_callback_function);
3443 extern rtx regno_use_in (unsigned int, rtx);
3444 extern int auto_inc_p (const_rtx);
3445 extern bool in_insn_list_p (const rtx_insn_list *, const rtx_insn *);
3446 extern void remove_node_from_expr_list (const_rtx, rtx_expr_list **);
3447 extern void remove_node_from_insn_list (const rtx_insn *, rtx_insn_list **);
3448 extern int loc_mentioned_in_p (rtx *, const_rtx);
3449 extern rtx_insn *find_first_parameter_load (rtx_insn *, rtx_insn *);
3450 extern bool keep_with_call_p (const rtx_insn *);
3451 extern bool label_is_jump_target_p (const_rtx, const rtx_insn *);
3452 extern int pattern_cost (rtx, bool);
3453 extern int insn_cost (rtx_insn *, bool);
3454 extern unsigned seq_cost (const rtx_insn *, bool);
3456 /* Given an insn and condition, return a canonical description of
3457 the test being made. */
3458 extern rtx canonicalize_condition (rtx_insn *, rtx, int, rtx_insn **, rtx,
3459 int, int);
3461 /* Given a JUMP_INSN, return a canonical description of the test
3462 being made. */
3463 extern rtx get_condition (rtx_insn *, rtx_insn **, int, int);
3465 /* Information about a subreg of a hard register. */
3466 struct subreg_info
3468 /* Offset of first hard register involved in the subreg. */
3469 int offset;
3470 /* Number of hard registers involved in the subreg. In the case of
3471 a paradoxical subreg, this is the number of registers that would
3472 be modified by writing to the subreg; some of them may be don't-care
3473 when reading from the subreg. */
3474 int nregs;
3475 /* Whether this subreg can be represented as a hard reg with the new
3476 mode (by adding OFFSET to the original hard register). */
3477 bool representable_p;
3480 extern void subreg_get_info (unsigned int, machine_mode,
3481 unsigned int, machine_mode,
3482 struct subreg_info *);
3484 /* lists.c */
3486 extern void free_EXPR_LIST_list (rtx_expr_list **);
3487 extern void free_INSN_LIST_list (rtx_insn_list **);
3488 extern void free_EXPR_LIST_node (rtx);
3489 extern void free_INSN_LIST_node (rtx);
3490 extern rtx_insn_list *alloc_INSN_LIST (rtx, rtx);
3491 extern rtx_insn_list *copy_INSN_LIST (rtx_insn_list *);
3492 extern rtx_insn_list *concat_INSN_LIST (rtx_insn_list *, rtx_insn_list *);
3493 extern rtx_expr_list *alloc_EXPR_LIST (int, rtx, rtx);
3494 extern void remove_free_INSN_LIST_elem (rtx_insn *, rtx_insn_list **);
3495 extern rtx remove_list_elem (rtx, rtx *);
3496 extern rtx_insn *remove_free_INSN_LIST_node (rtx_insn_list **);
3497 extern rtx remove_free_EXPR_LIST_node (rtx_expr_list **);
3500 /* reginfo.c */
3502 /* Resize reg info. */
3503 extern bool resize_reg_info (void);
3504 /* Free up register info memory. */
3505 extern void free_reg_info (void);
3506 extern void init_subregs_of_mode (void);
3507 extern void finish_subregs_of_mode (void);
3509 /* recog.c */
3510 extern rtx extract_asm_operands (rtx);
3511 extern int asm_noperands (const_rtx);
3512 extern const char *decode_asm_operands (rtx, rtx *, rtx **, const char **,
3513 machine_mode *, location_t *);
3514 extern void get_referenced_operands (const char *, bool *, unsigned int);
3516 extern enum reg_class reg_preferred_class (int);
3517 extern enum reg_class reg_alternate_class (int);
3518 extern enum reg_class reg_allocno_class (int);
3519 extern void setup_reg_classes (int, enum reg_class, enum reg_class,
3520 enum reg_class);
3522 extern void split_all_insns (void);
3523 extern unsigned int split_all_insns_noflow (void);
3525 #define MAX_SAVED_CONST_INT 64
3526 extern GTY(()) rtx const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1];
3528 #define const0_rtx (const_int_rtx[MAX_SAVED_CONST_INT])
3529 #define const1_rtx (const_int_rtx[MAX_SAVED_CONST_INT+1])
3530 #define const2_rtx (const_int_rtx[MAX_SAVED_CONST_INT+2])
3531 #define constm1_rtx (const_int_rtx[MAX_SAVED_CONST_INT-1])
3532 extern GTY(()) rtx const_true_rtx;
3534 extern GTY(()) rtx const_tiny_rtx[4][(int) MAX_MACHINE_MODE];
3536 /* Returns a constant 0 rtx in mode MODE. Integer modes are treated the
3537 same as VOIDmode. */
3539 #define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)])
3541 /* Likewise, for the constants 1 and 2 and -1. */
3543 #define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)])
3544 #define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)])
3545 #define CONSTM1_RTX(MODE) (const_tiny_rtx[3][(int) (MODE)])
3547 extern GTY(()) rtx pc_rtx;
3548 extern GTY(()) rtx cc0_rtx;
3549 extern GTY(()) rtx ret_rtx;
3550 extern GTY(()) rtx simple_return_rtx;
3551 extern GTY(()) rtx_insn *invalid_insn_rtx;
3553 /* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg
3554 is used to represent the frame pointer. This is because the
3555 hard frame pointer and the automatic variables are separated by an amount
3556 that cannot be determined until after register allocation. We can assume
3557 that in this case ELIMINABLE_REGS will be defined, one action of which
3558 will be to eliminate FRAME_POINTER_REGNUM into HARD_FRAME_POINTER_REGNUM. */
3559 #ifndef HARD_FRAME_POINTER_REGNUM
3560 #define HARD_FRAME_POINTER_REGNUM FRAME_POINTER_REGNUM
3561 #endif
3563 #ifndef HARD_FRAME_POINTER_IS_FRAME_POINTER
3564 #define HARD_FRAME_POINTER_IS_FRAME_POINTER \
3565 (HARD_FRAME_POINTER_REGNUM == FRAME_POINTER_REGNUM)
3566 #endif
3568 #ifndef HARD_FRAME_POINTER_IS_ARG_POINTER
3569 #define HARD_FRAME_POINTER_IS_ARG_POINTER \
3570 (HARD_FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM)
3571 #endif
3573 /* Index labels for global_rtl. */
3574 enum global_rtl_index
3576 GR_STACK_POINTER,
3577 GR_FRAME_POINTER,
3578 /* For register elimination to work properly these hard_frame_pointer_rtx,
3579 frame_pointer_rtx, and arg_pointer_rtx must be the same if they refer to
3580 the same register. */
3581 #if FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM
3582 GR_ARG_POINTER = GR_FRAME_POINTER,
3583 #endif
3584 #if HARD_FRAME_POINTER_IS_FRAME_POINTER
3585 GR_HARD_FRAME_POINTER = GR_FRAME_POINTER,
3586 #else
3587 GR_HARD_FRAME_POINTER,
3588 #endif
3589 #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
3590 #if HARD_FRAME_POINTER_IS_ARG_POINTER
3591 GR_ARG_POINTER = GR_HARD_FRAME_POINTER,
3592 #else
3593 GR_ARG_POINTER,
3594 #endif
3595 #endif
3596 GR_VIRTUAL_INCOMING_ARGS,
3597 GR_VIRTUAL_STACK_ARGS,
3598 GR_VIRTUAL_STACK_DYNAMIC,
3599 GR_VIRTUAL_OUTGOING_ARGS,
3600 GR_VIRTUAL_CFA,
3601 GR_VIRTUAL_PREFERRED_STACK_BOUNDARY,
3603 GR_MAX
3606 /* Target-dependent globals. */
3607 struct GTY(()) target_rtl {
3608 /* All references to the hard registers in global_rtl_index go through
3609 these unique rtl objects. On machines where the frame-pointer and
3610 arg-pointer are the same register, they use the same unique object.
3612 After register allocation, other rtl objects which used to be pseudo-regs
3613 may be clobbered to refer to the frame-pointer register.
3614 But references that were originally to the frame-pointer can be
3615 distinguished from the others because they contain frame_pointer_rtx.
3617 When to use frame_pointer_rtx and hard_frame_pointer_rtx is a little
3618 tricky: until register elimination has taken place hard_frame_pointer_rtx
3619 should be used if it is being set, and frame_pointer_rtx otherwise. After
3620 register elimination hard_frame_pointer_rtx should always be used.
3621 On machines where the two registers are same (most) then these are the
3622 same. */
3623 rtx x_global_rtl[GR_MAX];
3625 /* A unique representation of (REG:Pmode PIC_OFFSET_TABLE_REGNUM). */
3626 rtx x_pic_offset_table_rtx;
3628 /* A unique representation of (REG:Pmode RETURN_ADDRESS_POINTER_REGNUM).
3629 This is used to implement __builtin_return_address for some machines;
3630 see for instance the MIPS port. */
3631 rtx x_return_address_pointer_rtx;
3633 /* Commonly used RTL for hard registers. These objects are not
3634 necessarily unique, so we allocate them separately from global_rtl.
3635 They are initialized once per compilation unit, then copied into
3636 regno_reg_rtx at the beginning of each function. */
3637 rtx x_initial_regno_reg_rtx[FIRST_PSEUDO_REGISTER];
3639 /* A sample (mem:M stack_pointer_rtx) rtx for each mode M. */
3640 rtx x_top_of_stack[MAX_MACHINE_MODE];
3642 /* Static hunks of RTL used by the aliasing code; these are treated
3643 as persistent to avoid unnecessary RTL allocations. */
3644 rtx x_static_reg_base_value[FIRST_PSEUDO_REGISTER];
3646 /* The default memory attributes for each mode. */
3647 struct mem_attrs *x_mode_mem_attrs[(int) MAX_MACHINE_MODE];
3649 /* Track if RTL has been initialized. */
3650 bool target_specific_initialized;
3653 extern GTY(()) struct target_rtl default_target_rtl;
3654 #if SWITCHABLE_TARGET
3655 extern struct target_rtl *this_target_rtl;
3656 #else
3657 #define this_target_rtl (&default_target_rtl)
3658 #endif
3660 #define global_rtl \
3661 (this_target_rtl->x_global_rtl)
3662 #define pic_offset_table_rtx \
3663 (this_target_rtl->x_pic_offset_table_rtx)
3664 #define return_address_pointer_rtx \
3665 (this_target_rtl->x_return_address_pointer_rtx)
3666 #define top_of_stack \
3667 (this_target_rtl->x_top_of_stack)
3668 #define mode_mem_attrs \
3669 (this_target_rtl->x_mode_mem_attrs)
3671 /* All references to certain hard regs, except those created
3672 by allocating pseudo regs into them (when that's possible),
3673 go through these unique rtx objects. */
3674 #define stack_pointer_rtx (global_rtl[GR_STACK_POINTER])
3675 #define frame_pointer_rtx (global_rtl[GR_FRAME_POINTER])
3676 #define hard_frame_pointer_rtx (global_rtl[GR_HARD_FRAME_POINTER])
3677 #define arg_pointer_rtx (global_rtl[GR_ARG_POINTER])
3679 #ifndef GENERATOR_FILE
3680 /* Return the attributes of a MEM rtx. */
3681 static inline const struct mem_attrs *
3682 get_mem_attrs (const_rtx x)
3684 struct mem_attrs *attrs;
3686 attrs = MEM_ATTRS (x);
3687 if (!attrs)
3688 attrs = mode_mem_attrs[(int) GET_MODE (x)];
3689 return attrs;
3691 #endif
3693 /* Include the RTL generation functions. */
3695 #ifndef GENERATOR_FILE
3696 #include "genrtl.h"
3697 #undef gen_rtx_ASM_INPUT
3698 #define gen_rtx_ASM_INPUT(MODE, ARG0) \
3699 gen_rtx_fmt_si (ASM_INPUT, (MODE), (ARG0), 0)
3700 #define gen_rtx_ASM_INPUT_loc(MODE, ARG0, LOC) \
3701 gen_rtx_fmt_si (ASM_INPUT, (MODE), (ARG0), (LOC))
3702 #endif
3704 /* There are some RTL codes that require special attention; the
3705 generation functions included above do the raw handling. If you
3706 add to this list, modify special_rtx in gengenrtl.c as well. */
3708 extern rtx_expr_list *gen_rtx_EXPR_LIST (machine_mode, rtx, rtx);
3709 extern rtx_insn_list *gen_rtx_INSN_LIST (machine_mode, rtx, rtx);
3710 extern rtx_insn *
3711 gen_rtx_INSN (machine_mode mode, rtx_insn *prev_insn, rtx_insn *next_insn,
3712 basic_block bb, rtx pattern, int location, int code,
3713 rtx reg_notes);
3714 extern rtx gen_rtx_CONST_INT (machine_mode, HOST_WIDE_INT);
3715 extern rtx gen_rtx_CONST_VECTOR (machine_mode, rtvec);
3716 extern void set_mode_and_regno (rtx, machine_mode, unsigned int);
3717 extern rtx gen_raw_REG (machine_mode, unsigned int);
3718 extern rtx gen_rtx_REG (machine_mode, unsigned int);
3719 extern rtx gen_rtx_SUBREG (machine_mode, rtx, int);
3720 extern rtx gen_rtx_MEM (machine_mode, rtx);
3721 extern rtx gen_rtx_VAR_LOCATION (machine_mode, tree, rtx,
3722 enum var_init_status);
3724 #ifdef GENERATOR_FILE
3725 #define PUT_MODE(RTX, MODE) PUT_MODE_RAW (RTX, MODE)
3726 #else
3727 static inline void
3728 PUT_MODE (rtx x, machine_mode mode)
3730 if (REG_P (x))
3731 set_mode_and_regno (x, mode, REGNO (x));
3732 else
3733 PUT_MODE_RAW (x, mode);
3735 #endif
3737 #define GEN_INT(N) gen_rtx_CONST_INT (VOIDmode, (N))
3739 /* Virtual registers are used during RTL generation to refer to locations into
3740 the stack frame when the actual location isn't known until RTL generation
3741 is complete. The routine instantiate_virtual_regs replaces these with
3742 the proper value, which is normally {frame,arg,stack}_pointer_rtx plus
3743 a constant. */
3745 #define FIRST_VIRTUAL_REGISTER (FIRST_PSEUDO_REGISTER)
3747 /* This points to the first word of the incoming arguments passed on the stack,
3748 either by the caller or by the callee when pretending it was passed by the
3749 caller. */
3751 #define virtual_incoming_args_rtx (global_rtl[GR_VIRTUAL_INCOMING_ARGS])
3753 #define VIRTUAL_INCOMING_ARGS_REGNUM (FIRST_VIRTUAL_REGISTER)
3755 /* If FRAME_GROWS_DOWNWARD, this points to immediately above the first
3756 variable on the stack. Otherwise, it points to the first variable on
3757 the stack. */
3759 #define virtual_stack_vars_rtx (global_rtl[GR_VIRTUAL_STACK_ARGS])
3761 #define VIRTUAL_STACK_VARS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 1)
3763 /* This points to the location of dynamically-allocated memory on the stack
3764 immediately after the stack pointer has been adjusted by the amount
3765 desired. */
3767 #define virtual_stack_dynamic_rtx (global_rtl[GR_VIRTUAL_STACK_DYNAMIC])
3769 #define VIRTUAL_STACK_DYNAMIC_REGNUM ((FIRST_VIRTUAL_REGISTER) + 2)
3771 /* This points to the location in the stack at which outgoing arguments should
3772 be written when the stack is pre-pushed (arguments pushed using push
3773 insns always use sp). */
3775 #define virtual_outgoing_args_rtx (global_rtl[GR_VIRTUAL_OUTGOING_ARGS])
3777 #define VIRTUAL_OUTGOING_ARGS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 3)
3779 /* This points to the Canonical Frame Address of the function. This
3780 should correspond to the CFA produced by INCOMING_FRAME_SP_OFFSET,
3781 but is calculated relative to the arg pointer for simplicity; the
3782 frame pointer nor stack pointer are necessarily fixed relative to
3783 the CFA until after reload. */
3785 #define virtual_cfa_rtx (global_rtl[GR_VIRTUAL_CFA])
3787 #define VIRTUAL_CFA_REGNUM ((FIRST_VIRTUAL_REGISTER) + 4)
3789 #define LAST_VIRTUAL_POINTER_REGISTER ((FIRST_VIRTUAL_REGISTER) + 4)
3791 /* This is replaced by crtl->preferred_stack_boundary / BITS_PER_UNIT
3792 when finalized. */
3794 #define virtual_preferred_stack_boundary_rtx \
3795 (global_rtl[GR_VIRTUAL_PREFERRED_STACK_BOUNDARY])
3797 #define VIRTUAL_PREFERRED_STACK_BOUNDARY_REGNUM \
3798 ((FIRST_VIRTUAL_REGISTER) + 5)
3800 #define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 5)
3802 /* Nonzero if REGNUM is a pointer into the stack frame. */
3803 #define REGNO_PTR_FRAME_P(REGNUM) \
3804 ((REGNUM) == STACK_POINTER_REGNUM \
3805 || (REGNUM) == FRAME_POINTER_REGNUM \
3806 || (REGNUM) == HARD_FRAME_POINTER_REGNUM \
3807 || (REGNUM) == ARG_POINTER_REGNUM \
3808 || ((REGNUM) >= FIRST_VIRTUAL_REGISTER \
3809 && (REGNUM) <= LAST_VIRTUAL_POINTER_REGISTER))
3811 /* REGNUM never really appearing in the INSN stream. */
3812 #define INVALID_REGNUM (~(unsigned int) 0)
3814 /* REGNUM for which no debug information can be generated. */
3815 #define IGNORED_DWARF_REGNUM (INVALID_REGNUM - 1)
3817 extern rtx output_constant_def (tree, int);
3818 extern rtx lookup_constant_def (tree);
3820 /* Nonzero after end of reload pass.
3821 Set to 1 or 0 by reload1.c. */
3823 extern int reload_completed;
3825 /* Nonzero after thread_prologue_and_epilogue_insns has run. */
3826 extern int epilogue_completed;
3828 /* Set to 1 while reload_as_needed is operating.
3829 Required by some machines to handle any generated moves differently. */
3831 extern int reload_in_progress;
3833 /* Set to 1 while in lra. */
3834 extern int lra_in_progress;
3836 /* This macro indicates whether you may create a new
3837 pseudo-register. */
3839 #define can_create_pseudo_p() (!reload_in_progress && !reload_completed)
3841 #ifdef STACK_REGS
3842 /* Nonzero after end of regstack pass.
3843 Set to 1 or 0 by reg-stack.c. */
3844 extern int regstack_completed;
3845 #endif
3847 /* If this is nonzero, we do not bother generating VOLATILE
3848 around volatile memory references, and we are willing to
3849 output indirect addresses. If cse is to follow, we reject
3850 indirect addresses so a useful potential cse is generated;
3851 if it is used only once, instruction combination will produce
3852 the same indirect address eventually. */
3853 extern int cse_not_expected;
3855 /* Translates rtx code to tree code, for those codes needed by
3856 real_arithmetic. The function returns an int because the caller may not
3857 know what `enum tree_code' means. */
3859 extern int rtx_to_tree_code (enum rtx_code);
3861 /* In cse.c */
3862 extern int delete_trivially_dead_insns (rtx_insn *, int);
3863 extern int exp_equiv_p (const_rtx, const_rtx, int, bool);
3864 extern unsigned hash_rtx (const_rtx x, machine_mode, int *, int *, bool);
3866 /* In dse.c */
3867 extern bool check_for_inc_dec (rtx_insn *insn);
3869 /* In jump.c */
3870 extern int comparison_dominates_p (enum rtx_code, enum rtx_code);
3871 extern bool jump_to_label_p (const rtx_insn *);
3872 extern int condjump_p (const rtx_insn *);
3873 extern int any_condjump_p (const rtx_insn *);
3874 extern int any_uncondjump_p (const rtx_insn *);
3875 extern rtx pc_set (const rtx_insn *);
3876 extern rtx condjump_label (const rtx_insn *);
3877 extern int simplejump_p (const rtx_insn *);
3878 extern int returnjump_p (const rtx_insn *);
3879 extern int eh_returnjump_p (rtx_insn *);
3880 extern int onlyjump_p (const rtx_insn *);
3881 extern int only_sets_cc0_p (const_rtx);
3882 extern int sets_cc0_p (const_rtx);
3883 extern int invert_jump_1 (rtx_jump_insn *, rtx);
3884 extern int invert_jump (rtx_jump_insn *, rtx, int);
3885 extern int rtx_renumbered_equal_p (const_rtx, const_rtx);
3886 extern int true_regnum (const_rtx);
3887 extern unsigned int reg_or_subregno (const_rtx);
3888 extern int redirect_jump_1 (rtx_insn *, rtx);
3889 extern void redirect_jump_2 (rtx_jump_insn *, rtx, rtx, int, int);
3890 extern int redirect_jump (rtx_jump_insn *, rtx, int);
3891 extern void rebuild_jump_labels (rtx_insn *);
3892 extern void rebuild_jump_labels_chain (rtx_insn *);
3893 extern rtx reversed_comparison (const_rtx, machine_mode);
3894 extern enum rtx_code reversed_comparison_code (const_rtx, const rtx_insn *);
3895 extern enum rtx_code reversed_comparison_code_parts (enum rtx_code, const_rtx,
3896 const_rtx, const rtx_insn *);
3897 extern void delete_for_peephole (rtx_insn *, rtx_insn *);
3898 extern int condjump_in_parallel_p (const rtx_insn *);
3900 /* In emit-rtl.c. */
3901 extern int max_reg_num (void);
3902 extern int max_label_num (void);
3903 extern int get_first_label_num (void);
3904 extern void maybe_set_first_label_num (rtx_code_label *);
3905 extern void delete_insns_since (rtx_insn *);
3906 extern void mark_reg_pointer (rtx, int);
3907 extern void mark_user_reg (rtx);
3908 extern void reset_used_flags (rtx);
3909 extern void set_used_flags (rtx);
3910 extern void reorder_insns (rtx_insn *, rtx_insn *, rtx_insn *);
3911 extern void reorder_insns_nobb (rtx_insn *, rtx_insn *, rtx_insn *);
3912 extern int get_max_insn_count (void);
3913 extern int in_sequence_p (void);
3914 extern void init_emit (void);
3915 extern void init_emit_regs (void);
3916 extern void init_derived_machine_modes (void);
3917 extern void init_emit_once (void);
3918 extern void push_topmost_sequence (void);
3919 extern void pop_topmost_sequence (void);
3920 extern void set_new_first_and_last_insn (rtx_insn *, rtx_insn *);
3921 extern unsigned int unshare_all_rtl (void);
3922 extern void unshare_all_rtl_again (rtx_insn *);
3923 extern void unshare_all_rtl_in_chain (rtx_insn *);
3924 extern void verify_rtl_sharing (void);
3925 extern void add_insn (rtx_insn *);
3926 extern void add_insn_before (rtx, rtx, basic_block);
3927 extern void add_insn_after (rtx, rtx, basic_block);
3928 extern void remove_insn (rtx);
3929 extern rtx_insn *emit (rtx, bool = true);
3930 extern void emit_insn_at_entry (rtx);
3931 extern rtx gen_lowpart_SUBREG (machine_mode, rtx);
3932 extern rtx gen_const_mem (machine_mode, rtx);
3933 extern rtx gen_frame_mem (machine_mode, rtx);
3934 extern rtx gen_tmp_stack_mem (machine_mode, rtx);
3935 extern bool validate_subreg (machine_mode, machine_mode,
3936 const_rtx, unsigned int);
3938 /* In combine.c */
3939 extern unsigned int extended_count (const_rtx, machine_mode, int);
3940 extern rtx remove_death (unsigned int, rtx_insn *);
3941 extern void dump_combine_stats (FILE *);
3942 extern void dump_combine_total_stats (FILE *);
3943 extern rtx make_compound_operation (rtx, enum rtx_code);
3945 /* In sched-rgn.c. */
3946 extern void schedule_insns (void);
3948 /* In sched-ebb.c. */
3949 extern void schedule_ebbs (void);
3951 /* In sel-sched-dump.c. */
3952 extern void sel_sched_fix_param (const char *param, const char *val);
3954 /* In print-rtl.c */
3955 extern const char *print_rtx_head;
3956 extern void debug (const rtx_def &ref);
3957 extern void debug (const rtx_def *ptr);
3958 extern void debug_rtx (const_rtx);
3959 extern void debug_rtx_list (const rtx_insn *, int);
3960 extern void debug_rtx_range (const rtx_insn *, const rtx_insn *);
3961 extern const rtx_insn *debug_rtx_find (const rtx_insn *, int);
3962 extern void print_mem_expr (FILE *, const_tree);
3963 extern void print_rtl (FILE *, const_rtx);
3964 extern void print_simple_rtl (FILE *, const_rtx);
3965 extern int print_rtl_single (FILE *, const_rtx);
3966 extern int print_rtl_single_with_indent (FILE *, const_rtx, int);
3967 extern void print_inline_rtx (FILE *, const_rtx, int);
3969 /* In stmt.c */
3970 extern void expand_null_return (void);
3971 extern void expand_naked_return (void);
3972 extern void emit_jump (rtx);
3974 /* In expr.c */
3975 extern rtx move_by_pieces (rtx, rtx, unsigned HOST_WIDE_INT,
3976 unsigned int, int);
3977 extern HOST_WIDE_INT find_args_size_adjust (rtx_insn *);
3978 extern int fixup_args_size_notes (rtx_insn *, rtx_insn *, int);
3980 /* In expmed.c */
3981 extern void init_expmed (void);
3982 extern void expand_inc (rtx, rtx);
3983 extern void expand_dec (rtx, rtx);
3985 /* In lower-subreg.c */
3986 extern void init_lower_subreg (void);
3988 /* In gcse.c */
3989 extern bool can_copy_p (machine_mode);
3990 extern bool can_assign_to_reg_without_clobbers_p (rtx, machine_mode);
3991 extern rtx fis_get_condition (rtx_insn *);
3993 /* In ira.c */
3994 extern HARD_REG_SET eliminable_regset;
3995 extern void mark_elimination (int, int);
3997 /* In reginfo.c */
3998 extern int reg_classes_intersect_p (reg_class_t, reg_class_t);
3999 extern int reg_class_subset_p (reg_class_t, reg_class_t);
4000 extern void globalize_reg (tree, int);
4001 extern void init_reg_modes_target (void);
4002 extern void init_regs (void);
4003 extern void reinit_regs (void);
4004 extern void init_fake_stack_mems (void);
4005 extern void save_register_info (void);
4006 extern void init_reg_sets (void);
4007 extern void regclass (rtx, int);
4008 extern void reg_scan (rtx_insn *, unsigned int);
4009 extern void fix_register (const char *, int, int);
4010 extern const HARD_REG_SET *valid_mode_changes_for_regno (unsigned int);
4012 /* In reload1.c */
4013 extern int function_invariant_p (const_rtx);
4015 /* In calls.c */
4016 enum libcall_type
4018 LCT_NORMAL = 0,
4019 LCT_CONST = 1,
4020 LCT_PURE = 2,
4021 LCT_NORETURN = 3,
4022 LCT_THROW = 4,
4023 LCT_RETURNS_TWICE = 5
4026 extern rtx emit_library_call_value_1 (int, rtx, rtx, enum libcall_type,
4027 machine_mode, int, rtx_mode_t *);
4029 /* Output a library call and discard the returned value. FUN is the
4030 address of the function, as a SYMBOL_REF rtx, and OUTMODE is the mode
4031 of the (discarded) return value. FN_TYPE is LCT_NORMAL for `normal'
4032 calls, LCT_CONST for `const' calls, LCT_PURE for `pure' calls, or
4033 another LCT_ value for other types of library calls.
4035 There are different overloads of this function for different numbers
4036 of arguments. In each case the argument value is followed by its mode. */
4038 inline void
4039 emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode)
4041 emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 0, NULL);
4044 inline void
4045 emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
4046 rtx arg1, machine_mode arg1_mode)
4048 rtx_mode_t args[] = { rtx_mode_t (arg1, arg1_mode) };
4049 emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 1, args);
4052 inline void
4053 emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
4054 rtx arg1, machine_mode arg1_mode,
4055 rtx arg2, machine_mode arg2_mode)
4057 rtx_mode_t args[] = {
4058 rtx_mode_t (arg1, arg1_mode),
4059 rtx_mode_t (arg2, arg2_mode)
4061 emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 2, args);
4064 inline void
4065 emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
4066 rtx arg1, machine_mode arg1_mode,
4067 rtx arg2, machine_mode arg2_mode,
4068 rtx arg3, machine_mode arg3_mode)
4070 rtx_mode_t args[] = {
4071 rtx_mode_t (arg1, arg1_mode),
4072 rtx_mode_t (arg2, arg2_mode),
4073 rtx_mode_t (arg3, arg3_mode)
4075 emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 3, args);
4078 inline void
4079 emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
4080 rtx arg1, machine_mode arg1_mode,
4081 rtx arg2, machine_mode arg2_mode,
4082 rtx arg3, machine_mode arg3_mode,
4083 rtx arg4, machine_mode arg4_mode)
4085 rtx_mode_t args[] = {
4086 rtx_mode_t (arg1, arg1_mode),
4087 rtx_mode_t (arg2, arg2_mode),
4088 rtx_mode_t (arg3, arg3_mode),
4089 rtx_mode_t (arg4, arg4_mode)
4091 emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 4, args);
4094 /* Like emit_library_call, but return the value produced by the call.
4095 Use VALUE to store the result if it is nonnull, otherwise pick a
4096 convenient location. */
4098 inline rtx
4099 emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
4100 machine_mode outmode)
4102 return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 0, NULL);
4105 inline rtx
4106 emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
4107 machine_mode outmode,
4108 rtx arg1, machine_mode arg1_mode)
4110 rtx_mode_t args[] = { rtx_mode_t (arg1, arg1_mode) };
4111 return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 1, args);
4114 inline rtx
4115 emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
4116 machine_mode outmode,
4117 rtx arg1, machine_mode arg1_mode,
4118 rtx arg2, machine_mode arg2_mode)
4120 rtx_mode_t args[] = {
4121 rtx_mode_t (arg1, arg1_mode),
4122 rtx_mode_t (arg2, arg2_mode)
4124 return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 2, args);
4127 inline rtx
4128 emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
4129 machine_mode outmode,
4130 rtx arg1, machine_mode arg1_mode,
4131 rtx arg2, machine_mode arg2_mode,
4132 rtx arg3, machine_mode arg3_mode)
4134 rtx_mode_t args[] = {
4135 rtx_mode_t (arg1, arg1_mode),
4136 rtx_mode_t (arg2, arg2_mode),
4137 rtx_mode_t (arg3, arg3_mode)
4139 return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 3, args);
4142 inline rtx
4143 emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
4144 machine_mode outmode,
4145 rtx arg1, machine_mode arg1_mode,
4146 rtx arg2, machine_mode arg2_mode,
4147 rtx arg3, machine_mode arg3_mode,
4148 rtx arg4, machine_mode arg4_mode)
4150 rtx_mode_t args[] = {
4151 rtx_mode_t (arg1, arg1_mode),
4152 rtx_mode_t (arg2, arg2_mode),
4153 rtx_mode_t (arg3, arg3_mode),
4154 rtx_mode_t (arg4, arg4_mode)
4156 return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 4, args);
4159 /* In varasm.c */
4160 extern void init_varasm_once (void);
4162 extern rtx make_debug_expr_from_rtl (const_rtx);
4164 /* In read-rtl.c */
4165 #ifdef GENERATOR_FILE
4166 extern bool read_rtx (const char *, vec<rtx> *);
4167 #endif
4169 /* In alias.c */
4170 extern rtx canon_rtx (rtx);
4171 extern int true_dependence (const_rtx, machine_mode, const_rtx);
4172 extern rtx get_addr (rtx);
4173 extern int canon_true_dependence (const_rtx, machine_mode, rtx,
4174 const_rtx, rtx);
4175 extern int read_dependence (const_rtx, const_rtx);
4176 extern int anti_dependence (const_rtx, const_rtx);
4177 extern int canon_anti_dependence (const_rtx, bool,
4178 const_rtx, machine_mode, rtx);
4179 extern int output_dependence (const_rtx, const_rtx);
4180 extern int canon_output_dependence (const_rtx, bool,
4181 const_rtx, machine_mode, rtx);
4182 extern int may_alias_p (const_rtx, const_rtx);
4183 extern void init_alias_target (void);
4184 extern void init_alias_analysis (void);
4185 extern void end_alias_analysis (void);
4186 extern void vt_equate_reg_base_value (const_rtx, const_rtx);
4187 extern bool memory_modified_in_insn_p (const_rtx, const_rtx);
4188 extern bool may_be_sp_based_p (rtx);
4189 extern rtx gen_hard_reg_clobber (machine_mode, unsigned int);
4190 extern rtx get_reg_known_value (unsigned int);
4191 extern bool get_reg_known_equiv_p (unsigned int);
4192 extern rtx get_reg_base_value (unsigned int);
4194 #ifdef STACK_REGS
4195 extern int stack_regs_mentioned (const_rtx insn);
4196 #endif
4198 /* In toplev.c */
4199 extern GTY(()) rtx stack_limit_rtx;
4201 /* In var-tracking.c */
4202 extern unsigned int variable_tracking_main (void);
4204 /* In stor-layout.c. */
4205 extern void get_mode_bounds (scalar_int_mode, int,
4206 scalar_int_mode, rtx *, rtx *);
4208 /* In loop-iv.c */
4209 extern rtx canon_condition (rtx);
4210 extern void simplify_using_condition (rtx, rtx *, bitmap);
4212 /* In final.c */
4213 extern unsigned int compute_alignments (void);
4214 extern void update_alignments (vec<rtx> &);
4215 extern int asm_str_count (const char *templ);
4217 struct rtl_hooks
4219 rtx (*gen_lowpart) (machine_mode, rtx);
4220 rtx (*gen_lowpart_no_emit) (machine_mode, rtx);
4221 rtx (*reg_nonzero_bits) (const_rtx, scalar_int_mode, scalar_int_mode,
4222 unsigned HOST_WIDE_INT *);
4223 rtx (*reg_num_sign_bit_copies) (const_rtx, scalar_int_mode, scalar_int_mode,
4224 unsigned int *);
4225 bool (*reg_truncated_to_mode) (machine_mode, const_rtx);
4227 /* Whenever you add entries here, make sure you adjust rtlhooks-def.h. */
4230 /* Each pass can provide its own. */
4231 extern struct rtl_hooks rtl_hooks;
4233 /* ... but then it has to restore these. */
4234 extern const struct rtl_hooks general_rtl_hooks;
4236 /* Keep this for the nonce. */
4237 #define gen_lowpart rtl_hooks.gen_lowpart
4239 extern void insn_locations_init (void);
4240 extern void insn_locations_finalize (void);
4241 extern void set_curr_insn_location (location_t);
4242 extern location_t curr_insn_location (void);
4244 /* rtl-error.c */
4245 extern void _fatal_insn_not_found (const_rtx, const char *, int, const char *)
4246 ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
4247 extern void _fatal_insn (const char *, const_rtx, const char *, int, const char *)
4248 ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
4250 #define fatal_insn(msgid, insn) \
4251 _fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__)
4252 #define fatal_insn_not_found(insn) \
4253 _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__)
4255 /* reginfo.c */
4256 extern tree GTY(()) global_regs_decl[FIRST_PSEUDO_REGISTER];
4258 /* Information about the function that is propagated by the RTL backend.
4259 Available only for functions that has been already assembled. */
4261 struct GTY(()) cgraph_rtl_info {
4262 unsigned int preferred_incoming_stack_boundary;
4264 /* Call unsaved hard registers really used by the corresponding
4265 function (including ones used by functions called by the
4266 function). */
4267 HARD_REG_SET function_used_regs;
4268 /* Set if function_used_regs is valid. */
4269 unsigned function_used_regs_valid: 1;
4272 /* If loads from memories of mode MODE always sign or zero extend,
4273 return SIGN_EXTEND or ZERO_EXTEND as appropriate. Return UNKNOWN
4274 otherwise. */
4276 inline rtx_code
4277 load_extend_op (machine_mode mode)
4279 scalar_int_mode int_mode;
4280 if (is_a <scalar_int_mode> (mode, &int_mode)
4281 && GET_MODE_PRECISION (int_mode) < BITS_PER_WORD)
4282 return LOAD_EXTEND_OP (int_mode);
4283 return UNKNOWN;
4286 /* If X is a PLUS of a base and a constant offset, add the constant to *OFFSET
4287 and return the base. Return X otherwise. */
4289 inline rtx
4290 strip_offset_and_add (rtx x, poly_int64_pod *offset)
4292 if (GET_CODE (x) == PLUS)
4294 poly_int64 suboffset;
4295 x = strip_offset (x, &suboffset);
4296 *offset += suboffset;
4298 return x;
4301 /* gtype-desc.c. */
4302 extern void gt_ggc_mx (rtx &);
4303 extern void gt_pch_nx (rtx &);
4304 extern void gt_pch_nx (rtx &, gt_pointer_operator, void *);
4306 #endif /* ! GCC_RTL_H */