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