1 /* Front-end tree definitions for GNU compiler.
2 Copyright (C) 1989 Free Software Foundation, Inc.
4 This file is part of GNU CC.
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)
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.
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. */
22 /* codes of tree nodes */
24 #define DEFTREECODE(SYM, STRING, TYPE, NARGS) SYM,
29 LAST_AND_UNUSED_TREE_CODE /* A convenient way to get a value for
35 /* Number of tree codes. */
36 #define NUM_TREE_CODES ((int)LAST_AND_UNUSED_TREE_CODE)
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). */
45 extern char **tree_code_type;
46 #define TREE_CODE_CLASS(CODE) (*tree_code_type[(int) (CODE)])
48 /* Number of argument-words in each kind of tree-node. */
50 extern int *tree_code_length;
52 /* Names of tree components. */
54 extern char **tree_code_name;
56 /* Codes that identify the various built in functions
57 so that expand_call can identify them quickly. */
59 enum built_in_function
85 BUILT_IN_CLASSIFY_TYPE,
89 BUILT_IN_FRAME_ADDRESS,
90 BUILT_IN_RETURN_ADDRESS,
91 BUILT_IN_CALLER_RETURN_ADDRESS,
100 /* The definition of tree nodes fills the next several pages. */
102 /* A tree node can represent a data type, a variable, an expression
103 or a statement. Each node has a TREE_CODE which says what kind of
104 thing it represents. Some common codes are:
105 INTEGER_TYPE -- represents a type of integers.
106 ARRAY_TYPE -- represents a type of pointer.
107 VAR_DECL -- represents a declared variable.
108 INTEGER_CST -- represents a constant integer value.
109 PLUS_EXPR -- represents a sum (an expression).
111 As for the contents of a tree node: there are some fields
112 that all nodes share. Each TREE_CODE has various special-purpose
113 fields as well. The fields of a node are never accessed directly,
114 always through accessor macros. */
116 /* This type is used everywhere to refer to a tree node. */
118 typedef union tree_node *tree;
120 /* Every kind of tree node starts with this structure,
121 so all nodes have these fields.
123 See the accessor macros, defined below, for documentation of the fields. */
127 union tree_node *chain;
128 union tree_node *type;
129 #ifdef ONLY_INT_FIELDS
130 unsigned int code : 8;
132 enum tree_code code : 8;
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;
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;
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. */
161 /* Define accessors for the fields that all tree nodes have
162 (though some fields are not used for all kinds of nodes). */
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))
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)
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
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. */
183 #define TREE_CHAIN(NODE) ((NODE)->common.chain)
185 /* Given an expression as a tree, strip any NON_LVALUE_EXPRs and NOP_EXPRs
186 that don't change the machine mode. */
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);
196 /* Like STRIP_NOPS, but don't alter the TREE_TYPE either. */
198 #define STRIP_TYPE_NOPS(EXP) \
199 while ((TREE_CODE (EXP) == NOP_EXPR \
200 || TREE_CODE (EXP) == CONVERT_EXPR \
201 || TREE_CODE (EXP) == NON_LVALUE_EXPR) \
202 && (TREE_TYPE (EXP) \
203 == TREE_TYPE (TREE_OPERAND (EXP, 0)))) \
204 (EXP) = TREE_OPERAND (EXP, 0);
206 /* Define many boolean fields that all tree nodes have. */
208 /* In VAR_DECL nodes, nonzero means address of this is needed.
209 So it cannot be in a register.
210 In a FUNCTION_DECL, nonzero means its address is needed.
211 So it must be compiled even if it is an inline function.
212 In CONSTRUCTOR nodes, it means object constructed must be in memory.
213 In LABEL_DECL nodes, it means a goto for this label has been seen
214 from a place outside all binding contours that restore stack levels.
215 In ..._TYPE nodes, it means that objects of this type must
216 be fully addressable. This means that pieces of this
217 object cannot go into register parameters, for example.
218 In IDENTIFIER_NODEs, this means that some extern decl for this name
219 had its address taken. That matters for inline functions. */
220 #define TREE_ADDRESSABLE(NODE) ((NODE)->common.addressable_flag)
222 /* In a VAR_DECL, nonzero means allocate static storage.
223 In a FUNCTION_DECL, nonzero if function has been defined.
224 In a CONSTRUCTOR, nonzero means allocate static storage. */
225 #define TREE_STATIC(NODE) ((NODE)->common.static_flag)
227 /* In a CONVERT_EXPR or NOP_EXPR, this means the node was made
228 implicitly and should not lead to an "unused value" warning. */
229 #define TREE_NO_UNUSED_WARNING(NODE) ((NODE)->common.static_flag)
231 /* In a NON_LVALUE_EXPR, this means there was overflow in folding.
232 The folded constant is inside the NON_LVALUE_EXPR. */
233 #define TREE_CONSTANT_OVERFLOW(NODE) ((NODE)->common.static_flag)
235 /* Nonzero for a TREE_LIST or TREE_VEC node means that the derivation
236 chain is via a `virtual' declaration. */
237 #define TREE_VIA_VIRTUAL(NODE) ((NODE)->common.static_flag)
239 /* In a VAR_DECL or FUNCTION_DECL,
240 nonzero means name is to be accessible from outside this module.
241 In an identifier node, nonzero means an external declaration
242 accessible from outside this module was previously seen
243 for this name in an inner scope. */
244 #define TREE_PUBLIC(NODE) ((NODE)->common.public_flag)
246 /* Nonzero for TREE_LIST or TREE_VEC node means that the path to the
247 base class is via a `public' declaration, which preserves public
248 fields from the base class as public. */
249 #define TREE_VIA_PUBLIC(NODE) ((NODE)->common.public_flag)
251 /* Ditto, for `private' declarations. */
252 #define TREE_VIA_PRIVATE(NODE) ((NODE)->common.private_flag)
254 /* Nonzero for TREE_LIST node means that the path to the
255 base class is via a `protected' declaration, which preserves
256 protected fields from the base class as protected.
258 #define TREE_VIA_PROTECTED(NODE) ((NODE)->common.static_flag)
260 /* In any expression, nonzero means it has side effects or reevaluation
261 of the whole expression could produce a different value.
262 This is set if any subexpression is a function call, a side effect
263 or a reference to a volatile variable.
264 In a ..._DECL, this is set only if the declaration said `volatile'. */
265 #define TREE_SIDE_EFFECTS(NODE) ((NODE)->common.side_effects_flag)
267 /* Nonzero means this expression is volatile in the C sense:
268 its address should be of type `volatile WHATEVER *'.
269 In other words, the declared item is volatile qualified.
270 This is used in _DECL nodes and _REF nodes.
272 In a ..._TYPE node, means this type is volatile-qualified.
273 But use TYPE_VOLATILE instead of this macro when the node is a type,
274 because eventually we may make that a different bit.
276 If this bit is set in an expression, so is TREE_SIDE_EFFECTS. */
277 #define TREE_THIS_VOLATILE(NODE) ((NODE)->common.volatile_flag)
279 /* In a VAR_DECL, PARM_DECL or FIELD_DECL, or any kind of ..._REF node,
280 nonzero means it may not be the lhs of an assignment.
281 In a ..._TYPE node, means this type is const-qualified
282 (but the macro TYPE_READONLY should be used instead of this macro
283 when the node is a type). */
284 #define TREE_READONLY(NODE) ((NODE)->common.readonly_flag)
286 /* Value of expression is constant.
287 Always appears in all ..._CST nodes.
288 May also appear in an arithmetic expression, an ADDR_EXPR or a CONSTRUCTOR
289 if the value is constant. */
290 #define TREE_CONSTANT(NODE) ((NODE)->common.constant_flag)
292 /* Nonzero means permanent node;
293 node will continue to exist for the entire compiler run.
294 Otherwise it will be recycled at the end of the function. */
295 #define TREE_PERMANENT(NODE) ((NODE)->common.permanent_flag)
297 /* In INTEGER_TYPE or ENUMERAL_TYPE nodes, means an unsigned type.
298 In FIELD_DECL nodes, means an unsigned bit field.
299 The same bit is used in functions as DECL_BUILT_IN_NONANSI. */
300 #define TREE_UNSIGNED(NODE) ((NODE)->common.unsigned_flag)
302 /* Nonzero in a VAR_DECL means assembler code has been written.
303 Nonzero in a FUNCTION_DECL means that the function has been compiled.
304 This is interesting in an inline function, since it might not need
305 to be compiled separately.
306 Nonzero in a RECORD_TYPE, UNION_TYPE or ENUMERAL_TYPE
307 if the sdb debugging info for the type has been written.
308 In a BLOCK node, nonzero if reorder_blocks has already seen this block. */
309 #define TREE_ASM_WRITTEN(NODE) ((NODE)->common.asm_written_flag)
311 /* Nonzero in a _DECL if the name is used in its scope.
312 Nonzero in an expr node means inhibit warning if value is unused.
313 In IDENTIFIER_NODEs, this means that some extern decl for this name
315 #define TREE_USED(NODE) ((NODE)->common.used_flag)
317 /* Nonzero for a tree node whose evaluation could result
318 in the raising of an exception. Not implemented yet. */
319 #define TREE_RAISES(NODE) ((NODE)->common.raises_flag)
321 /* Used in classes in C++. */
322 #define TREE_PRIVATE(NODE) ((NODE)->common.private_flag)
323 /* Used in classes in C++.
324 In a BLOCK node, this is BLOCK_HANDLER_BLOCK. */
325 #define TREE_PROTECTED(NODE) ((NODE)->common.protected_flag)
327 /* These flags are available for each language front end to use internally. */
328 #define TREE_LANG_FLAG_0(NODE) ((NODE)->common.lang_flag_0)
329 #define TREE_LANG_FLAG_1(NODE) ((NODE)->common.lang_flag_1)
330 #define TREE_LANG_FLAG_2(NODE) ((NODE)->common.lang_flag_2)
331 #define TREE_LANG_FLAG_3(NODE) ((NODE)->common.lang_flag_3)
332 #define TREE_LANG_FLAG_4(NODE) ((NODE)->common.lang_flag_4)
333 #define TREE_LANG_FLAG_5(NODE) ((NODE)->common.lang_flag_5)
334 #define TREE_LANG_FLAG_6(NODE) ((NODE)->common.lang_flag_6)
336 /* Define additional fields and accessors for nodes representing constants. */
338 /* In an INTEGER_CST node. These two together make a 2-word integer.
339 If the data type is signed, the value is sign-extended to 2 words
340 even though not all of them may really be in use.
341 In an unsigned constant shorter than 2 words, the extra bits are 0. */
342 #define TREE_INT_CST_LOW(NODE) ((NODE)->int_cst.int_cst_low)
343 #define TREE_INT_CST_HIGH(NODE) ((NODE)->int_cst.int_cst_high)
345 #define INT_CST_LT(A, B) \
346 (TREE_INT_CST_HIGH (A) < TREE_INT_CST_HIGH (B) \
347 || (TREE_INT_CST_HIGH (A) == TREE_INT_CST_HIGH (B) \
348 && ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (A) \
349 < (unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (B))))
351 #define INT_CST_LT_UNSIGNED(A, B) \
352 (((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (A) \
353 < (unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (B)) \
354 || (((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (A) \
355 == (unsigned HOST_WIDE_INT ) TREE_INT_CST_HIGH (B)) \
356 && (((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (A) \
357 < (unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (B)))))
361 char common[sizeof (struct tree_common)];
362 HOST_WIDE_INT int_cst_low;
363 HOST_WIDE_INT int_cst_high;
366 /* In REAL_CST, STRING_CST, COMPLEX_CST nodes, and CONSTRUCTOR nodes,
367 and generally in all kinds of constants that could
368 be given labels (rather than being immediate). */
370 #define TREE_CST_RTL(NODE) ((NODE)->real_cst.rtl)
372 /* In a REAL_CST node. */
373 /* We can represent a real value as either a `double' or a string.
374 Strings don't allow for any optimization, but they do allow
375 for cross-compilation. */
377 #define TREE_REAL_CST(NODE) ((NODE)->real_cst.real_cst)
383 char common[sizeof (struct tree_common)];
384 struct rtx_def *rtl; /* acts as link to register transfer language
386 REAL_VALUE_TYPE real_cst;
389 /* In a STRING_CST */
390 #define TREE_STRING_LENGTH(NODE) ((NODE)->string.length)
391 #define TREE_STRING_POINTER(NODE) ((NODE)->string.pointer)
395 char common[sizeof (struct tree_common)];
396 struct rtx_def *rtl; /* acts as link to register transfer language
402 /* In a COMPLEX_CST node. */
403 #define TREE_REALPART(NODE) ((NODE)->complex.real)
404 #define TREE_IMAGPART(NODE) ((NODE)->complex.imag)
408 char common[sizeof (struct tree_common)];
409 struct rtx_def *rtl; /* acts as link to register transfer language
411 union tree_node *real;
412 union tree_node *imag;
415 /* Define fields and accessors for some special-purpose tree nodes. */
417 #define IDENTIFIER_LENGTH(NODE) ((NODE)->identifier.length)
418 #define IDENTIFIER_POINTER(NODE) ((NODE)->identifier.pointer)
420 struct tree_identifier
422 char common[sizeof (struct tree_common)];
427 /* In a TREE_LIST node. */
428 #define TREE_PURPOSE(NODE) ((NODE)->list.purpose)
429 #define TREE_VALUE(NODE) ((NODE)->list.value)
433 char common[sizeof (struct tree_common)];
434 union tree_node *purpose;
435 union tree_node *value;
438 /* In a TREE_VEC node. */
439 #define TREE_VEC_LENGTH(NODE) ((NODE)->vec.length)
440 #define TREE_VEC_ELT(NODE,I) ((NODE)->vec.a[I])
441 #define TREE_VEC_END(NODE) (&((NODE)->vec.a[(NODE)->vec.length]))
445 char common[sizeof (struct tree_common)];
447 union tree_node *a[1];
450 /* Define fields and accessors for some nodes that represent expressions. */
452 /* In a SAVE_EXPR node. */
453 #define SAVE_EXPR_CONTEXT(NODE) TREE_OPERAND(NODE, 1)
454 #define SAVE_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[2])
456 /* In a RTL_EXPR node. */
457 #define RTL_EXPR_SEQUENCE(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[0])
458 #define RTL_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[1])
460 /* In a CALL_EXPR node. */
461 #define CALL_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[2])
463 /* In a CONSTRUCTOR node. */
464 #define CONSTRUCTOR_ELTS(NODE) TREE_OPERAND (NODE, 1)
466 /* In ordinary expression nodes. */
467 #define TREE_OPERAND(NODE, I) ((NODE)->exp.operands[I])
468 #define TREE_COMPLEXITY(NODE) ((NODE)->exp.complexity)
472 char common[sizeof (struct tree_common)];
474 union tree_node *operands[1];
477 /* In a BLOCK node. */
478 #define BLOCK_VARS(NODE) ((NODE)->block.vars)
479 #define BLOCK_TYPE_TAGS(NODE) ((NODE)->block.type_tags)
480 #define BLOCK_SUBBLOCKS(NODE) ((NODE)->block.subblocks)
481 #define BLOCK_SUPERCONTEXT(NODE) ((NODE)->block.supercontext)
482 /* Note: when changing this, make sure to find the places
483 that use chainon or nreverse. */
484 #define BLOCK_CHAIN(NODE) TREE_CHAIN (NODE)
485 #define BLOCK_ABSTRACT_ORIGIN(NODE) ((NODE)->block.abstract_origin)
486 #define BLOCK_ABSTRACT(NODE) ((NODE)->block.abstract_flag)
487 #define BLOCK_END_NOTE(NODE) ((NODE)->block.end_note)
489 /* Nonzero means that this block is prepared to handle exceptions
490 listed in the BLOCK_VARS slot. */
491 #define BLOCK_HANDLER_BLOCK(NODE) ((NODE)->block.handler_block_flag)
495 char common[sizeof (struct tree_common)];
497 unsigned handler_block_flag : 1;
498 unsigned abstract_flag : 1;
500 union tree_node *vars;
501 union tree_node *type_tags;
502 union tree_node *subblocks;
503 union tree_node *supercontext;
504 union tree_node *abstract_origin;
505 struct rtx_def *end_note;
508 /* Define fields and accessors for nodes representing data types. */
510 /* See tree.def for documentation of the use of these fields.
511 Look at the documentation of the various ..._TYPE tree codes. */
513 #define TYPE_UID(NODE) ((NODE)->type.uid)
514 #define TYPE_SIZE(NODE) ((NODE)->type.size)
515 #define TYPE_MODE(NODE) ((NODE)->type.mode)
516 #define TYPE_VALUES(NODE) ((NODE)->type.values)
517 #define TYPE_DOMAIN(NODE) ((NODE)->type.values)
518 #define TYPE_FIELDS(NODE) ((NODE)->type.values)
519 #define TYPE_METHODS(NODE) ((NODE)->type.maxval)
520 #define TYPE_VFIELD(NODE) ((NODE)->type.minval)
521 #define TYPE_ARG_TYPES(NODE) ((NODE)->type.values)
522 #define TYPE_METHOD_BASETYPE(NODE) ((NODE)->type.maxval)
523 #define TYPE_OFFSET_BASETYPE(NODE) ((NODE)->type.maxval)
524 #define TYPE_POINTER_TO(NODE) ((NODE)->type.pointer_to)
525 #define TYPE_REFERENCE_TO(NODE) ((NODE)->type.reference_to)
526 #define TYPE_MIN_VALUE(NODE) ((NODE)->type.minval)
527 #define TYPE_MAX_VALUE(NODE) ((NODE)->type.maxval)
528 #define TYPE_PRECISION(NODE) ((NODE)->type.precision)
529 #define TYPE_PARSE_INFO(NODE) ((NODE)->type.parse_info)
530 #define TYPE_SYMTAB_ADDRESS(NODE) ((NODE)->type.symtab_address)
531 #define TYPE_NAME(NODE) ((NODE)->type.name)
532 #define TYPE_NEXT_VARIANT(NODE) ((NODE)->type.next_variant)
533 #define TYPE_MAIN_VARIANT(NODE) ((NODE)->type.main_variant)
534 #define TYPE_BINFO(NODE) ((NODE)->type.binfo)
535 #define TYPE_NONCOPIED_PARTS(NODE) ((NODE)->type.noncopied_parts)
536 #define TYPE_CONTEXT(NODE) ((NODE)->type.context)
537 #define TYPE_LANG_SPECIFIC(NODE) ((NODE)->type.lang_specific)
539 /* The alignment necessary for objects of this type.
540 The value is an int, measured in bits. */
541 #define TYPE_ALIGN(NODE) ((NODE)->type.align)
543 #define TYPE_STUB_DECL(NODE) (TREE_CHAIN (NODE))
545 /* In a RECORD_TYPE or UNION_TYPE, it means the type has BLKmode
546 only because it lacks the alignment requirement for its size. */
547 #define TYPE_NO_FORCE_BLK(NODE) ((NODE)->type.no_force_blk_flag)
549 /* Nonzero in a type considered volatile as a whole. */
550 #define TYPE_VOLATILE(NODE) ((NODE)->common.volatile_flag)
552 /* Means this type is const-qualified. */
553 #define TYPE_READONLY(NODE) ((NODE)->common.readonly_flag)
555 /* These flags are available for each language front end to use internally. */
556 #define TYPE_LANG_FLAG_0(NODE) ((NODE)->type.lang_flag_0)
557 #define TYPE_LANG_FLAG_1(NODE) ((NODE)->type.lang_flag_1)
558 #define TYPE_LANG_FLAG_2(NODE) ((NODE)->type.lang_flag_2)
559 #define TYPE_LANG_FLAG_3(NODE) ((NODE)->type.lang_flag_3)
560 #define TYPE_LANG_FLAG_4(NODE) ((NODE)->type.lang_flag_4)
561 #define TYPE_LANG_FLAG_5(NODE) ((NODE)->type.lang_flag_5)
562 #define TYPE_LANG_FLAG_6(NODE) ((NODE)->type.lang_flag_6)
566 char common[sizeof (struct tree_common)];
567 union tree_node *values;
568 union tree_node *size;
571 #ifdef ONLY_INT_FIELDS
574 enum machine_mode mode : 8;
577 unsigned char precision;
579 unsigned no_force_blk_flag : 1;
580 unsigned lang_flag_0 : 1;
581 unsigned lang_flag_1 : 1;
582 unsigned lang_flag_2 : 1;
583 unsigned lang_flag_3 : 1;
584 unsigned lang_flag_4 : 1;
585 unsigned lang_flag_5 : 1;
586 unsigned lang_flag_6 : 1;
588 union tree_node *pointer_to;
589 union tree_node *reference_to;
592 union tree_node *name;
593 union tree_node *minval;
594 union tree_node *maxval;
595 union tree_node *next_variant;
596 union tree_node *main_variant;
597 union tree_node *binfo;
598 union tree_node *noncopied_parts;
599 union tree_node *context;
600 /* Points to a structure whose details depend on the language in use. */
601 struct lang_type *lang_specific;
604 /* Define accessor macros for information about type inheritance
607 A "basetype" means a particular usage of a data type for inheritance
608 in another type. Each such basetype usage has its own "binfo"
609 object to describe it. The binfo object is a TREE_VEC node.
611 Inheritance is represented by the binfo nodes allocated for a
612 given type. For example, given types C and D, such that D is
613 inherited by C, 3 binfo nodes will be allocated: one for describing
614 the binfo properties of C, similarly one for D, and one for
615 describing the binfo properties of D as a base type for C.
616 Thus, given a pointer to class C, one can get a pointer to the binfo
617 of D acting as a basetype for C by looking at C's binfo's basetypes. */
619 /* The actual data type node being inherited in this basetype. */
620 #define BINFO_TYPE(NODE) TREE_TYPE (NODE)
622 /* The offset where this basetype appears in its containing type.
623 BINFO_OFFSET slot holds the offset (in bytes)
624 from the base of the complete object to the base of the part of the
625 object that is allocated on behalf of this `type'.
626 This is always 0 except when there is multiple inheritance. */
628 #define BINFO_OFFSET(NODE) TREE_VEC_ELT ((NODE), 1)
629 #define TYPE_BINFO_OFFSET(NODE) BINFO_OFFSET (TYPE_BINFO (NODE))
630 #define BINFO_OFFSET_ZEROP(NODE) (BINFO_OFFSET (NODE) == integer_zero_node)
632 /* The virtual function table belonging to this basetype. Virtual
633 function tables provide a mechanism for run-time method dispatching.
634 The entries of a virtual function table are language-dependent. */
636 #define BINFO_VTABLE(NODE) TREE_VEC_ELT ((NODE), 2)
637 #define TYPE_BINFO_VTABLE(NODE) BINFO_VTABLE (TYPE_BINFO (NODE))
639 /* The virtual functions in the virtual function table. This is
640 a TREE_LIST that is used as an initial approximation for building
641 a virtual function table for this basetype. */
642 #define BINFO_VIRTUALS(NODE) TREE_VEC_ELT ((NODE), 3)
643 #define TYPE_BINFO_VIRTUALS(NODE) BINFO_VIRTUALS (TYPE_BINFO (NODE))
645 /* A vector of additional binfos for the types inherited by this basetype.
647 If this basetype describes type D as inherited in C,
648 and if the basetypes of D are E anf F,
649 then this vector contains binfos for inheritance of E and F by C.
651 ??? This could probably be done by just allocating the
652 base types at the end of this TREE_VEC (instead of using
653 another TREE_VEC). This would simplify the calculation
654 of how many basetypes a given type had. */
655 #define BINFO_BASETYPES(NODE) TREE_VEC_ELT ((NODE), 4)
656 #define TYPE_BINFO_BASETYPES(NODE) TREE_VEC_ELT (TYPE_BINFO (NODE), 4)
658 /* Accessor macro to get to the Nth basetype of this basetype. */
659 #define BINFO_BASETYPE(NODE,N) TREE_VEC_ELT (BINFO_BASETYPES (NODE), (N))
660 #define TYPE_BINFO_BASETYPE(NODE,N) BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (NODE)), (N)))
662 /* Slot used to build a chain that represents a use of inheritance.
663 For example, if X is derived from Y, and Y is derived from Z,
664 then this field can be used to link the binfo node for X to
665 the binfo node for X's Y to represent the use of inheritance
666 from X to Y. Similarly, this slot of the binfo node for X's Y
667 can point to the Z from which Y is inherited (in X's inheritance
668 hierarchy). In this fashion, one can represent and traverse specific
669 uses of inheritance using the binfo nodes themselves (instead of
670 consing new space pointing to binfo nodes).
671 It is up to the language-dependent front-ends to maintain
672 this information as necessary. */
673 #define BINFO_INHERITANCE_CHAIN(NODE) TREE_VEC_ELT ((NODE), 0)
675 /* Define fields and accessors for nodes representing declared names. */
677 /* This is the name of the object as written by the user.
678 It is an IDENTIFIER_NODE. */
679 #define DECL_NAME(NODE) ((NODE)->decl.name)
680 /* This macro is marked for death. */
681 #define DECL_PRINT_NAME(NODE) ((NODE)->decl.print_name)
682 /* This is the name of the object as the assembler will see it
683 (but before any translations made by ASM_OUTPUT_LABELREF).
684 Often this is the same as DECL_NAME.
685 It is an IDENTIFIER_NODE. */
686 #define DECL_ASSEMBLER_NAME(NODE) ((NODE)->decl.assembler_name)
687 /* For FIELD_DECLs, this is the
688 RECORD_TYPE or UNION_TYPE node that the field is a member of. For
689 VAR_DECL, PARM_DECL, FUNCTION_DECL, LABEL_DECL, and CONST_DECL nodes,
690 this points to the FUNCTION_DECL for the containing function, or else
691 yields NULL_TREE if the given decl has "file scope". */
692 #define DECL_CONTEXT(NODE) ((NODE)->decl.context)
693 #define DECL_FIELD_CONTEXT(NODE) ((NODE)->decl.context)
694 /* In a FIELD_DECL, this is the field position, counting in bits,
695 of the bit closest to the beginning of the structure. */
696 #define DECL_FIELD_BITPOS(NODE) ((NODE)->decl.arguments)
697 /* In a FIELD_DECL, this indicates whether the field was a bit-field and
698 if so, the type that was originally specified for it.
699 TREE_TYPE may have been modified (in finish_struct). */
700 #define DECL_BIT_FIELD_TYPE(NODE) ((NODE)->decl.result)
701 /* In FUNCTION_DECL, a chain of ..._DECL nodes. */
702 /* VAR_DECL and PARM_DECL reserve the arguments slot
703 for language-specific uses. */
704 #define DECL_ARGUMENTS(NODE) ((NODE)->decl.arguments)
705 /* In FUNCTION_DECL, holds the decl for the return value. */
706 #define DECL_RESULT(NODE) ((NODE)->decl.result)
707 /* In PARM_DECL, holds the type as written (perhaps a function or array). */
708 #define DECL_ARG_TYPE_AS_WRITTEN(NODE) ((NODE)->decl.result)
709 /* For a FUNCTION_DECL, holds the tree of BINDINGs.
710 For a VAR_DECL, holds the initial value.
711 For a PARM_DECL, not used--default
712 values for parameters are encoded in the type of the function,
713 not in the PARM_DECL slot. */
714 #define DECL_INITIAL(NODE) ((NODE)->decl.initial)
715 /* For a PARM_DECL, records the data type used to pass the argument,
716 which may be different from the type seen in the program. */
717 #define DECL_ARG_TYPE(NODE) ((NODE)->decl.initial) /* In PARM_DECL. */
718 /* These two fields describe where in the source code the declaration was. */
719 #define DECL_SOURCE_FILE(NODE) ((NODE)->decl.filename)
720 #define DECL_SOURCE_LINE(NODE) ((NODE)->decl.linenum)
721 /* Holds the size of the datum, as a tree expression.
722 Need not be constant. */
723 #define DECL_SIZE(NODE) ((NODE)->decl.size)
724 /* Holds the alignment required for the datum. */
725 #define DECL_ALIGN(NODE) ((NODE)->decl.frame_size)
726 /* Holds the machine mode of a variable or field. */
727 #define DECL_MODE(NODE) ((NODE)->decl.mode)
728 /* Holds the RTL expression for the value of a variable or function. */
729 #define DECL_RTL(NODE) ((NODE)->decl.rtl)
730 /* For PARM_DECL, holds an RTL for the stack slot or register
731 where the data was actually passed. */
732 #define DECL_INCOMING_RTL(NODE) ((NODE)->decl.saved_insns.r)
733 /* For FUNCTION_DECL, if it is inline, holds the saved insn chain. */
734 #define DECL_SAVED_INSNS(NODE) ((NODE)->decl.saved_insns.r)
735 /* For FUNCTION_DECL, if it is inline,
736 holds the size of the stack frame, as an integer. */
737 #define DECL_FRAME_SIZE(NODE) ((NODE)->decl.frame_size)
738 /* For FUNCTION_DECL, if it is built-in,
739 this identifies which built-in operation it is. */
740 #define DECL_FUNCTION_CODE(NODE) \
741 ((enum built_in_function) (NODE)->decl.frame_size)
742 #define DECL_SET_FUNCTION_CODE(NODE,VAL) \
743 ((NODE)->decl.frame_size = (int) (VAL))
744 /* For a FIELD_DECL, holds the size of the member as an integer. */
745 #define DECL_FIELD_SIZE(NODE) ((NODE)->decl.saved_insns.i)
747 /* The DECL_VINDEX is used for FUNCTION_DECLS in two different ways.
748 Before the struct containing the FUNCTION_DECL is laid out,
749 DECL_VINDEX may point to a FUNCTION_DECL in a base class which
750 is the FUNCTION_DECL which this FUNCTION_DECL will replace as a virtual
751 function. When the class is laid out, this pointer is changed
752 to an INTEGER_CST node which is suitable for use as an index
753 into the virtual function table. */
754 #define DECL_VINDEX(NODE) ((NODE)->decl.vindex)
755 /* For FIELD_DECLS, DECL_FCONTEXT is the *first* baseclass in
756 which this FIELD_DECL is defined. This information is needed when
757 writing debugging information about vfield and vbase decls for C++. */
758 #define DECL_FCONTEXT(NODE) ((NODE)->decl.vindex)
760 /* Every ..._DECL node gets a unique number. */
761 #define DECL_UID(NODE) ((NODE)->decl.uid)
763 /* For any sort of a ..._DECL node, this points to the original (abstract)
764 decl node which this decl is an instance of, or else it is NULL indicating
765 that this decl is not an instance of some other decl. */
766 #define DECL_ABSTRACT_ORIGIN(NODE) ((NODE)->decl.abstract_origin)
768 /* Nonzero for any sort of ..._DECL node means this decl node represents
769 an inline instance of some original (abstract) decl from an inline function;
770 suppress any warnings about shadowing some other variable. */
771 #define DECL_FROM_INLINE(NODE) (DECL_ABSTRACT_ORIGIN (NODE) != (tree) 0)
773 /* Nonzero if a _DECL means that the name of this decl should be ignored
774 for symbolic debug purposes. */
775 #define DECL_IGNORED_P(NODE) ((NODE)->decl.ignored_flag)
777 /* Nonzero for a given ..._DECL node means that this node represents an
778 "abstract instance" of the given declaration (e.g. in the original
779 declaration of an inline function). When generating symbolic debugging
780 information, we musn't try to generate any address information for nodes
781 marked as "abstract instances" because we don't actually generate
782 any code or allocate any data space for such instances. */
783 #define DECL_ABSTRACT(NODE) ((NODE)->decl.abstract_flag)
785 /* Nonzero if a _DECL means that no warnings should be generated just
786 because this decl is unused. */
787 #define DECL_IN_SYSTEM_HEADER(NODE) ((NODE)->decl.in_system_header_flag)
789 /* Language-specific decl information. */
790 #define DECL_LANG_SPECIFIC(NODE) ((NODE)->decl.lang_specific)
792 /* In a VAR_DECL or FUNCTION_DECL,
793 nonzero means external reference:
794 do not allocate storage, and refer to a definition elsewhere. */
795 #define DECL_EXTERNAL(NODE) ((NODE)->decl.external_flag)
797 /* In VAR_DECL and PARM_DECL nodes, nonzero means declared `register'.
798 In LABEL_DECL nodes, nonzero means that an error message about
799 jumping into such a binding contour has been printed for this label. */
800 #define DECL_REGISTER(NODE) ((NODE)->decl.regdecl_flag)
801 /* In a FIELD_DECL, indicates this field should be bit-packed. */
802 #define DECL_PACKED(NODE) ((NODE)->decl.regdecl_flag)
804 /* Nonzero in a ..._DECL means this variable is ref'd from a nested function.
805 For VAR_DECL nodes, PARM_DECL nodes, and FUNCTION_DECL nodes.
807 For LABEL_DECL nodes, nonzero if nonlocal gotos to the label are permitted.
809 Also set in some languages for variables, etc., outside the normal
810 lexical scope, such as class instance variables. */
811 #define DECL_NONLOCAL(NODE) ((NODE)->decl.nonlocal_flag)
813 /* Nonzero in a FUNCTION_DECL means this function can be substituted
814 where it is called. */
815 #define DECL_INLINE(NODE) ((NODE)->decl.inline_flag)
817 /* Nonzero in a FUNCTION_DECL means this is a built-in function
818 that is not specified by ansi C and that users are supposed to be allowed
819 to redefine for any purpose whatever. */
820 #define DECL_BUILT_IN_NONANSI(NODE) ((NODE)->common.unsigned_flag)
822 /* Nonzero in a FIELD_DECL means it is a bit field, and must be accessed
824 #define DECL_BIT_FIELD(NODE) ((NODE)->decl.bit_field_flag)
825 /* In a LABEL_DECL, nonzero means label was defined inside a binding
826 contour that restored a stack level and which is now exited. */
827 #define DECL_TOO_LATE(NODE) ((NODE)->decl.bit_field_flag)
828 /* In a FUNCTION_DECL, nonzero means a built in function. */
829 #define DECL_BUILT_IN(NODE) ((NODE)->decl.bit_field_flag)
831 /* Used in VAR_DECLs to indicate that the variable is a vtable.
832 It is also used in FIELD_DECLs for vtable pointers. */
833 #define DECL_VIRTUAL_P(NODE) ((NODE)->decl.virtual_flag)
835 /* Additional flags for language-specific uses. */
836 #define DECL_LANG_FLAG_0(NODE) ((NODE)->decl.lang_flag_0)
837 #define DECL_LANG_FLAG_1(NODE) ((NODE)->decl.lang_flag_1)
838 #define DECL_LANG_FLAG_2(NODE) ((NODE)->decl.lang_flag_2)
839 #define DECL_LANG_FLAG_3(NODE) ((NODE)->decl.lang_flag_3)
840 #define DECL_LANG_FLAG_4(NODE) ((NODE)->decl.lang_flag_4)
841 #define DECL_LANG_FLAG_5(NODE) ((NODE)->decl.lang_flag_5)
842 #define DECL_LANG_FLAG_6(NODE) ((NODE)->decl.lang_flag_6)
843 #define DECL_LANG_FLAG_7(NODE) ((NODE)->decl.lang_flag_7)
847 char common[sizeof (struct tree_common)];
850 union tree_node *size;
852 #ifdef ONLY_INT_FIELDS
855 enum machine_mode mode : 8;
858 unsigned external_flag : 1;
859 unsigned nonlocal_flag : 1;
860 unsigned regdecl_flag : 1;
861 unsigned inline_flag : 1;
862 unsigned bit_field_flag : 1;
863 unsigned virtual_flag : 1;
864 unsigned ignored_flag : 1;
865 unsigned abstract_flag : 1;
867 unsigned in_system_header_flag : 1;
868 /* room for seven more */
870 unsigned lang_flag_0 : 1;
871 unsigned lang_flag_1 : 1;
872 unsigned lang_flag_2 : 1;
873 unsigned lang_flag_3 : 1;
874 unsigned lang_flag_4 : 1;
875 unsigned lang_flag_5 : 1;
876 unsigned lang_flag_6 : 1;
877 unsigned lang_flag_7 : 1;
879 union tree_node *name;
880 union tree_node *context;
881 union tree_node *arguments;
882 union tree_node *result;
883 union tree_node *initial;
884 union tree_node *abstract_origin;
885 /* The PRINT_NAME field is marked for death. */
887 union tree_node *assembler_name;
888 struct rtx_def *rtl; /* acts as link to register transfer language
890 /* For a FUNCTION_DECL, if inline, this is the size of frame needed.
891 If built-in, this is the code for which built-in function.
892 For other kinds of decls, this is DECL_ALIGN. */
894 /* For FUNCTION_DECLs: points to insn that constitutes its definition
895 on the permanent obstack. For any other kind of decl, this is the
901 union tree_node *vindex;
902 /* Points to a structure whose details depend on the language in use. */
903 struct lang_decl *lang_specific;
906 /* Define the overall contents of a tree node.
907 It may be any of the structures declared above
908 for various types of node. */
912 struct tree_common common;
913 struct tree_int_cst int_cst;
914 struct tree_real_cst real_cst;
915 struct tree_string string;
916 struct tree_complex complex;
917 struct tree_identifier identifier;
918 struct tree_decl decl;
919 struct tree_type type;
920 struct tree_list list;
923 struct tree_block block;
926 /* Add prototype support. */
928 #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
929 #define PROTO(ARGS) ARGS
931 #define PROTO(ARGS) ()
936 #define NULL_TREE (tree) NULL
938 /* Define a generic NULL if one hasn't already been defined. */
945 #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
946 #define GENERIC_PTR void *
948 #define GENERIC_PTR char *
953 #define NULL_PTR ((GENERIC_PTR)0)
956 /* Format for global names of constructor and destructor functions. */
957 #ifndef NO_DOLLAR_IN_LABEL
958 #define CONSTRUCTOR_NAME_FORMAT "_GLOBAL_$I$%s"
960 #define CONSTRUCTOR_NAME_FORMAT "_GLOBAL_.I.%s"
963 /* The following functions accept a wide integer argument. Rather than
964 having to cast on every function call, we use a macro instead, that is
965 defined here and in rtl.h. */
968 #define exact_log2(N) exact_log2_wide ((HOST_WIDE_INT) (N))
969 #define floor_log2(N) floor_log2_wide ((HOST_WIDE_INT) (N))
973 /* At present, don't prototype xrealloc, since all of the callers don't
974 cast their pointers to char *, and all of the xrealloc's don't use
976 extern char *xrealloc PROTO((void *, unsigned));
978 extern char *xrealloc ();
981 extern char *oballoc PROTO((int));
982 extern char *permalloc PROTO((int));
983 extern char *savealloc PROTO((int));
984 extern char *xmalloc PROTO((unsigned));
985 extern void free PROTO((void *));
987 /* Lowest level primitive for allocating a node.
988 The TREE_CODE is the only argument. Contents are initialized
989 to zero except for a few of the common fields. */
991 extern tree make_node PROTO((enum tree_code));
993 /* Make a copy of a node, with all the same contents except
994 for TREE_PERMANENT. (The copy is permanent
995 iff nodes being made now are permanent.) */
997 extern tree copy_node PROTO((tree));
999 /* Make a copy of a chain of TREE_LIST nodes. */
1001 extern tree copy_list PROTO((tree));
1003 /* Make a TREE_VEC. */
1005 extern tree make_tree_vec PROTO((int));
1007 /* Return the (unique) IDENTIFIER_NODE node for a given name.
1008 The name is supplied as a char *. */
1010 extern tree get_identifier PROTO((char *));
1012 /* Construct various types of nodes. */
1014 #define build_int_2(LO,HI) \
1015 build_int_2_wide ((HOST_WIDE_INT) (LO), (HOST_WIDE_INT) (HI))
1018 /* We cannot define prototypes for the variable argument functions,
1019 since they have not been ANSI-fied, and an ANSI compiler would
1020 complain when compiling the definition of these functions. */
1022 extern tree build PROTO((enum tree_code, tree, ...));
1023 extern tree build_nt PROTO((enum tree_code, ...));
1024 extern tree build_parse_node PROTO((enum tree_code, ...));
1026 extern tree build ();
1027 extern tree build_nt ();
1028 extern tree build_parse_node ();
1031 extern tree build_int_2_wide PROTO((HOST_WIDE_INT, HOST_WIDE_INT));
1032 extern tree build_real PROTO((tree, REAL_VALUE_TYPE));
1033 extern tree build_real_from_int_cst PROTO((tree, tree));
1034 extern tree build_complex PROTO((tree, tree));
1035 extern tree build_string PROTO((int, char *));
1036 extern tree build1 PROTO((enum tree_code, tree, tree));
1037 extern tree build_tree_list PROTO((tree, tree));
1038 extern tree build_decl_list PROTO((tree, tree));
1039 extern tree build_decl PROTO((enum tree_code, tree, tree));
1040 extern tree build_block PROTO((tree, tree, tree, tree, tree));
1042 /* Construct various nodes representing data types. */
1044 extern tree make_signed_type PROTO((int));
1045 extern tree make_unsigned_type PROTO((int));
1046 extern tree signed_or_unsigned_type PROTO((int, tree));
1047 extern void fixup_unsigned_type PROTO((tree));
1048 extern tree build_pointer_type PROTO((tree));
1049 extern tree build_reference_type PROTO((tree));
1050 extern tree build_index_type PROTO((tree));
1051 extern tree build_index_2_type PROTO((tree, tree));
1052 extern tree build_array_type PROTO((tree, tree));
1053 extern tree build_function_type PROTO((tree, tree));
1054 extern tree build_method_type PROTO((tree, tree));
1055 extern tree build_offset_type PROTO((tree, tree));
1056 extern tree build_complex_type PROTO((tree));
1057 extern tree array_type_nelts PROTO((tree));
1059 /* Construct expressions, performing type checking.
1060 GCC and G++ use different calling sequences for build_binary_op,
1061 and build_indirect_ref, so don't include a prototype here. */
1063 extern tree build_binary_op ();
1064 extern tree build_indirect_ref ();
1065 extern tree build_unary_op PROTO((enum tree_code, tree, int));
1067 /* From expmed.c. Since rtl.h is included after tree.h, we can't
1068 put the prototype here. Rtl.h does declare the prototype if
1069 tree.h had been included. */
1071 extern tree make_tree ();
1073 /* Given a type node TYPE, and CONSTP and VOLATILEP, return a type
1074 for the same kind of data as TYPE describes.
1075 Variants point to the "main variant" (which has neither CONST nor VOLATILE)
1076 via TYPE_MAIN_VARIANT, and it points to a chain of other variants
1077 so that duplicate variants are never made.
1078 Only main variants should ever appear as types of expressions. */
1080 extern tree build_type_variant PROTO((tree, int, int));
1082 /* Make a copy of a type node. */
1084 extern tree build_type_copy PROTO((tree));
1086 /* Given a ..._TYPE node, calculate the TYPE_SIZE, TYPE_SIZE_UNIT,
1087 TYPE_ALIGN and TYPE_MODE fields.
1088 If called more than once on one node, does nothing except
1089 for the first time. */
1091 extern void layout_type PROTO((tree));
1093 /* Given a hashcode and a ..._TYPE node (for which the hashcode was made),
1094 return a canonicalized ..._TYPE node, so that duplicates are not made.
1095 How the hash code is computed is up to the caller, as long as any two
1096 callers that could hash identical-looking type nodes agree. */
1098 extern tree type_hash_canon PROTO((int, tree));
1100 /* Given a VAR_DECL, PARM_DECL, RESULT_DECL or FIELD_DECL node,
1101 calculates the DECL_SIZE, DECL_SIZE_UNIT, DECL_ALIGN and DECL_MODE
1102 fields. Call this only once for any given decl node.
1104 Second argument is the boundary that this field can be assumed to
1105 be starting at (in bits). Zero means it can be assumed aligned
1106 on any boundary that may be needed. */
1108 extern void layout_decl PROTO((tree, unsigned));
1110 /* Fold constants as much as possible in an expression.
1111 Returns the simplified expression.
1112 Acts only on the top level of the expression;
1113 if the argument itself cannot be simplified, its
1114 subexpressions are not changed. */
1116 extern tree fold PROTO((tree));
1118 /* Return an expr equal to X but certainly not valid as an lvalue. */
1120 extern tree non_lvalue PROTO((tree));
1122 extern tree convert PROTO((tree, tree));
1123 extern tree size_in_bytes PROTO((tree));
1124 extern int int_size_in_bytes PROTO((tree));
1125 extern tree size_binop PROTO((enum tree_code, tree, tree));
1126 extern tree size_int PROTO((unsigned));
1127 extern tree round_up PROTO((tree, int));
1128 extern tree get_pending_sizes PROTO((void));
1130 /* Type for sizes of data-type. */
1132 extern tree sizetype;
1134 /* Concatenate two lists (chains of TREE_LIST nodes) X and Y
1135 by making the last node in X point to Y.
1136 Returns X, except if X is 0 returns Y. */
1138 extern tree chainon PROTO((tree, tree));
1140 /* Make a new TREE_LIST node from specified PURPOSE, VALUE and CHAIN. */
1142 extern tree tree_cons PROTO((tree, tree, tree));
1143 extern tree perm_tree_cons PROTO((tree, tree, tree));
1144 extern tree temp_tree_cons PROTO((tree, tree, tree));
1145 extern tree saveable_tree_cons PROTO((tree, tree, tree));
1146 extern tree decl_tree_cons PROTO((tree, tree, tree));
1148 /* Return the last tree node in a chain. */
1150 extern tree tree_last PROTO((tree));
1152 /* Reverse the order of elements in a chain, and return the new head. */
1154 extern tree nreverse PROTO((tree));
1156 /* Returns the length of a chain of nodes
1157 (number of chain pointers to follow before reaching a null pointer). */
1159 extern int list_length PROTO((tree));
1161 /* integer_zerop (tree x) is nonzero if X is an integer constant of value 0 */
1163 extern int integer_zerop PROTO((tree));
1165 /* integer_onep (tree x) is nonzero if X is an integer constant of value 1 */
1167 extern int integer_onep PROTO((tree));
1169 /* integer_all_onesp (tree x) is nonzero if X is an integer constant
1170 all of whose significant bits are 1. */
1172 extern int integer_all_onesp PROTO((tree));
1174 /* integer_pow2p (tree x) is nonzero is X is an integer constant with
1175 exactly one bit 1. */
1177 extern int integer_pow2p PROTO((tree));
1179 /* staticp (tree x) is nonzero if X is a reference to data allocated
1180 at a fixed address in memory. */
1182 extern int staticp PROTO((tree));
1184 /* Gets an error if argument X is not an lvalue.
1185 Also returns 1 if X is an lvalue, 0 if not. */
1187 extern int lvalue_or_else PROTO((tree, char *));
1189 /* save_expr (EXP) returns an expression equivalent to EXP
1190 but it can be used multiple times within context CTX
1191 and only evaluate EXP once. */
1193 extern tree save_expr PROTO((tree));
1195 /* variable_size (EXP) is like save_expr (EXP) except that it
1196 is for the special case of something that is part of a
1197 variable size for a data type. It makes special arrangements
1198 to compute the value at the right time when the data type
1199 belongs to a function parameter. */
1201 extern tree variable_size PROTO((tree));
1203 /* stabilize_reference (EXP) returns an reference equivalent to EXP
1204 but it can be used multiple times
1205 and only evaluate the subexpressions once. */
1207 extern tree stabilize_reference PROTO((tree));
1209 /* Return EXP, stripped of any conversions to wider types
1210 in such a way that the result of converting to type FOR_TYPE
1211 is the same as if EXP were converted to FOR_TYPE.
1212 If FOR_TYPE is 0, it signifies EXP's type. */
1214 extern tree get_unwidened PROTO((tree, tree));
1216 /* Return OP or a simpler expression for a narrower value
1217 which can be sign-extended or zero-extended to give back OP.
1218 Store in *UNSIGNEDP_PTR either 1 if the value should be zero-extended
1219 or 0 if the value should be sign-extended. */
1221 extern tree get_narrower PROTO((tree, int *));
1223 /* Given MODE and UNSIGNEDP, return a suitable type-tree
1225 The definition of this resides in language-specific code
1226 as the repertoire of available types may vary. */
1228 extern tree type_for_mode PROTO((enum machine_mode, int));
1230 /* Given PRECISION and UNSIGNEDP, return a suitable type-tree
1231 for an integer type with at least that precision.
1232 The definition of this resides in language-specific code
1233 as the repertoire of available types may vary. */
1235 extern tree type_for_size PROTO((unsigned, int));
1237 /* Given an integer type T, return a type like T but unsigned.
1238 If T is unsigned, the value is T.
1239 The definition of this resides in language-specific code
1240 as the repertoire of available types may vary. */
1242 extern tree unsigned_type PROTO((tree));
1244 /* Given an integer type T, return a type like T but signed.
1245 If T is signed, the value is T.
1246 The definition of this resides in language-specific code
1247 as the repertoire of available types may vary. */
1249 extern tree signed_type PROTO((tree));
1251 /* This function must be defined in the language-specific files.
1252 expand_expr calls it to build the cleanup-expression for a TARGET_EXPR.
1253 This is defined in a language-specific file. */
1255 extern tree maybe_build_cleanup PROTO((tree));
1257 /* Given an expression EXP that may be a COMPONENT_REF or an ARRAY_REF,
1258 look for nested component-refs or array-refs at constant positions
1259 and find the ultimate containing object, which is returned. */
1261 extern tree get_inner_reference PROTO((tree, int *, int *, tree *, enum machine_mode *, int *, int *));
1263 /* Return the FUNCTION_DECL which provides this _DECL with its context,
1265 extern tree decl_function_context PROTO((tree));
1267 /* Return the RECORD_TYPE or UNION_TYPE which provides this _DECL
1268 with its context, or zero if none. */
1269 extern tree decl_type_context PROTO((tree));
1271 /* Given the FUNCTION_DECL for the current function,
1272 return zero if it is ok for this function to be inline.
1273 Otherwise return a warning message with a single %s
1274 for the function's name. */
1276 extern char *function_cannot_inline_p PROTO((tree));
1278 /* Declare commonly used variables for tree structure. */
1280 /* An integer constant with value 0 */
1281 extern tree integer_zero_node;
1283 /* An integer constant with value 1 */
1284 extern tree integer_one_node;
1286 /* An integer constant with value 0 whose type is sizetype. */
1287 extern tree size_zero_node;
1289 /* An integer constant with value 1 whose type is sizetype. */
1290 extern tree size_one_node;
1292 /* A constant of type pointer-to-int and value 0 */
1293 extern tree null_pointer_node;
1295 /* A node of type ERROR_MARK. */
1296 extern tree error_mark_node;
1298 /* The type node for the void type. */
1299 extern tree void_type_node;
1301 /* The type node for the ordinary (signed) integer type. */
1302 extern tree integer_type_node;
1304 /* The type node for the unsigned integer type. */
1305 extern tree unsigned_type_node;
1307 /* The type node for the ordinary character type. */
1308 extern tree char_type_node;
1310 /* Points to the name of the input file from which the current input
1311 being parsed originally came (before it went into cpp). */
1312 extern char *input_filename;
1314 /* Current line number in input file. */
1317 /* Nonzero for -pedantic switch: warn about anything
1318 that standard C forbids. */
1319 extern int pedantic;
1321 /* Nonzero means can safely call expand_expr now;
1322 otherwise layout_type puts variable sizes onto `pending_sizes' instead. */
1324 extern int immediate_size_expand;
1326 /* Points to the FUNCTION_DECL of the function whose body we are reading. */
1328 extern tree current_function_decl;
1330 /* Nonzero if function being compiled can call setjmp. */
1332 extern int current_function_calls_setjmp;
1334 /* Nonzero if function being compiled can call longjmp. */
1336 extern int current_function_calls_longjmp;
1338 /* Nonzero means all ..._TYPE nodes should be allocated permanently. */
1340 extern int all_types_permanent;
1342 /* Pointer to function to compute the name to use to print a declaration. */
1344 extern char *(*decl_printable_name) ();
1348 extern tree expand_start_stmt_expr PROTO((void));
1349 extern tree expand_end_stmt_expr PROTO((tree));
1350 extern void expand_expr_stmt PROTO((tree));
1351 extern void clear_last_expr PROTO((void));
1352 extern void expand_label PROTO((tree));
1353 extern void expand_goto PROTO((tree));
1354 extern void expand_asm PROTO((tree));
1355 extern void expand_start_cond PROTO((tree, int));
1356 extern void expand_end_cond PROTO((void));
1357 extern void expand_start_else PROTO((void));
1358 extern void expand_start_elseif PROTO((tree));
1359 extern struct nesting *expand_start_loop PROTO((int));
1360 extern struct nesting *expand_start_loop_continue_elsewhere PROTO((int));
1361 extern void expand_loop_continue_here PROTO((void));
1362 extern void expand_end_loop PROTO((void));
1363 extern int expand_continue_loop PROTO((struct nesting *));
1364 extern int expand_exit_loop PROTO((struct nesting *));
1365 extern int expand_exit_loop_if_false PROTO((struct nesting *, tree));
1366 extern int expand_exit_something PROTO((void));
1368 extern void expand_null_return PROTO((void));
1369 extern void expand_return PROTO((tree));
1370 extern void expand_start_bindings PROTO((int));
1371 extern void expand_end_bindings PROTO((tree, int, int));
1372 extern tree last_cleanup_this_contour PROTO((void));
1373 extern void expand_start_case PROTO((int, tree, tree, char *));
1374 extern void expand_end_case PROTO((tree));
1375 extern int pushcase PROTO((tree, tree, tree *));
1376 extern int pushcase_range PROTO((tree, tree, tree, tree *));
1378 /* In fold-const.c */
1380 extern tree invert_truthvalue PROTO((tree));
1382 /* The language front-end must define these functions. */
1384 /* Function of no arguments for initializing lexical scanning. */
1385 extern void init_lex PROTO((void));
1386 /* Function of no arguments for initializing the symbol table. */
1387 extern void init_decl_processing PROTO((void));
1389 /* Functions called with no arguments at the beginning and end or processing
1390 the input source file. */
1391 extern void lang_init PROTO((void));
1392 extern void lang_finish PROTO((void));
1394 /* Function called with no arguments to parse and compile the input. */
1395 extern int yyparse PROTO((void));
1396 /* Function called with option as argument
1397 to decode options starting with -f or -W or +.
1398 It should return nonzero if it handles the option. */
1399 extern int lang_decode_option PROTO((char *));
1401 /* Functions for processing symbol declarations. */
1402 /* Function to enter a new lexical scope.
1403 Takes one argument: always zero when called from outside the front end. */
1404 extern void pushlevel PROTO((int));
1405 /* Function to exit a lexical scope. It returns a BINDING for that scope.
1406 Takes three arguments:
1407 KEEP -- nonzero if there were declarations in this scope.
1408 REVERSE -- reverse the order of decls before returning them.
1409 FUNCTIONBODY -- nonzero if this level is the body of a function. */
1410 extern tree poplevel PROTO((int, int, int));
1411 /* Return the BLOCK node for the current scope level. */
1412 extern tree current_block PROTO((void));
1413 /* Function to add a decl to the current scope level.
1414 Takes one argument, a decl to add.
1415 Returns that decl, or, if the same symbol is already declared, may
1416 return a different decl for that name. */
1417 extern tree pushdecl PROTO((tree));
1418 /* Function to return the chain of decls so far in the current scope level. */
1419 extern tree getdecls PROTO((void));
1420 /* Function to return the chain of structure tags in the current scope level. */
1421 extern tree gettags PROTO((void));