]> gcc.gnu.org Git - gcc.git/blame - gcc/tree.h
Comment change for meaning of TREE_CONSTANT_OVERFLOW.
[gcc.git] / gcc / tree.h
CommitLineData
8da1b058
RS
1/* Front-end tree definitions for GNU compiler.
2 Copyright (C) 1989 Free Software Foundation, Inc.
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING. If not, write to
18the 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
26enum tree_code {
27#include "tree.def"
28
6dc42e49 29 LAST_AND_UNUSED_TREE_CODE /* A convenient way to get a value for
8da1b058
RS
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
45extern 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
50extern int *tree_code_length;
51
52/* Names of tree components. */
53
54extern 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
59enum 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,
a1ee10a4
JVA
80 BUILT_IN_SIN,
81 BUILT_IN_COS,
8da1b058
RS
82 BUILT_IN_GETEXP,
83 BUILT_IN_GETMAN,
84 BUILT_IN_SAVEREGS,
85 BUILT_IN_CLASSIFY_TYPE,
86 BUILT_IN_NEXT_ARG,
87 BUILT_IN_ARGS_INFO,
88 BUILT_IN_CONSTANT_P,
89 BUILT_IN_FRAME_ADDRESS,
90 BUILT_IN_RETURN_ADDRESS,
91 BUILT_IN_CALLER_RETURN_ADDRESS,
92
93 /* C++ extensions */
94 BUILT_IN_NEW,
95 BUILT_IN_VEC_NEW,
96 BUILT_IN_DELETE,
97 BUILT_IN_VEC_DELETE
98};
99\f
100/* The definition of tree nodes fills the next several pages. */
101
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).
110
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. */
115
116/* This type is used everywhere to refer to a tree node. */
117
118typedef union tree_node *tree;
119
8da1b058
RS
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
125struct 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);
0fafb45e
RS
195
196/* Like STRIP_NOPS, but don't alter the TREE_TYPE either. */
197
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);
8da1b058
RS
205\f
206/* Define many boolean fields that all tree nodes have. */
207
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)
221
222/* In a VAR_DECL, nonzero means allocate static storage.
9f86614b 223 In a FUNCTION_DECL, nonzero if function has been defined.
8da1b058
RS
224 In a CONSTRUCTOR, nonzero means allocate static storage. */
225#define TREE_STATIC(NODE) ((NODE)->common.static_flag)
226
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)
230
dac45ea3 231/* In an INTEGER_CST, this means there was overflow in folding. */
98f21a70
RS
232#define TREE_CONSTANT_OVERFLOW(NODE) ((NODE)->common.static_flag)
233
8da1b058
RS
234/* Nonzero for a TREE_LIST or TREE_VEC node means that the derivation
235 chain is via a `virtual' declaration. */
236#define TREE_VIA_VIRTUAL(NODE) ((NODE)->common.static_flag)
237
238/* In a VAR_DECL or FUNCTION_DECL,
239 nonzero means name is to be accessible from outside this module.
858a47b1 240 In an identifier node, nonzero means an external declaration
6dc42e49 241 accessible from outside this module was previously seen
8da1b058
RS
242 for this name in an inner scope. */
243#define TREE_PUBLIC(NODE) ((NODE)->common.public_flag)
244
245/* Nonzero for TREE_LIST or TREE_VEC node means that the path to the
246 base class is via a `public' declaration, which preserves public
247 fields from the base class as public. */
248#define TREE_VIA_PUBLIC(NODE) ((NODE)->common.public_flag)
249
9e5386db
MS
250/* Ditto, for `private' declarations. */
251#define TREE_VIA_PRIVATE(NODE) ((NODE)->common.private_flag)
252
253/* Nonzero for TREE_LIST node means that the path to the
254 base class is via a `protected' declaration, which preserves
255 protected fields from the base class as protected.
256 OVERLOADED. */
257#define TREE_VIA_PROTECTED(NODE) ((NODE)->common.static_flag)
258
8da1b058
RS
259/* In any expression, nonzero means it has side effects or reevaluation
260 of the whole expression could produce a different value.
261 This is set if any subexpression is a function call, a side effect
262 or a reference to a volatile variable.
263 In a ..._DECL, this is set only if the declaration said `volatile'. */
264#define TREE_SIDE_EFFECTS(NODE) ((NODE)->common.side_effects_flag)
265
266/* Nonzero means this expression is volatile in the C sense:
267 its address should be of type `volatile WHATEVER *'.
268 In other words, the declared item is volatile qualified.
269 This is used in _DECL nodes and _REF nodes.
270
271 In a ..._TYPE node, means this type is volatile-qualified.
272 But use TYPE_VOLATILE instead of this macro when the node is a type,
273 because eventually we may make that a different bit.
274
275 If this bit is set in an expression, so is TREE_SIDE_EFFECTS. */
276#define TREE_THIS_VOLATILE(NODE) ((NODE)->common.volatile_flag)
277
278/* In a VAR_DECL, PARM_DECL or FIELD_DECL, or any kind of ..._REF node,
279 nonzero means it may not be the lhs of an assignment.
280 In a ..._TYPE node, means this type is const-qualified
281 (but the macro TYPE_READONLY should be used instead of this macro
282 when the node is a type). */
283#define TREE_READONLY(NODE) ((NODE)->common.readonly_flag)
284
285/* Value of expression is constant.
286 Always appears in all ..._CST nodes.
287 May also appear in an arithmetic expression, an ADDR_EXPR or a CONSTRUCTOR
288 if the value is constant. */
289#define TREE_CONSTANT(NODE) ((NODE)->common.constant_flag)
290
291/* Nonzero means permanent node;
292 node will continue to exist for the entire compiler run.
293 Otherwise it will be recycled at the end of the function. */
294#define TREE_PERMANENT(NODE) ((NODE)->common.permanent_flag)
295
296/* In INTEGER_TYPE or ENUMERAL_TYPE nodes, means an unsigned type.
297 In FIELD_DECL nodes, means an unsigned bit field.
298 The same bit is used in functions as DECL_BUILT_IN_NONANSI. */
299#define TREE_UNSIGNED(NODE) ((NODE)->common.unsigned_flag)
300
301/* Nonzero in a VAR_DECL means assembler code has been written.
302 Nonzero in a FUNCTION_DECL means that the function has been compiled.
303 This is interesting in an inline function, since it might not need
304 to be compiled separately.
305 Nonzero in a RECORD_TYPE, UNION_TYPE or ENUMERAL_TYPE
9f86614b
RS
306 if the sdb debugging info for the type has been written.
307 In a BLOCK node, nonzero if reorder_blocks has already seen this block. */
8da1b058
RS
308#define TREE_ASM_WRITTEN(NODE) ((NODE)->common.asm_written_flag)
309
310/* Nonzero in a _DECL if the name is used in its scope.
311 Nonzero in an expr node means inhibit warning if value is unused.
312 In IDENTIFIER_NODEs, this means that some extern decl for this name
313 was used. */
314#define TREE_USED(NODE) ((NODE)->common.used_flag)
315
316/* Nonzero for a tree node whose evaluation could result
317 in the raising of an exception. Not implemented yet. */
318#define TREE_RAISES(NODE) ((NODE)->common.raises_flag)
319
9f86614b 320/* Used in classes in C++. */
8da1b058 321#define TREE_PRIVATE(NODE) ((NODE)->common.private_flag)
9f86614b
RS
322/* Used in classes in C++.
323 In a BLOCK node, this is BLOCK_HANDLER_BLOCK. */
8da1b058
RS
324#define TREE_PROTECTED(NODE) ((NODE)->common.protected_flag)
325
9f86614b 326/* These flags are available for each language front end to use internally. */
8da1b058
RS
327#define TREE_LANG_FLAG_0(NODE) ((NODE)->common.lang_flag_0)
328#define TREE_LANG_FLAG_1(NODE) ((NODE)->common.lang_flag_1)
329#define TREE_LANG_FLAG_2(NODE) ((NODE)->common.lang_flag_2)
330#define TREE_LANG_FLAG_3(NODE) ((NODE)->common.lang_flag_3)
331#define TREE_LANG_FLAG_4(NODE) ((NODE)->common.lang_flag_4)
332#define TREE_LANG_FLAG_5(NODE) ((NODE)->common.lang_flag_5)
333#define TREE_LANG_FLAG_6(NODE) ((NODE)->common.lang_flag_6)
334\f
335/* Define additional fields and accessors for nodes representing constants. */
336
e5d70561
RK
337/* In an INTEGER_CST node. These two together make a 2-word integer.
338 If the data type is signed, the value is sign-extended to 2 words
8da1b058 339 even though not all of them may really be in use.
e5d70561 340 In an unsigned constant shorter than 2 words, the extra bits are 0. */
8da1b058
RS
341#define TREE_INT_CST_LOW(NODE) ((NODE)->int_cst.int_cst_low)
342#define TREE_INT_CST_HIGH(NODE) ((NODE)->int_cst.int_cst_high)
343
344#define INT_CST_LT(A, B) \
345(TREE_INT_CST_HIGH (A) < TREE_INT_CST_HIGH (B) \
346 || (TREE_INT_CST_HIGH (A) == TREE_INT_CST_HIGH (B) \
e5d70561
RK
347 && ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (A) \
348 < (unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (B))))
8da1b058
RS
349
350#define INT_CST_LT_UNSIGNED(A, B) \
e5d70561
RK
351(((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (A) \
352 < (unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (B)) \
353 || (((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (A) \
354 == (unsigned HOST_WIDE_INT ) TREE_INT_CST_HIGH (B)) \
355 && (((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (A) \
356 < (unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (B)))))
8da1b058
RS
357
358struct tree_int_cst
359{
360 char common[sizeof (struct tree_common)];
e5d70561
RK
361 HOST_WIDE_INT int_cst_low;
362 HOST_WIDE_INT int_cst_high;
8da1b058
RS
363};
364
365/* In REAL_CST, STRING_CST, COMPLEX_CST nodes, and CONSTRUCTOR nodes,
366 and generally in all kinds of constants that could
367 be given labels (rather than being immediate). */
368
369#define TREE_CST_RTL(NODE) ((NODE)->real_cst.rtl)
370
371/* In a REAL_CST node. */
372/* We can represent a real value as either a `double' or a string.
373 Strings don't allow for any optimization, but they do allow
374 for cross-compilation. */
375
376#define TREE_REAL_CST(NODE) ((NODE)->real_cst.real_cst)
377
378#include "real.h"
379
380struct tree_real_cst
381{
382 char common[sizeof (struct tree_common)];
383 struct rtx_def *rtl; /* acts as link to register transfer language
384 (rtl) info */
385 REAL_VALUE_TYPE real_cst;
386};
387
388/* In a STRING_CST */
389#define TREE_STRING_LENGTH(NODE) ((NODE)->string.length)
390#define TREE_STRING_POINTER(NODE) ((NODE)->string.pointer)
391
392struct tree_string
393{
394 char common[sizeof (struct tree_common)];
395 struct rtx_def *rtl; /* acts as link to register transfer language
396 (rtl) info */
397 int length;
398 char *pointer;
399};
400
401/* In a COMPLEX_CST node. */
402#define TREE_REALPART(NODE) ((NODE)->complex.real)
403#define TREE_IMAGPART(NODE) ((NODE)->complex.imag)
404
405struct tree_complex
406{
407 char common[sizeof (struct tree_common)];
408 struct rtx_def *rtl; /* acts as link to register transfer language
409 (rtl) info */
410 union tree_node *real;
411 union tree_node *imag;
412};
413\f
414/* Define fields and accessors for some special-purpose tree nodes. */
415
416#define IDENTIFIER_LENGTH(NODE) ((NODE)->identifier.length)
417#define IDENTIFIER_POINTER(NODE) ((NODE)->identifier.pointer)
8da1b058
RS
418
419struct tree_identifier
420{
421 char common[sizeof (struct tree_common)];
422 int length;
423 char *pointer;
424};
425
426/* In a TREE_LIST node. */
427#define TREE_PURPOSE(NODE) ((NODE)->list.purpose)
428#define TREE_VALUE(NODE) ((NODE)->list.value)
429
430struct tree_list
431{
432 char common[sizeof (struct tree_common)];
433 union tree_node *purpose;
434 union tree_node *value;
435};
436
437/* In a TREE_VEC node. */
438#define TREE_VEC_LENGTH(NODE) ((NODE)->vec.length)
439#define TREE_VEC_ELT(NODE,I) ((NODE)->vec.a[I])
440#define TREE_VEC_END(NODE) (&((NODE)->vec.a[(NODE)->vec.length]))
441
442struct tree_vec
443{
444 char common[sizeof (struct tree_common)];
445 int length;
446 union tree_node *a[1];
447};
448
449/* Define fields and accessors for some nodes that represent expressions. */
450
451/* In a SAVE_EXPR node. */
452#define SAVE_EXPR_CONTEXT(NODE) TREE_OPERAND(NODE, 1)
453#define SAVE_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[2])
454
455/* In a RTL_EXPR node. */
456#define RTL_EXPR_SEQUENCE(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[0])
457#define RTL_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[1])
458
459/* In a CALL_EXPR node. */
460#define CALL_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[2])
461
462/* In a CONSTRUCTOR node. */
463#define CONSTRUCTOR_ELTS(NODE) TREE_OPERAND (NODE, 1)
464
61131fa2
RS
465/* In ordinary expression nodes. */
466#define TREE_OPERAND(NODE, I) ((NODE)->exp.operands[I])
467#define TREE_COMPLEXITY(NODE) ((NODE)->exp.complexity)
468
469struct tree_exp
470{
471 char common[sizeof (struct tree_common)];
472 int complexity;
473 union tree_node *operands[1];
474};
475\f
8da1b058 476/* In a BLOCK node. */
61131fa2
RS
477#define BLOCK_VARS(NODE) ((NODE)->block.vars)
478#define BLOCK_TYPE_TAGS(NODE) ((NODE)->block.type_tags)
479#define BLOCK_SUBBLOCKS(NODE) ((NODE)->block.subblocks)
480#define BLOCK_SUPERCONTEXT(NODE) ((NODE)->block.supercontext)
8da1b058
RS
481/* Note: when changing this, make sure to find the places
482 that use chainon or nreverse. */
483#define BLOCK_CHAIN(NODE) TREE_CHAIN (NODE)
61131fa2
RS
484#define BLOCK_ABSTRACT_ORIGIN(NODE) ((NODE)->block.abstract_origin)
485#define BLOCK_ABSTRACT(NODE) ((NODE)->block.abstract_flag)
5b3f0db1 486#define BLOCK_END_NOTE(NODE) ((NODE)->block.end_note)
8da1b058
RS
487
488/* Nonzero means that this block is prepared to handle exceptions
489 listed in the BLOCK_VARS slot. */
61131fa2 490#define BLOCK_HANDLER_BLOCK(NODE) ((NODE)->block.handler_block_flag)
8da1b058 491
61131fa2 492struct tree_block
8da1b058
RS
493{
494 char common[sizeof (struct tree_common)];
61131fa2
RS
495
496 unsigned handler_block_flag : 1;
497 unsigned abstract_flag : 1;
498
499 union tree_node *vars;
500 union tree_node *type_tags;
501 union tree_node *subblocks;
502 union tree_node *supercontext;
503 union tree_node *abstract_origin;
5b3f0db1 504 struct rtx_def *end_note;
8da1b058
RS
505};
506\f
507/* Define fields and accessors for nodes representing data types. */
508
509/* See tree.def for documentation of the use of these fields.
510 Look at the documentation of the various ..._TYPE tree codes. */
511
512#define TYPE_UID(NODE) ((NODE)->type.uid)
513#define TYPE_SIZE(NODE) ((NODE)->type.size)
514#define TYPE_MODE(NODE) ((NODE)->type.mode)
8da1b058
RS
515#define TYPE_VALUES(NODE) ((NODE)->type.values)
516#define TYPE_DOMAIN(NODE) ((NODE)->type.values)
517#define TYPE_FIELDS(NODE) ((NODE)->type.values)
518#define TYPE_METHODS(NODE) ((NODE)->type.maxval)
519#define TYPE_VFIELD(NODE) ((NODE)->type.minval)
520#define TYPE_ARG_TYPES(NODE) ((NODE)->type.values)
521#define TYPE_METHOD_BASETYPE(NODE) ((NODE)->type.maxval)
522#define TYPE_OFFSET_BASETYPE(NODE) ((NODE)->type.maxval)
523#define TYPE_POINTER_TO(NODE) ((NODE)->type.pointer_to)
524#define TYPE_REFERENCE_TO(NODE) ((NODE)->type.reference_to)
525#define TYPE_MIN_VALUE(NODE) ((NODE)->type.minval)
526#define TYPE_MAX_VALUE(NODE) ((NODE)->type.maxval)
527#define TYPE_PRECISION(NODE) ((NODE)->type.precision)
528#define TYPE_PARSE_INFO(NODE) ((NODE)->type.parse_info)
529#define TYPE_SYMTAB_ADDRESS(NODE) ((NODE)->type.symtab_address)
530#define TYPE_NAME(NODE) ((NODE)->type.name)
531#define TYPE_NEXT_VARIANT(NODE) ((NODE)->type.next_variant)
532#define TYPE_MAIN_VARIANT(NODE) ((NODE)->type.main_variant)
533#define TYPE_BINFO(NODE) ((NODE)->type.binfo)
534#define TYPE_NONCOPIED_PARTS(NODE) ((NODE)->type.noncopied_parts)
535#define TYPE_CONTEXT(NODE) ((NODE)->type.context)
536#define TYPE_LANG_SPECIFIC(NODE) ((NODE)->type.lang_specific)
537
869637e6
RS
538/* The alignment necessary for objects of this type.
539 The value is an int, measured in bits. */
540#define TYPE_ALIGN(NODE) ((NODE)->type.align)
541
8da1b058
RS
542#define TYPE_STUB_DECL(NODE) (TREE_CHAIN (NODE))
543
544/* In a RECORD_TYPE or UNION_TYPE, it means the type has BLKmode
545 only because it lacks the alignment requirement for its size. */
546#define TYPE_NO_FORCE_BLK(NODE) ((NODE)->type.no_force_blk_flag)
547
548/* Nonzero in a type considered volatile as a whole. */
549#define TYPE_VOLATILE(NODE) ((NODE)->common.volatile_flag)
550
551/* Means this type is const-qualified. */
552#define TYPE_READONLY(NODE) ((NODE)->common.readonly_flag)
553
9f86614b 554/* These flags are available for each language front end to use internally. */
8da1b058
RS
555#define TYPE_LANG_FLAG_0(NODE) ((NODE)->type.lang_flag_0)
556#define TYPE_LANG_FLAG_1(NODE) ((NODE)->type.lang_flag_1)
557#define TYPE_LANG_FLAG_2(NODE) ((NODE)->type.lang_flag_2)
558#define TYPE_LANG_FLAG_3(NODE) ((NODE)->type.lang_flag_3)
559#define TYPE_LANG_FLAG_4(NODE) ((NODE)->type.lang_flag_4)
560#define TYPE_LANG_FLAG_5(NODE) ((NODE)->type.lang_flag_5)
561#define TYPE_LANG_FLAG_6(NODE) ((NODE)->type.lang_flag_6)
562
563struct tree_type
564{
565 char common[sizeof (struct tree_common)];
566 union tree_node *values;
567 union tree_node *size;
568 unsigned uid;
569
570#ifdef ONLY_INT_FIELDS
571 int mode : 8;
572#else
573 enum machine_mode mode : 8;
574#endif
8da1b058
RS
575 unsigned char precision;
576
577 unsigned no_force_blk_flag : 1;
578 unsigned lang_flag_0 : 1;
579 unsigned lang_flag_1 : 1;
580 unsigned lang_flag_2 : 1;
581 unsigned lang_flag_3 : 1;
582 unsigned lang_flag_4 : 1;
583 unsigned lang_flag_5 : 1;
584 unsigned lang_flag_6 : 1;
585
69b78d8d 586 unsigned int align;
8da1b058
RS
587 union tree_node *pointer_to;
588 union tree_node *reference_to;
589 int parse_info;
590 int symtab_address;
591 union tree_node *name;
592 union tree_node *minval;
593 union tree_node *maxval;
594 union tree_node *next_variant;
595 union tree_node *main_variant;
596 union tree_node *binfo;
597 union tree_node *noncopied_parts;
598 union tree_node *context;
599 /* Points to a structure whose details depend on the language in use. */
600 struct lang_type *lang_specific;
601};
602\f
603/* Define accessor macros for information about type inheritance
604 and basetypes.
605
606 A "basetype" means a particular usage of a data type for inheritance
607 in another type. Each such basetype usage has its own "binfo"
608 object to describe it. The binfo object is a TREE_VEC node.
609
610 Inheritance is represented by the binfo nodes allocated for a
611 given type. For example, given types C and D, such that D is
612 inherited by C, 3 binfo nodes will be allocated: one for describing
613 the binfo properties of C, similarly one for D, and one for
614 describing the binfo properties of D as a base type for C.
615 Thus, given a pointer to class C, one can get a pointer to the binfo
616 of D acting as a basetype for C by looking at C's binfo's basetypes. */
617
618/* The actual data type node being inherited in this basetype. */
619#define BINFO_TYPE(NODE) TREE_TYPE (NODE)
620
621/* The offset where this basetype appears in its containing type.
622 BINFO_OFFSET slot holds the offset (in bytes)
623 from the base of the complete object to the base of the part of the
624 object that is allocated on behalf of this `type'.
625 This is always 0 except when there is multiple inheritance. */
626
627#define BINFO_OFFSET(NODE) TREE_VEC_ELT ((NODE), 1)
628#define TYPE_BINFO_OFFSET(NODE) BINFO_OFFSET (TYPE_BINFO (NODE))
629#define BINFO_OFFSET_ZEROP(NODE) (BINFO_OFFSET (NODE) == integer_zero_node)
630
631/* The virtual function table belonging to this basetype. Virtual
632 function tables provide a mechanism for run-time method dispatching.
633 The entries of a virtual function table are language-dependent. */
634
635#define BINFO_VTABLE(NODE) TREE_VEC_ELT ((NODE), 2)
636#define TYPE_BINFO_VTABLE(NODE) BINFO_VTABLE (TYPE_BINFO (NODE))
637
638/* The virtual functions in the virtual function table. This is
639 a TREE_LIST that is used as an initial approximation for building
640 a virtual function table for this basetype. */
641#define BINFO_VIRTUALS(NODE) TREE_VEC_ELT ((NODE), 3)
642#define TYPE_BINFO_VIRTUALS(NODE) BINFO_VIRTUALS (TYPE_BINFO (NODE))
643
644/* A vector of additional binfos for the types inherited by this basetype.
645
646 If this basetype describes type D as inherited in C,
647 and if the basetypes of D are E anf F,
648 then this vector contains binfos for inheritance of E and F by C.
649
650 ??? This could probably be done by just allocating the
651 base types at the end of this TREE_VEC (instead of using
652 another TREE_VEC). This would simplify the calculation
653 of how many basetypes a given type had. */
654#define BINFO_BASETYPES(NODE) TREE_VEC_ELT ((NODE), 4)
655#define TYPE_BINFO_BASETYPES(NODE) TREE_VEC_ELT (TYPE_BINFO (NODE), 4)
656
657/* Accessor macro to get to the Nth basetype of this basetype. */
658#define BINFO_BASETYPE(NODE,N) TREE_VEC_ELT (BINFO_BASETYPES (NODE), (N))
659#define TYPE_BINFO_BASETYPE(NODE,N) BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (NODE)), (N)))
660
661/* Slot used to build a chain that represents a use of inheritance.
662 For example, if X is derived from Y, and Y is derived from Z,
663 then this field can be used to link the binfo node for X to
664 the binfo node for X's Y to represent the use of inheritance
665 from X to Y. Similarly, this slot of the binfo node for X's Y
666 can point to the Z from which Y is inherited (in X's inheritance
667 hierarchy). In this fashion, one can represent and traverse specific
668 uses of inheritance using the binfo nodes themselves (instead of
669 consing new space pointing to binfo nodes).
670 It is up to the language-dependent front-ends to maintain
671 this information as necessary. */
672#define BINFO_INHERITANCE_CHAIN(NODE) TREE_VEC_ELT ((NODE), 0)
673\f
674/* Define fields and accessors for nodes representing declared names. */
675
676/* This is the name of the object as written by the user.
677 It is an IDENTIFIER_NODE. */
678#define DECL_NAME(NODE) ((NODE)->decl.name)
679/* This macro is marked for death. */
680#define DECL_PRINT_NAME(NODE) ((NODE)->decl.print_name)
681/* This is the name of the object as the assembler will see it
682 (but before any translations made by ASM_OUTPUT_LABELREF).
683 Often this is the same as DECL_NAME.
684 It is an IDENTIFIER_NODE. */
685#define DECL_ASSEMBLER_NAME(NODE) ((NODE)->decl.assembler_name)
9b800101
RS
686/* For FIELD_DECLs, this is the
687 RECORD_TYPE or UNION_TYPE node that the field is a member of. For
688 VAR_DECL, PARM_DECL, FUNCTION_DECL, LABEL_DECL, and CONST_DECL nodes,
689 this points to the FUNCTION_DECL for the containing function, or else
690 yields NULL_TREE if the given decl has "file scope". */
8da1b058
RS
691#define DECL_CONTEXT(NODE) ((NODE)->decl.context)
692#define DECL_FIELD_CONTEXT(NODE) ((NODE)->decl.context)
693/* In a FIELD_DECL, this is the field position, counting in bits,
694 of the bit closest to the beginning of the structure. */
695#define DECL_FIELD_BITPOS(NODE) ((NODE)->decl.arguments)
696/* In a FIELD_DECL, this indicates whether the field was a bit-field and
8e148bef
RS
697 if so, the type that was originally specified for it.
698 TREE_TYPE may have been modified (in finish_struct). */
8da1b058
RS
699#define DECL_BIT_FIELD_TYPE(NODE) ((NODE)->decl.result)
700/* In FUNCTION_DECL, a chain of ..._DECL nodes. */
701/* VAR_DECL and PARM_DECL reserve the arguments slot
702 for language-specific uses. */
703#define DECL_ARGUMENTS(NODE) ((NODE)->decl.arguments)
704/* In FUNCTION_DECL, holds the decl for the return value. */
705#define DECL_RESULT(NODE) ((NODE)->decl.result)
706/* In PARM_DECL, holds the type as written (perhaps a function or array). */
707#define DECL_ARG_TYPE_AS_WRITTEN(NODE) ((NODE)->decl.result)
708/* For a FUNCTION_DECL, holds the tree of BINDINGs.
709 For a VAR_DECL, holds the initial value.
710 For a PARM_DECL, not used--default
711 values for parameters are encoded in the type of the function,
712 not in the PARM_DECL slot. */
713#define DECL_INITIAL(NODE) ((NODE)->decl.initial)
714/* For a PARM_DECL, records the data type used to pass the argument,
715 which may be different from the type seen in the program. */
716#define DECL_ARG_TYPE(NODE) ((NODE)->decl.initial) /* In PARM_DECL. */
717/* These two fields describe where in the source code the declaration was. */
718#define DECL_SOURCE_FILE(NODE) ((NODE)->decl.filename)
719#define DECL_SOURCE_LINE(NODE) ((NODE)->decl.linenum)
720/* Holds the size of the datum, as a tree expression.
721 Need not be constant. */
722#define DECL_SIZE(NODE) ((NODE)->decl.size)
723/* Holds the alignment required for the datum. */
c0920bf9 724#define DECL_ALIGN(NODE) ((NODE)->decl.frame_size)
8da1b058
RS
725/* Holds the machine mode of a variable or field. */
726#define DECL_MODE(NODE) ((NODE)->decl.mode)
727/* Holds the RTL expression for the value of a variable or function. */
728#define DECL_RTL(NODE) ((NODE)->decl.rtl)
729/* For PARM_DECL, holds an RTL for the stack slot or register
730 where the data was actually passed. */
77f934bb 731#define DECL_INCOMING_RTL(NODE) ((NODE)->decl.saved_insns.r)
8da1b058 732/* For FUNCTION_DECL, if it is inline, holds the saved insn chain. */
77f934bb 733#define DECL_SAVED_INSNS(NODE) ((NODE)->decl.saved_insns.r)
66321686
RS
734/* For FUNCTION_DECL, if it is inline,
735 holds the size of the stack frame, as an integer. */
736#define DECL_FRAME_SIZE(NODE) ((NODE)->decl.frame_size)
737/* For FUNCTION_DECL, if it is built-in,
738 this identifies which built-in operation it is. */
8da1b058
RS
739#define DECL_FUNCTION_CODE(NODE) \
740 ((enum built_in_function) (NODE)->decl.frame_size)
741#define DECL_SET_FUNCTION_CODE(NODE,VAL) \
742 ((NODE)->decl.frame_size = (int) (VAL))
77f934bb
TW
743/* For a FIELD_DECL, holds the size of the member as an integer. */
744#define DECL_FIELD_SIZE(NODE) ((NODE)->decl.saved_insns.i)
8da1b058
RS
745
746/* The DECL_VINDEX is used for FUNCTION_DECLS in two different ways.
747 Before the struct containing the FUNCTION_DECL is laid out,
748 DECL_VINDEX may point to a FUNCTION_DECL in a base class which
749 is the FUNCTION_DECL which this FUNCTION_DECL will replace as a virtual
750 function. When the class is laid out, this pointer is changed
751 to an INTEGER_CST node which is suitable for use as an index
752 into the virtual function table. */
753#define DECL_VINDEX(NODE) ((NODE)->decl.vindex)
754/* For FIELD_DECLS, DECL_FCONTEXT is the *first* baseclass in
755 which this FIELD_DECL is defined. This information is needed when
756 writing debugging information about vfield and vbase decls for C++. */
757#define DECL_FCONTEXT(NODE) ((NODE)->decl.vindex)
758
0e77444b
RS
759/* Every ..._DECL node gets a unique number. */
760#define DECL_UID(NODE) ((NODE)->decl.uid)
761
c5caa350
CH
762/* For any sort of a ..._DECL node, this points to the original (abstract)
763 decl node which this decl is an instance of, or else it is NULL indicating
764 that this decl is not an instance of some other decl. */
765#define DECL_ABSTRACT_ORIGIN(NODE) ((NODE)->decl.abstract_origin)
766
767/* Nonzero for any sort of ..._DECL node means this decl node represents
768 an inline instance of some original (abstract) decl from an inline function;
8da1b058 769 suppress any warnings about shadowing some other variable. */
c5caa350 770#define DECL_FROM_INLINE(NODE) (DECL_ABSTRACT_ORIGIN (NODE) != (tree) 0)
8da1b058
RS
771
772/* Nonzero if a _DECL means that the name of this decl should be ignored
773 for symbolic debug purposes. */
774#define DECL_IGNORED_P(NODE) ((NODE)->decl.ignored_flag)
775
c5caa350
CH
776/* Nonzero for a given ..._DECL node means that this node represents an
777 "abstract instance" of the given declaration (e.g. in the original
778 declaration of an inline function). When generating symbolic debugging
779 information, we musn't try to generate any address information for nodes
780 marked as "abstract instances" because we don't actually generate
781 any code or allocate any data space for such instances. */
782#define DECL_ABSTRACT(NODE) ((NODE)->decl.abstract_flag)
783
3110a56e
RS
784/* Nonzero if a _DECL means that no warnings should be generated just
785 because this decl is unused. */
786#define DECL_IN_SYSTEM_HEADER(NODE) ((NODE)->decl.in_system_header_flag)
787
788/* Language-specific decl information. */
8da1b058
RS
789#define DECL_LANG_SPECIFIC(NODE) ((NODE)->decl.lang_specific)
790
791/* In a VAR_DECL or FUNCTION_DECL,
792 nonzero means external reference:
793 do not allocate storage, and refer to a definition elsewhere. */
1394aabd 794#define DECL_EXTERNAL(NODE) ((NODE)->decl.external_flag)
8da1b058
RS
795
796/* In VAR_DECL and PARM_DECL nodes, nonzero means declared `register'.
797 In LABEL_DECL nodes, nonzero means that an error message about
798 jumping into such a binding contour has been printed for this label. */
1394aabd 799#define DECL_REGISTER(NODE) ((NODE)->decl.regdecl_flag)
5a1c7968
RS
800/* In a FIELD_DECL, indicates this field should be bit-packed. */
801#define DECL_PACKED(NODE) ((NODE)->decl.regdecl_flag)
8da1b058
RS
802
803/* Nonzero in a ..._DECL means this variable is ref'd from a nested function.
804 For VAR_DECL nodes, PARM_DECL nodes, and FUNCTION_DECL nodes.
805
806 For LABEL_DECL nodes, nonzero if nonlocal gotos to the label are permitted.
807
808 Also set in some languages for variables, etc., outside the normal
809 lexical scope, such as class instance variables. */
1394aabd 810#define DECL_NONLOCAL(NODE) ((NODE)->decl.nonlocal_flag)
8da1b058
RS
811
812/* Nonzero in a FUNCTION_DECL means this function can be substituted
813 where it is called. */
1394aabd 814#define DECL_INLINE(NODE) ((NODE)->decl.inline_flag)
8da1b058
RS
815
816/* Nonzero in a FUNCTION_DECL means this is a built-in function
817 that is not specified by ansi C and that users are supposed to be allowed
818 to redefine for any purpose whatever. */
819#define DECL_BUILT_IN_NONANSI(NODE) ((NODE)->common.unsigned_flag)
820
821/* Nonzero in a FIELD_DECL means it is a bit field, and must be accessed
822 specially. */
823#define DECL_BIT_FIELD(NODE) ((NODE)->decl.bit_field_flag)
824/* In a LABEL_DECL, nonzero means label was defined inside a binding
825 contour that restored a stack level and which is now exited. */
826#define DECL_TOO_LATE(NODE) ((NODE)->decl.bit_field_flag)
827/* In a FUNCTION_DECL, nonzero means a built in function. */
828#define DECL_BUILT_IN(NODE) ((NODE)->decl.bit_field_flag)
829
5a1c7968
RS
830/* Used in VAR_DECLs to indicate that the variable is a vtable.
831 It is also used in FIELD_DECLs for vtable pointers. */
8da1b058 832#define DECL_VIRTUAL_P(NODE) ((NODE)->decl.virtual_flag)
8da1b058
RS
833
834/* Additional flags for language-specific uses. */
835#define DECL_LANG_FLAG_0(NODE) ((NODE)->decl.lang_flag_0)
836#define DECL_LANG_FLAG_1(NODE) ((NODE)->decl.lang_flag_1)
837#define DECL_LANG_FLAG_2(NODE) ((NODE)->decl.lang_flag_2)
838#define DECL_LANG_FLAG_3(NODE) ((NODE)->decl.lang_flag_3)
839#define DECL_LANG_FLAG_4(NODE) ((NODE)->decl.lang_flag_4)
840#define DECL_LANG_FLAG_5(NODE) ((NODE)->decl.lang_flag_5)
841#define DECL_LANG_FLAG_6(NODE) ((NODE)->decl.lang_flag_6)
842#define DECL_LANG_FLAG_7(NODE) ((NODE)->decl.lang_flag_7)
843
844struct tree_decl
845{
846 char common[sizeof (struct tree_common)];
847 char *filename;
848 int linenum;
849 union tree_node *size;
0e77444b 850 unsigned int uid;
8da1b058
RS
851#ifdef ONLY_INT_FIELDS
852 int mode : 8;
853#else
854 enum machine_mode mode : 8;
855#endif
8da1b058
RS
856
857 unsigned external_flag : 1;
858 unsigned nonlocal_flag : 1;
859 unsigned regdecl_flag : 1;
860 unsigned inline_flag : 1;
861 unsigned bit_field_flag : 1;
862 unsigned virtual_flag : 1;
8da1b058 863 unsigned ignored_flag : 1;
c5caa350 864 unsigned abstract_flag : 1;
8da1b058 865
3110a56e
RS
866 unsigned in_system_header_flag : 1;
867 /* room for seven more */
868
8da1b058
RS
869 unsigned lang_flag_0 : 1;
870 unsigned lang_flag_1 : 1;
871 unsigned lang_flag_2 : 1;
872 unsigned lang_flag_3 : 1;
873 unsigned lang_flag_4 : 1;
874 unsigned lang_flag_5 : 1;
875 unsigned lang_flag_6 : 1;
876 unsigned lang_flag_7 : 1;
877
878 union tree_node *name;
879 union tree_node *context;
880 union tree_node *arguments;
881 union tree_node *result;
882 union tree_node *initial;
c5caa350 883 union tree_node *abstract_origin;
8da1b058
RS
884 /* The PRINT_NAME field is marked for death. */
885 char *print_name;
886 union tree_node *assembler_name;
887 struct rtx_def *rtl; /* acts as link to register transfer language
888 (rtl) info */
c0920bf9 889 /* For a FUNCTION_DECL, if inline, this is the size of frame needed.
66321686
RS
890 If built-in, this is the code for which built-in function.
891 For other kinds of decls, this is DECL_ALIGN. */
c0920bf9 892 int frame_size;
77f934bb
TW
893 /* For FUNCTION_DECLs: points to insn that constitutes its definition
894 on the permanent obstack. For any other kind of decl, this is the
895 alignment. */
896 union {
897 struct rtx_def *r;
898 int i;
899 } saved_insns;
8da1b058
RS
900 union tree_node *vindex;
901 /* Points to a structure whose details depend on the language in use. */
902 struct lang_decl *lang_specific;
903};
904\f
905/* Define the overall contents of a tree node.
906 It may be any of the structures declared above
907 for various types of node. */
908
909union tree_node
910{
911 struct tree_common common;
912 struct tree_int_cst int_cst;
913 struct tree_real_cst real_cst;
914 struct tree_string string;
915 struct tree_complex complex;
916 struct tree_identifier identifier;
917 struct tree_decl decl;
918 struct tree_type type;
919 struct tree_list list;
920 struct tree_vec vec;
921 struct tree_exp exp;
61131fa2 922 struct tree_block block;
8da1b058
RS
923 };
924
f837a861
MM
925/* Add prototype support. */
926#ifndef PROTO
927#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
928#define PROTO(ARGS) ARGS
929#else
930#define PROTO(ARGS) ()
931#endif
932#endif
933
934
935#define NULL_TREE (tree) NULL
936
937/* Define a generic NULL if one hasn't already been defined. */
938
939#ifndef NULL
940#define NULL 0
941#endif
942
943#ifndef GENERIC_PTR
944#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
945#define GENERIC_PTR void *
946#else
947#define GENERIC_PTR char *
948#endif
949#endif
950
951#ifndef NULL_PTR
952#define NULL_PTR ((GENERIC_PTR)0)
953#endif
954
8da1b058
RS
955/* Format for global names of constructor and destructor functions. */
956#ifndef NO_DOLLAR_IN_LABEL
957#define CONSTRUCTOR_NAME_FORMAT "_GLOBAL_$I$%s"
958#else
959#define CONSTRUCTOR_NAME_FORMAT "_GLOBAL_.I.%s"
960#endif
961\f
e5d70561
RK
962/* The following functions accept a wide integer argument. Rather than
963 having to cast on every function call, we use a macro instead, that is
964 defined here and in rtl.h. */
965
966#ifndef exact_log2
967#define exact_log2(N) exact_log2_wide ((HOST_WIDE_INT) (N))
968#define floor_log2(N) floor_log2_wide ((HOST_WIDE_INT) (N))
969#endif
970
f837a861
MM
971#if 0
972/* At present, don't prototype xrealloc, since all of the callers don't
973 cast their pointers to char *, and all of the xrealloc's don't use
974 void * yet. */
975extern char *xrealloc PROTO((void *, unsigned));
976#else
0e77444b 977extern char *xrealloc ();
f837a861
MM
978#endif
979
980extern char *oballoc PROTO((int));
981extern char *permalloc PROTO((int));
982extern char *savealloc PROTO((int));
983extern char *xmalloc PROTO((unsigned));
984extern void free PROTO((void *));
8da1b058
RS
985
986/* Lowest level primitive for allocating a node.
987 The TREE_CODE is the only argument. Contents are initialized
988 to zero except for a few of the common fields. */
989
f837a861 990extern tree make_node PROTO((enum tree_code));
8da1b058
RS
991
992/* Make a copy of a node, with all the same contents except
993 for TREE_PERMANENT. (The copy is permanent
994 iff nodes being made now are permanent.) */
995
f837a861 996extern tree copy_node PROTO((tree));
8da1b058
RS
997
998/* Make a copy of a chain of TREE_LIST nodes. */
999
f837a861 1000extern tree copy_list PROTO((tree));
8da1b058
RS
1001
1002/* Make a TREE_VEC. */
1003
f837a861 1004extern tree make_tree_vec PROTO((int));
8da1b058
RS
1005
1006/* Return the (unique) IDENTIFIER_NODE node for a given name.
1007 The name is supplied as a char *. */
1008
f837a861 1009extern tree get_identifier PROTO((char *));
8da1b058
RS
1010
1011/* Construct various types of nodes. */
1012
e5d70561
RK
1013#define build_int_2(LO,HI) \
1014 build_int_2_wide ((HOST_WIDE_INT) (LO), (HOST_WIDE_INT) (HI))
1015
f837a861
MM
1016#if 0
1017/* We cannot define prototypes for the variable argument functions,
1018 since they have not been ANSI-fied, and an ANSI compiler would
1019 complain when compiling the definition of these functions. */
1020
1021extern tree build PROTO((enum tree_code, tree, ...));
1022extern tree build_nt PROTO((enum tree_code, ...));
1023extern tree build_parse_node PROTO((enum tree_code, ...));
1024#else
1025extern tree build ();
1026extern tree build_nt ();
1027extern tree build_parse_node ();
1028#endif
1029
1030extern tree build_int_2_wide PROTO((HOST_WIDE_INT, HOST_WIDE_INT));
1031extern tree build_real PROTO((tree, REAL_VALUE_TYPE));
1032extern tree build_real_from_int_cst PROTO((tree, tree));
1033extern tree build_complex PROTO((tree, tree));
1034extern tree build_string PROTO((int, char *));
1035extern tree build1 PROTO((enum tree_code, tree, tree));
1036extern tree build_tree_list PROTO((tree, tree));
1037extern tree build_decl_list PROTO((tree, tree));
1038extern tree build_decl PROTO((enum tree_code, tree, tree));
1039extern tree build_block PROTO((tree, tree, tree, tree, tree));
8da1b058
RS
1040
1041/* Construct various nodes representing data types. */
1042
f837a861
MM
1043extern tree make_signed_type PROTO((int));
1044extern tree make_unsigned_type PROTO((int));
1045extern tree signed_or_unsigned_type PROTO((int, tree));
1046extern void fixup_unsigned_type PROTO((tree));
1047extern tree build_pointer_type PROTO((tree));
1048extern tree build_reference_type PROTO((tree));
1049extern tree build_index_type PROTO((tree));
1050extern tree build_index_2_type PROTO((tree, tree));
1051extern tree build_array_type PROTO((tree, tree));
1052extern tree build_function_type PROTO((tree, tree));
1053extern tree build_method_type PROTO((tree, tree));
1054extern tree build_offset_type PROTO((tree, tree));
1055extern tree build_complex_type PROTO((tree));
1056extern tree array_type_nelts PROTO((tree));
1057
1058/* Construct expressions, performing type checking.
1059 GCC and G++ use different calling sequences for build_binary_op,
1060 and build_indirect_ref, so don't include a prototype here. */
8da1b058
RS
1061
1062extern tree build_binary_op ();
1063extern tree build_indirect_ref ();
f837a861
MM
1064extern tree build_unary_op PROTO((enum tree_code, tree, int));
1065
1066/* From expmed.c. Since rtl.h is included after tree.h, we can't
1067 put the prototype here. Rtl.h does declare the prototype if
1068 tree.h had been included. */
1069
1070extern tree make_tree ();
8da1b058
RS
1071\f
1072/* Given a type node TYPE, and CONSTP and VOLATILEP, return a type
1073 for the same kind of data as TYPE describes.
1074 Variants point to the "main variant" (which has neither CONST nor VOLATILE)
1075 via TYPE_MAIN_VARIANT, and it points to a chain of other variants
1076 so that duplicate variants are never made.
1077 Only main variants should ever appear as types of expressions. */
1078
f837a861 1079extern tree build_type_variant PROTO((tree, int, int));
8da1b058 1080
43100b14
RS
1081/* Make a copy of a type node. */
1082
f837a861 1083extern tree build_type_copy PROTO((tree));
43100b14 1084
8da1b058
RS
1085/* Given a ..._TYPE node, calculate the TYPE_SIZE, TYPE_SIZE_UNIT,
1086 TYPE_ALIGN and TYPE_MODE fields.
1087 If called more than once on one node, does nothing except
1088 for the first time. */
1089
f837a861 1090extern void layout_type PROTO((tree));
8da1b058
RS
1091
1092/* Given a hashcode and a ..._TYPE node (for which the hashcode was made),
1093 return a canonicalized ..._TYPE node, so that duplicates are not made.
1094 How the hash code is computed is up to the caller, as long as any two
1095 callers that could hash identical-looking type nodes agree. */
1096
f837a861 1097extern tree type_hash_canon PROTO((int, tree));
8da1b058
RS
1098
1099/* Given a VAR_DECL, PARM_DECL, RESULT_DECL or FIELD_DECL node,
1100 calculates the DECL_SIZE, DECL_SIZE_UNIT, DECL_ALIGN and DECL_MODE
1101 fields. Call this only once for any given decl node.
1102
1103 Second argument is the boundary that this field can be assumed to
1104 be starting at (in bits). Zero means it can be assumed aligned
1105 on any boundary that may be needed. */
1106
f837a861 1107extern void layout_decl PROTO((tree, unsigned));
8da1b058
RS
1108
1109/* Fold constants as much as possible in an expression.
1110 Returns the simplified expression.
1111 Acts only on the top level of the expression;
1112 if the argument itself cannot be simplified, its
1113 subexpressions are not changed. */
1114
f837a861 1115extern tree fold PROTO((tree));
8da1b058
RS
1116
1117/* Return an expr equal to X but certainly not valid as an lvalue. */
1118
f837a861 1119extern tree non_lvalue PROTO((tree));
8da1b058 1120
f837a861
MM
1121extern tree convert PROTO((tree, tree));
1122extern tree size_in_bytes PROTO((tree));
1123extern int int_size_in_bytes PROTO((tree));
1124extern tree size_binop PROTO((enum tree_code, tree, tree));
1125extern tree size_int PROTO((unsigned));
1126extern tree round_up PROTO((tree, int));
1127extern tree get_pending_sizes PROTO((void));
8da1b058
RS
1128
1129/* Type for sizes of data-type. */
1130
1131extern tree sizetype;
1132
1133/* Concatenate two lists (chains of TREE_LIST nodes) X and Y
1134 by making the last node in X point to Y.
1135 Returns X, except if X is 0 returns Y. */
1136
f837a861 1137extern tree chainon PROTO((tree, tree));
8da1b058
RS
1138
1139/* Make a new TREE_LIST node from specified PURPOSE, VALUE and CHAIN. */
1140
f837a861
MM
1141extern tree tree_cons PROTO((tree, tree, tree));
1142extern tree perm_tree_cons PROTO((tree, tree, tree));
1143extern tree temp_tree_cons PROTO((tree, tree, tree));
1144extern tree saveable_tree_cons PROTO((tree, tree, tree));
1145extern tree decl_tree_cons PROTO((tree, tree, tree));
8da1b058
RS
1146
1147/* Return the last tree node in a chain. */
1148
f837a861 1149extern tree tree_last PROTO((tree));
8da1b058
RS
1150
1151/* Reverse the order of elements in a chain, and return the new head. */
1152
f837a861 1153extern tree nreverse PROTO((tree));
8da1b058
RS
1154
1155/* Returns the length of a chain of nodes
1156 (number of chain pointers to follow before reaching a null pointer). */
1157
f837a861 1158extern int list_length PROTO((tree));
8da1b058
RS
1159
1160/* integer_zerop (tree x) is nonzero if X is an integer constant of value 0 */
1161
f837a861 1162extern int integer_zerop PROTO((tree));
8da1b058
RS
1163
1164/* integer_onep (tree x) is nonzero if X is an integer constant of value 1 */
1165
f837a861 1166extern int integer_onep PROTO((tree));
8da1b058
RS
1167
1168/* integer_all_onesp (tree x) is nonzero if X is an integer constant
1169 all of whose significant bits are 1. */
1170
f837a861 1171extern int integer_all_onesp PROTO((tree));
8da1b058
RS
1172
1173/* integer_pow2p (tree x) is nonzero is X is an integer constant with
1174 exactly one bit 1. */
1175
f837a861 1176extern int integer_pow2p PROTO((tree));
8da1b058
RS
1177
1178/* staticp (tree x) is nonzero if X is a reference to data allocated
1179 at a fixed address in memory. */
1180
f837a861 1181extern int staticp PROTO((tree));
8da1b058
RS
1182
1183/* Gets an error if argument X is not an lvalue.
1184 Also returns 1 if X is an lvalue, 0 if not. */
1185
f837a861 1186extern int lvalue_or_else PROTO((tree, char *));
8da1b058
RS
1187
1188/* save_expr (EXP) returns an expression equivalent to EXP
1189 but it can be used multiple times within context CTX
1190 and only evaluate EXP once. */
1191
f837a861 1192extern tree save_expr PROTO((tree));
8da1b058 1193
90ca31be
RS
1194/* variable_size (EXP) is like save_expr (EXP) except that it
1195 is for the special case of something that is part of a
1196 variable size for a data type. It makes special arrangements
1197 to compute the value at the right time when the data type
1198 belongs to a function parameter. */
1199
f837a861 1200extern tree variable_size PROTO((tree));
90ca31be 1201
8da1b058
RS
1202/* stabilize_reference (EXP) returns an reference equivalent to EXP
1203 but it can be used multiple times
1204 and only evaluate the subexpressions once. */
1205
f837a861 1206extern tree stabilize_reference PROTO((tree));
8da1b058
RS
1207
1208/* Return EXP, stripped of any conversions to wider types
1209 in such a way that the result of converting to type FOR_TYPE
1210 is the same as if EXP were converted to FOR_TYPE.
1211 If FOR_TYPE is 0, it signifies EXP's type. */
1212
f837a861 1213extern tree get_unwidened PROTO((tree, tree));
8da1b058
RS
1214
1215/* Return OP or a simpler expression for a narrower value
1216 which can be sign-extended or zero-extended to give back OP.
1217 Store in *UNSIGNEDP_PTR either 1 if the value should be zero-extended
1218 or 0 if the value should be sign-extended. */
1219
f837a861 1220extern tree get_narrower PROTO((tree, int *));
8da1b058
RS
1221
1222/* Given MODE and UNSIGNEDP, return a suitable type-tree
1223 with that mode.
1224 The definition of this resides in language-specific code
1225 as the repertoire of available types may vary. */
1226
f837a861 1227extern tree type_for_mode PROTO((enum machine_mode, int));
8da1b058
RS
1228
1229/* Given PRECISION and UNSIGNEDP, return a suitable type-tree
1230 for an integer type with at least that precision.
1231 The definition of this resides in language-specific code
1232 as the repertoire of available types may vary. */
1233
f837a861 1234extern tree type_for_size PROTO((unsigned, int));
8da1b058
RS
1235
1236/* Given an integer type T, return a type like T but unsigned.
1237 If T is unsigned, the value is T.
1238 The definition of this resides in language-specific code
1239 as the repertoire of available types may vary. */
1240
f837a861 1241extern tree unsigned_type PROTO((tree));
8da1b058
RS
1242
1243/* Given an integer type T, return a type like T but signed.
1244 If T is signed, the value is T.
1245 The definition of this resides in language-specific code
1246 as the repertoire of available types may vary. */
1247
f837a861 1248extern tree signed_type PROTO((tree));
8da1b058
RS
1249
1250/* This function must be defined in the language-specific files.
1251 expand_expr calls it to build the cleanup-expression for a TARGET_EXPR.
1252 This is defined in a language-specific file. */
1253
f837a861 1254extern tree maybe_build_cleanup PROTO((tree));
8da1b058
RS
1255
1256/* Given an expression EXP that may be a COMPONENT_REF or an ARRAY_REF,
1257 look for nested component-refs or array-refs at constant positions
1258 and find the ultimate containing object, which is returned. */
1259
f837a861 1260extern tree get_inner_reference PROTO((tree, int *, int *, tree *, enum machine_mode *, int *, int *));
8da1b058
RS
1261
1262/* Return the FUNCTION_DECL which provides this _DECL with its context,
1263 or zero if none. */
f837a861 1264extern tree decl_function_context PROTO((tree));
8da1b058
RS
1265
1266/* Return the RECORD_TYPE or UNION_TYPE which provides this _DECL
1267 with its context, or zero if none. */
f837a861 1268extern tree decl_type_context PROTO((tree));
8da1b058
RS
1269
1270/* Given the FUNCTION_DECL for the current function,
1271 return zero if it is ok for this function to be inline.
1272 Otherwise return a warning message with a single %s
1273 for the function's name. */
1274
f837a861 1275extern char *function_cannot_inline_p PROTO((tree));
8da1b058
RS
1276\f
1277/* Declare commonly used variables for tree structure. */
1278
1279/* An integer constant with value 0 */
1280extern tree integer_zero_node;
1281
1282/* An integer constant with value 1 */
1283extern tree integer_one_node;
1284
1285/* An integer constant with value 0 whose type is sizetype. */
1286extern tree size_zero_node;
1287
1288/* An integer constant with value 1 whose type is sizetype. */
1289extern tree size_one_node;
1290
1291/* A constant of type pointer-to-int and value 0 */
1292extern tree null_pointer_node;
1293
1294/* A node of type ERROR_MARK. */
1295extern tree error_mark_node;
1296
1297/* The type node for the void type. */
1298extern tree void_type_node;
1299
1300/* The type node for the ordinary (signed) integer type. */
1301extern tree integer_type_node;
1302
1303/* The type node for the unsigned integer type. */
1304extern tree unsigned_type_node;
1305
1306/* The type node for the ordinary character type. */
1307extern tree char_type_node;
1308
1309/* Points to the name of the input file from which the current input
1310 being parsed originally came (before it went into cpp). */
1311extern char *input_filename;
1312
1313/* Current line number in input file. */
1314extern int lineno;
1315
1316/* Nonzero for -pedantic switch: warn about anything
1317 that standard C forbids. */
1318extern int pedantic;
1319
1320/* Nonzero means can safely call expand_expr now;
1321 otherwise layout_type puts variable sizes onto `pending_sizes' instead. */
1322
1323extern int immediate_size_expand;
1324
1325/* Points to the FUNCTION_DECL of the function whose body we are reading. */
1326
1327extern tree current_function_decl;
1328
1329/* Nonzero if function being compiled can call setjmp. */
1330
1331extern int current_function_calls_setjmp;
1332
1333/* Nonzero if function being compiled can call longjmp. */
1334
1335extern int current_function_calls_longjmp;
1336
1337/* Nonzero means all ..._TYPE nodes should be allocated permanently. */
1338
1339extern int all_types_permanent;
1340
1341/* Pointer to function to compute the name to use to print a declaration. */
1342
1343extern char *(*decl_printable_name) ();
1344\f
8da1b058
RS
1345/* In stmt.c */
1346
f837a861
MM
1347extern tree expand_start_stmt_expr PROTO((void));
1348extern tree expand_end_stmt_expr PROTO((tree));
1349extern void expand_expr_stmt PROTO((tree));
1350extern void clear_last_expr PROTO((void));
1351extern void expand_label PROTO((tree));
1352extern void expand_goto PROTO((tree));
1353extern void expand_asm PROTO((tree));
1354extern void expand_start_cond PROTO((tree, int));
1355extern void expand_end_cond PROTO((void));
1356extern void expand_start_else PROTO((void));
1357extern void expand_start_elseif PROTO((tree));
1358extern struct nesting *expand_start_loop PROTO((int));
1359extern struct nesting *expand_start_loop_continue_elsewhere PROTO((int));
1360extern void expand_loop_continue_here PROTO((void));
1361extern void expand_end_loop PROTO((void));
1362extern int expand_continue_loop PROTO((struct nesting *));
1363extern int expand_exit_loop PROTO((struct nesting *));
1364extern int expand_exit_loop_if_false PROTO((struct nesting *, tree));
1365extern int expand_exit_something PROTO((void));
1366
1367extern void expand_null_return PROTO((void));
1368extern void expand_return PROTO((tree));
1369extern void expand_start_bindings PROTO((int));
1370extern void expand_end_bindings PROTO((tree, int, int));
1371extern tree last_cleanup_this_contour PROTO((void));
1372extern void expand_start_case PROTO((int, tree, tree, char *));
1373extern void expand_end_case PROTO((tree));
1374extern int pushcase PROTO((tree, tree, tree *));
1375extern int pushcase_range PROTO((tree, tree, tree, tree *));
8da1b058
RS
1376
1377/* In fold-const.c */
1378
f837a861 1379extern tree invert_truthvalue PROTO((tree));
8da1b058
RS
1380\f
1381/* The language front-end must define these functions. */
1382
1383/* Function of no arguments for initializing lexical scanning. */
f837a861 1384extern void init_lex PROTO((void));
8da1b058 1385/* Function of no arguments for initializing the symbol table. */
f837a861 1386extern void init_decl_processing PROTO((void));
8da1b058
RS
1387
1388/* Functions called with no arguments at the beginning and end or processing
1389 the input source file. */
f837a861
MM
1390extern void lang_init PROTO((void));
1391extern void lang_finish PROTO((void));
8da1b058
RS
1392
1393/* Function called with no arguments to parse and compile the input. */
f837a861 1394extern int yyparse PROTO((void));
8da1b058
RS
1395/* Function called with option as argument
1396 to decode options starting with -f or -W or +.
1397 It should return nonzero if it handles the option. */
f837a861 1398extern int lang_decode_option PROTO((char *));
8da1b058
RS
1399
1400/* Functions for processing symbol declarations. */
1401/* Function to enter a new lexical scope.
1402 Takes one argument: always zero when called from outside the front end. */
f837a861 1403extern void pushlevel PROTO((int));
8da1b058
RS
1404/* Function to exit a lexical scope. It returns a BINDING for that scope.
1405 Takes three arguments:
1406 KEEP -- nonzero if there were declarations in this scope.
1407 REVERSE -- reverse the order of decls before returning them.
1408 FUNCTIONBODY -- nonzero if this level is the body of a function. */
f837a861 1409extern tree poplevel PROTO((int, int, int));
69b78d8d
RS
1410/* Set the BLOCK node for the current scope level. */
1411extern void set_block PROTO((tree));
8da1b058
RS
1412/* Function to add a decl to the current scope level.
1413 Takes one argument, a decl to add.
1414 Returns that decl, or, if the same symbol is already declared, may
1415 return a different decl for that name. */
f837a861 1416extern tree pushdecl PROTO((tree));
8da1b058 1417/* Function to return the chain of decls so far in the current scope level. */
f837a861 1418extern tree getdecls PROTO((void));
8da1b058 1419/* Function to return the chain of structure tags in the current scope level. */
f837a861 1420extern tree gettags PROTO((void));
This page took 0.247493 seconds and 5 git commands to generate.