Line data Source code
1 : /* Register Transfer Language (RTL) definitions for GCC
2 : Copyright (C) 1987-2026 Free Software Foundation, Inc.
3 :
4 : This file is part of GCC.
5 :
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.
10 :
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.
15 :
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/>. */
19 :
20 : #ifndef GCC_RTL_H
21 : #define GCC_RTL_H
22 :
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 */
36 :
37 : #include "hard-reg-set.h"
38 :
39 : class predefined_function_abi;
40 :
41 : /* Value used by some passes to "recognize" noop moves as valid
42 : instructions. */
43 : #define NOOP_MOVE_INSN_CODE INT_MAX
44 :
45 : /* Register Transfer Language EXPRESSIONS CODES */
46 :
47 : #define RTX_CODE enum rtx_code
48 : enum rtx_code : unsigned {
49 :
50 : #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) ENUM ,
51 : #include "rtl.def" /* rtl expressions are documented here */
52 : #undef DEF_RTL_EXPR
53 :
54 : LAST_AND_UNUSED_RTX_CODE}; /* A convenient way to get a value for
55 : NUM_RTX_CODE.
56 : Assumes default enum value assignment. */
57 :
58 : /* The cast here, saves many elsewhere. */
59 : #define NUM_RTX_CODE ((int) LAST_AND_UNUSED_RTX_CODE)
60 :
61 : /* Similar, but since generator files get more entries... */
62 : #ifdef GENERATOR_FILE
63 : # define NON_GENERATOR_NUM_RTX_CODE ((int) MATCH_OPERAND)
64 : #endif
65 :
66 : #define RTX_CODE_BITSIZE 8
67 :
68 : /* Register Transfer Language EXPRESSIONS CODE CLASSES */
69 :
70 : enum rtx_class {
71 : /* We check bit 0-1 of some rtx class codes in the predicates below. */
72 :
73 : /* Bit 0 = comparison if 0, arithmetic is 1
74 : Bit 1 = 1 if commutative. */
75 : RTX_COMPARE, /* 0 */
76 : RTX_COMM_COMPARE,
77 : RTX_BIN_ARITH,
78 : RTX_COMM_ARITH,
79 :
80 : /* Must follow the four preceding values. */
81 : RTX_UNARY, /* 4 */
82 :
83 : RTX_EXTRA,
84 : RTX_MATCH,
85 : RTX_INSN,
86 :
87 : /* Bit 0 = 1 if constant. */
88 : RTX_OBJ, /* 8 */
89 : RTX_CONST_OBJ,
90 :
91 : RTX_TERNARY,
92 : RTX_BITFIELD_OPS,
93 : RTX_AUTOINC
94 : };
95 :
96 : #define RTX_OBJ_MASK (~1)
97 : #define RTX_OBJ_RESULT (RTX_OBJ & RTX_OBJ_MASK)
98 : #define RTX_COMPARE_MASK (~1)
99 : #define RTX_COMPARE_RESULT (RTX_COMPARE & RTX_COMPARE_MASK)
100 : #define RTX_ARITHMETIC_MASK (~1)
101 : #define RTX_ARITHMETIC_RESULT (RTX_COMM_ARITH & RTX_ARITHMETIC_MASK)
102 : #define RTX_BINARY_MASK (~3)
103 : #define RTX_BINARY_RESULT (RTX_COMPARE & RTX_BINARY_MASK)
104 : #define RTX_COMMUTATIVE_MASK (~2)
105 : #define RTX_COMMUTATIVE_RESULT (RTX_COMM_COMPARE & RTX_COMMUTATIVE_MASK)
106 : #define RTX_NON_COMMUTATIVE_RESULT (RTX_COMPARE & RTX_COMMUTATIVE_MASK)
107 :
108 : extern const unsigned char rtx_length[NUM_RTX_CODE];
109 : #define GET_RTX_LENGTH(CODE) (rtx_length[(int) (CODE)])
110 :
111 : extern const char * const rtx_name[NUM_RTX_CODE];
112 : #define GET_RTX_NAME(CODE) (rtx_name[(int) (CODE)])
113 :
114 : extern const char * const rtx_format[NUM_RTX_CODE];
115 : #define GET_RTX_FORMAT(CODE) (rtx_format[(int) (CODE)])
116 :
117 : extern const enum rtx_class rtx_class[NUM_RTX_CODE];
118 : #define GET_RTX_CLASS(CODE) (rtx_class[(int) (CODE)])
119 :
120 : /* True if CODE is part of the insn chain (i.e. has INSN_UID, PREV_INSN
121 : and NEXT_INSN fields). */
122 : #define INSN_CHAIN_CODE_P(CODE) IN_RANGE (CODE, DEBUG_INSN, NOTE)
123 :
124 : extern const unsigned char rtx_code_size[NUM_RTX_CODE];
125 : extern const unsigned char rtx_next[NUM_RTX_CODE];
126 :
127 : /* The flags and bitfields of an ADDR_DIFF_VEC. BASE is the base label
128 : relative to which the offsets are calculated, as explained in rtl.def. */
129 : struct addr_diff_vec_flags
130 : {
131 : /* Set at the start of shorten_branches - ONLY WHEN OPTIMIZING - : */
132 : unsigned min_align: 8;
133 : /* Flags: */
134 : unsigned base_after_vec: 1; /* BASE is after the ADDR_DIFF_VEC. */
135 : unsigned min_after_vec: 1; /* minimum address target label is
136 : after the ADDR_DIFF_VEC. */
137 : unsigned max_after_vec: 1; /* maximum address target label is
138 : after the ADDR_DIFF_VEC. */
139 : unsigned min_after_base: 1; /* minimum address target label is
140 : after BASE. */
141 : unsigned max_after_base: 1; /* maximum address target label is
142 : after BASE. */
143 : /* Set by the actual branch shortening process - ONLY WHEN OPTIMIZING - : */
144 : unsigned offset_unsigned: 1; /* offsets have to be treated as unsigned. */
145 : unsigned : 2;
146 : unsigned scale : 8;
147 : };
148 :
149 : /* Structure used to describe the attributes of a MEM. These are hashed
150 : so MEMs that the same attributes share a data structure. This means
151 : they cannot be modified in place. */
152 : class GTY(()) mem_attrs
153 : {
154 : public:
155 : mem_attrs ();
156 :
157 : /* The expression that the MEM accesses, or null if not known.
158 : This expression might be larger than the memory reference itself.
159 : (In other words, the MEM might access only part of the object.) */
160 : tree expr;
161 :
162 : /* The offset of the memory reference from the start of EXPR.
163 : Only valid if OFFSET_KNOWN_P. */
164 : poly_int64 offset;
165 :
166 : /* The size of the memory reference in bytes. Only valid if
167 : SIZE_KNOWN_P. */
168 : poly_int64 size;
169 :
170 : /* The alias set of the memory reference. */
171 : alias_set_type alias;
172 :
173 : /* The alignment of the reference in bits. Always a multiple of
174 : BITS_PER_UNIT. Note that EXPR may have a stricter alignment
175 : than the memory reference itself. */
176 : unsigned int align;
177 :
178 : /* The address space that the memory reference uses. */
179 : unsigned char addrspace;
180 :
181 : /* True if OFFSET is known. */
182 : bool offset_known_p;
183 :
184 : /* True if SIZE is known. */
185 : bool size_known_p;
186 : };
187 :
188 : /* Structure used to describe the attributes of a REG in similar way as
189 : mem_attrs does for MEM above. Note that the OFFSET field is calculated
190 : in the same way as for mem_attrs, rather than in the same way as a
191 : SUBREG_BYTE. For example, if a big-endian target stores a byte
192 : object in the low part of a 4-byte register, the OFFSET field
193 : will be -3 rather than 0. */
194 :
195 : class GTY((for_user)) reg_attrs {
196 : public:
197 : tree decl; /* decl corresponding to REG. */
198 : poly_int64 offset; /* Offset from start of DECL. */
199 : };
200 :
201 : /* Common union for an element of an rtx. */
202 :
203 : union rtunion
204 : {
205 : int rt_int;
206 : unsigned int rt_uint;
207 : location_t rt_loc;
208 : poly_uint16 rt_subreg;
209 : const char *rt_str;
210 : rtx rt_rtx;
211 : rtvec rt_rtvec;
212 : machine_mode rt_type;
213 : addr_diff_vec_flags rt_addr_diff_vec_flags;
214 : struct cselib_val *rt_cselib;
215 : tree rt_tree;
216 : basic_block rt_bb;
217 : mem_attrs *rt_mem;
218 : class constant_descriptor_rtx *rt_constant;
219 : struct dw_cfi_node *rt_cfi;
220 : };
221 :
222 : /* Describes the properties of a REG. */
223 : struct GTY(()) reg_info {
224 : /* The value of REGNO. */
225 : unsigned int regno;
226 :
227 : /* The value of REG_NREGS. */
228 : unsigned int nregs : 8;
229 : unsigned int unused : 24;
230 :
231 : /* The value of REG_ATTRS. */
232 : reg_attrs *attrs;
233 : };
234 :
235 : /* This structure remembers the position of a SYMBOL_REF within an
236 : object_block structure. A SYMBOL_REF only provides this information
237 : if SYMBOL_REF_HAS_BLOCK_INFO_P is true. */
238 : struct GTY(()) block_symbol {
239 : /* The usual SYMBOL_REF fields. */
240 : rtunion GTY ((skip)) fld[2];
241 :
242 : /* The block that contains this object. */
243 : struct object_block *block;
244 :
245 : /* The offset of this object from the start of its block. It is negative
246 : if the symbol has not yet been assigned an offset. */
247 : HOST_WIDE_INT offset;
248 : };
249 :
250 : /* Describes a group of objects that are to be placed together in such
251 : a way that their relative positions are known. */
252 : struct GTY((for_user)) object_block {
253 : /* The section in which these objects should be placed. */
254 : section *sect;
255 :
256 : /* The alignment of the first object, measured in bits. */
257 : unsigned int alignment;
258 :
259 : /* The total size of the objects, measured in bytes. */
260 : HOST_WIDE_INT size;
261 :
262 : /* The SYMBOL_REFs for each object. The vector is sorted in
263 : order of increasing offset and the following conditions will
264 : hold for each element X:
265 :
266 : SYMBOL_REF_HAS_BLOCK_INFO_P (X)
267 : !SYMBOL_REF_ANCHOR_P (X)
268 : SYMBOL_REF_BLOCK (X) == [address of this structure]
269 : SYMBOL_REF_BLOCK_OFFSET (X) >= 0. */
270 : vec<rtx, va_gc> *objects;
271 :
272 : /* All the anchor SYMBOL_REFs used to address these objects, sorted
273 : in order of increasing offset, and then increasing TLS model.
274 : The following conditions will hold for each element X in this vector:
275 :
276 : SYMBOL_REF_HAS_BLOCK_INFO_P (X)
277 : SYMBOL_REF_ANCHOR_P (X)
278 : SYMBOL_REF_BLOCK (X) == [address of this structure]
279 : SYMBOL_REF_BLOCK_OFFSET (X) >= 0. */
280 : vec<rtx, va_gc> *anchors;
281 : };
282 :
283 : struct GTY((variable_size)) hwivec_def {
284 : HOST_WIDE_INT elem[1];
285 : };
286 :
287 : /* Number of elements of the HWIVEC if RTX is a CONST_WIDE_INT. */
288 : #define CWI_GET_NUM_ELEM(RTX) \
289 : ((int)RTL_FLAG_CHECK1("CWI_GET_NUM_ELEM", (RTX), CONST_WIDE_INT)->u2.num_elem)
290 : #define CWI_PUT_NUM_ELEM(RTX, NUM) \
291 : (RTL_FLAG_CHECK1("CWI_PUT_NUM_ELEM", (RTX), CONST_WIDE_INT)->u2.num_elem = (NUM))
292 :
293 : struct GTY((variable_size)) const_poly_int_def {
294 : trailing_wide_ints<NUM_POLY_INT_COEFFS> coeffs;
295 : };
296 :
297 : /* RTL expression ("rtx"). */
298 :
299 : /* The GTY "desc" and "tag" options below are a kludge: we need a desc
300 : field for gengtype to recognize that inheritance is occurring,
301 : so that all subclasses are redirected to the traversal hook for the
302 : base class.
303 : However, all of the fields are in the base class, and special-casing
304 : is at work. Hence we use desc and tag of 0, generating a switch
305 : statement of the form:
306 : switch (0)
307 : {
308 : case 0: // all the work happens here
309 : }
310 : in order to work with the existing special-casing in gengtype. */
311 :
312 : struct GTY((desc("0"), tag("0"),
313 : chain_next ("RTX_NEXT (&%h)"),
314 : chain_prev ("RTX_PREV (&%h)"))) rtx_def {
315 : /* The kind of value the expression has. */
316 : machine_mode mode : MACHINE_MODE_BITSIZE;
317 :
318 : /* The kind of expression this is. */
319 : enum rtx_code code: RTX_CODE_BITSIZE;
320 :
321 : /* 1 in a MEM if we should keep the alias set for this mem unchanged
322 : when we access a component.
323 : 1 in a JUMP_INSN if it is a crossing jump.
324 : 1 in a CALL_INSN if it is a sibling call.
325 : 1 in a SET that is for a return.
326 : In a CODE_LABEL, part of the two-bit alternate entry field.
327 : 1 in a CONCAT is VAL_EXPR_IS_COPIED in var-tracking.cc.
328 : 1 in a VALUE is SP_BASED_VALUE_P in cselib.cc.
329 : 1 in a SUBREG generated by LRA for reload insns.
330 : 1 in a REG if this is a static chain register.
331 : Dumped as "/j" in RTL dumps. */
332 : unsigned int jump : 1;
333 : /* In a CODE_LABEL, part of the two-bit alternate entry field.
334 : 1 in a MEM if it cannot trap.
335 : 1 in a CALL_INSN logically equivalent to
336 : ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P.
337 : 1 in a VALUE is SP_DERIVED_VALUE_P in cselib.cc.
338 : Dumped as "/c" in RTL dumps. */
339 : unsigned int call : 1;
340 : /* 1 in a REG, MEM, or CONCAT if the value is set at most once, anywhere.
341 : 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P.
342 : 1 in a SYMBOL_REF if it addresses something in the per-function
343 : constants pool.
344 : 1 in a CALL_INSN logically equivalent to ECF_CONST and TREE_READONLY.
345 : 1 in a NOTE, or EXPR_LIST for a const call.
346 : 1 in a JUMP_INSN of an annulling branch.
347 : 1 in a CONCAT is VAL_EXPR_IS_CLOBBERED in var-tracking.cc.
348 : 1 in a preserved VALUE is PRESERVED_VALUE_P in cselib.cc.
349 : 1 in a clobber temporarily created for LRA.
350 : Dumped as "/u" in RTL dumps. */
351 : unsigned int unchanging : 1;
352 : /* 1 in a MEM or ASM_OPERANDS expression if the memory reference is volatile.
353 : 1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL, BARRIER, or NOTE
354 : if it has been deleted.
355 : 1 in a REG expression if corresponds to a variable declared by the user,
356 : 0 for an internally generated temporary.
357 : 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P.
358 : 1 in a LABEL_REF, REG_LABEL_TARGET or REG_LABEL_OPERAND note for a
359 : non-local label.
360 : In a SYMBOL_REF, this flag is used for machine-specific purposes.
361 : In a PREFETCH, this flag indicates that it should be considered a
362 : scheduling barrier.
363 : 1 in a CONCAT is VAL_NEEDS_RESOLUTION in var-tracking.cc.
364 : 1 in a CONCATN is used internally by lower-subreg.cc.
365 : Dumped as "/v" in RTL dumps. */
366 : unsigned int volatil : 1;
367 : /* 1 in a REG if the register is used only in exit code a loop.
368 : 1 in a SUBREG expression if was generated from a variable with a
369 : promoted mode.
370 : 1 in a CODE_LABEL if the label is used for nonlocal gotos
371 : and must not be deleted even if its count is zero.
372 : 1 in an INSN, JUMP_INSN or CALL_INSN if this insn must be scheduled
373 : together with the preceding insn. Valid only within sched.
374 : 1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and
375 : from the target of a branch. Valid from reorg until end of compilation;
376 : cleared before used.
377 :
378 : The name of the field is historical. It used to be used in MEMs
379 : to record whether the MEM accessed part of a structure.
380 : Dumped as "/s" in RTL dumps. */
381 : unsigned int in_struct : 1;
382 : /* At the end of RTL generation, 1 if this rtx is used. This is used for
383 : copying shared structure. See `unshare_all_rtl'.
384 : In a REG, this is not needed for that purpose, and used instead
385 : in `leaf_renumber_regs_insn'.
386 : 1 in a SYMBOL_REF, means that emit_library_call
387 : has used it as the function.
388 : 1 in a CONCAT is VAL_HOLDS_TRACK_EXPR in var-tracking.cc.
389 : 1 in a VALUE or DEBUG_EXPR is VALUE_RECURSED_INTO in var-tracking.cc. */
390 : unsigned int used : 1;
391 : /* 1 in an INSN or a SET if this rtx is related to the call frame,
392 : either changing how we compute the frame address or saving and
393 : restoring registers in the prologue and epilogue.
394 : 1 in a REG or MEM if it is a pointer.
395 : 1 in a SYMBOL_REF if it addresses something in the per-function
396 : constant string pool.
397 : 1 in a VALUE is VALUE_CHANGED in var-tracking.cc.
398 : Dumped as "/f" in RTL dumps. */
399 : unsigned frame_related : 1;
400 : /* 1 in a REG or PARALLEL that is the current function's return value.
401 : 1 in a SYMBOL_REF for a weak symbol.
402 : 1 in a CALL_INSN logically equivalent to ECF_PURE and DECL_PURE_P.
403 : 1 in a CONCAT is VAL_EXPR_HAS_REVERSE in var-tracking.cc.
404 : 1 in a VALUE or DEBUG_EXPR is NO_LOC_P in var-tracking.cc.
405 : Dumped as "/i" in RTL dumps. */
406 : unsigned return_val : 1;
407 :
408 : union {
409 : /* The final union field is aligned to 64 bits on LP64 hosts,
410 : giving a 32-bit gap after the fields above. We optimize the
411 : layout for that case and use the gap for extra code-specific
412 : information. */
413 :
414 : /* The ORIGINAL_REGNO of a REG. */
415 : unsigned int original_regno;
416 :
417 : /* The INSN_UID of an RTX_INSN-class code. */
418 : int insn_uid;
419 :
420 : /* The SYMBOL_REF_FLAGS of a SYMBOL_REF. */
421 : unsigned int symbol_ref_flags;
422 :
423 : /* The PAT_VAR_LOCATION_STATUS of a VAR_LOCATION. */
424 : enum var_init_status var_location_status;
425 :
426 : /* In a CONST_WIDE_INT (aka hwivec_def), this is the number of
427 : HOST_WIDE_INTs in the hwivec_def. */
428 : unsigned int num_elem;
429 :
430 : /* The unique identifier of a VALUE rtx. */
431 : int value_uid;
432 :
433 : /* Information about a CONST_VECTOR. */
434 : struct
435 : {
436 : /* The value of CONST_VECTOR_NPATTERNS. */
437 : unsigned int npatterns : 16;
438 :
439 : /* The value of CONST_VECTOR_NELTS_PER_PATTERN. */
440 : unsigned int nelts_per_pattern : 8;
441 :
442 : /* For future expansion. */
443 : unsigned int unused : 8;
444 : } const_vector;
445 : } GTY ((skip)) u2;
446 :
447 : /* The first element of the operands of this rtx.
448 : The number of operands and their types are controlled
449 : by the `code' field, according to rtl.def. */
450 : union u {
451 : rtunion fld[1];
452 : HOST_WIDE_INT hwint[1];
453 : struct reg_info reg;
454 : struct block_symbol block_sym;
455 : struct real_value rv;
456 : struct fixed_value fv;
457 : struct hwivec_def hwiv;
458 : struct const_poly_int_def cpi;
459 : } GTY ((special ("rtx_def"), desc ("GET_CODE (&%0)"))) u;
460 : };
461 :
462 : /* A node for constructing singly-linked lists of rtx. */
463 :
464 : struct GTY(()) rtx_expr_list : public rtx_def
465 : {
466 : private:
467 : /* No extra fields, but adds invariant: (GET_CODE (X) == EXPR_LIST). */
468 :
469 : public:
470 : /* Get next in list. */
471 : rtx_expr_list *next () const;
472 :
473 : /* Get at the underlying rtx. */
474 : rtx element () const;
475 : };
476 :
477 : template <>
478 : template <>
479 : inline bool
480 951470912 : is_a_helper <rtx_expr_list *>::test (rtx rt)
481 : {
482 951470912 : return rt->code == EXPR_LIST;
483 : }
484 :
485 : struct GTY(()) rtx_insn_list : public rtx_def
486 : {
487 : private:
488 : /* No extra fields, but adds invariant: (GET_CODE (X) == INSN_LIST).
489 :
490 : This is an instance of:
491 :
492 : DEF_RTL_EXPR(INSN_LIST, "insn_list", "ue", RTX_EXTRA)
493 :
494 : i.e. a node for constructing singly-linked lists of rtx_insn *, where
495 : the list is "external" to the insn (as opposed to the doubly-linked
496 : list embedded within rtx_insn itself). */
497 :
498 : public:
499 : /* Get next in list. */
500 : rtx_insn_list *next () const;
501 :
502 : /* Get at the underlying instruction. */
503 : rtx_insn *insn () const;
504 :
505 : };
506 :
507 : template <>
508 : template <>
509 : inline bool
510 2355375232 : is_a_helper <rtx_insn_list *>::test (rtx rt)
511 : {
512 2355375232 : return rt->code == INSN_LIST;
513 : }
514 :
515 : /* A node with invariant GET_CODE (X) == SEQUENCE i.e. a vector of rtx,
516 : typically (but not always) of rtx_insn *, used in the late passes. */
517 :
518 : struct GTY(()) rtx_sequence : public rtx_def
519 : {
520 : private:
521 : /* No extra fields, but adds invariant: (GET_CODE (X) == SEQUENCE). */
522 :
523 : public:
524 : /* Get number of elements in sequence. */
525 : int len () const;
526 :
527 : /* Get i-th element of the sequence. */
528 : rtx element (int index) const;
529 :
530 : /* Get i-th element of the sequence, with a checked cast to
531 : rtx_insn *. */
532 : rtx_insn *insn (int index) const;
533 : };
534 :
535 : template <>
536 : template <>
537 : inline bool
538 34378306766 : is_a_helper <rtx_sequence *>::test (rtx rt)
539 : {
540 34378306766 : return rt->code == SEQUENCE;
541 : }
542 :
543 : template <>
544 : template <>
545 : inline bool
546 0 : is_a_helper <const rtx_sequence *>::test (const_rtx rt)
547 : {
548 0 : return rt->code == SEQUENCE;
549 : }
550 :
551 : struct GTY(()) rtx_insn : public rtx_def
552 : {
553 : public:
554 : /* No extra fields, but adds the invariant:
555 :
556 : (INSN_P (X)
557 : || NOTE_P (X)
558 : || JUMP_TABLE_DATA_P (X)
559 : || BARRIER_P (X)
560 : || LABEL_P (X))
561 :
562 : i.e. that we must be able to use the following:
563 : INSN_UID ()
564 : NEXT_INSN ()
565 : PREV_INSN ()
566 : i.e. we have an rtx that has an INSN_UID field and can be part of
567 : a linked list of insns.
568 : */
569 :
570 : /* Returns true if this insn has been deleted. */
571 :
572 2391199976 : bool deleted () const { return volatil; }
573 :
574 : /* Mark this insn as deleted. */
575 :
576 136226669 : void set_deleted () { volatil = true; }
577 :
578 : /* Mark this insn as not deleted. */
579 :
580 9604 : void set_undeleted () { volatil = false; }
581 : };
582 :
583 : /* Subclasses of rtx_insn. */
584 :
585 : struct GTY(()) rtx_debug_insn : public rtx_insn
586 : {
587 : /* No extra fields, but adds the invariant:
588 : DEBUG_INSN_P (X) aka (GET_CODE (X) == DEBUG_INSN)
589 : i.e. an annotation for tracking variable assignments.
590 :
591 : This is an instance of:
592 : DEF_RTL_EXPR(DEBUG_INSN, "debug_insn", "uuBeLie", RTX_INSN)
593 : from rtl.def. */
594 : };
595 :
596 : struct GTY(()) rtx_nonjump_insn : public rtx_insn
597 : {
598 : /* No extra fields, but adds the invariant:
599 : NONJUMP_INSN_P (X) aka (GET_CODE (X) == INSN)
600 : i.e an instruction that cannot jump.
601 :
602 : This is an instance of:
603 : DEF_RTL_EXPR(INSN, "insn", "uuBeLie", RTX_INSN)
604 : from rtl.def. */
605 : };
606 :
607 : struct GTY(()) rtx_jump_insn : public rtx_insn
608 : {
609 : public:
610 : /* No extra fields, but adds the invariant:
611 : JUMP_P (X) aka (GET_CODE (X) == JUMP_INSN)
612 : i.e. an instruction that can possibly jump.
613 :
614 : This is an instance of:
615 : DEF_RTL_EXPR(JUMP_INSN, "jump_insn", "uuBeLie0", RTX_INSN)
616 : from rtl.def. */
617 :
618 : /* Returns jump target of this instruction. The returned value is not
619 : necessarily a code label: it may also be a RETURN or SIMPLE_RETURN
620 : expression. Also, when the code label is marked "deleted", it is
621 : replaced by a NOTE. In some cases the value is NULL_RTX. */
622 :
623 : inline rtx jump_label () const;
624 :
625 : /* Returns jump target cast to rtx_code_label *. */
626 :
627 : inline rtx_code_label *jump_target () const;
628 :
629 : /* Set jump target. */
630 :
631 : inline void set_jump_target (rtx_code_label *);
632 : };
633 :
634 : struct GTY(()) rtx_call_insn : public rtx_insn
635 : {
636 : /* No extra fields, but adds the invariant:
637 : CALL_P (X) aka (GET_CODE (X) == CALL_INSN)
638 : i.e. an instruction that can possibly call a subroutine
639 : but which will not change which instruction comes next
640 : in the current function.
641 :
642 : This is an instance of:
643 : DEF_RTL_EXPR(CALL_INSN, "call_insn", "uuBeLiee", RTX_INSN)
644 : from rtl.def. */
645 : };
646 :
647 : struct GTY(()) rtx_jump_table_data : public rtx_insn
648 : {
649 : /* No extra fields, but adds the invariant:
650 : JUMP_TABLE_DATA_P (X) aka (GET_CODE (INSN) == JUMP_TABLE_DATA)
651 : i.e. a data for a jump table, considered an instruction for
652 : historical reasons.
653 :
654 : This is an instance of:
655 : DEF_RTL_EXPR(JUMP_TABLE_DATA, "jump_table_data", "uuBe0000", RTX_INSN)
656 : from rtl.def. */
657 :
658 : /* This can be either:
659 :
660 : (a) a table of absolute jumps, in which case PATTERN (this) is an
661 : ADDR_VEC with arg 0 a vector of labels, or
662 :
663 : (b) a table of relative jumps (e.g. for -fPIC), in which case
664 : PATTERN (this) is an ADDR_DIFF_VEC, with arg 0 a LABEL_REF and
665 : arg 1 the vector of labels.
666 :
667 : This method gets the underlying vec. */
668 :
669 : inline rtvec get_labels () const;
670 : inline scalar_int_mode get_data_mode () const;
671 : };
672 :
673 : struct GTY(()) rtx_barrier : public rtx_insn
674 : {
675 : /* No extra fields, but adds the invariant:
676 : BARRIER_P (X) aka (GET_CODE (X) == BARRIER)
677 : i.e. a marker that indicates that control will not flow through.
678 :
679 : This is an instance of:
680 : DEF_RTL_EXPR(BARRIER, "barrier", "uu00000", RTX_EXTRA)
681 : from rtl.def. */
682 : };
683 :
684 : struct GTY(()) rtx_code_label : public rtx_insn
685 : {
686 : /* No extra fields, but adds the invariant:
687 : LABEL_P (X) aka (GET_CODE (X) == CODE_LABEL)
688 : i.e. a label in the assembler.
689 :
690 : This is an instance of:
691 : DEF_RTL_EXPR(CODE_LABEL, "code_label", "uuB00is", RTX_EXTRA)
692 : from rtl.def. */
693 : };
694 :
695 : struct GTY(()) rtx_note : public rtx_insn
696 : {
697 : /* No extra fields, but adds the invariant:
698 : NOTE_P(X) aka (GET_CODE (X) == NOTE)
699 : i.e. a note about the corresponding source code.
700 :
701 : This is an instance of:
702 : DEF_RTL_EXPR(NOTE, "note", "uuB0ni", RTX_EXTRA)
703 : from rtl.def. */
704 : };
705 :
706 : /* The size in bytes of an rtx header (code, mode and flags). */
707 : #define RTX_HDR_SIZE offsetof (struct rtx_def, u)
708 :
709 : /* The size in bytes of an rtx with code CODE. */
710 : #define RTX_CODE_SIZE(CODE) rtx_code_size[CODE]
711 :
712 : #define NULL_RTX (rtx) 0
713 :
714 : /* The "next" and "previous" RTX, relative to this one. */
715 :
716 : #define RTX_NEXT(X) (rtx_next[GET_CODE (X)] == 0 ? NULL \
717 : : *(rtx *)(((char *)X) + rtx_next[GET_CODE (X)]))
718 :
719 : /* FIXME: the "NEXT_INSN (PREV_INSN (X)) == X" condition shouldn't be needed.
720 : */
721 : #define RTX_PREV(X) ((INSN_P (X) \
722 : || NOTE_P (X) \
723 : || JUMP_TABLE_DATA_P (X) \
724 : || BARRIER_P (X) \
725 : || LABEL_P (X)) \
726 : && PREV_INSN (as_a <rtx_insn *> (X)) != NULL \
727 : && NEXT_INSN (PREV_INSN (as_a <rtx_insn *> (X))) == X \
728 : ? PREV_INSN (as_a <rtx_insn *> (X)) : NULL)
729 :
730 : /* Define macros to access the `code' field of the rtx. */
731 :
732 : #define GET_CODE(RTX) ((enum rtx_code) (RTX)->code)
733 : #define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE))
734 :
735 : #define GET_MODE(RTX) ((machine_mode) (RTX)->mode)
736 : #define PUT_MODE_RAW(RTX, MODE) ((RTX)->mode = (MODE))
737 :
738 : /* RTL vector. These appear inside RTX's when there is a need
739 : for a variable number of things. The principle use is inside
740 : PARALLEL expressions. */
741 :
742 : struct GTY(()) rtvec_def {
743 : int num_elem; /* number of elements */
744 : rtx GTY ((length ("%h.num_elem"))) elem[1];
745 : };
746 :
747 : #define NULL_RTVEC (rtvec) 0
748 :
749 : #define GET_NUM_ELEM(RTVEC) ((RTVEC)->num_elem)
750 : #define PUT_NUM_ELEM(RTVEC, NUM) ((RTVEC)->num_elem = (NUM))
751 :
752 : /* Predicate yielding nonzero iff X is an rtx for a register. */
753 : #define REG_P(X) (GET_CODE (X) == REG)
754 :
755 : /* Predicate yielding nonzero iff X is an rtx for a memory location. */
756 : #define MEM_P(X) (GET_CODE (X) == MEM)
757 :
758 : #if TARGET_SUPPORTS_WIDE_INT
759 :
760 : /* Match CONST_*s that can represent compile-time constant integers. */
761 : #define CASE_CONST_SCALAR_INT \
762 : case CONST_INT: \
763 : case CONST_WIDE_INT
764 :
765 : /* Match CONST_*s for which pointer equality corresponds to value
766 : equality. */
767 : #define CASE_CONST_UNIQUE \
768 : case CONST_INT: \
769 : case CONST_WIDE_INT: \
770 : case CONST_POLY_INT: \
771 : case CONST_DOUBLE: \
772 : case CONST_FIXED
773 :
774 : /* Match all CONST_* rtxes. */
775 : #define CASE_CONST_ANY \
776 : case CONST_INT: \
777 : case CONST_WIDE_INT: \
778 : case CONST_POLY_INT: \
779 : case CONST_DOUBLE: \
780 : case CONST_FIXED: \
781 : case CONST_VECTOR
782 :
783 : #else
784 :
785 : /* Match CONST_*s that can represent compile-time constant integers. */
786 : #define CASE_CONST_SCALAR_INT \
787 : case CONST_INT: \
788 : case CONST_DOUBLE
789 :
790 : /* Match CONST_*s for which pointer equality corresponds to value
791 : equality. */
792 : #define CASE_CONST_UNIQUE \
793 : case CONST_INT: \
794 : case CONST_DOUBLE: \
795 : case CONST_FIXED
796 :
797 : /* Match all CONST_* rtxes. */
798 : #define CASE_CONST_ANY \
799 : case CONST_INT: \
800 : case CONST_DOUBLE: \
801 : case CONST_FIXED: \
802 : case CONST_VECTOR
803 : #endif
804 :
805 : /* Predicate yielding nonzero iff X is an rtx for a constant integer. */
806 : #define CONST_INT_P(X) (GET_CODE (X) == CONST_INT)
807 :
808 : /* Predicate yielding nonzero iff X is an rtx for a constant integer. */
809 : #define CONST_WIDE_INT_P(X) (GET_CODE (X) == CONST_WIDE_INT)
810 :
811 : /* Predicate yielding nonzero iff X is an rtx for a polynomial constant
812 : integer. */
813 : #define CONST_POLY_INT_P(X) \
814 : (NUM_POLY_INT_COEFFS > 1 && GET_CODE (X) == CONST_POLY_INT)
815 :
816 : /* Predicate yielding nonzero iff X is an rtx for a constant fixed-point. */
817 : #define CONST_FIXED_P(X) (GET_CODE (X) == CONST_FIXED)
818 :
819 : /* Predicate yielding true iff X is an rtx for a double-int
820 : or floating point constant. */
821 : #define CONST_DOUBLE_P(X) (GET_CODE (X) == CONST_DOUBLE)
822 :
823 : /* Predicate yielding true iff X is an rtx for a double-int. */
824 : #define CONST_DOUBLE_AS_INT_P(X) \
825 : (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == VOIDmode)
826 :
827 : /* Predicate yielding true iff X is an rtx for a integer const. */
828 : #if TARGET_SUPPORTS_WIDE_INT
829 : #define CONST_SCALAR_INT_P(X) \
830 : (CONST_INT_P (X) || CONST_WIDE_INT_P (X))
831 : #else
832 : #define CONST_SCALAR_INT_P(X) \
833 : (CONST_INT_P (X) || CONST_DOUBLE_AS_INT_P (X))
834 : #endif
835 :
836 : /* Predicate yielding true iff X is an rtx for a double-int. */
837 : #define CONST_DOUBLE_AS_FLOAT_P(X) \
838 : (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode)
839 :
840 : /* Predicate yielding nonzero iff X is an rtx for a constant vector. */
841 : #define CONST_VECTOR_P(X) (GET_CODE (X) == CONST_VECTOR)
842 :
843 : /* Predicate yielding nonzero iff X is a label insn. */
844 : #define LABEL_P(X) (GET_CODE (X) == CODE_LABEL)
845 :
846 : /* Predicate yielding nonzero iff X is a jump insn. */
847 : #define JUMP_P(X) (GET_CODE (X) == JUMP_INSN)
848 :
849 : /* Predicate yielding nonzero iff X is a call insn. */
850 : #define CALL_P(X) (GET_CODE (X) == CALL_INSN)
851 :
852 : /* 1 if RTX is a call_insn for a fake call.
853 : CALL_INSN use "used" flag to indicate it's a fake call. */
854 : #define FAKE_CALL_P(RTX) \
855 : (RTL_FLAG_CHECK1 ("FAKE_CALL_P", (RTX), CALL_INSN)->used)
856 :
857 : /* Predicate yielding nonzero iff X is an insn that cannot jump. */
858 : #define NONJUMP_INSN_P(X) (GET_CODE (X) == INSN)
859 :
860 : /* Predicate yielding nonzero iff X is a debug note/insn. */
861 : #define DEBUG_INSN_P(X) (GET_CODE (X) == DEBUG_INSN)
862 :
863 : /* Predicate yielding nonzero iff X is an insn that is not a debug insn. */
864 : #define NONDEBUG_INSN_P(X) (NONJUMP_INSN_P (X) || JUMP_P (X) || CALL_P (X))
865 :
866 : /* Nonzero if DEBUG_MARKER_INSN_P may possibly hold. */
867 : #define MAY_HAVE_DEBUG_MARKER_INSNS debug_nonbind_markers_p
868 : /* Nonzero if DEBUG_BIND_INSN_P may possibly hold. */
869 : #define MAY_HAVE_DEBUG_BIND_INSNS flag_var_tracking_assignments
870 : /* Nonzero if DEBUG_INSN_P may possibly hold. */
871 : #define MAY_HAVE_DEBUG_INSNS \
872 : (MAY_HAVE_DEBUG_MARKER_INSNS || MAY_HAVE_DEBUG_BIND_INSNS)
873 :
874 : /* Predicate yielding nonzero iff X is a real insn. */
875 : #define INSN_P(X) (NONDEBUG_INSN_P (X) || DEBUG_INSN_P (X))
876 :
877 : /* Predicate yielding nonzero iff X is a note insn. */
878 : #define NOTE_P(X) (GET_CODE (X) == NOTE)
879 :
880 : /* Predicate yielding nonzero iff X is a barrier insn. */
881 : #define BARRIER_P(X) (GET_CODE (X) == BARRIER)
882 :
883 : /* Predicate yielding nonzero iff X is a data for a jump table. */
884 : #define JUMP_TABLE_DATA_P(INSN) (GET_CODE (INSN) == JUMP_TABLE_DATA)
885 :
886 : /* Predicate yielding nonzero iff RTX is a subreg. */
887 : #define SUBREG_P(RTX) (GET_CODE (RTX) == SUBREG)
888 :
889 : /* Predicate yielding true iff RTX is a symbol ref. */
890 : #define SYMBOL_REF_P(RTX) (GET_CODE (RTX) == SYMBOL_REF)
891 :
892 : template <>
893 : template <>
894 : inline bool
895 >18833*10^7 : is_a_helper <rtx_insn *>::test (rtx rt)
896 : {
897 >18833*10^7 : return (INSN_P (rt)
898 >18833*10^7 : || NOTE_P (rt)
899 23465425683 : || JUMP_TABLE_DATA_P (rt)
900 23462353945 : || BARRIER_P (rt)
901 >20300*10^7 : || LABEL_P (rt));
902 : }
903 :
904 : template <>
905 : template <>
906 : inline bool
907 113573808 : is_a_helper <const rtx_insn *>::test (const_rtx rt)
908 : {
909 113573808 : return (INSN_P (rt)
910 113573808 : || NOTE_P (rt)
911 283 : || JUMP_TABLE_DATA_P (rt)
912 283 : || BARRIER_P (rt)
913 113574083 : || LABEL_P (rt));
914 : }
915 :
916 : template <>
917 : template <>
918 : inline bool
919 56714166 : is_a_helper <rtx_debug_insn *>::test (rtx rt)
920 : {
921 56714166 : return DEBUG_INSN_P (rt);
922 : }
923 :
924 : template <>
925 : template <>
926 : inline bool
927 : is_a_helper <rtx_nonjump_insn *>::test (rtx rt)
928 : {
929 : return NONJUMP_INSN_P (rt);
930 : }
931 :
932 : template <>
933 : template <>
934 : inline bool
935 18579955 : is_a_helper <rtx_jump_insn *>::test (rtx rt)
936 : {
937 18579955 : return JUMP_P (rt);
938 : }
939 :
940 : template <>
941 : template <>
942 : inline bool
943 50921290 : is_a_helper <rtx_jump_insn *>::test (rtx_insn *insn)
944 : {
945 50921290 : return JUMP_P (insn);
946 : }
947 :
948 : template <>
949 : template <>
950 : inline bool
951 6521302 : is_a_helper <rtx_call_insn *>::test (rtx rt)
952 : {
953 6521302 : return CALL_P (rt);
954 : }
955 :
956 : template <>
957 : template <>
958 : inline bool
959 909330303 : is_a_helper <rtx_call_insn *>::test (rtx_insn *insn)
960 : {
961 909330303 : return CALL_P (insn);
962 : }
963 :
964 : template <>
965 : template <>
966 : inline bool
967 33707186 : is_a_helper <const rtx_call_insn *>::test (const rtx_insn *insn)
968 : {
969 33707186 : return CALL_P (insn);
970 : }
971 :
972 : template <>
973 : template <>
974 : inline bool
975 7461 : is_a_helper <rtx_jump_table_data *>::test (rtx rt)
976 : {
977 7461 : return JUMP_TABLE_DATA_P (rt);
978 : }
979 :
980 : template <>
981 : template <>
982 : inline bool
983 150532483 : is_a_helper <rtx_jump_table_data *>::test (rtx_insn *insn)
984 : {
985 150532483 : return JUMP_TABLE_DATA_P (insn);
986 : }
987 :
988 : template <>
989 : template <>
990 : inline bool
991 11522202 : is_a_helper <rtx_barrier *>::test (rtx rt)
992 : {
993 11522202 : return BARRIER_P (rt);
994 : }
995 :
996 : template <>
997 : template <>
998 : inline bool
999 24704923 : is_a_helper <rtx_code_label *>::test (rtx rt)
1000 : {
1001 24704923 : return LABEL_P (rt);
1002 : }
1003 :
1004 : template <>
1005 : template <>
1006 : inline bool
1007 435286506 : is_a_helper <rtx_code_label *>::test (rtx_insn *insn)
1008 : {
1009 435286506 : return LABEL_P (insn);
1010 : }
1011 :
1012 : template <>
1013 : template <>
1014 : inline bool
1015 181325301 : is_a_helper <rtx_note *>::test (rtx rt)
1016 : {
1017 181325301 : return NOTE_P (rt);
1018 : }
1019 :
1020 : template <>
1021 : template <>
1022 : inline bool
1023 88002324 : is_a_helper <rtx_note *>::test (rtx_insn *insn)
1024 : {
1025 88002324 : return NOTE_P (insn);
1026 : }
1027 :
1028 : /* Predicate yielding nonzero iff X is a return or simple_return. */
1029 : #define ANY_RETURN_P(X) \
1030 : (GET_CODE (X) == RETURN || GET_CODE (X) == SIMPLE_RETURN)
1031 :
1032 : /* 1 if X is a unary operator. */
1033 :
1034 : #define UNARY_P(X) \
1035 : (GET_RTX_CLASS (GET_CODE (X)) == RTX_UNARY)
1036 :
1037 : /* 1 if X is a binary operator. */
1038 :
1039 : #define BINARY_P(X) \
1040 : ((GET_RTX_CLASS (GET_CODE (X)) & RTX_BINARY_MASK) == RTX_BINARY_RESULT)
1041 :
1042 : /* 1 if X is an arithmetic operator. */
1043 :
1044 : #define ARITHMETIC_P(X) \
1045 : ((GET_RTX_CLASS (GET_CODE (X)) & RTX_ARITHMETIC_MASK) \
1046 : == RTX_ARITHMETIC_RESULT)
1047 :
1048 : /* 1 if X is an arithmetic operator. */
1049 :
1050 : #define COMMUTATIVE_ARITH_P(X) \
1051 : (GET_RTX_CLASS (GET_CODE (X)) == RTX_COMM_ARITH)
1052 :
1053 : /* 1 if X is a commutative arithmetic operator or a comparison operator.
1054 : These two are sometimes selected together because it is possible to
1055 : swap the two operands. */
1056 :
1057 : #define SWAPPABLE_OPERANDS_P(X) \
1058 : ((1 << GET_RTX_CLASS (GET_CODE (X))) \
1059 : & ((1 << RTX_COMM_ARITH) | (1 << RTX_COMM_COMPARE) \
1060 : | (1 << RTX_COMPARE)))
1061 :
1062 : /* 1 if X is a non-commutative operator. */
1063 :
1064 : #define NON_COMMUTATIVE_P(X) \
1065 : ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \
1066 : == RTX_NON_COMMUTATIVE_RESULT)
1067 :
1068 : /* 1 if X is a commutative operator on integers. */
1069 :
1070 : #define COMMUTATIVE_P(X) \
1071 : ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \
1072 : == RTX_COMMUTATIVE_RESULT)
1073 :
1074 : /* 1 if X is a relational operator. */
1075 :
1076 : #define COMPARISON_P(X) \
1077 : ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMPARE_MASK) == RTX_COMPARE_RESULT)
1078 :
1079 : /* 1 if X is a constant value that is an integer. */
1080 :
1081 : #define CONSTANT_P(X) \
1082 : (GET_RTX_CLASS (GET_CODE (X)) == RTX_CONST_OBJ)
1083 :
1084 : /* 1 if X is a LABEL_REF. */
1085 : #define LABEL_REF_P(X) \
1086 : (GET_CODE (X) == LABEL_REF)
1087 :
1088 : /* 1 if X can be used to represent an object. */
1089 : #define OBJECT_P(X) \
1090 : ((GET_RTX_CLASS (GET_CODE (X)) & RTX_OBJ_MASK) == RTX_OBJ_RESULT)
1091 :
1092 : /* General accessor macros for accessing the fields of an rtx. */
1093 :
1094 : #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
1095 : /* The bit with a star outside the statement expr and an & inside is
1096 : so that N can be evaluated only once. */
1097 : #define RTL_CHECK1(RTX, N, C1) __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] != C1) \
1104 : rtl_check_failed_type1 (_rtx, _n, C1, __FILE__, __LINE__, \
1105 : __FUNCTION__); \
1106 : &_rtx->u.fld[_n]; }))
1107 :
1108 : #define RTL_CHECK2(RTX, N, C1, C2) __extension__ \
1109 : (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
1110 : const enum rtx_code _code = GET_CODE (_rtx); \
1111 : if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
1112 : rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
1113 : __FUNCTION__); \
1114 : if (GET_RTX_FORMAT (_code)[_n] != C1 \
1115 : && GET_RTX_FORMAT (_code)[_n] != C2) \
1116 : rtl_check_failed_type2 (_rtx, _n, C1, C2, __FILE__, __LINE__, \
1117 : __FUNCTION__); \
1118 : &_rtx->u.fld[_n]; }))
1119 :
1120 : #define RTL_CHECKC1(RTX, N, C) __extension__ \
1121 : (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
1122 : if (GET_CODE (_rtx) != (C)) \
1123 : rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
1124 : __FUNCTION__); \
1125 : &_rtx->u.fld[_n]; }))
1126 :
1127 : #define RTL_CHECKC2(RTX, N, C1, C2) __extension__ \
1128 : (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
1129 : const enum rtx_code _code = GET_CODE (_rtx); \
1130 : if (_code != (C1) && _code != (C2)) \
1131 : rtl_check_failed_code2 (_rtx, (C1), (C2), __FILE__, __LINE__, \
1132 : __FUNCTION__); \
1133 : &_rtx->u.fld[_n]; }))
1134 :
1135 : #define RTL_CHECKC3(RTX, N, C1, C2, C3) __extension__ \
1136 : (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
1137 : const enum rtx_code _code = GET_CODE (_rtx); \
1138 : if (_code != (C1) && _code != (C2) && _code != (C3)) \
1139 : rtl_check_failed_code3 (_rtx, (C1), (C2), (C3), __FILE__, \
1140 : __LINE__, __FUNCTION__); \
1141 : &_rtx->u.fld[_n]; }))
1142 :
1143 : #define RTVEC_ELT(RTVEC, I) __extension__ \
1144 : (*({ __typeof (RTVEC) const _rtvec = (RTVEC); const int _i = (I); \
1145 : if (_i < 0 || _i >= GET_NUM_ELEM (_rtvec)) \
1146 : rtvec_check_failed_bounds (_rtvec, _i, __FILE__, __LINE__, \
1147 : __FUNCTION__); \
1148 : &_rtvec->elem[_i]; }))
1149 :
1150 : #define XWINT(RTX, N) __extension__ \
1151 : (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
1152 : const enum rtx_code _code = GET_CODE (_rtx); \
1153 : if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
1154 : rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
1155 : __FUNCTION__); \
1156 : if (GET_RTX_FORMAT (_code)[_n] != 'w') \
1157 : rtl_check_failed_type1 (_rtx, _n, 'w', __FILE__, __LINE__, \
1158 : __FUNCTION__); \
1159 : &_rtx->u.hwint[_n]; }))
1160 :
1161 : #define CWI_ELT(RTX, I) __extension__ \
1162 : (*({ __typeof (RTX) const _cwi = (RTX); \
1163 : int _max = CWI_GET_NUM_ELEM (_cwi); \
1164 : const int _i = (I); \
1165 : if (_i < 0 || _i >= _max) \
1166 : cwi_check_failed_bounds (_cwi, _i, __FILE__, __LINE__, \
1167 : __FUNCTION__); \
1168 : &_cwi->u.hwiv.elem[_i]; }))
1169 :
1170 : #define XCWINT(RTX, N, C) __extension__ \
1171 : (*({ __typeof (RTX) const _rtx = (RTX); \
1172 : if (GET_CODE (_rtx) != (C)) \
1173 : rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
1174 : __FUNCTION__); \
1175 : &_rtx->u.hwint[N]; }))
1176 :
1177 : #define XCMWINT(RTX, N, C, M) __extension__ \
1178 : (*({ __typeof (RTX) const _rtx = (RTX); \
1179 : if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) != (M)) \
1180 : rtl_check_failed_code_mode (_rtx, (C), (M), false, __FILE__, \
1181 : __LINE__, __FUNCTION__); \
1182 : &_rtx->u.hwint[N]; }))
1183 :
1184 : #define XCNMPRV(RTX, C, M) __extension__ \
1185 : ({ __typeof (RTX) const _rtx = (RTX); \
1186 : if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \
1187 : rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \
1188 : __LINE__, __FUNCTION__); \
1189 : &_rtx->u.rv; })
1190 :
1191 : #define XCNMPFV(RTX, C, M) __extension__ \
1192 : ({ __typeof (RTX) const _rtx = (RTX); \
1193 : if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \
1194 : rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \
1195 : __LINE__, __FUNCTION__); \
1196 : &_rtx->u.fv; })
1197 :
1198 : #define REG_CHECK(RTX) __extension__ \
1199 : ({ __typeof (RTX) const _rtx = (RTX); \
1200 : if (GET_CODE (_rtx) != REG) \
1201 : rtl_check_failed_code1 (_rtx, REG, __FILE__, __LINE__, \
1202 : __FUNCTION__); \
1203 : &_rtx->u.reg; })
1204 :
1205 : #define BLOCK_SYMBOL_CHECK(RTX) __extension__ \
1206 : ({ __typeof (RTX) const _symbol = (RTX); \
1207 : const unsigned int flags = SYMBOL_REF_FLAGS (_symbol); \
1208 : if ((flags & SYMBOL_FLAG_HAS_BLOCK_INFO) == 0) \
1209 : rtl_check_failed_block_symbol (__FILE__, __LINE__, \
1210 : __FUNCTION__); \
1211 : &_symbol->u.block_sym; })
1212 :
1213 : #define HWIVEC_CHECK(RTX,C) __extension__ \
1214 : ({ __typeof (RTX) const _symbol = (RTX); \
1215 : RTL_CHECKC1 (_symbol, 0, C); \
1216 : &_symbol->u.hwiv; })
1217 :
1218 : extern void rtl_check_failed_bounds (const_rtx, int, const char *, int,
1219 : const char *)
1220 : ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1221 : extern void rtl_check_failed_type1 (const_rtx, int, int, const char *, int,
1222 : const char *)
1223 : ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1224 : extern void rtl_check_failed_type2 (const_rtx, int, int, int, const char *,
1225 : int, const char *)
1226 : ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1227 : extern void rtl_check_failed_code1 (const_rtx, enum rtx_code, const char *,
1228 : int, const char *)
1229 : ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1230 : extern void rtl_check_failed_code2 (const_rtx, enum rtx_code, enum rtx_code,
1231 : const char *, int, const char *)
1232 : ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1233 : extern void rtl_check_failed_code3 (const_rtx, enum rtx_code, enum rtx_code,
1234 : enum rtx_code, const char *, int,
1235 : const char *)
1236 : ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1237 : extern void rtl_check_failed_code_mode (const_rtx, enum rtx_code, machine_mode,
1238 : bool, const char *, int, const char *)
1239 : ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1240 : extern void rtl_check_failed_block_symbol (const char *, int, const char *)
1241 : ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1242 : extern void cwi_check_failed_bounds (const_rtx, int, const char *, int,
1243 : const char *)
1244 : ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1245 : extern void rtvec_check_failed_bounds (const_rtvec, int, const char *, int,
1246 : const char *)
1247 : ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
1248 :
1249 : #else /* not ENABLE_RTL_CHECKING */
1250 :
1251 : #define RTL_CHECK1(RTX, N, C1) ((RTX)->u.fld[N])
1252 : #define RTL_CHECK2(RTX, N, C1, C2) ((RTX)->u.fld[N])
1253 : #define RTL_CHECKC1(RTX, N, C) ((RTX)->u.fld[N])
1254 : #define RTL_CHECKC2(RTX, N, C1, C2) ((RTX)->u.fld[N])
1255 : #define RTL_CHECKC3(RTX, N, C1, C2, C3) ((RTX)->u.fld[N])
1256 : #define RTVEC_ELT(RTVEC, I) ((RTVEC)->elem[I])
1257 : #define XWINT(RTX, N) ((RTX)->u.hwint[N])
1258 : #define CWI_ELT(RTX, I) ((RTX)->u.hwiv.elem[I])
1259 : #define XCWINT(RTX, N, C) ((RTX)->u.hwint[N])
1260 : #define XCMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
1261 : #define XCNMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
1262 : #define XCNMPRV(RTX, C, M) (&(RTX)->u.rv)
1263 : #define XCNMPFV(RTX, C, M) (&(RTX)->u.fv)
1264 : #define REG_CHECK(RTX) (&(RTX)->u.reg)
1265 : #define BLOCK_SYMBOL_CHECK(RTX) (&(RTX)->u.block_sym)
1266 : #define HWIVEC_CHECK(RTX,C) (&(RTX)->u.hwiv)
1267 :
1268 : #endif
1269 :
1270 : /* General accessor macros for accessing the flags of an rtx. */
1271 :
1272 : /* Access an individual rtx flag, with no checking of any kind. */
1273 : #define RTX_FLAG(RTX, FLAG) ((RTX)->FLAG)
1274 :
1275 : #if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION >= 2007)
1276 : #define RTL_FLAG_CHECK1(NAME, RTX, C1) __extension__ \
1277 : ({ __typeof (RTX) const _rtx = (RTX); \
1278 : if (GET_CODE (_rtx) != C1) \
1279 : rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1280 : __FUNCTION__); \
1281 : _rtx; })
1282 :
1283 : #define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) __extension__ \
1284 : ({ __typeof (RTX) const _rtx = (RTX); \
1285 : if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2) \
1286 : rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
1287 : __FUNCTION__); \
1288 : _rtx; })
1289 :
1290 : #define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) __extension__ \
1291 : ({ __typeof (RTX) const _rtx = (RTX); \
1292 : if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \
1293 : && GET_CODE (_rtx) != C3) \
1294 : rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1295 : __FUNCTION__); \
1296 : _rtx; })
1297 :
1298 : #define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) __extension__ \
1299 : ({ __typeof (RTX) const _rtx = (RTX); \
1300 : if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \
1301 : && GET_CODE (_rtx) != C3 && GET_CODE(_rtx) != C4) \
1302 : rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1303 : __FUNCTION__); \
1304 : _rtx; })
1305 :
1306 : #define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) __extension__ \
1307 : ({ __typeof (RTX) const _rtx = (RTX); \
1308 : if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
1309 : && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
1310 : && GET_CODE (_rtx) != C5) \
1311 : rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1312 : __FUNCTION__); \
1313 : _rtx; })
1314 :
1315 : #define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) \
1316 : __extension__ \
1317 : ({ __typeof (RTX) const _rtx = (RTX); \
1318 : if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
1319 : && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
1320 : && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6) \
1321 : rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
1322 : __FUNCTION__); \
1323 : _rtx; })
1324 :
1325 : #define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) \
1326 : __extension__ \
1327 : ({ __typeof (RTX) const _rtx = (RTX); \
1328 : if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
1329 : && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
1330 : && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6 \
1331 : && GET_CODE (_rtx) != C7) \
1332 : rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1333 : __FUNCTION__); \
1334 : _rtx; })
1335 :
1336 : #define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) \
1337 : __extension__ \
1338 : ({ __typeof (RTX) const _rtx = (RTX); \
1339 : if (!INSN_CHAIN_CODE_P (GET_CODE (_rtx))) \
1340 : rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
1341 : __FUNCTION__); \
1342 : _rtx; })
1343 :
1344 : extern void rtl_check_failed_flag (const char *, const_rtx, const char *,
1345 : int, const char *)
1346 : ATTRIBUTE_NORETURN ATTRIBUTE_COLD
1347 : ;
1348 :
1349 : #else /* not ENABLE_RTL_FLAG_CHECKING */
1350 :
1351 : #define RTL_FLAG_CHECK1(NAME, RTX, C1) (RTX)
1352 : #define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) (RTX)
1353 : #define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) (RTX)
1354 : #define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) (RTX)
1355 : #define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) (RTX)
1356 : #define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) (RTX)
1357 : #define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) (RTX)
1358 : #define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) (RTX)
1359 : #endif
1360 :
1361 : #define XINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rt_int)
1362 : #define XUINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rt_uint)
1363 : #define XLOC(RTX, N) (RTL_CHECK1 (RTX, N, 'L').rt_loc)
1364 : #define XSTR(RTX, N) (RTL_CHECK2 (RTX, N, 's', 'S').rt_str)
1365 : #define XEXP(RTX, N) (RTL_CHECK2 (RTX, N, 'e', 'u').rt_rtx)
1366 : #define XVEC(RTX, N) (RTL_CHECK2 (RTX, N, 'E', 'V').rt_rtvec)
1367 : #define XMODE(RTX, N) (RTL_CHECK1 (RTX, N, 'M').rt_type)
1368 : #define XTREE(RTX, N) (RTL_CHECK1 (RTX, N, 't').rt_tree)
1369 : #define XBBDEF(RTX, N) (RTL_CHECK1 (RTX, N, 'B').rt_bb)
1370 : #define XTMPL(RTX, N) (RTL_CHECK1 (RTX, N, 'T').rt_str)
1371 : #define XCFI(RTX, N) (RTL_CHECK1 (RTX, N, 'C').rt_cfi)
1372 :
1373 : #define XVECEXP(RTX, N, M) RTVEC_ELT (XVEC (RTX, N), M)
1374 : #define XVECLEN(RTX, N) GET_NUM_ELEM (XVEC (RTX, N))
1375 :
1376 : /* These are like XINT, etc. except that they expect a '0' field instead
1377 : of the normal type code. */
1378 :
1379 : #define X0INT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_int)
1380 : #define X0UINT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_uint)
1381 : #define X0LOC(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_loc)
1382 : #define X0STR(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_str)
1383 : #define X0EXP(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtx)
1384 : #define X0VEC(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtvec)
1385 : #define X0MODE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_type)
1386 : #define X0TREE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_tree)
1387 : #define X0BBDEF(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_bb)
1388 : #define X0ADVFLAGS(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_addr_diff_vec_flags)
1389 : #define X0CSELIB(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_cselib)
1390 : #define X0MEMATTR(RTX, N) (RTL_CHECKC1 (RTX, N, MEM).rt_mem)
1391 : #define X0CONSTANT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_constant)
1392 :
1393 : /* Access a '0' field with any type. */
1394 : #define X0ANY(RTX, N) RTL_CHECK1 (RTX, N, '0')
1395 :
1396 : #define XCINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_int)
1397 : #define XCUINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_uint)
1398 : #define XCLOC(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_loc)
1399 : #define XCSUBREG(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_subreg)
1400 : #define XCSTR(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_str)
1401 : #define XCEXP(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtx)
1402 : #define XCVEC(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtvec)
1403 : #define XCMODE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_type)
1404 : #define XCTREE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_tree)
1405 : #define XCBBDEF(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_bb)
1406 : #define XCCFI(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_cfi)
1407 : #define XCCSELIB(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_cselib)
1408 :
1409 : #define XCVECEXP(RTX, N, M, C) RTVEC_ELT (XCVEC (RTX, N, C), M)
1410 : #define XCVECLEN(RTX, N, C) GET_NUM_ELEM (XCVEC (RTX, N, C))
1411 :
1412 : #define XC2EXP(RTX, N, C1, C2) (RTL_CHECKC2 (RTX, N, C1, C2).rt_rtx)
1413 : #define XC3EXP(RTX, N, C1, C2, C3) (RTL_CHECKC3 (RTX, N, C1, C2, C3).rt_rtx)
1414 :
1415 :
1416 : /* Methods of rtx_expr_list. */
1417 :
1418 139340305 : inline rtx_expr_list *rtx_expr_list::next () const
1419 : {
1420 139340305 : rtx tmp = XEXP (this, 1);
1421 139340305 : return safe_as_a <rtx_expr_list *> (tmp);
1422 : }
1423 :
1424 154432751 : inline rtx rtx_expr_list::element () const
1425 : {
1426 154432751 : return XEXP (this, 0);
1427 : }
1428 :
1429 : /* Methods of rtx_insn_list. */
1430 :
1431 1736427746 : inline rtx_insn_list *rtx_insn_list::next () const
1432 : {
1433 1736427746 : rtx tmp = XEXP (this, 1);
1434 1736427746 : return safe_as_a <rtx_insn_list *> (tmp);
1435 : }
1436 :
1437 1119580706 : inline rtx_insn *rtx_insn_list::insn () const
1438 : {
1439 1119580706 : rtx tmp = XEXP (this, 0);
1440 1119580706 : return safe_as_a <rtx_insn *> (tmp);
1441 : }
1442 :
1443 : /* Methods of rtx_sequence. */
1444 :
1445 0 : inline int rtx_sequence::len () const
1446 : {
1447 0 : return XVECLEN (this, 0);
1448 : }
1449 :
1450 0 : inline rtx rtx_sequence::element (int index) const
1451 : {
1452 0 : return XVECEXP (this, 0, index);
1453 : }
1454 :
1455 0 : inline rtx_insn *rtx_sequence::insn (int index) const
1456 : {
1457 0 : return as_a <rtx_insn *> (XVECEXP (this, 0, index));
1458 : }
1459 :
1460 : /* ACCESS MACROS for particular fields of insns. */
1461 :
1462 : /* Holds a unique number for each insn.
1463 : These are not necessarily sequentially increasing. */
1464 7815276170 : inline int INSN_UID (const_rtx insn)
1465 : {
1466 7815276170 : return RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID",
1467 7815276170 : (insn))->u2.insn_uid;
1468 : }
1469 61299392660 : inline int& INSN_UID (rtx insn)
1470 : {
1471 61299392660 : return RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID",
1472 61299392660 : (insn))->u2.insn_uid;
1473 : }
1474 :
1475 : /* Chain insns together in sequence. */
1476 :
1477 : /* For now these are split in two: an rvalue form:
1478 : PREV_INSN/NEXT_INSN
1479 : and an lvalue form:
1480 : SET_NEXT_INSN/SET_PREV_INSN. */
1481 :
1482 47226876221 : inline rtx_insn *PREV_INSN (const rtx_insn *insn)
1483 : {
1484 47226876221 : rtx prev = XEXP (insn, 0);
1485 47193679578 : return safe_as_a <rtx_insn *> (prev);
1486 : }
1487 :
1488 : inline rtx& SET_PREV_INSN (rtx_insn *insn)
1489 : {
1490 : return XEXP (insn, 0);
1491 : }
1492 :
1493 >14243*10^7 : inline rtx_insn *NEXT_INSN (const rtx_insn *insn)
1494 : {
1495 >14243*10^7 : rtx next = XEXP (insn, 1);
1496 >14171*10^7 : return safe_as_a <rtx_insn *> (next);
1497 : }
1498 :
1499 : inline rtx& SET_NEXT_INSN (rtx_insn *insn)
1500 : {
1501 : return XEXP (insn, 1);
1502 : }
1503 :
1504 970645 : inline basic_block BLOCK_FOR_INSN (const_rtx insn)
1505 : {
1506 970645 : return XBBDEF (insn, 2);
1507 : }
1508 :
1509 : inline basic_block& BLOCK_FOR_INSN (rtx insn)
1510 : {
1511 : return XBBDEF (insn, 2);
1512 : }
1513 :
1514 474916940 : inline void set_block_for_insn (rtx_insn *insn, basic_block bb)
1515 : {
1516 474916806 : BLOCK_FOR_INSN (insn) = bb;
1517 : }
1518 :
1519 : /* The body of an insn. */
1520 30947426726 : inline rtx PATTERN (const_rtx insn)
1521 : {
1522 30368755294 : return XEXP (insn, 3);
1523 : }
1524 :
1525 8005848517 : inline rtx& PATTERN (rtx insn)
1526 : {
1527 8005848517 : return XEXP (insn, 3);
1528 : }
1529 :
1530 325124401 : inline location_t INSN_LOCATION (const rtx_insn *insn)
1531 : {
1532 230208114 : return XLOC (insn, 4);
1533 : }
1534 :
1535 : inline location_t& INSN_LOCATION (rtx_insn *insn)
1536 : {
1537 : return XLOC (insn, 4);
1538 : }
1539 :
1540 101983756 : inline bool INSN_HAS_LOCATION (const rtx_insn *insn)
1541 : {
1542 101983756 : return LOCATION_LOCUS (INSN_LOCATION (insn)) != UNKNOWN_LOCATION;
1543 : }
1544 :
1545 : /* LOCATION of an RTX if relevant. */
1546 : #define RTL_LOCATION(X) (INSN_P (X) ? \
1547 : INSN_LOCATION (as_a <rtx_insn *> (X)) \
1548 : : UNKNOWN_LOCATION)
1549 :
1550 : /* Code number of instruction, from when it was recognized.
1551 : -1 means this instruction has not been recognized yet. */
1552 : #define INSN_CODE(INSN) XINT (INSN, 5)
1553 :
1554 40523 : inline rtvec rtx_jump_table_data::get_labels () const
1555 : {
1556 40523 : rtx pat = PATTERN (this);
1557 40523 : if (GET_CODE (pat) == ADDR_VEC)
1558 34553 : return XVEC (pat, 0);
1559 : else
1560 5970 : return XVEC (pat, 1); /* presumably an ADDR_DIFF_VEC */
1561 : }
1562 :
1563 : /* Return the mode of the data in the table, which is always a scalar
1564 : integer. */
1565 :
1566 : inline scalar_int_mode
1567 7269 : rtx_jump_table_data::get_data_mode () const
1568 : {
1569 7269 : return as_a <scalar_int_mode> (GET_MODE (PATTERN (this)));
1570 : }
1571 :
1572 : /* If LABEL is followed by a jump table, return the table, otherwise
1573 : return null. */
1574 :
1575 : inline rtx_jump_table_data *
1576 14112076 : jump_table_for_label (const rtx_code_label *label)
1577 : {
1578 14112076 : return safe_dyn_cast <rtx_jump_table_data *> (NEXT_INSN (label));
1579 : }
1580 :
1581 : #define RTX_FRAME_RELATED_P(RTX) \
1582 : (RTL_FLAG_CHECK6 ("RTX_FRAME_RELATED_P", (RTX), DEBUG_INSN, INSN, \
1583 : CALL_INSN, JUMP_INSN, BARRIER, SET)->frame_related)
1584 :
1585 : /* 1 if JUMP RTX is a crossing jump. */
1586 : #define CROSSING_JUMP_P(RTX) \
1587 : (RTL_FLAG_CHECK1 ("CROSSING_JUMP_P", (RTX), JUMP_INSN)->jump)
1588 :
1589 : /* 1 if RTX is a call to a const function. Built from ECF_CONST and
1590 : TREE_READONLY. */
1591 : #define RTL_CONST_CALL_P(RTX) \
1592 : (RTL_FLAG_CHECK1 ("RTL_CONST_CALL_P", (RTX), CALL_INSN)->unchanging)
1593 :
1594 : /* 1 if RTX is a call to a pure function. Built from ECF_PURE and
1595 : DECL_PURE_P. */
1596 : #define RTL_PURE_CALL_P(RTX) \
1597 : (RTL_FLAG_CHECK1 ("RTL_PURE_CALL_P", (RTX), CALL_INSN)->return_val)
1598 :
1599 : /* 1 if RTX is a call to a const or pure function. */
1600 : #define RTL_CONST_OR_PURE_CALL_P(RTX) \
1601 : (RTL_CONST_CALL_P (RTX) || RTL_PURE_CALL_P (RTX))
1602 :
1603 : /* 1 if RTX is a call to a looping const or pure function. Built from
1604 : ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P. */
1605 : #define RTL_LOOPING_CONST_OR_PURE_CALL_P(RTX) \
1606 : (RTL_FLAG_CHECK1 ("CONST_OR_PURE_CALL_P", (RTX), CALL_INSN)->call)
1607 :
1608 : /* 1 if RTX is a call_insn for a sibling call. */
1609 : #define SIBLING_CALL_P(RTX) \
1610 : (RTL_FLAG_CHECK1 ("SIBLING_CALL_P", (RTX), CALL_INSN)->jump)
1611 :
1612 : /* 1 if RTX is a jump_insn, call_insn, or insn that is an annulling branch. */
1613 : #define INSN_ANNULLED_BRANCH_P(RTX) \
1614 : (RTL_FLAG_CHECK1 ("INSN_ANNULLED_BRANCH_P", (RTX), JUMP_INSN)->unchanging)
1615 :
1616 : /* 1 if RTX is an insn in a delay slot and is from the target of the branch.
1617 : If the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be
1618 : executed if the branch is taken. For annulled branches with this bit
1619 : clear, the insn should be executed only if the branch is not taken. */
1620 : #define INSN_FROM_TARGET_P(RTX) \
1621 : (RTL_FLAG_CHECK3 ("INSN_FROM_TARGET_P", (RTX), INSN, JUMP_INSN, \
1622 : CALL_INSN)->in_struct)
1623 :
1624 : /* In an ADDR_DIFF_VEC, the flags for RTX for use by branch shortening.
1625 : See the comments for ADDR_DIFF_VEC in rtl.def. */
1626 : #define ADDR_DIFF_VEC_FLAGS(RTX) X0ADVFLAGS (RTX, 4)
1627 :
1628 : /* In a VALUE, the value cselib has assigned to RTX.
1629 : This is a "struct cselib_val", see cselib.h. */
1630 : #define CSELIB_VAL_PTR(RTX) X0CSELIB (RTX, 0)
1631 :
1632 : /* A VALUE's unique identifier. */
1633 : #define CSELIB_VAL_UID(RTX) \
1634 : RTL_FLAG_CHECK1 ("CSELIB_VAL_UID", (RTX), VALUE)->u2.value_uid
1635 :
1636 : /* Holds a list of notes on what this insn does to various REGs.
1637 : It is a chain of EXPR_LIST rtx's, where the second operand is the
1638 : chain pointer and the first operand is the REG being described.
1639 : The mode field of the EXPR_LIST contains not a real machine mode
1640 : but a value from enum reg_note. */
1641 : #define REG_NOTES(INSN) XEXP(INSN, 6)
1642 :
1643 : /* In an ENTRY_VALUE this is the DECL_INCOMING_RTL of the argument in
1644 : question. */
1645 : #define ENTRY_VALUE_EXP(RTX) (RTL_CHECKC1 (RTX, 0, ENTRY_VALUE).rt_rtx)
1646 :
1647 : enum reg_note
1648 : {
1649 : #define DEF_REG_NOTE(NAME) NAME,
1650 : #include "reg-notes.def"
1651 : #undef DEF_REG_NOTE
1652 : REG_NOTE_MAX
1653 : };
1654 :
1655 : /* Define macros to extract and insert the reg-note kind in an EXPR_LIST. */
1656 : #define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK))
1657 : #define PUT_REG_NOTE_KIND(LINK, KIND) \
1658 : PUT_MODE_RAW (LINK, (machine_mode) (KIND))
1659 :
1660 : /* Names for REG_NOTE's in EXPR_LIST insn's. */
1661 :
1662 : extern const char * const reg_note_name[];
1663 : #define GET_REG_NOTE_NAME(MODE) (reg_note_name[(int) (MODE)])
1664 :
1665 : /* This field is only present on CALL_INSNs. It holds a chain of EXPR_LIST of
1666 : USE, CLOBBER and SET expressions.
1667 : USE expressions list the registers filled with arguments that
1668 : are passed to the function.
1669 : CLOBBER expressions document the registers explicitly clobbered
1670 : by this CALL_INSN.
1671 : SET expressions say that the return value of the call (the SET_DEST)
1672 : is equivalent to a value available before the call (the SET_SRC).
1673 : This kind of SET is used when the return value is predictable in
1674 : advance. It is purely an optimisation hint; unlike USEs and CLOBBERs,
1675 : it does not affect register liveness.
1676 :
1677 : Pseudo registers cannot be mentioned in this list. */
1678 : #define CALL_INSN_FUNCTION_USAGE(INSN) XEXP(INSN, 7)
1679 :
1680 : /* Specifies the callee's ABI as an index in the range [0, NUM_ABI_IDS - 1].
1681 : See function-abi.h for more details. */
1682 : #define CALL_INSN_ABI_ID(INSN) XCINT(INSN, 8, CALL_INSN)
1683 :
1684 : /* The label-number of a code-label. The assembler label
1685 : is made from `L' and the label-number printed in decimal.
1686 : Label numbers are unique in a compilation. */
1687 : #define CODE_LABEL_NUMBER(INSN) XINT (INSN, 5)
1688 :
1689 : /* In a NOTE that is a line number, this is a string for the file name that the
1690 : line is in. We use the same field to record block numbers temporarily in
1691 : NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes. (We avoid lots of casts
1692 : between ints and pointers if we use a different macro for the block number.)
1693 : */
1694 :
1695 : /* Opaque data. */
1696 : #define NOTE_DATA(INSN) RTL_CHECKC1 (INSN, 3, NOTE)
1697 : #define NOTE_DELETED_LABEL_NAME(INSN) XCSTR (INSN, 3, NOTE)
1698 : #define SET_INSN_DELETED(INSN) set_insn_deleted (INSN);
1699 : #define NOTE_BLOCK(INSN) XCTREE (INSN, 3, NOTE)
1700 : #define NOTE_EH_HANDLER(INSN) XCINT (INSN, 3, NOTE)
1701 : #define NOTE_BASIC_BLOCK(INSN) XCBBDEF (INSN, 3, NOTE)
1702 : #define NOTE_VAR_LOCATION(INSN) XCEXP (INSN, 3, NOTE)
1703 : #define NOTE_MARKER_LOCATION(INSN) XCLOC (INSN, 3, NOTE)
1704 : #define NOTE_CFI(INSN) XCCFI (INSN, 3, NOTE)
1705 : #define NOTE_LABEL_NUMBER(INSN) XCINT (INSN, 3, NOTE)
1706 :
1707 : /* In a NOTE that is a line number, this is the line number.
1708 : Other kinds of NOTEs are identified by negative numbers here. */
1709 : #define NOTE_KIND(INSN) XCINT (INSN, 4, NOTE)
1710 :
1711 : /* Nonzero if INSN is a note marking the beginning of a basic block. */
1712 : #define NOTE_INSN_BASIC_BLOCK_P(INSN) \
1713 : (NOTE_P (INSN) && NOTE_KIND (INSN) == NOTE_INSN_BASIC_BLOCK)
1714 :
1715 : /* Nonzero if INSN is a debug nonbind marker note,
1716 : for which NOTE_MARKER_LOCATION can be used. */
1717 : #define NOTE_MARKER_P(INSN) \
1718 : (NOTE_P (INSN) && \
1719 : (NOTE_KIND (INSN) == NOTE_INSN_BEGIN_STMT \
1720 : || NOTE_KIND (INSN) == NOTE_INSN_INLINE_ENTRY))
1721 :
1722 : /* Variable declaration and the location of a variable. */
1723 : #define PAT_VAR_LOCATION_DECL(PAT) (XCTREE ((PAT), 0, VAR_LOCATION))
1724 : #define PAT_VAR_LOCATION_LOC(PAT) (XCEXP ((PAT), 1, VAR_LOCATION))
1725 :
1726 : /* Initialization status of the variable in the location. Status
1727 : can be unknown, uninitialized or initialized. See enumeration
1728 : type below. */
1729 : #define PAT_VAR_LOCATION_STATUS(PAT) \
1730 : (RTL_FLAG_CHECK1 ("PAT_VAR_LOCATION_STATUS", PAT, VAR_LOCATION) \
1731 : ->u2.var_location_status)
1732 :
1733 : /* Accessors for a NOTE_INSN_VAR_LOCATION. */
1734 : #define NOTE_VAR_LOCATION_DECL(NOTE) \
1735 : PAT_VAR_LOCATION_DECL (NOTE_VAR_LOCATION (NOTE))
1736 : #define NOTE_VAR_LOCATION_LOC(NOTE) \
1737 : PAT_VAR_LOCATION_LOC (NOTE_VAR_LOCATION (NOTE))
1738 : #define NOTE_VAR_LOCATION_STATUS(NOTE) \
1739 : PAT_VAR_LOCATION_STATUS (NOTE_VAR_LOCATION (NOTE))
1740 :
1741 : /* Evaluate to TRUE if INSN is a debug insn that denotes a variable
1742 : location/value tracking annotation. */
1743 : #define DEBUG_BIND_INSN_P(INSN) \
1744 : (DEBUG_INSN_P (INSN) \
1745 : && (GET_CODE (PATTERN (INSN)) \
1746 : == VAR_LOCATION))
1747 : /* Evaluate to TRUE if INSN is a debug insn that denotes a program
1748 : source location marker. */
1749 : #define DEBUG_MARKER_INSN_P(INSN) \
1750 : (DEBUG_INSN_P (INSN) \
1751 : && (GET_CODE (PATTERN (INSN)) \
1752 : != VAR_LOCATION))
1753 : /* Evaluate to the marker kind. */
1754 : #define INSN_DEBUG_MARKER_KIND(INSN) \
1755 : (GET_CODE (PATTERN (INSN)) == DEBUG_MARKER \
1756 : ? (GET_MODE (PATTERN (INSN)) == VOIDmode \
1757 : ? NOTE_INSN_BEGIN_STMT \
1758 : : GET_MODE (PATTERN (INSN)) == BLKmode \
1759 : ? NOTE_INSN_INLINE_ENTRY \
1760 : : (enum insn_note)-1) \
1761 : : (enum insn_note)-1)
1762 : /* Create patterns for debug markers. These and the above abstract
1763 : the representation, so that it's easier to get rid of the abuse of
1764 : the mode to hold the marker kind. Other marker types are
1765 : envisioned, so a single bit flag won't do; maybe separate RTL codes
1766 : wouldn't be a problem. */
1767 : #define GEN_RTX_DEBUG_MARKER_BEGIN_STMT_PAT() \
1768 : gen_rtx_DEBUG_MARKER (VOIDmode)
1769 : #define GEN_RTX_DEBUG_MARKER_INLINE_ENTRY_PAT() \
1770 : gen_rtx_DEBUG_MARKER (BLKmode)
1771 :
1772 : /* The VAR_LOCATION rtx in a DEBUG_INSN. */
1773 : #define INSN_VAR_LOCATION(INSN) \
1774 : (RTL_FLAG_CHECK1 ("INSN_VAR_LOCATION", PATTERN (INSN), VAR_LOCATION))
1775 : /* A pointer to the VAR_LOCATION rtx in a DEBUG_INSN. */
1776 : #define INSN_VAR_LOCATION_PTR(INSN) \
1777 : (&PATTERN (INSN))
1778 :
1779 : /* Accessors for a tree-expanded var location debug insn. */
1780 : #define INSN_VAR_LOCATION_DECL(INSN) \
1781 : PAT_VAR_LOCATION_DECL (INSN_VAR_LOCATION (INSN))
1782 : #define INSN_VAR_LOCATION_LOC(INSN) \
1783 : PAT_VAR_LOCATION_LOC (INSN_VAR_LOCATION (INSN))
1784 : #define INSN_VAR_LOCATION_STATUS(INSN) \
1785 : PAT_VAR_LOCATION_STATUS (INSN_VAR_LOCATION (INSN))
1786 :
1787 : /* Expand to the RTL that denotes an unknown variable location in a
1788 : DEBUG_INSN. */
1789 : #define gen_rtx_UNKNOWN_VAR_LOC() (gen_rtx_CLOBBER (VOIDmode, const0_rtx))
1790 :
1791 : /* Determine whether X is such an unknown location. */
1792 : #define VAR_LOC_UNKNOWN_P(X) \
1793 : (GET_CODE (X) == CLOBBER && XEXP ((X), 0) == const0_rtx)
1794 :
1795 : /* 1 if RTX is emitted after a call, but it should take effect before
1796 : the call returns. */
1797 : #define NOTE_DURING_CALL_P(RTX) \
1798 : (RTL_FLAG_CHECK1 ("NOTE_VAR_LOCATION_DURING_CALL_P", (RTX), NOTE)->call)
1799 :
1800 : /* DEBUG_EXPR_DECL corresponding to a DEBUG_EXPR RTX. */
1801 : #define DEBUG_EXPR_TREE_DECL(RTX) XCTREE (RTX, 0, DEBUG_EXPR)
1802 :
1803 : /* VAR_DECL/PARM_DECL DEBUG_IMPLICIT_PTR takes address of. */
1804 : #define DEBUG_IMPLICIT_PTR_DECL(RTX) XCTREE (RTX, 0, DEBUG_IMPLICIT_PTR)
1805 :
1806 : /* PARM_DECL DEBUG_PARAMETER_REF references. */
1807 : #define DEBUG_PARAMETER_REF_DECL(RTX) XCTREE (RTX, 0, DEBUG_PARAMETER_REF)
1808 :
1809 : /* Codes that appear in the NOTE_KIND field for kinds of notes
1810 : that are not line numbers. These codes are all negative.
1811 :
1812 : Notice that we do not try to use zero here for any of
1813 : the special note codes because sometimes the source line
1814 : actually can be zero! This happens (for example) when we
1815 : are generating code for the per-translation-unit constructor
1816 : and destructor routines for some C++ translation unit. */
1817 :
1818 : enum insn_note
1819 : {
1820 : #define DEF_INSN_NOTE(NAME) NAME,
1821 : #include "insn-notes.def"
1822 : #undef DEF_INSN_NOTE
1823 :
1824 : NOTE_INSN_MAX
1825 : };
1826 :
1827 : /* Names for NOTE insn's other than line numbers. */
1828 :
1829 : extern const char * const note_insn_name[NOTE_INSN_MAX];
1830 : #define GET_NOTE_INSN_NAME(NOTE_CODE) \
1831 : (note_insn_name[(NOTE_CODE)])
1832 :
1833 : /* The name of a label, in case it corresponds to an explicit label
1834 : in the input source code. */
1835 : #define LABEL_NAME(RTX) XCSTR (RTX, 6, CODE_LABEL)
1836 :
1837 : /* In jump.cc, each label contains a count of the number
1838 : of LABEL_REFs that point at it, so unused labels can be deleted. */
1839 : #define LABEL_NUSES(RTX) XCINT (RTX, 4, CODE_LABEL)
1840 :
1841 : /* Labels carry a two-bit field composed of the ->jump and ->call
1842 : bits. This field indicates whether the label is an alternate
1843 : entry point, and if so, what kind. */
1844 : enum label_kind
1845 : {
1846 : LABEL_NORMAL = 0, /* ordinary label */
1847 : LABEL_STATIC_ENTRY, /* alternate entry point, not exported */
1848 : LABEL_GLOBAL_ENTRY, /* alternate entry point, exported */
1849 : LABEL_WEAK_ENTRY /* alternate entry point, exported as weak symbol */
1850 : };
1851 :
1852 : #if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION > 2007)
1853 :
1854 : /* Retrieve the kind of LABEL. */
1855 : #define LABEL_KIND(LABEL) __extension__ \
1856 : ({ __typeof (LABEL) const _label = (LABEL); \
1857 : if (! LABEL_P (_label)) \
1858 : rtl_check_failed_flag ("LABEL_KIND", _label, __FILE__, __LINE__, \
1859 : __FUNCTION__); \
1860 : (enum label_kind) ((_label->jump << 1) | _label->call); })
1861 :
1862 : /* Set the kind of LABEL. */
1863 : #define SET_LABEL_KIND(LABEL, KIND) do { \
1864 : __typeof (LABEL) const _label = (LABEL); \
1865 : const unsigned int _kind = (KIND); \
1866 : if (! LABEL_P (_label)) \
1867 : rtl_check_failed_flag ("SET_LABEL_KIND", _label, __FILE__, __LINE__, \
1868 : __FUNCTION__); \
1869 : _label->jump = ((_kind >> 1) & 1); \
1870 : _label->call = (_kind & 1); \
1871 : } while (0)
1872 :
1873 : #else
1874 :
1875 : /* Retrieve the kind of LABEL. */
1876 : #define LABEL_KIND(LABEL) \
1877 : ((enum label_kind) (((LABEL)->jump << 1) | (LABEL)->call))
1878 :
1879 : /* Set the kind of LABEL. */
1880 : #define SET_LABEL_KIND(LABEL, KIND) do { \
1881 : rtx const _label = (LABEL); \
1882 : const unsigned int _kind = (KIND); \
1883 : _label->jump = ((_kind >> 1) & 1); \
1884 : _label->call = (_kind & 1); \
1885 : } while (0)
1886 :
1887 : #endif /* rtl flag checking */
1888 :
1889 : #define LABEL_ALT_ENTRY_P(LABEL) (LABEL_KIND (LABEL) != LABEL_NORMAL)
1890 :
1891 : /* In jump.cc, each JUMP_INSN can point to a label that it can jump to,
1892 : so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
1893 : be decremented and possibly the label can be deleted. */
1894 : #define JUMP_LABEL(INSN) XCEXP (INSN, 7, JUMP_INSN)
1895 :
1896 8938543 : inline rtx_insn *JUMP_LABEL_AS_INSN (const rtx_insn *insn)
1897 : {
1898 8938543 : return safe_as_a <rtx_insn *> (JUMP_LABEL (insn));
1899 : }
1900 :
1901 : /* Methods of rtx_jump_insn. */
1902 :
1903 8179315 : inline rtx rtx_jump_insn::jump_label () const
1904 : {
1905 8179315 : return JUMP_LABEL (this);
1906 : }
1907 :
1908 0 : inline rtx_code_label *rtx_jump_insn::jump_target () const
1909 : {
1910 0 : return safe_as_a <rtx_code_label *> (JUMP_LABEL (this));
1911 : }
1912 :
1913 60743 : inline void rtx_jump_insn::set_jump_target (rtx_code_label *target)
1914 : {
1915 60743 : JUMP_LABEL (this) = target;
1916 : }
1917 :
1918 : /* Once basic blocks are found, each CODE_LABEL starts a chain that
1919 : goes through all the LABEL_REFs that jump to that label. The chain
1920 : eventually winds up at the CODE_LABEL: it is circular. */
1921 : #define LABEL_REFS(LABEL) XCEXP (LABEL, 3, CODE_LABEL)
1922 :
1923 : /* Get the label that a LABEL_REF references. */
1924 : inline rtx_insn *
1925 93749514 : label_ref_label (const_rtx ref)
1926 : {
1927 93700372 : return as_a<rtx_insn *> (XCEXP (ref, 0, LABEL_REF));
1928 : }
1929 :
1930 : /* Set the label that LABEL_REF ref refers to. */
1931 :
1932 : inline void
1933 34447020 : set_label_ref_label (rtx ref, rtx_insn *label)
1934 : {
1935 34447020 : XCEXP (ref, 0, LABEL_REF) = label;
1936 : }
1937 :
1938 : /* For a REG rtx, REGNO extracts the register number. REGNO can only
1939 : be used on RHS. Use SET_REGNO to change the value. */
1940 : #define REGNO(RTX) (rhs_regno(RTX))
1941 : #define SET_REGNO(RTX, N) (df_ref_change_reg_with_loc (RTX, N))
1942 :
1943 : /* Return the number of consecutive registers in a REG. This is always
1944 : 1 for pseudo registers and is determined by TARGET_HARD_REGNO_NREGS for
1945 : hard registers. */
1946 : #define REG_NREGS(RTX) (REG_CHECK (RTX)->nregs)
1947 :
1948 : /* ORIGINAL_REGNO holds the number the register originally had; for a
1949 : pseudo register turned into a hard reg this will hold the old pseudo
1950 : register number. */
1951 : #define ORIGINAL_REGNO(RTX) \
1952 : (RTL_FLAG_CHECK1 ("ORIGINAL_REGNO", (RTX), REG)->u2.original_regno)
1953 :
1954 : /* Force the REGNO macro to only be used on the lhs. */
1955 : inline unsigned int
1956 80826790242 : rhs_regno (const_rtx x)
1957 : {
1958 70842527549 : return REG_CHECK (x)->regno;
1959 : }
1960 :
1961 : /* Return the final register in REG X plus one. */
1962 : inline unsigned int
1963 14464907173 : END_REGNO (const_rtx x)
1964 : {
1965 14463974619 : return REGNO (x) + REG_NREGS (x);
1966 : }
1967 :
1968 : /* Change the REGNO and REG_NREGS of REG X to the specified values,
1969 : bypassing the df machinery. */
1970 : inline void
1971 1763583848 : set_regno_raw (rtx x, unsigned int regno, unsigned int nregs)
1972 : {
1973 1763583848 : reg_info *reg = REG_CHECK (x);
1974 1763583848 : reg->regno = regno;
1975 1763583848 : reg->nregs = nregs;
1976 : }
1977 :
1978 : /* 1 if RTX is a reg or parallel that is the current function's return
1979 : value. */
1980 : #define REG_FUNCTION_VALUE_P(RTX) \
1981 : (RTL_FLAG_CHECK2 ("REG_FUNCTION_VALUE_P", (RTX), REG, PARALLEL)->return_val)
1982 :
1983 : /* 1 if RTX is a reg that corresponds to a variable declared by the user. */
1984 : #define REG_USERVAR_P(RTX) \
1985 : (RTL_FLAG_CHECK1 ("REG_USERVAR_P", (RTX), REG)->volatil)
1986 :
1987 : /* 1 if RTX is a reg that holds a pointer value. */
1988 : #define REG_POINTER(RTX) \
1989 : (RTL_FLAG_CHECK1 ("REG_POINTER", (RTX), REG)->frame_related)
1990 :
1991 : /* 1 if RTX is a mem that holds a pointer value. */
1992 : #define MEM_POINTER(RTX) \
1993 : (RTL_FLAG_CHECK1 ("MEM_POINTER", (RTX), MEM)->frame_related)
1994 :
1995 : /* 1 if the given register REG corresponds to a hard register. */
1996 : #define HARD_REGISTER_P(REG) HARD_REGISTER_NUM_P (REGNO (REG))
1997 :
1998 : /* 1 if the given register number REG_NO corresponds to a hard register. */
1999 : #define HARD_REGISTER_NUM_P(REG_NO) ((REG_NO) < FIRST_PSEUDO_REGISTER)
2000 :
2001 : /* 1 if the given register REG corresponds to a virtual register. */
2002 : #define VIRTUAL_REGISTER_P(REG) VIRTUAL_REGISTER_NUM_P (REGNO (REG))
2003 :
2004 : /* 1 if the given register number REG_NO corresponds to a virtual register. */
2005 : #define VIRTUAL_REGISTER_NUM_P(REG_NO) \
2006 : IN_RANGE (REG_NO, FIRST_VIRTUAL_REGISTER, LAST_VIRTUAL_REGISTER)
2007 :
2008 : /* For a CONST_INT rtx, INTVAL extracts the integer. */
2009 : #define INTVAL(RTX) XCWINT (RTX, 0, CONST_INT)
2010 : #define UINTVAL(RTX) ((unsigned HOST_WIDE_INT) INTVAL (RTX))
2011 :
2012 : /* For a CONST_WIDE_INT, CONST_WIDE_INT_NUNITS is the number of
2013 : elements actually needed to represent the constant.
2014 : CONST_WIDE_INT_ELT gets one of the elements. 0 is the least
2015 : significant HOST_WIDE_INT. */
2016 : #define CONST_WIDE_INT_VEC(RTX) HWIVEC_CHECK (RTX, CONST_WIDE_INT)
2017 : #define CONST_WIDE_INT_NUNITS(RTX) CWI_GET_NUM_ELEM (RTX)
2018 : #define CONST_WIDE_INT_ELT(RTX, N) CWI_ELT (RTX, N)
2019 :
2020 : /* For a CONST_POLY_INT, CONST_POLY_INT_COEFFS gives access to the
2021 : individual coefficients, in the form of a trailing_wide_ints structure. */
2022 : #define CONST_POLY_INT_COEFFS(RTX) \
2023 : (RTL_FLAG_CHECK1("CONST_POLY_INT_COEFFS", (RTX), \
2024 : CONST_POLY_INT)->u.cpi.coeffs)
2025 :
2026 : /* For a CONST_DOUBLE:
2027 : #if TARGET_SUPPORTS_WIDE_INT == 0
2028 : For a VOIDmode, there are two integers CONST_DOUBLE_LOW is the
2029 : low-order word and ..._HIGH the high-order.
2030 : #endif
2031 : For a float, there is a REAL_VALUE_TYPE structure, and
2032 : CONST_DOUBLE_REAL_VALUE(r) is a pointer to it. */
2033 : #define CONST_DOUBLE_LOW(r) XCMWINT (r, 0, CONST_DOUBLE, VOIDmode)
2034 : #define CONST_DOUBLE_HIGH(r) XCMWINT (r, 1, CONST_DOUBLE, VOIDmode)
2035 : #define CONST_DOUBLE_REAL_VALUE(r) \
2036 : ((const struct real_value *) XCNMPRV (r, CONST_DOUBLE, VOIDmode))
2037 :
2038 : #define CONST_FIXED_VALUE(r) \
2039 : ((const struct fixed_value *) XCNMPFV (r, CONST_FIXED, VOIDmode))
2040 : #define CONST_FIXED_VALUE_HIGH(r) \
2041 : ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.high))
2042 : #define CONST_FIXED_VALUE_LOW(r) \
2043 : ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.low))
2044 :
2045 : /* For a CONST_VECTOR, return element #n. */
2046 : #define CONST_VECTOR_ELT(RTX, N) const_vector_elt (RTX, N)
2047 :
2048 : /* See rtl.texi for a description of these macros. */
2049 : #define CONST_VECTOR_NPATTERNS(RTX) \
2050 : (RTL_FLAG_CHECK1 ("CONST_VECTOR_NPATTERNS", (RTX), CONST_VECTOR) \
2051 : ->u2.const_vector.npatterns)
2052 :
2053 : #define CONST_VECTOR_NELTS_PER_PATTERN(RTX) \
2054 : (RTL_FLAG_CHECK1 ("CONST_VECTOR_NELTS_PER_PATTERN", (RTX), CONST_VECTOR) \
2055 : ->u2.const_vector.nelts_per_pattern)
2056 :
2057 : #define CONST_VECTOR_DUPLICATE_P(RTX) \
2058 : (CONST_VECTOR_NELTS_PER_PATTERN (RTX) == 1)
2059 :
2060 : #define CONST_VECTOR_STEPPED_P(RTX) \
2061 : (CONST_VECTOR_NELTS_PER_PATTERN (RTX) == 3)
2062 :
2063 : #define CONST_VECTOR_ENCODED_ELT(RTX, N) XCVECEXP (RTX, 0, N, CONST_VECTOR)
2064 :
2065 : /* Return the number of elements encoded directly in a CONST_VECTOR. */
2066 :
2067 : inline unsigned int
2068 8775739 : const_vector_encoded_nelts (const_rtx x)
2069 : {
2070 8775739 : return CONST_VECTOR_NPATTERNS (x) * CONST_VECTOR_NELTS_PER_PATTERN (x);
2071 : }
2072 :
2073 : /* For a CONST_VECTOR, return the number of elements in a vector. */
2074 : #define CONST_VECTOR_NUNITS(RTX) GET_MODE_NUNITS (GET_MODE (RTX))
2075 :
2076 : /* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of.
2077 : SUBREG_BYTE extracts the byte-number. */
2078 :
2079 : #define SUBREG_REG(RTX) XCEXP (RTX, 0, SUBREG)
2080 : #define SUBREG_BYTE(RTX) XCSUBREG (RTX, 1, SUBREG)
2081 :
2082 : /* in rtlanal.cc */
2083 : /* Return the right cost to give to an operation
2084 : to make the cost of the corresponding register-to-register instruction
2085 : N times that of a fast register-to-register instruction. */
2086 : #define COSTS_N_INSNS(N) ((N) * 4)
2087 :
2088 : /* Maximum cost of an rtl expression. This value has the special meaning
2089 : not to use an rtx with this cost under any circumstances. */
2090 : #define MAX_COST INT_MAX
2091 :
2092 : /* Return true if CODE always has VOIDmode. */
2093 :
2094 : inline bool
2095 59539470 : always_void_p (enum rtx_code code)
2096 : {
2097 59539470 : switch (code)
2098 : {
2099 : case SET:
2100 : case PC:
2101 : case RETURN:
2102 : case SIMPLE_RETURN:
2103 : return true;
2104 :
2105 35052296 : default:
2106 35052296 : return false;
2107 : }
2108 : }
2109 :
2110 : /* A structure to hold all available cost information about an rtl
2111 : expression. */
2112 : struct full_rtx_costs
2113 : {
2114 : int speed;
2115 : int size;
2116 : };
2117 :
2118 : /* Initialize a full_rtx_costs structure C to the maximum cost. */
2119 : inline void
2120 1960607 : init_costs_to_max (struct full_rtx_costs *c)
2121 : {
2122 1960607 : c->speed = MAX_COST;
2123 1960607 : c->size = MAX_COST;
2124 : }
2125 :
2126 : /* Initialize a full_rtx_costs structure C to zero cost. */
2127 : inline void
2128 6 : init_costs_to_zero (struct full_rtx_costs *c)
2129 : {
2130 6 : c->speed = 0;
2131 6 : c->size = 0;
2132 : }
2133 :
2134 : /* Compare two full_rtx_costs structures A and B, returning true
2135 : if A < B when optimizing for speed. */
2136 : inline bool
2137 2212078 : costs_lt_p (struct full_rtx_costs *a, struct full_rtx_costs *b,
2138 : bool speed)
2139 : {
2140 2212078 : if (speed)
2141 1455433 : return (a->speed < b->speed
2142 1455433 : || (a->speed == b->speed && a->size < b->size));
2143 : else
2144 756645 : return (a->size < b->size
2145 756645 : || (a->size == b->size && a->speed < b->speed));
2146 : }
2147 :
2148 : /* Increase both members of the full_rtx_costs structure C by the
2149 : cost of N insns. */
2150 : inline void
2151 378 : costs_add_n_insns (struct full_rtx_costs *c, int n)
2152 : {
2153 378 : c->speed += COSTS_N_INSNS (n);
2154 378 : c->size += COSTS_N_INSNS (n);
2155 : }
2156 :
2157 : /* Describes the shape of a subreg:
2158 :
2159 : inner_mode == the mode of the SUBREG_REG
2160 : offset == the SUBREG_BYTE
2161 : outer_mode == the mode of the SUBREG itself. */
2162 : class subreg_shape {
2163 : public:
2164 : subreg_shape (machine_mode, poly_uint16, machine_mode);
2165 : bool operator == (const subreg_shape &) const;
2166 : bool operator != (const subreg_shape &) const;
2167 : unsigned HOST_WIDE_INT unique_id () const;
2168 :
2169 : machine_mode inner_mode;
2170 : poly_uint16 offset;
2171 : machine_mode outer_mode;
2172 : };
2173 :
2174 : inline
2175 3448408 : subreg_shape::subreg_shape (machine_mode inner_mode_in,
2176 : poly_uint16 offset_in,
2177 : machine_mode outer_mode_in)
2178 : : inner_mode (inner_mode_in), offset (offset_in), outer_mode (outer_mode_in)
2179 : {}
2180 :
2181 : inline bool
2182 11056708 : subreg_shape::operator == (const subreg_shape &other) const
2183 : {
2184 11056708 : return (inner_mode == other.inner_mode
2185 4141085 : && known_eq (offset, other.offset)
2186 14773227 : && outer_mode == other.outer_mode);
2187 : }
2188 :
2189 : inline bool
2190 : subreg_shape::operator != (const subreg_shape &other) const
2191 : {
2192 : return !operator == (other);
2193 : }
2194 :
2195 : /* Return an integer that uniquely identifies this shape. Structures
2196 : like rtx_def assume that a mode can fit in an 8-bit bitfield and no
2197 : current mode is anywhere near being 65536 bytes in size, so the
2198 : id comfortably fits in an int. */
2199 :
2200 : inline unsigned HOST_WIDE_INT
2201 11696863 : subreg_shape::unique_id () const
2202 : {
2203 11696863 : { STATIC_ASSERT (MAX_MACHINE_MODE <= (1 << MACHINE_MODE_BITSIZE)); }
2204 11696863 : { STATIC_ASSERT (NUM_POLY_INT_COEFFS <= 3); }
2205 11696863 : { STATIC_ASSERT (sizeof (offset.coeffs[0]) <= 2); }
2206 11696863 : int res = (int) inner_mode + ((int) outer_mode << 8);
2207 11696863 : for (int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
2208 11696863 : res += (HOST_WIDE_INT) offset.coeffs[i] << ((1 + i) * 16);
2209 3448408 : return res;
2210 : }
2211 :
2212 : /* Return the shape of a SUBREG rtx. */
2213 :
2214 : inline subreg_shape
2215 3448408 : shape_of_subreg (const_rtx x)
2216 : {
2217 3448408 : return subreg_shape (GET_MODE (SUBREG_REG (x)),
2218 3448408 : SUBREG_BYTE (x), GET_MODE (x));
2219 : }
2220 :
2221 : /* Information about an address. This structure is supposed to be able
2222 : to represent all supported target addresses. Please extend it if it
2223 : is not yet general enough. */
2224 : struct address_info {
2225 : /* The mode of the value being addressed, or VOIDmode if this is
2226 : a load-address operation with no known address mode. */
2227 : machine_mode mode;
2228 :
2229 : /* The address space. */
2230 : addr_space_t as;
2231 :
2232 : /* True if this is an RTX_AUTOINC address. */
2233 : bool autoinc_p;
2234 :
2235 : /* The MEM whose address this is, or null if this describes an address
2236 : operand with no enclosing MEM (an ADDRESS rather than a MEM address). */
2237 : rtx mem;
2238 :
2239 : /* A pointer to the top-level address. */
2240 : rtx *outer;
2241 :
2242 : /* A pointer to the inner address, after all address mutations
2243 : have been stripped from the top-level address. It can be one
2244 : of the following:
2245 :
2246 : - A {PRE,POST}_{INC,DEC} of *BASE. SEGMENT, INDEX and DISP are null.
2247 :
2248 : - A {PRE,POST}_MODIFY of *BASE. In this case either INDEX or DISP
2249 : points to the step value, depending on whether the step is variable
2250 : or constant respectively. SEGMENT is null.
2251 :
2252 : - A plain sum of the form SEGMENT + BASE + INDEX + DISP,
2253 : with null fields evaluating to 0. */
2254 : rtx *inner;
2255 :
2256 : /* Components that make up *INNER. Each one may be null or nonnull.
2257 : When nonnull, their meanings are as follows:
2258 :
2259 : - *SEGMENT is the "segment" of memory to which the address refers.
2260 : This value is entirely target-specific and is only called a "segment"
2261 : because that's its most typical use. It contains exactly one UNSPEC,
2262 : pointed to by SEGMENT_TERM. The contents of *SEGMENT do not need
2263 : reloading.
2264 :
2265 : - *BASE is a variable expression representing a base address.
2266 : It contains exactly one "term", pointed to by BASE_TERM.
2267 : This term can be one of the following:
2268 :
2269 : (1) a REG, or a SUBREG of a REG
2270 : (2) an eliminated REG (a PLUS of (1) and a constant)
2271 : (3) a MEM, or a SUBREG of a MEM
2272 : (4) a SCRATCH
2273 :
2274 : This term is the one that base_reg_class constrains.
2275 :
2276 : - *INDEX is a variable expression representing an index value.
2277 : It may be a scaled expression, such as a MULT. It has exactly
2278 : one "term", pointed to by INDEX_TERM. The possible terms are
2279 : the same as for BASE. This term is the one that index_reg_class
2280 : constrains.
2281 :
2282 : - *DISP is a constant, possibly mutated. DISP_TERM points to the
2283 : unmutated RTX_CONST_OBJ. */
2284 : rtx *segment;
2285 : rtx *base;
2286 : rtx *index;
2287 : rtx *disp;
2288 :
2289 : rtx *segment_term;
2290 : rtx *base_term;
2291 : rtx *index_term;
2292 : rtx *disp_term;
2293 :
2294 : /* In a {PRE,POST}_MODIFY address, this points to a second copy
2295 : of BASE_TERM, otherwise it is null. */
2296 : rtx *base_term2;
2297 :
2298 : /* ADDRESS if this structure describes an address operand, MEM if
2299 : it describes a MEM address. */
2300 : enum rtx_code addr_outer_code;
2301 :
2302 : /* If BASE is nonnull, this is the code of the rtx that contains it. */
2303 : enum rtx_code base_outer_code;
2304 : };
2305 :
2306 : /* This is used to bundle an rtx and a mode together so that the pair
2307 : can be used with the wi:: routines. If we ever put modes into rtx
2308 : integer constants, this should go away and then just pass an rtx in. */
2309 : typedef std::pair <rtx, machine_mode> rtx_mode_t;
2310 :
2311 : namespace wi
2312 : {
2313 : template <>
2314 : struct int_traits <rtx_mode_t>
2315 : {
2316 : static const enum precision_type precision_type = VAR_PRECISION;
2317 : static const bool host_dependent_precision = false;
2318 : /* This ought to be true, except for the special case that BImode
2319 : is canonicalized to STORE_FLAG_VALUE, which might be 1. */
2320 : static const bool is_sign_extended = false;
2321 : static const bool needs_write_val_arg = false;
2322 : static unsigned int get_precision (const rtx_mode_t &);
2323 : static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int,
2324 : const rtx_mode_t &);
2325 : };
2326 : }
2327 :
2328 : inline unsigned int
2329 1288919297 : wi::int_traits <rtx_mode_t>::get_precision (const rtx_mode_t &x)
2330 : {
2331 1288919297 : return GET_MODE_PRECISION (as_a <scalar_mode> (x.second));
2332 : }
2333 :
2334 : inline wi::storage_ref
2335 658102558 : wi::int_traits <rtx_mode_t>::decompose (HOST_WIDE_INT *,
2336 : unsigned int precision,
2337 : const rtx_mode_t &x)
2338 : {
2339 658102558 : gcc_checking_assert (precision == get_precision (x));
2340 658102558 : switch (GET_CODE (x.first))
2341 : {
2342 657405214 : case CONST_INT:
2343 657405214 : if (precision < HOST_BITS_PER_WIDE_INT)
2344 : /* Nonzero BImodes are stored as STORE_FLAG_VALUE, which on many
2345 : targets is 1 rather than -1. */
2346 205243476 : gcc_checking_assert (INTVAL (x.first)
2347 : == sext_hwi (INTVAL (x.first), precision)
2348 : || (x.second == BImode && INTVAL (x.first) == 1));
2349 :
2350 657405214 : return wi::storage_ref (&INTVAL (x.first), 1, precision);
2351 :
2352 697344 : case CONST_WIDE_INT:
2353 697344 : return wi::storage_ref (&CONST_WIDE_INT_ELT (x.first, 0),
2354 697344 : CONST_WIDE_INT_NUNITS (x.first), precision);
2355 :
2356 : #if TARGET_SUPPORTS_WIDE_INT == 0
2357 : case CONST_DOUBLE:
2358 : return wi::storage_ref (&CONST_DOUBLE_LOW (x.first), 2, precision);
2359 : #endif
2360 :
2361 0 : default:
2362 0 : gcc_unreachable ();
2363 : }
2364 : }
2365 :
2366 : namespace wi
2367 : {
2368 : hwi_with_prec shwi (HOST_WIDE_INT, machine_mode mode);
2369 : wide_int min_value (machine_mode, signop);
2370 : wide_int max_value (machine_mode, signop);
2371 : }
2372 :
2373 : inline wi::hwi_with_prec
2374 287650 : wi::shwi (HOST_WIDE_INT val, machine_mode mode)
2375 : {
2376 287650 : return shwi (val, GET_MODE_PRECISION (as_a <scalar_mode> (mode)));
2377 : }
2378 :
2379 : /* Produce the smallest number that is represented in MODE. The precision
2380 : is taken from MODE and the sign from SGN. */
2381 : inline wide_int
2382 100164 : wi::min_value (machine_mode mode, signop sgn)
2383 : {
2384 100164 : return min_value (GET_MODE_PRECISION (as_a <scalar_mode> (mode)), sgn);
2385 : }
2386 :
2387 : /* Produce the largest number that is represented in MODE. The precision
2388 : is taken from MODE and the sign from SGN. */
2389 : inline wide_int
2390 53673 : wi::max_value (machine_mode mode, signop sgn)
2391 : {
2392 53673 : return max_value (GET_MODE_PRECISION (as_a <scalar_mode> (mode)), sgn);
2393 : }
2394 :
2395 : namespace wi
2396 : {
2397 : typedef poly_int<NUM_POLY_INT_COEFFS,
2398 : generic_wide_int <wide_int_ref_storage <false, false> > >
2399 : rtx_to_poly_wide_ref;
2400 : rtx_to_poly_wide_ref to_poly_wide (const_rtx, machine_mode);
2401 : }
2402 :
2403 : /* Return the value of a CONST_POLY_INT in its native precision. */
2404 :
2405 : inline wi::rtx_to_poly_wide_ref
2406 0 : const_poly_int_value (const_rtx x)
2407 : {
2408 0 : poly_int<NUM_POLY_INT_COEFFS, WIDE_INT_REF_FOR (wide_int)> res;
2409 0 : for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
2410 0 : res.coeffs[i] = CONST_POLY_INT_COEFFS (x)[i];
2411 0 : return res;
2412 : }
2413 :
2414 : /* Return true if X is a scalar integer or a CONST_POLY_INT. The value
2415 : can then be extracted using wi::to_poly_wide. */
2416 :
2417 : inline bool
2418 105853941 : poly_int_rtx_p (const_rtx x)
2419 : {
2420 105853941 : return CONST_SCALAR_INT_P (x) || CONST_POLY_INT_P (x);
2421 : }
2422 :
2423 : /* Access X (which satisfies poly_int_rtx_p) as a poly_wide_int.
2424 : MODE is the mode of X. */
2425 :
2426 : inline wi::rtx_to_poly_wide_ref
2427 10377986 : wi::to_poly_wide (const_rtx x, machine_mode mode)
2428 : {
2429 10377986 : if (CONST_POLY_INT_P (x))
2430 : return const_poly_int_value (x);
2431 10377986 : return rtx_mode_t (const_cast<rtx> (x), mode);
2432 : }
2433 :
2434 : /* Return the value of X as a poly_int64. */
2435 :
2436 : inline poly_int64
2437 8875430 : rtx_to_poly_int64 (const_rtx x)
2438 : {
2439 8875430 : if (CONST_POLY_INT_P (x))
2440 : {
2441 : poly_int64 res;
2442 : for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
2443 : res.coeffs[i] = CONST_POLY_INT_COEFFS (x)[i].to_shwi ();
2444 : return res;
2445 : }
2446 8875430 : return INTVAL (x);
2447 : }
2448 :
2449 : /* Return true if arbitrary value X is an integer constant that can
2450 : be represented as a poly_int64. Store the value in *RES if so,
2451 : otherwise leave it unmodified. */
2452 :
2453 : inline bool
2454 3635364177 : poly_int_rtx_p (const_rtx x, poly_int64 *res)
2455 : {
2456 2924307732 : if (CONST_INT_P (x))
2457 : {
2458 2636610900 : *res = INTVAL (x);
2459 2636610900 : return true;
2460 : }
2461 : if (CONST_POLY_INT_P (x))
2462 : {
2463 : for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
2464 : if (!wi::fits_shwi_p (CONST_POLY_INT_COEFFS (x)[i]))
2465 : return false;
2466 : for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
2467 : res->coeffs[i] = CONST_POLY_INT_COEFFS (x)[i].to_shwi ();
2468 : return true;
2469 : }
2470 : return false;
2471 : }
2472 :
2473 : extern void init_rtlanal (void);
2474 : extern int rtx_cost (rtx, machine_mode, enum rtx_code, int, bool);
2475 : extern int address_cost (rtx, machine_mode, addr_space_t, bool);
2476 : extern void get_full_rtx_cost (rtx, machine_mode, enum rtx_code, int,
2477 : struct full_rtx_costs *);
2478 : extern bool native_encode_rtx (machine_mode, rtx, vec<target_unit> &,
2479 : unsigned int, unsigned int);
2480 : extern wide_int native_decode_int (const vec<target_unit> &, unsigned int,
2481 : unsigned int, unsigned int);
2482 : extern rtx native_decode_rtx (machine_mode, const vec<target_unit> &,
2483 : unsigned int);
2484 : extern rtx native_decode_vector_rtx (machine_mode, const vec<target_unit> &,
2485 : unsigned int, unsigned int, unsigned int);
2486 : extern poly_uint64 subreg_lsb (const_rtx);
2487 : extern poly_uint64 subreg_size_lsb (poly_uint64, poly_uint64, poly_uint64);
2488 : extern poly_uint64 subreg_size_offset_from_lsb (poly_uint64, poly_uint64,
2489 : poly_uint64);
2490 : extern bool read_modify_subreg_p (const_rtx);
2491 :
2492 : /* Given a subreg's OUTER_MODE, INNER_MODE, and SUBREG_BYTE, return the
2493 : bit offset at which the subreg begins (counting from the least significant
2494 : bit of the operand). */
2495 :
2496 : inline poly_uint64
2497 3289087 : subreg_lsb_1 (machine_mode outer_mode, machine_mode inner_mode,
2498 : poly_uint64 subreg_byte)
2499 : {
2500 6578174 : return subreg_size_lsb (GET_MODE_SIZE (outer_mode),
2501 3289087 : GET_MODE_SIZE (inner_mode), subreg_byte);
2502 : }
2503 :
2504 : /* Return the subreg byte offset for a subreg whose outer mode is
2505 : OUTER_MODE, whose inner mode is INNER_MODE, and where there are
2506 : LSB_SHIFT *bits* between the lsb of the outer value and the lsb of
2507 : the inner value. This is the inverse of subreg_lsb_1 (which converts
2508 : byte offsets to bit shifts). */
2509 :
2510 : inline poly_uint64
2511 3114 : subreg_offset_from_lsb (machine_mode outer_mode,
2512 : machine_mode inner_mode,
2513 : poly_uint64 lsb_shift)
2514 : {
2515 6228 : return subreg_size_offset_from_lsb (GET_MODE_SIZE (outer_mode),
2516 3114 : GET_MODE_SIZE (inner_mode), lsb_shift);
2517 : }
2518 :
2519 : extern unsigned int subreg_regno_offset (unsigned int, machine_mode,
2520 : poly_uint64, machine_mode);
2521 : extern bool subreg_offset_representable_p (unsigned int, machine_mode,
2522 : poly_uint64, machine_mode);
2523 : extern unsigned int subreg_regno (const_rtx);
2524 : extern int simplify_subreg_regno (unsigned int, machine_mode,
2525 : poly_uint64, machine_mode,
2526 : bool allow_stack_regs = false);
2527 : extern int lowpart_subreg_regno (unsigned int, machine_mode,
2528 : machine_mode);
2529 : extern unsigned int subreg_nregs (const_rtx);
2530 : extern unsigned int subreg_nregs_with_regno (unsigned int, const_rtx);
2531 : extern unsigned HOST_WIDE_INT nonzero_bits (const_rtx, machine_mode);
2532 : extern unsigned int num_sign_bit_copies (const_rtx, machine_mode);
2533 : extern bool constant_pool_constant_p (rtx);
2534 : extern bool truncated_to_mode (machine_mode, const_rtx);
2535 : extern int low_bitmask_len (machine_mode, unsigned HOST_WIDE_INT);
2536 : extern void split_double (rtx, rtx *, rtx *);
2537 : extern rtx *strip_address_mutations (rtx *, enum rtx_code * = 0);
2538 : extern void decompose_address (struct address_info *, rtx *,
2539 : machine_mode, addr_space_t, enum rtx_code);
2540 : extern void decompose_lea_address (struct address_info *, rtx *);
2541 : extern void decompose_mem_address (struct address_info *, rtx);
2542 : extern void update_address (struct address_info *);
2543 : extern HOST_WIDE_INT get_index_scale (const struct address_info *);
2544 : extern enum rtx_code get_index_code (const struct address_info *);
2545 :
2546 : /* 1 if RTX is a subreg containing a reg that is already known to be
2547 : sign- or zero-extended from the mode of the subreg to the mode of
2548 : the reg. SUBREG_PROMOTED_UNSIGNED_P gives the signedness of the
2549 : extension.
2550 :
2551 : When used as a LHS, is means that this extension must be done
2552 : when assigning to SUBREG_REG. */
2553 :
2554 : #define SUBREG_PROMOTED_VAR_P(RTX) \
2555 : (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED", (RTX), SUBREG)->in_struct)
2556 :
2557 : /* Valid for subregs which are SUBREG_PROMOTED_VAR_P(). In that case
2558 : this gives the necessary extensions:
2559 : 0 - signed (SPR_SIGNED)
2560 : 1 - normal unsigned (SPR_UNSIGNED)
2561 : 2 - value is both sign and unsign extended for mode
2562 : (SPR_SIGNED_AND_UNSIGNED).
2563 : -1 - pointer unsigned, which most often can be handled like unsigned
2564 : extension, except for generating instructions where we need to
2565 : emit special code (ptr_extend insns) on some architectures
2566 : (SPR_POINTER). */
2567 :
2568 : const int SRP_POINTER = -1;
2569 : const int SRP_SIGNED = 0;
2570 : const int SRP_UNSIGNED = 1;
2571 : const int SRP_SIGNED_AND_UNSIGNED = 2;
2572 :
2573 : /* Sets promoted mode for SUBREG_PROMOTED_VAR_P(). */
2574 : #define SUBREG_PROMOTED_SET(RTX, VAL) \
2575 : do { \
2576 : rtx const _rtx = RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SET", \
2577 : (RTX), SUBREG); \
2578 : switch (VAL) \
2579 : { \
2580 : case SRP_POINTER: \
2581 : _rtx->volatil = 0; \
2582 : _rtx->unchanging = 0; \
2583 : break; \
2584 : case SRP_SIGNED: \
2585 : _rtx->volatil = 0; \
2586 : _rtx->unchanging = 1; \
2587 : break; \
2588 : case SRP_UNSIGNED: \
2589 : _rtx->volatil = 1; \
2590 : _rtx->unchanging = 0; \
2591 : break; \
2592 : case SRP_SIGNED_AND_UNSIGNED: \
2593 : _rtx->volatil = 1; \
2594 : _rtx->unchanging = 1; \
2595 : break; \
2596 : } \
2597 : } while (0)
2598 :
2599 : /* Gets the value stored in promoted mode for SUBREG_PROMOTED_VAR_P(),
2600 : including SRP_SIGNED_AND_UNSIGNED if promoted for
2601 : both signed and unsigned. */
2602 : #define SUBREG_PROMOTED_GET(RTX) \
2603 : (2 * (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_GET", (RTX), SUBREG)->volatil)\
2604 : + (RTX)->unchanging - 1)
2605 :
2606 : /* Returns sign of promoted mode for SUBREG_PROMOTED_VAR_P(). */
2607 : #define SUBREG_PROMOTED_SIGN(RTX) \
2608 : ((RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SIGN", (RTX), SUBREG)->volatil) ? 1\
2609 : : (RTX)->unchanging - 1)
2610 :
2611 : /* Predicate to check if RTX of SUBREG_PROMOTED_VAR_P() is promoted
2612 : for SIGNED type. */
2613 : #define SUBREG_PROMOTED_SIGNED_P(RTX) \
2614 : (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SIGNED_P", (RTX), SUBREG)->unchanging)
2615 :
2616 : /* Predicate to check if RTX of SUBREG_PROMOTED_VAR_P() is promoted
2617 : for UNSIGNED type. */
2618 : #define SUBREG_PROMOTED_UNSIGNED_P(RTX) \
2619 : (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_P", (RTX), SUBREG)->volatil)
2620 :
2621 : /* Checks if RTX of SUBREG_PROMOTED_VAR_P() is promoted for given SIGN. */
2622 : #define SUBREG_CHECK_PROMOTED_SIGN(RTX, SIGN) \
2623 : ((SIGN) == SRP_POINTER ? SUBREG_PROMOTED_GET (RTX) == SRP_POINTER \
2624 : : (SIGN) == SRP_SIGNED ? SUBREG_PROMOTED_SIGNED_P (RTX) \
2625 : : SUBREG_PROMOTED_UNSIGNED_P (RTX))
2626 :
2627 : /* True if the REG is the static chain register for some CALL_INSN. */
2628 : #define STATIC_CHAIN_REG_P(RTX) \
2629 : (RTL_FLAG_CHECK1 ("STATIC_CHAIN_REG_P", (RTX), REG)->jump)
2630 :
2631 : /* True if the subreg was generated by LRA for reload insns. Such
2632 : subregs are valid only during LRA. */
2633 : #define LRA_SUBREG_P(RTX) \
2634 : (RTL_FLAG_CHECK1 ("LRA_SUBREG_P", (RTX), SUBREG)->jump)
2635 :
2636 : /* Access various components of an ASM_OPERANDS rtx. */
2637 :
2638 : #define ASM_OPERANDS_TEMPLATE(RTX) XCSTR (RTX, 0, ASM_OPERANDS)
2639 : #define ASM_OPERANDS_OUTPUT_CONSTRAINT(RTX) XCSTR (RTX, 1, ASM_OPERANDS)
2640 : #define ASM_OPERANDS_OUTPUT_IDX(RTX) XCINT (RTX, 2, ASM_OPERANDS)
2641 : #define ASM_OPERANDS_INPUT_VEC(RTX) XCVEC (RTX, 3, ASM_OPERANDS)
2642 : #define ASM_OPERANDS_INPUT_CONSTRAINT_VEC(RTX) XCVEC (RTX, 4, ASM_OPERANDS)
2643 : #define ASM_OPERANDS_INPUT(RTX, N) XCVECEXP (RTX, 3, N, ASM_OPERANDS)
2644 : #define ASM_OPERANDS_INPUT_LENGTH(RTX) XCVECLEN (RTX, 3, ASM_OPERANDS)
2645 : #define ASM_OPERANDS_INPUT_CONSTRAINT_EXP(RTX, N) \
2646 : XCVECEXP (RTX, 4, N, ASM_OPERANDS)
2647 : #define ASM_OPERANDS_INPUT_CONSTRAINT(RTX, N) \
2648 : XSTR (XCVECEXP (RTX, 4, N, ASM_OPERANDS), 0)
2649 : #define ASM_OPERANDS_INPUT_MODE(RTX, N) \
2650 : GET_MODE (XCVECEXP (RTX, 4, N, ASM_OPERANDS))
2651 : #define ASM_OPERANDS_LABEL_VEC(RTX) XCVEC (RTX, 5, ASM_OPERANDS)
2652 : #define ASM_OPERANDS_LABEL_LENGTH(RTX) XCVECLEN (RTX, 5, ASM_OPERANDS)
2653 : #define ASM_OPERANDS_LABEL(RTX, N) XCVECEXP (RTX, 5, N, ASM_OPERANDS)
2654 : #define ASM_OPERANDS_SOURCE_LOCATION(RTX) XCLOC (RTX, 6, ASM_OPERANDS)
2655 : #define ASM_INPUT_SOURCE_LOCATION(RTX) XCLOC (RTX, 1, ASM_INPUT)
2656 :
2657 : /* 1 if RTX is a mem that is statically allocated in read-only memory. */
2658 : #define MEM_READONLY_P(RTX) \
2659 : (RTL_FLAG_CHECK1 ("MEM_READONLY_P", (RTX), MEM)->unchanging)
2660 :
2661 : /* 1 if RTX is a mem whose address vector elements all point to
2662 : independent memory locations, without overlapping each other. */
2663 : #define MEM_INDEPENDENT_P(RTX) \
2664 : (RTL_FLAG_CHECK1 ("MEM_INDEPENDENT_P", (RTX), MEM)->return_val)
2665 :
2666 : /* 1 if RTX is a mem and we should keep the alias set for this mem
2667 : unchanged when we access a component. Set to 1, or example, when we
2668 : are already in a non-addressable component of an aggregate. */
2669 : #define MEM_KEEP_ALIAS_SET_P(RTX) \
2670 : (RTL_FLAG_CHECK1 ("MEM_KEEP_ALIAS_SET_P", (RTX), MEM)->jump)
2671 :
2672 : /* 1 if RTX is a mem or asm_operand for a volatile reference. */
2673 : #define MEM_VOLATILE_P(RTX) \
2674 : (RTL_FLAG_CHECK3 ("MEM_VOLATILE_P", (RTX), MEM, ASM_OPERANDS, \
2675 : ASM_INPUT)->volatil)
2676 :
2677 : /* 1 if RTX is a mem that cannot trap. */
2678 : #define MEM_NOTRAP_P(RTX) \
2679 : (RTL_FLAG_CHECK1 ("MEM_NOTRAP_P", (RTX), MEM)->call)
2680 :
2681 : /* The memory attribute block. We provide access macros for each value
2682 : in the block and provide defaults if none specified. */
2683 : #define MEM_ATTRS(RTX) X0MEMATTR (RTX, 1)
2684 :
2685 : /* The register attribute block. We provide access macros for each value
2686 : in the block and provide defaults if none specified. */
2687 : #define REG_ATTRS(RTX) (REG_CHECK (RTX)->attrs)
2688 :
2689 : #ifndef GENERATOR_FILE
2690 : /* For a MEM rtx, the alias set. If 0, this MEM is not in any alias
2691 : set, and may alias anything. Otherwise, the MEM can only alias
2692 : MEMs in a conflicting alias set. This value is set in a
2693 : language-dependent manner in the front-end, and should not be
2694 : altered in the back-end. These set numbers are tested with
2695 : alias_sets_conflict_p. */
2696 : #define MEM_ALIAS_SET(RTX) (get_mem_attrs (RTX)->alias)
2697 :
2698 : /* For a MEM rtx, the decl it is known to refer to, if it is known to
2699 : refer to part of a DECL. It may also be a COMPONENT_REF. */
2700 : #define MEM_EXPR(RTX) (get_mem_attrs (RTX)->expr)
2701 :
2702 : /* For a MEM rtx, true if its MEM_OFFSET is known. */
2703 : #define MEM_OFFSET_KNOWN_P(RTX) (get_mem_attrs (RTX)->offset_known_p)
2704 :
2705 : /* For a MEM rtx, the offset from the start of MEM_EXPR. */
2706 : #define MEM_OFFSET(RTX) (get_mem_attrs (RTX)->offset)
2707 :
2708 : /* For a MEM rtx, the address space. */
2709 : #define MEM_ADDR_SPACE(RTX) (get_mem_attrs (RTX)->addrspace)
2710 :
2711 : /* For a MEM rtx, true if its MEM_SIZE is known. */
2712 : #define MEM_SIZE_KNOWN_P(RTX) (get_mem_attrs (RTX)->size_known_p)
2713 :
2714 : /* For a MEM rtx, the size in bytes of the MEM. */
2715 : #define MEM_SIZE(RTX) (get_mem_attrs (RTX)->size)
2716 :
2717 : /* For a MEM rtx, the alignment in bits. We can use the alignment of the
2718 : mode as a default when STRICT_ALIGNMENT, but not if not. */
2719 : #define MEM_ALIGN(RTX) (get_mem_attrs (RTX)->align)
2720 : #else
2721 : #define MEM_ADDR_SPACE(RTX) ADDR_SPACE_GENERIC
2722 : #endif
2723 :
2724 : /* For a REG rtx, the decl it is known to refer to, if it is known to
2725 : refer to part of a DECL. */
2726 : #define REG_EXPR(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->decl)
2727 :
2728 : /* For a REG rtx, the offset from the start of REG_EXPR, if known, as an
2729 : HOST_WIDE_INT. */
2730 : #define REG_OFFSET(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->offset)
2731 :
2732 : /* Copy the attributes that apply to memory locations from RHS to LHS. */
2733 : #define MEM_COPY_ATTRIBUTES(LHS, RHS) \
2734 : (MEM_VOLATILE_P (LHS) = MEM_VOLATILE_P (RHS), \
2735 : MEM_NOTRAP_P (LHS) = MEM_NOTRAP_P (RHS), \
2736 : MEM_READONLY_P (LHS) = MEM_READONLY_P (RHS), \
2737 : MEM_KEEP_ALIAS_SET_P (LHS) = MEM_KEEP_ALIAS_SET_P (RHS), \
2738 : MEM_POINTER (LHS) = MEM_POINTER (RHS), \
2739 : MEM_INDEPENDENT_P (LHS) = MEM_INDEPENDENT_P (RHS), \
2740 : MEM_ATTRS (LHS) = MEM_ATTRS (RHS))
2741 :
2742 : /* 1 if RTX is a label_ref for a nonlocal label. */
2743 : /* Likewise in an expr_list for a REG_LABEL_OPERAND or
2744 : REG_LABEL_TARGET note. */
2745 : #define LABEL_REF_NONLOCAL_P(RTX) \
2746 : (RTL_FLAG_CHECK1 ("LABEL_REF_NONLOCAL_P", (RTX), LABEL_REF)->volatil)
2747 :
2748 : /* 1 if RTX is a code_label that should always be considered to be needed. */
2749 : #define LABEL_PRESERVE_P(RTX) \
2750 : (RTL_FLAG_CHECK2 ("LABEL_PRESERVE_P", (RTX), CODE_LABEL, NOTE)->in_struct)
2751 :
2752 : /* During sched, 1 if RTX is an insn that must be scheduled together
2753 : with the preceding insn. */
2754 : #define SCHED_GROUP_P(RTX) \
2755 : (RTL_FLAG_CHECK4 ("SCHED_GROUP_P", (RTX), DEBUG_INSN, INSN, \
2756 : JUMP_INSN, CALL_INSN)->in_struct)
2757 :
2758 : /* For a SET rtx, SET_DEST is the place that is set
2759 : and SET_SRC is the value it is set to. */
2760 : #define SET_DEST(RTX) XC2EXP (RTX, 0, SET, CLOBBER)
2761 : #define SET_SRC(RTX) XCEXP (RTX, 1, SET)
2762 : #define SET_IS_RETURN_P(RTX) \
2763 : (RTL_FLAG_CHECK1 ("SET_IS_RETURN_P", (RTX), SET)->jump)
2764 :
2765 : /* For a TRAP_IF rtx, TRAP_CONDITION is an expression. */
2766 : #define TRAP_CONDITION(RTX) XCEXP (RTX, 0, TRAP_IF)
2767 : #define TRAP_CODE(RTX) XCEXP (RTX, 1, TRAP_IF)
2768 :
2769 : /* For a COND_EXEC rtx, COND_EXEC_TEST is the condition to base
2770 : conditionally executing the code on, COND_EXEC_CODE is the code
2771 : to execute if the condition is true. */
2772 : #define COND_EXEC_TEST(RTX) XCEXP (RTX, 0, COND_EXEC)
2773 : #define COND_EXEC_CODE(RTX) XCEXP (RTX, 1, COND_EXEC)
2774 :
2775 : /* 1 if RTX is a symbol_ref that addresses this function's rtl
2776 : constants pool. */
2777 : #define CONSTANT_POOL_ADDRESS_P(RTX) \
2778 : (RTL_FLAG_CHECK1 ("CONSTANT_POOL_ADDRESS_P", (RTX), SYMBOL_REF)->unchanging)
2779 :
2780 : /* 1 if RTX is a symbol_ref that addresses a value in the file's
2781 : tree constant pool. This information is private to varasm.cc. */
2782 : #define TREE_CONSTANT_POOL_ADDRESS_P(RTX) \
2783 : (RTL_FLAG_CHECK1 ("TREE_CONSTANT_POOL_ADDRESS_P", \
2784 : (RTX), SYMBOL_REF)->frame_related)
2785 :
2786 : /* Used if RTX is a symbol_ref, for machine-specific purposes. */
2787 : #define SYMBOL_REF_FLAG(RTX) \
2788 : (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAG", (RTX), SYMBOL_REF)->volatil)
2789 :
2790 : /* 1 if RTX is a symbol_ref that has been the library function in
2791 : emit_library_call. */
2792 : #define SYMBOL_REF_USED(RTX) \
2793 : (RTL_FLAG_CHECK1 ("SYMBOL_REF_USED", (RTX), SYMBOL_REF)->used)
2794 :
2795 : /* 1 if RTX is a symbol_ref for a weak symbol. */
2796 : #define SYMBOL_REF_WEAK(RTX) \
2797 : (RTL_FLAG_CHECK1 ("SYMBOL_REF_WEAK", (RTX), SYMBOL_REF)->return_val)
2798 :
2799 : /* A pointer attached to the SYMBOL_REF; either SYMBOL_REF_DECL or
2800 : SYMBOL_REF_CONSTANT. */
2801 : #define SYMBOL_REF_DATA(RTX) X0ANY ((RTX), 1)
2802 :
2803 : /* Set RTX's SYMBOL_REF_DECL to DECL. RTX must not be a constant
2804 : pool symbol. */
2805 : #define SET_SYMBOL_REF_DECL(RTX, DECL) \
2806 : (gcc_assert (!CONSTANT_POOL_ADDRESS_P (RTX)), X0TREE ((RTX), 1) = (DECL))
2807 :
2808 : /* The tree (decl or constant) associated with the symbol, or null. */
2809 : #define SYMBOL_REF_DECL(RTX) \
2810 : (CONSTANT_POOL_ADDRESS_P (RTX) ? NULL : X0TREE ((RTX), 1))
2811 :
2812 : /* Set RTX's SYMBOL_REF_CONSTANT to C. RTX must be a constant pool symbol. */
2813 : #define SET_SYMBOL_REF_CONSTANT(RTX, C) \
2814 : (gcc_assert (CONSTANT_POOL_ADDRESS_P (RTX)), X0CONSTANT ((RTX), 1) = (C))
2815 :
2816 : /* The rtx constant pool entry for a symbol, or null. */
2817 : #define SYMBOL_REF_CONSTANT(RTX) \
2818 : (CONSTANT_POOL_ADDRESS_P (RTX) ? X0CONSTANT ((RTX), 1) : NULL)
2819 :
2820 : /* A set of flags on a symbol_ref that are, in some respects, redundant with
2821 : information derivable from the tree decl associated with this symbol.
2822 : Except that we build a *lot* of SYMBOL_REFs that aren't associated with a
2823 : decl. In some cases this is a bug. But beyond that, it's nice to cache
2824 : this information to avoid recomputing it. Finally, this allows space for
2825 : the target to store more than one bit of information, as with
2826 : SYMBOL_REF_FLAG. */
2827 : #define SYMBOL_REF_FLAGS(RTX) \
2828 : (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAGS", (RTX), SYMBOL_REF) \
2829 : ->u2.symbol_ref_flags)
2830 :
2831 : /* These flags are common enough to be defined for all targets. They
2832 : are computed by the default version of targetm.encode_section_info. */
2833 :
2834 : /* Set if this symbol is a function. */
2835 : #define SYMBOL_FLAG_FUNCTION (1 << 0)
2836 : #define SYMBOL_REF_FUNCTION_P(RTX) \
2837 : ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_FUNCTION) != 0)
2838 : /* Set if targetm.binds_local_p is true. */
2839 : #define SYMBOL_FLAG_LOCAL (1 << 1)
2840 : #define SYMBOL_REF_LOCAL_P(RTX) \
2841 : ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_LOCAL) != 0)
2842 : /* Set if targetm.in_small_data_p is true. */
2843 : #define SYMBOL_FLAG_SMALL (1 << 2)
2844 : #define SYMBOL_REF_SMALL_P(RTX) \
2845 : ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_SMALL) != 0)
2846 : /* The three-bit field at [5:3] is true for TLS variables; use
2847 : SYMBOL_REF_TLS_MODEL to extract the field as an enum tls_model. */
2848 : #define SYMBOL_FLAG_TLS_SHIFT 3
2849 : #define SYMBOL_REF_TLS_MODEL(RTX) \
2850 : ((enum tls_model) ((SYMBOL_REF_FLAGS (RTX) >> SYMBOL_FLAG_TLS_SHIFT) & 7))
2851 : /* Set if this symbol is not defined in this translation unit. */
2852 : #define SYMBOL_FLAG_EXTERNAL (1 << 6)
2853 : #define SYMBOL_REF_EXTERNAL_P(RTX) \
2854 : ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_EXTERNAL) != 0)
2855 : /* Set if this symbol has a block_symbol structure associated with it. */
2856 : #define SYMBOL_FLAG_HAS_BLOCK_INFO (1 << 7)
2857 : #define SYMBOL_REF_HAS_BLOCK_INFO_P(RTX) \
2858 : ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_HAS_BLOCK_INFO) != 0)
2859 : /* Set if this symbol is a section anchor. SYMBOL_REF_ANCHOR_P implies
2860 : SYMBOL_REF_HAS_BLOCK_INFO_P. */
2861 : #define SYMBOL_FLAG_ANCHOR (1 << 8)
2862 : #define SYMBOL_REF_ANCHOR_P(RTX) \
2863 : ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_ANCHOR) != 0)
2864 :
2865 : /* Subsequent bits are available for the target to use. */
2866 : #define SYMBOL_FLAG_MACH_DEP_SHIFT 9
2867 : #define SYMBOL_FLAG_MACH_DEP (1 << SYMBOL_FLAG_MACH_DEP_SHIFT)
2868 :
2869 : /* If SYMBOL_REF_HAS_BLOCK_INFO_P (RTX), this is the object_block
2870 : structure to which the symbol belongs, or NULL if it has not been
2871 : assigned a block. */
2872 : #define SYMBOL_REF_BLOCK(RTX) (BLOCK_SYMBOL_CHECK (RTX)->block)
2873 :
2874 : /* If SYMBOL_REF_HAS_BLOCK_INFO_P (RTX), this is the offset of RTX from
2875 : the first object in SYMBOL_REF_BLOCK (RTX). The value is negative if
2876 : RTX has not yet been assigned to a block, or it has not been given an
2877 : offset within that block. */
2878 : #define SYMBOL_REF_BLOCK_OFFSET(RTX) (BLOCK_SYMBOL_CHECK (RTX)->offset)
2879 :
2880 : /* True if RTX is flagged to be a scheduling barrier. */
2881 : #define PREFETCH_SCHEDULE_BARRIER_P(RTX) \
2882 : (RTL_FLAG_CHECK1 ("PREFETCH_SCHEDULE_BARRIER_P", (RTX), PREFETCH)->volatil)
2883 :
2884 : /* Indicate whether the machine has any sort of auto increment addressing.
2885 : If not, we can avoid checking for REG_INC notes. */
2886 :
2887 : #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) \
2888 : || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT) \
2889 : || defined (HAVE_PRE_MODIFY_DISP) || defined (HAVE_POST_MODIFY_DISP) \
2890 : || defined (HAVE_PRE_MODIFY_REG) || defined (HAVE_POST_MODIFY_REG))
2891 : #define AUTO_INC_DEC 1
2892 : #else
2893 : #define AUTO_INC_DEC 0
2894 : #endif
2895 :
2896 : /* Define a macro to look for REG_INC notes,
2897 : but save time on machines where they never exist. */
2898 :
2899 : #if AUTO_INC_DEC
2900 : #define FIND_REG_INC_NOTE(INSN, REG) \
2901 : ((REG) != NULL_RTX && REG_P ((REG)) \
2902 : ? find_regno_note ((INSN), REG_INC, REGNO (REG)) \
2903 : : find_reg_note ((INSN), REG_INC, (REG)))
2904 : #else
2905 : #define FIND_REG_INC_NOTE(INSN, REG) 0
2906 : #endif
2907 :
2908 : #ifndef HAVE_PRE_INCREMENT
2909 : #define HAVE_PRE_INCREMENT 0
2910 : #endif
2911 :
2912 : #ifndef HAVE_PRE_DECREMENT
2913 : #define HAVE_PRE_DECREMENT 0
2914 : #endif
2915 :
2916 : #ifndef HAVE_POST_INCREMENT
2917 : #define HAVE_POST_INCREMENT 0
2918 : #endif
2919 :
2920 : #ifndef HAVE_POST_DECREMENT
2921 : #define HAVE_POST_DECREMENT 0
2922 : #endif
2923 :
2924 : #ifndef HAVE_POST_MODIFY_DISP
2925 : #define HAVE_POST_MODIFY_DISP 0
2926 : #endif
2927 :
2928 : #ifndef HAVE_POST_MODIFY_REG
2929 : #define HAVE_POST_MODIFY_REG 0
2930 : #endif
2931 :
2932 : #ifndef HAVE_PRE_MODIFY_DISP
2933 : #define HAVE_PRE_MODIFY_DISP 0
2934 : #endif
2935 :
2936 : #ifndef HAVE_PRE_MODIFY_REG
2937 : #define HAVE_PRE_MODIFY_REG 0
2938 : #endif
2939 :
2940 :
2941 : /* Some architectures do not have complete pre/post increment/decrement
2942 : instruction sets, or only move some modes efficiently. These macros
2943 : allow us to tune autoincrement generation. */
2944 :
2945 : #ifndef USE_LOAD_POST_INCREMENT
2946 : #define USE_LOAD_POST_INCREMENT(MODE) HAVE_POST_INCREMENT
2947 : #endif
2948 :
2949 : #ifndef USE_LOAD_POST_DECREMENT
2950 : #define USE_LOAD_POST_DECREMENT(MODE) HAVE_POST_DECREMENT
2951 : #endif
2952 :
2953 : #ifndef USE_LOAD_PRE_INCREMENT
2954 : #define USE_LOAD_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT
2955 : #endif
2956 :
2957 : #ifndef USE_LOAD_PRE_DECREMENT
2958 : #define USE_LOAD_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT
2959 : #endif
2960 :
2961 : #ifndef USE_STORE_POST_INCREMENT
2962 : #define USE_STORE_POST_INCREMENT(MODE) HAVE_POST_INCREMENT
2963 : #endif
2964 :
2965 : #ifndef USE_STORE_POST_DECREMENT
2966 : #define USE_STORE_POST_DECREMENT(MODE) HAVE_POST_DECREMENT
2967 : #endif
2968 :
2969 : #ifndef USE_STORE_PRE_INCREMENT
2970 : #define USE_STORE_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT
2971 : #endif
2972 :
2973 : #ifndef USE_STORE_PRE_DECREMENT
2974 : #define USE_STORE_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT
2975 : #endif
2976 :
2977 : /* Nonzero when we are generating CONCATs. */
2978 : extern int generating_concat_p;
2979 :
2980 : /* Nonzero when we are expanding trees to RTL. */
2981 : extern int currently_expanding_to_rtl;
2982 :
2983 : /* Generally useful functions. */
2984 :
2985 : #ifndef GENERATOR_FILE
2986 : /* Return the cost of SET X. SPEED_P is true if optimizing for speed
2987 : rather than size. */
2988 :
2989 : inline int
2990 44909208 : set_rtx_cost (rtx x, bool speed_p)
2991 : {
2992 44468632 : return rtx_cost (x, VOIDmode, INSN, 4, speed_p);
2993 : }
2994 :
2995 : /* Like set_rtx_cost, but return both the speed and size costs in C. */
2996 :
2997 : inline void
2998 2349384 : get_full_set_rtx_cost (rtx x, struct full_rtx_costs *c)
2999 : {
3000 2212078 : get_full_rtx_cost (x, VOIDmode, INSN, 4, c);
3001 : }
3002 :
3003 : /* Return the cost of moving X into a register, relative to the cost
3004 : of a register move. SPEED_P is true if optimizing for speed rather
3005 : than size. */
3006 :
3007 : inline int
3008 2850191409 : set_src_cost (rtx x, machine_mode mode, bool speed_p)
3009 : {
3010 2848868608 : return rtx_cost (x, mode, SET, 1, speed_p);
3011 : }
3012 :
3013 : /* Like set_src_cost, but return both the speed and size costs in C. */
3014 :
3015 : inline void
3016 378 : get_full_set_src_cost (rtx x, machine_mode mode, struct full_rtx_costs *c)
3017 : {
3018 378 : get_full_rtx_cost (x, mode, SET, 1, c);
3019 : }
3020 : #endif
3021 :
3022 : /* A convenience macro to validate the arguments of a zero_extract
3023 : expression. It determines whether SIZE lies inclusively within
3024 : [1, RANGE], POS lies inclusively within between [0, RANGE - 1]
3025 : and the sum lies inclusively within [1, RANGE]. RANGE must be
3026 : >= 1, but SIZE and POS may be negative. */
3027 : #define EXTRACT_ARGS_IN_RANGE(SIZE, POS, RANGE) \
3028 : (IN_RANGE ((POS), 0, (unsigned HOST_WIDE_INT) (RANGE) - 1) \
3029 : && IN_RANGE ((SIZE), 1, (unsigned HOST_WIDE_INT) (RANGE) \
3030 : - (unsigned HOST_WIDE_INT)(POS)))
3031 :
3032 : /* In explow.cc */
3033 : extern HOST_WIDE_INT trunc_int_for_mode (HOST_WIDE_INT, machine_mode);
3034 : extern poly_int64 trunc_int_for_mode (poly_int64, machine_mode);
3035 : extern rtx plus_constant (machine_mode, rtx, poly_int64, bool = false);
3036 : extern HOST_WIDE_INT get_stack_check_protect (void);
3037 :
3038 : /* In rtl.cc */
3039 : extern rtx rtx_alloc (RTX_CODE CXX_MEM_STAT_INFO);
3040 : inline rtx
3041 2828456216 : rtx_init (rtx rt, RTX_CODE code)
3042 : {
3043 2828456216 : memset (rt, 0, RTX_HDR_SIZE);
3044 2828456216 : PUT_CODE (rt, code);
3045 2826326576 : return rt;
3046 : }
3047 : #define rtx_alloca(code) \
3048 : rtx_init ((rtx) alloca (RTX_CODE_SIZE ((code))), (code))
3049 : extern rtx rtx_alloc_stat_v (RTX_CODE MEM_STAT_DECL, int);
3050 : #define rtx_alloc_v(c, SZ) rtx_alloc_stat_v (c MEM_STAT_INFO, SZ)
3051 : #define const_wide_int_alloc(NWORDS) \
3052 : rtx_alloc_v (CONST_WIDE_INT, \
3053 : (sizeof (struct hwivec_def) \
3054 : + ((NWORDS)-1) * sizeof (HOST_WIDE_INT))) \
3055 :
3056 : extern rtvec rtvec_alloc (size_t);
3057 : extern rtvec shallow_copy_rtvec (rtvec);
3058 : extern bool shared_const_p (const_rtx);
3059 : extern rtx copy_rtx (rtx);
3060 : extern enum rtx_code classify_insn (rtx);
3061 : extern void dump_rtx_statistics (void);
3062 :
3063 : /* In emit-rtl.cc */
3064 :
3065 : /* Opcodes used in the bytecode generated by genemit.cc. */
3066 : enum class expand_opcode {
3067 : /* NULL_RTX. */
3068 : NO_RTX,
3069 :
3070 : /* A (match_operand N) or (match_dup N). Followed by the operand number. */
3071 : MATCH_OPERAND,
3072 :
3073 : /* A (match_operator N) or (match_op_dup N) that preserves the original mode.
3074 : Followed by the operand number. */
3075 : MATCH_OPERATOR,
3076 :
3077 : /* A (match_operator N) or (match_op_dup N) that overrides the original mode.
3078 : Followed by the new mode and by the operand number. */
3079 : MATCH_OPERATOR_WITH_MODE,
3080 :
3081 : /* A (match_parallel N) or (match_par_dup N). Followed by the operand
3082 : number. */
3083 : MATCH_PARALLEL,
3084 :
3085 : /* A (clobber (reg:M R)). Followed by M and R. */
3086 : CLOBBER_REG,
3087 :
3088 : /* FIRST_CODE + X represents a normal rtx with code X. */
3089 : FIRST_CODE
3090 : };
3091 :
3092 : extern rtx expand_rtx (const uint8_t *, rtx *);
3093 : extern rtx_insn *complete_seq (const uint8_t *, rtx *);
3094 : extern void note_split (const char *);
3095 : extern rtx copy_rtx_if_shared (rtx);
3096 :
3097 : /* In rtl.cc */
3098 : extern unsigned int rtx_size (const_rtx);
3099 : extern rtx shallow_copy_rtx (const_rtx CXX_MEM_STAT_INFO);
3100 :
3101 : typedef bool (*rtx_equal_p_callback_function) (const_rtx *, const_rtx *,
3102 : rtx *, rtx *);
3103 : extern bool rtx_equal_p (const_rtx, const_rtx,
3104 : rtx_equal_p_callback_function = NULL);
3105 :
3106 : extern bool rtvec_all_equal_p (const_rtvec);
3107 : extern bool rtvec_series_p (rtvec, poly_int64);
3108 :
3109 : /* Return true if X is a vector constant with a duplicated element value. */
3110 :
3111 : inline bool
3112 522175613 : const_vec_duplicate_p (const_rtx x)
3113 : {
3114 522175613 : return (GET_CODE (x) == CONST_VECTOR
3115 1479219 : && CONST_VECTOR_NPATTERNS (x) == 1
3116 1444662 : && CONST_VECTOR_DUPLICATE_P (x));
3117 : }
3118 :
3119 : /* Return true if X is a vector constant with a duplicated element value.
3120 : Store the duplicated element in *ELT if so. */
3121 :
3122 : template <typename T>
3123 : inline bool
3124 520909199 : const_vec_duplicate_p (T x, T *elt)
3125 : {
3126 318898030 : if (const_vec_duplicate_p (x))
3127 : {
3128 718092 : *elt = CONST_VECTOR_ENCODED_ELT (x, 0);
3129 718096 : return true;
3130 : }
3131 : return false;
3132 : }
3133 :
3134 : /* Return true if X is a vector with a duplicated element value, either
3135 : constant or nonconstant. Store the duplicated element in *ELT if so. */
3136 :
3137 : template <typename T>
3138 : inline bool
3139 325591053 : vec_duplicate_p (T x, T *elt)
3140 : {
3141 325591053 : if (GET_CODE (x) == VEC_DUPLICATE
3142 584891 : && !VECTOR_MODE_P (GET_MODE (XEXP (x, 0))))
3143 : {
3144 584722 : *elt = XEXP (x, 0);
3145 584722 : return true;
3146 : }
3147 325591053 : return const_vec_duplicate_p (x, elt);
3148 : }
3149 :
3150 : /* If X is a vector constant with a duplicated element value, return that
3151 : element value, otherwise return X. */
3152 :
3153 : template <typename T>
3154 : inline T
3155 1266106 : unwrap_const_vec_duplicate (T x)
3156 : {
3157 1280501 : if (const_vec_duplicate_p (x))
3158 14395 : x = CONST_VECTOR_ELT (x, 0);
3159 1266106 : return x;
3160 : }
3161 :
3162 : /* In emit-rtl.cc. */
3163 : extern wide_int const_vector_int_elt (const_rtx, unsigned int);
3164 : extern rtx const_vector_elt (const_rtx, unsigned int);
3165 : extern bool const_vec_series_p_1 (const_rtx, rtx *, rtx *);
3166 :
3167 : /* Return true if X is an integer constant vector that contains a linear
3168 : series of the form:
3169 :
3170 : { B, B + S, B + 2 * S, B + 3 * S, ... }
3171 :
3172 : for a nonzero S. Store B and S in *BASE_OUT and *STEP_OUT on success. */
3173 :
3174 : inline bool
3175 4272969 : const_vec_series_p (const_rtx x, rtx *base_out, rtx *step_out)
3176 : {
3177 4272969 : if (GET_CODE (x) == CONST_VECTOR
3178 6613 : && CONST_VECTOR_NPATTERNS (x) == 1
3179 4278829 : && !CONST_VECTOR_DUPLICATE_P (x))
3180 5860 : return const_vec_series_p_1 (x, base_out, step_out);
3181 : return false;
3182 : }
3183 :
3184 : /* Return true if X is a vector that contains a linear series of the
3185 : form:
3186 :
3187 : { B, B + S, B + 2 * S, B + 3 * S, ... }
3188 :
3189 : where B and S are constant or nonconstant. Store B and S in
3190 : *BASE_OUT and *STEP_OUT on success. */
3191 :
3192 : inline bool
3193 4273433 : vec_series_p (const_rtx x, rtx *base_out, rtx *step_out)
3194 : {
3195 4273433 : if (GET_CODE (x) == VEC_SERIES)
3196 : {
3197 464 : *base_out = XEXP (x, 0);
3198 464 : *step_out = XEXP (x, 1);
3199 464 : return true;
3200 : }
3201 4272969 : return const_vec_series_p (x, base_out, step_out);
3202 : }
3203 :
3204 : /* Return true if CONST_VECTORs X and Y, which are known to have the same mode,
3205 : also have the same encoding. This means that they are equal whenever their
3206 : operands are equal. */
3207 :
3208 : inline bool
3209 : same_vector_encodings_p (const_rtx x, const_rtx y)
3210 : {
3211 : /* Don't be fussy about the encoding of constant-length vectors,
3212 : since XVECEXP (X, 0) and XVECEXP (Y, 0) list all the elements anyway. */
3213 : if (poly_uint64 (CONST_VECTOR_NUNITS (x)).is_constant ())
3214 : return true;
3215 :
3216 : return (CONST_VECTOR_NPATTERNS (x) == CONST_VECTOR_NPATTERNS (y)
3217 : && (CONST_VECTOR_NELTS_PER_PATTERN (x)
3218 : == CONST_VECTOR_NELTS_PER_PATTERN (y)));
3219 : }
3220 :
3221 : /* Return the unpromoted (outer) mode of SUBREG_PROMOTED_VAR_P subreg X. */
3222 :
3223 : inline scalar_int_mode
3224 7 : subreg_unpromoted_mode (rtx x)
3225 : {
3226 7 : gcc_checking_assert (SUBREG_PROMOTED_VAR_P (x));
3227 7 : return as_a <scalar_int_mode> (GET_MODE (x));
3228 : }
3229 :
3230 : /* Return the promoted (inner) mode of SUBREG_PROMOTED_VAR_P subreg X. */
3231 :
3232 : inline scalar_int_mode
3233 28 : subreg_promoted_mode (rtx x)
3234 : {
3235 28 : gcc_checking_assert (SUBREG_PROMOTED_VAR_P (x));
3236 28 : return as_a <scalar_int_mode> (GET_MODE (SUBREG_REG (x)));
3237 : }
3238 :
3239 : /* In emit-rtl.cc */
3240 : extern rtvec gen_rtvec_v (int, rtx *);
3241 : extern rtvec gen_rtvec_v (int, rtx_insn **);
3242 : extern rtx gen_reg_rtx (machine_mode);
3243 : extern rtx gen_rtx_REG_offset (rtx, machine_mode, unsigned int, poly_int64);
3244 : extern rtx gen_reg_rtx_offset (rtx, machine_mode, int);
3245 : extern rtx gen_reg_rtx_and_attrs (rtx);
3246 : extern rtx_code_label *gen_label_rtx (void);
3247 : extern rtx gen_lowpart_common (machine_mode, rtx);
3248 :
3249 : /* In cse.cc */
3250 : extern rtx gen_lowpart_if_possible (machine_mode, rtx);
3251 :
3252 : /* In emit-rtl.cc */
3253 : extern rtx gen_highpart (machine_mode, rtx);
3254 : extern rtx gen_highpart_mode (machine_mode, machine_mode, rtx);
3255 : extern rtx operand_subword (rtx, poly_uint64, int, machine_mode);
3256 :
3257 : /* In emit-rtl.cc */
3258 : extern rtx operand_subword_force (rtx, poly_uint64, machine_mode);
3259 : extern bool subreg_lowpart_p (const_rtx);
3260 : extern poly_uint64 subreg_size_lowpart_offset (poly_uint64, poly_uint64);
3261 :
3262 : /* Return true if a subreg of mode OUTERMODE would only access part of
3263 : an inner register with mode INNERMODE. The other bits of the inner
3264 : register would then be "don't care" on read. The behavior for writes
3265 : depends on REGMODE_NATURAL_SIZE; bits in the same REGMODE_NATURAL_SIZE-d
3266 : chunk would be clobbered but other bits would be preserved. */
3267 :
3268 : inline bool
3269 969744841 : partial_subreg_p (machine_mode outermode, machine_mode innermode)
3270 : {
3271 : /* Modes involved in a subreg must be ordered. In particular, we must
3272 : always know at compile time whether the subreg is paradoxical. */
3273 951867680 : poly_int64 outer_prec = GET_MODE_PRECISION (outermode);
3274 958825099 : poly_int64 inner_prec = GET_MODE_PRECISION (innermode);
3275 969744841 : gcc_checking_assert (ordered_p (outer_prec, inner_prec));
3276 969655228 : return maybe_lt (outer_prec, inner_prec);
3277 : }
3278 :
3279 : /* Likewise return true if X is a subreg that is smaller than the inner
3280 : register. Use read_modify_subreg_p to test whether writing to such
3281 : a subreg preserves any part of the inner register. */
3282 :
3283 : inline bool
3284 63260790 : partial_subreg_p (const_rtx x)
3285 : {
3286 62816369 : if (GET_CODE (x) != SUBREG)
3287 : return false;
3288 11961933 : return partial_subreg_p (GET_MODE (x), GET_MODE (SUBREG_REG (x)));
3289 : }
3290 :
3291 : /* Return true if a subreg with the given outer and inner modes is
3292 : paradoxical. */
3293 :
3294 : inline bool
3295 306325435 : paradoxical_subreg_p (machine_mode outermode, machine_mode innermode)
3296 : {
3297 : /* Modes involved in a subreg must be ordered. In particular, we must
3298 : always know at compile time whether the subreg is paradoxical. */
3299 262151619 : poly_int64 outer_prec = GET_MODE_PRECISION (outermode);
3300 306325198 : poly_int64 inner_prec = GET_MODE_PRECISION (innermode);
3301 306325435 : gcc_checking_assert (ordered_p (outer_prec, inner_prec));
3302 305657704 : return maybe_gt (outer_prec, inner_prec);
3303 : }
3304 :
3305 : /* Return true if X is a paradoxical subreg, false otherwise. */
3306 :
3307 : inline bool
3308 526200164 : paradoxical_subreg_p (const_rtx x)
3309 : {
3310 515109303 : if (GET_CODE (x) != SUBREG)
3311 : return false;
3312 64745982 : return paradoxical_subreg_p (GET_MODE (x), GET_MODE (SUBREG_REG (x)));
3313 : }
3314 :
3315 : /* Return the SUBREG_BYTE for an OUTERMODE lowpart of an INNERMODE value. */
3316 :
3317 : inline poly_uint64
3318 234523892 : subreg_lowpart_offset (machine_mode outermode, machine_mode innermode)
3319 : {
3320 469047784 : return subreg_size_lowpart_offset (GET_MODE_SIZE (outermode),
3321 234523892 : GET_MODE_SIZE (innermode));
3322 : }
3323 :
3324 : /* Given that a subreg has outer mode OUTERMODE and inner mode INNERMODE,
3325 : return the smaller of the two modes if they are different sizes,
3326 : otherwise return the outer mode. */
3327 :
3328 : inline machine_mode
3329 13903634 : narrower_subreg_mode (machine_mode outermode, machine_mode innermode)
3330 : {
3331 13903634 : return paradoxical_subreg_p (outermode, innermode) ? innermode : outermode;
3332 : }
3333 :
3334 : /* Given that a subreg has outer mode OUTERMODE and inner mode INNERMODE,
3335 : return the mode that is big enough to hold both the outer and inner
3336 : values. Prefer the outer mode in the event of a tie. */
3337 :
3338 : inline machine_mode
3339 151689899 : wider_subreg_mode (machine_mode outermode, machine_mode innermode)
3340 : {
3341 147389820 : return partial_subreg_p (outermode, innermode) ? innermode : outermode;
3342 : }
3343 :
3344 : /* Likewise for subreg X. */
3345 :
3346 : inline machine_mode
3347 9480373 : wider_subreg_mode (const_rtx x)
3348 : {
3349 14150208 : return wider_subreg_mode (GET_MODE (x), GET_MODE (SUBREG_REG (x)));
3350 : }
3351 :
3352 : extern poly_uint64 subreg_size_highpart_offset (poly_uint64, poly_uint64);
3353 :
3354 : /* Return the SUBREG_BYTE for an OUTERMODE highpart of an INNERMODE value. */
3355 :
3356 : inline poly_uint64
3357 46155 : subreg_highpart_offset (machine_mode outermode, machine_mode innermode)
3358 : {
3359 92310 : return subreg_size_highpart_offset (GET_MODE_SIZE (outermode),
3360 46155 : GET_MODE_SIZE (innermode));
3361 : }
3362 :
3363 : extern poly_int64 byte_lowpart_offset (machine_mode, machine_mode);
3364 : extern poly_int64 subreg_memory_offset (machine_mode, machine_mode,
3365 : poly_uint64);
3366 : extern poly_int64 subreg_memory_offset (const_rtx);
3367 : extern rtx make_safe_from (rtx, rtx);
3368 : extern rtx convert_memory_address_addr_space_1 (scalar_int_mode, rtx,
3369 : addr_space_t, bool, bool);
3370 : extern rtx convert_memory_address_addr_space (scalar_int_mode, rtx,
3371 : addr_space_t);
3372 : #define convert_memory_address(to_mode,x) \
3373 : convert_memory_address_addr_space ((to_mode), (x), ADDR_SPACE_GENERIC)
3374 : extern const char *get_insn_name (int);
3375 : extern rtx_insn *get_last_insn_anywhere (void);
3376 : extern rtx_insn *get_first_nonnote_insn (void);
3377 : extern rtx_insn *get_last_nonnote_insn (void);
3378 : extern void start_sequence (void);
3379 : extern void push_to_sequence (rtx_insn *);
3380 : extern void push_to_sequence2 (rtx_insn *, rtx_insn *);
3381 : extern rtx_insn *end_sequence (void);
3382 : #if TARGET_SUPPORTS_WIDE_INT == 0
3383 : extern double_int rtx_to_double_int (const_rtx);
3384 : #endif
3385 : extern void cwi_output_hex (FILE *, const_rtx);
3386 : #if TARGET_SUPPORTS_WIDE_INT == 0
3387 : extern rtx immed_double_const (HOST_WIDE_INT, HOST_WIDE_INT,
3388 : machine_mode);
3389 : #endif
3390 : extern rtx immed_wide_int_const (const poly_wide_int_ref &, machine_mode);
3391 :
3392 : /* In varasm.cc */
3393 : extern rtx force_const_mem (machine_mode, rtx);
3394 :
3395 : /* In varasm.cc */
3396 :
3397 : struct function;
3398 : extern rtx get_pool_constant (const_rtx);
3399 : extern rtx get_pool_constant_mark (rtx, bool *);
3400 : extern fixed_size_mode get_pool_mode (const_rtx);
3401 : extern rtx simplify_subtraction (rtx);
3402 : extern void decide_function_section (tree);
3403 :
3404 : /* In emit-rtl.cc */
3405 : extern rtx_insn *emit_insn_before (rtx, rtx_insn *);
3406 : extern rtx_insn *emit_insn_before_noloc (rtx, rtx_insn *, basic_block);
3407 : extern rtx_insn *emit_insn_before_setloc (rtx, rtx_insn *, location_t);
3408 : extern rtx_jump_insn *emit_jump_insn_before (rtx, rtx_insn *);
3409 : extern rtx_jump_insn *emit_jump_insn_before_noloc (rtx, rtx_insn *);
3410 : extern rtx_jump_insn *emit_jump_insn_before_setloc (rtx, rtx_insn *,
3411 : location_t);
3412 : extern rtx_insn *emit_call_insn_before (rtx, rtx_insn *);
3413 : extern rtx_insn *emit_call_insn_before_noloc (rtx, rtx_insn *);
3414 : extern rtx_insn *emit_call_insn_before_setloc (rtx, rtx_insn *, location_t);
3415 : extern rtx_insn *emit_debug_insn_before (rtx, rtx_insn *);
3416 : extern rtx_insn *emit_debug_insn_before_noloc (rtx, rtx_insn *);
3417 : extern rtx_insn *emit_debug_insn_before_setloc (rtx, rtx_insn *, location_t);
3418 : extern rtx_barrier *emit_barrier_before (rtx_insn *);
3419 : extern rtx_code_label *emit_label_before (rtx_code_label *, rtx_insn *);
3420 : extern rtx_note *emit_note_before (enum insn_note, rtx_insn *);
3421 : extern rtx_insn *emit_insn_after (rtx, rtx_insn *);
3422 : extern rtx_insn *emit_insn_after_noloc (rtx, rtx_insn *, basic_block);
3423 : extern rtx_insn *emit_insn_after_setloc (rtx, rtx_insn *, location_t);
3424 : extern rtx_jump_insn *emit_jump_insn_after (rtx, rtx_insn *);
3425 : extern rtx_jump_insn *emit_jump_insn_after_noloc (rtx, rtx_insn *);
3426 : extern rtx_jump_insn *emit_jump_insn_after_setloc (rtx, rtx_insn *, location_t);
3427 : extern rtx_insn *emit_call_insn_after (rtx, rtx_insn *);
3428 : extern rtx_insn *emit_call_insn_after_noloc (rtx, rtx_insn *);
3429 : extern rtx_insn *emit_call_insn_after_setloc (rtx, rtx_insn *, location_t);
3430 : extern rtx_insn *emit_debug_insn_after (rtx, rtx_insn *);
3431 : extern rtx_insn *emit_debug_insn_after_noloc (rtx, rtx_insn *);
3432 : extern rtx_insn *emit_debug_insn_after_setloc (rtx, rtx_insn *, location_t);
3433 : extern rtx_barrier *emit_barrier_after (rtx_insn *);
3434 : extern rtx_insn *emit_label_after (rtx_insn *, rtx_insn *);
3435 : extern rtx_note *emit_note_after (enum insn_note, rtx_insn *);
3436 : extern rtx_insn *emit_insn (rtx);
3437 : extern rtx_insn *emit_debug_insn (rtx);
3438 : extern rtx_insn *emit_jump_insn (rtx);
3439 : extern rtx_insn *emit_likely_jump_insn (rtx);
3440 : extern rtx_insn *emit_unlikely_jump_insn (rtx);
3441 : extern rtx_insn *emit_call_insn (rtx);
3442 : extern rtx_code_label *emit_label (rtx);
3443 : extern rtx_jump_table_data *emit_jump_table_data (rtx);
3444 : extern rtx_barrier *emit_barrier (void);
3445 : extern rtx_note *emit_note (enum insn_note);
3446 : extern rtx_note *emit_note_copy (rtx_note *);
3447 : extern rtx_insn *gen_clobber (rtx);
3448 : extern rtx_insn *emit_clobber (rtx);
3449 : extern rtx_insn *gen_use (rtx);
3450 : extern rtx_insn *emit_use (rtx);
3451 : extern rtx_insn *make_insn_raw (rtx);
3452 : extern void add_function_usage_to (rtx, rtx);
3453 : extern rtx_call_insn *last_call_insn (void);
3454 : extern rtx_insn *previous_insn (rtx_insn *);
3455 : extern rtx_insn *next_insn (rtx_insn *);
3456 : extern rtx_insn *prev_nonnote_insn (rtx_insn *);
3457 : extern rtx_insn *next_nonnote_insn (rtx_insn *);
3458 : extern rtx_insn *prev_nondebug_insn (rtx_insn *);
3459 : extern rtx_insn *next_nondebug_insn (rtx_insn *);
3460 : extern rtx_insn *prev_nonnote_nondebug_insn (rtx_insn *);
3461 : extern rtx_insn *prev_nonnote_nondebug_insn_bb (rtx_insn *);
3462 : extern rtx_insn *next_nonnote_nondebug_insn (rtx_insn *);
3463 : extern rtx_insn *next_nonnote_nondebug_insn_bb (rtx_insn *);
3464 : extern rtx_insn *prev_real_insn (rtx_insn *);
3465 : extern rtx_insn *next_real_insn (rtx_insn *);
3466 : extern rtx_insn *prev_real_nondebug_insn (rtx_insn *);
3467 : extern rtx_insn *next_real_nondebug_insn (rtx);
3468 : extern rtx_insn *prev_active_insn (rtx_insn *);
3469 : extern rtx_insn *next_active_insn (rtx_insn *);
3470 : extern bool active_insn_p (const rtx_insn *);
3471 :
3472 : /* In emit-rtl.cc */
3473 : extern int insn_line (const rtx_insn *);
3474 : extern const char * insn_file (const rtx_insn *);
3475 : extern tree insn_scope (const rtx_insn *);
3476 : extern expanded_location insn_location (const rtx_insn *);
3477 : extern int insn_discriminator (const rtx_insn *);
3478 : extern location_t prologue_location, epilogue_location;
3479 :
3480 : /* In jump.cc */
3481 : extern enum rtx_code reverse_condition (enum rtx_code);
3482 : extern enum rtx_code reverse_condition_maybe_unordered (enum rtx_code);
3483 : extern enum rtx_code swap_condition (enum rtx_code);
3484 : extern enum rtx_code unsigned_condition (enum rtx_code);
3485 : extern enum rtx_code signed_condition (enum rtx_code);
3486 : extern void mark_jump_label (rtx, rtx_insn *, int);
3487 :
3488 : /* Return true if integer comparison operator CODE interprets its operands
3489 : as unsigned. */
3490 :
3491 : inline bool
3492 4843411 : unsigned_condition_p (enum rtx_code code)
3493 : {
3494 4843411 : return unsigned_condition (code) == code;
3495 : }
3496 :
3497 : /* In jump.cc */
3498 : extern rtx_insn *delete_related_insns (rtx);
3499 :
3500 : /* In recog.cc */
3501 : extern rtx *find_constant_term_loc (rtx *);
3502 :
3503 : /* In emit-rtl.cc */
3504 : extern rtx_insn *try_split (rtx, rtx_insn *, int);
3505 :
3506 : /* In insn-recog.cc (generated by genrecog). */
3507 : extern rtx_insn *split_insns (rtx, rtx_insn *);
3508 :
3509 : /* In simplify-rtx.cc */
3510 :
3511 : /* A class that records the context in which a simplification
3512 : is being mode. */
3513 71539809 : class simplify_context
3514 : {
3515 : public:
3516 : rtx simplify_unary_operation (rtx_code, machine_mode, rtx, machine_mode);
3517 : rtx simplify_binary_operation (rtx_code, machine_mode, rtx, rtx);
3518 : rtx simplify_ternary_operation (rtx_code, machine_mode, machine_mode,
3519 : rtx, rtx, rtx);
3520 : rtx simplify_relational_operation (rtx_code, machine_mode, machine_mode,
3521 : rtx, rtx);
3522 : rtx simplify_ior_with_common_term (machine_mode, rtx, rtx);
3523 : rtx simplify_subreg (machine_mode, rtx, machine_mode, poly_uint64);
3524 :
3525 : rtx lowpart_subreg (machine_mode, rtx, machine_mode);
3526 :
3527 : rtx simplify_merge_mask (rtx, rtx, int);
3528 :
3529 : rtx simplify_gen_unary (rtx_code, machine_mode, rtx, machine_mode);
3530 : rtx simplify_gen_binary (rtx_code, machine_mode, rtx, rtx);
3531 : rtx simplify_gen_ternary (rtx_code, machine_mode, machine_mode,
3532 : rtx, rtx, rtx);
3533 : rtx simplify_gen_relational (rtx_code, machine_mode, machine_mode, rtx, rtx);
3534 : rtx simplify_gen_subreg (machine_mode, rtx, machine_mode, poly_uint64);
3535 : rtx simplify_gen_vec_select (rtx, unsigned int);
3536 :
3537 : /* Tracks the level of MEM nesting for the value being simplified:
3538 : 0 means the value is not in a MEM, >0 means it is. This is needed
3539 : because the canonical representation of multiplication is different
3540 : inside a MEM than outside. */
3541 : unsigned int mem_depth = 0;
3542 :
3543 : /* Tracks number of simplify_associative_operation calls performed during
3544 : outermost simplify* call. */
3545 : unsigned int assoc_count = 0;
3546 :
3547 : /* Limit for the above number, return NULL from
3548 : simplify_associative_operation after we reach that assoc_count. */
3549 : static const unsigned int max_assoc_count = 64;
3550 :
3551 : private:
3552 : rtx simplify_truncation (machine_mode, rtx, machine_mode);
3553 : rtx simplify_byte_swapping_operation (rtx_code, machine_mode, rtx, rtx);
3554 : rtx simplify_associative_operation (rtx_code, machine_mode, rtx, rtx);
3555 : rtx simplify_distributive_operation (rtx_code, machine_mode, rtx, rtx);
3556 : rtx simplify_logical_relational_operation (rtx_code, machine_mode, rtx, rtx,
3557 : bool = false);
3558 : rtx simplify_binary_operation_series (rtx_code, machine_mode, rtx, rtx);
3559 : rtx simplify_distribute_over_subregs (rtx_code, machine_mode, rtx, rtx);
3560 : rtx simplify_shift_const_int (rtx_code, machine_mode, rtx, unsigned int);
3561 : rtx simplify_plus_minus (rtx_code, machine_mode, rtx, rtx);
3562 : rtx simplify_cond_clz_ctz (rtx, rtx_code, rtx, rtx);
3563 :
3564 : rtx simplify_unary_operation_1 (rtx_code, machine_mode, rtx);
3565 : rtx simplify_binary_operation_1 (rtx_code, machine_mode, rtx, rtx, rtx, rtx);
3566 : rtx simplify_ternary_operation_1 (rtx_code, machine_mode, machine_mode,
3567 : rtx, rtx, rtx);
3568 : rtx simplify_relational_operation_1 (rtx_code, machine_mode, machine_mode,
3569 : rtx, rtx);
3570 : };
3571 :
3572 : inline rtx
3573 20126773 : simplify_unary_operation (rtx_code code, machine_mode mode, rtx op,
3574 : machine_mode op_mode)
3575 : {
3576 20126497 : return simplify_context ().simplify_unary_operation (code, mode, op,
3577 : op_mode);
3578 : }
3579 :
3580 : inline rtx
3581 212557134 : simplify_binary_operation (rtx_code code, machine_mode mode, rtx op0, rtx op1)
3582 : {
3583 212555690 : return simplify_context ().simplify_binary_operation (code, mode, op0, op1);
3584 : }
3585 :
3586 : inline rtx
3587 36354304 : simplify_ternary_operation (rtx_code code, machine_mode mode,
3588 : machine_mode op0_mode, rtx op0, rtx op1, rtx op2)
3589 : {
3590 36354304 : return simplify_context ().simplify_ternary_operation (code, mode, op0_mode,
3591 84255 : op0, op1, op2);
3592 : }
3593 :
3594 : inline rtx
3595 64397756 : simplify_relational_operation (rtx_code code, machine_mode mode,
3596 : machine_mode op_mode, rtx op0, rtx op1)
3597 : {
3598 64397756 : return simplify_context ().simplify_relational_operation (code, mode,
3599 207577 : op_mode, op0, op1);
3600 : }
3601 :
3602 : inline rtx
3603 23633537 : simplify_subreg (machine_mode outermode, rtx op, machine_mode innermode,
3604 : poly_uint64 byte)
3605 : {
3606 23633537 : return simplify_context ().simplify_subreg (outermode, op, innermode, byte);
3607 : }
3608 :
3609 : inline rtx
3610 890806 : simplify_gen_unary (rtx_code code, machine_mode mode, rtx op,
3611 : machine_mode op_mode)
3612 : {
3613 1781207 : return simplify_context ().simplify_gen_unary (code, mode, op, op_mode);
3614 : }
3615 :
3616 : inline rtx
3617 38749015 : simplify_gen_binary (rtx_code code, machine_mode mode, rtx op0, rtx op1)
3618 : {
3619 91431299 : return simplify_context ().simplify_gen_binary (code, mode, op0, op1);
3620 : }
3621 :
3622 : inline rtx
3623 2751993 : simplify_gen_ternary (rtx_code code, machine_mode mode, machine_mode op0_mode,
3624 : rtx op0, rtx op1, rtx op2)
3625 : {
3626 2751993 : return simplify_context ().simplify_gen_ternary (code, mode, op0_mode,
3627 : op0, op1, op2);
3628 : }
3629 :
3630 : inline rtx
3631 3504493 : simplify_gen_relational (rtx_code code, machine_mode mode,
3632 : machine_mode op_mode, rtx op0, rtx op1)
3633 : {
3634 6042196 : return simplify_context ().simplify_gen_relational (code, mode, op_mode,
3635 : op0, op1);
3636 : }
3637 :
3638 : inline rtx
3639 11456448 : simplify_gen_subreg (machine_mode outermode, rtx op, machine_mode innermode,
3640 : poly_uint64 byte)
3641 : {
3642 11131533 : return simplify_context ().simplify_gen_subreg (outermode, op,
3643 : innermode, byte);
3644 : }
3645 :
3646 : inline rtx
3647 678362 : simplify_gen_vec_select (rtx op, unsigned int index)
3648 : {
3649 678362 : return simplify_context ().simplify_gen_vec_select (op, index);
3650 : }
3651 :
3652 : inline rtx
3653 30973089 : lowpart_subreg (machine_mode outermode, rtx op, machine_mode innermode)
3654 : {
3655 32252334 : return simplify_context ().lowpart_subreg (outermode, op, innermode);
3656 : }
3657 :
3658 : extern rtx simplify_const_unary_operation (enum rtx_code, machine_mode,
3659 : rtx, machine_mode);
3660 : extern rtx simplify_const_binary_operation (enum rtx_code, machine_mode,
3661 : rtx, rtx);
3662 : extern rtx simplify_const_relational_operation (enum rtx_code,
3663 : machine_mode, rtx, rtx);
3664 : extern rtx simplify_replace_fn_rtx (rtx, const_rtx,
3665 : rtx (*fn) (rtx, const_rtx, void *), void *);
3666 : extern rtx simplify_replace_rtx (rtx, const_rtx, rtx);
3667 : extern rtx simplify_rtx (const_rtx);
3668 : extern rtx avoid_constant_pool_reference (rtx);
3669 : extern rtx delegitimize_mem_from_attrs (rtx);
3670 : extern bool mode_signbit_p (machine_mode, const_rtx);
3671 : extern bool val_signbit_p (machine_mode, unsigned HOST_WIDE_INT);
3672 : extern bool val_signbit_known_set_p (machine_mode,
3673 : unsigned HOST_WIDE_INT);
3674 : extern bool val_signbit_known_clear_p (machine_mode,
3675 : unsigned HOST_WIDE_INT);
3676 : extern bool reverse_rotate_by_imm_p (machine_mode, unsigned int, rtx);
3677 :
3678 : /* In reginfo.cc */
3679 : extern machine_mode choose_hard_reg_mode (unsigned int, unsigned int,
3680 : const predefined_function_abi *);
3681 : extern const HARD_REG_SET &simplifiable_subregs (const subreg_shape &);
3682 :
3683 : /* In emit-rtl.cc */
3684 : extern rtx set_for_reg_notes (rtx_insn *);
3685 : extern rtx set_unique_reg_note (rtx_insn *, enum reg_note, rtx);
3686 : extern rtx set_dst_reg_note (rtx_insn *, enum reg_note, rtx, rtx);
3687 : extern void set_insn_deleted (rtx_insn *);
3688 :
3689 : /* Functions in rtlanal.cc */
3690 :
3691 : extern rtx single_set_2 (const rtx_insn *, const_rtx);
3692 : extern rtx simple_regno_set (rtx, unsigned int);
3693 : extern bool contains_symbol_ref_p (const_rtx);
3694 : extern bool contains_symbolic_reference_p (const_rtx);
3695 : extern bool contains_constant_pool_address_p (const_rtx);
3696 : extern void add_auto_inc_notes (rtx_insn *, rtx);
3697 : extern bool single_output_fused_pair_p (rtx_insn *);
3698 :
3699 : /* Handle the cheap and common cases inline for performance. */
3700 :
3701 6983804428 : inline rtx single_set (const rtx_insn *insn)
3702 : {
3703 6983804428 : if (!INSN_P (insn))
3704 : return NULL_RTX;
3705 :
3706 6858763525 : if (GET_CODE (PATTERN (insn)) == SET)
3707 : return PATTERN (insn);
3708 :
3709 : /* Defer to the more expensive case. */
3710 2026453246 : return single_set_2 (insn, PATTERN (insn));
3711 : }
3712 :
3713 : extern machine_mode get_address_mode (rtx mem);
3714 : extern bool rtx_addr_can_trap_p (const_rtx);
3715 : extern bool nonzero_address_p (const_rtx);
3716 : extern bool rtx_unstable_p (const_rtx);
3717 : extern bool rtx_varies_p (const_rtx, bool);
3718 : extern bool rtx_addr_varies_p (const_rtx, bool);
3719 : extern tree get_call_fndecl (const rtx_insn *);
3720 : extern HOST_WIDE_INT get_integer_term (const_rtx);
3721 : extern rtx get_related_value (const_rtx);
3722 : extern bool offset_within_block_p (const_rtx, HOST_WIDE_INT);
3723 : extern void split_const (rtx, rtx *, rtx *);
3724 : extern rtx strip_offset (rtx, poly_int64 *);
3725 : extern poly_int64 get_args_size (const_rtx);
3726 : extern bool unsigned_reg_p (rtx);
3727 : extern bool reg_mentioned_p (const_rtx, const_rtx);
3728 : extern int count_occurrences (const_rtx, const_rtx, int);
3729 : extern bool reg_referenced_p (const_rtx, const_rtx);
3730 : extern bool reg_used_between_p (const_rtx, const rtx_insn *, const rtx_insn *);
3731 : extern bool reg_set_between_p (const_rtx, const rtx_insn *, const rtx_insn *);
3732 : extern int commutative_operand_precedence (rtx);
3733 : extern bool swap_commutative_operands_p (rtx, rtx);
3734 : extern bool modified_between_p (const_rtx, const rtx_insn *, const rtx_insn *);
3735 : extern bool no_labels_between_p (const rtx_insn *, const rtx_insn *);
3736 : extern bool modified_in_p (const_rtx, const_rtx);
3737 : extern bool reg_set_p (const_rtx, const_rtx);
3738 : extern bool multiple_sets (const_rtx);
3739 : extern bool set_noop_p (const_rtx);
3740 : extern bool noop_move_p (const rtx_insn *);
3741 : extern bool refers_to_regno_p (unsigned int, unsigned int, const_rtx, rtx *);
3742 : extern bool reg_overlap_mentioned_p (const_rtx, const_rtx);
3743 : extern const_rtx set_of (const_rtx, const_rtx);
3744 : extern void record_hard_reg_sets (rtx, const_rtx, void *);
3745 : extern void record_hard_reg_uses (rtx *, void *);
3746 : extern void find_all_hard_regs (const_rtx, HARD_REG_SET *);
3747 : extern void find_all_hard_reg_sets (const rtx_insn *, HARD_REG_SET *, bool);
3748 : extern void note_pattern_stores (const_rtx,
3749 : void (*) (rtx, const_rtx, void *), void *);
3750 : extern void note_stores (const rtx_insn *,
3751 : void (*) (rtx, const_rtx, void *), void *);
3752 : extern void note_uses (rtx *, void (*) (rtx *, void *), void *);
3753 : extern bool dead_or_set_p (const rtx_insn *, const_rtx);
3754 : extern bool dead_or_set_regno_p (const rtx_insn *, unsigned int);
3755 : extern rtx find_reg_note (const_rtx, enum reg_note, const_rtx);
3756 : extern rtx find_regno_note (const_rtx, enum reg_note, unsigned int);
3757 : extern rtx find_reg_equal_equiv_note (const_rtx);
3758 : extern rtx find_constant_src (const rtx_insn *);
3759 : extern bool find_reg_fusage (const_rtx, enum rtx_code, const_rtx);
3760 : extern bool find_regno_fusage (const_rtx, enum rtx_code, unsigned int);
3761 : extern rtx alloc_reg_note (enum reg_note, rtx, rtx);
3762 : extern void add_reg_note (rtx, enum reg_note, rtx);
3763 : extern void add_int_reg_note (rtx_insn *, enum reg_note, int);
3764 : extern void add_args_size_note (rtx_insn *, poly_int64);
3765 : extern void add_shallow_copy_of_reg_note (rtx_insn *, rtx);
3766 : extern rtx duplicate_reg_note (rtx);
3767 : extern void remove_note (rtx_insn *, const_rtx);
3768 : extern bool remove_reg_equal_equiv_notes (rtx_insn *, bool = false);
3769 : extern void remove_reg_equal_equiv_notes_for_regno (unsigned int);
3770 : extern bool side_effects_p (const_rtx);
3771 : extern bool volatile_refs_p (const_rtx);
3772 : extern bool volatile_insn_p (const_rtx);
3773 : extern bool may_trap_p_1 (const_rtx, unsigned);
3774 : extern bool may_trap_p (const_rtx);
3775 : extern bool may_trap_or_fault_p (const_rtx);
3776 : extern bool can_throw_internal (const_rtx);
3777 : extern bool can_throw_external (const_rtx);
3778 : extern bool insn_could_throw_p (const_rtx);
3779 : extern bool insn_nothrow_p (const_rtx);
3780 : extern bool can_nonlocal_goto (const rtx_insn *);
3781 : extern void copy_reg_eh_region_note_forward (rtx, rtx_insn *, rtx);
3782 : extern void copy_reg_eh_region_note_backward (rtx, rtx_insn *, rtx);
3783 : extern rtx replace_rtx (rtx, rtx, rtx, bool = false);
3784 : extern void replace_label (rtx *, rtx, rtx, bool);
3785 : extern void replace_label_in_insn (rtx_insn *, rtx_insn *, rtx_insn *, bool);
3786 : extern bool rtx_referenced_p (const_rtx, const_rtx);
3787 : extern bool tablejump_p (const rtx_insn *, rtx_insn **, rtx_jump_table_data **);
3788 : extern rtx tablejump_casesi_pattern (const rtx_insn *insn);
3789 : extern bool computed_jump_p (const rtx_insn *);
3790 : extern bool tls_referenced_p (const_rtx);
3791 : extern bool contains_mem_rtx_p (rtx x);
3792 : extern bool register_asm_p (const_rtx);
3793 :
3794 : /* Overload for refers_to_regno_p for checking a single register. */
3795 : inline bool
3796 145389399 : refers_to_regno_p (unsigned int regnum, const_rtx x, rtx* loc = NULL)
3797 : {
3798 145389399 : return refers_to_regno_p (regnum, regnum + 1, x, loc);
3799 : }
3800 :
3801 : /* Callback for for_each_inc_dec, to process the autoinc operation OP
3802 : within MEM that sets DEST to SRC + SRCOFF, or SRC if SRCOFF is
3803 : NULL. The callback is passed the same opaque ARG passed to
3804 : for_each_inc_dec. Return zero to continue looking for other
3805 : autoinc operations or any other value to interrupt the traversal and
3806 : return that value to the caller of for_each_inc_dec. */
3807 : typedef int (*for_each_inc_dec_fn) (rtx mem, rtx op, rtx dest, rtx src,
3808 : rtx srcoff, void *arg);
3809 : extern int for_each_inc_dec (rtx, for_each_inc_dec_fn, void *arg);
3810 :
3811 : extern rtx regno_use_in (unsigned int, rtx);
3812 : extern bool auto_inc_p (const_rtx);
3813 : extern bool in_insn_list_p (const rtx_insn_list *, const rtx_insn *);
3814 : extern void remove_node_from_insn_list (const rtx_insn *, rtx_insn_list **);
3815 : extern bool loc_mentioned_in_p (rtx *, const_rtx);
3816 : extern rtx_insn *find_first_parameter_load (rtx_insn *, rtx_insn *);
3817 : extern bool keep_with_call_p (const rtx_insn *);
3818 : extern bool label_is_jump_target_p (const_rtx, const rtx_insn *);
3819 : extern int pattern_cost (rtx, bool);
3820 : extern int insn_cost (rtx_insn *, bool);
3821 : extern unsigned seq_cost (const rtx_insn *, bool);
3822 :
3823 : /* Given an insn and condition, return a canonical description of
3824 : the test being made. */
3825 : extern rtx canonicalize_condition (rtx_insn *, rtx, int, rtx_insn **, rtx,
3826 : int, int);
3827 :
3828 : /* Given a JUMP_INSN, return a canonical description of the test
3829 : being made. */
3830 : extern rtx get_condition (rtx_insn *, rtx_insn **, int, int);
3831 :
3832 : /* Information about a subreg of a hard register. */
3833 : struct subreg_info
3834 : {
3835 : /* Offset of first hard register involved in the subreg. */
3836 : int offset;
3837 : /* Number of hard registers involved in the subreg. In the case of
3838 : a paradoxical subreg, this is the number of registers that would
3839 : be modified by writing to the subreg; some of them may be don't-care
3840 : when reading from the subreg. */
3841 : int nregs;
3842 : /* Whether this subreg can be represented as a hard reg with the new
3843 : mode (by adding OFFSET to the original hard register). */
3844 : bool representable_p;
3845 : };
3846 :
3847 : extern void subreg_get_info (unsigned int, machine_mode,
3848 : poly_uint64, machine_mode,
3849 : struct subreg_info *);
3850 :
3851 : /* lists.cc */
3852 :
3853 : extern void free_EXPR_LIST_list (rtx_expr_list **);
3854 : extern void free_INSN_LIST_list (rtx_insn_list **);
3855 : extern void free_EXPR_LIST_node (rtx);
3856 : extern void free_INSN_LIST_node (rtx);
3857 : extern rtx_insn_list *alloc_INSN_LIST (rtx, rtx);
3858 : extern rtx_insn_list *copy_INSN_LIST (rtx_insn_list *);
3859 : extern rtx_insn_list *concat_INSN_LIST (rtx_insn_list *, rtx_insn_list *);
3860 : extern rtx_expr_list *alloc_EXPR_LIST (int, rtx, rtx);
3861 : extern void remove_free_INSN_LIST_elem (rtx_insn *, rtx_insn_list **);
3862 : extern rtx remove_list_elem (rtx, rtx *);
3863 : extern rtx_insn *remove_free_INSN_LIST_node (rtx_insn_list **);
3864 : extern rtx remove_free_EXPR_LIST_node (rtx_expr_list **);
3865 :
3866 :
3867 : /* reginfo.cc */
3868 :
3869 : /* Resize reg info. */
3870 : extern bool resize_reg_info (void);
3871 : /* Free up register info memory. */
3872 : extern void free_reg_info (void);
3873 : extern void init_subregs_of_mode (void);
3874 : extern void finish_subregs_of_mode (void);
3875 : extern void reginfo_cc_finalize (void);
3876 :
3877 : /* recog.cc */
3878 : extern rtx extract_asm_operands (rtx);
3879 : extern int asm_noperands (const_rtx);
3880 : extern const char *decode_asm_operands (rtx, rtx *, rtx **, const char **,
3881 : machine_mode *, location_t *);
3882 : extern void get_referenced_operands (const char *, bool *, unsigned int);
3883 :
3884 : extern enum reg_class reg_preferred_class (int);
3885 : extern enum reg_class reg_alternate_class (int);
3886 : extern enum reg_class reg_allocno_class (int);
3887 : extern void setup_reg_classes (int, enum reg_class, enum reg_class,
3888 : enum reg_class);
3889 :
3890 : extern void split_all_insns (void);
3891 : extern void split_all_insns_noflow (void);
3892 :
3893 : #define MAX_SAVED_CONST_INT 64
3894 : extern GTY(()) rtx const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1];
3895 :
3896 : #define const0_rtx (const_int_rtx[MAX_SAVED_CONST_INT])
3897 : #define const1_rtx (const_int_rtx[MAX_SAVED_CONST_INT+1])
3898 : #define const2_rtx (const_int_rtx[MAX_SAVED_CONST_INT+2])
3899 : #define constm1_rtx (const_int_rtx[MAX_SAVED_CONST_INT-1])
3900 : extern GTY(()) rtx const_true_rtx;
3901 :
3902 : extern GTY(()) rtx const_tiny_rtx[4][(int) MAX_MACHINE_MODE];
3903 :
3904 : /* Returns a constant 0 rtx in mode MODE. Integer modes are treated the
3905 : same as VOIDmode. */
3906 :
3907 : #define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)])
3908 :
3909 : /* Likewise, for the constants 1 and 2 and -1. */
3910 :
3911 : #define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)])
3912 : #define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)])
3913 : #define CONSTM1_RTX(MODE) (const_tiny_rtx[3][(int) (MODE)])
3914 :
3915 : extern GTY(()) rtx pc_rtx;
3916 : extern GTY(()) rtx ret_rtx;
3917 : extern GTY(()) rtx simple_return_rtx;
3918 : extern GTY(()) rtx_insn *invalid_insn_rtx;
3919 :
3920 : /* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg
3921 : is used to represent the frame pointer. This is because the
3922 : hard frame pointer and the automatic variables are separated by an amount
3923 : that cannot be determined until after register allocation. We can assume
3924 : that in this case ELIMINABLE_REGS will be defined, one action of which
3925 : will be to eliminate FRAME_POINTER_REGNUM into HARD_FRAME_POINTER_REGNUM. */
3926 : #ifndef HARD_FRAME_POINTER_REGNUM
3927 : #define HARD_FRAME_POINTER_REGNUM FRAME_POINTER_REGNUM
3928 : #endif
3929 :
3930 : #ifndef HARD_FRAME_POINTER_IS_FRAME_POINTER
3931 : #define HARD_FRAME_POINTER_IS_FRAME_POINTER \
3932 : (HARD_FRAME_POINTER_REGNUM == FRAME_POINTER_REGNUM)
3933 : #endif
3934 :
3935 : #ifndef HARD_FRAME_POINTER_IS_ARG_POINTER
3936 : #define HARD_FRAME_POINTER_IS_ARG_POINTER \
3937 : (HARD_FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM)
3938 : #endif
3939 :
3940 : /* Index labels for global_rtl. */
3941 : enum global_rtl_index
3942 : {
3943 : GR_STACK_POINTER,
3944 : GR_FRAME_POINTER,
3945 : /* For register elimination to work properly these hard_frame_pointer_rtx,
3946 : frame_pointer_rtx, and arg_pointer_rtx must be the same if they refer to
3947 : the same register. */
3948 : #if FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM
3949 : GR_ARG_POINTER = GR_FRAME_POINTER,
3950 : #endif
3951 : #if HARD_FRAME_POINTER_IS_FRAME_POINTER
3952 : GR_HARD_FRAME_POINTER = GR_FRAME_POINTER,
3953 : #else
3954 : GR_HARD_FRAME_POINTER,
3955 : #endif
3956 : #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
3957 : #if HARD_FRAME_POINTER_IS_ARG_POINTER
3958 : GR_ARG_POINTER = GR_HARD_FRAME_POINTER,
3959 : #else
3960 : GR_ARG_POINTER,
3961 : #endif
3962 : #endif
3963 : GR_VIRTUAL_INCOMING_ARGS,
3964 : GR_VIRTUAL_STACK_ARGS,
3965 : GR_VIRTUAL_STACK_DYNAMIC,
3966 : GR_VIRTUAL_OUTGOING_ARGS,
3967 : GR_VIRTUAL_CFA,
3968 : GR_VIRTUAL_PREFERRED_STACK_BOUNDARY,
3969 :
3970 : GR_MAX
3971 : };
3972 :
3973 : /* Target-dependent globals. */
3974 : struct GTY(()) target_rtl {
3975 : /* All references to the hard registers in global_rtl_index go through
3976 : these unique rtl objects. On machines where the frame-pointer and
3977 : arg-pointer are the same register, they use the same unique object.
3978 :
3979 : After register allocation, other rtl objects which used to be pseudo-regs
3980 : may be clobbered to refer to the frame-pointer register.
3981 : But references that were originally to the frame-pointer can be
3982 : distinguished from the others because they contain frame_pointer_rtx.
3983 :
3984 : When to use frame_pointer_rtx and hard_frame_pointer_rtx is a little
3985 : tricky: until register elimination has taken place hard_frame_pointer_rtx
3986 : should be used if it is being set, and frame_pointer_rtx otherwise. After
3987 : register elimination hard_frame_pointer_rtx should always be used.
3988 : On machines where the two registers are same (most) then these are the
3989 : same. */
3990 : rtx x_global_rtl[GR_MAX];
3991 :
3992 : /* A unique representation of (REG:Pmode PIC_OFFSET_TABLE_REGNUM). */
3993 : rtx x_pic_offset_table_rtx;
3994 :
3995 : /* A unique representation of (REG:Pmode RETURN_ADDRESS_POINTER_REGNUM).
3996 : This is used to implement __builtin_return_address for some machines;
3997 : see for instance the MIPS port. */
3998 : rtx x_return_address_pointer_rtx;
3999 :
4000 : /* Commonly used RTL for hard registers. These objects are not
4001 : necessarily unique, so we allocate them separately from global_rtl.
4002 : They are initialized once per compilation unit, then copied into
4003 : regno_reg_rtx at the beginning of each function. */
4004 : rtx x_initial_regno_reg_rtx[FIRST_PSEUDO_REGISTER];
4005 :
4006 : /* A sample (mem:M stack_pointer_rtx) rtx for each mode M. */
4007 : rtx x_top_of_stack[MAX_MACHINE_MODE];
4008 :
4009 : /* Static hunks of RTL used by the aliasing code; these are treated
4010 : as persistent to avoid unnecessary RTL allocations. */
4011 : rtx x_static_reg_base_value[FIRST_PSEUDO_REGISTER];
4012 :
4013 : /* The default memory attributes for each mode. */
4014 : class mem_attrs *x_mode_mem_attrs[(int) MAX_MACHINE_MODE];
4015 :
4016 : /* Track if RTL has been initialized. */
4017 : bool target_specific_initialized;
4018 : };
4019 :
4020 : extern GTY(()) struct target_rtl default_target_rtl;
4021 : #if SWITCHABLE_TARGET
4022 : extern struct target_rtl *this_target_rtl;
4023 : #else
4024 : #define this_target_rtl (&default_target_rtl)
4025 : #endif
4026 :
4027 : #define global_rtl \
4028 : (this_target_rtl->x_global_rtl)
4029 : #define pic_offset_table_rtx \
4030 : (this_target_rtl->x_pic_offset_table_rtx)
4031 : #define return_address_pointer_rtx \
4032 : (this_target_rtl->x_return_address_pointer_rtx)
4033 : #define top_of_stack \
4034 : (this_target_rtl->x_top_of_stack)
4035 : #define mode_mem_attrs \
4036 : (this_target_rtl->x_mode_mem_attrs)
4037 :
4038 : /* All references to certain hard regs, except those created
4039 : by allocating pseudo regs into them (when that's possible),
4040 : go through these unique rtx objects. */
4041 : #define stack_pointer_rtx (global_rtl[GR_STACK_POINTER])
4042 : #define frame_pointer_rtx (global_rtl[GR_FRAME_POINTER])
4043 : #define hard_frame_pointer_rtx (global_rtl[GR_HARD_FRAME_POINTER])
4044 : #define arg_pointer_rtx (global_rtl[GR_ARG_POINTER])
4045 :
4046 : #ifndef GENERATOR_FILE
4047 : /* Return the attributes of a MEM rtx. */
4048 : inline const class mem_attrs *
4049 11649121552 : get_mem_attrs (const_rtx x)
4050 : {
4051 11649121552 : class mem_attrs *attrs;
4052 :
4053 3906571730 : attrs = MEM_ATTRS (x);
4054 9817277256 : if (!attrs)
4055 499120503 : attrs = mode_mem_attrs[(int) GET_MODE (x)];
4056 9781356123 : return attrs;
4057 : }
4058 : #endif
4059 :
4060 : /* Include the RTL generation functions. */
4061 :
4062 : #ifndef GENERATOR_FILE
4063 : #include "genrtl.h"
4064 : #undef gen_rtx_ASM_INPUT
4065 : #define gen_rtx_ASM_INPUT(MODE, ARG0) \
4066 : gen_rtx_fmt_sL (ASM_INPUT, (MODE), (ARG0), 0)
4067 : #define gen_rtx_ASM_INPUT_loc(MODE, ARG0, LOC) \
4068 : gen_rtx_fmt_sL (ASM_INPUT, (MODE), (ARG0), (LOC))
4069 : #endif
4070 :
4071 : /* There are some RTL codes that require special attention; the
4072 : generation functions included above do the raw handling. If you
4073 : add to this list, modify special_rtx in gengenrtl.cc as well. */
4074 :
4075 : extern rtx_expr_list *gen_rtx_EXPR_LIST (machine_mode, rtx, rtx);
4076 : extern rtx_insn_list *gen_rtx_INSN_LIST (machine_mode, rtx, rtx);
4077 : extern rtx_insn *
4078 : gen_rtx_INSN (machine_mode mode, rtx_insn *prev_insn, rtx_insn *next_insn,
4079 : basic_block bb, rtx pattern, location_t location, int code,
4080 : rtx reg_notes);
4081 : extern rtx gen_rtx_CONST_INT (machine_mode, HOST_WIDE_INT);
4082 : extern rtx gen_rtx_CONST_VECTOR (machine_mode, rtvec);
4083 : extern void set_mode_and_regno (rtx, machine_mode, unsigned int);
4084 : extern rtx init_raw_REG (rtx, machine_mode, unsigned int);
4085 : extern rtx gen_raw_REG (machine_mode, unsigned int);
4086 : #define alloca_raw_REG(mode, regno) \
4087 : init_raw_REG (rtx_alloca (REG), (mode), (regno))
4088 : extern rtx gen_rtx_REG (machine_mode, unsigned int);
4089 : extern rtx gen_rtx_SUBREG (machine_mode, rtx, poly_uint64);
4090 : extern rtx gen_rtx_MEM (machine_mode, rtx);
4091 : extern rtx gen_rtx_VAR_LOCATION (machine_mode, tree, rtx,
4092 : enum var_init_status);
4093 :
4094 : #ifdef GENERATOR_FILE
4095 : #define PUT_MODE(RTX, MODE) PUT_MODE_RAW (RTX, MODE)
4096 : #else
4097 : inline void
4098 1392930643 : PUT_MODE (rtx x, machine_mode mode)
4099 : {
4100 1392930643 : if (REG_P (x))
4101 344957687 : set_mode_and_regno (x, mode, REGNO (x));
4102 : else
4103 1047972956 : PUT_MODE_RAW (x, mode);
4104 1392930643 : }
4105 : #endif
4106 :
4107 : #define GEN_INT(N) gen_rtx_CONST_INT (VOIDmode, (N))
4108 :
4109 : /* Virtual registers are used during RTL generation to refer to locations into
4110 : the stack frame when the actual location isn't known until RTL generation
4111 : is complete. The routine instantiate_virtual_regs replaces these with
4112 : the proper value, which is normally {frame,arg,stack}_pointer_rtx plus
4113 : a constant. */
4114 :
4115 : #define FIRST_VIRTUAL_REGISTER (FIRST_PSEUDO_REGISTER)
4116 :
4117 : /* This points to the first word of the incoming arguments passed on the stack,
4118 : either by the caller or by the callee when pretending it was passed by the
4119 : caller. */
4120 :
4121 : #define virtual_incoming_args_rtx (global_rtl[GR_VIRTUAL_INCOMING_ARGS])
4122 :
4123 : #define VIRTUAL_INCOMING_ARGS_REGNUM (FIRST_VIRTUAL_REGISTER)
4124 :
4125 : /* If FRAME_GROWS_DOWNWARD, this points to immediately above the first
4126 : variable on the stack. Otherwise, it points to the first variable on
4127 : the stack. */
4128 :
4129 : #define virtual_stack_vars_rtx (global_rtl[GR_VIRTUAL_STACK_ARGS])
4130 :
4131 : #define VIRTUAL_STACK_VARS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 1)
4132 :
4133 : /* This points to the location of dynamically-allocated memory on the stack
4134 : immediately after the stack pointer has been adjusted by the amount
4135 : desired. */
4136 :
4137 : #define virtual_stack_dynamic_rtx (global_rtl[GR_VIRTUAL_STACK_DYNAMIC])
4138 :
4139 : #define VIRTUAL_STACK_DYNAMIC_REGNUM ((FIRST_VIRTUAL_REGISTER) + 2)
4140 :
4141 : /* This points to the location in the stack at which outgoing arguments should
4142 : be written when the stack is pre-pushed (arguments pushed using push
4143 : insns always use sp). */
4144 :
4145 : #define virtual_outgoing_args_rtx (global_rtl[GR_VIRTUAL_OUTGOING_ARGS])
4146 :
4147 : #define VIRTUAL_OUTGOING_ARGS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 3)
4148 :
4149 : /* This points to the Canonical Frame Address of the function. This
4150 : should correspond to the CFA produced by INCOMING_FRAME_SP_OFFSET,
4151 : but is calculated relative to the arg pointer for simplicity; the
4152 : frame pointer nor stack pointer are necessarily fixed relative to
4153 : the CFA until after reload. */
4154 :
4155 : #define virtual_cfa_rtx (global_rtl[GR_VIRTUAL_CFA])
4156 :
4157 : #define VIRTUAL_CFA_REGNUM ((FIRST_VIRTUAL_REGISTER) + 4)
4158 :
4159 : #define LAST_VIRTUAL_POINTER_REGISTER ((FIRST_VIRTUAL_REGISTER) + 4)
4160 :
4161 : /* This is replaced by crtl->preferred_stack_boundary / BITS_PER_UNIT
4162 : when finalized. */
4163 :
4164 : #define virtual_preferred_stack_boundary_rtx \
4165 : (global_rtl[GR_VIRTUAL_PREFERRED_STACK_BOUNDARY])
4166 :
4167 : #define VIRTUAL_PREFERRED_STACK_BOUNDARY_REGNUM \
4168 : ((FIRST_VIRTUAL_REGISTER) + 5)
4169 :
4170 : #define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 5)
4171 :
4172 : /* Nonzero if REGNUM is a pointer into the stack frame. */
4173 : #define REGNO_PTR_FRAME_P(REGNUM) \
4174 : ((REGNUM) == STACK_POINTER_REGNUM \
4175 : || (REGNUM) == FRAME_POINTER_REGNUM \
4176 : || (REGNUM) == HARD_FRAME_POINTER_REGNUM \
4177 : || (REGNUM) == ARG_POINTER_REGNUM \
4178 : || VIRTUAL_REGISTER_NUM_P (REGNUM))
4179 :
4180 : /* REGNUM never really appearing in the INSN stream. */
4181 : #define INVALID_REGNUM (~(unsigned int) 0)
4182 :
4183 : /* REGNUM for which no debug information can be generated. */
4184 : #define IGNORED_DWARF_REGNUM (INVALID_REGNUM - 1)
4185 :
4186 : extern rtx output_constant_def (tree, int);
4187 : extern rtx lookup_constant_def (tree);
4188 :
4189 : /* Nonzero after end of reload pass.
4190 : Set to 1 or 0 by reload1.cc. */
4191 :
4192 : extern int reload_completed;
4193 :
4194 : /* Nonzero after thread_prologue_and_epilogue_insns has run. */
4195 : extern int epilogue_completed;
4196 :
4197 : /* Set to true once the first split pass after register allocation has
4198 : been run. Ports can treat that split pass as a "lowering" pass,
4199 : with some instructions only being valid before the lowering
4200 : and others only being valid after the lowering.
4201 :
4202 : One use of this variable is to cope with address calculations during
4203 : register allocation. The register allocator needs to be able to perform
4204 : address arithmetic (such as addition) at arbitrary points in the program,
4205 : regardless of whether the condition-code flags are live at that point.
4206 : If a target cannot add without clobbering the condition-code flags,
4207 : it must either (1) hide the condition-code flags entirely from RTL
4208 : or (2) ensure that the condition-code flags are never live before
4209 : or during register allocation.
4210 :
4211 : (2) requires a boundary between "the condition-code flags are never live"
4212 : and "the condition-code flags might be live". reload_completed can be
4213 : used for this purpose, provided that all clobbers of the CC register
4214 : are explicit before and during register allocation.
4215 :
4216 : However, if the condition-code flags are never live before or during
4217 : register allocation, there is no real need for patterns to have an explicit
4218 : clobber of the flags at that point. Not having a clobber would allow more
4219 : recog attempts to succeed, both before and during register allocation.
4220 :
4221 : post_ra_split_completed is an alternative boundary to reload_completed.
4222 : It allows sets and uses of the condition-code flags, such as individual
4223 : comparison and jump instructions, to be introduced in the first split pass
4224 : after register allocation, while also allowing new implicit clobbers of
4225 : the condition-code flags to be introduced at any time before that point.
4226 :
4227 : Ports that use post_ra_split_completed for this purpose would have an
4228 : "unlowered" form with the following properties:
4229 :
4230 : (a) The condition-code flags are never live between instructions.
4231 : (That is, they are never defined by one instruction and used
4232 : by another instruction.)
4233 :
4234 : (b) As a consequence, new clobbers of the condition-code flags
4235 : can be introduced at any time.
4236 :
4237 : (c) RTL instruction patterns (such as addition) can omit clobbers of the
4238 : condition-code flags even if the flags are in fact clobbered.
4239 :
4240 : In contrast, the "lowered" form would have these properties:
4241 :
4242 : (d) The condition-code flags can be live between instructions.
4243 : That is, RTL instruction patterns can set the condition-code flags
4244 : or use the condition-code flags.
4245 :
4246 : (e) All clobbers of the condition-code flags must be explicit in the RTL
4247 : instruction patterns.
4248 :
4249 : Instructions covered by (c) would require !post_ra_split_completed
4250 : and would need to be split into instructions that satisfy (d) or (e).
4251 : Instructions covered by (d) would require post_ra_split_completed,
4252 : so that they are not accidentally matched before lowering has taken
4253 : place. */
4254 : extern bool post_ra_split_completed;
4255 :
4256 : /* Set to 1 while reload_as_needed is operating.
4257 : Required by some machines to handle any generated moves differently. */
4258 :
4259 : extern int reload_in_progress;
4260 :
4261 : /* Set to true while in IRA. */
4262 : extern bool ira_in_progress;
4263 :
4264 : /* Set to true while in LRA. */
4265 : extern bool lra_in_progress;
4266 :
4267 : /* This macro indicates whether you may create a new
4268 : pseudo-register. */
4269 :
4270 : #define can_create_pseudo_p() (!reload_in_progress && !reload_completed)
4271 :
4272 : #ifdef STACK_REGS
4273 : /* Nonzero after end of regstack pass.
4274 : Set to 1 or 0 by reg-stack.cc. */
4275 : extern int regstack_completed;
4276 : #endif
4277 :
4278 : /* If this is nonzero, we do not bother generating VOLATILE
4279 : around volatile memory references, and we are willing to
4280 : output indirect addresses. If cse is to follow, we reject
4281 : indirect addresses so a useful potential cse is generated;
4282 : if it is used only once, instruction combination will produce
4283 : the same indirect address eventually. */
4284 : extern int cse_not_expected;
4285 :
4286 : /* Translates rtx code to tree code, for those codes needed by
4287 : real_arithmetic. The function returns an int because the caller may not
4288 : know what `enum tree_code' means. */
4289 :
4290 : extern int rtx_to_tree_code (enum rtx_code);
4291 :
4292 : /* In cse.cc */
4293 : extern int delete_trivially_dead_insns (rtx_insn *, int);
4294 : extern bool exp_equiv_p (const_rtx, const_rtx, int, bool);
4295 :
4296 : typedef bool (*hash_rtx_callback_function) (const_rtx, machine_mode, rtx *,
4297 : machine_mode *);
4298 : extern unsigned hash_rtx (const_rtx, machine_mode, int *, int *,
4299 : bool, hash_rtx_callback_function = NULL);
4300 :
4301 : /* In dse.cc */
4302 : extern bool check_for_inc_dec (rtx_insn *insn);
4303 :
4304 : /* In jump.cc */
4305 : extern bool comparison_dominates_p (enum rtx_code, enum rtx_code);
4306 : extern bool jump_to_label_p (const rtx_insn *);
4307 : extern bool condjump_p (const rtx_insn *);
4308 : extern bool any_condjump_p (const rtx_insn *);
4309 : extern bool any_uncondjump_p (const rtx_insn *);
4310 : extern rtx pc_set (const rtx_insn *);
4311 : extern rtx condjump_label (const rtx_insn *);
4312 : extern bool simplejump_p (const rtx_insn *);
4313 : extern bool returnjump_p (const rtx_insn *);
4314 : extern bool eh_returnjump_p (rtx_insn *);
4315 : extern bool onlyjump_p (const rtx_insn *);
4316 : extern bool invert_jump_1 (rtx_jump_insn *, rtx);
4317 : extern bool invert_jump (rtx_jump_insn *, rtx, int);
4318 : extern bool rtx_renumbered_equal_p (const_rtx, const_rtx);
4319 : extern int true_regnum (const_rtx);
4320 : extern unsigned int reg_or_subregno (const_rtx);
4321 : extern bool redirect_jump_1 (rtx_insn *, rtx);
4322 : extern void redirect_jump_2 (rtx_jump_insn *, rtx, rtx, int, int);
4323 : extern bool redirect_jump (rtx_jump_insn *, rtx, int);
4324 : extern void rebuild_jump_labels (rtx_insn *);
4325 : extern void rebuild_jump_labels_chain (rtx_insn *);
4326 : extern rtx reversed_comparison (const_rtx, machine_mode);
4327 : extern enum rtx_code reversed_comparison_code (const_rtx, const rtx_insn *);
4328 : extern enum rtx_code reversed_comparison_code_parts (enum rtx_code, const_rtx,
4329 : const_rtx, const rtx_insn *);
4330 : extern void delete_for_peephole (rtx_insn *, rtx_insn *);
4331 : extern bool condjump_in_parallel_p (const rtx_insn *);
4332 :
4333 : /* In emit-rtl.cc. */
4334 : extern int max_reg_num (void);
4335 : extern int max_label_num (void);
4336 : extern int get_first_label_num (void);
4337 : extern void maybe_set_first_label_num (rtx_code_label *);
4338 : extern void delete_insns_since (rtx_insn *);
4339 : extern void mark_reg_pointer (rtx, int);
4340 : extern void mark_user_reg (rtx);
4341 : extern void reset_used_flags (rtx);
4342 : extern void set_used_flags (rtx);
4343 : extern void reorder_insns (rtx_insn *, rtx_insn *, rtx_insn *);
4344 : extern void reorder_insns_nobb (rtx_insn *, rtx_insn *, rtx_insn *);
4345 : extern int get_max_insn_count (void);
4346 : extern bool in_sequence_p (void);
4347 : extern void init_emit (void);
4348 : extern void init_emit_regs (void);
4349 : extern void init_derived_machine_modes (void);
4350 : extern void init_emit_once (void);
4351 : extern void push_topmost_sequence (void);
4352 : extern void pop_topmost_sequence (void);
4353 : extern void set_new_first_and_last_insn (rtx_insn *, rtx_insn *);
4354 : extern void unshare_all_rtl (void);
4355 : extern void unshare_all_rtl_again (rtx_insn *);
4356 : extern void unshare_all_rtl_in_chain (rtx_insn *);
4357 : extern void verify_rtl_sharing (void);
4358 : extern void add_insn (rtx_insn *);
4359 : extern void add_insn_before (rtx_insn *, rtx_insn *, basic_block);
4360 : extern void add_insn_after (rtx_insn *, rtx_insn *, basic_block);
4361 : extern void remove_insn (rtx_insn *);
4362 : extern rtx_insn *emit (rtx, bool = true);
4363 : extern void emit_insn_at_entry (rtx);
4364 : extern rtx gen_lowpart_SUBREG (machine_mode, rtx);
4365 : extern rtx gen_const_mem (machine_mode, rtx);
4366 : extern rtx gen_frame_mem (machine_mode, rtx);
4367 : extern rtx gen_tmp_stack_mem (machine_mode, rtx);
4368 : extern bool validate_subreg (machine_mode, machine_mode,
4369 : const_rtx, poly_uint64);
4370 :
4371 : /* In combine.cc */
4372 : extern unsigned int extended_count (const_rtx, machine_mode, bool);
4373 : extern rtx remove_death (unsigned int, rtx_insn *);
4374 : extern rtx make_compound_operation (rtx, enum rtx_code);
4375 :
4376 : /* In sched-rgn.cc. */
4377 : extern void schedule_insns (void);
4378 :
4379 : /* In sched-ebb.cc. */
4380 : extern void schedule_ebbs (void);
4381 :
4382 : /* In sel-sched-dump.cc. */
4383 : extern void sel_sched_fix_param (const char *param, const char *val);
4384 :
4385 : /* In print-rtl.cc */
4386 : extern const char *print_rtx_head;
4387 : extern void debug (const rtx_def &ref);
4388 : extern void debug (const rtx_def *ptr);
4389 : extern void debug_rtx (const_rtx);
4390 : extern void debug_rtx_list (const rtx_insn *, int);
4391 : extern void debug_rtx_range (const rtx_insn *, const rtx_insn *);
4392 : extern const rtx_insn *debug_rtx_find (const rtx_insn *, int);
4393 : extern void print_mem_expr (FILE *, const_tree);
4394 : extern void print_rtl (FILE *, const_rtx);
4395 : extern void print_simple_rtl (FILE *, const_rtx);
4396 : extern void print_rtl_single (FILE *, const_rtx);
4397 : extern void print_rtl_single_with_indent (FILE *, const_rtx, int);
4398 : extern void print_inline_rtx (FILE *, const_rtx, int);
4399 :
4400 : /* In stmt.cc */
4401 : extern void expand_null_return (void);
4402 : extern void expand_naked_return (void);
4403 : extern void emit_jump (rtx);
4404 :
4405 : /* Memory operation built-ins differ by return value. Mapping
4406 : of the enum values is following:
4407 : - RETURN_BEGIN - return destination, e.g. memcpy
4408 : - RETURN_END - return destination + n, e.g. mempcpy
4409 : - RETURN_END_MINUS_ONE - return a pointer to the terminating
4410 : null byte of the string, e.g. strcpy
4411 : */
4412 :
4413 : enum memop_ret
4414 : {
4415 : RETURN_BEGIN,
4416 : RETURN_END,
4417 : RETURN_END_MINUS_ONE
4418 : };
4419 :
4420 : /* In expr.cc */
4421 : extern rtx move_by_pieces (rtx, rtx, unsigned HOST_WIDE_INT,
4422 : unsigned int, memop_ret);
4423 : extern poly_int64 find_args_size_adjust (rtx_insn *);
4424 : extern poly_int64 fixup_args_size_notes (rtx_insn *, rtx_insn *, poly_int64);
4425 :
4426 : /* In expmed.cc */
4427 : extern void init_expmed (void);
4428 : extern void expand_inc (rtx, rtx);
4429 : extern void expand_dec (rtx, rtx);
4430 :
4431 : /* In lower-subreg.cc */
4432 : extern void init_lower_subreg (void);
4433 :
4434 : /* In gcse.cc */
4435 : extern bool can_copy_p (machine_mode);
4436 : extern bool can_assign_to_reg_without_clobbers_p (rtx, machine_mode);
4437 : extern rtx_insn *prepare_copy_insn (rtx, rtx);
4438 :
4439 : /* In cprop.cc */
4440 : extern rtx fis_get_condition (rtx_insn *);
4441 :
4442 : /* In ira.cc */
4443 : extern HARD_REG_SET eliminable_regset;
4444 : extern void mark_elimination (int, int);
4445 :
4446 : /* In reginfo.cc */
4447 : extern bool reg_classes_intersect_p (reg_class_t, reg_class_t);
4448 : extern bool reg_class_subset_p (reg_class_t, reg_class_t);
4449 : extern void globalize_reg (tree, int);
4450 : extern void init_reg_modes_target (void);
4451 : extern void init_regs (void);
4452 : extern void reinit_regs (void);
4453 : extern void init_fake_stack_mems (void);
4454 : extern void save_register_info (void);
4455 : extern void init_reg_sets (void);
4456 : extern void regclass (rtx, int);
4457 : extern void reg_scan (rtx_insn *, unsigned int);
4458 : extern void fix_register (const char *, int, int);
4459 : extern const HARD_REG_SET *valid_mode_changes_for_regno (unsigned int);
4460 :
4461 : /* In reload1.cc */
4462 : extern bool function_invariant_p (const_rtx);
4463 :
4464 : /* In calls.cc */
4465 : enum libcall_type
4466 : {
4467 : LCT_NORMAL = 0,
4468 : LCT_CONST = 1,
4469 : LCT_PURE = 2,
4470 : LCT_NORETURN = 3,
4471 : LCT_THROW = 4,
4472 : LCT_RETURNS_TWICE = 5
4473 : };
4474 :
4475 : extern rtx emit_library_call_value_1 (int, rtx, rtx, enum libcall_type,
4476 : machine_mode, int, rtx_mode_t *);
4477 :
4478 : /* Output a library call and discard the returned value. FUN is the
4479 : address of the function, as a SYMBOL_REF rtx, and OUTMODE is the mode
4480 : of the (discarded) return value. FN_TYPE is LCT_NORMAL for `normal'
4481 : calls, LCT_CONST for `const' calls, LCT_PURE for `pure' calls, or
4482 : another LCT_ value for other types of library calls.
4483 :
4484 : There are different overloads of this function for different numbers
4485 : of arguments. In each case the argument value is followed by its mode. */
4486 :
4487 : inline void
4488 0 : emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode)
4489 : {
4490 0 : emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 0, NULL);
4491 0 : }
4492 :
4493 : inline void
4494 0 : emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
4495 : rtx arg1, machine_mode arg1_mode)
4496 : {
4497 0 : rtx_mode_t args[] = { rtx_mode_t (arg1, arg1_mode) };
4498 0 : emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 1, args);
4499 0 : }
4500 :
4501 : inline void
4502 178 : emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
4503 : rtx arg1, machine_mode arg1_mode,
4504 : rtx arg2, machine_mode arg2_mode)
4505 : {
4506 178 : rtx_mode_t args[] = {
4507 : rtx_mode_t (arg1, arg1_mode),
4508 : rtx_mode_t (arg2, arg2_mode)
4509 178 : };
4510 178 : emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 2, args);
4511 178 : }
4512 :
4513 : inline void
4514 445 : emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
4515 : rtx arg1, machine_mode arg1_mode,
4516 : rtx arg2, machine_mode arg2_mode,
4517 : rtx arg3, machine_mode arg3_mode)
4518 : {
4519 445 : rtx_mode_t args[] = {
4520 : rtx_mode_t (arg1, arg1_mode),
4521 : rtx_mode_t (arg2, arg2_mode),
4522 : rtx_mode_t (arg3, arg3_mode)
4523 445 : };
4524 445 : emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 3, args);
4525 445 : }
4526 :
4527 : inline void
4528 : emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
4529 : rtx arg1, machine_mode arg1_mode,
4530 : rtx arg2, machine_mode arg2_mode,
4531 : rtx arg3, machine_mode arg3_mode,
4532 : rtx arg4, machine_mode arg4_mode)
4533 : {
4534 : rtx_mode_t args[] = {
4535 : rtx_mode_t (arg1, arg1_mode),
4536 : rtx_mode_t (arg2, arg2_mode),
4537 : rtx_mode_t (arg3, arg3_mode),
4538 : rtx_mode_t (arg4, arg4_mode)
4539 : };
4540 : emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 4, args);
4541 : }
4542 :
4543 : /* Like emit_library_call, but return the value produced by the call.
4544 : Use VALUE to store the result if it is nonnull, otherwise pick a
4545 : convenient location. */
4546 :
4547 : inline rtx
4548 16 : emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
4549 : machine_mode outmode)
4550 : {
4551 16 : return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 0, NULL);
4552 : }
4553 :
4554 : inline rtx
4555 44571 : emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
4556 : machine_mode outmode,
4557 : rtx arg1, machine_mode arg1_mode)
4558 : {
4559 44571 : rtx_mode_t args[] = { rtx_mode_t (arg1, arg1_mode) };
4560 44571 : return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 1, args);
4561 : }
4562 :
4563 : inline rtx
4564 76198 : emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
4565 : machine_mode outmode,
4566 : rtx arg1, machine_mode arg1_mode,
4567 : rtx arg2, machine_mode arg2_mode)
4568 : {
4569 76198 : rtx_mode_t args[] = {
4570 : rtx_mode_t (arg1, arg1_mode),
4571 : rtx_mode_t (arg2, arg2_mode)
4572 76198 : };
4573 76198 : return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 2, args);
4574 : }
4575 :
4576 : inline rtx
4577 892 : emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
4578 : machine_mode outmode,
4579 : rtx arg1, machine_mode arg1_mode,
4580 : rtx arg2, machine_mode arg2_mode,
4581 : rtx arg3, machine_mode arg3_mode)
4582 : {
4583 892 : rtx_mode_t args[] = {
4584 : rtx_mode_t (arg1, arg1_mode),
4585 : rtx_mode_t (arg2, arg2_mode),
4586 : rtx_mode_t (arg3, arg3_mode)
4587 892 : };
4588 892 : return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 3, args);
4589 : }
4590 :
4591 : inline rtx
4592 : emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
4593 : machine_mode outmode,
4594 : rtx arg1, machine_mode arg1_mode,
4595 : rtx arg2, machine_mode arg2_mode,
4596 : rtx arg3, machine_mode arg3_mode,
4597 : rtx arg4, machine_mode arg4_mode)
4598 : {
4599 : rtx_mode_t args[] = {
4600 : rtx_mode_t (arg1, arg1_mode),
4601 : rtx_mode_t (arg2, arg2_mode),
4602 : rtx_mode_t (arg3, arg3_mode),
4603 : rtx_mode_t (arg4, arg4_mode)
4604 : };
4605 : return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 4, args);
4606 : }
4607 :
4608 : /* In varasm.cc */
4609 : extern void init_varasm_once (void);
4610 :
4611 : extern rtx make_debug_expr_from_rtl (const_rtx);
4612 :
4613 : /* In read-rtl.cc */
4614 : #ifdef GENERATOR_FILE
4615 : extern bool read_rtx (const char *, vec<rtx> *);
4616 : #endif
4617 :
4618 : /* In alias.cc */
4619 : extern rtx canon_rtx (rtx);
4620 : extern rtx get_addr (rtx);
4621 : extern bool read_dependence (const_rtx, const_rtx);
4622 : extern bool true_dependence (const_rtx, machine_mode, const_rtx);
4623 : extern bool canon_true_dependence (const_rtx, machine_mode, rtx,
4624 : const_rtx, rtx);
4625 : extern bool anti_dependence (const_rtx, const_rtx);
4626 : extern bool canon_anti_dependence (const_rtx, bool,
4627 : const_rtx, machine_mode, rtx);
4628 : extern bool output_dependence (const_rtx, const_rtx);
4629 : extern bool canon_output_dependence (const_rtx, bool,
4630 : const_rtx, machine_mode, rtx);
4631 : extern bool may_alias_p (const_rtx, const_rtx);
4632 : extern void init_alias_target (void);
4633 : extern void init_alias_analysis (void);
4634 : extern void end_alias_analysis (void);
4635 : extern void vt_equate_reg_base_value (const_rtx, const_rtx);
4636 : extern bool memory_modified_in_insn_p (const_rtx, const_rtx);
4637 : extern bool may_be_sp_based_p (rtx);
4638 : extern rtx gen_hard_reg_clobber (machine_mode, unsigned int);
4639 : extern rtx get_reg_known_value (unsigned int);
4640 : extern bool get_reg_known_equiv_p (unsigned int);
4641 : extern rtx get_reg_base_value (unsigned int);
4642 : extern rtx extract_mem_from_operand (rtx);
4643 :
4644 : #ifdef STACK_REGS
4645 : extern bool stack_regs_mentioned (const rtx_insn *insn);
4646 : #endif
4647 :
4648 : /* In toplev.cc */
4649 : extern GTY(()) rtx stack_limit_rtx;
4650 :
4651 : /* In var-tracking.cc */
4652 : extern unsigned int variable_tracking_main (void);
4653 : extern void delete_vta_debug_insns (bool);
4654 :
4655 : /* In stor-layout.cc. */
4656 : extern void get_mode_bounds (scalar_int_mode, int,
4657 : scalar_int_mode, rtx *, rtx *);
4658 :
4659 : /* In loop-iv.cc */
4660 : extern rtx canon_condition (rtx);
4661 : extern void simplify_using_condition (rtx, rtx *, bitmap);
4662 :
4663 : /* In final.cc */
4664 : extern void compute_alignments (void);
4665 : extern void update_alignments (vec<rtx> &);
4666 : extern int asm_str_count (const char *templ);
4667 : extern rtx get_call_rtx_from (const rtx_insn *);
4668 :
4669 : struct rtl_hooks
4670 : {
4671 : rtx (*gen_lowpart) (machine_mode, rtx);
4672 : rtx (*gen_lowpart_no_emit) (machine_mode, rtx);
4673 : rtx (*reg_nonzero_bits) (const_rtx, scalar_int_mode, scalar_int_mode,
4674 : unsigned HOST_WIDE_INT *);
4675 : rtx (*reg_num_sign_bit_copies) (const_rtx, scalar_int_mode, scalar_int_mode,
4676 : unsigned int *);
4677 : bool (*reg_truncated_to_mode) (machine_mode, const_rtx);
4678 :
4679 : /* Whenever you add entries here, make sure you adjust rtlhooks-def.h. */
4680 : };
4681 :
4682 : /* Each pass can provide its own. */
4683 : extern struct rtl_hooks rtl_hooks;
4684 :
4685 : /* ... but then it has to restore these. */
4686 : extern const struct rtl_hooks general_rtl_hooks;
4687 :
4688 : /* Keep this for the nonce. */
4689 : #define gen_lowpart rtl_hooks.gen_lowpart
4690 :
4691 : extern void insn_locations_init (void);
4692 : extern void insn_locations_finalize (void);
4693 : extern void set_curr_insn_location (location_t);
4694 : extern location_t curr_insn_location (void);
4695 : extern void set_insn_locations (rtx_insn *, location_t);
4696 :
4697 : /* rtl-error.cc */
4698 : extern void _fatal_insn_not_found (const_rtx, const char *, int, const char *)
4699 : ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
4700 : extern void _fatal_insn (const char *, const_rtx, const char *, int, const char *)
4701 : ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
4702 :
4703 : #define fatal_insn(msgid, insn) \
4704 : _fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__)
4705 : #define fatal_insn_not_found(insn) \
4706 : _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__)
4707 :
4708 : /* reginfo.cc */
4709 : extern tree GTY(()) global_regs_decl[FIRST_PSEUDO_REGISTER];
4710 :
4711 : /* Information about the function that is propagated by the RTL backend.
4712 : Available only for functions that has been already assembled. */
4713 :
4714 : struct GTY(()) cgraph_rtl_info {
4715 : unsigned int preferred_incoming_stack_boundary;
4716 :
4717 : /* Which registers the function clobbers, either directly or by
4718 : calling another function. */
4719 : HARD_REG_SET function_used_regs;
4720 : };
4721 :
4722 : /* If loads from memories of mode MODE always sign or zero extend,
4723 : return SIGN_EXTEND or ZERO_EXTEND as appropriate. Return UNKNOWN
4724 : otherwise. */
4725 :
4726 : inline rtx_code
4727 35459 : load_extend_op (machine_mode mode)
4728 : {
4729 35459 : scalar_int_mode int_mode;
4730 35459 : if (is_a <scalar_int_mode> (mode, &int_mode)
4731 : && GET_MODE_PRECISION (int_mode) < BITS_PER_WORD)
4732 : return LOAD_EXTEND_OP (int_mode);
4733 : return UNKNOWN;
4734 : }
4735 :
4736 : /* If X is a PLUS of a base and a constant offset, add the constant to *OFFSET
4737 : and return the base. Return X otherwise. */
4738 :
4739 : inline rtx
4740 112842965 : strip_offset_and_add (rtx x, poly_int64 *offset)
4741 : {
4742 112842965 : if (GET_CODE (x) == PLUS)
4743 : {
4744 60268189 : poly_int64 suboffset;
4745 60268189 : x = strip_offset (x, &suboffset);
4746 120536378 : *offset = poly_uint64 (*offset) + suboffset;
4747 : }
4748 112842965 : return x;
4749 : }
4750 :
4751 : /* Return true if X is an operation that always operates on the full
4752 : registers for WORD_REGISTER_OPERATIONS architectures. */
4753 :
4754 : inline bool
4755 : word_register_operation_p (const_rtx x)
4756 : {
4757 : switch (GET_CODE (x))
4758 : {
4759 : case CONST_INT:
4760 : case ROTATE:
4761 : case ROTATERT:
4762 : case SIGN_EXTRACT:
4763 : case ZERO_EXTRACT:
4764 : return false;
4765 :
4766 : default:
4767 : return true;
4768 : }
4769 : }
4770 :
4771 : /* Holds an rtx comparison to simplify passing many parameters pertaining to a
4772 : single comparison. */
4773 :
4774 : struct rtx_comparison {
4775 : rtx_code code;
4776 : rtx op0, op1;
4777 : machine_mode mode;
4778 : };
4779 :
4780 : /* gtype-desc.cc. */
4781 : extern void gt_ggc_mx (rtx &);
4782 : extern void gt_pch_nx (rtx &);
4783 : extern void gt_pch_nx (rtx &, gt_pointer_operator, void *);
4784 :
4785 : #endif /* ! GCC_RTL_H */
|