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