]>
Commit | Line | Data |
---|---|---|
6f29feb1 | 1 | /* Register Transfer Language (RTL) definitions for GNU C-Compiler |
a8efe40d | 2 | Copyright (C) 1987, 1991 Free Software Foundation, Inc. |
6f29feb1 JW |
3 | |
4 | This file is part of GNU CC. | |
5 | ||
6 | GNU CC is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2, or (at your option) | |
9 | any later version. | |
10 | ||
11 | GNU CC is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU CC; see the file COPYING. If not, write to | |
18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
19 | ||
20 | ||
21 | #include "machmode.h" | |
22 | ||
23 | #undef FFS /* Some systems predefine this symbol; don't let it interfere. */ | |
1cfc3092 | 24 | #undef FLOAT /* Likewise. */ |
6f29feb1 JW |
25 | |
26 | /* Register Transfer Language EXPRESSIONS CODES */ | |
27 | ||
28 | #define RTX_CODE enum rtx_code | |
29 | enum rtx_code { | |
30 | ||
31 | #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) ENUM , | |
32 | #include "rtl.def" /* rtl expressions are documented here */ | |
33 | #undef DEF_RTL_EXPR | |
34 | ||
6dc42e49 | 35 | LAST_AND_UNUSED_RTX_CODE}; /* A convenient way to get a value for |
6f29feb1 | 36 | NUM_RTX_CODE. |
6dc42e49 | 37 | Assumes default enum value assignment. */ |
6f29feb1 JW |
38 | |
39 | #define NUM_RTX_CODE ((int)LAST_AND_UNUSED_RTX_CODE) | |
40 | /* The cast here, saves many elsewhere. */ | |
41 | ||
42 | extern int rtx_length[]; | |
43 | #define GET_RTX_LENGTH(CODE) (rtx_length[(int)(CODE)]) | |
44 | ||
45 | extern char *rtx_name[]; | |
46 | #define GET_RTX_NAME(CODE) (rtx_name[(int)(CODE)]) | |
47 | ||
48 | extern char *rtx_format[]; | |
49 | #define GET_RTX_FORMAT(CODE) (rtx_format[(int)(CODE)]) | |
50 | ||
51 | extern char rtx_class[]; | |
52 | #define GET_RTX_CLASS(CODE) (rtx_class[(int)(CODE)]) | |
53 | \f | |
54 | /* Common union for an element of an rtx. */ | |
55 | ||
56 | typedef union rtunion_def | |
57 | { | |
58 | int rtint; | |
59 | char *rtstr; | |
60 | struct rtx_def *rtx; | |
61 | struct rtvec_def *rtvec; | |
62 | enum machine_mode rttype; | |
63 | } rtunion; | |
64 | ||
65 | /* RTL expression ("rtx"). */ | |
66 | ||
67 | typedef struct rtx_def | |
68 | { | |
69 | #ifdef ONLY_INT_FIELDS | |
70 | unsigned short code; | |
71 | #else | |
72 | /* The kind of expression this is. */ | |
73 | enum rtx_code code : 16; | |
74 | #endif | |
75 | /* The kind of value the expression has. */ | |
76 | #ifdef ONLY_INT_FIELDS | |
77 | int mode : 8; | |
78 | #else | |
79 | enum machine_mode mode : 8; | |
80 | #endif | |
81 | /* 1 in an INSN if it can alter flow of control | |
82 | within this function. Not yet used! */ | |
83 | unsigned int jump : 1; | |
84 | /* 1 in an INSN if it can call another function. Not yet used! */ | |
85 | unsigned int call : 1; | |
86 | /* 1 in a MEM or REG if value of this expression will never change | |
87 | during the current function, even though it is not | |
88 | manifestly constant. | |
89 | 1 in a SYMBOL_REF if it addresses something in the per-function | |
90 | constants pool. | |
91 | 1 in a CALL_INSN if it is a const call. | |
92 | 1 in a JUMP_INSN if it is a branch that should be annulled. Valid from | |
93 | reorg until end of compilation; cleared before used. */ | |
94 | unsigned int unchanging : 1; | |
95 | /* 1 in a MEM expression if contents of memory are volatile. | |
96 | 1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL or BARRIER | |
97 | if it is deleted. | |
98 | 1 in a REG expression if corresponds to a variable declared by the user. | |
99 | 0 for an internally generated temporary. | |
100 | In a SYMBOL_REF, this flag is used for machine-specific purposes. */ | |
101 | unsigned int volatil : 1; | |
102 | /* 1 in a MEM referring to a field of a structure (not a union!). | |
103 | 0 if the MEM was a variable or the result of a * operator in C; | |
104 | 1 if it was the result of a . or -> operator (on a struct) in C. | |
105 | 1 in a REG if the register is used only in exit code a loop. | |
106 | 1 in a CODE_LABEL if the label is used for nonlocal gotos | |
107 | and must not be deleted even if its count is zero. | |
108 | 1 in a LABEL_REF if this is a reference to a label outside the | |
109 | current loop. | |
110 | 1 in an INSN, JUMP_INSN, or CALL_INSN if this insn must be scheduled | |
d45cf215 | 111 | together with the preceding insn. Valid only within sched. |
6f29feb1 JW |
112 | 1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and |
113 | from the target of a branch. Valid from reorg until end of compilation; | |
114 | cleared before used. */ | |
115 | unsigned int in_struct : 1; | |
116 | /* 1 if this rtx is used. This is used for copying shared structure. | |
117 | See `unshare_all_rtl'. | |
118 | In a REG, this is not needed for that purpose, and used instead | |
119 | in `leaf_renumber_regs_insn'. | |
120 | In a SYMBOL_REF, means that emit_library_call | |
121 | has used it as the function. */ | |
122 | unsigned int used : 1; | |
123 | /* Nonzero if this rtx came from procedure integration. | |
124 | In a REG, nonzero means this reg refers to the return value | |
125 | of the current function. */ | |
126 | unsigned integrated : 1; | |
127 | /* The first element of the operands of this rtx. | |
128 | The number of operands and their types are controlled | |
129 | by the `code' field, according to rtl.def. */ | |
130 | rtunion fld[1]; | |
131 | } *rtx; | |
132 | ||
133 | #define NULL_RTX (rtx) 0 | |
134 | ||
135 | /* Define macros to access the `code' field of the rtx. */ | |
136 | ||
137 | #ifdef SHORT_ENUM_BUG | |
138 | #define GET_CODE(RTX) ((enum rtx_code) ((RTX)->code)) | |
139 | #define PUT_CODE(RTX, CODE) ((RTX)->code = ((short) (CODE))) | |
140 | #else | |
141 | #define GET_CODE(RTX) ((RTX)->code) | |
142 | #define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE)) | |
143 | #endif | |
144 | ||
145 | #define GET_MODE(RTX) ((RTX)->mode) | |
146 | #define PUT_MODE(RTX, MODE) ((RTX)->mode = (MODE)) | |
147 | ||
148 | #define RTX_INTEGRATED_P(RTX) ((RTX)->integrated) | |
149 | #define RTX_UNCHANGING_P(RTX) ((RTX)->unchanging) | |
150 | ||
151 | /* RTL vector. These appear inside RTX's when there is a need | |
152 | for a variable number of things. The principle use is inside | |
153 | PARALLEL expressions. */ | |
154 | ||
155 | typedef struct rtvec_def{ | |
156 | unsigned num_elem; /* number of elements */ | |
157 | rtunion elem[1]; | |
158 | } *rtvec; | |
159 | ||
160 | #define NULL_RTVEC (rtvec) 0 | |
161 | ||
162 | #define GET_NUM_ELEM(RTVEC) ((RTVEC)->num_elem) | |
163 | #define PUT_NUM_ELEM(RTVEC, NUM) ((RTVEC)->num_elem = (unsigned) NUM) | |
164 | ||
165 | #define RTVEC_ELT(RTVEC, I) ((RTVEC)->elem[(I)].rtx) | |
166 | ||
167 | /* 1 if X is a REG. */ | |
168 | ||
169 | #define REG_P(X) (GET_CODE (X) == REG) | |
170 | ||
171 | /* 1 if X is a constant value that is an integer. */ | |
172 | ||
173 | #define CONSTANT_P(X) \ | |
174 | (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \ | |
175 | || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST_DOUBLE \ | |
176 | || GET_CODE (X) == CONST || GET_CODE (X) == HIGH) | |
177 | ||
178 | /* General accessor macros for accessing the fields of an rtx. */ | |
179 | ||
180 | #define XEXP(RTX, N) ((RTX)->fld[N].rtx) | |
181 | #define XINT(RTX, N) ((RTX)->fld[N].rtint) | |
182 | #define XSTR(RTX, N) ((RTX)->fld[N].rtstr) | |
183 | #define XVEC(RTX, N) ((RTX)->fld[N].rtvec) | |
184 | #define XVECLEN(RTX, N) ((RTX)->fld[N].rtvec->num_elem) | |
185 | #define XVECEXP(RTX,N,M)((RTX)->fld[N].rtvec->elem[M].rtx) | |
186 | \f | |
187 | /* ACCESS MACROS for particular fields of insns. */ | |
188 | ||
189 | /* Holds a unique number for each insn. | |
190 | These are not necessarily sequentially increasing. */ | |
191 | #define INSN_UID(INSN) ((INSN)->fld[0].rtint) | |
192 | ||
193 | /* Chain insns together in sequence. */ | |
194 | #define PREV_INSN(INSN) ((INSN)->fld[1].rtx) | |
195 | #define NEXT_INSN(INSN) ((INSN)->fld[2].rtx) | |
196 | ||
197 | /* The body of an insn. */ | |
198 | #define PATTERN(INSN) ((INSN)->fld[3].rtx) | |
199 | ||
200 | /* Code number of instruction, from when it was recognized. | |
201 | -1 means this instruction has not been recognized yet. */ | |
202 | #define INSN_CODE(INSN) ((INSN)->fld[4].rtint) | |
203 | ||
204 | /* Set up in flow.c; empty before then. | |
205 | Holds a chain of INSN_LIST rtx's whose first operands point at | |
206 | previous insns with direct data-flow connections to this one. | |
207 | That means that those insns set variables whose next use is in this insn. | |
208 | They are always in the same basic block as this insn. */ | |
209 | #define LOG_LINKS(INSN) ((INSN)->fld[5].rtx) | |
210 | ||
211 | /* 1 if insn has been deleted. */ | |
212 | #define INSN_DELETED_P(INSN) ((INSN)->volatil) | |
213 | ||
214 | /* 1 if insn is a call to a const function. */ | |
215 | #define CONST_CALL_P(INSN) ((INSN)->unchanging) | |
216 | ||
217 | /* 1 if insn is a branch that should not unconditionally execute its | |
218 | delay slots, i.e., it is an annulled branch. */ | |
219 | #define INSN_ANNULLED_BRANCH_P(INSN) ((INSN)->unchanging) | |
220 | ||
221 | /* 1 if insn is in a delay slot and is from the target of the branch. If | |
6dc42e49 | 222 | the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be |
6f29feb1 JW |
223 | executed if the branch is taken. For annulled branches with this bit |
224 | clear, the insn should be executed only if the branch is not taken. */ | |
225 | #define INSN_FROM_TARGET_P(INSN) ((INSN)->in_struct) | |
226 | ||
227 | /* Holds a list of notes on what this insn does to various REGs. | |
228 | It is a chain of EXPR_LIST rtx's, where the second operand | |
229 | is the chain pointer and the first operand is the REG being described. | |
230 | The mode field of the EXPR_LIST contains not a real machine mode | |
231 | but a value that says what this note says about the REG: | |
232 | REG_DEAD means that the value in REG dies in this insn (i.e., it is | |
233 | not needed past this insn). If REG is set in this insn, the REG_DEAD | |
234 | note may, but need not, be omitted. | |
235 | REG_INC means that the REG is autoincremented or autodecremented. | |
236 | REG_EQUIV describes the insn as a whole; it says that the | |
237 | insn sets a register to a constant value or to be equivalent to | |
238 | a memory address. If the | |
239 | register is spilled to the stack then the constant value | |
240 | should be substituted for it. The contents of the REG_EQUIV | |
241 | is the constant value or memory address, which may be different | |
242 | from the source of the SET although it has the same value. | |
243 | REG_EQUAL is like REG_EQUIV except that the destination | |
244 | is only momentarily equal to the specified rtx. Therefore, it | |
245 | cannot be used for substitution; but it can be used for cse. | |
246 | REG_RETVAL means that this insn copies the return-value of | |
247 | a library call out of the hard reg for return values. This note | |
248 | is actually an INSN_LIST and it points to the first insn involved | |
249 | in setting up arguments for the call. flow.c uses this to delete | |
250 | the entire library call when its result is dead. | |
251 | REG_LIBCALL is the inverse of REG_RETVAL: it goes on the first insn | |
252 | of the library call and points at the one that has the REG_RETVAL. | |
253 | REG_WAS_0 says that the register set in this insn held 0 before the insn. | |
254 | The contents of the note is the insn that stored the 0. | |
255 | If that insn is deleted or patched to a NOTE, the REG_WAS_0 is inoperative. | |
256 | The REG_WAS_0 note is actually an INSN_LIST, not an EXPR_LIST. | |
257 | REG_NONNEG means that the register is always nonnegative during | |
258 | the containing loop. This is used in branches so that decrement and | |
259 | branch instructions terminating on zero can be matched. There must be | |
260 | an insn pattern in the md file named `decrement_and_branch_until_zero' | |
261 | or else this will never be added to any instructions. | |
262 | REG_NO_CONFLICT means there is no conflict *after this insn* | |
263 | between the register in the note and the destination of this insn. | |
264 | REG_UNUSED identifies a register set in this insn and never used. | |
265 | REG_CC_SETTER and REG_CC_USER link a pair of insns that set and use | |
266 | CC0, respectively. Normally, these are required to be consecutive insns, | |
267 | but we permit putting a cc0-setting insn in the delay slot of a branch | |
268 | as long as only one copy of the insn exists. In that case, these notes | |
269 | point from one to the other to allow code generation to determine what | |
270 | any require information and to properly update CC_STATUS. | |
271 | REG_LABEL points to a CODE_LABEL. Used by non-JUMP_INSNs to | |
272 | say that the CODE_LABEL contained in the REG_LABEL note is used | |
273 | by the insn. | |
d45cf215 | 274 | REG_DEP_ANTI is used in LOG_LINKS which represent anti (write after read) |
6f29feb1 JW |
275 | dependencies. REG_DEP_OUTPUT is used in LOG_LINKS which represent output |
276 | (write after write) dependencies. Data dependencies, which are the only | |
277 | type of LOG_LINK created by flow, are represented by a 0 reg note kind. */ | |
278 | ||
279 | #define REG_NOTES(INSN) ((INSN)->fld[6].rtx) | |
280 | ||
281 | /* Don't forget to change reg_note_name in rtl.c. */ | |
282 | enum reg_note { REG_DEAD = 1, REG_INC = 2, REG_EQUIV = 3, REG_WAS_0 = 4, | |
283 | REG_EQUAL = 5, REG_RETVAL = 6, REG_LIBCALL = 7, | |
284 | REG_NONNEG = 8, REG_NO_CONFLICT = 9, REG_UNUSED = 10, | |
285 | REG_CC_SETTER = 11, REG_CC_USER = 12, REG_LABEL = 13, | |
286 | REG_DEP_ANTI = 14, REG_DEP_OUTPUT = 15 }; | |
287 | ||
288 | /* Define macros to extract and insert the reg-note kind in an EXPR_LIST. */ | |
289 | #define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK)) | |
290 | #define PUT_REG_NOTE_KIND(LINK,KIND) PUT_MODE(LINK, (enum machine_mode) (KIND)) | |
291 | ||
292 | /* Names for REG_NOTE's in EXPR_LIST insn's. */ | |
293 | ||
294 | extern char *reg_note_name[]; | |
295 | #define GET_REG_NOTE_NAME(MODE) (reg_note_name[(int)(MODE)]) | |
296 | ||
297 | /* The label-number of a code-label. The assembler label | |
298 | is made from `L' and the label-number printed in decimal. | |
299 | Label numbers are unique in a compilation. */ | |
300 | #define CODE_LABEL_NUMBER(INSN) ((INSN)->fld[3].rtint) | |
301 | ||
302 | #define LINE_NUMBER NOTE | |
303 | ||
304 | /* In a NOTE that is a line number, this is a string for the file name | |
305 | that the line is in. */ | |
306 | ||
307 | #define NOTE_SOURCE_FILE(INSN) ((INSN)->fld[3].rtstr) | |
308 | ||
309 | /* In a NOTE that is a line number, this is the line number. | |
310 | Other kinds of NOTEs are identified by negative numbers here. */ | |
311 | #define NOTE_LINE_NUMBER(INSN) ((INSN)->fld[4].rtint) | |
312 | ||
313 | /* Codes that appear in the NOTE_LINE_NUMBER field | |
314 | for kinds of notes that are not line numbers. */ | |
315 | ||
316 | /* This note indicates the end of the real body of the function, | |
317 | after moving the parms into their homes, etc. */ | |
318 | #define NOTE_INSN_FUNCTION_BEG 0 | |
319 | ||
320 | /* This note is used to get rid of an insn | |
321 | when it isn't safe to patch the insn out of the chain. */ | |
322 | #define NOTE_INSN_DELETED -1 | |
323 | #define NOTE_INSN_BLOCK_BEG -2 | |
324 | #define NOTE_INSN_BLOCK_END -3 | |
325 | #define NOTE_INSN_LOOP_BEG -4 | |
326 | #define NOTE_INSN_LOOP_END -5 | |
327 | /* This kind of note is generated at the end of the function body, | |
328 | just before the return insn or return label. | |
329 | In an optimizing compilation it is deleted by the first jump optimization, | |
330 | after enabling that optimizer to determine whether control can fall | |
331 | off the end of the function body without a return statement. */ | |
332 | #define NOTE_INSN_FUNCTION_END -6 | |
333 | /* This kind of note is generated just after each call to `setjmp', et al. */ | |
334 | #define NOTE_INSN_SETJMP -7 | |
335 | /* Generated at the place in a loop that `continue' jumps to. */ | |
336 | #define NOTE_INSN_LOOP_CONT -8 | |
337 | /* Generated at the start of a duplicated exit test. */ | |
338 | #define NOTE_INSN_LOOP_VTOP -9 | |
339 | /* Don't forget to change note_insn_name in rtl.c. */ | |
340 | ||
341 | #define NOTE_DECL_NAME(INSN) ((INSN)->fld[3].rtstr) | |
342 | #define NOTE_DECL_CODE(INSN) ((INSN)->fld[4].rtint) | |
343 | #define NOTE_DECL_RTL(INSN) ((INSN)->fld[5].rtx) | |
344 | #define NOTE_DECL_IDENTIFIER(INSN) ((INSN)->fld[6].rtint) | |
345 | #define NOTE_DECL_TYPE(INSN) ((INSN)->fld[7].rtint) | |
346 | ||
347 | /* Names for NOTE insn's other than line numbers. */ | |
348 | ||
349 | extern char *note_insn_name[]; | |
350 | #define GET_NOTE_INSN_NAME(NOTE_CODE) (note_insn_name[-(NOTE_CODE)]) | |
351 | ||
352 | /* The name of a label, in case it corresponds to an explicit label | |
353 | in the input source code. */ | |
354 | #define LABEL_NAME(LABEL) ((LABEL)->fld[4].rtstr) | |
355 | ||
356 | /* In jump.c, each label contains a count of the number | |
357 | of LABEL_REFs that point at it, so unused labels can be deleted. */ | |
358 | #define LABEL_NUSES(LABEL) ((LABEL)->fld[5].rtint) | |
359 | ||
360 | /* In jump.c, each JUMP_INSN can point to a label that it can jump to, | |
361 | so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can | |
362 | be decremented and possibly the label can be deleted. */ | |
363 | #define JUMP_LABEL(INSN) ((INSN)->fld[7].rtx) | |
364 | ||
365 | /* Once basic blocks are found in flow.c, | |
366 | each CODE_LABEL starts a chain that goes through | |
367 | all the LABEL_REFs that jump to that label. | |
368 | The chain eventually winds up at the CODE_LABEL; it is circular. */ | |
369 | #define LABEL_REFS(LABEL) ((LABEL)->fld[5].rtx) | |
370 | \f | |
371 | /* This is the field in the LABEL_REF through which the circular chain | |
372 | of references to a particular label is linked. | |
373 | This chain is set up in flow.c. */ | |
374 | ||
375 | #define LABEL_NEXTREF(REF) ((REF)->fld[1].rtx) | |
376 | ||
377 | /* Once basic blocks are found in flow.c, | |
378 | Each LABEL_REF points to its containing instruction with this field. */ | |
379 | ||
380 | #define CONTAINING_INSN(RTX) ((RTX)->fld[2].rtx) | |
381 | ||
382 | /* For a REG rtx, REGNO extracts the register number. */ | |
383 | ||
384 | #define REGNO(RTX) ((RTX)->fld[0].rtint) | |
385 | ||
386 | /* For a REG rtx, REG_FUNCTION_VALUE_P is nonzero if the reg | |
387 | is the current function's return value. */ | |
388 | ||
389 | #define REG_FUNCTION_VALUE_P(RTX) ((RTX)->integrated) | |
390 | ||
391 | /* 1 in a REG rtx if it corresponds to a variable declared by the user. */ | |
392 | #define REG_USERVAR_P(RTX) ((RTX)->volatil) | |
393 | ||
394 | /* For a CONST_INT rtx, INTVAL extracts the integer. */ | |
395 | ||
396 | #define INTVAL(RTX) ((RTX)->fld[0].rtint) | |
397 | ||
398 | /* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of. | |
399 | SUBREG_WORD extracts the word-number. */ | |
400 | ||
401 | #define SUBREG_REG(RTX) ((RTX)->fld[0].rtx) | |
402 | #define SUBREG_WORD(RTX) ((RTX)->fld[1].rtint) | |
403 | ||
404 | /* Access various components of an ASM_OPERANDS rtx. */ | |
405 | ||
406 | #define ASM_OPERANDS_TEMPLATE(RTX) XSTR ((RTX), 0) | |
407 | #define ASM_OPERANDS_OUTPUT_CONSTRAINT(RTX) XSTR ((RTX), 1) | |
408 | #define ASM_OPERANDS_OUTPUT_IDX(RTX) XINT ((RTX), 2) | |
409 | #define ASM_OPERANDS_INPUT_VEC(RTX) XVEC ((RTX), 3) | |
410 | #define ASM_OPERANDS_INPUT_CONSTRAINT_VEC(RTX) XVEC ((RTX), 4) | |
411 | #define ASM_OPERANDS_INPUT(RTX, N) XVECEXP ((RTX), 3, (N)) | |
412 | #define ASM_OPERANDS_INPUT_LENGTH(RTX) XVECLEN ((RTX), 3) | |
413 | #define ASM_OPERANDS_INPUT_CONSTRAINT(RTX, N) XSTR (XVECEXP ((RTX), 4, (N)), 0) | |
414 | #define ASM_OPERANDS_INPUT_MODE(RTX, N) GET_MODE (XVECEXP ((RTX), 4, (N))) | |
415 | #define ASM_OPERANDS_SOURCE_FILE(RTX) XSTR ((RTX), 5) | |
416 | #define ASM_OPERANDS_SOURCE_LINE(RTX) XINT ((RTX), 6) | |
417 | ||
418 | /* For a MEM rtx, 1 if it's a volatile reference. | |
419 | Also in an ASM_OPERANDS rtx. */ | |
420 | #define MEM_VOLATILE_P(RTX) ((RTX)->volatil) | |
421 | ||
422 | /* For a MEM rtx, 1 if it refers to a structure or union component. */ | |
423 | #define MEM_IN_STRUCT_P(RTX) ((RTX)->in_struct) | |
424 | ||
425 | /* For a LABEL_REF, 1 means that this reference is to a label outside the | |
426 | loop containing the reference. */ | |
427 | #define LABEL_OUTSIDE_LOOP_P(RTX) ((RTX)->in_struct) | |
428 | ||
429 | /* For a CODE_LABEL, 1 means always consider this label to be needed. */ | |
430 | #define LABEL_PRESERVE_P(RTX) ((RTX)->in_struct) | |
431 | ||
432 | /* For a REG, 1 means the register is used only in an exit test of a loop. */ | |
433 | #define REG_LOOP_TEST_P(RTX) ((RTX)->in_struct) | |
434 | ||
435 | /* During sched, for an insn, 1 means that the insn must be scheduled together | |
d45cf215 | 436 | with the preceding insn. */ |
6f29feb1 JW |
437 | #define SCHED_GROUP_P(INSN) ((INSN)->in_struct) |
438 | ||
439 | /* For a SET rtx, SET_DEST is the place that is set | |
440 | and SET_SRC is the value it is set to. */ | |
441 | #define SET_DEST(RTX) ((RTX)->fld[0].rtx) | |
442 | #define SET_SRC(RTX) ((RTX)->fld[1].rtx) | |
443 | ||
444 | /* For a TRAP_IF rtx, TRAP_CONDITION is an expression. */ | |
445 | #define TRAP_CONDITION(RTX) ((RTX)->fld[0].rtx) | |
446 | ||
447 | /* 1 in a SYMBOL_REF if it addresses this function's constants pool. */ | |
448 | #define CONSTANT_POOL_ADDRESS_P(RTX) ((RTX)->unchanging) | |
449 | ||
450 | /* Flag in a SYMBOL_REF for machine-specific purposes. */ | |
451 | #define SYMBOL_REF_FLAG(RTX) ((RTX)->volatil) | |
452 | ||
453 | /* 1 means a SYMBOL_REF has been the library function in emit_library_call. */ | |
454 | #define SYMBOL_REF_USED(RTX) ((RTX)->used) | |
455 | ||
456 | /* For an INLINE_HEADER rtx, FIRST_FUNCTION_INSN is the first insn | |
457 | of the function that is not involved in copying parameters to | |
458 | pseudo-registers. FIRST_PARM_INSN is the very first insn of | |
459 | the function, including the parameter copying. | |
460 | We keep this around in case we must splice | |
461 | this function into the assembly code at the end of the file. | |
462 | FIRST_LABELNO is the first label number used by the function (inclusive). | |
463 | LAST_LABELNO is the last label used by the function (exclusive). | |
464 | MAX_REGNUM is the largest pseudo-register used by that function. | |
465 | FUNCTION_ARGS_SIZE is the size of the argument block in the stack. | |
466 | POPS_ARGS is the number of bytes of input arguments popped by the function | |
467 | STACK_SLOT_LIST is the list of stack slots. | |
468 | FUNCTION_FLAGS are where single-bit flags are saved. | |
469 | OUTGOING_ARGS_SIZE is the size of the largest outgoing stack parameter list. | |
470 | ORIGINAL_ARG_VECTOR is a vector of the original DECL_RTX values | |
471 | for the function arguments. | |
472 | ORIGINAL_DECL_INITIAL is a pointer to the original DECL_INITIAL for the | |
473 | function. | |
474 | ||
475 | We want this to lay down like an INSN. The PREV_INSN field | |
476 | is always NULL. The NEXT_INSN field always points to the | |
477 | first function insn of the function being squirreled away. */ | |
478 | ||
479 | #define FIRST_FUNCTION_INSN(RTX) ((RTX)->fld[2].rtx) | |
480 | #define FIRST_PARM_INSN(RTX) ((RTX)->fld[3].rtx) | |
481 | #define FIRST_LABELNO(RTX) ((RTX)->fld[4].rtint) | |
482 | #define LAST_LABELNO(RTX) ((RTX)->fld[5].rtint) | |
483 | #define MAX_PARMREG(RTX) ((RTX)->fld[6].rtint) | |
484 | #define MAX_REGNUM(RTX) ((RTX)->fld[7].rtint) | |
485 | #define FUNCTION_ARGS_SIZE(RTX) ((RTX)->fld[8].rtint) | |
486 | #define POPS_ARGS(RTX) ((RTX)->fld[9].rtint) | |
487 | #define STACK_SLOT_LIST(RTX) ((RTX)->fld[10].rtx) | |
488 | #define FUNCTION_FLAGS(RTX) ((RTX)->fld[11].rtint) | |
489 | #define OUTGOING_ARGS_SIZE(RTX) ((RTX)->fld[12].rtint) | |
490 | #define ORIGINAL_ARG_VECTOR(RTX) ((RTX)->fld[13].rtvec) | |
491 | #define ORIGINAL_DECL_INITIAL(RTX) ((RTX)->fld[14].rtx) | |
492 | ||
493 | /* In FUNCTION_FLAGS we save some variables computed when emitting the code | |
494 | for the function and which must be `or'ed into the current flag values when | |
495 | insns from that function are being inlined. */ | |
496 | ||
497 | /* These ought to be an enum, but non-ANSI compilers don't like that. */ | |
498 | #define FUNCTION_FLAGS_CALLS_ALLOCA 01 | |
499 | #define FUNCTION_FLAGS_CALLS_SETJMP 02 | |
500 | #define FUNCTION_FLAGS_RETURNS_STRUCT 04 | |
501 | #define FUNCTION_FLAGS_RETURNS_PCC_STRUCT 010 | |
502 | #define FUNCTION_FLAGS_NEEDS_CONTEXT 020 | |
503 | #define FUNCTION_FLAGS_HAS_NONLOCAL_LABEL 040 | |
504 | #define FUNCTION_FLAGS_RETURNS_POINTER 0100 | |
505 | #define FUNCTION_FLAGS_USES_CONST_POOL 0200 | |
506 | #define FUNCTION_FLAGS_CALLS_LONGJMP 0400 | |
507 | #define FUNCTION_FLAGS_USES_PIC_OFFSET_TABLE 01000 | |
508 | ||
509 | /* Define a macro to look for REG_INC notes, | |
510 | but save time on machines where they never exist. */ | |
511 | ||
58e54c44 RS |
512 | /* Don't continue this line--convex cc version 4.1 would lose. */ |
513 | #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT)) | |
6f29feb1 JW |
514 | #define FIND_REG_INC_NOTE(insn, reg) (find_reg_note ((insn), REG_INC, (reg))) |
515 | #else | |
516 | #define FIND_REG_INC_NOTE(insn, reg) 0 | |
517 | #endif | |
518 | ||
519 | /* Indicate whether the machine has any sort of auto increment addressing. | |
520 | If not, we can avoid checking for REG_INC notes. */ | |
521 | ||
58e54c44 RS |
522 | /* Don't continue this line--convex cc version 4.1 would lose. */ |
523 | #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT)) | |
6f29feb1 JW |
524 | #define AUTO_INC_DEC |
525 | #endif | |
526 | \f | |
527 | /* Generally useful functions. */ | |
528 | ||
529 | extern rtx rtx_alloc (); | |
530 | extern rtvec rtvec_alloc (); | |
531 | extern rtx find_reg_note (); | |
532 | extern rtx find_regno_note (); | |
533 | extern int get_integer_term (); | |
534 | extern rtx get_related_value (); | |
535 | extern rtx single_set (); | |
536 | extern rtx find_last_value (); | |
537 | extern rtx gen_rtx (); | |
538 | extern rtx copy_rtx (); | |
539 | extern rtx copy_rtx_if_shared (); | |
540 | extern rtx copy_most_rtx (); | |
541 | extern rtx replace_rtx (); | |
542 | extern rtvec gen_rtvec (); | |
543 | extern rtvec gen_rtvec_v (); | |
1cfc3092 | 544 | extern rtx read_rtx (); |
6f29feb1 JW |
545 | extern rtx gen_reg_rtx (); |
546 | extern rtx gen_label_rtx (); | |
547 | extern rtx gen_inline_header_rtx (); | |
548 | extern rtx gen_lowpart_common (); | |
549 | extern rtx gen_lowpart (); | |
550 | extern rtx gen_lowpart_if_possible (); | |
551 | extern rtx operand_subword (); | |
552 | extern rtx operand_subword_force (); | |
553 | extern int subreg_lowpart_p (); | |
554 | extern rtx make_safe_from (); | |
555 | extern rtx memory_address (); | |
556 | extern rtx get_insns (); | |
557 | extern rtx get_last_insn (); | |
558 | extern rtx get_last_insn_anywhere (); | |
559 | extern void start_sequence (); | |
560 | extern void push_to_sequence (); | |
561 | extern void end_sequence (); | |
562 | extern rtx gen_sequence (); | |
563 | extern rtx expand_expr (); | |
564 | extern rtx output_constant_def (); | |
565 | extern rtx immed_real_const (); | |
566 | extern rtx immed_real_const_1 (); | |
567 | extern rtx immed_double_const (); | |
568 | extern rtx force_const_mem (); | |
569 | extern rtx get_pool_constant (); | |
570 | extern enum machine_mode get_pool_mode (); | |
571 | extern int get_pool_offset (); | |
572 | extern rtx get_parm_real_loc (); | |
573 | extern rtx assign_stack_local (); | |
574 | extern rtx assign_stack_temp (); | |
575 | extern rtx protect_from_queue (); | |
576 | extern void emit_queue (); | |
577 | extern rtx emit_move_insn (); | |
578 | extern rtx emit_insn_before (); | |
579 | extern rtx emit_jump_insn_before (); | |
580 | extern rtx emit_call_insn_before (); | |
581 | extern rtx emit_barrier_before (); | |
582 | extern rtx emit_note_before (); | |
583 | extern rtx emit_insn_after (); | |
584 | extern rtx emit_jump_insn_after (); | |
585 | extern rtx emit_barrier_after (); | |
586 | extern rtx emit_label_after (); | |
587 | extern rtx emit_note_after (); | |
588 | extern rtx emit_line_note_after (); | |
589 | extern rtx emit_insn (); | |
590 | extern rtx emit_insns (); | |
591 | extern rtx emit_insns_before (); | |
592 | extern rtx emit_jump_insn (); | |
593 | extern rtx emit_call_insn (); | |
594 | extern rtx emit_label (); | |
595 | extern rtx emit_barrier (); | |
596 | extern rtx emit_line_note (); | |
597 | extern rtx emit_note (); | |
598 | extern rtx emit_line_note_force (); | |
599 | extern rtx make_insn_raw (); | |
600 | extern rtx previous_insn (); | |
601 | extern rtx next_insn (); | |
602 | extern rtx prev_nonnote_insn (); | |
603 | extern rtx next_nonnote_insn (); | |
604 | extern rtx prev_real_insn (); | |
605 | extern rtx next_real_insn (); | |
606 | extern rtx prev_active_insn (); | |
607 | extern rtx next_active_insn (); | |
608 | extern rtx prev_label (); | |
609 | extern rtx next_label (); | |
610 | extern rtx next_cc0_user (); | |
611 | extern rtx prev_cc0_setter (); | |
612 | extern rtx reg_set_last (); | |
613 | extern rtx next_nondeleted_insn (); | |
614 | extern enum rtx_code reverse_condition (); | |
615 | extern enum rtx_code swap_condition (); | |
616 | extern enum rtx_code unsigned_condition (); | |
617 | extern enum rtx_code signed_condition (); | |
618 | extern rtx plus_constant (), plus_constant_for_output (); | |
619 | extern rtx find_equiv_reg (); | |
915f619f | 620 | extern rtx squeeze_notes (); |
6f29feb1 JW |
621 | extern rtx delete_insn (); |
622 | extern void delete_jump (); | |
623 | extern rtx get_label_before (); | |
624 | extern rtx get_label_after (); | |
625 | extern rtx follow_jumps (); | |
626 | extern rtx adj_offsettable_operand (); | |
627 | extern rtx try_split (); | |
628 | extern rtx split_insns (); | |
629 | extern rtx simplify_unary_operation (), simplify_binary_operation (); | |
630 | extern rtx simplify_ternary_operation (), simplify_relational_operation (); | |
d0c84390 | 631 | extern rtx nonlocal_label_rtx_list (); |
6f29feb1 JW |
632 | |
633 | /* Maximum number of parallel sets and clobbers in any insn in this fn. | |
634 | Always at least 3, since the combiner could put that many togetherm | |
635 | and we want this to remain correct for all the remaining passes. */ | |
636 | ||
637 | extern int max_parallel; | |
638 | ||
639 | extern int asm_noperands (); | |
640 | extern char *decode_asm_operands (); | |
641 | ||
642 | #ifdef BITS_PER_WORD | |
643 | /* Conditional is to detect when config.h has been included. */ | |
644 | extern enum reg_class reg_preferred_class (); | |
645 | #endif | |
646 | ||
647 | extern rtx get_first_nonparm_insn (); | |
648 | ||
649 | /* Standard pieces of rtx, to be substituted directly into things. */ | |
650 | extern rtx pc_rtx; | |
651 | extern rtx cc0_rtx; | |
652 | extern rtx const0_rtx; | |
653 | extern rtx const1_rtx; | |
a8efe40d | 654 | extern rtx const2_rtx; |
6f29feb1 JW |
655 | extern rtx constm1_rtx; |
656 | extern rtx const_true_rtx; | |
a8efe40d RK |
657 | |
658 | extern rtx const_tiny_rtx[3][(int) MAX_MACHINE_MODE]; | |
659 | ||
660 | /* Returns a constant 0 rtx in mode MODE. Integer modes are treated the | |
661 | same as VOIDmode. */ | |
662 | ||
663 | #define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)]) | |
664 | ||
665 | /* Likewise, for the constants 1 and 2. */ | |
666 | ||
667 | #define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)]) | |
668 | #define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)]) | |
6f29feb1 JW |
669 | |
670 | /* All references to certain hard regs, except those created | |
671 | by allocating pseudo regs into them (when that's possible), | |
672 | go through these unique rtx objects. */ | |
673 | extern rtx stack_pointer_rtx; | |
674 | extern rtx frame_pointer_rtx; | |
675 | extern rtx arg_pointer_rtx; | |
676 | extern rtx pic_offset_table_rtx; | |
677 | extern rtx struct_value_rtx; | |
678 | extern rtx struct_value_incoming_rtx; | |
679 | extern rtx static_chain_rtx; | |
680 | extern rtx static_chain_incoming_rtx; | |
681 | ||
682 | /* Virtual registers are used during RTL generation to refer to locations into | |
683 | the stack frame when the actual location isn't known until RTL generation | |
684 | is complete. The routine instantiate_virtual_regs replaces these with | |
685 | the proper value, which is normally {frame,arg,stack}_pointer_rtx plus | |
686 | a constant. */ | |
687 | ||
688 | #define FIRST_VIRTUAL_REGISTER (FIRST_PSEUDO_REGISTER) | |
689 | ||
690 | /* This points to the first word of the incoming arguments passed on the stack, | |
691 | either by the caller or by the callee when pretending it was passed by the | |
692 | caller. */ | |
693 | ||
694 | extern rtx virtual_incoming_args_rtx; | |
695 | ||
696 | #define VIRTUAL_INCOMING_ARGS_REGNUM (FIRST_VIRTUAL_REGISTER) | |
697 | ||
698 | /* If FRAME_GROWS_DOWNWARDS, this points to immediately above the first | |
699 | variable on the stack. Otherwise, it points to the first variable on | |
700 | the stack. */ | |
701 | ||
702 | extern rtx virtual_stack_vars_rtx; | |
703 | ||
704 | #define VIRTUAL_STACK_VARS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 1) | |
705 | ||
706 | /* This points to the location of dynamically-allocated memory on the stack | |
707 | immediately after the stack pointer has been adjusted by the amount | |
708 | desired. */ | |
709 | ||
710 | extern rtx virtual_stack_dynamic_rtx; | |
711 | ||
712 | #define VIRTUAL_STACK_DYNAMIC_REGNUM ((FIRST_VIRTUAL_REGISTER) + 2) | |
713 | ||
714 | /* This points to the location in the stack at which outgoing arguments should | |
715 | be written when the stack is pre-pushed (arguments pushed using push | |
716 | insns always use sp). */ | |
717 | ||
718 | extern rtx virtual_outgoing_args_rtx; | |
719 | ||
720 | #define VIRTUAL_OUTGOING_ARGS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 3) | |
721 | ||
722 | #define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 3) | |
723 | ||
724 | extern rtx find_next_ref (); | |
725 | extern rtx *find_single_use (); | |
726 | ||
727 | /* Define a default value for STORE_FLAG_VALUE. */ | |
728 | ||
729 | #ifndef STORE_FLAG_VALUE | |
730 | #define STORE_FLAG_VALUE 1 | |
731 | #endif | |
732 | ||
733 | /* Nonzero after end of reload pass. | |
734 | Set to 1 or 0 by toplev.c. */ | |
735 | ||
736 | extern int reload_completed; | |
737 | ||
738 | /* Set to 1 while reload_as_needed is operating. | |
739 | Required by some machines to handle any generated moves differently. */ | |
740 | ||
741 | extern int reload_in_progress; | |
742 | ||
743 | /* If this is nonzero, we do not bother generating VOLATILE | |
744 | around volatile memory references, and we are willing to | |
745 | output indirect addresses. If cse is to follow, we reject | |
746 | indirect addresses so a useful potential cse is generated; | |
747 | if it is used only once, instruction combination will produce | |
748 | the same indirect address eventually. */ | |
749 | extern int cse_not_expected; | |
750 | ||
751 | /* Indexed by pseudo register number, gives the rtx for that pseudo. | |
752 | Allocated in parallel with regno_pointer_flag. */ | |
753 | extern rtx *regno_reg_rtx; |