2014-06-25 Marc Glisse <marc.glisse@inria.fr>
[official-gcc.git] / gcc / rtl.h
blob6ec91a890a616224e26d4ec73cee37ef898aebd7
1 /* Register Transfer Language (RTL) definitions for GCC
2 Copyright (C) 1987-2014 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_RTL_H
21 #define GCC_RTL_H
23 #include <utility>
24 #include "statistics.h"
25 #include "machmode.h"
26 #include "input.h"
27 #include "real.h"
28 #include "vec.h"
29 #include "fixed-value.h"
30 #include "alias.h"
31 #include "hashtab.h"
32 #include "wide-int.h"
33 #include "flags.h"
35 /* Value used by some passes to "recognize" noop moves as valid
36 instructions. */
37 #define NOOP_MOVE_INSN_CODE INT_MAX
39 /* Register Transfer Language EXPRESSIONS CODES */
41 #define RTX_CODE enum rtx_code
42 enum rtx_code {
44 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) ENUM ,
45 #include "rtl.def" /* rtl expressions are documented here */
46 #undef DEF_RTL_EXPR
48 LAST_AND_UNUSED_RTX_CODE}; /* A convenient way to get a value for
49 NUM_RTX_CODE.
50 Assumes default enum value assignment. */
52 /* The cast here, saves many elsewhere. */
53 #define NUM_RTX_CODE ((int) LAST_AND_UNUSED_RTX_CODE)
55 /* Similar, but since generator files get more entries... */
56 #ifdef GENERATOR_FILE
57 # define NON_GENERATOR_NUM_RTX_CODE ((int) MATCH_OPERAND)
58 #endif
60 /* Register Transfer Language EXPRESSIONS CODE CLASSES */
62 enum rtx_class {
63 /* We check bit 0-1 of some rtx class codes in the predicates below. */
65 /* Bit 0 = comparison if 0, arithmetic is 1
66 Bit 1 = 1 if commutative. */
67 RTX_COMPARE, /* 0 */
68 RTX_COMM_COMPARE,
69 RTX_BIN_ARITH,
70 RTX_COMM_ARITH,
72 /* Must follow the four preceding values. */
73 RTX_UNARY, /* 4 */
75 RTX_EXTRA,
76 RTX_MATCH,
77 RTX_INSN,
79 /* Bit 0 = 1 if constant. */
80 RTX_OBJ, /* 8 */
81 RTX_CONST_OBJ,
83 RTX_TERNARY,
84 RTX_BITFIELD_OPS,
85 RTX_AUTOINC
88 #define RTX_OBJ_MASK (~1)
89 #define RTX_OBJ_RESULT (RTX_OBJ & RTX_OBJ_MASK)
90 #define RTX_COMPARE_MASK (~1)
91 #define RTX_COMPARE_RESULT (RTX_COMPARE & RTX_COMPARE_MASK)
92 #define RTX_ARITHMETIC_MASK (~1)
93 #define RTX_ARITHMETIC_RESULT (RTX_COMM_ARITH & RTX_ARITHMETIC_MASK)
94 #define RTX_BINARY_MASK (~3)
95 #define RTX_BINARY_RESULT (RTX_COMPARE & RTX_BINARY_MASK)
96 #define RTX_COMMUTATIVE_MASK (~2)
97 #define RTX_COMMUTATIVE_RESULT (RTX_COMM_COMPARE & RTX_COMMUTATIVE_MASK)
98 #define RTX_NON_COMMUTATIVE_RESULT (RTX_COMPARE & RTX_COMMUTATIVE_MASK)
100 extern const unsigned char rtx_length[NUM_RTX_CODE];
101 #define GET_RTX_LENGTH(CODE) (rtx_length[(int) (CODE)])
103 extern const char * const rtx_name[NUM_RTX_CODE];
104 #define GET_RTX_NAME(CODE) (rtx_name[(int) (CODE)])
106 extern const char * const rtx_format[NUM_RTX_CODE];
107 #define GET_RTX_FORMAT(CODE) (rtx_format[(int) (CODE)])
109 extern const enum rtx_class rtx_class[NUM_RTX_CODE];
110 #define GET_RTX_CLASS(CODE) (rtx_class[(int) (CODE)])
112 /* True if CODE is part of the insn chain (i.e. has INSN_UID, PREV_INSN
113 and NEXT_INSN fields). */
114 #define INSN_CHAIN_CODE_P(CODE) IN_RANGE (CODE, DEBUG_INSN, NOTE)
116 extern const unsigned char rtx_code_size[NUM_RTX_CODE];
117 extern const unsigned char rtx_next[NUM_RTX_CODE];
119 /* The flags and bitfields of an ADDR_DIFF_VEC. BASE is the base label
120 relative to which the offsets are calculated, as explained in rtl.def. */
121 struct addr_diff_vec_flags
123 /* Set at the start of shorten_branches - ONLY WHEN OPTIMIZING - : */
124 unsigned min_align: 8;
125 /* Flags: */
126 unsigned base_after_vec: 1; /* BASE is after the ADDR_DIFF_VEC. */
127 unsigned min_after_vec: 1; /* minimum address target label is
128 after the ADDR_DIFF_VEC. */
129 unsigned max_after_vec: 1; /* maximum address target label is
130 after the ADDR_DIFF_VEC. */
131 unsigned min_after_base: 1; /* minimum address target label is
132 after BASE. */
133 unsigned max_after_base: 1; /* maximum address target label is
134 after BASE. */
135 /* Set by the actual branch shortening process - ONLY WHEN OPTIMIZING - : */
136 unsigned offset_unsigned: 1; /* offsets have to be treated as unsigned. */
137 unsigned : 2;
138 unsigned scale : 8;
141 /* Structure used to describe the attributes of a MEM. These are hashed
142 so MEMs that the same attributes share a data structure. This means
143 they cannot be modified in place. */
144 struct GTY(()) mem_attrs
146 /* The expression that the MEM accesses, or null if not known.
147 This expression might be larger than the memory reference itself.
148 (In other words, the MEM might access only part of the object.) */
149 tree expr;
151 /* The offset of the memory reference from the start of EXPR.
152 Only valid if OFFSET_KNOWN_P. */
153 HOST_WIDE_INT offset;
155 /* The size of the memory reference in bytes. Only valid if
156 SIZE_KNOWN_P. */
157 HOST_WIDE_INT size;
159 /* The alias set of the memory reference. */
160 alias_set_type alias;
162 /* The alignment of the reference in bits. Always a multiple of
163 BITS_PER_UNIT. Note that EXPR may have a stricter alignment
164 than the memory reference itself. */
165 unsigned int align;
167 /* The address space that the memory reference uses. */
168 unsigned char addrspace;
170 /* True if OFFSET is known. */
171 bool offset_known_p;
173 /* True if SIZE is known. */
174 bool size_known_p;
177 /* Structure used to describe the attributes of a REG in similar way as
178 mem_attrs does for MEM above. Note that the OFFSET field is calculated
179 in the same way as for mem_attrs, rather than in the same way as a
180 SUBREG_BYTE. For example, if a big-endian target stores a byte
181 object in the low part of a 4-byte register, the OFFSET field
182 will be -3 rather than 0. */
184 struct GTY(()) reg_attrs {
185 tree decl; /* decl corresponding to REG. */
186 HOST_WIDE_INT offset; /* Offset from start of DECL. */
189 /* Common union for an element of an rtx. */
191 union rtunion
193 int rt_int;
194 unsigned int rt_uint;
195 const char *rt_str;
196 rtx rt_rtx;
197 rtvec rt_rtvec;
198 enum machine_mode rt_type;
199 addr_diff_vec_flags rt_addr_diff_vec_flags;
200 struct cselib_val *rt_cselib;
201 tree rt_tree;
202 basic_block rt_bb;
203 mem_attrs *rt_mem;
204 reg_attrs *rt_reg;
205 struct constant_descriptor_rtx *rt_constant;
206 struct dw_cfi_node *rt_cfi;
209 /* This structure remembers the position of a SYMBOL_REF within an
210 object_block structure. A SYMBOL_REF only provides this information
211 if SYMBOL_REF_HAS_BLOCK_INFO_P is true. */
212 struct GTY(()) block_symbol {
213 /* The usual SYMBOL_REF fields. */
214 rtunion GTY ((skip)) fld[2];
216 /* The block that contains this object. */
217 struct object_block *block;
219 /* The offset of this object from the start of its block. It is negative
220 if the symbol has not yet been assigned an offset. */
221 HOST_WIDE_INT offset;
224 /* Describes a group of objects that are to be placed together in such
225 a way that their relative positions are known. */
226 struct GTY(()) object_block {
227 /* The section in which these objects should be placed. */
228 section *sect;
230 /* The alignment of the first object, measured in bits. */
231 unsigned int alignment;
233 /* The total size of the objects, measured in bytes. */
234 HOST_WIDE_INT size;
236 /* The SYMBOL_REFs for each object. The vector is sorted in
237 order of increasing offset and the following conditions will
238 hold for each element X:
240 SYMBOL_REF_HAS_BLOCK_INFO_P (X)
241 !SYMBOL_REF_ANCHOR_P (X)
242 SYMBOL_REF_BLOCK (X) == [address of this structure]
243 SYMBOL_REF_BLOCK_OFFSET (X) >= 0. */
244 vec<rtx, va_gc> *objects;
246 /* All the anchor SYMBOL_REFs used to address these objects, sorted
247 in order of increasing offset, and then increasing TLS model.
248 The following conditions will hold for each element X in this vector:
250 SYMBOL_REF_HAS_BLOCK_INFO_P (X)
251 SYMBOL_REF_ANCHOR_P (X)
252 SYMBOL_REF_BLOCK (X) == [address of this structure]
253 SYMBOL_REF_BLOCK_OFFSET (X) >= 0. */
254 vec<rtx, va_gc> *anchors;
257 struct GTY((variable_size)) hwivec_def {
258 HOST_WIDE_INT elem[1];
261 /* Number of elements of the HWIVEC if RTX is a CONST_WIDE_INT. */
262 #define CWI_GET_NUM_ELEM(RTX) \
263 ((int)RTL_FLAG_CHECK1("CWI_GET_NUM_ELEM", (RTX), CONST_WIDE_INT)->u2.num_elem)
264 #define CWI_PUT_NUM_ELEM(RTX, NUM) \
265 (RTL_FLAG_CHECK1("CWI_PUT_NUM_ELEM", (RTX), CONST_WIDE_INT)->u2.num_elem = (NUM))
267 /* RTL expression ("rtx"). */
269 struct GTY((chain_next ("RTX_NEXT (&%h)"),
270 chain_prev ("RTX_PREV (&%h)"))) rtx_def {
271 /* The kind of expression this is. */
272 ENUM_BITFIELD(rtx_code) code: 16;
274 /* The kind of value the expression has. */
275 ENUM_BITFIELD(machine_mode) mode : 8;
277 /* 1 in a MEM if we should keep the alias set for this mem unchanged
278 when we access a component.
279 1 in a JUMP_INSN if it is a crossing jump.
280 1 in a CALL_INSN if it is a sibling call.
281 1 in a SET that is for a return.
282 In a CODE_LABEL, part of the two-bit alternate entry field.
283 1 in a CONCAT is VAL_EXPR_IS_COPIED in var-tracking.c.
284 1 in a VALUE is SP_BASED_VALUE_P in cselib.c.
285 1 in a SUBREG generated by LRA for reload insns. */
286 unsigned int jump : 1;
287 /* In a CODE_LABEL, part of the two-bit alternate entry field.
288 1 in a MEM if it cannot trap.
289 1 in a CALL_INSN logically equivalent to
290 ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P. */
291 unsigned int call : 1;
292 /* 1 in a REG, MEM, or CONCAT if the value is set at most once, anywhere.
293 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P.
294 1 in a SYMBOL_REF if it addresses something in the per-function
295 constants pool.
296 1 in a CALL_INSN logically equivalent to ECF_CONST and TREE_READONLY.
297 1 in a NOTE, or EXPR_LIST for a const call.
298 1 in a JUMP_INSN of an annulling branch.
299 1 in a CONCAT is VAL_EXPR_IS_CLOBBERED in var-tracking.c.
300 1 in a preserved VALUE is PRESERVED_VALUE_P in cselib.c.
301 1 in a clobber temporarily created for LRA. */
302 unsigned int unchanging : 1;
303 /* 1 in a MEM or ASM_OPERANDS expression if the memory reference is volatile.
304 1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL, BARRIER, or NOTE
305 if it has been deleted.
306 1 in a REG expression if corresponds to a variable declared by the user,
307 0 for an internally generated temporary.
308 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P.
309 1 in a LABEL_REF, REG_LABEL_TARGET or REG_LABEL_OPERAND note for a
310 non-local label.
311 In a SYMBOL_REF, this flag is used for machine-specific purposes.
312 In a PREFETCH, this flag indicates that it should be considered a scheduling
313 barrier.
314 1 in a CONCAT is VAL_NEEDS_RESOLUTION in var-tracking.c. */
315 unsigned int volatil : 1;
316 /* 1 in a REG if the register is used only in exit code a loop.
317 1 in a SUBREG expression if was generated from a variable with a
318 promoted mode.
319 1 in a CODE_LABEL if the label is used for nonlocal gotos
320 and must not be deleted even if its count is zero.
321 1 in an INSN, JUMP_INSN or CALL_INSN if this insn must be scheduled
322 together with the preceding insn. Valid only within sched.
323 1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and
324 from the target of a branch. Valid from reorg until end of compilation;
325 cleared before used.
327 The name of the field is historical. It used to be used in MEMs
328 to record whether the MEM accessed part of a structure. */
329 unsigned int in_struct : 1;
330 /* At the end of RTL generation, 1 if this rtx is used. This is used for
331 copying shared structure. See `unshare_all_rtl'.
332 In a REG, this is not needed for that purpose, and used instead
333 in `leaf_renumber_regs_insn'.
334 1 in a SYMBOL_REF, means that emit_library_call
335 has used it as the function.
336 1 in a CONCAT is VAL_HOLDS_TRACK_EXPR in var-tracking.c.
337 1 in a VALUE or DEBUG_EXPR is VALUE_RECURSED_INTO in var-tracking.c. */
338 unsigned int used : 1;
339 /* 1 in an INSN or a SET if this rtx is related to the call frame,
340 either changing how we compute the frame address or saving and
341 restoring registers in the prologue and epilogue.
342 1 in a REG or MEM if it is a pointer.
343 1 in a SYMBOL_REF if it addresses something in the per-function
344 constant string pool.
345 1 in a VALUE is VALUE_CHANGED in var-tracking.c. */
346 unsigned frame_related : 1;
347 /* 1 in a REG or PARALLEL that is the current function's return value.
348 1 in a SYMBOL_REF for a weak symbol.
349 1 in a CALL_INSN logically equivalent to ECF_PURE and DECL_PURE_P.
350 1 in a CONCAT is VAL_EXPR_HAS_REVERSE in var-tracking.c.
351 1 in a VALUE or DEBUG_EXPR is NO_LOC_P in var-tracking.c. */
352 unsigned return_val : 1;
354 union {
355 /* The final union field is aligned to 64 bits on LP64 hosts,
356 giving a 32-bit gap after the fields above. We optimize the
357 layout for that case and use the gap for extra code-specific
358 information. */
360 /* The ORIGINAL_REGNO of a REG. */
361 unsigned int original_regno;
363 /* The INSN_UID of an RTX_INSN-class code. */
364 int insn_uid;
366 /* The SYMBOL_REF_FLAGS of a SYMBOL_REF. */
367 unsigned int symbol_ref_flags;
369 /* The PAT_VAR_LOCATION_STATUS of a VAR_LOCATION. */
370 enum var_init_status var_location_status;
372 /* In a CONST_WIDE_INT (aka hwivec_def), this is the number of
373 HOST_WIDE_INTs in the hwivec_def. */
374 unsigned int num_elem;
375 } GTY ((skip)) u2;
377 /* The first element of the operands of this rtx.
378 The number of operands and their types are controlled
379 by the `code' field, according to rtl.def. */
380 union u {
381 rtunion fld[1];
382 HOST_WIDE_INT hwint[1];
383 struct block_symbol block_sym;
384 struct real_value rv;
385 struct fixed_value fv;
386 struct hwivec_def hwiv;
387 } GTY ((special ("rtx_def"), desc ("GET_CODE (&%0)"))) u;
390 /* The size in bytes of an rtx header (code, mode and flags). */
391 #define RTX_HDR_SIZE offsetof (struct rtx_def, u)
393 /* The size in bytes of an rtx with code CODE. */
394 #define RTX_CODE_SIZE(CODE) rtx_code_size[CODE]
396 #define NULL_RTX (rtx) 0
398 /* The "next" and "previous" RTX, relative to this one. */
400 #define RTX_NEXT(X) (rtx_next[GET_CODE (X)] == 0 ? NULL \
401 : *(rtx *)(((char *)X) + rtx_next[GET_CODE (X)]))
403 /* FIXME: the "NEXT_INSN (PREV_INSN (X)) == X" condition shouldn't be needed.
405 #define RTX_PREV(X) ((INSN_P (X) \
406 || NOTE_P (X) \
407 || JUMP_TABLE_DATA_P (X) \
408 || BARRIER_P (X) \
409 || LABEL_P (X)) \
410 && PREV_INSN (X) != NULL \
411 && NEXT_INSN (PREV_INSN (X)) == X \
412 ? PREV_INSN (X) : NULL)
414 /* Define macros to access the `code' field of the rtx. */
416 #define GET_CODE(RTX) ((enum rtx_code) (RTX)->code)
417 #define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE))
419 #define GET_MODE(RTX) ((enum machine_mode) (RTX)->mode)
420 #define PUT_MODE(RTX, MODE) ((RTX)->mode = (MODE))
422 /* RTL vector. These appear inside RTX's when there is a need
423 for a variable number of things. The principle use is inside
424 PARALLEL expressions. */
426 struct GTY(()) rtvec_def {
427 int num_elem; /* number of elements */
428 rtx GTY ((length ("%h.num_elem"))) elem[1];
431 #define NULL_RTVEC (rtvec) 0
433 #define GET_NUM_ELEM(RTVEC) ((RTVEC)->num_elem)
434 #define PUT_NUM_ELEM(RTVEC, NUM) ((RTVEC)->num_elem = (NUM))
436 /* Predicate yielding nonzero iff X is an rtx for a register. */
437 #define REG_P(X) (GET_CODE (X) == REG)
439 /* Predicate yielding nonzero iff X is an rtx for a memory location. */
440 #define MEM_P(X) (GET_CODE (X) == MEM)
442 #if TARGET_SUPPORTS_WIDE_INT
444 /* Match CONST_*s that can represent compile-time constant integers. */
445 #define CASE_CONST_SCALAR_INT \
446 case CONST_INT: \
447 case CONST_WIDE_INT
449 /* Match CONST_*s for which pointer equality corresponds to value
450 equality. */
451 #define CASE_CONST_UNIQUE \
452 case CONST_INT: \
453 case CONST_WIDE_INT: \
454 case CONST_DOUBLE: \
455 case CONST_FIXED
457 /* Match all CONST_* rtxes. */
458 #define CASE_CONST_ANY \
459 case CONST_INT: \
460 case CONST_WIDE_INT: \
461 case CONST_DOUBLE: \
462 case CONST_FIXED: \
463 case CONST_VECTOR
465 #else
467 /* Match CONST_*s that can represent compile-time constant integers. */
468 #define CASE_CONST_SCALAR_INT \
469 case CONST_INT: \
470 case CONST_DOUBLE
472 /* Match CONST_*s for which pointer equality corresponds to value
473 equality. */
474 #define CASE_CONST_UNIQUE \
475 case CONST_INT: \
476 case CONST_DOUBLE: \
477 case CONST_FIXED
479 /* Match all CONST_* rtxes. */
480 #define CASE_CONST_ANY \
481 case CONST_INT: \
482 case CONST_DOUBLE: \
483 case CONST_FIXED: \
484 case CONST_VECTOR
485 #endif
487 /* Predicate yielding nonzero iff X is an rtx for a constant integer. */
488 #define CONST_INT_P(X) (GET_CODE (X) == CONST_INT)
490 /* Predicate yielding nonzero iff X is an rtx for a constant integer. */
491 #define CONST_WIDE_INT_P(X) (GET_CODE (X) == CONST_WIDE_INT)
493 /* Predicate yielding nonzero iff X is an rtx for a constant fixed-point. */
494 #define CONST_FIXED_P(X) (GET_CODE (X) == CONST_FIXED)
496 /* Predicate yielding true iff X is an rtx for a double-int
497 or floating point constant. */
498 #define CONST_DOUBLE_P(X) (GET_CODE (X) == CONST_DOUBLE)
500 /* Predicate yielding true iff X is an rtx for a double-int. */
501 #define CONST_DOUBLE_AS_INT_P(X) \
502 (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == VOIDmode)
504 /* Predicate yielding true iff X is an rtx for a integer const. */
505 #if TARGET_SUPPORTS_WIDE_INT
506 #define CONST_SCALAR_INT_P(X) \
507 (CONST_INT_P (X) || CONST_WIDE_INT_P (X))
508 #else
509 #define CONST_SCALAR_INT_P(X) \
510 (CONST_INT_P (X) || CONST_DOUBLE_AS_INT_P (X))
511 #endif
513 /* Predicate yielding true iff X is an rtx for a double-int. */
514 #define CONST_DOUBLE_AS_FLOAT_P(X) \
515 (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode)
517 /* Predicate yielding nonzero iff X is a label insn. */
518 #define LABEL_P(X) (GET_CODE (X) == CODE_LABEL)
520 /* Predicate yielding nonzero iff X is a jump insn. */
521 #define JUMP_P(X) (GET_CODE (X) == JUMP_INSN)
523 /* Predicate yielding nonzero iff X is a call insn. */
524 #define CALL_P(X) (GET_CODE (X) == CALL_INSN)
526 /* Predicate yielding nonzero iff X is an insn that cannot jump. */
527 #define NONJUMP_INSN_P(X) (GET_CODE (X) == INSN)
529 /* Predicate yielding nonzero iff X is a debug note/insn. */
530 #define DEBUG_INSN_P(X) (GET_CODE (X) == DEBUG_INSN)
532 /* Predicate yielding nonzero iff X is an insn that is not a debug insn. */
533 #define NONDEBUG_INSN_P(X) (INSN_P (X) && !DEBUG_INSN_P (X))
535 /* Nonzero if DEBUG_INSN_P may possibly hold. */
536 #define MAY_HAVE_DEBUG_INSNS (flag_var_tracking_assignments)
538 /* Predicate yielding nonzero iff X is a real insn. */
539 #define INSN_P(X) \
540 (NONJUMP_INSN_P (X) || DEBUG_INSN_P (X) || JUMP_P (X) || CALL_P (X))
542 /* Predicate yielding nonzero iff X is a note insn. */
543 #define NOTE_P(X) (GET_CODE (X) == NOTE)
545 /* Predicate yielding nonzero iff X is a barrier insn. */
546 #define BARRIER_P(X) (GET_CODE (X) == BARRIER)
548 /* Predicate yielding nonzero iff X is a data for a jump table. */
549 #define JUMP_TABLE_DATA_P(INSN) (GET_CODE (INSN) == JUMP_TABLE_DATA)
551 /* Predicate yielding nonzero iff X is a return or simple_return. */
552 #define ANY_RETURN_P(X) \
553 (GET_CODE (X) == RETURN || GET_CODE (X) == SIMPLE_RETURN)
555 /* 1 if X is a unary operator. */
557 #define UNARY_P(X) \
558 (GET_RTX_CLASS (GET_CODE (X)) == RTX_UNARY)
560 /* 1 if X is a binary operator. */
562 #define BINARY_P(X) \
563 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_BINARY_MASK) == RTX_BINARY_RESULT)
565 /* 1 if X is an arithmetic operator. */
567 #define ARITHMETIC_P(X) \
568 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_ARITHMETIC_MASK) \
569 == RTX_ARITHMETIC_RESULT)
571 /* 1 if X is an arithmetic operator. */
573 #define COMMUTATIVE_ARITH_P(X) \
574 (GET_RTX_CLASS (GET_CODE (X)) == RTX_COMM_ARITH)
576 /* 1 if X is a commutative arithmetic operator or a comparison operator.
577 These two are sometimes selected together because it is possible to
578 swap the two operands. */
580 #define SWAPPABLE_OPERANDS_P(X) \
581 ((1 << GET_RTX_CLASS (GET_CODE (X))) \
582 & ((1 << RTX_COMM_ARITH) | (1 << RTX_COMM_COMPARE) \
583 | (1 << RTX_COMPARE)))
585 /* 1 if X is a non-commutative operator. */
587 #define NON_COMMUTATIVE_P(X) \
588 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \
589 == RTX_NON_COMMUTATIVE_RESULT)
591 /* 1 if X is a commutative operator on integers. */
593 #define COMMUTATIVE_P(X) \
594 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \
595 == RTX_COMMUTATIVE_RESULT)
597 /* 1 if X is a relational operator. */
599 #define COMPARISON_P(X) \
600 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMPARE_MASK) == RTX_COMPARE_RESULT)
602 /* 1 if X is a constant value that is an integer. */
604 #define CONSTANT_P(X) \
605 (GET_RTX_CLASS (GET_CODE (X)) == RTX_CONST_OBJ)
607 /* 1 if X can be used to represent an object. */
608 #define OBJECT_P(X) \
609 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_OBJ_MASK) == RTX_OBJ_RESULT)
611 /* General accessor macros for accessing the fields of an rtx. */
613 #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
614 /* The bit with a star outside the statement expr and an & inside is
615 so that N can be evaluated only once. */
616 #define RTL_CHECK1(RTX, N, C1) __extension__ \
617 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
618 const enum rtx_code _code = GET_CODE (_rtx); \
619 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
620 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
621 __FUNCTION__); \
622 if (GET_RTX_FORMAT (_code)[_n] != C1) \
623 rtl_check_failed_type1 (_rtx, _n, C1, __FILE__, __LINE__, \
624 __FUNCTION__); \
625 &_rtx->u.fld[_n]; }))
627 #define RTL_CHECK2(RTX, N, C1, C2) __extension__ \
628 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
629 const enum rtx_code _code = GET_CODE (_rtx); \
630 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
631 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
632 __FUNCTION__); \
633 if (GET_RTX_FORMAT (_code)[_n] != C1 \
634 && GET_RTX_FORMAT (_code)[_n] != C2) \
635 rtl_check_failed_type2 (_rtx, _n, C1, C2, __FILE__, __LINE__, \
636 __FUNCTION__); \
637 &_rtx->u.fld[_n]; }))
639 #define RTL_CHECKC1(RTX, N, C) __extension__ \
640 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
641 if (GET_CODE (_rtx) != (C)) \
642 rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
643 __FUNCTION__); \
644 &_rtx->u.fld[_n]; }))
646 #define RTL_CHECKC2(RTX, N, C1, C2) __extension__ \
647 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
648 const enum rtx_code _code = GET_CODE (_rtx); \
649 if (_code != (C1) && _code != (C2)) \
650 rtl_check_failed_code2 (_rtx, (C1), (C2), __FILE__, __LINE__, \
651 __FUNCTION__); \
652 &_rtx->u.fld[_n]; }))
654 #define RTVEC_ELT(RTVEC, I) __extension__ \
655 (*({ __typeof (RTVEC) const _rtvec = (RTVEC); const int _i = (I); \
656 if (_i < 0 || _i >= GET_NUM_ELEM (_rtvec)) \
657 rtvec_check_failed_bounds (_rtvec, _i, __FILE__, __LINE__, \
658 __FUNCTION__); \
659 &_rtvec->elem[_i]; }))
661 #define XWINT(RTX, N) __extension__ \
662 (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
663 const enum rtx_code _code = GET_CODE (_rtx); \
664 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
665 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
666 __FUNCTION__); \
667 if (GET_RTX_FORMAT (_code)[_n] != 'w') \
668 rtl_check_failed_type1 (_rtx, _n, 'w', __FILE__, __LINE__, \
669 __FUNCTION__); \
670 &_rtx->u.hwint[_n]; }))
672 #define CWI_ELT(RTX, I) __extension__ \
673 (*({ __typeof (RTX) const _cwi = (RTX); \
674 int _max = CWI_GET_NUM_ELEM (_cwi); \
675 const int _i = (I); \
676 if (_i < 0 || _i >= _max) \
677 cwi_check_failed_bounds (_cwi, _i, __FILE__, __LINE__, \
678 __FUNCTION__); \
679 &_cwi->u.hwiv.elem[_i]; }))
681 #define XCWINT(RTX, N, C) __extension__ \
682 (*({ __typeof (RTX) const _rtx = (RTX); \
683 if (GET_CODE (_rtx) != (C)) \
684 rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
685 __FUNCTION__); \
686 &_rtx->u.hwint[N]; }))
688 #define XCMWINT(RTX, N, C, M) __extension__ \
689 (*({ __typeof (RTX) const _rtx = (RTX); \
690 if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) != (M)) \
691 rtl_check_failed_code_mode (_rtx, (C), (M), false, __FILE__, \
692 __LINE__, __FUNCTION__); \
693 &_rtx->u.hwint[N]; }))
695 #define XCNMPRV(RTX, C, M) __extension__ \
696 ({ __typeof (RTX) const _rtx = (RTX); \
697 if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \
698 rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \
699 __LINE__, __FUNCTION__); \
700 &_rtx->u.rv; })
702 #define XCNMPFV(RTX, C, M) __extension__ \
703 ({ __typeof (RTX) const _rtx = (RTX); \
704 if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \
705 rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \
706 __LINE__, __FUNCTION__); \
707 &_rtx->u.fv; })
709 #define BLOCK_SYMBOL_CHECK(RTX) __extension__ \
710 ({ __typeof (RTX) const _symbol = (RTX); \
711 const unsigned int flags = SYMBOL_REF_FLAGS (_symbol); \
712 if ((flags & SYMBOL_FLAG_HAS_BLOCK_INFO) == 0) \
713 rtl_check_failed_block_symbol (__FILE__, __LINE__, \
714 __FUNCTION__); \
715 &_symbol->u.block_sym; })
717 #define HWIVEC_CHECK(RTX,C) __extension__ \
718 ({ __typeof (RTX) const _symbol = (RTX); \
719 RTL_CHECKC1 (_symbol, 0, C); \
720 &_symbol->u.hwiv; })
722 extern void rtl_check_failed_bounds (const_rtx, int, const char *, int,
723 const char *)
724 ATTRIBUTE_NORETURN;
725 extern void rtl_check_failed_type1 (const_rtx, int, int, const char *, int,
726 const char *)
727 ATTRIBUTE_NORETURN;
728 extern void rtl_check_failed_type2 (const_rtx, int, int, int, const char *,
729 int, const char *)
730 ATTRIBUTE_NORETURN;
731 extern void rtl_check_failed_code1 (const_rtx, enum rtx_code, const char *,
732 int, const char *)
733 ATTRIBUTE_NORETURN;
734 extern void rtl_check_failed_code2 (const_rtx, enum rtx_code, enum rtx_code,
735 const char *, int, const char *)
736 ATTRIBUTE_NORETURN;
737 extern void rtl_check_failed_code_mode (const_rtx, enum rtx_code, enum machine_mode,
738 bool, const char *, int, const char *)
739 ATTRIBUTE_NORETURN;
740 extern void rtl_check_failed_block_symbol (const char *, int, const char *)
741 ATTRIBUTE_NORETURN;
742 extern void cwi_check_failed_bounds (const_rtx, int, const char *, int,
743 const char *)
744 ATTRIBUTE_NORETURN;
745 extern void rtvec_check_failed_bounds (const_rtvec, int, const char *, int,
746 const char *)
747 ATTRIBUTE_NORETURN;
749 #else /* not ENABLE_RTL_CHECKING */
751 #define RTL_CHECK1(RTX, N, C1) ((RTX)->u.fld[N])
752 #define RTL_CHECK2(RTX, N, C1, C2) ((RTX)->u.fld[N])
753 #define RTL_CHECKC1(RTX, N, C) ((RTX)->u.fld[N])
754 #define RTL_CHECKC2(RTX, N, C1, C2) ((RTX)->u.fld[N])
755 #define RTVEC_ELT(RTVEC, I) ((RTVEC)->elem[I])
756 #define XWINT(RTX, N) ((RTX)->u.hwint[N])
757 #define CWI_ELT(RTX, I) ((RTX)->u.hwiv.elem[I])
758 #define XCWINT(RTX, N, C) ((RTX)->u.hwint[N])
759 #define XCMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
760 #define XCNMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
761 #define XCNMPRV(RTX, C, M) (&(RTX)->u.rv)
762 #define XCNMPFV(RTX, C, M) (&(RTX)->u.fv)
763 #define BLOCK_SYMBOL_CHECK(RTX) (&(RTX)->u.block_sym)
764 #define HWIVEC_CHECK(RTX,C) (&(RTX)->u.hwiv)
766 #endif
768 /* General accessor macros for accessing the flags of an rtx. */
770 /* Access an individual rtx flag, with no checking of any kind. */
771 #define RTX_FLAG(RTX, FLAG) ((RTX)->FLAG)
773 #if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION >= 2007)
774 #define RTL_FLAG_CHECK1(NAME, RTX, C1) __extension__ \
775 ({ __typeof (RTX) const _rtx = (RTX); \
776 if (GET_CODE (_rtx) != C1) \
777 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
778 __FUNCTION__); \
779 _rtx; })
781 #define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) __extension__ \
782 ({ __typeof (RTX) const _rtx = (RTX); \
783 if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2) \
784 rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
785 __FUNCTION__); \
786 _rtx; })
788 #define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) __extension__ \
789 ({ __typeof (RTX) const _rtx = (RTX); \
790 if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \
791 && GET_CODE (_rtx) != C3) \
792 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
793 __FUNCTION__); \
794 _rtx; })
796 #define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) __extension__ \
797 ({ __typeof (RTX) const _rtx = (RTX); \
798 if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \
799 && GET_CODE (_rtx) != C3 && GET_CODE(_rtx) != C4) \
800 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
801 __FUNCTION__); \
802 _rtx; })
804 #define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) __extension__ \
805 ({ __typeof (RTX) const _rtx = (RTX); \
806 if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
807 && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
808 && GET_CODE (_rtx) != C5) \
809 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
810 __FUNCTION__); \
811 _rtx; })
813 #define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) \
814 __extension__ \
815 ({ __typeof (RTX) const _rtx = (RTX); \
816 if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
817 && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
818 && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6) \
819 rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
820 __FUNCTION__); \
821 _rtx; })
823 #define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) \
824 __extension__ \
825 ({ __typeof (RTX) const _rtx = (RTX); \
826 if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
827 && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
828 && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6 \
829 && GET_CODE (_rtx) != C7) \
830 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
831 __FUNCTION__); \
832 _rtx; })
834 #define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) \
835 __extension__ \
836 ({ __typeof (RTX) const _rtx = (RTX); \
837 if (!INSN_CHAIN_CODE_P (GET_CODE (_rtx))) \
838 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
839 __FUNCTION__); \
840 _rtx; })
842 extern void rtl_check_failed_flag (const char *, const_rtx, const char *,
843 int, const char *)
844 ATTRIBUTE_NORETURN
847 #else /* not ENABLE_RTL_FLAG_CHECKING */
849 #define RTL_FLAG_CHECK1(NAME, RTX, C1) (RTX)
850 #define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) (RTX)
851 #define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) (RTX)
852 #define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) (RTX)
853 #define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) (RTX)
854 #define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) (RTX)
855 #define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) (RTX)
856 #define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) (RTX)
857 #endif
859 #define XINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rt_int)
860 #define XUINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rt_uint)
861 #define XSTR(RTX, N) (RTL_CHECK2 (RTX, N, 's', 'S').rt_str)
862 #define XEXP(RTX, N) (RTL_CHECK2 (RTX, N, 'e', 'u').rt_rtx)
863 #define XVEC(RTX, N) (RTL_CHECK2 (RTX, N, 'E', 'V').rt_rtvec)
864 #define XMODE(RTX, N) (RTL_CHECK1 (RTX, N, 'M').rt_type)
865 #define XTREE(RTX, N) (RTL_CHECK1 (RTX, N, 't').rt_tree)
866 #define XBBDEF(RTX, N) (RTL_CHECK1 (RTX, N, 'B').rt_bb)
867 #define XTMPL(RTX, N) (RTL_CHECK1 (RTX, N, 'T').rt_str)
868 #define XCFI(RTX, N) (RTL_CHECK1 (RTX, N, 'C').rt_cfi)
870 #define XVECEXP(RTX, N, M) RTVEC_ELT (XVEC (RTX, N), M)
871 #define XVECLEN(RTX, N) GET_NUM_ELEM (XVEC (RTX, N))
873 /* These are like XINT, etc. except that they expect a '0' field instead
874 of the normal type code. */
876 #define X0INT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_int)
877 #define X0UINT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_uint)
878 #define X0STR(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_str)
879 #define X0EXP(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtx)
880 #define X0VEC(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtvec)
881 #define X0MODE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_type)
882 #define X0TREE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_tree)
883 #define X0BBDEF(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_bb)
884 #define X0ADVFLAGS(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_addr_diff_vec_flags)
885 #define X0CSELIB(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_cselib)
886 #define X0MEMATTR(RTX, N) (RTL_CHECKC1 (RTX, N, MEM).rt_mem)
887 #define X0REGATTR(RTX, N) (RTL_CHECKC1 (RTX, N, REG).rt_reg)
888 #define X0CONSTANT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_constant)
890 /* Access a '0' field with any type. */
891 #define X0ANY(RTX, N) RTL_CHECK1 (RTX, N, '0')
893 #define XCINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_int)
894 #define XCUINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_uint)
895 #define XCSTR(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_str)
896 #define XCEXP(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtx)
897 #define XCVEC(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtvec)
898 #define XCMODE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_type)
899 #define XCTREE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_tree)
900 #define XCBBDEF(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_bb)
901 #define XCCFI(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_cfi)
902 #define XCCSELIB(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_cselib)
904 #define XCVECEXP(RTX, N, M, C) RTVEC_ELT (XCVEC (RTX, N, C), M)
905 #define XCVECLEN(RTX, N, C) GET_NUM_ELEM (XCVEC (RTX, N, C))
907 #define XC2EXP(RTX, N, C1, C2) (RTL_CHECKC2 (RTX, N, C1, C2).rt_rtx)
909 /* ACCESS MACROS for particular fields of insns. */
911 /* Holds a unique number for each insn.
912 These are not necessarily sequentially increasing. */
913 #define INSN_UID(INSN) \
914 (RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID", (INSN))->u2.insn_uid)
916 /* Chain insns together in sequence. */
917 #define PREV_INSN(INSN) XEXP (INSN, 0)
918 #define NEXT_INSN(INSN) XEXP (INSN, 1)
920 #define BLOCK_FOR_INSN(INSN) XBBDEF (INSN, 2)
922 /* The body of an insn. */
923 #define PATTERN(INSN) XEXP (INSN, 3)
925 #define INSN_LOCATION(INSN) XUINT (INSN, 4)
927 #define INSN_HAS_LOCATION(INSN) ((LOCATION_LOCUS (INSN_LOCATION (INSN)))\
928 != UNKNOWN_LOCATION)
930 /* LOCATION of an RTX if relevant. */
931 #define RTL_LOCATION(X) (INSN_P (X) ? \
932 INSN_LOCATION (X) : UNKNOWN_LOCATION)
934 /* Code number of instruction, from when it was recognized.
935 -1 means this instruction has not been recognized yet. */
936 #define INSN_CODE(INSN) XINT (INSN, 5)
938 #define RTX_FRAME_RELATED_P(RTX) \
939 (RTL_FLAG_CHECK6 ("RTX_FRAME_RELATED_P", (RTX), DEBUG_INSN, INSN, \
940 CALL_INSN, JUMP_INSN, BARRIER, SET)->frame_related)
942 /* 1 if RTX is an insn that has been deleted. */
943 #define INSN_DELETED_P(RTX) \
944 (RTL_INSN_CHAIN_FLAG_CHECK ("INSN_DELETED_P", (RTX))->volatil)
946 /* 1 if JUMP RTX is a crossing jump. */
947 #define CROSSING_JUMP_P(RTX) \
948 (RTL_FLAG_CHECK1 ("CROSSING_JUMP_P", (RTX), JUMP_INSN)->jump)
950 /* 1 if RTX is a call to a const function. Built from ECF_CONST and
951 TREE_READONLY. */
952 #define RTL_CONST_CALL_P(RTX) \
953 (RTL_FLAG_CHECK1 ("RTL_CONST_CALL_P", (RTX), CALL_INSN)->unchanging)
955 /* 1 if RTX is a call to a pure function. Built from ECF_PURE and
956 DECL_PURE_P. */
957 #define RTL_PURE_CALL_P(RTX) \
958 (RTL_FLAG_CHECK1 ("RTL_PURE_CALL_P", (RTX), CALL_INSN)->return_val)
960 /* 1 if RTX is a call to a const or pure function. */
961 #define RTL_CONST_OR_PURE_CALL_P(RTX) \
962 (RTL_CONST_CALL_P (RTX) || RTL_PURE_CALL_P (RTX))
964 /* 1 if RTX is a call to a looping const or pure function. Built from
965 ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P. */
966 #define RTL_LOOPING_CONST_OR_PURE_CALL_P(RTX) \
967 (RTL_FLAG_CHECK1 ("CONST_OR_PURE_CALL_P", (RTX), CALL_INSN)->call)
969 /* 1 if RTX is a call_insn for a sibling call. */
970 #define SIBLING_CALL_P(RTX) \
971 (RTL_FLAG_CHECK1 ("SIBLING_CALL_P", (RTX), CALL_INSN)->jump)
973 /* 1 if RTX is a jump_insn, call_insn, or insn that is an annulling branch. */
974 #define INSN_ANNULLED_BRANCH_P(RTX) \
975 (RTL_FLAG_CHECK1 ("INSN_ANNULLED_BRANCH_P", (RTX), JUMP_INSN)->unchanging)
977 /* 1 if RTX is an insn in a delay slot and is from the target of the branch.
978 If the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be
979 executed if the branch is taken. For annulled branches with this bit
980 clear, the insn should be executed only if the branch is not taken. */
981 #define INSN_FROM_TARGET_P(RTX) \
982 (RTL_FLAG_CHECK3 ("INSN_FROM_TARGET_P", (RTX), INSN, JUMP_INSN, \
983 CALL_INSN)->in_struct)
985 /* In an ADDR_DIFF_VEC, the flags for RTX for use by branch shortening.
986 See the comments for ADDR_DIFF_VEC in rtl.def. */
987 #define ADDR_DIFF_VEC_FLAGS(RTX) X0ADVFLAGS (RTX, 4)
989 /* In a VALUE, the value cselib has assigned to RTX.
990 This is a "struct cselib_val", see cselib.h. */
991 #define CSELIB_VAL_PTR(RTX) X0CSELIB (RTX, 0)
993 /* Holds a list of notes on what this insn does to various REGs.
994 It is a chain of EXPR_LIST rtx's, where the second operand is the
995 chain pointer and the first operand is the REG being described.
996 The mode field of the EXPR_LIST contains not a real machine mode
997 but a value from enum reg_note. */
998 #define REG_NOTES(INSN) XEXP(INSN, 6)
1000 /* In an ENTRY_VALUE this is the DECL_INCOMING_RTL of the argument in
1001 question. */
1002 #define ENTRY_VALUE_EXP(RTX) (RTL_CHECKC1 (RTX, 0, ENTRY_VALUE).rt_rtx)
1004 enum reg_note
1006 #define DEF_REG_NOTE(NAME) NAME,
1007 #include "reg-notes.def"
1008 #undef DEF_REG_NOTE
1009 REG_NOTE_MAX
1012 /* Define macros to extract and insert the reg-note kind in an EXPR_LIST. */
1013 #define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK))
1014 #define PUT_REG_NOTE_KIND(LINK, KIND) \
1015 PUT_MODE (LINK, (enum machine_mode) (KIND))
1017 /* Names for REG_NOTE's in EXPR_LIST insn's. */
1019 extern const char * const reg_note_name[];
1020 #define GET_REG_NOTE_NAME(MODE) (reg_note_name[(int) (MODE)])
1022 /* This field is only present on CALL_INSNs. It holds a chain of EXPR_LIST of
1023 USE and CLOBBER expressions.
1024 USE expressions list the registers filled with arguments that
1025 are passed to the function.
1026 CLOBBER expressions document the registers explicitly clobbered
1027 by this CALL_INSN.
1028 Pseudo registers can not be mentioned in this list. */
1029 #define CALL_INSN_FUNCTION_USAGE(INSN) XEXP(INSN, 7)
1031 /* The label-number of a code-label. The assembler label
1032 is made from `L' and the label-number printed in decimal.
1033 Label numbers are unique in a compilation. */
1034 #define CODE_LABEL_NUMBER(INSN) XINT (INSN, 5)
1036 /* In a NOTE that is a line number, this is a string for the file name that the
1037 line is in. We use the same field to record block numbers temporarily in
1038 NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes. (We avoid lots of casts
1039 between ints and pointers if we use a different macro for the block number.)
1042 /* Opaque data. */
1043 #define NOTE_DATA(INSN) RTL_CHECKC1 (INSN, 3, NOTE)
1044 #define NOTE_DELETED_LABEL_NAME(INSN) XCSTR (INSN, 3, NOTE)
1045 #define SET_INSN_DELETED(INSN) set_insn_deleted (INSN);
1046 #define NOTE_BLOCK(INSN) XCTREE (INSN, 3, NOTE)
1047 #define NOTE_EH_HANDLER(INSN) XCINT (INSN, 3, NOTE)
1048 #define NOTE_BASIC_BLOCK(INSN) XCBBDEF (INSN, 3, NOTE)
1049 #define NOTE_VAR_LOCATION(INSN) XCEXP (INSN, 3, NOTE)
1050 #define NOTE_CFI(INSN) XCCFI (INSN, 3, NOTE)
1051 #define NOTE_LABEL_NUMBER(INSN) XCINT (INSN, 3, NOTE)
1053 /* In a NOTE that is a line number, this is the line number.
1054 Other kinds of NOTEs are identified by negative numbers here. */
1055 #define NOTE_KIND(INSN) XCINT (INSN, 4, NOTE)
1057 /* Nonzero if INSN is a note marking the beginning of a basic block. */
1058 #define NOTE_INSN_BASIC_BLOCK_P(INSN) \
1059 (NOTE_P (INSN) && NOTE_KIND (INSN) == NOTE_INSN_BASIC_BLOCK)
1061 /* Variable declaration and the location of a variable. */
1062 #define PAT_VAR_LOCATION_DECL(PAT) (XCTREE ((PAT), 0, VAR_LOCATION))
1063 #define PAT_VAR_LOCATION_LOC(PAT) (XCEXP ((PAT), 1, VAR_LOCATION))
1065 /* Initialization status of the variable in the location. Status
1066 can be unknown, uninitialized or initialized. See enumeration
1067 type below. */
1068 #define PAT_VAR_LOCATION_STATUS(PAT) \
1069 (RTL_FLAG_CHECK1 ("PAT_VAR_LOCATION_STATUS", PAT, VAR_LOCATION) \
1070 ->u2.var_location_status)
1072 /* Accessors for a NOTE_INSN_VAR_LOCATION. */
1073 #define NOTE_VAR_LOCATION_DECL(NOTE) \
1074 PAT_VAR_LOCATION_DECL (NOTE_VAR_LOCATION (NOTE))
1075 #define NOTE_VAR_LOCATION_LOC(NOTE) \
1076 PAT_VAR_LOCATION_LOC (NOTE_VAR_LOCATION (NOTE))
1077 #define NOTE_VAR_LOCATION_STATUS(NOTE) \
1078 PAT_VAR_LOCATION_STATUS (NOTE_VAR_LOCATION (NOTE))
1080 /* The VAR_LOCATION rtx in a DEBUG_INSN. */
1081 #define INSN_VAR_LOCATION(INSN) PATTERN (INSN)
1083 /* Accessors for a tree-expanded var location debug insn. */
1084 #define INSN_VAR_LOCATION_DECL(INSN) \
1085 PAT_VAR_LOCATION_DECL (INSN_VAR_LOCATION (INSN))
1086 #define INSN_VAR_LOCATION_LOC(INSN) \
1087 PAT_VAR_LOCATION_LOC (INSN_VAR_LOCATION (INSN))
1088 #define INSN_VAR_LOCATION_STATUS(INSN) \
1089 PAT_VAR_LOCATION_STATUS (INSN_VAR_LOCATION (INSN))
1091 /* Expand to the RTL that denotes an unknown variable location in a
1092 DEBUG_INSN. */
1093 #define gen_rtx_UNKNOWN_VAR_LOC() (gen_rtx_CLOBBER (VOIDmode, const0_rtx))
1095 /* Determine whether X is such an unknown location. */
1096 #define VAR_LOC_UNKNOWN_P(X) \
1097 (GET_CODE (X) == CLOBBER && XEXP ((X), 0) == const0_rtx)
1099 /* 1 if RTX is emitted after a call, but it should take effect before
1100 the call returns. */
1101 #define NOTE_DURING_CALL_P(RTX) \
1102 (RTL_FLAG_CHECK1 ("NOTE_VAR_LOCATION_DURING_CALL_P", (RTX), NOTE)->call)
1104 /* DEBUG_EXPR_DECL corresponding to a DEBUG_EXPR RTX. */
1105 #define DEBUG_EXPR_TREE_DECL(RTX) XCTREE (RTX, 0, DEBUG_EXPR)
1107 /* VAR_DECL/PARM_DECL DEBUG_IMPLICIT_PTR takes address of. */
1108 #define DEBUG_IMPLICIT_PTR_DECL(RTX) XCTREE (RTX, 0, DEBUG_IMPLICIT_PTR)
1110 /* PARM_DECL DEBUG_PARAMETER_REF references. */
1111 #define DEBUG_PARAMETER_REF_DECL(RTX) XCTREE (RTX, 0, DEBUG_PARAMETER_REF)
1113 /* Codes that appear in the NOTE_KIND field for kinds of notes
1114 that are not line numbers. These codes are all negative.
1116 Notice that we do not try to use zero here for any of
1117 the special note codes because sometimes the source line
1118 actually can be zero! This happens (for example) when we
1119 are generating code for the per-translation-unit constructor
1120 and destructor routines for some C++ translation unit. */
1122 enum insn_note
1124 #define DEF_INSN_NOTE(NAME) NAME,
1125 #include "insn-notes.def"
1126 #undef DEF_INSN_NOTE
1128 NOTE_INSN_MAX
1131 /* Names for NOTE insn's other than line numbers. */
1133 extern const char * const note_insn_name[NOTE_INSN_MAX];
1134 #define GET_NOTE_INSN_NAME(NOTE_CODE) \
1135 (note_insn_name[(NOTE_CODE)])
1137 /* The name of a label, in case it corresponds to an explicit label
1138 in the input source code. */
1139 #define LABEL_NAME(RTX) XCSTR (RTX, 6, CODE_LABEL)
1141 /* In jump.c, each label contains a count of the number
1142 of LABEL_REFs that point at it, so unused labels can be deleted. */
1143 #define LABEL_NUSES(RTX) XCINT (RTX, 4, CODE_LABEL)
1145 /* Labels carry a two-bit field composed of the ->jump and ->call
1146 bits. This field indicates whether the label is an alternate
1147 entry point, and if so, what kind. */
1148 enum label_kind
1150 LABEL_NORMAL = 0, /* ordinary label */
1151 LABEL_STATIC_ENTRY, /* alternate entry point, not exported */
1152 LABEL_GLOBAL_ENTRY, /* alternate entry point, exported */
1153 LABEL_WEAK_ENTRY /* alternate entry point, exported as weak symbol */
1156 #if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION > 2007)
1158 /* Retrieve the kind of LABEL. */
1159 #define LABEL_KIND(LABEL) __extension__ \
1160 ({ __typeof (LABEL) const _label = (LABEL); \
1161 if (! LABEL_P (_label)) \
1162 rtl_check_failed_flag ("LABEL_KIND", _label, __FILE__, __LINE__, \
1163 __FUNCTION__); \
1164 (enum label_kind) ((_label->jump << 1) | _label->call); })
1166 /* Set the kind of LABEL. */
1167 #define SET_LABEL_KIND(LABEL, KIND) do { \
1168 __typeof (LABEL) const _label = (LABEL); \
1169 const unsigned int _kind = (KIND); \
1170 if (! LABEL_P (_label)) \
1171 rtl_check_failed_flag ("SET_LABEL_KIND", _label, __FILE__, __LINE__, \
1172 __FUNCTION__); \
1173 _label->jump = ((_kind >> 1) & 1); \
1174 _label->call = (_kind & 1); \
1175 } while (0)
1177 #else
1179 /* Retrieve the kind of LABEL. */
1180 #define LABEL_KIND(LABEL) \
1181 ((enum label_kind) (((LABEL)->jump << 1) | (LABEL)->call))
1183 /* Set the kind of LABEL. */
1184 #define SET_LABEL_KIND(LABEL, KIND) do { \
1185 rtx const _label = (LABEL); \
1186 const unsigned int _kind = (KIND); \
1187 _label->jump = ((_kind >> 1) & 1); \
1188 _label->call = (_kind & 1); \
1189 } while (0)
1191 #endif /* rtl flag checking */
1193 #define LABEL_ALT_ENTRY_P(LABEL) (LABEL_KIND (LABEL) != LABEL_NORMAL)
1195 /* In jump.c, each JUMP_INSN can point to a label that it can jump to,
1196 so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
1197 be decremented and possibly the label can be deleted. */
1198 #define JUMP_LABEL(INSN) XCEXP (INSN, 7, JUMP_INSN)
1200 /* Once basic blocks are found, each CODE_LABEL starts a chain that
1201 goes through all the LABEL_REFs that jump to that label. The chain
1202 eventually winds up at the CODE_LABEL: it is circular. */
1203 #define LABEL_REFS(LABEL) XCEXP (LABEL, 3, CODE_LABEL)
1205 /* For a REG rtx, REGNO extracts the register number. REGNO can only
1206 be used on RHS. Use SET_REGNO to change the value. */
1207 #define REGNO(RTX) (rhs_regno(RTX))
1208 #define SET_REGNO(RTX,N) \
1209 (df_ref_change_reg_with_loc (REGNO (RTX), N, RTX), XCUINT (RTX, 0, REG) = N)
1210 #define SET_REGNO_RAW(RTX,N) (XCUINT (RTX, 0, REG) = N)
1212 /* ORIGINAL_REGNO holds the number the register originally had; for a
1213 pseudo register turned into a hard reg this will hold the old pseudo
1214 register number. */
1215 #define ORIGINAL_REGNO(RTX) \
1216 (RTL_FLAG_CHECK1 ("ORIGINAL_REGNO", (RTX), REG)->u2.original_regno)
1218 /* Force the REGNO macro to only be used on the lhs. */
1219 static inline unsigned int
1220 rhs_regno (const_rtx x)
1222 return XCUINT (x, 0, REG);
1226 /* 1 if RTX is a reg or parallel that is the current function's return
1227 value. */
1228 #define REG_FUNCTION_VALUE_P(RTX) \
1229 (RTL_FLAG_CHECK2 ("REG_FUNCTION_VALUE_P", (RTX), REG, PARALLEL)->return_val)
1231 /* 1 if RTX is a reg that corresponds to a variable declared by the user. */
1232 #define REG_USERVAR_P(RTX) \
1233 (RTL_FLAG_CHECK1 ("REG_USERVAR_P", (RTX), REG)->volatil)
1235 /* 1 if RTX is a reg that holds a pointer value. */
1236 #define REG_POINTER(RTX) \
1237 (RTL_FLAG_CHECK1 ("REG_POINTER", (RTX), REG)->frame_related)
1239 /* 1 if RTX is a mem that holds a pointer value. */
1240 #define MEM_POINTER(RTX) \
1241 (RTL_FLAG_CHECK1 ("MEM_POINTER", (RTX), MEM)->frame_related)
1243 /* 1 if the given register REG corresponds to a hard register. */
1244 #define HARD_REGISTER_P(REG) (HARD_REGISTER_NUM_P (REGNO (REG)))
1246 /* 1 if the given register number REG_NO corresponds to a hard register. */
1247 #define HARD_REGISTER_NUM_P(REG_NO) ((REG_NO) < FIRST_PSEUDO_REGISTER)
1249 /* For a CONST_INT rtx, INTVAL extracts the integer. */
1250 #define INTVAL(RTX) XCWINT (RTX, 0, CONST_INT)
1251 #define UINTVAL(RTX) ((unsigned HOST_WIDE_INT) INTVAL (RTX))
1253 /* For a CONST_WIDE_INT, CONST_WIDE_INT_NUNITS is the number of
1254 elements actually needed to represent the constant.
1255 CONST_WIDE_INT_ELT gets one of the elements. 0 is the least
1256 significant HOST_WIDE_INT. */
1257 #define CONST_WIDE_INT_VEC(RTX) HWIVEC_CHECK (RTX, CONST_WIDE_INT)
1258 #define CONST_WIDE_INT_NUNITS(RTX) CWI_GET_NUM_ELEM (RTX)
1259 #define CONST_WIDE_INT_ELT(RTX, N) CWI_ELT (RTX, N)
1261 /* For a CONST_DOUBLE:
1262 #if TARGET_SUPPORTS_WIDE_INT == 0
1263 For a VOIDmode, there are two integers CONST_DOUBLE_LOW is the
1264 low-order word and ..._HIGH the high-order.
1265 #endif
1266 For a float, there is a REAL_VALUE_TYPE structure, and
1267 CONST_DOUBLE_REAL_VALUE(r) is a pointer to it. */
1268 #define CONST_DOUBLE_LOW(r) XCMWINT (r, 0, CONST_DOUBLE, VOIDmode)
1269 #define CONST_DOUBLE_HIGH(r) XCMWINT (r, 1, CONST_DOUBLE, VOIDmode)
1270 #define CONST_DOUBLE_REAL_VALUE(r) \
1271 ((const struct real_value *) XCNMPRV (r, CONST_DOUBLE, VOIDmode))
1273 #define CONST_FIXED_VALUE(r) \
1274 ((const struct fixed_value *) XCNMPFV (r, CONST_FIXED, VOIDmode))
1275 #define CONST_FIXED_VALUE_HIGH(r) \
1276 ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.high))
1277 #define CONST_FIXED_VALUE_LOW(r) \
1278 ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.low))
1280 /* For a CONST_VECTOR, return element #n. */
1281 #define CONST_VECTOR_ELT(RTX, N) XCVECEXP (RTX, 0, N, CONST_VECTOR)
1283 /* For a CONST_VECTOR, return the number of elements in a vector. */
1284 #define CONST_VECTOR_NUNITS(RTX) XCVECLEN (RTX, 0, CONST_VECTOR)
1286 /* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of.
1287 SUBREG_BYTE extracts the byte-number. */
1289 #define SUBREG_REG(RTX) XCEXP (RTX, 0, SUBREG)
1290 #define SUBREG_BYTE(RTX) XCUINT (RTX, 1, SUBREG)
1292 /* in rtlanal.c */
1293 /* Return the right cost to give to an operation
1294 to make the cost of the corresponding register-to-register instruction
1295 N times that of a fast register-to-register instruction. */
1296 #define COSTS_N_INSNS(N) ((N) * 4)
1298 /* Maximum cost of an rtl expression. This value has the special meaning
1299 not to use an rtx with this cost under any circumstances. */
1300 #define MAX_COST INT_MAX
1302 /* A structure to hold all available cost information about an rtl
1303 expression. */
1304 struct full_rtx_costs
1306 int speed;
1307 int size;
1310 /* Initialize a full_rtx_costs structure C to the maximum cost. */
1311 static inline void
1312 init_costs_to_max (struct full_rtx_costs *c)
1314 c->speed = MAX_COST;
1315 c->size = MAX_COST;
1318 /* Initialize a full_rtx_costs structure C to zero cost. */
1319 static inline void
1320 init_costs_to_zero (struct full_rtx_costs *c)
1322 c->speed = 0;
1323 c->size = 0;
1326 /* Compare two full_rtx_costs structures A and B, returning true
1327 if A < B when optimizing for speed. */
1328 static inline bool
1329 costs_lt_p (struct full_rtx_costs *a, struct full_rtx_costs *b,
1330 bool speed)
1332 if (speed)
1333 return (a->speed < b->speed
1334 || (a->speed == b->speed && a->size < b->size));
1335 else
1336 return (a->size < b->size
1337 || (a->size == b->size && a->speed < b->speed));
1340 /* Increase both members of the full_rtx_costs structure C by the
1341 cost of N insns. */
1342 static inline void
1343 costs_add_n_insns (struct full_rtx_costs *c, int n)
1345 c->speed += COSTS_N_INSNS (n);
1346 c->size += COSTS_N_INSNS (n);
1349 /* Information about an address. This structure is supposed to be able
1350 to represent all supported target addresses. Please extend it if it
1351 is not yet general enough. */
1352 struct address_info {
1353 /* The mode of the value being addressed, or VOIDmode if this is
1354 a load-address operation with no known address mode. */
1355 enum machine_mode mode;
1357 /* The address space. */
1358 addr_space_t as;
1360 /* A pointer to the top-level address. */
1361 rtx *outer;
1363 /* A pointer to the inner address, after all address mutations
1364 have been stripped from the top-level address. It can be one
1365 of the following:
1367 - A {PRE,POST}_{INC,DEC} of *BASE. SEGMENT, INDEX and DISP are null.
1369 - A {PRE,POST}_MODIFY of *BASE. In this case either INDEX or DISP
1370 points to the step value, depending on whether the step is variable
1371 or constant respectively. SEGMENT is null.
1373 - A plain sum of the form SEGMENT + BASE + INDEX + DISP,
1374 with null fields evaluating to 0. */
1375 rtx *inner;
1377 /* Components that make up *INNER. Each one may be null or nonnull.
1378 When nonnull, their meanings are as follows:
1380 - *SEGMENT is the "segment" of memory to which the address refers.
1381 This value is entirely target-specific and is only called a "segment"
1382 because that's its most typical use. It contains exactly one UNSPEC,
1383 pointed to by SEGMENT_TERM. The contents of *SEGMENT do not need
1384 reloading.
1386 - *BASE is a variable expression representing a base address.
1387 It contains exactly one REG, SUBREG or MEM, pointed to by BASE_TERM.
1389 - *INDEX is a variable expression representing an index value.
1390 It may be a scaled expression, such as a MULT. It has exactly
1391 one REG, SUBREG or MEM, pointed to by INDEX_TERM.
1393 - *DISP is a constant, possibly mutated. DISP_TERM points to the
1394 unmutated RTX_CONST_OBJ. */
1395 rtx *segment;
1396 rtx *base;
1397 rtx *index;
1398 rtx *disp;
1400 rtx *segment_term;
1401 rtx *base_term;
1402 rtx *index_term;
1403 rtx *disp_term;
1405 /* In a {PRE,POST}_MODIFY address, this points to a second copy
1406 of BASE_TERM, otherwise it is null. */
1407 rtx *base_term2;
1409 /* ADDRESS if this structure describes an address operand, MEM if
1410 it describes a MEM address. */
1411 enum rtx_code addr_outer_code;
1413 /* If BASE is nonnull, this is the code of the rtx that contains it. */
1414 enum rtx_code base_outer_code;
1416 /* True if this is an RTX_AUTOINC address. */
1417 bool autoinc_p;
1420 /* This is used to bundle an rtx and a mode together so that the pair
1421 can be used with the wi:: routines. If we ever put modes into rtx
1422 integer constants, this should go away and then just pass an rtx in. */
1423 typedef std::pair <rtx, enum machine_mode> rtx_mode_t;
1425 namespace wi
1427 template <>
1428 struct int_traits <rtx_mode_t>
1430 static const enum precision_type precision_type = VAR_PRECISION;
1431 static const bool host_dependent_precision = false;
1432 /* This ought to be true, except for the special case that BImode
1433 is canonicalized to STORE_FLAG_VALUE, which might be 1. */
1434 static const bool is_sign_extended = false;
1435 static unsigned int get_precision (const rtx_mode_t &);
1436 static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int,
1437 const rtx_mode_t &);
1441 inline unsigned int
1442 wi::int_traits <rtx_mode_t>::get_precision (const rtx_mode_t &x)
1444 return GET_MODE_PRECISION (x.second);
1447 inline wi::storage_ref
1448 wi::int_traits <rtx_mode_t>::decompose (HOST_WIDE_INT *,
1449 unsigned int precision,
1450 const rtx_mode_t &x)
1452 gcc_checking_assert (precision == get_precision (x));
1453 switch (GET_CODE (x.first))
1455 case CONST_INT:
1456 if (precision < HOST_BITS_PER_WIDE_INT)
1457 /* Nonzero BImodes are stored as STORE_FLAG_VALUE, which on many
1458 targets is 1 rather than -1. */
1459 gcc_checking_assert (INTVAL (x.first)
1460 == sext_hwi (INTVAL (x.first), precision)
1461 || (x.second == BImode && INTVAL (x.first) == 1));
1463 return wi::storage_ref (&INTVAL (x.first), 1, precision);
1465 case CONST_WIDE_INT:
1466 return wi::storage_ref (&CONST_WIDE_INT_ELT (x.first, 0),
1467 CONST_WIDE_INT_NUNITS (x.first), precision);
1469 #if TARGET_SUPPORTS_WIDE_INT == 0
1470 case CONST_DOUBLE:
1471 return wi::storage_ref (&CONST_DOUBLE_LOW (x.first), 2, precision);
1472 #endif
1474 default:
1475 gcc_unreachable ();
1479 namespace wi
1481 hwi_with_prec shwi (HOST_WIDE_INT, enum machine_mode mode);
1482 wide_int min_value (enum machine_mode, signop);
1483 wide_int max_value (enum machine_mode, signop);
1486 inline wi::hwi_with_prec
1487 wi::shwi (HOST_WIDE_INT val, enum machine_mode mode)
1489 return shwi (val, GET_MODE_PRECISION (mode));
1492 /* Produce the smallest number that is represented in MODE. The precision
1493 is taken from MODE and the sign from SGN. */
1494 inline wide_int
1495 wi::min_value (enum machine_mode mode, signop sgn)
1497 return min_value (GET_MODE_PRECISION (mode), sgn);
1500 /* Produce the largest number that is represented in MODE. The precision
1501 is taken from MODE and the sign from SGN. */
1502 inline wide_int
1503 wi::max_value (enum machine_mode mode, signop sgn)
1505 return max_value (GET_MODE_PRECISION (mode), sgn);
1508 extern void init_rtlanal (void);
1509 extern int rtx_cost (rtx, enum rtx_code, int, bool);
1510 extern int address_cost (rtx, enum machine_mode, addr_space_t, bool);
1511 extern void get_full_rtx_cost (rtx, enum rtx_code, int,
1512 struct full_rtx_costs *);
1513 extern unsigned int subreg_lsb (const_rtx);
1514 extern unsigned int subreg_lsb_1 (enum machine_mode, enum machine_mode,
1515 unsigned int);
1516 extern unsigned int subreg_regno_offset (unsigned int, enum machine_mode,
1517 unsigned int, enum machine_mode);
1518 extern bool subreg_offset_representable_p (unsigned int, enum machine_mode,
1519 unsigned int, enum machine_mode);
1520 extern unsigned int subreg_regno (const_rtx);
1521 extern int simplify_subreg_regno (unsigned int, enum machine_mode,
1522 unsigned int, enum machine_mode);
1523 extern unsigned int subreg_nregs (const_rtx);
1524 extern unsigned int subreg_nregs_with_regno (unsigned int, const_rtx);
1525 extern unsigned HOST_WIDE_INT nonzero_bits (const_rtx, enum machine_mode);
1526 extern unsigned int num_sign_bit_copies (const_rtx, enum machine_mode);
1527 extern bool constant_pool_constant_p (rtx);
1528 extern bool truncated_to_mode (enum machine_mode, const_rtx);
1529 extern int low_bitmask_len (enum machine_mode, unsigned HOST_WIDE_INT);
1530 extern void split_double (rtx, rtx *, rtx *);
1531 extern rtx *strip_address_mutations (rtx *, enum rtx_code * = 0);
1532 extern void decompose_address (struct address_info *, rtx *,
1533 enum machine_mode, addr_space_t, enum rtx_code);
1534 extern void decompose_lea_address (struct address_info *, rtx *);
1535 extern void decompose_mem_address (struct address_info *, rtx);
1536 extern void update_address (struct address_info *);
1537 extern HOST_WIDE_INT get_index_scale (const struct address_info *);
1538 extern enum rtx_code get_index_code (const struct address_info *);
1540 #ifndef GENERATOR_FILE
1541 /* Return the cost of SET X. SPEED_P is true if optimizing for speed
1542 rather than size. */
1544 static inline int
1545 set_rtx_cost (rtx x, bool speed_p)
1547 return rtx_cost (x, INSN, 4, speed_p);
1550 /* Like set_rtx_cost, but return both the speed and size costs in C. */
1552 static inline void
1553 get_full_set_rtx_cost (rtx x, struct full_rtx_costs *c)
1555 get_full_rtx_cost (x, INSN, 4, c);
1558 /* Return the cost of moving X into a register, relative to the cost
1559 of a register move. SPEED_P is true if optimizing for speed rather
1560 than size. */
1562 static inline int
1563 set_src_cost (rtx x, bool speed_p)
1565 return rtx_cost (x, SET, 1, speed_p);
1568 /* Like set_src_cost, but return both the speed and size costs in C. */
1570 static inline void
1571 get_full_set_src_cost (rtx x, struct full_rtx_costs *c)
1573 get_full_rtx_cost (x, SET, 1, c);
1575 #endif
1577 /* 1 if RTX is a subreg containing a reg that is already known to be
1578 sign- or zero-extended from the mode of the subreg to the mode of
1579 the reg. SUBREG_PROMOTED_UNSIGNED_P gives the signedness of the
1580 extension.
1582 When used as a LHS, is means that this extension must be done
1583 when assigning to SUBREG_REG. */
1585 #define SUBREG_PROMOTED_VAR_P(RTX) \
1586 (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED", (RTX), SUBREG)->in_struct)
1588 #define SUBREG_PROMOTED_UNSIGNED_SET(RTX, VAL) \
1589 do { \
1590 rtx const _rtx = RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_SET", \
1591 (RTX), SUBREG); \
1592 if ((VAL) < 0) \
1593 _rtx->volatil = 1; \
1594 else { \
1595 _rtx->volatil = 0; \
1596 _rtx->unchanging = (VAL); \
1598 } while (0)
1600 /* Valid for subregs which are SUBREG_PROMOTED_VAR_P(). In that case
1601 this gives the necessary extensions:
1602 0 - signed
1603 1 - normal unsigned
1604 -1 - pointer unsigned, which most often can be handled like unsigned
1605 extension, except for generating instructions where we need to
1606 emit special code (ptr_extend insns) on some architectures. */
1608 #define SUBREG_PROMOTED_UNSIGNED_P(RTX) \
1609 ((RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_P", (RTX), SUBREG)->volatil) \
1610 ? -1 : (int) (RTX)->unchanging)
1612 /* True if the subreg was generated by LRA for reload insns. Such
1613 subregs are valid only during LRA. */
1614 #define LRA_SUBREG_P(RTX) \
1615 (RTL_FLAG_CHECK1 ("LRA_SUBREG_P", (RTX), SUBREG)->jump)
1617 /* Access various components of an ASM_OPERANDS rtx. */
1619 #define ASM_OPERANDS_TEMPLATE(RTX) XCSTR (RTX, 0, ASM_OPERANDS)
1620 #define ASM_OPERANDS_OUTPUT_CONSTRAINT(RTX) XCSTR (RTX, 1, ASM_OPERANDS)
1621 #define ASM_OPERANDS_OUTPUT_IDX(RTX) XCINT (RTX, 2, ASM_OPERANDS)
1622 #define ASM_OPERANDS_INPUT_VEC(RTX) XCVEC (RTX, 3, ASM_OPERANDS)
1623 #define ASM_OPERANDS_INPUT_CONSTRAINT_VEC(RTX) XCVEC (RTX, 4, ASM_OPERANDS)
1624 #define ASM_OPERANDS_INPUT(RTX, N) XCVECEXP (RTX, 3, N, ASM_OPERANDS)
1625 #define ASM_OPERANDS_INPUT_LENGTH(RTX) XCVECLEN (RTX, 3, ASM_OPERANDS)
1626 #define ASM_OPERANDS_INPUT_CONSTRAINT_EXP(RTX, N) \
1627 XCVECEXP (RTX, 4, N, ASM_OPERANDS)
1628 #define ASM_OPERANDS_INPUT_CONSTRAINT(RTX, N) \
1629 XSTR (XCVECEXP (RTX, 4, N, ASM_OPERANDS), 0)
1630 #define ASM_OPERANDS_INPUT_MODE(RTX, N) \
1631 GET_MODE (XCVECEXP (RTX, 4, N, ASM_OPERANDS))
1632 #define ASM_OPERANDS_LABEL_VEC(RTX) XCVEC (RTX, 5, ASM_OPERANDS)
1633 #define ASM_OPERANDS_LABEL_LENGTH(RTX) XCVECLEN (RTX, 5, ASM_OPERANDS)
1634 #define ASM_OPERANDS_LABEL(RTX, N) XCVECEXP (RTX, 5, N, ASM_OPERANDS)
1635 #define ASM_OPERANDS_SOURCE_LOCATION(RTX) XCUINT (RTX, 6, ASM_OPERANDS)
1636 #define ASM_INPUT_SOURCE_LOCATION(RTX) XCUINT (RTX, 1, ASM_INPUT)
1638 /* 1 if RTX is a mem that is statically allocated in read-only memory. */
1639 #define MEM_READONLY_P(RTX) \
1640 (RTL_FLAG_CHECK1 ("MEM_READONLY_P", (RTX), MEM)->unchanging)
1642 /* 1 if RTX is a mem and we should keep the alias set for this mem
1643 unchanged when we access a component. Set to 1, or example, when we
1644 are already in a non-addressable component of an aggregate. */
1645 #define MEM_KEEP_ALIAS_SET_P(RTX) \
1646 (RTL_FLAG_CHECK1 ("MEM_KEEP_ALIAS_SET_P", (RTX), MEM)->jump)
1648 /* 1 if RTX is a mem or asm_operand for a volatile reference. */
1649 #define MEM_VOLATILE_P(RTX) \
1650 (RTL_FLAG_CHECK3 ("MEM_VOLATILE_P", (RTX), MEM, ASM_OPERANDS, \
1651 ASM_INPUT)->volatil)
1653 /* 1 if RTX is a mem that cannot trap. */
1654 #define MEM_NOTRAP_P(RTX) \
1655 (RTL_FLAG_CHECK1 ("MEM_NOTRAP_P", (RTX), MEM)->call)
1657 /* The memory attribute block. We provide access macros for each value
1658 in the block and provide defaults if none specified. */
1659 #define MEM_ATTRS(RTX) X0MEMATTR (RTX, 1)
1661 /* The register attribute block. We provide access macros for each value
1662 in the block and provide defaults if none specified. */
1663 #define REG_ATTRS(RTX) X0REGATTR (RTX, 1)
1665 #ifndef GENERATOR_FILE
1666 /* For a MEM rtx, the alias set. If 0, this MEM is not in any alias
1667 set, and may alias anything. Otherwise, the MEM can only alias
1668 MEMs in a conflicting alias set. This value is set in a
1669 language-dependent manner in the front-end, and should not be
1670 altered in the back-end. These set numbers are tested with
1671 alias_sets_conflict_p. */
1672 #define MEM_ALIAS_SET(RTX) (get_mem_attrs (RTX)->alias)
1674 /* For a MEM rtx, the decl it is known to refer to, if it is known to
1675 refer to part of a DECL. It may also be a COMPONENT_REF. */
1676 #define MEM_EXPR(RTX) (get_mem_attrs (RTX)->expr)
1678 /* For a MEM rtx, true if its MEM_OFFSET is known. */
1679 #define MEM_OFFSET_KNOWN_P(RTX) (get_mem_attrs (RTX)->offset_known_p)
1681 /* For a MEM rtx, the offset from the start of MEM_EXPR. */
1682 #define MEM_OFFSET(RTX) (get_mem_attrs (RTX)->offset)
1684 /* For a MEM rtx, the address space. */
1685 #define MEM_ADDR_SPACE(RTX) (get_mem_attrs (RTX)->addrspace)
1687 /* For a MEM rtx, true if its MEM_SIZE is known. */
1688 #define MEM_SIZE_KNOWN_P(RTX) (get_mem_attrs (RTX)->size_known_p)
1690 /* For a MEM rtx, the size in bytes of the MEM. */
1691 #define MEM_SIZE(RTX) (get_mem_attrs (RTX)->size)
1693 /* For a MEM rtx, the alignment in bits. We can use the alignment of the
1694 mode as a default when STRICT_ALIGNMENT, but not if not. */
1695 #define MEM_ALIGN(RTX) (get_mem_attrs (RTX)->align)
1696 #else
1697 #define MEM_ADDR_SPACE(RTX) ADDR_SPACE_GENERIC
1698 #endif
1700 /* For a REG rtx, the decl it is known to refer to, if it is known to
1701 refer to part of a DECL. */
1702 #define REG_EXPR(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->decl)
1704 /* For a REG rtx, the offset from the start of REG_EXPR, if known, as an
1705 HOST_WIDE_INT. */
1706 #define REG_OFFSET(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->offset)
1708 /* Copy the attributes that apply to memory locations from RHS to LHS. */
1709 #define MEM_COPY_ATTRIBUTES(LHS, RHS) \
1710 (MEM_VOLATILE_P (LHS) = MEM_VOLATILE_P (RHS), \
1711 MEM_NOTRAP_P (LHS) = MEM_NOTRAP_P (RHS), \
1712 MEM_READONLY_P (LHS) = MEM_READONLY_P (RHS), \
1713 MEM_KEEP_ALIAS_SET_P (LHS) = MEM_KEEP_ALIAS_SET_P (RHS), \
1714 MEM_POINTER (LHS) = MEM_POINTER (RHS), \
1715 MEM_ATTRS (LHS) = MEM_ATTRS (RHS))
1717 /* 1 if RTX is a label_ref for a nonlocal label. */
1718 /* Likewise in an expr_list for a REG_LABEL_OPERAND or
1719 REG_LABEL_TARGET note. */
1720 #define LABEL_REF_NONLOCAL_P(RTX) \
1721 (RTL_FLAG_CHECK1 ("LABEL_REF_NONLOCAL_P", (RTX), LABEL_REF)->volatil)
1723 /* 1 if RTX is a code_label that should always be considered to be needed. */
1724 #define LABEL_PRESERVE_P(RTX) \
1725 (RTL_FLAG_CHECK2 ("LABEL_PRESERVE_P", (RTX), CODE_LABEL, NOTE)->in_struct)
1727 /* During sched, 1 if RTX is an insn that must be scheduled together
1728 with the preceding insn. */
1729 #define SCHED_GROUP_P(RTX) \
1730 (RTL_FLAG_CHECK4 ("SCHED_GROUP_P", (RTX), DEBUG_INSN, INSN, \
1731 JUMP_INSN, CALL_INSN)->in_struct)
1733 /* For a SET rtx, SET_DEST is the place that is set
1734 and SET_SRC is the value it is set to. */
1735 #define SET_DEST(RTX) XC2EXP (RTX, 0, SET, CLOBBER)
1736 #define SET_SRC(RTX) XCEXP (RTX, 1, SET)
1737 #define SET_IS_RETURN_P(RTX) \
1738 (RTL_FLAG_CHECK1 ("SET_IS_RETURN_P", (RTX), SET)->jump)
1740 /* For a TRAP_IF rtx, TRAP_CONDITION is an expression. */
1741 #define TRAP_CONDITION(RTX) XCEXP (RTX, 0, TRAP_IF)
1742 #define TRAP_CODE(RTX) XCEXP (RTX, 1, TRAP_IF)
1744 /* For a COND_EXEC rtx, COND_EXEC_TEST is the condition to base
1745 conditionally executing the code on, COND_EXEC_CODE is the code
1746 to execute if the condition is true. */
1747 #define COND_EXEC_TEST(RTX) XCEXP (RTX, 0, COND_EXEC)
1748 #define COND_EXEC_CODE(RTX) XCEXP (RTX, 1, COND_EXEC)
1750 /* 1 if RTX is a symbol_ref that addresses this function's rtl
1751 constants pool. */
1752 #define CONSTANT_POOL_ADDRESS_P(RTX) \
1753 (RTL_FLAG_CHECK1 ("CONSTANT_POOL_ADDRESS_P", (RTX), SYMBOL_REF)->unchanging)
1755 /* 1 if RTX is a symbol_ref that addresses a value in the file's
1756 tree constant pool. This information is private to varasm.c. */
1757 #define TREE_CONSTANT_POOL_ADDRESS_P(RTX) \
1758 (RTL_FLAG_CHECK1 ("TREE_CONSTANT_POOL_ADDRESS_P", \
1759 (RTX), SYMBOL_REF)->frame_related)
1761 /* Used if RTX is a symbol_ref, for machine-specific purposes. */
1762 #define SYMBOL_REF_FLAG(RTX) \
1763 (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAG", (RTX), SYMBOL_REF)->volatil)
1765 /* 1 if RTX is a symbol_ref that has been the library function in
1766 emit_library_call. */
1767 #define SYMBOL_REF_USED(RTX) \
1768 (RTL_FLAG_CHECK1 ("SYMBOL_REF_USED", (RTX), SYMBOL_REF)->used)
1770 /* 1 if RTX is a symbol_ref for a weak symbol. */
1771 #define SYMBOL_REF_WEAK(RTX) \
1772 (RTL_FLAG_CHECK1 ("SYMBOL_REF_WEAK", (RTX), SYMBOL_REF)->return_val)
1774 /* A pointer attached to the SYMBOL_REF; either SYMBOL_REF_DECL or
1775 SYMBOL_REF_CONSTANT. */
1776 #define SYMBOL_REF_DATA(RTX) X0ANY ((RTX), 1)
1778 /* Set RTX's SYMBOL_REF_DECL to DECL. RTX must not be a constant
1779 pool symbol. */
1780 #define SET_SYMBOL_REF_DECL(RTX, DECL) \
1781 (gcc_assert (!CONSTANT_POOL_ADDRESS_P (RTX)), X0TREE ((RTX), 1) = (DECL))
1783 /* The tree (decl or constant) associated with the symbol, or null. */
1784 #define SYMBOL_REF_DECL(RTX) \
1785 (CONSTANT_POOL_ADDRESS_P (RTX) ? NULL : X0TREE ((RTX), 1))
1787 /* Set RTX's SYMBOL_REF_CONSTANT to C. RTX must be a constant pool symbol. */
1788 #define SET_SYMBOL_REF_CONSTANT(RTX, C) \
1789 (gcc_assert (CONSTANT_POOL_ADDRESS_P (RTX)), X0CONSTANT ((RTX), 1) = (C))
1791 /* The rtx constant pool entry for a symbol, or null. */
1792 #define SYMBOL_REF_CONSTANT(RTX) \
1793 (CONSTANT_POOL_ADDRESS_P (RTX) ? X0CONSTANT ((RTX), 1) : NULL)
1795 /* A set of flags on a symbol_ref that are, in some respects, redundant with
1796 information derivable from the tree decl associated with this symbol.
1797 Except that we build a *lot* of SYMBOL_REFs that aren't associated with a
1798 decl. In some cases this is a bug. But beyond that, it's nice to cache
1799 this information to avoid recomputing it. Finally, this allows space for
1800 the target to store more than one bit of information, as with
1801 SYMBOL_REF_FLAG. */
1802 #define SYMBOL_REF_FLAGS(RTX) \
1803 (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAGS", (RTX), SYMBOL_REF) \
1804 ->u2.symbol_ref_flags)
1806 /* These flags are common enough to be defined for all targets. They
1807 are computed by the default version of targetm.encode_section_info. */
1809 /* Set if this symbol is a function. */
1810 #define SYMBOL_FLAG_FUNCTION (1 << 0)
1811 #define SYMBOL_REF_FUNCTION_P(RTX) \
1812 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_FUNCTION) != 0)
1813 /* Set if targetm.binds_local_p is true. */
1814 #define SYMBOL_FLAG_LOCAL (1 << 1)
1815 #define SYMBOL_REF_LOCAL_P(RTX) \
1816 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_LOCAL) != 0)
1817 /* Set if targetm.in_small_data_p is true. */
1818 #define SYMBOL_FLAG_SMALL (1 << 2)
1819 #define SYMBOL_REF_SMALL_P(RTX) \
1820 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_SMALL) != 0)
1821 /* The three-bit field at [5:3] is true for TLS variables; use
1822 SYMBOL_REF_TLS_MODEL to extract the field as an enum tls_model. */
1823 #define SYMBOL_FLAG_TLS_SHIFT 3
1824 #define SYMBOL_REF_TLS_MODEL(RTX) \
1825 ((enum tls_model) ((SYMBOL_REF_FLAGS (RTX) >> SYMBOL_FLAG_TLS_SHIFT) & 7))
1826 /* Set if this symbol is not defined in this translation unit. */
1827 #define SYMBOL_FLAG_EXTERNAL (1 << 6)
1828 #define SYMBOL_REF_EXTERNAL_P(RTX) \
1829 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_EXTERNAL) != 0)
1830 /* Set if this symbol has a block_symbol structure associated with it. */
1831 #define SYMBOL_FLAG_HAS_BLOCK_INFO (1 << 7)
1832 #define SYMBOL_REF_HAS_BLOCK_INFO_P(RTX) \
1833 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_HAS_BLOCK_INFO) != 0)
1834 /* Set if this symbol is a section anchor. SYMBOL_REF_ANCHOR_P implies
1835 SYMBOL_REF_HAS_BLOCK_INFO_P. */
1836 #define SYMBOL_FLAG_ANCHOR (1 << 8)
1837 #define SYMBOL_REF_ANCHOR_P(RTX) \
1838 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_ANCHOR) != 0)
1840 /* Subsequent bits are available for the target to use. */
1841 #define SYMBOL_FLAG_MACH_DEP_SHIFT 9
1842 #define SYMBOL_FLAG_MACH_DEP (1 << SYMBOL_FLAG_MACH_DEP_SHIFT)
1844 /* If SYMBOL_REF_HAS_BLOCK_INFO_P (RTX), this is the object_block
1845 structure to which the symbol belongs, or NULL if it has not been
1846 assigned a block. */
1847 #define SYMBOL_REF_BLOCK(RTX) (BLOCK_SYMBOL_CHECK (RTX)->block)
1849 /* If SYMBOL_REF_HAS_BLOCK_INFO_P (RTX), this is the offset of RTX from
1850 the first object in SYMBOL_REF_BLOCK (RTX). The value is negative if
1851 RTX has not yet been assigned to a block, or it has not been given an
1852 offset within that block. */
1853 #define SYMBOL_REF_BLOCK_OFFSET(RTX) (BLOCK_SYMBOL_CHECK (RTX)->offset)
1855 /* True if RTX is flagged to be a scheduling barrier. */
1856 #define PREFETCH_SCHEDULE_BARRIER_P(RTX) \
1857 (RTL_FLAG_CHECK1 ("PREFETCH_SCHEDULE_BARRIER_P", (RTX), PREFETCH)->volatil)
1859 /* Indicate whether the machine has any sort of auto increment addressing.
1860 If not, we can avoid checking for REG_INC notes. */
1862 #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) \
1863 || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT) \
1864 || defined (HAVE_PRE_MODIFY_DISP) || defined (HAVE_POST_MODIFY_DISP) \
1865 || defined (HAVE_PRE_MODIFY_REG) || defined (HAVE_POST_MODIFY_REG))
1866 #define AUTO_INC_DEC
1867 #endif
1869 /* Define a macro to look for REG_INC notes,
1870 but save time on machines where they never exist. */
1872 #ifdef AUTO_INC_DEC
1873 #define FIND_REG_INC_NOTE(INSN, REG) \
1874 ((REG) != NULL_RTX && REG_P ((REG)) \
1875 ? find_regno_note ((INSN), REG_INC, REGNO (REG)) \
1876 : find_reg_note ((INSN), REG_INC, (REG)))
1877 #else
1878 #define FIND_REG_INC_NOTE(INSN, REG) 0
1879 #endif
1881 #ifndef HAVE_PRE_INCREMENT
1882 #define HAVE_PRE_INCREMENT 0
1883 #endif
1885 #ifndef HAVE_PRE_DECREMENT
1886 #define HAVE_PRE_DECREMENT 0
1887 #endif
1889 #ifndef HAVE_POST_INCREMENT
1890 #define HAVE_POST_INCREMENT 0
1891 #endif
1893 #ifndef HAVE_POST_DECREMENT
1894 #define HAVE_POST_DECREMENT 0
1895 #endif
1897 #ifndef HAVE_POST_MODIFY_DISP
1898 #define HAVE_POST_MODIFY_DISP 0
1899 #endif
1901 #ifndef HAVE_POST_MODIFY_REG
1902 #define HAVE_POST_MODIFY_REG 0
1903 #endif
1905 #ifndef HAVE_PRE_MODIFY_DISP
1906 #define HAVE_PRE_MODIFY_DISP 0
1907 #endif
1909 #ifndef HAVE_PRE_MODIFY_REG
1910 #define HAVE_PRE_MODIFY_REG 0
1911 #endif
1914 /* Some architectures do not have complete pre/post increment/decrement
1915 instruction sets, or only move some modes efficiently. These macros
1916 allow us to tune autoincrement generation. */
1918 #ifndef USE_LOAD_POST_INCREMENT
1919 #define USE_LOAD_POST_INCREMENT(MODE) HAVE_POST_INCREMENT
1920 #endif
1922 #ifndef USE_LOAD_POST_DECREMENT
1923 #define USE_LOAD_POST_DECREMENT(MODE) HAVE_POST_DECREMENT
1924 #endif
1926 #ifndef USE_LOAD_PRE_INCREMENT
1927 #define USE_LOAD_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT
1928 #endif
1930 #ifndef USE_LOAD_PRE_DECREMENT
1931 #define USE_LOAD_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT
1932 #endif
1934 #ifndef USE_STORE_POST_INCREMENT
1935 #define USE_STORE_POST_INCREMENT(MODE) HAVE_POST_INCREMENT
1936 #endif
1938 #ifndef USE_STORE_POST_DECREMENT
1939 #define USE_STORE_POST_DECREMENT(MODE) HAVE_POST_DECREMENT
1940 #endif
1942 #ifndef USE_STORE_PRE_INCREMENT
1943 #define USE_STORE_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT
1944 #endif
1946 #ifndef USE_STORE_PRE_DECREMENT
1947 #define USE_STORE_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT
1948 #endif
1950 /* Nonzero when we are generating CONCATs. */
1951 extern int generating_concat_p;
1953 /* Nonzero when we are expanding trees to RTL. */
1954 extern int currently_expanding_to_rtl;
1956 /* Generally useful functions. */
1958 /* In explow.c */
1959 extern HOST_WIDE_INT trunc_int_for_mode (HOST_WIDE_INT, enum machine_mode);
1960 extern rtx plus_constant (enum machine_mode, rtx, HOST_WIDE_INT, bool = false);
1962 /* In rtl.c */
1963 extern rtx rtx_alloc_stat (RTX_CODE MEM_STAT_DECL);
1964 #define rtx_alloc(c) rtx_alloc_stat (c MEM_STAT_INFO)
1965 extern rtx rtx_alloc_stat_v (RTX_CODE MEM_STAT_DECL, int);
1966 #define rtx_alloc_v(c, SZ) rtx_alloc_stat_v (c MEM_STAT_INFO, SZ)
1967 #define const_wide_int_alloc(NWORDS) \
1968 rtx_alloc_v (CONST_WIDE_INT, \
1969 (sizeof (struct hwivec_def) \
1970 + ((NWORDS)-1) * sizeof (HOST_WIDE_INT))) \
1972 extern rtvec rtvec_alloc (int);
1973 extern rtvec shallow_copy_rtvec (rtvec);
1974 extern bool shared_const_p (const_rtx);
1975 extern rtx copy_rtx (rtx);
1976 extern void dump_rtx_statistics (void);
1978 /* In emit-rtl.c */
1979 extern rtx copy_rtx_if_shared (rtx);
1981 /* In rtl.c */
1982 extern unsigned int rtx_size (const_rtx);
1983 extern rtx shallow_copy_rtx_stat (const_rtx MEM_STAT_DECL);
1984 #define shallow_copy_rtx(a) shallow_copy_rtx_stat (a MEM_STAT_INFO)
1985 extern int rtx_equal_p (const_rtx, const_rtx);
1986 extern hashval_t iterative_hash_rtx (const_rtx, hashval_t);
1988 /* In emit-rtl.c */
1989 extern rtvec gen_rtvec_v (int, rtx *);
1990 extern rtx gen_reg_rtx (enum machine_mode);
1991 extern rtx gen_rtx_REG_offset (rtx, enum machine_mode, unsigned int, int);
1992 extern rtx gen_reg_rtx_offset (rtx, enum machine_mode, int);
1993 extern rtx gen_reg_rtx_and_attrs (rtx);
1994 extern rtx gen_label_rtx (void);
1995 extern rtx gen_lowpart_common (enum machine_mode, rtx);
1997 /* In cse.c */
1998 extern rtx gen_lowpart_if_possible (enum machine_mode, rtx);
2000 /* In emit-rtl.c */
2001 extern rtx gen_highpart (enum machine_mode, rtx);
2002 extern rtx gen_highpart_mode (enum machine_mode, enum machine_mode, rtx);
2003 extern rtx operand_subword (rtx, unsigned int, int, enum machine_mode);
2005 /* In emit-rtl.c */
2006 extern rtx operand_subword_force (rtx, unsigned int, enum machine_mode);
2007 extern bool paradoxical_subreg_p (const_rtx);
2008 extern int subreg_lowpart_p (const_rtx);
2009 extern unsigned int subreg_lowpart_offset (enum machine_mode,
2010 enum machine_mode);
2011 extern unsigned int subreg_highpart_offset (enum machine_mode,
2012 enum machine_mode);
2013 extern int byte_lowpart_offset (enum machine_mode, enum machine_mode);
2014 extern rtx make_safe_from (rtx, rtx);
2015 extern rtx convert_memory_address_addr_space (enum machine_mode, rtx,
2016 addr_space_t);
2017 #define convert_memory_address(to_mode,x) \
2018 convert_memory_address_addr_space ((to_mode), (x), ADDR_SPACE_GENERIC)
2019 extern const char *get_insn_name (int);
2020 extern rtx get_last_insn_anywhere (void);
2021 extern rtx get_first_nonnote_insn (void);
2022 extern rtx get_last_nonnote_insn (void);
2023 extern void start_sequence (void);
2024 extern void push_to_sequence (rtx);
2025 extern void push_to_sequence2 (rtx, rtx);
2026 extern void end_sequence (void);
2027 #if TARGET_SUPPORTS_WIDE_INT == 0
2028 extern double_int rtx_to_double_int (const_rtx);
2029 #endif
2030 extern void cwi_output_hex (FILE *, const_rtx);
2031 #ifndef GENERATOR_FILE
2032 extern rtx immed_wide_int_const (const wide_int_ref &, enum machine_mode);
2033 #endif
2034 #if TARGET_SUPPORTS_WIDE_INT == 0
2035 extern rtx immed_double_const (HOST_WIDE_INT, HOST_WIDE_INT,
2036 enum machine_mode);
2037 #endif
2039 /* In loop-iv.c */
2041 extern rtx lowpart_subreg (enum machine_mode, rtx, enum machine_mode);
2043 /* In varasm.c */
2044 extern rtx force_const_mem (enum machine_mode, rtx);
2046 /* In varasm.c */
2048 struct function;
2049 extern rtx get_pool_constant (rtx);
2050 extern rtx get_pool_constant_mark (rtx, bool *);
2051 extern enum machine_mode get_pool_mode (const_rtx);
2052 extern rtx simplify_subtraction (rtx);
2053 extern void decide_function_section (tree);
2055 /* In function.c */
2056 extern rtx assign_stack_local (enum machine_mode, HOST_WIDE_INT, int);
2057 #define ASLK_REDUCE_ALIGN 1
2058 #define ASLK_RECORD_PAD 2
2059 extern rtx assign_stack_local_1 (enum machine_mode, HOST_WIDE_INT, int, int);
2060 extern rtx assign_stack_temp (enum machine_mode, HOST_WIDE_INT);
2061 extern rtx assign_stack_temp_for_type (enum machine_mode, HOST_WIDE_INT, tree);
2062 extern rtx assign_temp (tree, int, int);
2064 /* In emit-rtl.c */
2065 extern rtx emit_insn_before (rtx, rtx);
2066 extern rtx emit_insn_before_noloc (rtx, rtx, basic_block);
2067 extern rtx emit_insn_before_setloc (rtx, rtx, int);
2068 extern rtx emit_jump_insn_before (rtx, rtx);
2069 extern rtx emit_jump_insn_before_noloc (rtx, rtx);
2070 extern rtx emit_jump_insn_before_setloc (rtx, rtx, int);
2071 extern rtx emit_call_insn_before (rtx, rtx);
2072 extern rtx emit_call_insn_before_noloc (rtx, rtx);
2073 extern rtx emit_call_insn_before_setloc (rtx, rtx, int);
2074 extern rtx emit_debug_insn_before (rtx, rtx);
2075 extern rtx emit_debug_insn_before_noloc (rtx, rtx);
2076 extern rtx emit_debug_insn_before_setloc (rtx, rtx, int);
2077 extern rtx emit_barrier_before (rtx);
2078 extern rtx emit_label_before (rtx, rtx);
2079 extern rtx emit_note_before (enum insn_note, rtx);
2080 extern rtx emit_insn_after (rtx, rtx);
2081 extern rtx emit_insn_after_noloc (rtx, rtx, basic_block);
2082 extern rtx emit_insn_after_setloc (rtx, rtx, int);
2083 extern rtx emit_jump_insn_after (rtx, rtx);
2084 extern rtx emit_jump_insn_after_noloc (rtx, rtx);
2085 extern rtx emit_jump_insn_after_setloc (rtx, rtx, int);
2086 extern rtx emit_call_insn_after (rtx, rtx);
2087 extern rtx emit_call_insn_after_noloc (rtx, rtx);
2088 extern rtx emit_call_insn_after_setloc (rtx, rtx, int);
2089 extern rtx emit_debug_insn_after (rtx, rtx);
2090 extern rtx emit_debug_insn_after_noloc (rtx, rtx);
2091 extern rtx emit_debug_insn_after_setloc (rtx, rtx, int);
2092 extern rtx emit_barrier_after (rtx);
2093 extern rtx emit_label_after (rtx, rtx);
2094 extern rtx emit_note_after (enum insn_note, rtx);
2095 extern rtx emit_insn (rtx);
2096 extern rtx emit_debug_insn (rtx);
2097 extern rtx emit_jump_insn (rtx);
2098 extern rtx emit_call_insn (rtx);
2099 extern rtx emit_label (rtx);
2100 extern rtx emit_jump_table_data (rtx);
2101 extern rtx emit_barrier (void);
2102 extern rtx emit_note (enum insn_note);
2103 extern rtx emit_note_copy (rtx);
2104 extern rtx gen_clobber (rtx);
2105 extern rtx emit_clobber (rtx);
2106 extern rtx gen_use (rtx);
2107 extern rtx emit_use (rtx);
2108 extern rtx make_insn_raw (rtx);
2109 extern void add_function_usage_to (rtx, rtx);
2110 extern rtx last_call_insn (void);
2111 extern rtx previous_insn (rtx);
2112 extern rtx next_insn (rtx);
2113 extern rtx prev_nonnote_insn (rtx);
2114 extern rtx prev_nonnote_insn_bb (rtx);
2115 extern rtx next_nonnote_insn (rtx);
2116 extern rtx next_nonnote_insn_bb (rtx);
2117 extern rtx prev_nondebug_insn (rtx);
2118 extern rtx next_nondebug_insn (rtx);
2119 extern rtx prev_nonnote_nondebug_insn (rtx);
2120 extern rtx next_nonnote_nondebug_insn (rtx);
2121 extern rtx prev_real_insn (rtx);
2122 extern rtx next_real_insn (rtx);
2123 extern rtx prev_active_insn (rtx);
2124 extern rtx next_active_insn (rtx);
2125 extern int active_insn_p (const_rtx);
2126 extern rtx next_cc0_user (rtx);
2127 extern rtx prev_cc0_setter (rtx);
2129 /* In emit-rtl.c */
2130 extern int insn_line (const_rtx);
2131 extern const char * insn_file (const_rtx);
2132 extern tree insn_scope (const_rtx);
2133 extern expanded_location insn_location (const_rtx);
2134 extern location_t prologue_location, epilogue_location;
2136 /* In jump.c */
2137 extern enum rtx_code reverse_condition (enum rtx_code);
2138 extern enum rtx_code reverse_condition_maybe_unordered (enum rtx_code);
2139 extern enum rtx_code swap_condition (enum rtx_code);
2140 extern enum rtx_code unsigned_condition (enum rtx_code);
2141 extern enum rtx_code signed_condition (enum rtx_code);
2142 extern void mark_jump_label (rtx, rtx, int);
2144 /* In jump.c */
2145 extern rtx delete_related_insns (rtx);
2147 /* In recog.c */
2148 extern rtx *find_constant_term_loc (rtx *);
2150 /* In emit-rtl.c */
2151 extern rtx try_split (rtx, rtx, int);
2152 extern int split_branch_probability;
2154 /* In unknown file */
2155 extern rtx split_insns (rtx, rtx);
2157 /* In simplify-rtx.c */
2158 extern rtx simplify_const_unary_operation (enum rtx_code, enum machine_mode,
2159 rtx, enum machine_mode);
2160 extern rtx simplify_unary_operation (enum rtx_code, enum machine_mode, rtx,
2161 enum machine_mode);
2162 extern rtx simplify_const_binary_operation (enum rtx_code, enum machine_mode,
2163 rtx, rtx);
2164 extern rtx simplify_binary_operation (enum rtx_code, enum machine_mode, rtx,
2165 rtx);
2166 extern rtx simplify_ternary_operation (enum rtx_code, enum machine_mode,
2167 enum machine_mode, rtx, rtx, rtx);
2168 extern rtx simplify_const_relational_operation (enum rtx_code,
2169 enum machine_mode, rtx, rtx);
2170 extern rtx simplify_relational_operation (enum rtx_code, enum machine_mode,
2171 enum machine_mode, rtx, rtx);
2172 extern rtx simplify_gen_binary (enum rtx_code, enum machine_mode, rtx, rtx);
2173 extern rtx simplify_gen_unary (enum rtx_code, enum machine_mode, rtx,
2174 enum machine_mode);
2175 extern rtx simplify_gen_ternary (enum rtx_code, enum machine_mode,
2176 enum machine_mode, rtx, rtx, rtx);
2177 extern rtx simplify_gen_relational (enum rtx_code, enum machine_mode,
2178 enum machine_mode, rtx, rtx);
2179 extern rtx simplify_subreg (enum machine_mode, rtx, enum machine_mode,
2180 unsigned int);
2181 extern rtx simplify_gen_subreg (enum machine_mode, rtx, enum machine_mode,
2182 unsigned int);
2183 extern rtx simplify_replace_fn_rtx (rtx, const_rtx,
2184 rtx (*fn) (rtx, const_rtx, void *), void *);
2185 extern rtx simplify_replace_rtx (rtx, const_rtx, rtx);
2186 extern rtx simplify_rtx (const_rtx);
2187 extern rtx avoid_constant_pool_reference (rtx);
2188 extern rtx delegitimize_mem_from_attrs (rtx);
2189 extern bool mode_signbit_p (enum machine_mode, const_rtx);
2190 extern bool val_signbit_p (enum machine_mode, unsigned HOST_WIDE_INT);
2191 extern bool val_signbit_known_set_p (enum machine_mode,
2192 unsigned HOST_WIDE_INT);
2193 extern bool val_signbit_known_clear_p (enum machine_mode,
2194 unsigned HOST_WIDE_INT);
2196 /* In reginfo.c */
2197 extern enum machine_mode choose_hard_reg_mode (unsigned int, unsigned int,
2198 bool);
2200 /* In emit-rtl.c */
2201 extern rtx set_for_reg_notes (rtx);
2202 extern rtx set_unique_reg_note (rtx, enum reg_note, rtx);
2203 extern rtx set_dst_reg_note (rtx, enum reg_note, rtx, rtx);
2204 extern void set_insn_deleted (rtx);
2206 /* Functions in rtlanal.c */
2208 /* Single set is implemented as macro for performance reasons. */
2209 #define single_set(I) (INSN_P (I) \
2210 ? (GET_CODE (PATTERN (I)) == SET \
2211 ? PATTERN (I) : single_set_1 (I)) \
2212 : NULL_RTX)
2213 #define single_set_1(I) single_set_2 (I, PATTERN (I))
2215 /* Structure used for passing data to REPLACE_LABEL. */
2216 struct replace_label_data
2218 rtx r1;
2219 rtx r2;
2220 bool update_label_nuses;
2223 extern enum machine_mode get_address_mode (rtx mem);
2224 extern int rtx_addr_can_trap_p (const_rtx);
2225 extern bool nonzero_address_p (const_rtx);
2226 extern int rtx_unstable_p (const_rtx);
2227 extern bool rtx_varies_p (const_rtx, bool);
2228 extern bool rtx_addr_varies_p (const_rtx, bool);
2229 extern rtx get_call_rtx_from (rtx);
2230 extern HOST_WIDE_INT get_integer_term (const_rtx);
2231 extern rtx get_related_value (const_rtx);
2232 extern bool offset_within_block_p (const_rtx, HOST_WIDE_INT);
2233 extern void split_const (rtx, rtx *, rtx *);
2234 extern bool unsigned_reg_p (rtx);
2235 extern int reg_mentioned_p (const_rtx, const_rtx);
2236 extern int count_occurrences (const_rtx, const_rtx, int);
2237 extern int reg_referenced_p (const_rtx, const_rtx);
2238 extern int reg_used_between_p (const_rtx, const_rtx, const_rtx);
2239 extern int reg_set_between_p (const_rtx, const_rtx, const_rtx);
2240 extern int commutative_operand_precedence (rtx);
2241 extern bool swap_commutative_operands_p (rtx, rtx);
2242 extern int modified_between_p (const_rtx, const_rtx, const_rtx);
2243 extern int no_labels_between_p (const_rtx, const_rtx);
2244 extern int modified_in_p (const_rtx, const_rtx);
2245 extern int reg_set_p (const_rtx, const_rtx);
2246 extern rtx single_set_2 (const_rtx, const_rtx);
2247 extern int multiple_sets (const_rtx);
2248 extern int set_noop_p (const_rtx);
2249 extern int noop_move_p (const_rtx);
2250 extern rtx find_last_value (rtx, rtx *, rtx, int);
2251 extern int refers_to_regno_p (unsigned int, unsigned int, const_rtx, rtx *);
2252 extern int reg_overlap_mentioned_p (const_rtx, const_rtx);
2253 extern const_rtx set_of (const_rtx, const_rtx);
2254 extern void record_hard_reg_sets (rtx, const_rtx, void *);
2255 extern void record_hard_reg_uses (rtx *, void *);
2256 #ifdef HARD_CONST
2257 extern void find_all_hard_reg_sets (const_rtx, HARD_REG_SET *, bool);
2258 #endif
2259 extern void note_stores (const_rtx, void (*) (rtx, const_rtx, void *), void *);
2260 extern void note_uses (rtx *, void (*) (rtx *, void *), void *);
2261 extern int dead_or_set_p (const_rtx, const_rtx);
2262 extern int dead_or_set_regno_p (const_rtx, unsigned int);
2263 extern rtx find_reg_note (const_rtx, enum reg_note, const_rtx);
2264 extern rtx find_regno_note (const_rtx, enum reg_note, unsigned int);
2265 extern rtx find_reg_equal_equiv_note (const_rtx);
2266 extern rtx find_constant_src (const_rtx);
2267 extern int find_reg_fusage (const_rtx, enum rtx_code, const_rtx);
2268 extern int find_regno_fusage (const_rtx, enum rtx_code, unsigned int);
2269 extern rtx alloc_reg_note (enum reg_note, rtx, rtx);
2270 extern void add_reg_note (rtx, enum reg_note, rtx);
2271 extern void add_int_reg_note (rtx, enum reg_note, int);
2272 extern void add_shallow_copy_of_reg_note (rtx, rtx);
2273 extern void remove_note (rtx, const_rtx);
2274 extern void remove_reg_equal_equiv_notes (rtx);
2275 extern void remove_reg_equal_equiv_notes_for_regno (unsigned int);
2276 extern int side_effects_p (const_rtx);
2277 extern int volatile_refs_p (const_rtx);
2278 extern int volatile_insn_p (const_rtx);
2279 extern int may_trap_p_1 (const_rtx, unsigned);
2280 extern int may_trap_p (const_rtx);
2281 extern int may_trap_or_fault_p (const_rtx);
2282 extern bool can_throw_internal (const_rtx);
2283 extern bool can_throw_external (const_rtx);
2284 extern bool insn_could_throw_p (const_rtx);
2285 extern bool insn_nothrow_p (const_rtx);
2286 extern bool can_nonlocal_goto (const_rtx);
2287 extern void copy_reg_eh_region_note_forward (rtx, rtx, rtx);
2288 extern void copy_reg_eh_region_note_backward (rtx, rtx, rtx);
2289 extern int inequality_comparisons_p (const_rtx);
2290 extern rtx replace_rtx (rtx, rtx, rtx);
2291 extern int replace_label (rtx *, void *);
2292 extern int rtx_referenced_p (rtx, rtx);
2293 extern bool tablejump_p (const_rtx, rtx *, rtx *);
2294 extern int computed_jump_p (const_rtx);
2296 typedef int (*rtx_function) (rtx *, void *);
2297 extern int for_each_rtx (rtx *, rtx_function, void *);
2299 /* Callback for for_each_inc_dec, to process the autoinc operation OP
2300 within MEM that sets DEST to SRC + SRCOFF, or SRC if SRCOFF is
2301 NULL. The callback is passed the same opaque ARG passed to
2302 for_each_inc_dec. Return zero to continue looking for other
2303 autoinc operations, -1 to skip OP's operands, and any other value
2304 to interrupt the traversal and return that value to the caller of
2305 for_each_inc_dec. */
2306 typedef int (*for_each_inc_dec_fn) (rtx mem, rtx op, rtx dest, rtx src,
2307 rtx srcoff, void *arg);
2308 extern int for_each_inc_dec (rtx *, for_each_inc_dec_fn, void *arg);
2310 typedef int (*rtx_equal_p_callback_function) (const_rtx *, const_rtx *,
2311 rtx *, rtx *);
2312 extern int rtx_equal_p_cb (const_rtx, const_rtx,
2313 rtx_equal_p_callback_function);
2315 typedef int (*hash_rtx_callback_function) (const_rtx, enum machine_mode, rtx *,
2316 enum machine_mode *);
2317 extern unsigned hash_rtx_cb (const_rtx, enum machine_mode, int *, int *,
2318 bool, hash_rtx_callback_function);
2320 extern rtx regno_use_in (unsigned int, rtx);
2321 extern int auto_inc_p (const_rtx);
2322 extern int in_expr_list_p (const_rtx, const_rtx);
2323 extern void remove_node_from_expr_list (const_rtx, rtx *);
2324 extern int loc_mentioned_in_p (rtx *, const_rtx);
2325 extern rtx find_first_parameter_load (rtx, rtx);
2326 extern bool keep_with_call_p (const_rtx);
2327 extern bool label_is_jump_target_p (const_rtx, const_rtx);
2328 extern int insn_rtx_cost (rtx, bool);
2330 /* Given an insn and condition, return a canonical description of
2331 the test being made. */
2332 extern rtx canonicalize_condition (rtx, rtx, int, rtx *, rtx, int, int);
2334 /* Given a JUMP_INSN, return a canonical description of the test
2335 being made. */
2336 extern rtx get_condition (rtx, rtx *, int, int);
2338 /* Information about a subreg of a hard register. */
2339 struct subreg_info
2341 /* Offset of first hard register involved in the subreg. */
2342 int offset;
2343 /* Number of hard registers involved in the subreg. */
2344 int nregs;
2345 /* Whether this subreg can be represented as a hard reg with the new
2346 mode. */
2347 bool representable_p;
2350 extern void subreg_get_info (unsigned int, enum machine_mode,
2351 unsigned int, enum machine_mode,
2352 struct subreg_info *);
2354 /* lists.c */
2356 extern void free_EXPR_LIST_list (rtx *);
2357 extern void free_INSN_LIST_list (rtx *);
2358 extern void free_EXPR_LIST_node (rtx);
2359 extern void free_INSN_LIST_node (rtx);
2360 extern rtx alloc_INSN_LIST (rtx, rtx);
2361 extern rtx copy_INSN_LIST (rtx);
2362 extern rtx concat_INSN_LIST (rtx, rtx);
2363 extern rtx alloc_EXPR_LIST (int, rtx, rtx);
2364 extern void remove_free_INSN_LIST_elem (rtx, rtx *);
2365 extern rtx remove_list_elem (rtx, rtx *);
2366 extern rtx remove_free_INSN_LIST_node (rtx *);
2367 extern rtx remove_free_EXPR_LIST_node (rtx *);
2370 /* reginfo.c */
2372 /* Resize reg info. */
2373 extern bool resize_reg_info (void);
2374 /* Free up register info memory. */
2375 extern void free_reg_info (void);
2376 extern void init_subregs_of_mode (void);
2377 extern void finish_subregs_of_mode (void);
2379 /* recog.c */
2380 extern rtx extract_asm_operands (rtx);
2381 extern int asm_noperands (const_rtx);
2382 extern const char *decode_asm_operands (rtx, rtx *, rtx **, const char **,
2383 enum machine_mode *, location_t *);
2384 extern void get_referenced_operands (const char *, bool *, unsigned int);
2386 extern enum reg_class reg_preferred_class (int);
2387 extern enum reg_class reg_alternate_class (int);
2388 extern enum reg_class reg_allocno_class (int);
2389 extern void setup_reg_classes (int, enum reg_class, enum reg_class,
2390 enum reg_class);
2392 extern void split_all_insns (void);
2393 extern unsigned int split_all_insns_noflow (void);
2395 #define MAX_SAVED_CONST_INT 64
2396 extern GTY(()) rtx const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1];
2398 #define const0_rtx (const_int_rtx[MAX_SAVED_CONST_INT])
2399 #define const1_rtx (const_int_rtx[MAX_SAVED_CONST_INT+1])
2400 #define const2_rtx (const_int_rtx[MAX_SAVED_CONST_INT+2])
2401 #define constm1_rtx (const_int_rtx[MAX_SAVED_CONST_INT-1])
2402 extern GTY(()) rtx const_true_rtx;
2404 extern GTY(()) rtx const_tiny_rtx[4][(int) MAX_MACHINE_MODE];
2406 /* Returns a constant 0 rtx in mode MODE. Integer modes are treated the
2407 same as VOIDmode. */
2409 #define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)])
2411 /* Likewise, for the constants 1 and 2 and -1. */
2413 #define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)])
2414 #define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)])
2415 #define CONSTM1_RTX(MODE) (const_tiny_rtx[3][(int) (MODE)])
2417 extern GTY(()) rtx pc_rtx;
2418 extern GTY(()) rtx cc0_rtx;
2419 extern GTY(()) rtx ret_rtx;
2420 extern GTY(()) rtx simple_return_rtx;
2422 /* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg
2423 is used to represent the frame pointer. This is because the
2424 hard frame pointer and the automatic variables are separated by an amount
2425 that cannot be determined until after register allocation. We can assume
2426 that in this case ELIMINABLE_REGS will be defined, one action of which
2427 will be to eliminate FRAME_POINTER_REGNUM into HARD_FRAME_POINTER_REGNUM. */
2428 #ifndef HARD_FRAME_POINTER_REGNUM
2429 #define HARD_FRAME_POINTER_REGNUM FRAME_POINTER_REGNUM
2430 #endif
2432 #ifndef HARD_FRAME_POINTER_IS_FRAME_POINTER
2433 #define HARD_FRAME_POINTER_IS_FRAME_POINTER \
2434 (HARD_FRAME_POINTER_REGNUM == FRAME_POINTER_REGNUM)
2435 #endif
2437 #ifndef HARD_FRAME_POINTER_IS_ARG_POINTER
2438 #define HARD_FRAME_POINTER_IS_ARG_POINTER \
2439 (HARD_FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM)
2440 #endif
2442 /* Index labels for global_rtl. */
2443 enum global_rtl_index
2445 GR_STACK_POINTER,
2446 GR_FRAME_POINTER,
2447 /* For register elimination to work properly these hard_frame_pointer_rtx,
2448 frame_pointer_rtx, and arg_pointer_rtx must be the same if they refer to
2449 the same register. */
2450 #if FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM
2451 GR_ARG_POINTER = GR_FRAME_POINTER,
2452 #endif
2453 #if HARD_FRAME_POINTER_IS_FRAME_POINTER
2454 GR_HARD_FRAME_POINTER = GR_FRAME_POINTER,
2455 #else
2456 GR_HARD_FRAME_POINTER,
2457 #endif
2458 #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
2459 #if HARD_FRAME_POINTER_IS_ARG_POINTER
2460 GR_ARG_POINTER = GR_HARD_FRAME_POINTER,
2461 #else
2462 GR_ARG_POINTER,
2463 #endif
2464 #endif
2465 GR_VIRTUAL_INCOMING_ARGS,
2466 GR_VIRTUAL_STACK_ARGS,
2467 GR_VIRTUAL_STACK_DYNAMIC,
2468 GR_VIRTUAL_OUTGOING_ARGS,
2469 GR_VIRTUAL_CFA,
2470 GR_VIRTUAL_PREFERRED_STACK_BOUNDARY,
2472 GR_MAX
2475 /* Target-dependent globals. */
2476 struct GTY(()) target_rtl {
2477 /* All references to the hard registers in global_rtl_index go through
2478 these unique rtl objects. On machines where the frame-pointer and
2479 arg-pointer are the same register, they use the same unique object.
2481 After register allocation, other rtl objects which used to be pseudo-regs
2482 may be clobbered to refer to the frame-pointer register.
2483 But references that were originally to the frame-pointer can be
2484 distinguished from the others because they contain frame_pointer_rtx.
2486 When to use frame_pointer_rtx and hard_frame_pointer_rtx is a little
2487 tricky: until register elimination has taken place hard_frame_pointer_rtx
2488 should be used if it is being set, and frame_pointer_rtx otherwise. After
2489 register elimination hard_frame_pointer_rtx should always be used.
2490 On machines where the two registers are same (most) then these are the
2491 same. */
2492 rtx x_global_rtl[GR_MAX];
2494 /* A unique representation of (REG:Pmode PIC_OFFSET_TABLE_REGNUM). */
2495 rtx x_pic_offset_table_rtx;
2497 /* A unique representation of (REG:Pmode RETURN_ADDRESS_POINTER_REGNUM).
2498 This is used to implement __builtin_return_address for some machines;
2499 see for instance the MIPS port. */
2500 rtx x_return_address_pointer_rtx;
2502 /* Commonly used RTL for hard registers. These objects are not
2503 necessarily unique, so we allocate them separately from global_rtl.
2504 They are initialized once per compilation unit, then copied into
2505 regno_reg_rtx at the beginning of each function. */
2506 rtx x_initial_regno_reg_rtx[FIRST_PSEUDO_REGISTER];
2508 /* A sample (mem:M stack_pointer_rtx) rtx for each mode M. */
2509 rtx x_top_of_stack[MAX_MACHINE_MODE];
2511 /* Static hunks of RTL used by the aliasing code; these are treated
2512 as persistent to avoid unnecessary RTL allocations. */
2513 rtx x_static_reg_base_value[FIRST_PSEUDO_REGISTER];
2515 /* The default memory attributes for each mode. */
2516 struct mem_attrs *x_mode_mem_attrs[(int) MAX_MACHINE_MODE];
2519 extern GTY(()) struct target_rtl default_target_rtl;
2520 #if SWITCHABLE_TARGET
2521 extern struct target_rtl *this_target_rtl;
2522 #else
2523 #define this_target_rtl (&default_target_rtl)
2524 #endif
2526 #define global_rtl \
2527 (this_target_rtl->x_global_rtl)
2528 #define pic_offset_table_rtx \
2529 (this_target_rtl->x_pic_offset_table_rtx)
2530 #define return_address_pointer_rtx \
2531 (this_target_rtl->x_return_address_pointer_rtx)
2532 #define top_of_stack \
2533 (this_target_rtl->x_top_of_stack)
2534 #define mode_mem_attrs \
2535 (this_target_rtl->x_mode_mem_attrs)
2537 /* All references to certain hard regs, except those created
2538 by allocating pseudo regs into them (when that's possible),
2539 go through these unique rtx objects. */
2540 #define stack_pointer_rtx (global_rtl[GR_STACK_POINTER])
2541 #define frame_pointer_rtx (global_rtl[GR_FRAME_POINTER])
2542 #define hard_frame_pointer_rtx (global_rtl[GR_HARD_FRAME_POINTER])
2543 #define arg_pointer_rtx (global_rtl[GR_ARG_POINTER])
2545 #ifndef GENERATOR_FILE
2546 /* Return the attributes of a MEM rtx. */
2547 static inline struct mem_attrs *
2548 get_mem_attrs (const_rtx x)
2550 struct mem_attrs *attrs;
2552 attrs = MEM_ATTRS (x);
2553 if (!attrs)
2554 attrs = mode_mem_attrs[(int) GET_MODE (x)];
2555 return attrs;
2557 #endif
2559 /* Include the RTL generation functions. */
2561 #ifndef GENERATOR_FILE
2562 #include "genrtl.h"
2563 #undef gen_rtx_ASM_INPUT
2564 #define gen_rtx_ASM_INPUT(MODE, ARG0) \
2565 gen_rtx_fmt_si (ASM_INPUT, (MODE), (ARG0), 0)
2566 #define gen_rtx_ASM_INPUT_loc(MODE, ARG0, LOC) \
2567 gen_rtx_fmt_si (ASM_INPUT, (MODE), (ARG0), (LOC))
2568 #endif
2570 /* There are some RTL codes that require special attention; the
2571 generation functions included above do the raw handling. If you
2572 add to this list, modify special_rtx in gengenrtl.c as well. */
2574 extern rtx gen_rtx_CONST_INT (enum machine_mode, HOST_WIDE_INT);
2575 extern rtx gen_rtx_CONST_VECTOR (enum machine_mode, rtvec);
2576 extern rtx gen_raw_REG (enum machine_mode, int);
2577 extern rtx gen_rtx_REG (enum machine_mode, unsigned);
2578 extern rtx gen_rtx_SUBREG (enum machine_mode, rtx, int);
2579 extern rtx gen_rtx_MEM (enum machine_mode, rtx);
2580 extern rtx gen_rtx_VAR_LOCATION (enum machine_mode, tree, rtx,
2581 enum var_init_status);
2583 #define GEN_INT(N) gen_rtx_CONST_INT (VOIDmode, (N))
2585 /* Virtual registers are used during RTL generation to refer to locations into
2586 the stack frame when the actual location isn't known until RTL generation
2587 is complete. The routine instantiate_virtual_regs replaces these with
2588 the proper value, which is normally {frame,arg,stack}_pointer_rtx plus
2589 a constant. */
2591 #define FIRST_VIRTUAL_REGISTER (FIRST_PSEUDO_REGISTER)
2593 /* This points to the first word of the incoming arguments passed on the stack,
2594 either by the caller or by the callee when pretending it was passed by the
2595 caller. */
2597 #define virtual_incoming_args_rtx (global_rtl[GR_VIRTUAL_INCOMING_ARGS])
2599 #define VIRTUAL_INCOMING_ARGS_REGNUM (FIRST_VIRTUAL_REGISTER)
2601 /* If FRAME_GROWS_DOWNWARD, this points to immediately above the first
2602 variable on the stack. Otherwise, it points to the first variable on
2603 the stack. */
2605 #define virtual_stack_vars_rtx (global_rtl[GR_VIRTUAL_STACK_ARGS])
2607 #define VIRTUAL_STACK_VARS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 1)
2609 /* This points to the location of dynamically-allocated memory on the stack
2610 immediately after the stack pointer has been adjusted by the amount
2611 desired. */
2613 #define virtual_stack_dynamic_rtx (global_rtl[GR_VIRTUAL_STACK_DYNAMIC])
2615 #define VIRTUAL_STACK_DYNAMIC_REGNUM ((FIRST_VIRTUAL_REGISTER) + 2)
2617 /* This points to the location in the stack at which outgoing arguments should
2618 be written when the stack is pre-pushed (arguments pushed using push
2619 insns always use sp). */
2621 #define virtual_outgoing_args_rtx (global_rtl[GR_VIRTUAL_OUTGOING_ARGS])
2623 #define VIRTUAL_OUTGOING_ARGS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 3)
2625 /* This points to the Canonical Frame Address of the function. This
2626 should correspond to the CFA produced by INCOMING_FRAME_SP_OFFSET,
2627 but is calculated relative to the arg pointer for simplicity; the
2628 frame pointer nor stack pointer are necessarily fixed relative to
2629 the CFA until after reload. */
2631 #define virtual_cfa_rtx (global_rtl[GR_VIRTUAL_CFA])
2633 #define VIRTUAL_CFA_REGNUM ((FIRST_VIRTUAL_REGISTER) + 4)
2635 #define LAST_VIRTUAL_POINTER_REGISTER ((FIRST_VIRTUAL_REGISTER) + 4)
2637 /* This is replaced by crtl->preferred_stack_boundary / BITS_PER_UNIT
2638 when finalized. */
2640 #define virtual_preferred_stack_boundary_rtx \
2641 (global_rtl[GR_VIRTUAL_PREFERRED_STACK_BOUNDARY])
2643 #define VIRTUAL_PREFERRED_STACK_BOUNDARY_REGNUM \
2644 ((FIRST_VIRTUAL_REGISTER) + 5)
2646 #define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 5)
2648 /* Nonzero if REGNUM is a pointer into the stack frame. */
2649 #define REGNO_PTR_FRAME_P(REGNUM) \
2650 ((REGNUM) == STACK_POINTER_REGNUM \
2651 || (REGNUM) == FRAME_POINTER_REGNUM \
2652 || (REGNUM) == HARD_FRAME_POINTER_REGNUM \
2653 || (REGNUM) == ARG_POINTER_REGNUM \
2654 || ((REGNUM) >= FIRST_VIRTUAL_REGISTER \
2655 && (REGNUM) <= LAST_VIRTUAL_POINTER_REGISTER))
2657 /* REGNUM never really appearing in the INSN stream. */
2658 #define INVALID_REGNUM (~(unsigned int) 0)
2660 /* REGNUM for which no debug information can be generated. */
2661 #define IGNORED_DWARF_REGNUM (INVALID_REGNUM - 1)
2663 extern rtx output_constant_def (tree, int);
2664 extern rtx lookup_constant_def (tree);
2666 /* Nonzero after end of reload pass.
2667 Set to 1 or 0 by reload1.c. */
2669 extern int reload_completed;
2671 /* Nonzero after thread_prologue_and_epilogue_insns has run. */
2672 extern int epilogue_completed;
2674 /* Set to 1 while reload_as_needed is operating.
2675 Required by some machines to handle any generated moves differently. */
2677 extern int reload_in_progress;
2679 /* Set to 1 while in lra. */
2680 extern int lra_in_progress;
2682 /* This macro indicates whether you may create a new
2683 pseudo-register. */
2685 #define can_create_pseudo_p() (!reload_in_progress && !reload_completed)
2687 #ifdef STACK_REGS
2688 /* Nonzero after end of regstack pass.
2689 Set to 1 or 0 by reg-stack.c. */
2690 extern int regstack_completed;
2691 #endif
2693 /* If this is nonzero, we do not bother generating VOLATILE
2694 around volatile memory references, and we are willing to
2695 output indirect addresses. If cse is to follow, we reject
2696 indirect addresses so a useful potential cse is generated;
2697 if it is used only once, instruction combination will produce
2698 the same indirect address eventually. */
2699 extern int cse_not_expected;
2701 /* Translates rtx code to tree code, for those codes needed by
2702 REAL_ARITHMETIC. The function returns an int because the caller may not
2703 know what `enum tree_code' means. */
2705 extern int rtx_to_tree_code (enum rtx_code);
2707 /* In cse.c */
2708 extern int delete_trivially_dead_insns (rtx, int);
2709 extern int exp_equiv_p (const_rtx, const_rtx, int, bool);
2710 extern unsigned hash_rtx (const_rtx x, enum machine_mode, int *, int *, bool);
2712 /* In dse.c */
2713 extern bool check_for_inc_dec (rtx insn);
2715 /* In jump.c */
2716 extern int comparison_dominates_p (enum rtx_code, enum rtx_code);
2717 extern bool jump_to_label_p (rtx);
2718 extern int condjump_p (const_rtx);
2719 extern int any_condjump_p (const_rtx);
2720 extern int any_uncondjump_p (const_rtx);
2721 extern rtx pc_set (const_rtx);
2722 extern rtx condjump_label (const_rtx);
2723 extern int simplejump_p (const_rtx);
2724 extern int returnjump_p (rtx);
2725 extern int eh_returnjump_p (rtx);
2726 extern int onlyjump_p (const_rtx);
2727 extern int only_sets_cc0_p (const_rtx);
2728 extern int sets_cc0_p (const_rtx);
2729 extern int invert_jump_1 (rtx, rtx);
2730 extern int invert_jump (rtx, rtx, int);
2731 extern int rtx_renumbered_equal_p (const_rtx, const_rtx);
2732 extern int true_regnum (const_rtx);
2733 extern unsigned int reg_or_subregno (const_rtx);
2734 extern int redirect_jump_1 (rtx, rtx);
2735 extern void redirect_jump_2 (rtx, rtx, rtx, int, int);
2736 extern int redirect_jump (rtx, rtx, int);
2737 extern void rebuild_jump_labels (rtx);
2738 extern void rebuild_jump_labels_chain (rtx);
2739 extern rtx reversed_comparison (const_rtx, enum machine_mode);
2740 extern enum rtx_code reversed_comparison_code (const_rtx, const_rtx);
2741 extern enum rtx_code reversed_comparison_code_parts (enum rtx_code, const_rtx,
2742 const_rtx, const_rtx);
2743 extern void delete_for_peephole (rtx, rtx);
2744 extern int condjump_in_parallel_p (const_rtx);
2746 /* In emit-rtl.c. */
2747 extern int max_reg_num (void);
2748 extern int max_label_num (void);
2749 extern int get_first_label_num (void);
2750 extern void maybe_set_first_label_num (rtx);
2751 extern void delete_insns_since (rtx);
2752 extern void mark_reg_pointer (rtx, int);
2753 extern void mark_user_reg (rtx);
2754 extern void reset_used_flags (rtx);
2755 extern void set_used_flags (rtx);
2756 extern void reorder_insns (rtx, rtx, rtx);
2757 extern void reorder_insns_nobb (rtx, rtx, rtx);
2758 extern int get_max_insn_count (void);
2759 extern int in_sequence_p (void);
2760 extern void init_emit (void);
2761 extern void init_emit_regs (void);
2762 extern void init_derived_machine_modes (void);
2763 extern void init_emit_once (void);
2764 extern void push_topmost_sequence (void);
2765 extern void pop_topmost_sequence (void);
2766 extern void set_new_first_and_last_insn (rtx, rtx);
2767 extern unsigned int unshare_all_rtl (void);
2768 extern void unshare_all_rtl_again (rtx);
2769 extern void unshare_all_rtl_in_chain (rtx);
2770 extern void verify_rtl_sharing (void);
2771 extern void add_insn (rtx);
2772 extern void add_insn_before (rtx, rtx, basic_block);
2773 extern void add_insn_after (rtx, rtx, basic_block);
2774 extern void remove_insn (rtx);
2775 extern rtx emit (rtx);
2776 extern void delete_insn (rtx);
2777 extern rtx entry_of_function (void);
2778 extern void emit_insn_at_entry (rtx);
2779 extern void delete_insn_chain (rtx, rtx, bool);
2780 extern rtx unlink_insn_chain (rtx, rtx);
2781 extern void delete_insn_and_edges (rtx);
2782 extern rtx gen_lowpart_SUBREG (enum machine_mode, rtx);
2783 extern rtx gen_const_mem (enum machine_mode, rtx);
2784 extern rtx gen_frame_mem (enum machine_mode, rtx);
2785 extern rtx gen_tmp_stack_mem (enum machine_mode, rtx);
2786 extern bool validate_subreg (enum machine_mode, enum machine_mode,
2787 const_rtx, unsigned int);
2789 /* In combine.c */
2790 extern unsigned int extended_count (const_rtx, enum machine_mode, int);
2791 extern rtx remove_death (unsigned int, rtx);
2792 extern void dump_combine_stats (FILE *);
2793 extern void dump_combine_total_stats (FILE *);
2794 extern rtx make_compound_operation (rtx, enum rtx_code);
2796 /* In cfgcleanup.c */
2797 extern void delete_dead_jumptables (void);
2799 /* In sched-rgn.c. */
2800 extern void schedule_insns (void);
2802 /* In sched-ebb.c. */
2803 extern void schedule_ebbs (void);
2805 /* In sel-sched-dump.c. */
2806 extern void sel_sched_fix_param (const char *param, const char *val);
2808 /* In print-rtl.c */
2809 extern const char *print_rtx_head;
2810 extern void debug (const rtx_def &ref);
2811 extern void debug (const rtx_def *ptr);
2812 extern void debug_rtx (const_rtx);
2813 extern void debug_rtx_list (const_rtx, int);
2814 extern void debug_rtx_range (const_rtx, const_rtx);
2815 extern const_rtx debug_rtx_find (const_rtx, int);
2816 extern void print_mem_expr (FILE *, const_tree);
2817 extern void print_rtl (FILE *, const_rtx);
2818 extern void print_simple_rtl (FILE *, const_rtx);
2819 extern int print_rtl_single (FILE *, const_rtx);
2820 extern int print_rtl_single_with_indent (FILE *, const_rtx, int);
2821 extern void print_inline_rtx (FILE *, const_rtx, int);
2823 /* Functions in sched-vis.c. FIXME: Ideally these functions would
2824 not be in sched-vis.c but in rtl.c, because they are not only used
2825 by the scheduler anymore but for all "slim" RTL dumping. */
2826 extern void dump_value_slim (FILE *, const_rtx, int);
2827 extern void dump_insn_slim (FILE *, const_rtx);
2828 extern void dump_rtl_slim (FILE *, const_rtx, const_rtx, int, int);
2829 extern void print_value (pretty_printer *, const_rtx, int);
2830 extern void print_pattern (pretty_printer *, const_rtx, int);
2831 extern void print_insn (pretty_printer *, const_rtx, int);
2832 extern void rtl_dump_bb_for_graph (pretty_printer *, basic_block);
2833 extern const char *str_pattern_slim (const_rtx);
2835 /* In function.c */
2836 extern void reposition_prologue_and_epilogue_notes (void);
2837 extern int prologue_epilogue_contains (const_rtx);
2838 extern int sibcall_epilogue_contains (const_rtx);
2839 extern void update_temp_slot_address (rtx, rtx);
2840 extern void maybe_copy_prologue_epilogue_insn (rtx, rtx);
2841 extern void set_return_jump_label (rtx);
2843 /* In stmt.c */
2844 extern void expand_null_return (void);
2845 extern void expand_naked_return (void);
2846 extern void emit_jump (rtx);
2848 /* In expr.c */
2849 extern rtx move_by_pieces (rtx, rtx, unsigned HOST_WIDE_INT,
2850 unsigned int, int);
2851 extern HOST_WIDE_INT find_args_size_adjust (rtx);
2852 extern int fixup_args_size_notes (rtx, rtx, int);
2854 /* In cfgrtl.c */
2855 extern void print_rtl_with_bb (FILE *, const_rtx, int);
2856 extern rtx duplicate_insn_chain (rtx, rtx);
2858 /* In expmed.c */
2859 extern void init_expmed (void);
2860 extern void expand_inc (rtx, rtx);
2861 extern void expand_dec (rtx, rtx);
2863 /* In lower-subreg.c */
2864 extern void init_lower_subreg (void);
2866 /* In gcse.c */
2867 extern bool can_copy_p (enum machine_mode);
2868 extern bool can_assign_to_reg_without_clobbers_p (rtx);
2869 extern rtx fis_get_condition (rtx);
2871 /* In ira.c */
2872 #ifdef HARD_CONST
2873 extern HARD_REG_SET eliminable_regset;
2874 #endif
2875 extern void mark_elimination (int, int);
2877 /* In reginfo.c */
2878 extern int reg_classes_intersect_p (reg_class_t, reg_class_t);
2879 extern int reg_class_subset_p (reg_class_t, reg_class_t);
2880 extern void globalize_reg (tree, int);
2881 extern void init_reg_modes_target (void);
2882 extern void init_regs (void);
2883 extern void reinit_regs (void);
2884 extern void init_fake_stack_mems (void);
2885 extern void save_register_info (void);
2886 extern void init_reg_sets (void);
2887 extern void regclass (rtx, int);
2888 extern void reg_scan (rtx, unsigned int);
2889 extern void fix_register (const char *, int, int);
2890 extern bool invalid_mode_change_p (unsigned int, enum reg_class);
2892 /* In reload1.c */
2893 extern int function_invariant_p (const_rtx);
2895 /* In calls.c */
2896 enum libcall_type
2898 LCT_NORMAL = 0,
2899 LCT_CONST = 1,
2900 LCT_PURE = 2,
2901 LCT_NORETURN = 3,
2902 LCT_THROW = 4,
2903 LCT_RETURNS_TWICE = 5
2906 extern void emit_library_call (rtx, enum libcall_type, enum machine_mode, int,
2907 ...);
2908 extern rtx emit_library_call_value (rtx, rtx, enum libcall_type,
2909 enum machine_mode, int, ...);
2911 /* In varasm.c */
2912 extern void init_varasm_once (void);
2914 extern rtx make_debug_expr_from_rtl (const_rtx);
2916 /* In read-rtl.c */
2917 extern bool read_rtx (const char *, rtx *);
2919 /* In alias.c */
2920 extern rtx canon_rtx (rtx);
2921 extern int true_dependence (const_rtx, enum machine_mode, const_rtx);
2922 extern rtx get_addr (rtx);
2923 extern int canon_true_dependence (const_rtx, enum machine_mode, rtx,
2924 const_rtx, rtx);
2925 extern int read_dependence (const_rtx, const_rtx);
2926 extern int anti_dependence (const_rtx, const_rtx);
2927 extern int canon_anti_dependence (const_rtx, bool,
2928 const_rtx, enum machine_mode, rtx);
2929 extern int output_dependence (const_rtx, const_rtx);
2930 extern int may_alias_p (const_rtx, const_rtx);
2931 extern void init_alias_target (void);
2932 extern void init_alias_analysis (void);
2933 extern void end_alias_analysis (void);
2934 extern void vt_equate_reg_base_value (const_rtx, const_rtx);
2935 extern bool memory_modified_in_insn_p (const_rtx, const_rtx);
2936 extern bool memory_must_be_modified_in_insn_p (const_rtx, const_rtx);
2937 extern bool may_be_sp_based_p (rtx);
2938 extern rtx gen_hard_reg_clobber (enum machine_mode, unsigned int);
2939 extern rtx get_reg_known_value (unsigned int);
2940 extern bool get_reg_known_equiv_p (unsigned int);
2941 extern rtx get_reg_base_value (unsigned int);
2943 #ifdef STACK_REGS
2944 extern int stack_regs_mentioned (const_rtx insn);
2945 #endif
2947 /* In toplev.c */
2948 extern GTY(()) rtx stack_limit_rtx;
2950 /* In predict.c */
2951 extern void invert_br_probabilities (rtx);
2952 extern bool expensive_function_p (int);
2954 /* In var-tracking.c */
2955 extern unsigned int variable_tracking_main (void);
2957 /* In stor-layout.c. */
2958 extern void get_mode_bounds (enum machine_mode, int, enum machine_mode,
2959 rtx *, rtx *);
2961 /* In loop-iv.c */
2962 extern rtx canon_condition (rtx);
2963 extern void simplify_using_condition (rtx, rtx *, bitmap);
2965 /* In final.c */
2966 extern unsigned int compute_alignments (void);
2967 extern void update_alignments (vec<rtx> &);
2968 extern int asm_str_count (const char *templ);
2970 struct rtl_hooks
2972 rtx (*gen_lowpart) (enum machine_mode, rtx);
2973 rtx (*gen_lowpart_no_emit) (enum machine_mode, rtx);
2974 rtx (*reg_nonzero_bits) (const_rtx, enum machine_mode, const_rtx, enum machine_mode,
2975 unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT *);
2976 rtx (*reg_num_sign_bit_copies) (const_rtx, enum machine_mode, const_rtx, enum machine_mode,
2977 unsigned int, unsigned int *);
2978 bool (*reg_truncated_to_mode) (enum machine_mode, const_rtx);
2980 /* Whenever you add entries here, make sure you adjust rtlhooks-def.h. */
2983 /* Each pass can provide its own. */
2984 extern struct rtl_hooks rtl_hooks;
2986 /* ... but then it has to restore these. */
2987 extern const struct rtl_hooks general_rtl_hooks;
2989 /* Keep this for the nonce. */
2990 #define gen_lowpart rtl_hooks.gen_lowpart
2992 extern void insn_locations_init (void);
2993 extern void insn_locations_finalize (void);
2994 extern void set_curr_insn_location (location_t);
2995 extern location_t curr_insn_location (void);
2996 extern bool optimize_insn_for_size_p (void);
2997 extern bool optimize_insn_for_speed_p (void);
2999 /* rtl-error.c */
3000 extern void _fatal_insn_not_found (const_rtx, const char *, int, const char *)
3001 ATTRIBUTE_NORETURN;
3002 extern void _fatal_insn (const char *, const_rtx, const char *, int, const char *)
3003 ATTRIBUTE_NORETURN;
3005 #define fatal_insn(msgid, insn) \
3006 _fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__)
3007 #define fatal_insn_not_found(insn) \
3008 _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__)
3010 /* reginfo.c */
3011 extern tree GTY(()) global_regs_decl[FIRST_PSEUDO_REGISTER];
3014 #endif /* ! GCC_RTL_H */