]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/rtl.h
Remove docs for removed option.
[thirdparty/gcc.git] / gcc / rtl.h
CommitLineData
5e6908ea 1/* Register Transfer Language (RTL) definitions for GCC
af841dbd 2 Copyright (C) 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
c80a0f26 3 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
6f29feb1 4
1322177d 5This file is part of GCC.
6f29feb1 6
1322177d
LB
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 2, or (at your option) any later
10version.
6f29feb1 11
1322177d
LB
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
6f29feb1
JW
16
17You should have received a copy of the GNU General Public License
1322177d
LB
18along with GCC; see the file COPYING. If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2002111-1307, USA. */
6f29feb1 21
88657302
RH
22#ifndef GCC_RTL_H
23#define GCC_RTL_H
36edd3cc 24
7e7ec48e 25#include "statistics.h"
6f29feb1 26#include "machmode.h"
fd3acbb3 27#include "input.h"
6f29feb1
JW
28
29#undef FFS /* Some systems predefine this symbol; don't let it interfere. */
1cfc3092 30#undef FLOAT /* Likewise. */
ac889e46 31#undef ABS /* Likewise. */
71ae9cc6 32#undef PC /* Likewise. */
6f29feb1 33
173b24b9 34/* Value used by some passes to "recognize" noop moves as valid
eebedaa5 35 instructions. */
b5832b43
JH
36#define NOOP_MOVE_INSN_CODE INT_MAX
37
6f29feb1
JW
38/* Register Transfer Language EXPRESSIONS CODES */
39
40#define RTX_CODE enum rtx_code
41enum rtx_code {
42
43#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) ENUM ,
44#include "rtl.def" /* rtl expressions are documented here */
45#undef DEF_RTL_EXPR
46
6dc42e49 47 LAST_AND_UNUSED_RTX_CODE}; /* A convenient way to get a value for
6f29feb1 48 NUM_RTX_CODE.
6dc42e49 49 Assumes default enum value assignment. */
6f29feb1 50
cf403648 51#define NUM_RTX_CODE ((int) LAST_AND_UNUSED_RTX_CODE)
6f29feb1
JW
52 /* The cast here, saves many elsewhere. */
53
ec8e098d
PB
54/* Register Transfer Language EXPRESSIONS CODE CLASSES */
55
56enum rtx_class {
57 /* We check bit 0-1 of some rtx class codes in the predicates below. */
58
59 /* Bit 0 = comparison if 0, arithmetic is 1
60 Bit 1 = 1 if commutative. */
61 RTX_COMPARE, /* 0 */
62 RTX_COMM_COMPARE,
63 RTX_BIN_ARITH,
64 RTX_COMM_ARITH,
65
66 /* Must follow the four preceding values. */
67 RTX_UNARY, /* 4 */
68
69 RTX_EXTRA,
70 RTX_MATCH,
71 RTX_INSN,
72
73 /* Bit 0 = 1 if constant. */
74 RTX_OBJ, /* 8 */
75 RTX_CONST_OBJ,
76
77 RTX_TERNARY,
78 RTX_BITFIELD_OPS,
79 RTX_AUTOINC
80};
81
82#define RTX_OBJ_MASK (~1)
83#define RTX_OBJ_RESULT (RTX_OBJ & RTX_OBJ_MASK)
84#define RTX_COMPARE_MASK (~1)
85#define RTX_COMPARE_RESULT (RTX_COMPARE & RTX_COMPARE_MASK)
86#define RTX_ARITHMETIC_MASK (~1)
87#define RTX_ARITHMETIC_RESULT (RTX_COMM_ARITH & RTX_ARITHMETIC_MASK)
88#define RTX_BINARY_MASK (~3)
89#define RTX_BINARY_RESULT (RTX_COMPARE & RTX_BINARY_MASK)
90#define RTX_COMMUTATIVE_MASK (~2)
91#define RTX_COMMUTATIVE_RESULT (RTX_COMM_COMPARE & RTX_COMMUTATIVE_MASK)
92#define RTX_NON_COMMUTATIVE_RESULT (RTX_COMPARE & RTX_COMMUTATIVE_MASK)
93#define RTX_EXPR_FIRST (RTX_COMPARE)
94#define RTX_EXPR_LAST (RTX_UNARY)
95
86460bab 96extern const unsigned char rtx_length[NUM_RTX_CODE];
0f41302f 97#define GET_RTX_LENGTH(CODE) (rtx_length[(int) (CODE)])
6f29feb1 98
86460bab 99extern const char * const rtx_name[NUM_RTX_CODE];
0f41302f 100#define GET_RTX_NAME(CODE) (rtx_name[(int) (CODE)])
6f29feb1 101
86460bab 102extern const char * const rtx_format[NUM_RTX_CODE];
0f41302f 103#define GET_RTX_FORMAT(CODE) (rtx_format[(int) (CODE)])
6f29feb1 104
ec8e098d 105extern const enum rtx_class rtx_class[NUM_RTX_CODE];
0f41302f 106#define GET_RTX_CLASS(CODE) (rtx_class[(int) (CODE)])
36a5eadd 107
e1de1560 108extern const unsigned char rtx_size[NUM_RTX_CODE];
36a5eadd 109extern const unsigned char rtx_next[NUM_RTX_CODE];
6f29feb1 110\f
33f7f353
JR
111/* The flags and bitfields of an ADDR_DIFF_VEC. BASE is the base label
112 relative to which the offsets are calculated, as explained in rtl.def. */
113typedef struct
114{
115 /* Set at the start of shorten_branches - ONLY WHEN OPTIMIZING - : */
116 unsigned min_align: 8;
117 /* Flags: */
118 unsigned base_after_vec: 1; /* BASE is after the ADDR_DIFF_VEC. */
173b24b9
RK
119 unsigned min_after_vec: 1; /* minimum address target label is
120 after the ADDR_DIFF_VEC. */
121 unsigned max_after_vec: 1; /* maximum address target label is
122 after the ADDR_DIFF_VEC. */
123 unsigned min_after_base: 1; /* minimum address target label is
124 after BASE. */
125 unsigned max_after_base: 1; /* maximum address target label is
126 after BASE. */
33f7f353
JR
127 /* Set by the actual branch shortening process - ONLY WHEN OPTIMIZING - : */
128 unsigned offset_unsigned: 1; /* offsets have to be treated as unsigned. */
129 unsigned : 2;
130 unsigned scale : 8;
131} addr_diff_vec_flags;
132
173b24b9
RK
133/* Structure used to describe the attributes of a MEM. These are hashed
134 so MEMs that the same attributes share a data structure. This means
135 they cannot be modified in place. If any element is nonzero, it means
136 the value of the corresponding attribute is unknown. */
184166b5
R
137/* ALIGN and SIZE are the alignment and size of the MEM itself,
138 while EXPR can describe a larger underlying object, which might have a
139 stricter alignment; OFFSET is the offset of the MEM within that object. */
e2500fed 140typedef struct mem_attrs GTY(())
173b24b9 141{
eebedaa5 142 HOST_WIDE_INT alias; /* Memory alias set. */
998d7deb 143 tree expr; /* expr corresponding to MEM. */
eebedaa5 144 rtx offset; /* Offset from start of DECL, as CONST_INT. */
173b24b9 145 rtx size; /* Size in bytes, as a CONST_INT. */
d022d93e 146 unsigned int align; /* Alignment of MEM in bits. */
173b24b9
RK
147} mem_attrs;
148
a560d4d4
JH
149/* Structure used to describe the attributes of a REG in similar way as
150 mem_attrs does for MEM above. */
151
152typedef struct reg_attrs GTY(())
153{
154 tree decl; /* decl corresponding to REG. */
155 HOST_WIDE_INT offset; /* Offset from start of DECL. */
156} reg_attrs;
157
6f29feb1
JW
158/* Common union for an element of an rtx. */
159
36a5eadd 160union rtunion_def
6f29feb1 161{
9ce88f5e
GDR
162 int rt_int;
163 unsigned int rt_uint;
164 const char *rt_str;
165 rtx rt_rtx;
166 rtvec rt_rtvec;
167 enum machine_mode rt_type;
33f7f353 168 addr_diff_vec_flags rt_addr_diff_vec_flags;
eab5c70a 169 struct cselib_val_struct *rt_cselib;
9ce88f5e
GDR
170 struct bitmap_head_def *rt_bit;
171 tree rt_tree;
172 struct basic_block_def *rt_bb;
173 mem_attrs *rt_mem;
174 reg_attrs *rt_reg;
36a5eadd
GK
175};
176typedef union rtunion_def rtunion;
6f29feb1
JW
177
178/* RTL expression ("rtx"). */
179
3d7aafde 180struct rtx_def GTY((chain_next ("RTX_NEXT (&%h)"),
36a5eadd 181 chain_prev ("RTX_PREV (&%h)")))
6f29feb1 182{
6f29feb1 183 /* The kind of expression this is. */
c149cc37 184 ENUM_BITFIELD(rtx_code) code: 16;
18def38f 185
6f29feb1 186 /* The kind of value the expression has. */
c149cc37
RL
187 ENUM_BITFIELD(machine_mode) mode : 8;
188
5a63e069
JJ
189 /* 1 in a MEM if we should keep the alias set for this mem unchanged
190 when we access a component.
191 1 in a CALL_INSN if it is a sibling call.
0dc36574
ZW
192 1 in a SET that is for a return.
193 In a CODE_LABEL, part of the two-bit alternate entry field. */
6f29feb1 194 unsigned int jump : 1;
4da2eb6b
RH
195 /* In a CODE_LABEL, part of the two-bit alternate entry field.
196 1 in a MEM if it cannot trap. */
6f29feb1 197 unsigned int call : 1;
5a63e069
JJ
198 /* 1 in a REG, MEM, or CONCAT if the value is set at most once, anywhere.
199 1 in a SUBREG if it references an unsigned object whose mode has been
200 from a promoted to a wider mode.
6f29feb1
JW
201 1 in a SYMBOL_REF if it addresses something in the per-function
202 constants pool.
5a63e069 203 1 in a CALL_INSN, NOTE, or EXPR_LIST for a const or pure call.
7440af14 204 1 in a JUMP_INSN, CALL_INSN, or INSN of an annulling branch. */
6f29feb1 205 unsigned int unchanging : 1;
5a63e069
JJ
206 /* 1 in a MEM or ASM_OPERANDS expression if the memory reference is volatile.
207 1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL, BARRIER, or NOTE
208 if it has been deleted.
209 1 in a REG expression if corresponds to a variable declared by the user,
6f29feb1 210 0 for an internally generated temporary.
5a63e069
JJ
211 1 in a SUBREG with a negative value.
212 1 in a LABEL_REF or in a REG_LABEL note for a non-local label.
213 In a SYMBOL_REF, this flag is used for machine-specific purposes. */
6f29feb1 214 unsigned int volatil : 1;
8358a974 215 /* 1 in a MEM referring to a field of an aggregate.
6f29feb1
JW
216 0 if the MEM was a variable or the result of a * operator in C;
217 1 if it was the result of a . or -> operator (on a struct) in C.
218 1 in a REG if the register is used only in exit code a loop.
f590cca1 219 1 in a SUBREG expression if was generated from a variable with a
07be3989 220 promoted mode.
6f29feb1
JW
221 1 in a CODE_LABEL if the label is used for nonlocal gotos
222 and must not be deleted even if its count is zero.
be202ec2
FS
223 1 in an INSN, JUMP_INSN or CALL_INSN if this insn must be scheduled
224 together with the preceding insn. Valid only within sched.
6f29feb1
JW
225 1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and
226 from the target of a branch. Valid from reorg until end of compilation;
d67fb775 227 cleared before used. */
6f29feb1 228 unsigned int in_struct : 1;
5a63e069
JJ
229 /* At the end of RTL generation, 1 if this rtx is used. This is used for
230 copying shared structure. See `unshare_all_rtl'.
f590cca1 231 In a REG, this is not needed for that purpose, and used instead
6f29feb1 232 in `leaf_renumber_regs_insn'.
5a63e069 233 1 in a SYMBOL_REF, means that emit_library_call
6f29feb1
JW
234 has used it as the function. */
235 unsigned int used : 1;
b664de3a 236 /* 1 in an INSN or a SET if this rtx is related to the call frame,
c6df88cb 237 either changing how we compute the frame address or saving and
f590cca1 238 restoring registers in the prologue and epilogue.
f8ad8d7c 239 1 in a REG or MEM if it is a pointer.
bd7cf17e
JJ
240 1 in a SYMBOL_REF if it addresses something in the per-function
241 constant string pool. */
469ac993 242 unsigned frame_related : 1;
6de9cd9a 243 /* 1 in a REG or PARALLEL that is the current function's return value.
acf8677f 244 1 in a MEM if it refers to a scalar.
6de9cd9a
DN
245 1 in a SYMBOL_REF for a weak symbol. */
246 unsigned return_val : 1;
0a25f1f5 247
6f29feb1
JW
248 /* The first element of the operands of this rtx.
249 The number of operands and their types are controlled
250 by the `code' field, according to rtl.def. */
e1de1560
RS
251 union u {
252 rtunion fld[1];
253 HOST_WIDE_INT hwint[1];
254 } GTY ((special ("rtx_def"), desc ("GET_CODE (&%0)"))) u;
2f78c311 255};
6f29feb1 256
e1de1560
RS
257/* The size in bytes of an rtx header (code, mode and flags). */
258#define RTX_HDR_SIZE offsetof (struct rtx_def, u)
259
260/* The size in bytes of an rtx with code CODE. */
261#define RTX_SIZE(CODE) rtx_size[CODE]
262
6f29feb1
JW
263#define NULL_RTX (rtx) 0
264
36a5eadd
GK
265/* The "next" and "previous" RTX, relative to this one. */
266
267#define RTX_NEXT(X) (rtx_next[GET_CODE (X)] == 0 ? NULL \
268 : *(rtx *)(((char *)X) + rtx_next[GET_CODE (X)]))
269
270/* FIXME: the "NEXT_INSN (PREV_INSN (X)) == X" condition shouldn't be needed.
271 */
4b4bf941
JQ
272#define RTX_PREV(X) ((INSN_P (X) \
273 || NOTE_P (X) \
274 || BARRIER_P (X) \
275 || LABEL_P (X)) \
36a5eadd
GK
276 && PREV_INSN (X) != NULL \
277 && NEXT_INSN (PREV_INSN (X)) == X \
278 ? PREV_INSN (X) : NULL)
279
6f29feb1
JW
280/* Define macros to access the `code' field of the rtx. */
281
dbbbbf3b 282#define GET_CODE(RTX) ((enum rtx_code) (RTX)->code)
7e7c843f 283#define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE))
6f29feb1 284
dbbbbf3b 285#define GET_MODE(RTX) ((enum machine_mode) (RTX)->mode)
7e7c843f 286#define PUT_MODE(RTX, MODE) ((RTX)->mode = (MODE))
6f29feb1 287
6f29feb1
JW
288/* RTL vector. These appear inside RTX's when there is a need
289 for a variable number of things. The principle use is inside
290 PARALLEL expressions. */
291
e2500fed 292struct rtvec_def GTY(()) {
e9a25f70 293 int num_elem; /* number of elements */
e2500fed 294 rtx GTY ((length ("%h.num_elem"))) elem[1];
2f78c311 295};
6f29feb1
JW
296
297#define NULL_RTVEC (rtvec) 0
298
299#define GET_NUM_ELEM(RTVEC) ((RTVEC)->num_elem)
e9a25f70 300#define PUT_NUM_ELEM(RTVEC, NUM) ((RTVEC)->num_elem = (NUM))
6f29feb1 301
3d27dbd0 302/* Predicate yielding nonzero iff X is an rtx for a register. */
6f29feb1
JW
303#define REG_P(X) (GET_CODE (X) == REG)
304
3d27dbd0
SB
305/* Predicate yielding nonzero iff X is an rtx for a memory location. */
306#define MEM_P(X) (GET_CODE (X) == MEM)
307
b53978a3
JO
308/* Predicate yielding nonzero iff X is a label insn. */
309#define LABEL_P(X) (GET_CODE (X) == CODE_LABEL)
310
311/* Predicate yielding nonzero iff X is a jump insn. */
312#define JUMP_P(X) (GET_CODE (X) == JUMP_INSN)
313
3d27dbd0
SB
314/* Predicate yielding nonzero iff X is a call insn. */
315#define CALL_P(X) (GET_CODE (X) == CALL_INSN)
316
317/* Predicate yielding nonzero iff X is an insn that cannot jump. */
318#define NONJUMP_INSN_P(X) (GET_CODE (X) == INSN)
319
320/* Predicate yielding nonzero iff X is a real insn. */
321#define INSN_P(X) \
322 (NONJUMP_INSN_P (X) || JUMP_P (X) || CALL_P (X))
323
b53978a3
JO
324/* Predicate yielding nonzero iff X is a note insn. */
325#define NOTE_P(X) (GET_CODE (X) == NOTE)
326
327/* Predicate yielding nonzero iff X is a barrier insn. */
328#define BARRIER_P(X) (GET_CODE (X) == BARRIER)
329
330/* Predicate yielding nonzero iff X is a data for a jump table. */
331#define JUMP_TABLE_DATA_P(INSN) \
332 (JUMP_P (INSN) && (GET_CODE (PATTERN (INSN)) == ADDR_VEC || \
333 GET_CODE (PATTERN (INSN)) == ADDR_DIFF_VEC))
334
ec8e098d
PB
335/* 1 if X is a unary operator. */
336
337#define UNARY_P(X) \
338 (GET_RTX_CLASS (GET_CODE (X)) == RTX_UNARY)
339
340/* 1 if X is a binary operator. */
341
342#define BINARY_P(X) \
343 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_BINARY_MASK) == RTX_BINARY_RESULT)
344
345/* 1 if X is an arithmetic operator. */
346
347#define ARITHMETIC_P(X) \
348 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_ARITHMETIC_MASK) \
349 == RTX_ARITHMETIC_RESULT)
350
351/* 1 if X is an arithmetic operator. */
352
353#define COMMUTATIVE_ARITH_P(X) \
354 (GET_RTX_CLASS (GET_CODE (X)) == RTX_COMM_ARITH)
355
356/* 1 if X is a commutative arithmetic operator or a comparison operator.
357 These two are sometimes selected together because it is possible to
358 swap the two operands. */
359
360#define SWAPPABLE_OPERANDS_P(X) \
361 ((1 << GET_RTX_CLASS (GET_CODE (X))) \
362 & ((1 << RTX_COMM_ARITH) | (1 << RTX_COMM_COMPARE) \
363 | (1 << RTX_COMPARE)))
364
365/* 1 if X is a non-commutative operator. */
366
367#define NON_COMMUTATIVE_P(X) \
368 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \
369 == RTX_NON_COMMUTATIVE_RESULT)
370
371/* 1 if X is a commutative operator on integers. */
372
373#define COMMUTATIVE_P(X) \
374 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \
375 == RTX_COMMUTATIVE_RESULT)
376
377/* 1 if X is a relational operator. */
378
379#define COMPARISON_P(X) \
380 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMPARE_MASK) == RTX_COMPARE_RESULT)
381
6f29feb1
JW
382/* 1 if X is a constant value that is an integer. */
383
384#define CONSTANT_P(X) \
f4770271 385 (GET_RTX_CLASS (GET_CODE (X)) == RTX_CONST_OBJ)
6f29feb1 386
ec8e098d
PB
387/* 1 if X can be used to represent an object. */
388#define OBJECT_P(X) \
389 ((GET_RTX_CLASS (GET_CODE (X)) & RTX_OBJ_MASK) == RTX_OBJ_RESULT)
390
6f29feb1
JW
391/* General accessor macros for accessing the fields of an rtx. */
392
f4524c9e 393#if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
ef178af3
ZW
394/* The bit with a star outside the statement expr and an & inside is
395 so that N can be evaluated only once. */
8784fdcd 396#define RTL_CHECK1(RTX, N, C1) __extension__ \
d544bc39
KG
397(*({ rtx const _rtx = (RTX); const int _n = (N); \
398 const enum rtx_code _code = GET_CODE (_rtx); \
ef178af3 399 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
f52eda29
GS
400 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
401 __FUNCTION__); \
ef178af3 402 if (GET_RTX_FORMAT(_code)[_n] != C1) \
f52eda29
GS
403 rtl_check_failed_type1 (_rtx, _n, C1, __FILE__, __LINE__, \
404 __FUNCTION__); \
e1de1560 405 &_rtx->u.fld[_n]; }))
ef178af3 406
8784fdcd 407#define RTL_CHECK2(RTX, N, C1, C2) __extension__ \
d544bc39
KG
408(*({ rtx const _rtx = (RTX); const int _n = (N); \
409 const enum rtx_code _code = GET_CODE (_rtx); \
ef178af3 410 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
f52eda29
GS
411 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
412 __FUNCTION__); \
ef178af3
ZW
413 if (GET_RTX_FORMAT(_code)[_n] != C1 \
414 && GET_RTX_FORMAT(_code)[_n] != C2) \
415 rtl_check_failed_type2 (_rtx, _n, C1, C2, __FILE__, __LINE__, \
fbfc1192 416 __FUNCTION__); \
e1de1560 417 &_rtx->u.fld[_n]; }))
ef178af3 418
8784fdcd 419#define RTL_CHECKC1(RTX, N, C) __extension__ \
d544bc39 420(*({ rtx const _rtx = (RTX); const int _n = (N); \
f52eda29
GS
421 if (GET_CODE (_rtx) != (C)) \
422 rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
423 __FUNCTION__); \
e1de1560 424 &_rtx->u.fld[_n]; }))
83ab3839 425
8784fdcd 426#define RTL_CHECKC2(RTX, N, C1, C2) __extension__ \
d544bc39
KG
427(*({ rtx const _rtx = (RTX); const int _n = (N); \
428 const enum rtx_code _code = GET_CODE (_rtx); \
f52eda29
GS
429 if (_code != (C1) && _code != (C2)) \
430 rtl_check_failed_code2 (_rtx, (C1), (C2), __FILE__, __LINE__, \
431 __FUNCTION__); \
e1de1560 432 &_rtx->u.fld[_n]; }))
83ab3839 433
8784fdcd 434#define RTVEC_ELT(RTVEC, I) __extension__ \
d544bc39 435(*({ rtvec const _rtvec = (RTVEC); const int _i = (I); \
ef178af3
ZW
436 if (_i < 0 || _i >= GET_NUM_ELEM (_rtvec)) \
437 rtvec_check_failed_bounds (_rtvec, _i, __FILE__, __LINE__, \
fbfc1192 438 __FUNCTION__); \
ef178af3
ZW
439 &_rtvec->elem[_i]; }))
440
e1de1560
RS
441#define XWINT(RTX, N) __extension__ \
442(*({ rtx const _rtx = (RTX); const int _n = (N); \
443 const enum rtx_code _code = GET_CODE (_rtx); \
444 if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
445 rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
446 __FUNCTION__); \
447 if (GET_RTX_FORMAT(_code)[_n] != 'w') \
448 rtl_check_failed_type1 (_rtx, _n, 'w', __FILE__, __LINE__, \
449 __FUNCTION__); \
450 &_rtx->u.hwint[_n]; }))
451
452#define XCWINT(RTX, N, C) __extension__ \
453(*({ rtx const _rtx = (RTX); \
454 if (GET_CODE (_rtx) != (C)) \
455 rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
456 __FUNCTION__); \
457 &_rtx->u.hwint[N]; }))
458
0c20a65f
AJ
459extern void rtl_check_failed_bounds (rtx, int, const char *, int,
460 const char *)
ef178af3 461 ATTRIBUTE_NORETURN;
0c20a65f
AJ
462extern void rtl_check_failed_type1 (rtx, int, int, const char *, int,
463 const char *)
ef178af3 464 ATTRIBUTE_NORETURN;
0c20a65f
AJ
465extern void rtl_check_failed_type2 (rtx, int, int, int, const char *,
466 int, const char *)
ef178af3 467 ATTRIBUTE_NORETURN;
0c20a65f
AJ
468extern void rtl_check_failed_code1 (rtx, enum rtx_code, const char *,
469 int, const char *)
83ab3839 470 ATTRIBUTE_NORETURN;
0c20a65f
AJ
471extern void rtl_check_failed_code2 (rtx, enum rtx_code, enum rtx_code,
472 const char *, int, const char *)
83ab3839 473 ATTRIBUTE_NORETURN;
0c20a65f
AJ
474extern void rtvec_check_failed_bounds (rtvec, int, const char *, int,
475 const char *)
ef178af3
ZW
476 ATTRIBUTE_NORETURN;
477
f4524c9e 478#else /* not ENABLE_RTL_CHECKING */
ef178af3 479
e1de1560
RS
480#define RTL_CHECK1(RTX, N, C1) ((RTX)->u.fld[N])
481#define RTL_CHECK2(RTX, N, C1, C2) ((RTX)->u.fld[N])
482#define RTL_CHECKC1(RTX, N, C) ((RTX)->u.fld[N])
483#define RTL_CHECKC2(RTX, N, C1, C2) ((RTX)->u.fld[N])
83ab3839 484#define RTVEC_ELT(RTVEC, I) ((RTVEC)->elem[I])
e1de1560
RS
485#define XWINT(RTX, N) ((RTX)->u.hwint[N])
486#define XCWINT(RTX, N, C) ((RTX)->u.hwint[N])
ef178af3
ZW
487
488#endif
489
5a63e069
JJ
490/* General accessor macros for accessing the flags of an rtx. */
491
492/* Access an individual rtx flag, with no checking of any kind. */
493#define RTX_FLAG(RTX, FLAG) ((RTX)->FLAG)
494
65212b66 495#if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION >= 2007)
2d4cc6a7 496#define RTL_FLAG_CHECK1(NAME, RTX, C1) __extension__ \
5a63e069
JJ
497({ rtx const _rtx = (RTX); \
498 if (GET_CODE(_rtx) != C1) \
2d4cc6a7 499 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
3d7aafde 500 __FUNCTION__); \
5a63e069
JJ
501 _rtx; })
502
2d4cc6a7 503#define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) __extension__ \
5a63e069
JJ
504({ rtx const _rtx = (RTX); \
505 if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2) \
2d4cc6a7 506 rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
3d7aafde 507 __FUNCTION__); \
5a63e069
JJ
508 _rtx; })
509
2d4cc6a7 510#define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) __extension__ \
5a63e069 511({ rtx const _rtx = (RTX); \
3d7aafde 512 if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2 \
5a63e069 513 && GET_CODE(_rtx) != C3) \
2d4cc6a7 514 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
3d7aafde 515 __FUNCTION__); \
5a63e069
JJ
516 _rtx; })
517
2d4cc6a7 518#define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) __extension__ \
5a63e069 519({ rtx const _rtx = (RTX); \
3d7aafde 520 if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2 \
5a63e069 521 && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4) \
2d4cc6a7 522 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
3d7aafde 523 __FUNCTION__); \
5a63e069
JJ
524 _rtx; })
525
2d4cc6a7 526#define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) __extension__ \
5a63e069 527({ rtx const _rtx = (RTX); \
3d7aafde 528 if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2 \
5a63e069
JJ
529 && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4 \
530 && GET_CODE(_rtx) != C5) \
2d4cc6a7 531 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
3d7aafde 532 __FUNCTION__); \
5a63e069
JJ
533 _rtx; })
534
2d4cc6a7
JJ
535#define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) \
536 __extension__ \
5a63e069 537({ rtx const _rtx = (RTX); \
3d7aafde 538 if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2 \
5a63e069
JJ
539 && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4 \
540 && GET_CODE(_rtx) != C5 && GET_CODE(_rtx) != C6) \
2d4cc6a7 541 rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
3d7aafde 542 __FUNCTION__); \
5a63e069
JJ
543 _rtx; })
544
2d4cc6a7
JJ
545#define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) \
546 __extension__ \
5a63e069 547({ rtx const _rtx = (RTX); \
3d7aafde 548 if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2 \
5a63e069
JJ
549 && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4 \
550 && GET_CODE(_rtx) != C5 && GET_CODE(_rtx) != C6 \
551 && GET_CODE(_rtx) != C7) \
2d4cc6a7 552 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
3d7aafde 553 __FUNCTION__); \
5a63e069
JJ
554 _rtx; })
555
2d4cc6a7
JJ
556#define RTL_FLAG_CHECK8(NAME, RTX, C1, C2, C3, C4, C5, C6, C7, C8) \
557 __extension__ \
5a63e069 558({ rtx const _rtx = (RTX); \
3d7aafde 559 if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2 \
5a63e069
JJ
560 && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4 \
561 && GET_CODE(_rtx) != C5 && GET_CODE(_rtx) != C6 \
562 && GET_CODE(_rtx) != C7 && GET_CODE(_rtx) != C8) \
2d4cc6a7 563 rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
3d7aafde 564 __FUNCTION__); \
5a63e069
JJ
565 _rtx; })
566
0c20a65f
AJ
567extern void rtl_check_failed_flag (const char *, rtx, const char *,
568 int, const char *)
5a63e069
JJ
569 ATTRIBUTE_NORETURN
570 ;
571
572#else /* not ENABLE_RTL_FLAG_CHECKING */
573
2d4cc6a7
JJ
574#define RTL_FLAG_CHECK1(NAME, RTX, C1) (RTX)
575#define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) (RTX)
576#define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) (RTX)
577#define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) (RTX)
3d7aafde 578#define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) (RTX)
2d4cc6a7
JJ
579#define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) (RTX)
580#define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) (RTX)
581#define RTL_FLAG_CHECK8(NAME, RTX, C1, C2, C3, C4, C5, C6, C7, C8) (RTX)
5a63e069
JJ
582#endif
583
584#define CLEAR_RTX_FLAGS(RTX) \
585do { \
586 rtx const _rtx = (RTX); \
5a63e069 587 _rtx->jump = 0; \
acf8677f 588 _rtx->call = 0; \
5a63e069 589 _rtx->unchanging = 0; \
5a63e069 590 _rtx->volatil = 0; \
acf8677f
SB
591 _rtx->in_struct = 0; \
592 _rtx->used = 0; \
593 _rtx->frame_related = 0; \
594 _rtx->return_val = 0; \
5a63e069
JJ
595} while (0)
596
9ce88f5e
GDR
597#define XINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rt_int)
598#define XSTR(RTX, N) (RTL_CHECK2 (RTX, N, 's', 'S').rt_str)
599#define XEXP(RTX, N) (RTL_CHECK2 (RTX, N, 'e', 'u').rt_rtx)
600#define XVEC(RTX, N) (RTL_CHECK2 (RTX, N, 'E', 'V').rt_rtvec)
601#define XMODE(RTX, N) (RTL_CHECK1 (RTX, N, 'M').rt_type)
602#define XBITMAP(RTX, N) (RTL_CHECK1 (RTX, N, 'b').rt_bit)
603#define XTREE(RTX, N) (RTL_CHECK1 (RTX, N, 't').rt_tree)
604#define XBBDEF(RTX, N) (RTL_CHECK1 (RTX, N, 'B').rt_bb)
605#define XTMPL(RTX, N) (RTL_CHECK1 (RTX, N, 'T').rt_str)
ef178af3
ZW
606
607#define XVECEXP(RTX, N, M) RTVEC_ELT (XVEC (RTX, N), M)
608#define XVECLEN(RTX, N) GET_NUM_ELEM (XVEC (RTX, N))
609
e1de1560 610/* These are like XINT, etc. except that they expect a '0' field instead
ef178af3
ZW
611 of the normal type code. */
612
9ce88f5e
GDR
613#define X0INT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_int)
614#define X0UINT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_uint)
615#define X0STR(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_str)
616#define X0EXP(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtx)
617#define X0VEC(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtvec)
618#define X0MODE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_type)
619#define X0BITMAP(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_bit)
620#define X0TREE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_tree)
621#define X0BBDEF(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_bb)
f52eda29
GS
622#define X0ADVFLAGS(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_addr_diff_vec_flags)
623#define X0CSELIB(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_cselib)
9ce88f5e
GDR
624#define X0MEMATTR(RTX, N) (RTL_CHECKC1 (RTX, N, MEM).rt_mem)
625#define X0REGATTR(RTX, N) (RTL_CHECKC1 (RTX, N, REG).rt_reg)
f52eda29 626
e1de1560
RS
627/* Access a '0' field with any type. */
628#define X0ANY(RTX, N) RTL_CHECK1 (RTX, N, '0')
629
9ce88f5e
GDR
630#define XCINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_int)
631#define XCUINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_uint)
632#define XCSTR(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_str)
633#define XCEXP(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtx)
634#define XCVEC(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtvec)
635#define XCMODE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_type)
636#define XCBITMAP(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_bit)
637#define XCTREE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_tree)
638#define XCBBDEF(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_bb)
f52eda29 639#define XCCSELIB(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_cselib)
83ab3839
RH
640
641#define XCVECEXP(RTX, N, M, C) RTVEC_ELT (XCVEC (RTX, N, C), M)
642#define XCVECLEN(RTX, N, C) GET_NUM_ELEM (XCVEC (RTX, N, C))
643
9ce88f5e 644#define XC2EXP(RTX, N, C1, C2) (RTL_CHECKC2 (RTX, N, C1, C2).rt_rtx)
6f29feb1
JW
645\f
646/* ACCESS MACROS for particular fields of insns. */
647
648/* Holds a unique number for each insn.
649 These are not necessarily sequentially increasing. */
f52eda29 650#define INSN_UID(INSN) XINT (INSN, 0)
6f29feb1
JW
651
652/* Chain insns together in sequence. */
f52eda29
GS
653#define PREV_INSN(INSN) XEXP (INSN, 1)
654#define NEXT_INSN(INSN) XEXP (INSN, 2)
6f29feb1 655
ba4f7968 656#define BLOCK_FOR_INSN(INSN) XBBDEF (INSN, 3)
0435312e 657#define INSN_LOCATOR(INSN) XINT (INSN, 4)
6f29feb1 658/* The body of an insn. */
ba4f7968 659#define PATTERN(INSN) XEXP (INSN, 5)
6f29feb1
JW
660
661/* Code number of instruction, from when it was recognized.
662 -1 means this instruction has not been recognized yet. */
ba4f7968 663#define INSN_CODE(INSN) XINT (INSN, 6)
6f29feb1
JW
664
665/* Set up in flow.c; empty before then.
666 Holds a chain of INSN_LIST rtx's whose first operands point at
667 previous insns with direct data-flow connections to this one.
668 That means that those insns set variables whose next use is in this insn.
669 They are always in the same basic block as this insn. */
ba4f7968 670#define LOG_LINKS(INSN) XEXP(INSN, 7)
6f29feb1 671
2d4cc6a7
JJ
672#define RTX_FRAME_RELATED_P(RTX) \
673 (RTL_FLAG_CHECK5("RTX_FRAME_RELATED_P", (RTX), INSN, CALL_INSN, \
674 JUMP_INSN, BARRIER, SET)->frame_related)
675
676/* 1 if RTX is an insn that has been deleted. */
677#define INSN_DELETED_P(RTX) \
678 (RTL_FLAG_CHECK6("INSN_DELETED_P", (RTX), INSN, CALL_INSN, JUMP_INSN, \
679 CODE_LABEL, BARRIER, NOTE)->volatil)
680
681/* 1 if RTX is a call to a const or pure function. */
682#define CONST_OR_PURE_CALL_P(RTX) \
683 (RTL_FLAG_CHECK3("CONST_OR_PURE_CALL_P", (RTX), CALL_INSN, NOTE, \
684 EXPR_LIST)->unchanging)
685
686/* 1 if RTX is a call_insn for a sibling call. */
687#define SIBLING_CALL_P(RTX) \
688 (RTL_FLAG_CHECK1("SIBLING_CALL_P", (RTX), CALL_INSN)->jump)
689
7440af14 690/* 1 if RTX is a jump_insn, call_insn, or insn that is an annulling branch. */
2d4cc6a7 691#define INSN_ANNULLED_BRANCH_P(RTX) \
7440af14 692 (RTL_FLAG_CHECK3("INSN_ANNULLED_BRANCH_P", (RTX), JUMP_INSN, CALL_INSN, INSN)->unchanging)
2d4cc6a7 693
2d4cc6a7
JJ
694/* 1 if RTX is an insn in a delay slot and is from the target of the branch.
695 If the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be
6f29feb1
JW
696 executed if the branch is taken. For annulled branches with this bit
697 clear, the insn should be executed only if the branch is not taken. */
2d4cc6a7 698#define INSN_FROM_TARGET_P(RTX) \
cf40ea15 699 (RTL_FLAG_CHECK3("INSN_FROM_TARGET_P", (RTX), INSN, JUMP_INSN, CALL_INSN)->in_struct)
6f29feb1 700
d67fb775
SB
701/* In an ADDR_DIFF_VEC, the flags for RTX for use by branch shortening.
702 See the comments for ADDR_DIFF_VEC in rtl.def. */
f590cca1
RH
703#define ADDR_DIFF_VEC_FLAGS(RTX) X0ADVFLAGS(RTX, 4)
704
d67fb775
SB
705/* In a VALUE, the value cselib has assigned to RTX.
706 This is a "struct cselib_val_struct", see cselib.h. */
f590cca1
RH
707#define CSELIB_VAL_PTR(RTX) X0CSELIB(RTX, 0)
708
6f29feb1 709/* Holds a list of notes on what this insn does to various REGs.
f590cca1
RH
710 It is a chain of EXPR_LIST rtx's, where the second operand is the
711 chain pointer and the first operand is the REG being described.
6f29feb1 712 The mode field of the EXPR_LIST contains not a real machine mode
f590cca1 713 but a value from enum reg_note. */
ba4f7968 714#define REG_NOTES(INSN) XEXP(INSN, 8)
6f29feb1 715
f590cca1
RH
716enum reg_note
717{
826c9564
ZW
718#define DEF_REG_NOTE(NAME) NAME,
719#include "reg-notes.def"
720#undef DEF_REG_NOTE
721 REG_NOTE_MAX
f590cca1
RH
722};
723
7ae21caf
DE
724/* The base value for branch probability notes. */
725#define REG_BR_PROB_BASE 10000
6f29feb1
JW
726
727/* Define macros to extract and insert the reg-note kind in an EXPR_LIST. */
728#define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK))
f52eda29
GS
729#define PUT_REG_NOTE_KIND(LINK, KIND) \
730 PUT_MODE (LINK, (enum machine_mode) (KIND))
6f29feb1
JW
731
732/* Names for REG_NOTE's in EXPR_LIST insn's. */
733
1f9a015e 734extern const char * const reg_note_name[];
0f41302f 735#define GET_REG_NOTE_NAME(MODE) (reg_note_name[(int) (MODE)])
6f29feb1 736
e51c6661
RK
737/* This field is only present on CALL_INSNs. It holds a chain of EXPR_LIST of
738 USE and CLOBBER expressions.
739 USE expressions list the registers filled with arguments that
740 are passed to the function.
741 CLOBBER expressions document the registers explicitly clobbered
742 by this CALL_INSN.
743 Pseudo registers can not be mentioned in this list. */
ba4f7968 744#define CALL_INSN_FUNCTION_USAGE(INSN) XEXP(INSN, 9)
e51c6661 745
6f29feb1
JW
746/* The label-number of a code-label. The assembler label
747 is made from `L' and the label-number printed in decimal.
748 Label numbers are unique in a compilation. */
ba4f7968 749#define CODE_LABEL_NUMBER(INSN) XINT (INSN, 6)
6f29feb1 750
0dfa1860
MM
751/* In a NOTE that is a line number, this is a string for the file name that the
752 line is in. We use the same field to record block numbers temporarily in
753 NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes. (We avoid lots of casts
754 between ints and pointers if we use a different macro for the block number.)
63f4a88e 755 */
6f29feb1 756
fd3acbb3 757/* Opaque data. */
dd107e66 758#define NOTE_DATA(INSN) RTL_CHECKC1 (INSN, 4, NOTE)
c1667470
PB
759#define NOTE_DELETED_LABEL_NAME(INSN) XCSTR (INSN, 4, NOTE)
760#ifdef USE_MAPPED_LOCATION
761#define NOTE_SOURCE_LOCATION(INSN) XCUINT (INSN, 5, NOTE)
762#define NOTE_EXPANDED_LOCATION(XLOC, INSN) \
763 (XLOC) = expand_location (NOTE_SOURCE_LOCATION (INSN))
764#define SET_INSN_DELETED(INSN) \
765 (PUT_CODE (INSN, NOTE), NOTE_LINE_NUMBER (INSN) = NOTE_INSN_DELETED)
766#else
767#define NOTE_EXPANDED_LOCATION(XLOC, INSN) \
768 ((XLOC).file = NOTE_SOURCE_FILE (INSN), \
769 (XLOC).line = NOTE_LINE_NUMBER (INSN))
3d7aafde 770#define NOTE_SOURCE_FILE(INSN) XCSTR (INSN, 4, NOTE)
c1667470
PB
771#define SET_INSN_DELETED(INSN) \
772 (PUT_CODE (INSN, NOTE), NOTE_SOURCE_FILE (INSN) = 0, \
773 NOTE_LINE_NUMBER (INSN) = NOTE_INSN_DELETED)
774#endif
ba4f7968
JH
775#define NOTE_BLOCK(INSN) XCTREE (INSN, 4, NOTE)
776#define NOTE_EH_HANDLER(INSN) XCINT (INSN, 4, NOTE)
ba4f7968
JH
777#define NOTE_BASIC_BLOCK(INSN) XCBBDEF (INSN, 4, NOTE)
778#define NOTE_EXPECTED_VALUE(INSN) XCEXP (INSN, 4, NOTE)
779#define NOTE_PREDICTION(INSN) XCINT (INSN, 4, NOTE)
014a1138 780#define NOTE_VAR_LOCATION(INSN) XCEXP (INSN, 4, NOTE)
0dfa1860 781
6f29feb1
JW
782/* In a NOTE that is a line number, this is the line number.
783 Other kinds of NOTEs are identified by negative numbers here. */
ba4f7968 784#define NOTE_LINE_NUMBER(INSN) XCINT (INSN, 5, NOTE)
6f29feb1 785
589ca5cb 786/* Nonzero if INSN is a note marking the beginning of a basic block. */
3d7aafde 787#define NOTE_INSN_BASIC_BLOCK_P(INSN) \
589ca5cb
MM
788 (GET_CODE (INSN) == NOTE \
789 && NOTE_LINE_NUMBER (INSN) == NOTE_INSN_BASIC_BLOCK)
790
969d70ca 791/* Algorithm and flags for prediction. */
ba4f7968
JH
792#define NOTE_PREDICTION_ALG(INSN) (XCINT(INSN, 4, NOTE)>>8)
793#define NOTE_PREDICTION_FLAGS(INSN) (XCINT(INSN, 4, NOTE)&0xff)
969d70ca
JH
794#define NOTE_PREDICT(ALG,FLAGS) ((ALG<<8)+(FLAGS))
795
014a1138
JZ
796/* Variable declaration and the location of a variable. */
797#define NOTE_VAR_LOCATION_DECL(INSN) (XCTREE (XCEXP (INSN, 4, NOTE), \
798 0, VAR_LOCATION))
799#define NOTE_VAR_LOCATION_LOC(INSN) (XCEXP (XCEXP (INSN, 4, NOTE), \
800 1, VAR_LOCATION))
6f29feb1 801
826c9564
ZW
802/* Codes that appear in the NOTE_LINE_NUMBER field for kinds of notes
803 that are not line numbers. These codes are all negative.
804
a31efb86
DE
805 Notice that we do not try to use zero here for any of
806 the special note codes because sometimes the source line
807 actually can be zero! This happens (for example) when we
808 are generating code for the per-translation-unit constructor
826c9564 809 and destructor routines for some C++ translation unit. */
6f29feb1 810
d636c18c
RH
811enum insn_note
812{
813 /* Keep all of these numbers negative. Adjust as needed. */
814 NOTE_INSN_BIAS = -100,
815
826c9564
ZW
816#define DEF_INSN_NOTE(NAME) NAME,
817#include "insn-notes.def"
818#undef DEF_INSN_NOTE
014a1138 819
d636c18c
RH
820 NOTE_INSN_MAX
821};
10f07067 822
6f29feb1
JW
823/* Names for NOTE insn's other than line numbers. */
824
d636c18c
RH
825extern const char * const note_insn_name[NOTE_INSN_MAX - NOTE_INSN_BIAS];
826#define GET_NOTE_INSN_NAME(NOTE_CODE) \
dbbbbf3b 827 (note_insn_name[(NOTE_CODE) - (int) NOTE_INSN_BIAS])
6f29feb1
JW
828
829/* The name of a label, in case it corresponds to an explicit label
830 in the input source code. */
ba4f7968 831#define LABEL_NAME(RTX) XCSTR (RTX, 7, CODE_LABEL)
6f29feb1
JW
832
833/* In jump.c, each label contains a count of the number
834 of LABEL_REFs that point at it, so unused labels can be deleted. */
ba4f7968 835#define LABEL_NUSES(RTX) XCINT (RTX, 4, CODE_LABEL)
6f29feb1 836
0dc36574
ZW
837/* Labels carry a two-bit field composed of the ->jump and ->call
838 bits. This field indicates whether the label is an alternate
839 entry point, and if so, what kind. */
840enum label_kind
841{
842 LABEL_NORMAL = 0, /* ordinary label */
843 LABEL_STATIC_ENTRY, /* alternate entry point, not exported */
844 LABEL_GLOBAL_ENTRY, /* alternate entry point, exported */
845 LABEL_WEAK_ENTRY /* alternate entry point, exported as weak symbol */
846};
847
848#if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION > 2007)
849
850/* Retrieve the kind of LABEL. */
851#define LABEL_KIND(LABEL) __extension__ \
852({ rtx const _label = (LABEL); \
853 if (GET_CODE (_label) != CODE_LABEL) \
854 rtl_check_failed_flag ("LABEL_KIND", _label, __FILE__, __LINE__, \
855 __FUNCTION__); \
856 (enum label_kind) ((_label->jump << 1) | _label->call); })
857
858/* Set the kind of LABEL. */
859#define SET_LABEL_KIND(LABEL, KIND) do { \
860 rtx _label = (LABEL); \
861 unsigned int _kind = (KIND); \
862 if (GET_CODE (_label) != CODE_LABEL) \
863 rtl_check_failed_flag ("SET_LABEL_KIND", _label, __FILE__, __LINE__, \
864 __FUNCTION__); \
865 _label->jump = ((_kind >> 1) & 1); \
866 _label->call = (_kind & 1); \
867} while (0)
868
869#else
870
871/* Retrieve the kind of LABEL. */
872#define LABEL_KIND(LABEL) \
873 ((enum label_kind) (((LABEL)->jump << 1) | (LABEL)->call))
874
875/* Set the kind of LABEL. */
876#define SET_LABEL_KIND(LABEL, KIND) do { \
877 rtx _label = (LABEL); \
878 unsigned int _kind = (KIND); \
879 _label->jump = ((_kind >> 1) & 1); \
880 _label->call = (_kind & 1); \
881} while (0)
882
883#endif /* rtl flag checking */
884
885#define LABEL_ALT_ENTRY_P(LABEL) (LABEL_KIND (LABEL) != LABEL_NORMAL)
8cd0faaf 886
6f29feb1
JW
887/* In jump.c, each JUMP_INSN can point to a label that it can jump to,
888 so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
889 be decremented and possibly the label can be deleted. */
ba4f7968 890#define JUMP_LABEL(INSN) XCEXP (INSN, 9, JUMP_INSN)
6f29feb1
JW
891
892/* Once basic blocks are found in flow.c,
893 each CODE_LABEL starts a chain that goes through
894 all the LABEL_REFs that jump to that label.
be1bb652 895 The chain eventually winds up at the CODE_LABEL: it is circular. */
ba4f7968 896#define LABEL_REFS(LABEL) XCEXP (LABEL, 5, CODE_LABEL)
6f29feb1
JW
897\f
898/* This is the field in the LABEL_REF through which the circular chain
899 of references to a particular label is linked.
d67fb775
SB
900 FIXME: This chain is used in loop.c and in the SH backend.
901 Since loop.c is about to go away, it could be a win to replace
902 the uses of this in the SH backend with something else. */
f52eda29 903#define LABEL_NEXTREF(REF) XCEXP (REF, 1, LABEL_REF)
6f29feb1 904
08394eef
BS
905/* For a REG rtx, REGNO extracts the register number. ORIGINAL_REGNO holds
906 the number the register originally had; for a pseudo register turned into
907 a hard reg this will hold the old pseudo register number. */
6f29feb1 908
f52eda29
GS
909#define REGNO(RTX) XCUINT (RTX, 0, REG)
910#define ORIGINAL_REGNO(RTX) X0UINT (RTX, 1)
6f29feb1 911
084a1106
JDA
912/* 1 if RTX is a reg or parallel that is the current function's return
913 value. */
2d4cc6a7 914#define REG_FUNCTION_VALUE_P(RTX) \
6de9cd9a 915 (RTL_FLAG_CHECK2("REG_FUNCTION_VALUE_P", (RTX), REG, PARALLEL)->return_val)
6f29feb1 916
2d4cc6a7
JJ
917/* 1 if RTX is a reg that corresponds to a variable declared by the user. */
918#define REG_USERVAR_P(RTX) \
919 (RTL_FLAG_CHECK1("REG_USERVAR_P", (RTX), REG)->volatil)
6f29feb1 920
2d4cc6a7
JJ
921/* 1 if RTX is a reg that holds a pointer value. */
922#define REG_POINTER(RTX) \
923 (RTL_FLAG_CHECK1("REG_POINTER", (RTX), REG)->frame_related)
3502dc9c 924
f8ad8d7c
ZD
925/* 1 if RTX is a mem that holds a pointer value. */
926#define MEM_POINTER(RTX) \
927 (RTL_FLAG_CHECK1("MEM_POINTER", (RTX), MEM)->frame_related)
928
cdbca172
JO
929/* 1 if the given register REG corresponds to a hard register. */
930#define HARD_REGISTER_P(REG) (HARD_REGISTER_NUM_P (REGNO (REG)))
931
932/* 1 if the given register number REG_NO corresponds to a hard register. */
f52eda29 933#define HARD_REGISTER_NUM_P(REG_NO) ((REG_NO) < FIRST_PSEUDO_REGISTER)
cdbca172 934
6f29feb1 935/* For a CONST_INT rtx, INTVAL extracts the integer. */
83ab3839 936#define INTVAL(RTX) XCWINT(RTX, 0, CONST_INT)
6f29feb1 937
a36556a8 938/* For a CONST_DOUBLE:
46b33600
RH
939 For a DImode, there are two integers CONST_DOUBLE_LOW is the
940 low-order word and ..._HIGH the high-order.
3d7aafde 941 For a float, there is a REAL_VALUE_TYPE structure, and
46b33600 942 CONST_DOUBLE_REAL_VALUE(r) is a pointer to it. */
5692c7bc
ZW
943#define CONST_DOUBLE_LOW(r) XCWINT (r, 0, CONST_DOUBLE)
944#define CONST_DOUBLE_HIGH(r) XCWINT (r, 1, CONST_DOUBLE)
46b33600 945#define CONST_DOUBLE_REAL_VALUE(r) ((struct real_value *)&CONST_DOUBLE_LOW(r))
a36556a8 946
69ef87e2
AH
947/* For a CONST_VECTOR, return element #n. */
948#define CONST_VECTOR_ELT(RTX, N) XCVECEXP (RTX, 0, N, CONST_VECTOR)
949
950/* For a CONST_VECTOR, return the number of elements in a vector. */
951#define CONST_VECTOR_NUNITS(RTX) XCVECLEN (RTX, 0, CONST_VECTOR)
952
6f29feb1 953/* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of.
ddef6bc7 954 SUBREG_BYTE extracts the byte-number. */
6f29feb1 955
f52eda29
GS
956#define SUBREG_REG(RTX) XCEXP (RTX, 0, SUBREG)
957#define SUBREG_BYTE(RTX) XCUINT (RTX, 1, SUBREG)
ddef6bc7
JJ
958
959/* in rtlanal.c */
f894b69b
PB
960/* Return the right cost to give to an operation
961 to make the cost of the corresponding register-to-register instruction
962 N times that of a fast register-to-register instruction. */
963#define COSTS_N_INSNS(N) ((N) * 4)
964
965/* Maximum cost of an rtl expression. This value has the special meaning
966 not to use an rtx with this cost under any circumstances. */
967#define MAX_COST INT_MAX
968
cf94b0fc 969extern void init_rtlanal (void);
f894b69b
PB
970extern int rtx_cost (rtx, enum rtx_code);
971extern int address_cost (rtx, enum machine_mode);
0c20a65f 972extern unsigned int subreg_lsb (rtx);
bb51e270
RS
973extern unsigned int subreg_lsb_1 (enum machine_mode, enum machine_mode,
974 unsigned int);
0c20a65f
AJ
975extern unsigned int subreg_regno_offset (unsigned int, enum machine_mode,
976 unsigned int, enum machine_mode);
977extern bool subreg_offset_representable_p (unsigned int, enum machine_mode,
978 unsigned int, enum machine_mode);
979extern unsigned int subreg_regno (rtx);
2f93eea8
PB
980extern unsigned HOST_WIDE_INT nonzero_bits (rtx, enum machine_mode);
981extern unsigned int num_sign_bit_copies (rtx, enum machine_mode);
982
6f29feb1 983
2d4cc6a7
JJ
984/* 1 if RTX is a subreg containing a reg that is already known to be
985 sign- or zero-extended from the mode of the subreg to the mode of
07be3989 986 the reg. SUBREG_PROMOTED_UNSIGNED_P gives the signedness of the
f590cca1 987 extension.
07be3989
RK
988
989 When used as a LHS, is means that this extension must be done
990 when assigning to SUBREG_REG. */
991
2d4cc6a7
JJ
992#define SUBREG_PROMOTED_VAR_P(RTX) \
993 (RTL_FLAG_CHECK1("SUBREG_PROMOTED", (RTX), SUBREG)->in_struct)
994
995#define SUBREG_PROMOTED_UNSIGNED_SET(RTX, VAL) \
996do { \
b0ad77d5 997 rtx const _rtx = RTL_FLAG_CHECK1("SUBREG_PROMOTED_UNSIGNED_SET", (RTX), SUBREG); \
2d4cc6a7 998 if ((VAL) < 0) \
b0ad77d5 999 _rtx->volatil = 1; \
2d4cc6a7 1000 else { \
b0ad77d5
KG
1001 _rtx->volatil = 0; \
1002 _rtx->unchanging = (VAL); \
2d4cc6a7 1003 } \
7879b81e 1004} while (0)
5a63e069 1005#define SUBREG_PROMOTED_UNSIGNED_P(RTX) \
2d4cc6a7
JJ
1006 ((RTL_FLAG_CHECK1("SUBREG_PROMOTED_UNSIGNED_P", (RTX), SUBREG)->volatil) \
1007 ? -1 : (RTX)->unchanging)
07be3989 1008
6f29feb1
JW
1009/* Access various components of an ASM_OPERANDS rtx. */
1010
f52eda29
GS
1011#define ASM_OPERANDS_TEMPLATE(RTX) XCSTR (RTX, 0, ASM_OPERANDS)
1012#define ASM_OPERANDS_OUTPUT_CONSTRAINT(RTX) XCSTR (RTX, 1, ASM_OPERANDS)
1013#define ASM_OPERANDS_OUTPUT_IDX(RTX) XCINT (RTX, 2, ASM_OPERANDS)
1014#define ASM_OPERANDS_INPUT_VEC(RTX) XCVEC (RTX, 3, ASM_OPERANDS)
1015#define ASM_OPERANDS_INPUT_CONSTRAINT_VEC(RTX) XCVEC (RTX, 4, ASM_OPERANDS)
1016#define ASM_OPERANDS_INPUT(RTX, N) XCVECEXP (RTX, 3, N, ASM_OPERANDS)
1017#define ASM_OPERANDS_INPUT_LENGTH(RTX) XCVECLEN (RTX, 3, ASM_OPERANDS)
6462bb43 1018#define ASM_OPERANDS_INPUT_CONSTRAINT_EXP(RTX, N) \
f52eda29 1019 XCVECEXP (RTX, 4, N, ASM_OPERANDS)
3bdf5ad1 1020#define ASM_OPERANDS_INPUT_CONSTRAINT(RTX, N) \
f52eda29 1021 XSTR (XCVECEXP (RTX, 4, N, ASM_OPERANDS), 0)
3bdf5ad1 1022#define ASM_OPERANDS_INPUT_MODE(RTX, N) \
f52eda29 1023 GET_MODE (XCVECEXP (RTX, 4, N, ASM_OPERANDS))
c1667470
PB
1024#ifdef USE_MAPPED_LOCATION
1025#define ASM_OPERANDS_SOURCE_LOCATION(RTX) XCUINT (RTX, 5, ASM_OPERANDS)
1026#else
f52eda29
GS
1027#define ASM_OPERANDS_SOURCE_FILE(RTX) XCSTR (RTX, 5, ASM_OPERANDS)
1028#define ASM_OPERANDS_SOURCE_LINE(RTX) XCINT (RTX, 6, ASM_OPERANDS)
c1667470 1029#endif
6f29feb1 1030
389fdba0
RH
1031/* 1 if RTX is a mem that is statically allocated in read-only memory. */
1032#define MEM_READONLY_P(RTX) \
1033 (RTL_FLAG_CHECK1("MEM_READONLY_P", (RTX), MEM)->unchanging)
1034
2d4cc6a7 1035/* 1 if RTX is a mem and we should keep the alias set for this mem
10b76d73
RK
1036 unchanged when we access a component. Set to 1, or example, when we
1037 are already in a non-addressable component of an aggregate. */
2d4cc6a7
JJ
1038#define MEM_KEEP_ALIAS_SET_P(RTX) \
1039 (RTL_FLAG_CHECK1("MEM_KEEP_ALIAS_SET_P", (RTX), MEM)->jump)
10b76d73 1040
2d4cc6a7
JJ
1041/* 1 if RTX is a mem or asm_operand for a volatile reference. */
1042#define MEM_VOLATILE_P(RTX) \
1043 (RTL_FLAG_CHECK3("MEM_VOLATILE_P", (RTX), MEM, ASM_OPERANDS, \
1044 ASM_INPUT)->volatil)
6f29feb1 1045
2d4cc6a7 1046/* 1 if RTX is a mem that refers to an aggregate, either to the
3bdf5ad1 1047 aggregate itself of to a field of the aggregate. If zero, RTX may
4eb00163 1048 or may not be such a reference. */
2d4cc6a7
JJ
1049#define MEM_IN_STRUCT_P(RTX) \
1050 (RTL_FLAG_CHECK1("MEM_IN_STRUCT_P", (RTX), MEM)->in_struct)
6f29feb1 1051
acf8677f 1052/* 1 if RTX is a MEM that refers to a scalar. If zero, RTX may or may
3ef42a0c 1053 not refer to a scalar. */
2d4cc6a7 1054#define MEM_SCALAR_P(RTX) \
acf8677f 1055 (RTL_FLAG_CHECK1("MEM_SCALAR_P", (RTX), MEM)->return_val)
c6df88cb 1056
4da2eb6b
RH
1057/* 1 if RTX is a mem that cannot trap. */
1058#define MEM_NOTRAP_P(RTX) \
1059 (RTL_FLAG_CHECK1("MEM_NOTRAP_P", (RTX), MEM)->call)
1060
40f03658 1061/* If VAL is nonzero, set MEM_IN_STRUCT_P and clear MEM_SCALAR_P in
c6df88cb
MM
1062 RTX. Otherwise, vice versa. Use this macro only when you are
1063 *sure* that you know that the MEM is in a structure, or is a
1064 scalar. VAL is evaluated only once. */
f52eda29
GS
1065#define MEM_SET_IN_STRUCT_P(RTX, VAL) \
1066do { \
f9e158c3
JM
1067 if (VAL) \
1068 { \
1069 MEM_IN_STRUCT_P (RTX) = 1; \
1070 MEM_SCALAR_P (RTX) = 0; \
1071 } \
1072 else \
1073 { \
1074 MEM_IN_STRUCT_P (RTX) = 0; \
1075 MEM_SCALAR_P (RTX) = 1; \
1076 } \
1077} while (0)
c6df88cb 1078
173b24b9
RK
1079/* The memory attribute block. We provide access macros for each value
1080 in the block and provide defaults if none specified. */
1081#define MEM_ATTRS(RTX) X0MEMATTR (RTX, 1)
1082
a560d4d4
JH
1083/* The register attribute block. We provide access macros for each value
1084 in the block and provide defaults if none specified. */
1085#define REG_ATTRS(RTX) X0REGATTR (RTX, 2)
1086
41472af8
MM
1087/* For a MEM rtx, the alias set. If 0, this MEM is not in any alias
1088 set, and may alias anything. Otherwise, the MEM can only alias
3568b0ef 1089 MEMs in a conflicting alias set. This value is set in a
41472af8 1090 language-dependent manner in the front-end, and should not be
3568b0ef
RH
1091 altered in the back-end. These set numbers are tested with
1092 alias_sets_conflict_p. */
173b24b9
RK
1093#define MEM_ALIAS_SET(RTX) (MEM_ATTRS (RTX) == 0 ? 0 : MEM_ATTRS (RTX)->alias)
1094
1095/* For a MEM rtx, the decl it is known to refer to, if it is known to
998d7deb
RH
1096 refer to part of a DECL. It may also be a COMPONENT_REF. */
1097#define MEM_EXPR(RTX) (MEM_ATTRS (RTX) == 0 ? 0 : MEM_ATTRS (RTX)->expr)
173b24b9 1098
998d7deb 1099/* For a MEM rtx, the offset from the start of MEM_EXPR, if known, as a
173b24b9
RK
1100 RTX that is always a CONST_INT. */
1101#define MEM_OFFSET(RTX) (MEM_ATTRS (RTX) == 0 ? 0 : MEM_ATTRS (RTX)->offset)
1102
1103/* For a MEM rtx, the size in bytes of the MEM, if known, as an RTX that
1104 is always a CONST_INT. */
10b76d73
RK
1105#define MEM_SIZE(RTX) \
1106(MEM_ATTRS (RTX) != 0 ? MEM_ATTRS (RTX)->size \
1107 : GET_MODE (RTX) != BLKmode ? GEN_INT (GET_MODE_SIZE (GET_MODE (RTX))) \
1108 : 0)
173b24b9 1109
917afb0c
RK
1110/* For a MEM rtx, the alignment in bits. We can use the alignment of the
1111 mode as a default when STRICT_ALIGNMENT, but not if not. */
8ac61af7
RK
1112#define MEM_ALIGN(RTX) \
1113(MEM_ATTRS (RTX) != 0 ? MEM_ATTRS (RTX)->align \
917afb0c
RK
1114 : (STRICT_ALIGNMENT && GET_MODE (RTX) != BLKmode \
1115 ? GET_MODE_ALIGNMENT (GET_MODE (RTX)) : BITS_PER_UNIT))
3bdf5ad1 1116
a560d4d4
JH
1117/* For a REG rtx, the decl it is known to refer to, if it is known to
1118 refer to part of a DECL. */
1119#define REG_EXPR(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->decl)
1120
1121/* For a MEM rtx, the offset from the start of MEM_DECL, if known, as a
1122 RTX that is always a CONST_INT. */
1123#define REG_OFFSET(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->offset)
1124
3bdf5ad1 1125/* Copy the attributes that apply to memory locations from RHS to LHS. */
10b76d73
RK
1126#define MEM_COPY_ATTRIBUTES(LHS, RHS) \
1127 (MEM_VOLATILE_P (LHS) = MEM_VOLATILE_P (RHS), \
1128 MEM_IN_STRUCT_P (LHS) = MEM_IN_STRUCT_P (RHS), \
1129 MEM_SCALAR_P (LHS) = MEM_SCALAR_P (RHS), \
4da2eb6b 1130 MEM_NOTRAP_P (LHS) = MEM_NOTRAP_P (RHS), \
389fdba0 1131 MEM_READONLY_P (LHS) = MEM_READONLY_P (RHS), \
10b76d73 1132 MEM_KEEP_ALIAS_SET_P (LHS) = MEM_KEEP_ALIAS_SET_P (RHS), \
173b24b9 1133 MEM_ATTRS (LHS) = MEM_ATTRS (RHS))
41472af8 1134
2d4cc6a7
JJ
1135/* 1 if RTX is a label_ref to a label outside the loop containing the
1136 reference. */
1137#define LABEL_OUTSIDE_LOOP_P(RTX) \
1138 (RTL_FLAG_CHECK1("LABEL_OUTSIDE_LOOP_P", (RTX), LABEL_REF)->in_struct)
6f29feb1 1139
2d4cc6a7
JJ
1140/* 1 if RTX is a label_ref for a nonlocal label. */
1141/* Likewise in an expr_list for a reg_label note. */
1142#define LABEL_REF_NONLOCAL_P(RTX) \
1143 (RTL_FLAG_CHECK2("LABEL_REF_NONLOCAL_P", (RTX), LABEL_REF, \
1144 REG_LABEL)->volatil)
adfaf10a 1145
2d4cc6a7
JJ
1146/* 1 if RTX is a code_label that should always be considered to be needed. */
1147#define LABEL_PRESERVE_P(RTX) \
1148 (RTL_FLAG_CHECK2("LABEL_PRESERVE_P", (RTX), CODE_LABEL, NOTE)->in_struct)
6f29feb1 1149
2d4cc6a7 1150/* During sched, 1 if RTX is an insn that must be scheduled together
d45cf215 1151 with the preceding insn. */
2d4cc6a7 1152#define SCHED_GROUP_P(RTX) \
be202ec2
FS
1153 (RTL_FLAG_CHECK3("SCHED_GROUP_P", (RTX), INSN, JUMP_INSN, CALL_INSN \
1154 )->in_struct)
6f29feb1
JW
1155
1156/* For a SET rtx, SET_DEST is the place that is set
1157 and SET_SRC is the value it is set to. */
83ab3839
RH
1158#define SET_DEST(RTX) XC2EXP(RTX, 0, SET, CLOBBER)
1159#define SET_SRC(RTX) XCEXP(RTX, 1, SET)
2d4cc6a7
JJ
1160#define SET_IS_RETURN_P(RTX) \
1161 (RTL_FLAG_CHECK1("SET_IS_RETURN_P", (RTX), SET)->jump)
6f29feb1
JW
1162
1163/* For a TRAP_IF rtx, TRAP_CONDITION is an expression. */
f52eda29
GS
1164#define TRAP_CONDITION(RTX) XCEXP (RTX, 0, TRAP_IF)
1165#define TRAP_CODE(RTX) XCEXP (RTX, 1, TRAP_IF)
6f29feb1 1166
0c99ec5c
RH
1167/* For a COND_EXEC rtx, COND_EXEC_TEST is the condition to base
1168 conditionally executing the code on, COND_EXEC_CODE is the code
1169 to execute if the condition is true. */
f52eda29
GS
1170#define COND_EXEC_TEST(RTX) XCEXP (RTX, 0, COND_EXEC)
1171#define COND_EXEC_CODE(RTX) XCEXP (RTX, 1, COND_EXEC)
0c99ec5c 1172
2adb9af1
RH
1173/* 1 if RTX is a symbol_ref that addresses this function's rtl
1174 constants pool. */
2d4cc6a7
JJ
1175#define CONSTANT_POOL_ADDRESS_P(RTX) \
1176 (RTL_FLAG_CHECK1("CONSTANT_POOL_ADDRESS_P", (RTX), SYMBOL_REF)->unchanging)
6f29feb1 1177
2adb9af1
RH
1178/* 1 if RTX is a symbol_ref that addresses a value in the file's
1179 tree constant pool. This information is private to varasm.c. */
1180#define TREE_CONSTANT_POOL_ADDRESS_P(RTX) \
1181 (RTL_FLAG_CHECK1("TREE_CONSTANT_POOL_ADDRESS_P", \
1182 (RTX), SYMBOL_REF)->frame_related)
bd7cf17e 1183
2d4cc6a7
JJ
1184/* Used if RTX is a symbol_ref, for machine-specific purposes. */
1185#define SYMBOL_REF_FLAG(RTX) \
1186 (RTL_FLAG_CHECK1("SYMBOL_REF_FLAG", (RTX), SYMBOL_REF)->volatil)
6f29feb1 1187
2d4cc6a7
JJ
1188/* 1 if RTX is a symbol_ref that has been the library function in
1189 emit_library_call. */
1190#define SYMBOL_REF_USED(RTX) \
1191 (RTL_FLAG_CHECK1("SYMBOL_REF_USED", (RTX), SYMBOL_REF)->used)
6f29feb1 1192
2d4cc6a7
JJ
1193/* 1 if RTX is a symbol_ref for a weak symbol. */
1194#define SYMBOL_REF_WEAK(RTX) \
6de9cd9a 1195 (RTL_FLAG_CHECK1("SYMBOL_REF_WEAK", (RTX), SYMBOL_REF)->return_val)
ff0b6b99 1196
32a61907 1197/* The tree (decl or constant) associated with the symbol, or null. */
52859c77
RH
1198#define SYMBOL_REF_DECL(RTX) X0TREE ((RTX), 2)
1199
1200/* A set of flags on a symbol_ref that are, in some respects, redundant with
1201 information derivable from the tree decl associated with this symbol.
1202 Except that we build a *lot* of SYMBOL_REFs that aren't associated with a
1203 decl. In some cases this is a bug. But beyond that, it's nice to cache
1204 this information to avoid recomputing it. Finally, this allows space for
1205 the target to store more than one bit of information, as with
1206 SYMBOL_REF_FLAG. */
1207#define SYMBOL_REF_FLAGS(RTX) X0INT ((RTX), 1)
1208
1209/* These flags are common enough to be defined for all targets. They
1210 are computed by the default version of targetm.encode_section_info. */
1211
1212/* Set if this symbol is a function. */
1213#define SYMBOL_FLAG_FUNCTION (1 << 0)
1214#define SYMBOL_REF_FUNCTION_P(RTX) \
1215 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_FUNCTION) != 0)
1216/* Set if targetm.binds_local_p is true. */
1217#define SYMBOL_FLAG_LOCAL (1 << 1)
1218#define SYMBOL_REF_LOCAL_P(RTX) \
1219 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_LOCAL) != 0)
1220/* Set if targetm.in_small_data_p is true. */
1221#define SYMBOL_FLAG_SMALL (1 << 2)
1222#define SYMBOL_REF_SMALL_P(RTX) \
1223 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_SMALL) != 0)
1224/* The three-bit field at [5:3] is true for TLS variables; use
1225 SYMBOL_REF_TLS_MODEL to extract the field as an enum tls_model. */
1226#define SYMBOL_FLAG_TLS_SHIFT 3
1227#define SYMBOL_REF_TLS_MODEL(RTX) \
629f6514 1228 ((enum tls_model) ((SYMBOL_REF_FLAGS (RTX) >> SYMBOL_FLAG_TLS_SHIFT) & 7))
52859c77
RH
1229/* Set if this symbol is not defined in this translation unit. */
1230#define SYMBOL_FLAG_EXTERNAL (1 << 6)
1231#define SYMBOL_REF_EXTERNAL_P(RTX) \
1232 ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_EXTERNAL) != 0)
1233
1234/* Subsequent bits are available for the target to use. */
89e6b702
RH
1235#define SYMBOL_FLAG_MACH_DEP_SHIFT 7
1236#define SYMBOL_FLAG_MACH_DEP (1 << SYMBOL_FLAG_MACH_DEP_SHIFT)
52859c77 1237
6f29feb1
JW
1238/* Define a macro to look for REG_INC notes,
1239 but save time on machines where they never exist. */
1240
58e54c44 1241#if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT))
f52eda29
GS
1242#define FIND_REG_INC_NOTE(INSN, REG) \
1243 ((REG) != NULL_RTX && REG_P ((REG)) \
1244 ? find_regno_note ((INSN), REG_INC, REGNO (REG)) \
1245 : find_reg_note ((INSN), REG_INC, (REG)))
6f29feb1 1246#else
f52eda29 1247#define FIND_REG_INC_NOTE(INSN, REG) 0
6f29feb1
JW
1248#endif
1249
1250/* Indicate whether the machine has any sort of auto increment addressing.
1251 If not, we can avoid checking for REG_INC notes. */
1252
58e54c44 1253#if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT))
6f29feb1
JW
1254#define AUTO_INC_DEC
1255#endif
0dfa1860 1256
940da324
JL
1257#ifndef HAVE_PRE_INCREMENT
1258#define HAVE_PRE_INCREMENT 0
1259#endif
1260
1261#ifndef HAVE_PRE_DECREMENT
1262#define HAVE_PRE_DECREMENT 0
1263#endif
1264
1265#ifndef HAVE_POST_INCREMENT
1266#define HAVE_POST_INCREMENT 0
1267#endif
1268
1269#ifndef HAVE_POST_DECREMENT
1270#define HAVE_POST_DECREMENT 0
1271#endif
1272
4b983fdc
RH
1273#ifndef HAVE_POST_MODIFY_DISP
1274#define HAVE_POST_MODIFY_DISP 0
1275#endif
1276
1277#ifndef HAVE_POST_MODIFY_REG
1278#define HAVE_POST_MODIFY_REG 0
1279#endif
1280
1281#ifndef HAVE_PRE_MODIFY_DISP
1282#define HAVE_PRE_MODIFY_DISP 0
1283#endif
1284
1285#ifndef HAVE_PRE_MODIFY_REG
1286#define HAVE_PRE_MODIFY_REG 0
1287#endif
1288
6e01bd94
MH
1289
1290/* Some architectures do not have complete pre/post increment/decrement
1291 instruction sets, or only move some modes efficiently. These macros
1292 allow us to tune autoincrement generation. */
1293
1294#ifndef USE_LOAD_POST_INCREMENT
1295#define USE_LOAD_POST_INCREMENT(MODE) HAVE_POST_INCREMENT
1296#endif
1297
1298#ifndef USE_LOAD_POST_DECREMENT
1299#define USE_LOAD_POST_DECREMENT(MODE) HAVE_POST_DECREMENT
1300#endif
1301
1302#ifndef USE_LOAD_PRE_INCREMENT
1303#define USE_LOAD_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT
1304#endif
1305
1306#ifndef USE_LOAD_PRE_DECREMENT
1307#define USE_LOAD_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT
1308#endif
1309
1310#ifndef USE_STORE_POST_INCREMENT
1311#define USE_STORE_POST_INCREMENT(MODE) HAVE_POST_INCREMENT
1312#endif
1313
1314#ifndef USE_STORE_POST_DECREMENT
1315#define USE_STORE_POST_DECREMENT(MODE) HAVE_POST_DECREMENT
1316#endif
1317
1318#ifndef USE_STORE_PRE_INCREMENT
1319#define USE_STORE_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT
1320#endif
1321
1322#ifndef USE_STORE_PRE_DECREMENT
1323#define USE_STORE_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT
1324#endif
6f29feb1 1325\f
1b3d8f8a
GK
1326/* Nonzero when we are generating CONCATs. */
1327extern int generating_concat_p;
1328
4586b4ca
SB
1329/* Nonzero when we are expanding trees to RTL. */
1330extern int currently_expanding_to_rtl;
1331
6f29feb1
JW
1332/* Generally useful functions. */
1333
ac957f13 1334/* In expmed.c */
0c20a65f 1335extern int ceil_log2 (unsigned HOST_WIDE_INT);
5f4f0e22 1336
5f2d6cfa 1337/* In builtins.c */
4682ae04 1338extern rtx expand_builtin_expect_jump (tree, rtx, rtx);
5f2d6cfa 1339
50b2596f 1340/* In explow.c */
0c20a65f
AJ
1341extern void set_stack_check_libfunc (rtx);
1342extern HOST_WIDE_INT trunc_int_for_mode (HOST_WIDE_INT, enum machine_mode);
3e95a7cb 1343extern rtx plus_constant (rtx, HOST_WIDE_INT);
97b0ade3 1344extern void optimize_save_area_alloca (void);
5f4f0e22 1345
4eb00163 1346/* In emit-rtl.c */
0c20a65f
AJ
1347extern rtvec gen_rtvec (int, ...);
1348extern rtx copy_insn_1 (rtx);
1349extern rtx copy_insn (rtx);
1350extern rtx gen_int_mode (HOST_WIDE_INT, enum machine_mode);
1351extern rtx emit_copy_of_insn_after (rtx, rtx);
1352extern void set_reg_attrs_from_mem (rtx, rtx);
1353extern void set_mem_attrs_from_reg (rtx, rtx);
1354extern void set_reg_attrs_for_parm (rtx, rtx);
2b3493c8 1355extern int mem_expr_equal_p (tree, tree);
4eb00163
JO
1356
1357/* In rtl.c */
b9dcdee4
JH
1358extern rtx rtx_alloc_stat (RTX_CODE MEM_STAT_DECL);
1359#define rtx_alloc(c) rtx_alloc_stat (c MEM_STAT_INFO)
1360
0c20a65f
AJ
1361extern rtvec rtvec_alloc (int);
1362extern rtx copy_rtx (rtx);
439a7e54 1363extern void dump_rtx_statistics (void);
4eb00163
JO
1364
1365/* In emit-rtl.c */
0c20a65f 1366extern rtx copy_rtx_if_shared (rtx);
4eb00163
JO
1367
1368/* In rtl.c */
b9dcdee4
JH
1369extern rtx shallow_copy_rtx_stat (rtx MEM_STAT_DECL);
1370#define shallow_copy_rtx(a) shallow_copy_rtx_stat (a MEM_STAT_INFO)
0c20a65f 1371extern int rtx_equal_p (rtx, rtx);
4eb00163
JO
1372
1373/* In emit-rtl.c */
0c20a65f
AJ
1374extern rtvec gen_rtvec_v (int, rtx *);
1375extern rtx gen_reg_rtx (enum machine_mode);
1376extern rtx gen_rtx_REG_offset (rtx, enum machine_mode, unsigned int, int);
1377extern rtx gen_label_rtx (void);
0c20a65f 1378extern rtx gen_lowpart_common (enum machine_mode, rtx);
4eb00163
JO
1379
1380/* In cse.c */
0c20a65f 1381extern rtx gen_lowpart_if_possible (enum machine_mode, rtx);
4eb00163
JO
1382
1383/* In emit-rtl.c */
0c20a65f
AJ
1384extern rtx gen_highpart (enum machine_mode, rtx);
1385extern rtx gen_highpart_mode (enum machine_mode, enum machine_mode, rtx);
0c20a65f 1386extern rtx operand_subword (rtx, unsigned int, int, enum machine_mode);
4eb00163
JO
1387
1388/* In emit-rtl.c */
0c20a65f
AJ
1389extern rtx operand_subword_force (rtx, unsigned int, enum machine_mode);
1390extern int subreg_lowpart_p (rtx);
1391extern unsigned int subreg_lowpart_offset (enum machine_mode,
1392 enum machine_mode);
1393extern unsigned int subreg_highpart_offset (enum machine_mode,
1394 enum machine_mode);
1395extern rtx make_safe_from (rtx, rtx);
1396extern rtx convert_memory_address (enum machine_mode, rtx);
1397extern rtx get_insns (void);
1398extern const char *get_insn_name (int);
1399extern rtx get_last_insn (void);
1400extern rtx get_last_insn_anywhere (void);
1401extern rtx get_first_nonnote_insn (void);
1402extern rtx get_last_nonnote_insn (void);
1403extern void start_sequence (void);
1404extern void push_to_sequence (rtx);
1405extern void end_sequence (void);
0c20a65f
AJ
1406extern rtx immed_double_const (HOST_WIDE_INT, HOST_WIDE_INT,
1407 enum machine_mode);
550d1387 1408
a82bbcbb
ZD
1409/* In loop-iv.c */
1410
1411extern rtx lowpart_subreg (enum machine_mode, rtx, enum machine_mode);
1412
550d1387 1413/* In varasm.c */
0c20a65f 1414extern rtx force_const_mem (enum machine_mode, rtx);
4eb00163 1415
4eb00163 1416/* In varasm.c */
7e7ec48e
ZW
1417
1418struct function;
0c20a65f
AJ
1419extern rtx get_pool_constant (rtx);
1420extern rtx get_pool_constant_mark (rtx, bool *);
1421extern enum machine_mode get_pool_mode (rtx);
1422extern rtx get_pool_constant_for_function (struct function *, rtx);
0c20a65f 1423extern rtx simplify_subtraction (rtx);
4eb00163
JO
1424
1425/* In function.c */
0c20a65f
AJ
1426extern rtx assign_stack_local (enum machine_mode, HOST_WIDE_INT, int);
1427extern rtx assign_stack_temp (enum machine_mode, HOST_WIDE_INT, int);
1428extern rtx assign_stack_temp_for_type (enum machine_mode,
1429 HOST_WIDE_INT, int, tree);
1430extern rtx assign_temp (tree, int, int, int);
fd3acbb3 1431
4eb00163 1432/* In emit-rtl.c */
0c20a65f 1433extern rtx emit_insn_before (rtx, rtx);
a7102479 1434extern rtx emit_insn_before_noloc (rtx, rtx);
0c20a65f
AJ
1435extern rtx emit_insn_before_setloc (rtx, rtx, int);
1436extern rtx emit_jump_insn_before (rtx, rtx);
a7102479 1437extern rtx emit_jump_insn_before_noloc (rtx, rtx);
0c20a65f
AJ
1438extern rtx emit_jump_insn_before_setloc (rtx, rtx, int);
1439extern rtx emit_call_insn_before (rtx, rtx);
a7102479 1440extern rtx emit_call_insn_before_noloc (rtx, rtx);
0c20a65f
AJ
1441extern rtx emit_call_insn_before_setloc (rtx, rtx, int);
1442extern rtx emit_barrier_before (rtx);
1443extern rtx emit_label_before (rtx, rtx);
1444extern rtx emit_note_before (int, rtx);
1445extern rtx emit_insn_after (rtx, rtx);
a7102479 1446extern rtx emit_insn_after_noloc (rtx, rtx);
0c20a65f
AJ
1447extern rtx emit_insn_after_setloc (rtx, rtx, int);
1448extern rtx emit_jump_insn_after (rtx, rtx);
a7102479 1449extern rtx emit_jump_insn_after_noloc (rtx, rtx);
0c20a65f
AJ
1450extern rtx emit_jump_insn_after_setloc (rtx, rtx, int);
1451extern rtx emit_call_insn_after (rtx, rtx);
a7102479 1452extern rtx emit_call_insn_after_noloc (rtx, rtx);
0c20a65f
AJ
1453extern rtx emit_call_insn_after_setloc (rtx, rtx, int);
1454extern rtx emit_barrier_after (rtx);
1455extern rtx emit_label_after (rtx, rtx);
1456extern rtx emit_note_after (int, rtx);
1457extern rtx emit_note_copy_after (rtx, rtx);
1458extern rtx emit_insn (rtx);
1459extern rtx emit_jump_insn (rtx);
1460extern rtx emit_call_insn (rtx);
1461extern rtx emit_label (rtx);
1462extern rtx emit_barrier (void);
1463extern rtx emit_note (int);
1464extern rtx emit_note_copy (rtx);
0cea056b 1465extern rtx emit_line_note (location_t);
0c20a65f
AJ
1466extern rtx make_insn_raw (rtx);
1467extern void add_function_usage_to (rtx, rtx);
1468extern rtx last_call_insn (void);
1469extern rtx previous_insn (rtx);
1470extern rtx next_insn (rtx);
1471extern rtx prev_nonnote_insn (rtx);
1472extern rtx next_nonnote_insn (rtx);
1473extern rtx prev_real_insn (rtx);
1474extern rtx next_real_insn (rtx);
1475extern rtx prev_active_insn (rtx);
1476extern rtx next_active_insn (rtx);
1477extern int active_insn_p (rtx);
1478extern rtx prev_label (rtx);
1479extern rtx next_label (rtx);
6c2511d3 1480extern rtx skip_consecutive_labels (rtx);
0c20a65f
AJ
1481extern rtx next_cc0_user (rtx);
1482extern rtx prev_cc0_setter (rtx);
4eb00163 1483
1292ec0c 1484/* In cfglayout.c */
0c20a65f
AJ
1485extern int insn_line (rtx);
1486extern const char * insn_file (rtx);
9ae130f8
JH
1487extern int locator_line (int);
1488extern const char * locator_file (int);
0435312e 1489extern int prologue_locator, epilogue_locator;
1292ec0c 1490
4eb00163 1491/* In jump.c */
0c20a65f
AJ
1492extern enum rtx_code reverse_condition (enum rtx_code);
1493extern enum rtx_code reverse_condition_maybe_unordered (enum rtx_code);
1494extern enum rtx_code swap_condition (enum rtx_code);
1495extern enum rtx_code unsigned_condition (enum rtx_code);
1496extern enum rtx_code signed_condition (enum rtx_code);
1497extern void mark_jump_label (rtx, rtx, int);
1498extern void cleanup_barriers (void);
4eb00163 1499
4eb00163 1500/* In jump.c */
0c20a65f
AJ
1501extern bool squeeze_notes (rtx *, rtx *);
1502extern rtx delete_related_insns (rtx);
1503extern void delete_jump (rtx);
0c20a65f
AJ
1504extern rtx get_label_before (rtx);
1505extern rtx get_label_after (rtx);
1506extern rtx follow_jumps (rtx);
4eb00163
JO
1507
1508/* In recog.c */
0c20a65f 1509extern rtx *find_constant_term_loc (rtx *);
4eb00163
JO
1510
1511/* In emit-rtl.c */
0c20a65f 1512extern rtx try_split (rtx, rtx, int);
6b24c259 1513extern int split_branch_probability;
4eb00163
JO
1514
1515/* In unknown file */
0c20a65f 1516extern rtx split_insns (rtx, rtx);
4eb00163
JO
1517
1518/* In simplify-rtx.c */
0a67e02c
PB
1519extern rtx simplify_const_unary_operation (enum rtx_code, enum machine_mode,
1520 rtx, enum machine_mode);
0c20a65f
AJ
1521extern rtx simplify_unary_operation (enum rtx_code, enum machine_mode, rtx,
1522 enum machine_mode);
0a67e02c
PB
1523extern rtx simplify_const_binary_operation (enum rtx_code, enum machine_mode,
1524 rtx, rtx);
0c20a65f
AJ
1525extern rtx simplify_binary_operation (enum rtx_code, enum machine_mode, rtx,
1526 rtx);
1527extern rtx simplify_ternary_operation (enum rtx_code, enum machine_mode,
1528 enum machine_mode, rtx, rtx, rtx);
7ce3e360
RS
1529extern rtx simplify_const_relational_operation (enum rtx_code,
1530 enum machine_mode, rtx, rtx);
0c20a65f 1531extern rtx simplify_relational_operation (enum rtx_code, enum machine_mode,
7ce3e360 1532 enum machine_mode, rtx, rtx);
0c20a65f
AJ
1533extern rtx simplify_gen_binary (enum rtx_code, enum machine_mode, rtx, rtx);
1534extern rtx simplify_gen_unary (enum rtx_code, enum machine_mode, rtx,
1535 enum machine_mode);
1536extern rtx simplify_gen_ternary (enum rtx_code, enum machine_mode,
1537 enum machine_mode, rtx, rtx, rtx);
1538extern rtx simplify_gen_relational (enum rtx_code, enum machine_mode,
1539 enum machine_mode, rtx, rtx);
1540extern rtx simplify_subreg (enum machine_mode, rtx, enum machine_mode,
1541 unsigned int);
1542extern rtx simplify_gen_subreg (enum machine_mode, rtx, enum machine_mode,
1543 unsigned int);
1544extern rtx simplify_replace_rtx (rtx, rtx, rtx);
1545extern rtx simplify_rtx (rtx);
1546extern rtx avoid_constant_pool_reference (rtx);
b757b9f8 1547extern bool mode_signbit_p (enum machine_mode, rtx);
4eb00163 1548
4eb00163 1549/* In regclass.c */
fee226d2
R
1550extern enum machine_mode choose_hard_reg_mode (unsigned int, unsigned int,
1551 bool);
4eb00163
JO
1552
1553/* In emit-rtl.c */
0c20a65f 1554extern rtx set_unique_reg_note (rtx, enum reg_note, rtx);
9ae8ffe7 1555
e9a25f70
JL
1556/* Functions in rtlanal.c */
1557
b1cdafbb
JH
1558/* Single set is implemented as macro for performance reasons. */
1559#define single_set(I) (INSN_P (I) \
1560 ? (GET_CODE (PATTERN (I)) == SET \
1561 ? PATTERN (I) : single_set_1 (I)) \
1562 : NULL_RTX)
2130b7fb 1563#define single_set_1(I) single_set_2 (I, PATTERN (I))
b1cdafbb 1564
39811184 1565/* Structure used for passing data to REPLACE_LABEL. */
4af16369 1566typedef struct replace_label_data
39811184
JZ
1567{
1568 rtx r1;
1569 rtx r2;
4af16369
JZ
1570 bool update_label_nuses;
1571} replace_label_data;
39811184 1572
0c20a65f
AJ
1573extern int rtx_addr_can_trap_p (rtx);
1574extern bool nonzero_address_p (rtx);
1575extern int rtx_unstable_p (rtx);
1576extern int rtx_varies_p (rtx, int);
1577extern int rtx_addr_varies_p (rtx, int);
1578extern HOST_WIDE_INT get_integer_term (rtx);
1579extern rtx get_related_value (rtx);
0c20a65f
AJ
1580extern int global_reg_mentioned_p (rtx);
1581extern int reg_mentioned_p (rtx, rtx);
1582extern int count_occurrences (rtx, rtx, int);
1583extern int reg_referenced_p (rtx, rtx);
1584extern int reg_used_between_p (rtx, rtx, rtx);
0c20a65f 1585extern int reg_set_between_p (rtx, rtx, rtx);
0c20a65f
AJ
1586extern int commutative_operand_precedence (rtx);
1587extern int swap_commutative_operands_p (rtx, rtx);
1588extern int modified_between_p (rtx, rtx, rtx);
1589extern int no_labels_between_p (rtx, rtx);
0c20a65f 1590extern int modified_in_p (rtx, rtx);
0c20a65f
AJ
1591extern int reg_set_p (rtx, rtx);
1592extern rtx single_set_2 (rtx, rtx);
1593extern int multiple_sets (rtx);
1594extern int set_noop_p (rtx);
1595extern int noop_move_p (rtx);
1596extern rtx find_last_value (rtx, rtx *, rtx, int);
1597extern int refers_to_regno_p (unsigned int, unsigned int, rtx, rtx *);
1598extern int reg_overlap_mentioned_p (rtx, rtx);
1599extern rtx set_of (rtx, rtx);
1600extern void note_stores (rtx, void (*) (rtx, rtx, void *), void *);
1601extern void note_uses (rtx *, void (*) (rtx *, void *), void *);
0c20a65f
AJ
1602extern int dead_or_set_p (rtx, rtx);
1603extern int dead_or_set_regno_p (rtx, unsigned int);
1604extern rtx find_reg_note (rtx, enum reg_note, rtx);
1605extern rtx find_regno_note (rtx, enum reg_note, unsigned int);
1606extern rtx find_reg_equal_equiv_note (rtx);
1607extern int find_reg_fusage (rtx, enum rtx_code, rtx);
1608extern int find_regno_fusage (rtx, enum rtx_code, unsigned int);
1609extern int pure_call_p (rtx);
1610extern void remove_note (rtx, rtx);
1611extern int side_effects_p (rtx);
1612extern int volatile_refs_p (rtx);
1613extern int volatile_insn_p (rtx);
1614extern int may_trap_p (rtx);
1615extern int inequality_comparisons_p (rtx);
1616extern rtx replace_rtx (rtx, rtx, rtx);
1617extern rtx replace_regs (rtx, rtx *, unsigned int, int);
1618extern int replace_label (rtx *, void *);
1619extern int rtx_referenced_p (rtx, rtx);
1620extern bool tablejump_p (rtx, rtx *, rtx *);
1621extern int computed_jump_p (rtx);
1622typedef int (*rtx_function) (rtx *, void *);
1623extern int for_each_rtx (rtx *, rtx_function, void *);
1624extern rtx regno_use_in (unsigned int, rtx);
1625extern int auto_inc_p (rtx);
1626extern int in_expr_list_p (rtx, rtx);
1627extern void remove_node_from_expr_list (rtx, rtx *);
1628extern int insns_safe_to_move_p (rtx, rtx, rtx *);
1629extern int loc_mentioned_in_p (rtx *, rtx);
1630extern rtx find_first_parameter_load (rtx, rtx);
1631extern bool keep_with_call_p (rtx);
432f982f 1632extern bool label_is_jump_target_p (rtx, rtx);
6fd21094 1633extern int insn_rtx_cost (rtx);
6f29feb1 1634
75473b02
SB
1635/* Given an insn and condition, return a canonical description of
1636 the test being made. */
1637extern rtx canonicalize_condition (rtx, rtx, int, rtx *, rtx, int, int);
1638
1639/* Given a JUMP_INSN, return a canonical description of the test
1640 being made. */
1641extern rtx get_condition (rtx, rtx *, int, int);
1642
1643
ae0b51ef
JL
1644/* flow.c */
1645
0c20a65f 1646extern rtx find_use_as_address (rtx, rtx, HOST_WIDE_INT);
e2500fed
GK
1647
1648/* lists.c */
1649
3d7aafde
AJ
1650void free_EXPR_LIST_list (rtx *);
1651void free_INSN_LIST_list (rtx *);
1652void free_EXPR_LIST_node (rtx);
1653void free_INSN_LIST_node (rtx);
1654rtx alloc_INSN_LIST (rtx, rtx);
1655rtx alloc_EXPR_LIST (int, rtx, rtx);
ae0b51ef
JL
1656
1657/* regclass.c */
1658
6f29feb1 1659/* Maximum number of parallel sets and clobbers in any insn in this fn.
d91edf86 1660 Always at least 3, since the combiner could put that many together
6f29feb1
JW
1661 and we want this to remain correct for all the remaining passes. */
1662
1663extern int max_parallel;
1664
e0c6d139 1665/* Free up register info memory. */
0c20a65f 1666extern void free_reg_info (void);
e0c6d139 1667
ae0b51ef 1668/* recog.c */
0c20a65f
AJ
1669extern int asm_noperands (rtx);
1670extern const char *decode_asm_operands (rtx, rtx *, rtx **, const char **,
1671 enum machine_mode *);
6f29feb1 1672
0c20a65f
AJ
1673extern enum reg_class reg_preferred_class (int);
1674extern enum reg_class reg_alternate_class (int);
6f29feb1 1675
0c20a65f
AJ
1676extern void split_all_insns (int);
1677extern void split_all_insns_noflow (void);
6a73406e 1678
68d75312 1679#define MAX_SAVED_CONST_INT 64
e2500fed 1680extern GTY(()) rtx const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1];
68d75312 1681
5da077de
AS
1682#define const0_rtx (const_int_rtx[MAX_SAVED_CONST_INT])
1683#define const1_rtx (const_int_rtx[MAX_SAVED_CONST_INT+1])
1684#define const2_rtx (const_int_rtx[MAX_SAVED_CONST_INT+2])
1685#define constm1_rtx (const_int_rtx[MAX_SAVED_CONST_INT-1])
e2500fed 1686extern GTY(()) rtx const_true_rtx;
a8efe40d 1687
e2500fed 1688extern GTY(()) rtx const_tiny_rtx[3][(int) MAX_MACHINE_MODE];
a8efe40d 1689
f590cca1 1690/* Returns a constant 0 rtx in mode MODE. Integer modes are treated the
a8efe40d
RK
1691 same as VOIDmode. */
1692
1693#define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)])
1694
1695/* Likewise, for the constants 1 and 2. */
1696
1697#define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)])
1698#define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)])
6f29feb1 1699
5da077de
AS
1700/* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg
1701 is used to represent the frame pointer. This is because the
1702 hard frame pointer and the automatic variables are separated by an amount
1703 that cannot be determined until after register allocation. We can assume
1704 that in this case ELIMINABLE_REGS will be defined, one action of which
eebedaa5 1705 will be to eliminate FRAME_POINTER_REGNUM into HARD_FRAME_POINTER_REGNUM. */
5da077de
AS
1706#ifndef HARD_FRAME_POINTER_REGNUM
1707#define HARD_FRAME_POINTER_REGNUM FRAME_POINTER_REGNUM
1708#endif
1709
1710/* Index labels for global_rtl. */
1711enum global_rtl_index
68d75312 1712{
5da077de
AS
1713 GR_PC,
1714 GR_CC0,
1715 GR_STACK_POINTER,
1716 GR_FRAME_POINTER,
1717/* For register elimination to work properly these hard_frame_pointer_rtx,
1718 frame_pointer_rtx, and arg_pointer_rtx must be the same if they refer to
1719 the same register. */
1720#if FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM
1721 GR_ARG_POINTER = GR_FRAME_POINTER,
1722#endif
1723#if HARD_FRAME_POINTER_REGNUM == FRAME_POINTER_REGNUM
1724 GR_HARD_FRAME_POINTER = GR_FRAME_POINTER,
1725#else
1726 GR_HARD_FRAME_POINTER,
1727#endif
1728#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
1729#if HARD_FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM
1730 GR_ARG_POINTER = GR_HARD_FRAME_POINTER,
1731#else
1732 GR_ARG_POINTER,
1733#endif
1734#endif
1735 GR_VIRTUAL_INCOMING_ARGS,
1736 GR_VIRTUAL_STACK_ARGS,
1737 GR_VIRTUAL_STACK_DYNAMIC,
1738 GR_VIRTUAL_OUTGOING_ARGS,
1739 GR_VIRTUAL_CFA,
1740
1741 GR_MAX
1742};
1743
1744/* Pointers to standard pieces of rtx are stored here. */
e2500fed 1745extern GTY(()) rtx global_rtl[GR_MAX];
5da077de
AS
1746
1747/* Standard pieces of rtx, to be substituted directly into things. */
1748#define pc_rtx (global_rtl[GR_PC])
1749#define cc0_rtx (global_rtl[GR_CC0])
68d75312 1750
6f29feb1
JW
1751/* All references to certain hard regs, except those created
1752 by allocating pseudo regs into them (when that's possible),
1753 go through these unique rtx objects. */
5da077de
AS
1754#define stack_pointer_rtx (global_rtl[GR_STACK_POINTER])
1755#define frame_pointer_rtx (global_rtl[GR_FRAME_POINTER])
1756#define hard_frame_pointer_rtx (global_rtl[GR_HARD_FRAME_POINTER])
1757#define arg_pointer_rtx (global_rtl[GR_ARG_POINTER])
68d75312 1758
e2500fed 1759extern GTY(()) rtx pic_offset_table_rtx;
e2500fed
GK
1760extern GTY(()) rtx static_chain_rtx;
1761extern GTY(()) rtx static_chain_incoming_rtx;
1762extern GTY(()) rtx return_address_pointer_rtx;
3b80f6ca
RH
1763
1764/* Include the RTL generation functions. */
1765
7e7ec48e 1766#ifndef GENERATOR_FILE
3b80f6ca 1767#include "genrtl.h"
c1667470
PB
1768#ifndef USE_MAPPED_LOCATION
1769#undef gen_rtx_ASM_OPERANDS
1770#define gen_rtx_ASM_OPERANDS(MODE, ARG0, ARG1, ARG2, ARG3, ARG4, LOC) \
1771 gen_rtx_fmt_ssiEEsi (ASM_OPERANDS, (MODE), (ARG0), (ARG1), (ARG2), (ARG3), (ARG4), (LOC).file, (LOC).line)
1772#endif
3b80f6ca
RH
1773#endif
1774
41472af8
MM
1775/* There are some RTL codes that require special attention; the
1776 generation functions included above do the raw handling. If you
a2a8cc44 1777 add to this list, modify special_rtx in gengenrtl.c as well. */
3b80f6ca 1778
0c20a65f
AJ
1779extern rtx gen_rtx_CONST_INT (enum machine_mode, HOST_WIDE_INT);
1780extern rtx gen_rtx_CONST_VECTOR (enum machine_mode, rtvec);
1781extern rtx gen_raw_REG (enum machine_mode, int);
1782extern rtx gen_rtx_REG (enum machine_mode, unsigned);
1783extern rtx gen_rtx_SUBREG (enum machine_mode, rtx, int);
1784extern rtx gen_rtx_MEM (enum machine_mode, rtx);
3b80f6ca 1785
3e95a7cb 1786#define GEN_INT(N) gen_rtx_CONST_INT (VOIDmode, (N))
3b80f6ca 1787
6f29feb1
JW
1788/* Virtual registers are used during RTL generation to refer to locations into
1789 the stack frame when the actual location isn't known until RTL generation
1790 is complete. The routine instantiate_virtual_regs replaces these with
1791 the proper value, which is normally {frame,arg,stack}_pointer_rtx plus
1792 a constant. */
1793
1794#define FIRST_VIRTUAL_REGISTER (FIRST_PSEUDO_REGISTER)
1795
1796/* This points to the first word of the incoming arguments passed on the stack,
1797 either by the caller or by the callee when pretending it was passed by the
1798 caller. */
1799
5da077de 1800#define virtual_incoming_args_rtx (global_rtl[GR_VIRTUAL_INCOMING_ARGS])
6f29feb1
JW
1801
1802#define VIRTUAL_INCOMING_ARGS_REGNUM (FIRST_VIRTUAL_REGISTER)
1803
60343c3b 1804/* If FRAME_GROWS_DOWNWARD, this points to immediately above the first
6f29feb1
JW
1805 variable on the stack. Otherwise, it points to the first variable on
1806 the stack. */
1807
5da077de 1808#define virtual_stack_vars_rtx (global_rtl[GR_VIRTUAL_STACK_ARGS])
6f29feb1
JW
1809
1810#define VIRTUAL_STACK_VARS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 1)
1811
1812/* This points to the location of dynamically-allocated memory on the stack
1813 immediately after the stack pointer has been adjusted by the amount
1814 desired. */
1815
5da077de 1816#define virtual_stack_dynamic_rtx (global_rtl[GR_VIRTUAL_STACK_DYNAMIC])
6f29feb1
JW
1817
1818#define VIRTUAL_STACK_DYNAMIC_REGNUM ((FIRST_VIRTUAL_REGISTER) + 2)
1819
1820/* This points to the location in the stack at which outgoing arguments should
1821 be written when the stack is pre-pushed (arguments pushed using push
1822 insns always use sp). */
1823
5da077de 1824#define virtual_outgoing_args_rtx (global_rtl[GR_VIRTUAL_OUTGOING_ARGS])
6f29feb1
JW
1825
1826#define VIRTUAL_OUTGOING_ARGS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 3)
1827
71038426 1828/* This points to the Canonical Frame Address of the function. This
14b493d6 1829 should correspond to the CFA produced by INCOMING_FRAME_SP_OFFSET,
71038426 1830 but is calculated relative to the arg pointer for simplicity; the
f590cca1 1831 frame pointer nor stack pointer are necessarily fixed relative to
71038426
RH
1832 the CFA until after reload. */
1833
5da077de 1834#define virtual_cfa_rtx (global_rtl[GR_VIRTUAL_CFA])
71038426
RH
1835
1836#define VIRTUAL_CFA_REGNUM ((FIRST_VIRTUAL_REGISTER) + 4)
1837
1838#define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 4)
6f29feb1 1839
a06ef755 1840/* Nonzero if REGNUM is a pointer into the stack frame. */
3d7aafde 1841#define REGNO_PTR_FRAME_P(REGNUM) \
a06ef755
RK
1842 ((REGNUM) == STACK_POINTER_REGNUM \
1843 || (REGNUM) == FRAME_POINTER_REGNUM \
1844 || (REGNUM) == HARD_FRAME_POINTER_REGNUM \
1845 || (REGNUM) == ARG_POINTER_REGNUM \
1846 || ((REGNUM) >= FIRST_VIRTUAL_REGISTER \
1847 && (REGNUM) <= LAST_VIRTUAL_REGISTER))
1848
848e0190 1849/* REGNUM never really appearing in the INSN stream. */
cf403648 1850#define INVALID_REGNUM (~(unsigned int) 0)
848e0190 1851
0c20a65f 1852extern rtx output_constant_def (tree, int);
75c20980 1853extern rtx lookup_constant_def (tree);
6f29feb1 1854
0ea0e871
JL
1855/* Nonzero after the second flow pass has completed.
1856 Set to 1 or 0 by toplev.c */
1857extern int flow2_completed;
1858
6f29feb1 1859/* Nonzero after end of reload pass.
0ea0e871 1860 Set to 1 or 0 by reload1.c. */
6f29feb1
JW
1861
1862extern int reload_completed;
1863
fe3ad572
SC
1864/* Nonzero after thread_prologue_and_epilogue_insns has run. */
1865extern int epilogue_completed;
1866
6f29feb1
JW
1867/* Set to 1 while reload_as_needed is operating.
1868 Required by some machines to handle any generated moves differently. */
1869
1870extern int reload_in_progress;
1871
1872/* If this is nonzero, we do not bother generating VOLATILE
1873 around volatile memory references, and we are willing to
1874 output indirect addresses. If cse is to follow, we reject
1875 indirect addresses so a useful potential cse is generated;
1876 if it is used only once, instruction combination will produce
1877 the same indirect address eventually. */
1878extern int cse_not_expected;
1879
f1db3576
JL
1880/* Set to nonzero before life analysis to indicate that it is unsafe to
1881 generate any new pseudo registers. */
1882extern int no_new_pseudos;
1883
f5118aa5 1884/* Translates rtx code to tree code, for those codes needed by
88efc60a
RK
1885 REAL_ARITHMETIC. The function returns an int because the caller may not
1886 know what `enum tree_code' means. */
1887
0c20a65f 1888extern int rtx_to_tree_code (enum rtx_code);
9ae8ffe7 1889
ac957f13 1890/* In cse.c */
0c20a65f 1891extern int delete_trivially_dead_insns (rtx, int);
5affca01 1892extern int cse_main (rtx, int, FILE *);
e129d93a 1893extern void cse_condition_code_reg (void);
0516f6fe
SB
1894extern int exp_equiv_p (rtx, rtx, int, bool);
1895extern unsigned hash_rtx (rtx x, enum machine_mode, int *, int *, bool);
ac957f13
JL
1896
1897/* In jump.c */
0c20a65f
AJ
1898extern int comparison_dominates_p (enum rtx_code, enum rtx_code);
1899extern int condjump_p (rtx);
1900extern int any_condjump_p (rtx);
1901extern int any_uncondjump_p (rtx);
0c20a65f
AJ
1902extern rtx pc_set (rtx);
1903extern rtx condjump_label (rtx);
1904extern int simplejump_p (rtx);
1905extern int returnjump_p (rtx);
1906extern int onlyjump_p (rtx);
1907extern int only_sets_cc0_p (rtx);
1908extern int sets_cc0_p (rtx);
1909extern int invert_jump_1 (rtx, rtx);
1910extern int invert_jump (rtx, rtx, int);
1911extern int rtx_renumbered_equal_p (rtx, rtx);
1912extern int true_regnum (rtx);
1913extern unsigned int reg_or_subregno (rtx);
1914extern int redirect_jump_1 (rtx, rtx);
0a634832 1915extern void redirect_jump_2 (rtx, rtx, rtx, int, int);
0c20a65f
AJ
1916extern int redirect_jump (rtx, rtx, int);
1917extern void rebuild_jump_labels (rtx);
14f02e73 1918extern rtx reversed_comparison (rtx, enum machine_mode);
0c20a65f
AJ
1919extern enum rtx_code reversed_comparison_code (rtx, rtx);
1920extern enum rtx_code reversed_comparison_code_parts (enum rtx_code,
1921 rtx, rtx, rtx);
1922extern void delete_for_peephole (rtx, rtx);
1923extern int condjump_in_parallel_p (rtx);
0c20a65f 1924extern void purge_line_number_notes (rtx);
14bf4a33 1925
eebedaa5 1926/* In emit-rtl.c. */
0c20a65f
AJ
1927extern int max_reg_num (void);
1928extern int max_label_num (void);
1929extern int get_first_label_num (void);
6de9cd9a 1930extern void maybe_set_first_label_num (rtx);
0c20a65f
AJ
1931extern void delete_insns_since (rtx);
1932extern void mark_reg_pointer (rtx, int);
1933extern void mark_user_reg (rtx);
1934extern void reset_used_flags (rtx);
2c07f13b 1935extern void set_used_flags (rtx);
0c20a65f
AJ
1936extern void reorder_insns (rtx, rtx, rtx);
1937extern void reorder_insns_nobb (rtx, rtx, rtx);
1938extern int get_max_uid (void);
1939extern int in_sequence_p (void);
1940extern void force_next_line_note (void);
1941extern void init_emit (void);
1942extern void init_emit_once (int);
1943extern void push_topmost_sequence (void);
1944extern void pop_topmost_sequence (void);
0c20a65f
AJ
1945extern void reverse_comparison (rtx);
1946extern void set_new_first_and_last_insn (rtx, rtx);
fd743bc1 1947extern void unshare_all_rtl (void);
0c20a65f 1948extern void unshare_all_rtl_again (rtx);
2c07f13b
JH
1949extern void unshare_all_rtl_in_chain (rtx);
1950extern void verify_rtl_sharing (void);
0c20a65f
AJ
1951extern void set_first_insn (rtx);
1952extern void set_last_insn (rtx);
1953extern void link_cc0_insns (rtx);
1954extern void add_insn (rtx);
1955extern void add_insn_before (rtx, rtx);
1956extern void add_insn_after (rtx, rtx);
1957extern void remove_insn (rtx);
0c20a65f 1958extern void emit_insn_after_with_line_notes (rtx, rtx, rtx);
0c20a65f 1959extern rtx emit (rtx);
0c20a65f
AJ
1960extern void renumber_insns (FILE *);
1961extern void remove_unnecessary_notes (void);
1962extern rtx delete_insn (rtx);
91278841 1963extern rtx entry_of_function (void);
0c20a65f
AJ
1964extern void delete_insn_chain (rtx, rtx);
1965extern rtx unlink_insn_chain (rtx, rtx);
1966extern rtx delete_insn_and_edges (rtx);
1967extern void delete_insn_chain_and_edges (rtx, rtx);
dad822d3 1968extern rtx gen_lowpart_SUBREG (enum machine_mode, rtx);
542a8afa 1969extern rtx gen_const_mem (enum machine_mode, rtx);
beb72684
RH
1970extern bool validate_subreg (enum machine_mode, enum machine_mode,
1971 rtx, unsigned int);
ac957f13 1972
ac957f13 1973/* In combine.c */
79a490a9
AJ
1974extern int combine_instructions (rtx, unsigned int);
1975extern unsigned int extended_count (rtx, enum machine_mode, int);
1976extern rtx remove_death (unsigned int, rtx);
79a490a9
AJ
1977extern void dump_combine_stats (FILE *);
1978extern void dump_combine_total_stats (FILE *);
62551c66 1979/* In web.c */
80fcc7bc 1980extern void web_main (void);
ac957f13 1981
dad822d3 1982/* In sched-rgn.c. */
0c20a65f 1983extern void schedule_insns (FILE *);
dad822d3
PB
1984
1985/* In sched-ebb.c. */
0c20a65f 1986extern void schedule_ebbs (FILE *);
dad822d3
PB
1987
1988/* In haifa-sched.c. */
0c20a65f 1989extern void fix_sched_param (const char *, const char *);
ac957f13
JL
1990
1991/* In print-rtl.c */
47c10e9b 1992extern const char *print_rtx_head;
0c20a65f
AJ
1993extern void debug_rtx (rtx);
1994extern void debug_rtx_list (rtx, int);
1995extern void debug_rtx_range (rtx, rtx);
1996extern rtx debug_rtx_find (rtx, int);
0c20a65f
AJ
1997extern void print_mem_expr (FILE *, tree);
1998extern void print_rtl (FILE *, rtx);
1999extern void print_simple_rtl (FILE *, rtx);
2000extern int print_rtl_single (FILE *, rtx);
2001extern void print_inline_rtx (FILE *, rtx, int);
ac957f13
JL
2002
2003/* In loop.c */
0c20a65f 2004extern void init_loop (void);
0c20a65f 2005extern void loop_optimize (rtx, FILE *, int);
75473b02
SB
2006
2007/* In bt-load.c */
827c06b6 2008extern void branch_target_load_optimize (bool);
ac957f13
JL
2009
2010/* In function.c */
0c20a65f
AJ
2011extern void reposition_prologue_and_epilogue_notes (rtx);
2012extern void thread_prologue_and_epilogue_insns (rtx);
2013extern int prologue_epilogue_contains (rtx);
2014extern int sibcall_epilogue_contains (rtx);
0c20a65f
AJ
2015extern void mark_temp_addr_taken (rtx);
2016extern void update_temp_slot_address (rtx, rtx);
ac957f13 2017
ac957f13 2018/* In stmt.c */
0c20a65f 2019extern void expand_null_return (void);
6e3077c6 2020extern void expand_naked_return (void);
0c20a65f 2021extern void emit_jump (rtx);
ac957f13
JL
2022
2023/* In expr.c */
0c20a65f
AJ
2024extern rtx move_by_pieces (rtx, rtx, unsigned HOST_WIDE_INT,
2025 unsigned int, int);
2e245dac 2026
ac957f13 2027/* In flow.c */
e22857eb 2028extern void recompute_reg_usage (void);
0c20a65f
AJ
2029extern int initialize_uninitialized_subregs (void);
2030extern void delete_dead_jumptables (void);
0c20a65f
AJ
2031extern void print_rtl_with_bb (FILE *, rtx);
2032extern void dump_flow_info (FILE *);
ac957f13
JL
2033
2034/* In expmed.c */
0c20a65f
AJ
2035extern void init_expmed (void);
2036extern void expand_inc (rtx, rtx);
2037extern void expand_dec (rtx, rtx);
ac957f13 2038
50b2596f 2039/* In gcse.c */
0c20a65f
AJ
2040extern bool can_copy_p (enum machine_mode);
2041extern rtx fis_get_condition (rtx);
0c20a65f
AJ
2042extern int gcse_main (rtx, FILE *);
2043extern int bypass_jumps (FILE *);
0516f6fe
SB
2044
2045/* In postreload-gcse.c */
2046extern void gcse_after_reload_main (rtx);
50b2596f 2047
ac957f13 2048/* In global.c */
0c20a65f 2049extern void mark_elimination (int, int);
0c20a65f
AJ
2050extern int global_alloc (FILE *);
2051extern void dump_global_regs (FILE *);
cab634f2 2052#ifdef HARD_CONST
cff9f8d5 2053/* Yes, this ifdef is silly, but HARD_REG_SET is not always defined. */
0c20a65f 2054extern void retry_global_alloc (int, HARD_REG_SET);
cab634f2 2055#endif
0c20a65f 2056extern void build_insn_chain (rtx);
ac957f13
JL
2057
2058/* In regclass.c */
0c20a65f
AJ
2059extern int reg_classes_intersect_p (enum reg_class, enum reg_class);
2060extern int reg_class_subset_p (enum reg_class, enum reg_class);
2061extern void globalize_reg (int);
28420116 2062extern void init_reg_modes_once (void);
0c20a65f
AJ
2063extern void init_regs (void);
2064extern void init_fake_stack_mems (void);
2065extern void init_reg_sets (void);
0c20a65f
AJ
2066extern void regclass_init (void);
2067extern void regclass (rtx, int, FILE *);
c80a0f26 2068extern void reg_scan (rtx, unsigned int);
0c20a65f
AJ
2069extern void reg_scan_update (rtx, rtx, unsigned int);
2070extern void fix_register (const char *, int, int);
41bf2a8b
RH
2071extern void init_subregs_of_mode (void);
2072extern void record_subregs_of_mode (rtx);
cff9f8d5 2073#ifdef HARD_CONST
0c20a65f
AJ
2074extern void cannot_change_mode_set_regs (HARD_REG_SET *,
2075 enum machine_mode, unsigned int);
cff9f8d5 2076#endif
0c20a65f
AJ
2077extern bool invalid_mode_change_p (unsigned int, enum reg_class,
2078 enum machine_mode);
cdadb1dd 2079
50b2596f 2080/* In regmove.c */
0c20a65f 2081extern void regmove_optimize (rtx, int, FILE *);
0c20a65f 2082extern void combine_stack_adjustments (void);
50b2596f
KG
2083
2084/* In reorg.c */
0c20a65f 2085extern void dbr_schedule (rtx, FILE *);
50b2596f 2086
ac957f13 2087/* In local-alloc.c */
0c20a65f 2088extern void dump_local_alloc (FILE *);
0c20a65f 2089extern int local_alloc (void);
ac957f13 2090
ac957f13 2091/* In reg-stack.c */
827c06b6 2092extern bool reg_to_stack (FILE *);
ac957f13 2093
ac957f13 2094/* In calls.c */
ebb1b59a
BS
2095enum libcall_type
2096{
2097 LCT_NORMAL = 0,
2098 LCT_CONST = 1,
2099 LCT_PURE = 2,
2100 LCT_CONST_MAKE_BLOCK = 3,
695ee791 2101 LCT_PURE_MAKE_BLOCK = 4,
9555a122 2102 LCT_NORETURN = 5,
9d98f8f9 2103 LCT_THROW = 6,
321cf1f2 2104 LCT_RETURNS_TWICE = 7
ebb1b59a
BS
2105};
2106
0c20a65f
AJ
2107extern void emit_library_call (rtx, enum libcall_type, enum machine_mode, int,
2108 ...);
2109extern rtx emit_library_call_value (rtx, rtx, enum libcall_type,
2110 enum machine_mode, int, ...);
ac957f13 2111
ac957f13 2112/* In varasm.c */
0c20a65f
AJ
2113extern int in_data_section (void);
2114extern void init_varasm_once (void);
ac957f13
JL
2115
2116/* In rtl.c */
0c20a65f 2117extern void traverse_md_constants (int (*) (void **, void *), void *);
c25c12b8 2118struct md_constant { char *name, *value; };
ac957f13 2119
7e7ec48e 2120/* In read-rtl.c */
0c20a65f 2121extern int read_skip_spaces (FILE *);
57406c63 2122extern bool read_rtx (FILE *, rtx *, int *);
7445392c
RS
2123extern void copy_rtx_ptr_loc (const void *, const void *);
2124extern void print_rtx_ptr_loc (const void *);
2125extern const char *join_c_conditions (const char *, const char *);
2126extern void print_c_condition (const char *);
bcdaba58
RH
2127extern const char *read_rtx_filename;
2128extern int read_rtx_lineno;
2129
ac957f13 2130/* In alias.c */
4682ae04
AJ
2131extern void clear_reg_alias_info (rtx);
2132extern rtx canon_rtx (rtx);
2133extern int true_dependence (rtx, enum machine_mode, rtx, int (*)(rtx, int));
2134extern rtx get_addr (rtx);
2135extern int canon_true_dependence (rtx, enum machine_mode, rtx, rtx,
2136 int (*)(rtx, int));
2137extern int read_dependence (rtx, rtx);
2138extern int anti_dependence (rtx, rtx);
2139extern int output_dependence (rtx, rtx);
2140extern void mark_constant_function (void);
2141extern void init_alias_once (void);
2142extern void init_alias_analysis (void);
2143extern void end_alias_analysis (void);
4682ae04
AJ
2144extern bool memory_modified_in_insn_p (rtx, rtx);
2145extern rtx find_base_term (rtx);
3e89ed8d 2146extern rtx gen_hard_reg_clobber (enum machine_mode, unsigned int);
bb1acb3e
RH
2147extern rtx get_reg_known_value (unsigned int);
2148extern bool get_reg_known_equiv_p (unsigned int);
4c649323 2149
21b2cd73 2150#ifdef STACK_REGS
0c20a65f 2151extern int stack_regs_mentioned (rtx insn);
21b2cd73
JH
2152#endif
2153
a157febd 2154/* In toplev.c */
e2500fed 2155extern GTY(()) rtx stack_limit_rtx;
dfdb644f 2156
7b82b5da 2157/* In regrename.c */
0c20a65f
AJ
2158extern void regrename_optimize (void);
2159extern void copyprop_hardreg_forward (void);
7b82b5da 2160
4db384c9 2161/* In ifcvt.c */
0c20a65f 2162extern void if_convert (int);
2ea64f10 2163
4db384c9 2164/* In predict.c */
0c20a65f
AJ
2165extern void invert_br_probabilities (rtx);
2166extern bool expensive_function_p (int);
5c856b23 2167/* In tracer.c */
35b6b437 2168extern void tracer (unsigned int);
cff9f8d5 2169
014a1138
JZ
2170/* In var-tracking.c */
2171extern void variable_tracking_main (void);
2172
50654f6c 2173/* In stor-layout.c. */
0aea6467
ZD
2174extern void get_mode_bounds (enum machine_mode, int, enum machine_mode,
2175 rtx *, rtx *);
50654f6c
ZD
2176
2177/* In loop-unswitch.c */
2178extern rtx reversed_condition (rtx);
2179extern rtx compare_and_jump_seq (rtx, rtx, enum rtx_code, rtx, int, rtx);
2180
2181/* In loop-iv.c */
2182extern rtx canon_condition (rtx);
2183extern void simplify_using_condition (rtx, rtx *, struct bitmap_head_def *);
2184
f6db1481
RH
2185/* In ra.c. */
2186extern void reg_alloc (void);
2187
e5626198 2188/* In modulo-sched.c. */
e5626198 2189extern void sms_schedule (FILE *);
2f93eea8
PB
2190\f
2191struct rtl_hooks
2192{
2193 rtx (*gen_lowpart) (enum machine_mode, rtx);
9ce921ab 2194 rtx (*gen_lowpart_no_emit) (enum machine_mode, rtx);
2f93eea8
PB
2195 rtx (*reg_nonzero_bits) (rtx, enum machine_mode, rtx, enum machine_mode,
2196 unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT *);
2197 rtx (*reg_num_sign_bit_copies) (rtx, enum machine_mode, rtx, enum machine_mode,
2198 unsigned int, unsigned int *);
2199
2200 /* Whenever you add entries here, make sure you adjust hosthooks-def.h. */
2201};
2202
2203/* Each pass can provide its own. */
2204extern struct rtl_hooks rtl_hooks;
2205
2206/* ... but then it has to restore these. */
2207extern const struct rtl_hooks general_rtl_hooks;
2208
2209/* Keep this for the nonce. */
2210#define gen_lowpart rtl_hooks.gen_lowpart
2211
88657302 2212#endif /* ! GCC_RTL_H */