]>
Commit | Line | Data |
---|---|---|
8da1b058 RS |
1 | /* Front-end tree definitions for GNU compiler. |
2 | Copyright (C) 1989 Free Software Foundation, Inc. | |
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 | #include "machmode.h" | |
21 | ||
22 | /* codes of tree nodes */ | |
23 | ||
24 | #define DEFTREECODE(SYM, STRING, TYPE, NARGS) SYM, | |
25 | ||
26 | enum tree_code { | |
27 | #include "tree.def" | |
28 | ||
29 | LAST_AND_UNUSED_TREE_CODE /* A convienent way to get a value for | |
30 | NUM_TREE_CODE. */ | |
31 | }; | |
32 | ||
33 | #undef DEFTREECODE | |
34 | ||
35 | /* Number of tree codes. */ | |
36 | #define NUM_TREE_CODES ((int)LAST_AND_UNUSED_TREE_CODE) | |
37 | ||
38 | /* Indexed by enum tree_code, contains a character which is | |
39 | `<' for a comparison expression, `1', for a unary arithmetic | |
40 | expression, `2' for a binary arithmetic expression, `e' for | |
41 | other types of expressions, `r' for a reference, `c' for a | |
42 | constant, `d' for a decl, `t' for a type, `s' for a statement, | |
43 | and `x' for anything else (TREE_LIST, IDENTIFIER, etc). */ | |
44 | ||
45 | extern char **tree_code_type; | |
46 | #define TREE_CODE_CLASS(CODE) (*tree_code_type[(int) (CODE)]) | |
47 | ||
48 | /* Number of argument-words in each kind of tree-node. */ | |
49 | ||
50 | extern int *tree_code_length; | |
51 | ||
52 | /* Names of tree components. */ | |
53 | ||
54 | extern char **tree_code_name; | |
55 | \f | |
56 | /* Codes that identify the various built in functions | |
57 | so that expand_call can identify them quickly. */ | |
58 | ||
59 | enum built_in_function | |
60 | { | |
61 | NOT_BUILT_IN, | |
62 | BUILT_IN_ALLOCA, | |
63 | BUILT_IN_ABS, | |
64 | BUILT_IN_FABS, | |
65 | BUILT_IN_LABS, | |
66 | BUILT_IN_FFS, | |
67 | BUILT_IN_DIV, | |
68 | BUILT_IN_LDIV, | |
69 | BUILT_IN_FFLOOR, | |
70 | BUILT_IN_FCEIL, | |
71 | BUILT_IN_FMOD, | |
72 | BUILT_IN_FREM, | |
73 | BUILT_IN_MEMCPY, | |
74 | BUILT_IN_MEMCMP, | |
75 | BUILT_IN_MEMSET, | |
76 | BUILT_IN_STRCPY, | |
77 | BUILT_IN_STRCMP, | |
78 | BUILT_IN_STRLEN, | |
79 | BUILT_IN_FSQRT, | |
80 | BUILT_IN_GETEXP, | |
81 | BUILT_IN_GETMAN, | |
82 | BUILT_IN_SAVEREGS, | |
83 | BUILT_IN_CLASSIFY_TYPE, | |
84 | BUILT_IN_NEXT_ARG, | |
85 | BUILT_IN_ARGS_INFO, | |
86 | BUILT_IN_CONSTANT_P, | |
87 | BUILT_IN_FRAME_ADDRESS, | |
88 | BUILT_IN_RETURN_ADDRESS, | |
89 | BUILT_IN_CALLER_RETURN_ADDRESS, | |
90 | ||
91 | /* C++ extensions */ | |
92 | BUILT_IN_NEW, | |
93 | BUILT_IN_VEC_NEW, | |
94 | BUILT_IN_DELETE, | |
95 | BUILT_IN_VEC_DELETE | |
96 | }; | |
97 | \f | |
98 | /* The definition of tree nodes fills the next several pages. */ | |
99 | ||
100 | /* A tree node can represent a data type, a variable, an expression | |
101 | or a statement. Each node has a TREE_CODE which says what kind of | |
102 | thing it represents. Some common codes are: | |
103 | INTEGER_TYPE -- represents a type of integers. | |
104 | ARRAY_TYPE -- represents a type of pointer. | |
105 | VAR_DECL -- represents a declared variable. | |
106 | INTEGER_CST -- represents a constant integer value. | |
107 | PLUS_EXPR -- represents a sum (an expression). | |
108 | ||
109 | As for the contents of a tree node: there are some fields | |
110 | that all nodes share. Each TREE_CODE has various special-purpose | |
111 | fields as well. The fields of a node are never accessed directly, | |
112 | always through accessor macros. */ | |
113 | ||
114 | /* This type is used everywhere to refer to a tree node. */ | |
115 | ||
116 | typedef union tree_node *tree; | |
117 | ||
118 | #define NULL_TREE (tree) NULL | |
119 | ||
120 | /* Every kind of tree node starts with this structure, | |
121 | so all nodes have these fields. | |
122 | ||
123 | See the accessor macros, defined below, for documentation of the fields. */ | |
124 | ||
125 | struct tree_common | |
126 | { | |
127 | union tree_node *chain; | |
128 | union tree_node *type; | |
129 | #ifdef ONLY_INT_FIELDS | |
130 | unsigned int code : 8; | |
131 | #else | |
132 | enum tree_code code : 8; | |
133 | #endif | |
134 | ||
135 | unsigned side_effects_flag : 1; | |
136 | unsigned constant_flag : 1; | |
137 | unsigned permanent_flag : 1; | |
138 | unsigned addressable_flag : 1; | |
139 | unsigned volatile_flag : 1; | |
140 | unsigned readonly_flag : 1; | |
141 | unsigned unsigned_flag : 1; | |
142 | unsigned asm_written_flag: 1; | |
143 | ||
144 | unsigned used_flag : 1; | |
145 | unsigned raises_flag : 1; | |
146 | unsigned static_flag : 1; | |
147 | unsigned public_flag : 1; | |
148 | unsigned private_flag : 1; | |
149 | unsigned protected_flag : 1; | |
150 | ||
151 | unsigned lang_flag_0 : 1; | |
152 | unsigned lang_flag_1 : 1; | |
153 | unsigned lang_flag_2 : 1; | |
154 | unsigned lang_flag_3 : 1; | |
155 | unsigned lang_flag_4 : 1; | |
156 | unsigned lang_flag_5 : 1; | |
157 | unsigned lang_flag_6 : 1; | |
158 | /* There is room for two more flags. */ | |
159 | }; | |
160 | ||
161 | /* Define accessors for the fields that all tree nodes have | |
162 | (though some fields are not used for all kinds of nodes). */ | |
163 | ||
164 | /* The tree-code says what kind of node it is. | |
165 | Codes are defined in tree.def. */ | |
166 | #define TREE_CODE(NODE) ((enum tree_code) (NODE)->common.code) | |
167 | #define TREE_SET_CODE(NODE, VALUE) ((NODE)->common.code = (int) (VALUE)) | |
168 | ||
169 | /* In all nodes that are expressions, this is the data type of the expression. | |
170 | In POINTER_TYPE nodes, this is the type that the pointer points to. | |
171 | In ARRAY_TYPE nodes, this is the type of the elements. */ | |
172 | #define TREE_TYPE(NODE) ((NODE)->common.type) | |
173 | ||
174 | /* Nodes are chained together for many purposes. | |
175 | Types are chained together to record them for being output to the debugger | |
176 | (see the function `chain_type'). | |
177 | Decls in the same scope are chained together to record the contents | |
178 | of the scope. | |
179 | Statement nodes for successive statements used to be chained together. | |
180 | Often lists of things are represented by TREE_LIST nodes that | |
181 | are chained together. */ | |
182 | ||
183 | #define TREE_CHAIN(NODE) ((NODE)->common.chain) | |
184 | ||
185 | /* Given an expression as a tree, strip any NON_LVALUE_EXPRs and NOP_EXPRs | |
186 | that don't change the machine mode. */ | |
187 | ||
188 | #define STRIP_NOPS(EXP) \ | |
189 | while ((TREE_CODE (EXP) == NOP_EXPR \ | |
190 | || TREE_CODE (EXP) == CONVERT_EXPR \ | |
191 | || TREE_CODE (EXP) == NON_LVALUE_EXPR) \ | |
192 | && (TYPE_MODE (TREE_TYPE (EXP)) \ | |
193 | == TYPE_MODE (TREE_TYPE (TREE_OPERAND (EXP, 0))))) \ | |
194 | (EXP) = TREE_OPERAND (EXP, 0); | |
195 | \f | |
196 | /* Define many boolean fields that all tree nodes have. */ | |
197 | ||
198 | /* In VAR_DECL nodes, nonzero means address of this is needed. | |
199 | So it cannot be in a register. | |
200 | In a FUNCTION_DECL, nonzero means its address is needed. | |
201 | So it must be compiled even if it is an inline function. | |
202 | In CONSTRUCTOR nodes, it means object constructed must be in memory. | |
203 | In LABEL_DECL nodes, it means a goto for this label has been seen | |
204 | from a place outside all binding contours that restore stack levels. | |
205 | In ..._TYPE nodes, it means that objects of this type must | |
206 | be fully addressable. This means that pieces of this | |
207 | object cannot go into register parameters, for example. | |
208 | In IDENTIFIER_NODEs, this means that some extern decl for this name | |
209 | had its address taken. That matters for inline functions. */ | |
210 | #define TREE_ADDRESSABLE(NODE) ((NODE)->common.addressable_flag) | |
211 | ||
212 | /* In a VAR_DECL, nonzero means allocate static storage. | |
213 | In a FUNCTION_DECL, currently nonzero if function has been defined. | |
214 | In a CONSTRUCTOR, nonzero means allocate static storage. */ | |
215 | #define TREE_STATIC(NODE) ((NODE)->common.static_flag) | |
216 | ||
217 | /* In a CONVERT_EXPR or NOP_EXPR, this means the node was made | |
218 | implicitly and should not lead to an "unused value" warning. */ | |
219 | #define TREE_NO_UNUSED_WARNING(NODE) ((NODE)->common.static_flag) | |
220 | ||
221 | /* Nonzero for a TREE_LIST or TREE_VEC node means that the derivation | |
222 | chain is via a `virtual' declaration. */ | |
223 | #define TREE_VIA_VIRTUAL(NODE) ((NODE)->common.static_flag) | |
224 | ||
225 | /* In a VAR_DECL or FUNCTION_DECL, | |
226 | nonzero means name is to be accessible from outside this module. | |
227 | In an identifier node, nonzero means a external declaration | |
228 | accesible from outside this module was previously seen | |
229 | for this name in an inner scope. */ | |
230 | #define TREE_PUBLIC(NODE) ((NODE)->common.public_flag) | |
231 | ||
232 | /* Nonzero for TREE_LIST or TREE_VEC node means that the path to the | |
233 | base class is via a `public' declaration, which preserves public | |
234 | fields from the base class as public. */ | |
235 | #define TREE_VIA_PUBLIC(NODE) ((NODE)->common.public_flag) | |
236 | ||
237 | /* In any expression, nonzero means it has side effects or reevaluation | |
238 | of the whole expression could produce a different value. | |
239 | This is set if any subexpression is a function call, a side effect | |
240 | or a reference to a volatile variable. | |
241 | In a ..._DECL, this is set only if the declaration said `volatile'. */ | |
242 | #define TREE_SIDE_EFFECTS(NODE) ((NODE)->common.side_effects_flag) | |
243 | ||
244 | /* Nonzero means this expression is volatile in the C sense: | |
245 | its address should be of type `volatile WHATEVER *'. | |
246 | In other words, the declared item is volatile qualified. | |
247 | This is used in _DECL nodes and _REF nodes. | |
248 | ||
249 | In a ..._TYPE node, means this type is volatile-qualified. | |
250 | But use TYPE_VOLATILE instead of this macro when the node is a type, | |
251 | because eventually we may make that a different bit. | |
252 | ||
253 | If this bit is set in an expression, so is TREE_SIDE_EFFECTS. */ | |
254 | #define TREE_THIS_VOLATILE(NODE) ((NODE)->common.volatile_flag) | |
255 | ||
256 | /* In a VAR_DECL, PARM_DECL or FIELD_DECL, or any kind of ..._REF node, | |
257 | nonzero means it may not be the lhs of an assignment. | |
258 | In a ..._TYPE node, means this type is const-qualified | |
259 | (but the macro TYPE_READONLY should be used instead of this macro | |
260 | when the node is a type). */ | |
261 | #define TREE_READONLY(NODE) ((NODE)->common.readonly_flag) | |
262 | ||
263 | /* Value of expression is constant. | |
264 | Always appears in all ..._CST nodes. | |
265 | May also appear in an arithmetic expression, an ADDR_EXPR or a CONSTRUCTOR | |
266 | if the value is constant. */ | |
267 | #define TREE_CONSTANT(NODE) ((NODE)->common.constant_flag) | |
268 | ||
269 | /* Nonzero means permanent node; | |
270 | node will continue to exist for the entire compiler run. | |
271 | Otherwise it will be recycled at the end of the function. */ | |
272 | #define TREE_PERMANENT(NODE) ((NODE)->common.permanent_flag) | |
273 | ||
274 | /* In INTEGER_TYPE or ENUMERAL_TYPE nodes, means an unsigned type. | |
275 | In FIELD_DECL nodes, means an unsigned bit field. | |
276 | The same bit is used in functions as DECL_BUILT_IN_NONANSI. */ | |
277 | #define TREE_UNSIGNED(NODE) ((NODE)->common.unsigned_flag) | |
278 | ||
279 | /* Nonzero in a VAR_DECL means assembler code has been written. | |
280 | Nonzero in a FUNCTION_DECL means that the function has been compiled. | |
281 | This is interesting in an inline function, since it might not need | |
282 | to be compiled separately. | |
283 | Nonzero in a RECORD_TYPE, UNION_TYPE or ENUMERAL_TYPE | |
284 | if the sdb debugging info for the type has been written. */ | |
285 | #define TREE_ASM_WRITTEN(NODE) ((NODE)->common.asm_written_flag) | |
286 | ||
287 | /* Nonzero in a _DECL if the name is used in its scope. | |
288 | Nonzero in an expr node means inhibit warning if value is unused. | |
289 | In IDENTIFIER_NODEs, this means that some extern decl for this name | |
290 | was used. */ | |
291 | #define TREE_USED(NODE) ((NODE)->common.used_flag) | |
292 | ||
293 | /* Nonzero for a tree node whose evaluation could result | |
294 | in the raising of an exception. Not implemented yet. */ | |
295 | #define TREE_RAISES(NODE) ((NODE)->common.raises_flag) | |
296 | ||
297 | /* These are currently used in classes in C++. */ | |
298 | #define TREE_PRIVATE(NODE) ((NODE)->common.private_flag) | |
299 | #define TREE_PROTECTED(NODE) ((NODE)->common.protected_flag) | |
300 | ||
301 | #define TREE_LANG_FLAG_0(NODE) ((NODE)->common.lang_flag_0) | |
302 | #define TREE_LANG_FLAG_1(NODE) ((NODE)->common.lang_flag_1) | |
303 | #define TREE_LANG_FLAG_2(NODE) ((NODE)->common.lang_flag_2) | |
304 | #define TREE_LANG_FLAG_3(NODE) ((NODE)->common.lang_flag_3) | |
305 | #define TREE_LANG_FLAG_4(NODE) ((NODE)->common.lang_flag_4) | |
306 | #define TREE_LANG_FLAG_5(NODE) ((NODE)->common.lang_flag_5) | |
307 | #define TREE_LANG_FLAG_6(NODE) ((NODE)->common.lang_flag_6) | |
308 | \f | |
309 | /* Define additional fields and accessors for nodes representing constants. */ | |
310 | ||
311 | /* In an INTEGER_CST node. These two together make a 64 bit integer. | |
312 | If the data type is signed, the value is sign-extended to 64 bits | |
313 | even though not all of them may really be in use. | |
314 | In an unsigned constant shorter than 64 bits, the extra bits are 0. */ | |
315 | #define TREE_INT_CST_LOW(NODE) ((NODE)->int_cst.int_cst_low) | |
316 | #define TREE_INT_CST_HIGH(NODE) ((NODE)->int_cst.int_cst_high) | |
317 | ||
318 | #define INT_CST_LT(A, B) \ | |
319 | (TREE_INT_CST_HIGH (A) < TREE_INT_CST_HIGH (B) \ | |
320 | || (TREE_INT_CST_HIGH (A) == TREE_INT_CST_HIGH (B) \ | |
321 | && ((unsigned) TREE_INT_CST_LOW (A) < (unsigned) TREE_INT_CST_LOW (B)))) | |
322 | ||
323 | #define INT_CST_LT_UNSIGNED(A, B) \ | |
324 | ((unsigned) TREE_INT_CST_HIGH (A) < (unsigned) TREE_INT_CST_HIGH (B) \ | |
325 | || ((unsigned) TREE_INT_CST_HIGH (A) == (unsigned) TREE_INT_CST_HIGH (B) \ | |
326 | && ((unsigned) TREE_INT_CST_LOW (A) < (unsigned) TREE_INT_CST_LOW (B)))) | |
327 | ||
328 | struct tree_int_cst | |
329 | { | |
330 | char common[sizeof (struct tree_common)]; | |
331 | long int_cst_low; | |
332 | long int_cst_high; | |
333 | }; | |
334 | ||
335 | /* In REAL_CST, STRING_CST, COMPLEX_CST nodes, and CONSTRUCTOR nodes, | |
336 | and generally in all kinds of constants that could | |
337 | be given labels (rather than being immediate). */ | |
338 | ||
339 | #define TREE_CST_RTL(NODE) ((NODE)->real_cst.rtl) | |
340 | ||
341 | /* In a REAL_CST node. */ | |
342 | /* We can represent a real value as either a `double' or a string. | |
343 | Strings don't allow for any optimization, but they do allow | |
344 | for cross-compilation. */ | |
345 | ||
346 | #define TREE_REAL_CST(NODE) ((NODE)->real_cst.real_cst) | |
347 | ||
348 | #include "real.h" | |
349 | ||
350 | struct tree_real_cst | |
351 | { | |
352 | char common[sizeof (struct tree_common)]; | |
353 | struct rtx_def *rtl; /* acts as link to register transfer language | |
354 | (rtl) info */ | |
355 | REAL_VALUE_TYPE real_cst; | |
356 | }; | |
357 | ||
358 | /* In a STRING_CST */ | |
359 | #define TREE_STRING_LENGTH(NODE) ((NODE)->string.length) | |
360 | #define TREE_STRING_POINTER(NODE) ((NODE)->string.pointer) | |
361 | ||
362 | struct tree_string | |
363 | { | |
364 | char common[sizeof (struct tree_common)]; | |
365 | struct rtx_def *rtl; /* acts as link to register transfer language | |
366 | (rtl) info */ | |
367 | int length; | |
368 | char *pointer; | |
369 | }; | |
370 | ||
371 | /* In a COMPLEX_CST node. */ | |
372 | #define TREE_REALPART(NODE) ((NODE)->complex.real) | |
373 | #define TREE_IMAGPART(NODE) ((NODE)->complex.imag) | |
374 | ||
375 | struct tree_complex | |
376 | { | |
377 | char common[sizeof (struct tree_common)]; | |
378 | struct rtx_def *rtl; /* acts as link to register transfer language | |
379 | (rtl) info */ | |
380 | union tree_node *real; | |
381 | union tree_node *imag; | |
382 | }; | |
383 | \f | |
384 | /* Define fields and accessors for some special-purpose tree nodes. */ | |
385 | ||
386 | #define IDENTIFIER_LENGTH(NODE) ((NODE)->identifier.length) | |
387 | #define IDENTIFIER_POINTER(NODE) ((NODE)->identifier.pointer) | |
388 | #define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1(NODE) | |
389 | ||
390 | struct tree_identifier | |
391 | { | |
392 | char common[sizeof (struct tree_common)]; | |
393 | int length; | |
394 | char *pointer; | |
395 | }; | |
396 | ||
397 | /* In a TREE_LIST node. */ | |
398 | #define TREE_PURPOSE(NODE) ((NODE)->list.purpose) | |
399 | #define TREE_VALUE(NODE) ((NODE)->list.value) | |
400 | ||
401 | struct tree_list | |
402 | { | |
403 | char common[sizeof (struct tree_common)]; | |
404 | union tree_node *purpose; | |
405 | union tree_node *value; | |
406 | }; | |
407 | ||
408 | /* In a TREE_VEC node. */ | |
409 | #define TREE_VEC_LENGTH(NODE) ((NODE)->vec.length) | |
410 | #define TREE_VEC_ELT(NODE,I) ((NODE)->vec.a[I]) | |
411 | #define TREE_VEC_END(NODE) (&((NODE)->vec.a[(NODE)->vec.length])) | |
412 | ||
413 | struct tree_vec | |
414 | { | |
415 | char common[sizeof (struct tree_common)]; | |
416 | int length; | |
417 | union tree_node *a[1]; | |
418 | }; | |
419 | ||
420 | /* Define fields and accessors for some nodes that represent expressions. */ | |
421 | ||
422 | /* In a SAVE_EXPR node. */ | |
423 | #define SAVE_EXPR_CONTEXT(NODE) TREE_OPERAND(NODE, 1) | |
424 | #define SAVE_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[2]) | |
425 | ||
426 | /* In a RTL_EXPR node. */ | |
427 | #define RTL_EXPR_SEQUENCE(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[0]) | |
428 | #define RTL_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[1]) | |
429 | ||
430 | /* In a CALL_EXPR node. */ | |
431 | #define CALL_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[2]) | |
432 | ||
433 | /* In a CONSTRUCTOR node. */ | |
434 | #define CONSTRUCTOR_ELTS(NODE) TREE_OPERAND (NODE, 1) | |
435 | ||
436 | /* In a BLOCK node. */ | |
437 | #define BLOCK_VARS(NODE) ((NODE)->exp.operands[0]) | |
438 | #define BLOCK_TYPE_TAGS(NODE) ((NODE)->exp.operands[1]) | |
439 | #define BLOCK_SUBBLOCKS(NODE) ((NODE)->exp.operands[2]) | |
440 | #define BLOCK_SUPERCONTEXT(NODE) ((NODE)->exp.operands[3]) | |
441 | /* Note: when changing this, make sure to find the places | |
442 | that use chainon or nreverse. */ | |
443 | #define BLOCK_CHAIN(NODE) TREE_CHAIN (NODE) | |
444 | ||
445 | /* Nonzero means that this block is prepared to handle exceptions | |
446 | listed in the BLOCK_VARS slot. */ | |
447 | #define BLOCK_HANDLER_BLOCK(NODE) TREE_PROTECTED(NODE) | |
448 | ||
449 | /* In ordinary expression nodes. */ | |
450 | #define TREE_OPERAND(NODE, I) ((NODE)->exp.operands[I]) | |
451 | #define TREE_COMPLEXITY(NODE) ((NODE)->exp.complexity) | |
452 | ||
453 | struct tree_exp | |
454 | { | |
455 | char common[sizeof (struct tree_common)]; | |
456 | int complexity; | |
457 | union tree_node *operands[1]; | |
458 | }; | |
459 | \f | |
460 | /* Define fields and accessors for nodes representing data types. */ | |
461 | ||
462 | /* See tree.def for documentation of the use of these fields. | |
463 | Look at the documentation of the various ..._TYPE tree codes. */ | |
464 | ||
465 | #define TYPE_UID(NODE) ((NODE)->type.uid) | |
466 | #define TYPE_SIZE(NODE) ((NODE)->type.size) | |
467 | #define TYPE_MODE(NODE) ((NODE)->type.mode) | |
468 | #define TYPE_ALIGN(NODE) ((NODE)->type.align) | |
469 | #define TYPE_VALUES(NODE) ((NODE)->type.values) | |
470 | #define TYPE_DOMAIN(NODE) ((NODE)->type.values) | |
471 | #define TYPE_FIELDS(NODE) ((NODE)->type.values) | |
472 | #define TYPE_METHODS(NODE) ((NODE)->type.maxval) | |
473 | #define TYPE_VFIELD(NODE) ((NODE)->type.minval) | |
474 | #define TYPE_ARG_TYPES(NODE) ((NODE)->type.values) | |
475 | #define TYPE_METHOD_BASETYPE(NODE) ((NODE)->type.maxval) | |
476 | #define TYPE_OFFSET_BASETYPE(NODE) ((NODE)->type.maxval) | |
477 | #define TYPE_POINTER_TO(NODE) ((NODE)->type.pointer_to) | |
478 | #define TYPE_REFERENCE_TO(NODE) ((NODE)->type.reference_to) | |
479 | #define TYPE_MIN_VALUE(NODE) ((NODE)->type.minval) | |
480 | #define TYPE_MAX_VALUE(NODE) ((NODE)->type.maxval) | |
481 | #define TYPE_PRECISION(NODE) ((NODE)->type.precision) | |
482 | #define TYPE_PARSE_INFO(NODE) ((NODE)->type.parse_info) | |
483 | #define TYPE_SYMTAB_ADDRESS(NODE) ((NODE)->type.symtab_address) | |
484 | #define TYPE_NAME(NODE) ((NODE)->type.name) | |
485 | #define TYPE_NEXT_VARIANT(NODE) ((NODE)->type.next_variant) | |
486 | #define TYPE_MAIN_VARIANT(NODE) ((NODE)->type.main_variant) | |
487 | #define TYPE_BINFO(NODE) ((NODE)->type.binfo) | |
488 | #define TYPE_NONCOPIED_PARTS(NODE) ((NODE)->type.noncopied_parts) | |
489 | #define TYPE_CONTEXT(NODE) ((NODE)->type.context) | |
490 | #define TYPE_LANG_SPECIFIC(NODE) ((NODE)->type.lang_specific) | |
491 | ||
492 | #define TYPE_STUB_DECL(NODE) (TREE_CHAIN (NODE)) | |
493 | ||
494 | /* In a RECORD_TYPE or UNION_TYPE, it means the type has BLKmode | |
495 | only because it lacks the alignment requirement for its size. */ | |
496 | #define TYPE_NO_FORCE_BLK(NODE) ((NODE)->type.no_force_blk_flag) | |
497 | ||
498 | /* Nonzero in a type considered volatile as a whole. */ | |
499 | #define TYPE_VOLATILE(NODE) ((NODE)->common.volatile_flag) | |
500 | ||
501 | /* Means this type is const-qualified. */ | |
502 | #define TYPE_READONLY(NODE) ((NODE)->common.readonly_flag) | |
503 | ||
504 | #define TYPE_LANG_FLAG_0(NODE) ((NODE)->type.lang_flag_0) | |
505 | #define TYPE_LANG_FLAG_1(NODE) ((NODE)->type.lang_flag_1) | |
506 | #define TYPE_LANG_FLAG_2(NODE) ((NODE)->type.lang_flag_2) | |
507 | #define TYPE_LANG_FLAG_3(NODE) ((NODE)->type.lang_flag_3) | |
508 | #define TYPE_LANG_FLAG_4(NODE) ((NODE)->type.lang_flag_4) | |
509 | #define TYPE_LANG_FLAG_5(NODE) ((NODE)->type.lang_flag_5) | |
510 | #define TYPE_LANG_FLAG_6(NODE) ((NODE)->type.lang_flag_6) | |
511 | ||
512 | struct tree_type | |
513 | { | |
514 | char common[sizeof (struct tree_common)]; | |
515 | union tree_node *values; | |
516 | union tree_node *size; | |
517 | unsigned uid; | |
518 | ||
519 | #ifdef ONLY_INT_FIELDS | |
520 | int mode : 8; | |
521 | #else | |
522 | enum machine_mode mode : 8; | |
523 | #endif | |
524 | unsigned char align; | |
525 | unsigned char precision; | |
526 | ||
527 | unsigned no_force_blk_flag : 1; | |
528 | unsigned lang_flag_0 : 1; | |
529 | unsigned lang_flag_1 : 1; | |
530 | unsigned lang_flag_2 : 1; | |
531 | unsigned lang_flag_3 : 1; | |
532 | unsigned lang_flag_4 : 1; | |
533 | unsigned lang_flag_5 : 1; | |
534 | unsigned lang_flag_6 : 1; | |
535 | ||
536 | union tree_node *pointer_to; | |
537 | union tree_node *reference_to; | |
538 | int parse_info; | |
539 | int symtab_address; | |
540 | union tree_node *name; | |
541 | union tree_node *minval; | |
542 | union tree_node *maxval; | |
543 | union tree_node *next_variant; | |
544 | union tree_node *main_variant; | |
545 | union tree_node *binfo; | |
546 | union tree_node *noncopied_parts; | |
547 | union tree_node *context; | |
548 | /* Points to a structure whose details depend on the language in use. */ | |
549 | struct lang_type *lang_specific; | |
550 | }; | |
551 | \f | |
552 | /* Define accessor macros for information about type inheritance | |
553 | and basetypes. | |
554 | ||
555 | A "basetype" means a particular usage of a data type for inheritance | |
556 | in another type. Each such basetype usage has its own "binfo" | |
557 | object to describe it. The binfo object is a TREE_VEC node. | |
558 | ||
559 | Inheritance is represented by the binfo nodes allocated for a | |
560 | given type. For example, given types C and D, such that D is | |
561 | inherited by C, 3 binfo nodes will be allocated: one for describing | |
562 | the binfo properties of C, similarly one for D, and one for | |
563 | describing the binfo properties of D as a base type for C. | |
564 | Thus, given a pointer to class C, one can get a pointer to the binfo | |
565 | of D acting as a basetype for C by looking at C's binfo's basetypes. */ | |
566 | ||
567 | /* The actual data type node being inherited in this basetype. */ | |
568 | #define BINFO_TYPE(NODE) TREE_TYPE (NODE) | |
569 | ||
570 | /* The offset where this basetype appears in its containing type. | |
571 | BINFO_OFFSET slot holds the offset (in bytes) | |
572 | from the base of the complete object to the base of the part of the | |
573 | object that is allocated on behalf of this `type'. | |
574 | This is always 0 except when there is multiple inheritance. */ | |
575 | ||
576 | #define BINFO_OFFSET(NODE) TREE_VEC_ELT ((NODE), 1) | |
577 | #define TYPE_BINFO_OFFSET(NODE) BINFO_OFFSET (TYPE_BINFO (NODE)) | |
578 | #define BINFO_OFFSET_ZEROP(NODE) (BINFO_OFFSET (NODE) == integer_zero_node) | |
579 | ||
580 | /* The virtual function table belonging to this basetype. Virtual | |
581 | function tables provide a mechanism for run-time method dispatching. | |
582 | The entries of a virtual function table are language-dependent. */ | |
583 | ||
584 | #define BINFO_VTABLE(NODE) TREE_VEC_ELT ((NODE), 2) | |
585 | #define TYPE_BINFO_VTABLE(NODE) BINFO_VTABLE (TYPE_BINFO (NODE)) | |
586 | ||
587 | /* The virtual functions in the virtual function table. This is | |
588 | a TREE_LIST that is used as an initial approximation for building | |
589 | a virtual function table for this basetype. */ | |
590 | #define BINFO_VIRTUALS(NODE) TREE_VEC_ELT ((NODE), 3) | |
591 | #define TYPE_BINFO_VIRTUALS(NODE) BINFO_VIRTUALS (TYPE_BINFO (NODE)) | |
592 | ||
593 | /* A vector of additional binfos for the types inherited by this basetype. | |
594 | ||
595 | If this basetype describes type D as inherited in C, | |
596 | and if the basetypes of D are E anf F, | |
597 | then this vector contains binfos for inheritance of E and F by C. | |
598 | ||
599 | ??? This could probably be done by just allocating the | |
600 | base types at the end of this TREE_VEC (instead of using | |
601 | another TREE_VEC). This would simplify the calculation | |
602 | of how many basetypes a given type had. */ | |
603 | #define BINFO_BASETYPES(NODE) TREE_VEC_ELT ((NODE), 4) | |
604 | #define TYPE_BINFO_BASETYPES(NODE) TREE_VEC_ELT (TYPE_BINFO (NODE), 4) | |
605 | ||
606 | /* Accessor macro to get to the Nth basetype of this basetype. */ | |
607 | #define BINFO_BASETYPE(NODE,N) TREE_VEC_ELT (BINFO_BASETYPES (NODE), (N)) | |
608 | #define TYPE_BINFO_BASETYPE(NODE,N) BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (NODE)), (N))) | |
609 | ||
610 | /* Slot used to build a chain that represents a use of inheritance. | |
611 | For example, if X is derived from Y, and Y is derived from Z, | |
612 | then this field can be used to link the binfo node for X to | |
613 | the binfo node for X's Y to represent the use of inheritance | |
614 | from X to Y. Similarly, this slot of the binfo node for X's Y | |
615 | can point to the Z from which Y is inherited (in X's inheritance | |
616 | hierarchy). In this fashion, one can represent and traverse specific | |
617 | uses of inheritance using the binfo nodes themselves (instead of | |
618 | consing new space pointing to binfo nodes). | |
619 | It is up to the language-dependent front-ends to maintain | |
620 | this information as necessary. */ | |
621 | #define BINFO_INHERITANCE_CHAIN(NODE) TREE_VEC_ELT ((NODE), 0) | |
622 | \f | |
623 | /* Define fields and accessors for nodes representing declared names. */ | |
624 | ||
625 | /* This is the name of the object as written by the user. | |
626 | It is an IDENTIFIER_NODE. */ | |
627 | #define DECL_NAME(NODE) ((NODE)->decl.name) | |
628 | /* This macro is marked for death. */ | |
629 | #define DECL_PRINT_NAME(NODE) ((NODE)->decl.print_name) | |
630 | /* This is the name of the object as the assembler will see it | |
631 | (but before any translations made by ASM_OUTPUT_LABELREF). | |
632 | Often this is the same as DECL_NAME. | |
633 | It is an IDENTIFIER_NODE. */ | |
634 | #define DECL_ASSEMBLER_NAME(NODE) ((NODE)->decl.assembler_name) | |
635 | /* The containing binding context; either a BINDING | |
636 | or a RECORD_TYPE or UNION_TYPE. */ | |
637 | #define DECL_CONTEXT(NODE) ((NODE)->decl.context) | |
638 | #define DECL_FIELD_CONTEXT(NODE) ((NODE)->decl.context) | |
639 | /* In a FIELD_DECL, this is the field position, counting in bits, | |
640 | of the bit closest to the beginning of the structure. */ | |
641 | #define DECL_FIELD_BITPOS(NODE) ((NODE)->decl.arguments) | |
642 | /* In a FIELD_DECL, this indicates whether the field was a bit-field and | |
643 | if so, its type. */ | |
644 | #define DECL_BIT_FIELD_TYPE(NODE) ((NODE)->decl.result) | |
645 | /* In FUNCTION_DECL, a chain of ..._DECL nodes. */ | |
646 | /* VAR_DECL and PARM_DECL reserve the arguments slot | |
647 | for language-specific uses. */ | |
648 | #define DECL_ARGUMENTS(NODE) ((NODE)->decl.arguments) | |
649 | /* In FUNCTION_DECL, holds the decl for the return value. */ | |
650 | #define DECL_RESULT(NODE) ((NODE)->decl.result) | |
651 | /* In PARM_DECL, holds the type as written (perhaps a function or array). */ | |
652 | #define DECL_ARG_TYPE_AS_WRITTEN(NODE) ((NODE)->decl.result) | |
653 | /* For a FUNCTION_DECL, holds the tree of BINDINGs. | |
654 | For a VAR_DECL, holds the initial value. | |
655 | For a PARM_DECL, not used--default | |
656 | values for parameters are encoded in the type of the function, | |
657 | not in the PARM_DECL slot. */ | |
658 | #define DECL_INITIAL(NODE) ((NODE)->decl.initial) | |
659 | /* For a PARM_DECL, records the data type used to pass the argument, | |
660 | which may be different from the type seen in the program. */ | |
661 | #define DECL_ARG_TYPE(NODE) ((NODE)->decl.initial) /* In PARM_DECL. */ | |
662 | /* These two fields describe where in the source code the declaration was. */ | |
663 | #define DECL_SOURCE_FILE(NODE) ((NODE)->decl.filename) | |
664 | #define DECL_SOURCE_LINE(NODE) ((NODE)->decl.linenum) | |
665 | /* Holds the size of the datum, as a tree expression. | |
666 | Need not be constant. */ | |
667 | #define DECL_SIZE(NODE) ((NODE)->decl.size) | |
668 | /* Holds the alignment required for the datum. */ | |
669 | #define DECL_ALIGN(NODE) ((NODE)->decl.align) | |
670 | /* Holds the machine mode of a variable or field. */ | |
671 | #define DECL_MODE(NODE) ((NODE)->decl.mode) | |
672 | /* Holds the RTL expression for the value of a variable or function. */ | |
673 | #define DECL_RTL(NODE) ((NODE)->decl.rtl) | |
674 | /* For PARM_DECL, holds an RTL for the stack slot or register | |
675 | where the data was actually passed. */ | |
676 | #define DECL_INCOMING_RTL(NODE) ((NODE)->decl.saved_insns) | |
677 | /* For FUNCTION_DECL, if it is inline, holds the saved insn chain. */ | |
678 | #define DECL_SAVED_INSNS(NODE) ((NODE)->decl.saved_insns) | |
679 | /* For FUNCTION_DECL for built-in function. */ | |
680 | #define DECL_FUNCTION_CODE(NODE) \ | |
681 | ((enum built_in_function) (NODE)->decl.frame_size) | |
682 | #define DECL_SET_FUNCTION_CODE(NODE,VAL) \ | |
683 | ((NODE)->decl.frame_size = (int) (VAL)) | |
684 | /* For FUNCTION_DECL, if it is inline, | |
685 | holds the size of the stack frame, as an integer. */ | |
686 | #define DECL_FRAME_SIZE(NODE) ((NODE)->decl.frame_size) | |
687 | ||
688 | /* The DECL_VINDEX is used for FUNCTION_DECLS in two different ways. | |
689 | Before the struct containing the FUNCTION_DECL is laid out, | |
690 | DECL_VINDEX may point to a FUNCTION_DECL in a base class which | |
691 | is the FUNCTION_DECL which this FUNCTION_DECL will replace as a virtual | |
692 | function. When the class is laid out, this pointer is changed | |
693 | to an INTEGER_CST node which is suitable for use as an index | |
694 | into the virtual function table. */ | |
695 | #define DECL_VINDEX(NODE) ((NODE)->decl.vindex) | |
696 | /* For FIELD_DECLS, DECL_FCONTEXT is the *first* baseclass in | |
697 | which this FIELD_DECL is defined. This information is needed when | |
698 | writing debugging information about vfield and vbase decls for C++. */ | |
699 | #define DECL_FCONTEXT(NODE) ((NODE)->decl.vindex) | |
700 | ||
701 | /* Nonzero in a VAR_DECL or PARM_DECL means this decl was made by inlining; | |
702 | suppress any warnings about shadowing some other variable. */ | |
703 | #define DECL_FROM_INLINE(NODE) ((NODE)->decl.from_inline_flag) | |
704 | ||
705 | /* Nonzero if a _DECL means that the name of this decl should be ignored | |
706 | for symbolic debug purposes. */ | |
707 | #define DECL_IGNORED_P(NODE) ((NODE)->decl.ignored_flag) | |
708 | ||
709 | #define DECL_LANG_SPECIFIC(NODE) ((NODE)->decl.lang_specific) | |
710 | ||
711 | /* In a VAR_DECL or FUNCTION_DECL, | |
712 | nonzero means external reference: | |
713 | do not allocate storage, and refer to a definition elsewhere. */ | |
714 | #define TREE_EXTERNAL(NODE) ((NODE)->decl.external_flag) | |
715 | ||
716 | /* In VAR_DECL and PARM_DECL nodes, nonzero means declared `register'. | |
717 | In LABEL_DECL nodes, nonzero means that an error message about | |
718 | jumping into such a binding contour has been printed for this label. */ | |
719 | #define TREE_REGDECL(NODE) ((NODE)->decl.regdecl_flag) | |
720 | ||
721 | /* Nonzero in a ..._DECL means this variable is ref'd from a nested function. | |
722 | For VAR_DECL nodes, PARM_DECL nodes, and FUNCTION_DECL nodes. | |
723 | ||
724 | For LABEL_DECL nodes, nonzero if nonlocal gotos to the label are permitted. | |
725 | ||
726 | Also set in some languages for variables, etc., outside the normal | |
727 | lexical scope, such as class instance variables. */ | |
728 | #define TREE_NONLOCAL(NODE) ((NODE)->decl.nonlocal_flag) | |
729 | ||
730 | /* Nonzero in a FUNCTION_DECL means this function can be substituted | |
731 | where it is called. */ | |
732 | #define TREE_INLINE(NODE) ((NODE)->decl.inline_flag) | |
733 | ||
734 | /* Nonzero in a FUNCTION_DECL means this is a built-in function | |
735 | that is not specified by ansi C and that users are supposed to be allowed | |
736 | to redefine for any purpose whatever. */ | |
737 | #define DECL_BUILT_IN_NONANSI(NODE) ((NODE)->common.unsigned_flag) | |
738 | ||
739 | /* Nonzero in a FIELD_DECL means it is a bit field, and must be accessed | |
740 | specially. */ | |
741 | #define DECL_BIT_FIELD(NODE) ((NODE)->decl.bit_field_flag) | |
742 | /* In a LABEL_DECL, nonzero means label was defined inside a binding | |
743 | contour that restored a stack level and which is now exited. */ | |
744 | #define DECL_TOO_LATE(NODE) ((NODE)->decl.bit_field_flag) | |
745 | /* In a FUNCTION_DECL, nonzero means a built in function. */ | |
746 | #define DECL_BUILT_IN(NODE) ((NODE)->decl.bit_field_flag) | |
747 | ||
748 | /* In a METHOD_DECL, indicates a function for which each instance has a pointer. */ | |
749 | #define DECL_VIRTUAL_P(NODE) ((NODE)->decl.virtual_flag) | |
750 | /* In a FIELD_DECL, indicates this field should be bit-packed. */ | |
751 | #define DECL_PACKED(NODE) ((NODE)->decl.virtual_flag) | |
752 | ||
753 | /* Additional flags for language-specific uses. */ | |
754 | #define DECL_LANG_FLAG_0(NODE) ((NODE)->decl.lang_flag_0) | |
755 | #define DECL_LANG_FLAG_1(NODE) ((NODE)->decl.lang_flag_1) | |
756 | #define DECL_LANG_FLAG_2(NODE) ((NODE)->decl.lang_flag_2) | |
757 | #define DECL_LANG_FLAG_3(NODE) ((NODE)->decl.lang_flag_3) | |
758 | #define DECL_LANG_FLAG_4(NODE) ((NODE)->decl.lang_flag_4) | |
759 | #define DECL_LANG_FLAG_5(NODE) ((NODE)->decl.lang_flag_5) | |
760 | #define DECL_LANG_FLAG_6(NODE) ((NODE)->decl.lang_flag_6) | |
761 | #define DECL_LANG_FLAG_7(NODE) ((NODE)->decl.lang_flag_7) | |
762 | ||
763 | struct tree_decl | |
764 | { | |
765 | char common[sizeof (struct tree_common)]; | |
766 | char *filename; | |
767 | int linenum; | |
768 | union tree_node *size; | |
769 | #ifdef ONLY_INT_FIELDS | |
770 | int mode : 8; | |
771 | #else | |
772 | enum machine_mode mode : 8; | |
773 | #endif | |
774 | unsigned char align; | |
775 | ||
776 | unsigned external_flag : 1; | |
777 | unsigned nonlocal_flag : 1; | |
778 | unsigned regdecl_flag : 1; | |
779 | unsigned inline_flag : 1; | |
780 | unsigned bit_field_flag : 1; | |
781 | unsigned virtual_flag : 1; | |
782 | unsigned from_inline_flag : 1; | |
783 | unsigned ignored_flag : 1; | |
784 | ||
785 | unsigned lang_flag_0 : 1; | |
786 | unsigned lang_flag_1 : 1; | |
787 | unsigned lang_flag_2 : 1; | |
788 | unsigned lang_flag_3 : 1; | |
789 | unsigned lang_flag_4 : 1; | |
790 | unsigned lang_flag_5 : 1; | |
791 | unsigned lang_flag_6 : 1; | |
792 | unsigned lang_flag_7 : 1; | |
793 | ||
794 | union tree_node *name; | |
795 | union tree_node *context; | |
796 | union tree_node *arguments; | |
797 | union tree_node *result; | |
798 | union tree_node *initial; | |
799 | /* The PRINT_NAME field is marked for death. */ | |
800 | char *print_name; | |
801 | union tree_node *assembler_name; | |
802 | struct rtx_def *rtl; /* acts as link to register transfer language | |
803 | (rtl) info */ | |
804 | int frame_size; /* For FUNCTION_DECLs: size of stack frame */ | |
805 | struct rtx_def *saved_insns; /* For FUNCTION_DECLs: points to insn that | |
806 | constitutes its definition on the | |
807 | permanent obstack. */ | |
808 | union tree_node *vindex; | |
809 | /* Points to a structure whose details depend on the language in use. */ | |
810 | struct lang_decl *lang_specific; | |
811 | }; | |
812 | \f | |
813 | /* Define the overall contents of a tree node. | |
814 | It may be any of the structures declared above | |
815 | for various types of node. */ | |
816 | ||
817 | union tree_node | |
818 | { | |
819 | struct tree_common common; | |
820 | struct tree_int_cst int_cst; | |
821 | struct tree_real_cst real_cst; | |
822 | struct tree_string string; | |
823 | struct tree_complex complex; | |
824 | struct tree_identifier identifier; | |
825 | struct tree_decl decl; | |
826 | struct tree_type type; | |
827 | struct tree_list list; | |
828 | struct tree_vec vec; | |
829 | struct tree_exp exp; | |
830 | }; | |
831 | ||
832 | /* Format for global names of constructor and destructor functions. */ | |
833 | #ifndef NO_DOLLAR_IN_LABEL | |
834 | #define CONSTRUCTOR_NAME_FORMAT "_GLOBAL_$I$%s" | |
835 | #else | |
836 | #define CONSTRUCTOR_NAME_FORMAT "_GLOBAL_.I.%s" | |
837 | #endif | |
838 | \f | |
839 | extern char *oballoc (); | |
840 | extern char *permalloc (); | |
841 | extern char *savealloc (); | |
842 | ||
843 | /* Lowest level primitive for allocating a node. | |
844 | The TREE_CODE is the only argument. Contents are initialized | |
845 | to zero except for a few of the common fields. */ | |
846 | ||
847 | extern tree make_node (); | |
848 | ||
849 | /* Make a copy of a node, with all the same contents except | |
850 | for TREE_PERMANENT. (The copy is permanent | |
851 | iff nodes being made now are permanent.) */ | |
852 | ||
853 | extern tree copy_node (); | |
854 | ||
855 | /* Make a copy of a chain of TREE_LIST nodes. */ | |
856 | ||
857 | extern tree copy_list (); | |
858 | ||
859 | /* Make a TREE_VEC. */ | |
860 | ||
861 | extern tree make_tree_vec (); | |
862 | ||
863 | /* Return the (unique) IDENTIFIER_NODE node for a given name. | |
864 | The name is supplied as a char *. */ | |
865 | ||
866 | extern tree get_identifier (); | |
867 | ||
868 | /* Construct various types of nodes. */ | |
869 | ||
870 | extern tree build_int_2 (); | |
871 | extern tree build_real (); | |
872 | extern tree build_real_from_string (); | |
873 | extern tree build_real_from_int_cst (); | |
874 | extern tree build_complex (); | |
875 | extern tree build_string (); | |
876 | extern tree build (), build1 (); | |
877 | extern tree build_nt (), build_parse_node (); | |
878 | extern tree build_tree_list (), build_decl_list (); | |
879 | extern tree build_op_identifier (); | |
880 | extern tree build_decl (); | |
881 | extern tree build_block (); | |
882 | ||
883 | /* Construct various nodes representing data types. */ | |
884 | ||
885 | extern tree make_signed_type (); | |
886 | extern tree make_unsigned_type (); | |
887 | extern tree signed_or_unsigned_type (); | |
888 | extern void fixup_unsigned_type (); | |
889 | extern tree build_pointer_type (); | |
890 | extern tree build_reference_type (); | |
891 | extern tree build_index_type (), build_index_2_type (); | |
892 | extern tree build_array_type (); | |
893 | extern tree build_function_type (); | |
894 | extern tree build_method_type (); | |
895 | extern tree build_offset_type (); | |
896 | extern tree build_complex_type (); | |
897 | extern tree array_type_nelts (); | |
898 | ||
899 | /* Construct expressions, performing type checking. */ | |
900 | ||
901 | extern tree build_binary_op (); | |
902 | extern tree build_indirect_ref (); | |
903 | extern tree build_unary_op (); | |
904 | \f | |
905 | /* Given a type node TYPE, and CONSTP and VOLATILEP, return a type | |
906 | for the same kind of data as TYPE describes. | |
907 | Variants point to the "main variant" (which has neither CONST nor VOLATILE) | |
908 | via TYPE_MAIN_VARIANT, and it points to a chain of other variants | |
909 | so that duplicate variants are never made. | |
910 | Only main variants should ever appear as types of expressions. */ | |
911 | ||
912 | extern tree build_type_variant (); | |
913 | ||
914 | /* Return the mode for data of a given size SIZE and mode class CLASS. | |
915 | If LIMIT is nonzero, then don't use modes bigger than MAX_FIXED_MODE_SIZE. | |
916 | The value is BLKmode if no other mode is found. */ | |
917 | ||
918 | extern enum machine_mode mode_for_size (); | |
919 | ||
920 | /* Given a ..._TYPE node, calculate the TYPE_SIZE, TYPE_SIZE_UNIT, | |
921 | TYPE_ALIGN and TYPE_MODE fields. | |
922 | If called more than once on one node, does nothing except | |
923 | for the first time. */ | |
924 | ||
925 | extern void layout_type (); | |
926 | ||
927 | /* Given a hashcode and a ..._TYPE node (for which the hashcode was made), | |
928 | return a canonicalized ..._TYPE node, so that duplicates are not made. | |
929 | How the hash code is computed is up to the caller, as long as any two | |
930 | callers that could hash identical-looking type nodes agree. */ | |
931 | ||
932 | extern tree type_hash_canon (); | |
933 | ||
934 | /* Given a VAR_DECL, PARM_DECL, RESULT_DECL or FIELD_DECL node, | |
935 | calculates the DECL_SIZE, DECL_SIZE_UNIT, DECL_ALIGN and DECL_MODE | |
936 | fields. Call this only once for any given decl node. | |
937 | ||
938 | Second argument is the boundary that this field can be assumed to | |
939 | be starting at (in bits). Zero means it can be assumed aligned | |
940 | on any boundary that may be needed. */ | |
941 | ||
942 | extern void layout_decl (); | |
943 | ||
944 | /* Fold constants as much as possible in an expression. | |
945 | Returns the simplified expression. | |
946 | Acts only on the top level of the expression; | |
947 | if the argument itself cannot be simplified, its | |
948 | subexpressions are not changed. */ | |
949 | ||
950 | extern tree fold (); | |
951 | ||
952 | /* Return an expr equal to X but certainly not valid as an lvalue. */ | |
953 | ||
954 | extern tree non_lvalue (); | |
955 | ||
956 | extern tree convert (); | |
957 | extern tree size_in_bytes (); | |
958 | extern tree size_binop (); | |
959 | extern tree size_int (); | |
960 | extern tree round_up (); | |
961 | extern tree get_pending_sizes (); | |
962 | extern tree get_permanent_types (), get_temporary_types (); | |
963 | ||
964 | /* Type for sizes of data-type. */ | |
965 | ||
966 | extern tree sizetype; | |
967 | ||
968 | /* Concatenate two lists (chains of TREE_LIST nodes) X and Y | |
969 | by making the last node in X point to Y. | |
970 | Returns X, except if X is 0 returns Y. */ | |
971 | ||
972 | extern tree chainon (); | |
973 | ||
974 | /* Make a new TREE_LIST node from specified PURPOSE, VALUE and CHAIN. */ | |
975 | ||
976 | extern tree tree_cons (), perm_tree_cons (), temp_tree_cons (); | |
977 | extern tree saveable_tree_cons (), decl_tree_cons (); | |
978 | ||
979 | /* Return the last tree node in a chain. */ | |
980 | ||
981 | extern tree tree_last (); | |
982 | ||
983 | /* Reverse the order of elements in a chain, and return the new head. */ | |
984 | ||
985 | extern tree nreverse (); | |
986 | ||
987 | /* Make a copy of a chain of tree nodes. */ | |
988 | ||
989 | extern tree copy_chain (); | |
990 | ||
991 | /* Returns the length of a chain of nodes | |
992 | (number of chain pointers to follow before reaching a null pointer). */ | |
993 | ||
994 | extern int list_length (); | |
995 | ||
996 | /* integer_zerop (tree x) is nonzero if X is an integer constant of value 0 */ | |
997 | ||
998 | extern int integer_zerop (); | |
999 | ||
1000 | /* integer_onep (tree x) is nonzero if X is an integer constant of value 1 */ | |
1001 | ||
1002 | extern int integer_onep (); | |
1003 | ||
1004 | /* integer_all_onesp (tree x) is nonzero if X is an integer constant | |
1005 | all of whose significant bits are 1. */ | |
1006 | ||
1007 | extern int integer_all_onesp (); | |
1008 | ||
1009 | /* integer_pow2p (tree x) is nonzero is X is an integer constant with | |
1010 | exactly one bit 1. */ | |
1011 | ||
1012 | extern int integer_pow2p (); | |
1013 | ||
1014 | /* type_unsigned_p (tree x) is nonzero if the type X is an unsigned type | |
1015 | (all of its possible values are >= 0). | |
1016 | If X is a pointer type, the value is 1. | |
1017 | If X is a real type, the value is 0. */ | |
1018 | ||
1019 | extern int type_unsigned_p (); | |
1020 | ||
1021 | /* staticp (tree x) is nonzero if X is a reference to data allocated | |
1022 | at a fixed address in memory. */ | |
1023 | ||
1024 | extern int staticp (); | |
1025 | ||
1026 | /* Gets an error if argument X is not an lvalue. | |
1027 | Also returns 1 if X is an lvalue, 0 if not. */ | |
1028 | ||
1029 | extern int lvalue_or_else (); | |
1030 | ||
1031 | /* save_expr (EXP) returns an expression equivalent to EXP | |
1032 | but it can be used multiple times within context CTX | |
1033 | and only evaluate EXP once. */ | |
1034 | ||
1035 | extern tree save_expr (); | |
1036 | ||
1037 | /* stabilize_reference (EXP) returns an reference equivalent to EXP | |
1038 | but it can be used multiple times | |
1039 | and only evaluate the subexpressions once. */ | |
1040 | ||
1041 | extern tree stabilize_reference (); | |
1042 | ||
1043 | /* Return EXP, stripped of any conversions to wider types | |
1044 | in such a way that the result of converting to type FOR_TYPE | |
1045 | is the same as if EXP were converted to FOR_TYPE. | |
1046 | If FOR_TYPE is 0, it signifies EXP's type. */ | |
1047 | ||
1048 | extern tree get_unwidened (); | |
1049 | ||
1050 | /* Return OP or a simpler expression for a narrower value | |
1051 | which can be sign-extended or zero-extended to give back OP. | |
1052 | Store in *UNSIGNEDP_PTR either 1 if the value should be zero-extended | |
1053 | or 0 if the value should be sign-extended. */ | |
1054 | ||
1055 | extern tree get_narrower (); | |
1056 | ||
1057 | /* Given MODE and UNSIGNEDP, return a suitable type-tree | |
1058 | with that mode. | |
1059 | The definition of this resides in language-specific code | |
1060 | as the repertoire of available types may vary. */ | |
1061 | ||
1062 | extern tree type_for_mode (); | |
1063 | ||
1064 | /* Given PRECISION and UNSIGNEDP, return a suitable type-tree | |
1065 | for an integer type with at least that precision. | |
1066 | The definition of this resides in language-specific code | |
1067 | as the repertoire of available types may vary. */ | |
1068 | ||
1069 | extern tree type_for_size (); | |
1070 | ||
1071 | /* Given an integer type T, return a type like T but unsigned. | |
1072 | If T is unsigned, the value is T. | |
1073 | The definition of this resides in language-specific code | |
1074 | as the repertoire of available types may vary. */ | |
1075 | ||
1076 | extern tree unsigned_type (); | |
1077 | ||
1078 | /* Given an integer type T, return a type like T but signed. | |
1079 | If T is signed, the value is T. | |
1080 | The definition of this resides in language-specific code | |
1081 | as the repertoire of available types may vary. */ | |
1082 | ||
1083 | extern tree signed_type (); | |
1084 | ||
1085 | /* This function must be defined in the language-specific files. | |
1086 | expand_expr calls it to build the cleanup-expression for a TARGET_EXPR. | |
1087 | This is defined in a language-specific file. */ | |
1088 | ||
1089 | extern tree maybe_build_cleanup (); | |
1090 | ||
1091 | /* Return the floating type node for a given floating machine mode. */ | |
1092 | ||
1093 | extern tree get_floating_type (); | |
1094 | ||
1095 | /* Given an expression EXP that may be a COMPONENT_REF or an ARRAY_REF, | |
1096 | look for nested component-refs or array-refs at constant positions | |
1097 | and find the ultimate containing object, which is returned. */ | |
1098 | ||
1099 | extern tree get_inner_reference (); | |
1100 | ||
1101 | /* Return the FUNCTION_DECL which provides this _DECL with its context, | |
1102 | or zero if none. */ | |
1103 | extern tree decl_function_context (); | |
1104 | ||
1105 | /* Return the RECORD_TYPE or UNION_TYPE which provides this _DECL | |
1106 | with its context, or zero if none. */ | |
1107 | extern tree decl_type_context (); | |
1108 | ||
1109 | /* Given the FUNCTION_DECL for the current function, | |
1110 | return zero if it is ok for this function to be inline. | |
1111 | Otherwise return a warning message with a single %s | |
1112 | for the function's name. */ | |
1113 | ||
1114 | extern char *function_cannot_inline_p (); | |
1115 | \f | |
1116 | /* Declare commonly used variables for tree structure. */ | |
1117 | ||
1118 | /* An integer constant with value 0 */ | |
1119 | extern tree integer_zero_node; | |
1120 | ||
1121 | /* An integer constant with value 1 */ | |
1122 | extern tree integer_one_node; | |
1123 | ||
1124 | /* An integer constant with value 0 whose type is sizetype. */ | |
1125 | extern tree size_zero_node; | |
1126 | ||
1127 | /* An integer constant with value 1 whose type is sizetype. */ | |
1128 | extern tree size_one_node; | |
1129 | ||
1130 | /* A constant of type pointer-to-int and value 0 */ | |
1131 | extern tree null_pointer_node; | |
1132 | ||
1133 | /* A node of type ERROR_MARK. */ | |
1134 | extern tree error_mark_node; | |
1135 | ||
1136 | /* The type node for the void type. */ | |
1137 | extern tree void_type_node; | |
1138 | ||
1139 | /* The type node for the ordinary (signed) integer type. */ | |
1140 | extern tree integer_type_node; | |
1141 | ||
1142 | /* The type node for the unsigned integer type. */ | |
1143 | extern tree unsigned_type_node; | |
1144 | ||
1145 | /* The type node for the ordinary character type. */ | |
1146 | extern tree char_type_node; | |
1147 | ||
1148 | /* Points to the name of the input file from which the current input | |
1149 | being parsed originally came (before it went into cpp). */ | |
1150 | extern char *input_filename; | |
1151 | ||
1152 | /* Current line number in input file. */ | |
1153 | extern int lineno; | |
1154 | ||
1155 | /* Nonzero for -pedantic switch: warn about anything | |
1156 | that standard C forbids. */ | |
1157 | extern int pedantic; | |
1158 | ||
1159 | /* Nonzero means can safely call expand_expr now; | |
1160 | otherwise layout_type puts variable sizes onto `pending_sizes' instead. */ | |
1161 | ||
1162 | extern int immediate_size_expand; | |
1163 | ||
1164 | /* Points to the FUNCTION_DECL of the function whose body we are reading. */ | |
1165 | ||
1166 | extern tree current_function_decl; | |
1167 | ||
1168 | /* Nonzero if function being compiled can call setjmp. */ | |
1169 | ||
1170 | extern int current_function_calls_setjmp; | |
1171 | ||
1172 | /* Nonzero if function being compiled can call longjmp. */ | |
1173 | ||
1174 | extern int current_function_calls_longjmp; | |
1175 | ||
1176 | /* Nonzero means all ..._TYPE nodes should be allocated permanently. */ | |
1177 | ||
1178 | extern int all_types_permanent; | |
1179 | ||
1180 | /* Pointer to function to compute the name to use to print a declaration. */ | |
1181 | ||
1182 | extern char *(*decl_printable_name) (); | |
1183 | \f | |
1184 | /* In expmed.c */ | |
1185 | extern tree make_tree (); | |
1186 | ||
1187 | /* In stmt.c */ | |
1188 | ||
1189 | extern tree expand_start_stmt_expr (); | |
1190 | extern tree expand_end_stmt_expr (); | |
1191 | extern void expand_expr_stmt (), clear_last_expr (); | |
1192 | extern void expand_label (), expand_goto (), expand_asm (); | |
1193 | extern void expand_start_cond (), expand_end_cond (); | |
1194 | extern void expand_start_else (), expand_start_elseif (); | |
1195 | extern struct nesting *expand_start_loop (); | |
1196 | extern struct nesting *expand_start_loop_continue_elsewhere (); | |
1197 | extern void expand_loop_continue_here (); | |
1198 | extern void expand_end_loop (); | |
1199 | extern int expand_continue_loop (); | |
1200 | extern int expand_exit_loop (), expand_exit_loop_if_false (); | |
1201 | extern int expand_exit_something (); | |
1202 | ||
1203 | extern void expand_start_delayed_expr (); | |
1204 | extern tree expand_end_delayed_expr (); | |
1205 | extern void expand_emit_delayed_expr (); | |
1206 | ||
1207 | extern void expand_null_return (), expand_return (); | |
1208 | extern void expand_start_bindings (), expand_end_bindings (); | |
1209 | extern tree last_cleanup_this_contour (); | |
1210 | extern void expand_start_case (), expand_end_case (); | |
1211 | extern int pushcase (), pushcase_range (); | |
1212 | extern void expand_start_function (), expand_end_function (); | |
1213 | ||
1214 | /* In fold-const.c */ | |
1215 | ||
1216 | extern tree invert_truthvalue (); | |
1217 | \f | |
1218 | /* The language front-end must define these functions. */ | |
1219 | ||
1220 | /* Function of no arguments for initializing lexical scanning. */ | |
1221 | extern void init_lex (); | |
1222 | /* Function of no arguments for initializing the symbol table. */ | |
1223 | extern void init_decl_processing (); | |
1224 | ||
1225 | /* Functions called with no arguments at the beginning and end or processing | |
1226 | the input source file. */ | |
1227 | extern void lang_init (); | |
1228 | extern void lang_finish (); | |
1229 | ||
1230 | /* Function called with no arguments to parse and compile the input. */ | |
1231 | extern int yyparse (); | |
1232 | /* Function called with option as argument | |
1233 | to decode options starting with -f or -W or +. | |
1234 | It should return nonzero if it handles the option. */ | |
1235 | extern int lang_decode_option (); | |
1236 | ||
1237 | /* Functions for processing symbol declarations. */ | |
1238 | /* Function to enter a new lexical scope. | |
1239 | Takes one argument: always zero when called from outside the front end. */ | |
1240 | extern void pushlevel (); | |
1241 | /* Function to exit a lexical scope. It returns a BINDING for that scope. | |
1242 | Takes three arguments: | |
1243 | KEEP -- nonzero if there were declarations in this scope. | |
1244 | REVERSE -- reverse the order of decls before returning them. | |
1245 | FUNCTIONBODY -- nonzero if this level is the body of a function. */ | |
1246 | extern tree poplevel (); | |
1247 | /* Function to add a decl to the current scope level. | |
1248 | Takes one argument, a decl to add. | |
1249 | Returns that decl, or, if the same symbol is already declared, may | |
1250 | return a different decl for that name. */ | |
1251 | extern tree pushdecl (); | |
1252 | /* Function to return the chain of decls so far in the current scope level. */ | |
1253 | extern tree getdecls (); | |
1254 | /* Function to return the chain of structure tags in the current scope level. */ | |
1255 | extern tree gettags (); |