1217309Snwhitehorn/* This file contains the definitions and documentation for the
2251843Sbapt   tree codes used in GCC.
3217309Snwhitehorn   Copyright (C) 1987, 1988, 1993, 1995, 1997, 1998, 2000, 2001, 2004, 2005
4220749Snwhitehorn   Free Software Foundation, Inc.
5217309Snwhitehorn
6251843SbaptThis file is part of GCC.
7217309Snwhitehorn
8217309SnwhitehornGCC is free software; you can redistribute it and/or modify it under
9217309Snwhitehornthe terms of the GNU General Public License as published by the Free
10217309SnwhitehornSoftware Foundation; either version 2, or (at your option) any later
11217309Snwhitehornversion.
12217309Snwhitehorn
13217309SnwhitehornGCC is distributed in the hope that it will be useful, but WITHOUT ANY
14217309SnwhitehornWARRANTY; without even the implied warranty of MERCHANTABILITY or
15217309SnwhitehornFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16217309Snwhitehornfor more details.
17217309Snwhitehorn
18217309SnwhitehornYou should have received a copy of the GNU General Public License
19217309Snwhitehornalong with GCC; see the file COPYING.  If not, write to the Free
20217309SnwhitehornSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
21217309Snwhitehorn02110-1301, USA.  */
22217309Snwhitehorn
23217309Snwhitehorn
24217309Snwhitehorn/* For tcc_references, tcc_expression, tcc_comparison, tcc_unary,
25217309Snwhitehorn   tcc_binary, and tcc_statement nodes, which use struct tree_exp, the
26217309Snwhitehorn   4th element is the number of argument slots to allocate.  This
27217309Snwhitehorn   determines the size of the tree node object.  Other nodes use
28217309Snwhitehorn   different structures, and the size is determined by the tree_union
29217309Snwhitehorn   member structure; the 4th element should be zero.  Languages that
30217309Snwhitehorn   define language-specific tcc_exceptional or tcc_constant codes must
31217309Snwhitehorn   define the tree_size langhook to say how big they are.
32217309Snwhitehorn
33217309Snwhitehorn   These tree codes have been sorted so that the macros in tree.h that
34217309Snwhitehorn   check for various tree codes are optimized into range checks.  This
35217309Snwhitehorn   gives a measurable performance improvement.  When adding a new
36217309Snwhitehorn   code, consider its placement in relation to the other codes.  */
37217309Snwhitehorn
38217309Snwhitehorn/* Any erroneous construct is parsed into a node of this type.
39217309Snwhitehorn   This type of node is accepted without complaint in all contexts
40217309Snwhitehorn   by later parsing activities, to avoid multiple error messages
41217309Snwhitehorn   for one error.
42217309Snwhitehorn   No fields in these nodes are used except the TREE_CODE.  */
43217309SnwhitehornDEFTREECODE (ERROR_MARK, "error_mark", tcc_exceptional, 0)
44217309Snwhitehorn
45217309Snwhitehorn/* Used to represent a name (such as, in the DECL_NAME of a decl node).
46217309Snwhitehorn   Internally it looks like a STRING_CST node.
47217309Snwhitehorn   There is only one IDENTIFIER_NODE ever made for any particular name.
48217309Snwhitehorn   Use `get_identifier' to get it (or create it, the first time).  */
49217309SnwhitehornDEFTREECODE (IDENTIFIER_NODE, "identifier_node", tcc_exceptional, 0)
50217309Snwhitehorn
51217309Snwhitehorn/* Has the TREE_VALUE and TREE_PURPOSE fields.  */
52217309Snwhitehorn/* These nodes are made into lists by chaining through the
53217309Snwhitehorn   TREE_CHAIN field.  The elements of the list live in the
54217309Snwhitehorn   TREE_VALUE fields, while TREE_PURPOSE fields are occasionally
55217309Snwhitehorn   used as well to get the effect of Lisp association lists.  */
56217309SnwhitehornDEFTREECODE (TREE_LIST, "tree_list", tcc_exceptional, 0)
57217309Snwhitehorn
58217309Snwhitehorn/* These nodes contain an array of tree nodes.  */
59217309SnwhitehornDEFTREECODE (TREE_VEC, "tree_vec", tcc_exceptional, 0)
60217309Snwhitehorn
61217309Snwhitehorn/* A symbol binding block.  These are arranged in a tree,
62217309Snwhitehorn   where the BLOCK_SUBBLOCKS field contains a chain of subblocks
63217309Snwhitehorn   chained through the BLOCK_CHAIN field.
64217309Snwhitehorn   BLOCK_SUPERCONTEXT points to the parent block.
65217309Snwhitehorn     For a block which represents the outermost scope of a function, it
66217309Snwhitehorn     points to the FUNCTION_DECL node.
67217309Snwhitehorn   BLOCK_VARS points to a chain of decl nodes.
68217309Snwhitehorn   BLOCK_TYPE_TAGS points to a chain of types which have their own names.
69217309Snwhitehorn   BLOCK_CHAIN points to the next BLOCK at the same level.
70217309Snwhitehorn   BLOCK_ABSTRACT_ORIGIN points to the original (abstract) tree node which
71217309Snwhitehorn   this block is an instance of, or else is NULL to indicate that this
72217309Snwhitehorn   block is not an instance of anything else.  When non-NULL, the value
73217309Snwhitehorn   could either point to another BLOCK node or it could point to a
74217309Snwhitehorn   FUNCTION_DECL node (e.g. in the case of a block representing the
75217309Snwhitehorn   outermost scope of a particular inlining of a function).
76217309Snwhitehorn   BLOCK_ABSTRACT is nonzero if the block represents an abstract
77217309Snwhitehorn   instance of a block (i.e. one which is nested within an abstract
78217309Snwhitehorn   instance of an inline function).
79217309Snwhitehorn   TREE_ASM_WRITTEN is nonzero if the block was actually referenced
80217309Snwhitehorn   in the generated assembly.  */
81217309SnwhitehornDEFTREECODE (BLOCK, "block", tcc_exceptional, 0)
82217309Snwhitehorn
83217309Snwhitehorn/* Each data type is represented by a tree node whose code is one of
84217309Snwhitehorn   the following:  */
85217309Snwhitehorn/* Each node that represents a data type has a component TYPE_SIZE
86217309Snwhitehorn   containing a tree that is an expression for the size in bits.
87217309Snwhitehorn   The TYPE_MODE contains the machine mode for values of this type.
88217309Snwhitehorn   The TYPE_POINTER_TO field contains a type for a pointer to this type,
89217309Snwhitehorn     or zero if no such has been created yet.
90217309Snwhitehorn   The TYPE_NEXT_VARIANT field is used to chain together types
91217309Snwhitehorn     that are variants made by type modifiers such as "const" and "volatile".
92217309Snwhitehorn   The TYPE_MAIN_VARIANT field, in any member of such a chain,
93217309Snwhitehorn     points to the start of the chain.
94217309Snwhitehorn   The TYPE_NONCOPIED_PARTS field is a list specifying which parts
95217309Snwhitehorn     of an object of this type should *not* be copied by assignment.
96217309Snwhitehorn     The TREE_VALUE of each is a FIELD_DECL that should not be
97217309Snwhitehorn     copied.  The TREE_PURPOSE is an initial value for that field when
98217309Snwhitehorn     an object of this type is initialized via an INIT_EXPR.  It may
99217309Snwhitehorn     be NULL if no special value is required.  Even the things in this
100217309Snwhitehorn     list are copied if the right-hand side of an assignment is known
101217309Snwhitehorn     to be a complete object (rather than being, perhaps, a subobject
102217309Snwhitehorn     of some other object.)  The determination of what constitutes a
103217309Snwhitehorn     complete object is done by fixed_type_p.
104217309Snwhitehorn   The TYPE_NAME field contains info on the name used in the program
105217309Snwhitehorn     for this type (for GDB symbol table output).  It is either a
106217309Snwhitehorn     TYPE_DECL node, for types that are typedefs, or an IDENTIFIER_NODE
107217309Snwhitehorn     in the case of structs, unions or enums that are known with a tag,
108217309Snwhitehorn     or zero for types that have no special name.
109217309Snwhitehorn   The TYPE_CONTEXT for any sort of type which could have a name or
110217309Snwhitehorn    which could have named members (e.g. tagged types in C/C++) will
111217309Snwhitehorn    point to the node which represents the scope of the given type, or
112217309Snwhitehorn    will be NULL_TREE if the type has "file scope".  For most types, this
113217309Snwhitehorn    will point to a BLOCK node or a FUNCTION_DECL node, but it could also
114217309Snwhitehorn    point to a FUNCTION_TYPE node (for types whose scope is limited to the
115217309Snwhitehorn    formal parameter list of some function type specification) or it
116217309Snwhitehorn    could point to a RECORD_TYPE, UNION_TYPE or QUAL_UNION_TYPE node
117217309Snwhitehorn    (for C++ "member" types).
118217309Snwhitehorn    For non-tagged-types, TYPE_CONTEXT need not be set to anything in
119217309Snwhitehorn    particular, since any type which is of some type category  (e.g.
120217309Snwhitehorn    an array type or a function type) which cannot either have a name
121217309Snwhitehorn    itself or have named members doesn't really have a "scope" per se.
122220749Snwhitehorn  The TREE_CHAIN field is used as a forward-references to names for
123220749Snwhitehorn    ENUMERAL_TYPE, RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE nodes;
124217309Snwhitehorn    see below.  */
125220749Snwhitehorn
126220749Snwhitehorn/* The ordering of the following codes is optimized for the checking
127220749Snwhitehorn   macros in tree.h.  Changing the order will degrade the speed of the
128220749Snwhitehorn   compiler.  OFFSET_TYPE, ENUMERAL_TYPE, BOOLEAN_TYPE, CHAR_TYPE,
129220749Snwhitehorn   INTEGER_TYPE, REAL_TYPE, POINTER_TYPE.  */
130220749Snwhitehorn     
131220749Snwhitehorn/* An offset is a pointer relative to an object.
132220749Snwhitehorn   The TREE_TYPE field is the type of the object at the offset.
133220749Snwhitehorn   The TYPE_OFFSET_BASETYPE points to the node for the type of object
134220749Snwhitehorn   that the offset is relative to.  */
135220749SnwhitehornDEFTREECODE (OFFSET_TYPE, "offset_type", tcc_type, 0)
136220749Snwhitehorn
137220749Snwhitehorn/* C enums.  The type node looks just like an INTEGER_TYPE node.
138220749Snwhitehorn   The symbols for the values of the enum type are defined by
139220749Snwhitehorn   CONST_DECL nodes, but the type does not point to them;
140220749Snwhitehorn   however, the TYPE_VALUES is a list in which each element's TREE_PURPOSE
141220749Snwhitehorn   is a name and the TREE_VALUE is the value (an INTEGER_CST node).  */
142220749Snwhitehorn/* A forward reference `enum foo' when no enum named foo is defined yet
143220749Snwhitehorn   has zero (a null pointer) in its TYPE_SIZE.  The tag name is in
144220749Snwhitehorn   the TYPE_NAME field.  If the type is later defined, the normal
145220749Snwhitehorn   fields are filled in.
146220749Snwhitehorn   RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE forward refs are
147220749Snwhitehorn   treated similarly.  */
148220749SnwhitehornDEFTREECODE (ENUMERAL_TYPE, "enumeral_type", tcc_type, 0)
149220749Snwhitehorn
150220749Snwhitehorn/* Boolean type (true or false are the only values).  Looks like an
151220749Snwhitehorn   INTEGRAL_TYPE.  */
152220749SnwhitehornDEFTREECODE (BOOLEAN_TYPE, "boolean_type", tcc_type, 0)
153220749Snwhitehorn
154220749Snwhitehorn/* CHAR in Java; not used in C.  Looks like an INTEGRAL_TYPE.  */
155220749SnwhitehornDEFTREECODE (CHAR_TYPE, "char_type", tcc_type, 0)
156220749Snwhitehorn
157220749Snwhitehorn/* Integer types in all languages, including char in C.
158220749Snwhitehorn   Also used for sub-ranges of other discrete types.
159220749Snwhitehorn   Has components TYPE_MIN_VALUE, TYPE_MAX_VALUE (expressions, inclusive)
160220749Snwhitehorn   and TYPE_PRECISION (number of bits used by this type).
161220749Snwhitehorn   In the case of a subrange type in Pascal, the TREE_TYPE
162220749Snwhitehorn   of this will point at the supertype (another INTEGER_TYPE,
163220749Snwhitehorn   or an ENUMERAL_TYPE, CHAR_TYPE, or BOOLEAN_TYPE).
164220749Snwhitehorn   Otherwise, the TREE_TYPE is zero.  */
165220749SnwhitehornDEFTREECODE (INTEGER_TYPE, "integer_type", tcc_type, 0)
166220749Snwhitehorn
167220749Snwhitehorn/* C's float and double.  Different floating types are distinguished
168220749Snwhitehorn   by machine mode and by the TYPE_SIZE and the TYPE_PRECISION.  */
169220749SnwhitehornDEFTREECODE (REAL_TYPE, "real_type", tcc_type, 0)
170220749Snwhitehorn
171220749Snwhitehorn/* The ordering of the following codes is optimized for the checking
172220749Snwhitehorn   macros in tree.h.  Changing the order will degrade the speed of the
173220749Snwhitehorn   compiler.  POINTER_TYPE, REFERENCE_TYPE.  Note that this range
174220749Snwhitehorn   overlaps the previous range of ordered types.  */
175220749Snwhitehorn     
176220749Snwhitehorn/* All pointer-to-x types have code POINTER_TYPE.
177217309Snwhitehorn   The TREE_TYPE points to the node for the type pointed to.  */
178220749SnwhitehornDEFTREECODE (POINTER_TYPE, "pointer_type", tcc_type, 0)
179217309Snwhitehorn
180220749Snwhitehorn/* A reference is like a pointer except that it is coerced
181217309Snwhitehorn   automatically to the value it points to.  Used in C++.  */
182217309SnwhitehornDEFTREECODE (REFERENCE_TYPE, "reference_type", tcc_type, 0)
183220749Snwhitehorn
184220749Snwhitehorn/* The ordering of the following codes is optimized for the checking
185220749Snwhitehorn   macros in tree.h.  Changing the order will degrade the speed of the
186220749Snwhitehorn   compiler.  COMPLEX_TYPE, VECTOR_TYPE, ARRAY_TYPE.  */
187217309Snwhitehorn     
188220749Snwhitehorn/* Complex number types.  The TREE_TYPE field is the data type
189220749Snwhitehorn   of the real and imaginary parts.  */
190217309SnwhitehornDEFTREECODE (COMPLEX_TYPE, "complex_type", tcc_type, 0)
191220749Snwhitehorn
192220749Snwhitehorn/* Vector types.  The TREE_TYPE field is the data type of the vector
193220749Snwhitehorn   elements.  The TYPE_PRECISION field is the number of subparts of
194220749Snwhitehorn   the vector.  */
195220749SnwhitehornDEFTREECODE (VECTOR_TYPE, "vector_type", tcc_type, 0)
196220749Snwhitehorn
197220749Snwhitehorn/* The ordering of the following codes is optimized for the checking
198220749Snwhitehorn   macros in tree.h.  Changing the order will degrade the speed of the
199220749Snwhitehorn   compiler.  ARRAY_TYPE, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE.
200220749Snwhitehorn   Note that this range overlaps the previous range.  */
201220749Snwhitehorn     
202220749Snwhitehorn/* Types of arrays.  Special fields:
203220749Snwhitehorn   TREE_TYPE		  Type of an array element.
204220749Snwhitehorn   TYPE_DOMAIN		  Type to index by.
205220749Snwhitehorn			    Its range of values specifies the array length.
206220749Snwhitehorn The field TYPE_POINTER_TO (TREE_TYPE (array_type)) is always nonzero
207220749Snwhitehorn and holds the type to coerce a value of that array type to in C.
208220749Snwhitehorn TYPE_STRING_FLAG indicates a string (in contrast to an array of chars)
209220749Snwhitehorn in languages (such as Chill) that make a distinction.  */
210220749Snwhitehorn/* Array types in C or Pascal */
211220749SnwhitehornDEFTREECODE (ARRAY_TYPE, "array_type", tcc_type, 0)
212220749Snwhitehorn
213220749Snwhitehorn/* Struct in C, or record in Pascal.  */
214220749Snwhitehorn/* Special fields:
215220749Snwhitehorn   TYPE_FIELDS  chain of FIELD_DECLs for the fields of the struct,
216220749Snwhitehorn     and VAR_DECLs, TYPE_DECLs and CONST_DECLs for record-scope variables,
217220749Snwhitehorn     types and enumerators.
218220749Snwhitehorn   A few may need to be added for Pascal.  */
219220749Snwhitehorn/* See the comment above, before ENUMERAL_TYPE, for how
220220749Snwhitehorn   forward references to struct tags are handled in C.  */
221217309SnwhitehornDEFTREECODE (RECORD_TYPE, "record_type", tcc_type, 0)
222217309Snwhitehorn
223217309Snwhitehorn/* Union in C.  Like a struct, except that the offsets of the fields
224217309Snwhitehorn   will all be zero.  */
225217309Snwhitehorn/* See the comment above, before ENUMERAL_TYPE, for how
226217309Snwhitehorn   forward references to union tags are handled in C.  */
227217309SnwhitehornDEFTREECODE (UNION_TYPE, "union_type", tcc_type, 0)	/* C union type */
228217309Snwhitehorn
229217309Snwhitehorn/* Similar to UNION_TYPE, except that the expressions in DECL_QUALIFIER
230220749Snwhitehorn   in each FIELD_DECL determine what the union contains.  The first
231220749Snwhitehorn   field whose DECL_QUALIFIER expression is true is deemed to occupy
232220749Snwhitehorn   the union.  */
233220749SnwhitehornDEFTREECODE (QUAL_UNION_TYPE, "qual_union_type", tcc_type, 0)
234220749Snwhitehorn
235220749Snwhitehorn/* The ordering of the following codes is optimized for the checking
236220749Snwhitehorn   macros in tree.h.  Changing the order will degrade the speed of the
237217309Snwhitehorn   compiler.  VOID_TYPE, FUNCTION_TYPE, METHOD_TYPE.  */
238220749Snwhitehorn     
239220749Snwhitehorn/* The void type in C */
240217309SnwhitehornDEFTREECODE (VOID_TYPE, "void_type", tcc_type, 0)
241217309Snwhitehorn
242217309Snwhitehorn/* Type of functions.  Special fields:
243217309Snwhitehorn   TREE_TYPE		    type of value returned.
244217309Snwhitehorn   TYPE_ARG_TYPES      list of types of arguments expected.
245217309Snwhitehorn	this list is made of TREE_LIST nodes.
246217309Snwhitehorn   Types of "Procedures" in languages where they are different from functions
247217309Snwhitehorn   have code FUNCTION_TYPE also, but then TREE_TYPE is zero or void type.  */
248217309SnwhitehornDEFTREECODE (FUNCTION_TYPE, "function_type", tcc_type, 0)
249217309Snwhitehorn
250217309Snwhitehorn/* METHOD_TYPE is the type of a function which takes an extra first
251217309Snwhitehorn   argument for "self", which is not present in the declared argument list.
252217309Snwhitehorn   The TREE_TYPE is the return type of the method.  The TYPE_METHOD_BASETYPE
253217309Snwhitehorn   is the type of "self".  TYPE_ARG_TYPES is the real argument list, which
254217309Snwhitehorn   includes the hidden argument for "self".  */
255217309SnwhitehornDEFTREECODE (METHOD_TYPE, "method_type", tcc_type, 0)
256217309Snwhitehorn
257217309Snwhitehorn/* This is a language-specific kind of type.
258217309Snwhitehorn   Its meaning is defined by the language front end.
259217309Snwhitehorn   layout_type does not know how to lay this out,
260217309Snwhitehorn   so the front-end must do so manually.  */
261217309SnwhitehornDEFTREECODE (LANG_TYPE, "lang_type", tcc_type, 0)
262217309Snwhitehorn
263217309Snwhitehorn/* Expressions */
264217309Snwhitehorn
265217309Snwhitehorn/* First, the constants.  */
266217309Snwhitehorn
267217309Snwhitehorn/* Contents are in TREE_INT_CST_LOW and TREE_INT_CST_HIGH fields,
268217309Snwhitehorn   32 bits each, giving us a 64 bit constant capability.  INTEGER_CST
269217309Snwhitehorn   nodes can be shared, and therefore should be considered read only.
270217309Snwhitehorn   They should be copied, before setting a flag such as
271217309Snwhitehorn   TREE_OVERFLOW.  If an INTEGER_CST has TREE_OVERFLOW or
272217309Snwhitehorn   TREE_CONSTANT_OVERFLOW already set, it is known to be unique.
273217309Snwhitehorn   INTEGER_CST nodes are created for the integral types, for pointer
274217309Snwhitehorn   types and for vector and float types in some circumstances.  */
275217309SnwhitehornDEFTREECODE (INTEGER_CST, "integer_cst", tcc_constant, 0)
276217309Snwhitehorn
277217309Snwhitehorn/* Contents are in TREE_REAL_CST field.  */
278217309SnwhitehornDEFTREECODE (REAL_CST, "real_cst", tcc_constant, 0)
279217309Snwhitehorn
280217309Snwhitehorn/* Contents are in TREE_REALPART and TREE_IMAGPART fields,
281217309Snwhitehorn   whose contents are other constant nodes.  */
282217309SnwhitehornDEFTREECODE (COMPLEX_CST, "complex_cst", tcc_constant, 0)
283217309Snwhitehorn
284217309Snwhitehorn/* Contents are in TREE_VECTOR_CST_ELTS field.  */
285217309SnwhitehornDEFTREECODE (VECTOR_CST, "vector_cst", tcc_constant, 0)
286217309Snwhitehorn
287251843Sbapt/* Contents are TREE_STRING_LENGTH and the actual contents of the string.  */
288251843SbaptDEFTREECODE (STRING_CST, "string_cst", tcc_constant, 0)
289251843Sbapt
290251843Sbapt/* Declarations.  All references to names are represented as ..._DECL
291251843Sbapt   nodes.  The decls in one binding context are chained through the
292251843Sbapt   TREE_CHAIN field.  Each DECL has a DECL_NAME field which contains
293251843Sbapt   an IDENTIFIER_NODE.  (Some decls, most often labels, may have zero
294251843Sbapt   as the DECL_NAME).  DECL_CONTEXT points to the node representing
295251843Sbapt   the context in which this declaration has its scope.  For
296251843Sbapt   FIELD_DECLs, this is the RECORD_TYPE, UNION_TYPE, or
297251843Sbapt   QUAL_UNION_TYPE node that the field is a member of.  For VAR_DECL,
298251843Sbapt   PARM_DECL, FUNCTION_DECL, LABEL_DECL, and CONST_DECL nodes, this
299251843Sbapt   points to either the FUNCTION_DECL for the containing function, the
300251843Sbapt   RECORD_TYPE or UNION_TYPE for the containing type, or NULL_TREE or
301251843Sbapt   a TRANSLATION_UNIT_DECL if the given decl has "file scope".
302251843Sbapt   DECL_ABSTRACT_ORIGIN, if non-NULL, points to the original (abstract)
303251843Sbapt    ..._DECL node of which this decl is an (inlined or template expanded)
304251843Sbapt    instance.
305251843Sbapt   The TREE_TYPE field holds the data type of the object, when relevant.
306251843Sbapt    LABEL_DECLs have no data type.  For TYPE_DECL, the TREE_TYPE field
307251843Sbapt    contents are the type whose name is being declared.
308251843Sbapt   The DECL_ALIGN, DECL_SIZE,
309251843Sbapt    and DECL_MODE fields exist in decl nodes just as in type nodes.
310251843Sbapt    They are unused in LABEL_DECL, TYPE_DECL and CONST_DECL nodes.
311251843Sbapt
312251843Sbapt   DECL_FIELD_BIT_OFFSET holds an integer number of bits offset for
313251843Sbapt   the location.  DECL_VOFFSET holds an expression for a variable
314251843Sbapt   offset; it is to be multiplied by DECL_VOFFSET_UNIT (an integer).
315251843Sbapt   These fields are relevant only in FIELD_DECLs and PARM_DECLs.
316251843Sbapt
317217309Snwhitehorn   DECL_INITIAL holds the value to initialize a variable to,
318217309Snwhitehorn   or the value of a constant.  For a function, it holds the body
319217309Snwhitehorn   (a node of type BLOCK representing the function's binding contour
320217309Snwhitehorn   and whose body contains the function's statements.)  For a LABEL_DECL
321217309Snwhitehorn   in C, it is a flag, nonzero if the label's definition has been seen.
322217309Snwhitehorn
323217309Snwhitehorn   PARM_DECLs use a special field:
324217309Snwhitehorn   DECL_ARG_TYPE is the type in which the argument is actually
325217309Snwhitehorn    passed, which may be different from its type within the function.
326217309Snwhitehorn
327251843Sbapt   FUNCTION_DECLs use four special fields:
328217309Snwhitehorn   DECL_ARGUMENTS holds a chain of PARM_DECL nodes for the arguments.
329217309Snwhitehorn   DECL_RESULT holds a RESULT_DECL node for the value of a function.
330217309Snwhitehorn    The DECL_RTL field is 0 for a function that returns no value.
331217309Snwhitehorn    (C functions returning void have zero here.)
332217309Snwhitehorn    The TREE_TYPE field is the type in which the result is actually
333217309Snwhitehorn    returned.  This is usually the same as the return type of the
334220749Snwhitehorn    FUNCTION_DECL, but it may be a wider integer type because of
335220749Snwhitehorn    promotion.
336220749Snwhitehorn   DECL_FUNCTION_CODE is a code number that is nonzero for
337220749Snwhitehorn    built-in functions.  Its value is an enum built_in_function
338220749Snwhitehorn    that says which built-in function it is.
339220749Snwhitehorn
340220749Snwhitehorn   DECL_SOURCE_FILE holds a filename string and DECL_SOURCE_LINE
341220749Snwhitehorn   holds a line number.  In some cases these can be the location of
342220749Snwhitehorn   a reference, if no definition has been seen.
343220749Snwhitehorn
344220749Snwhitehorn   DECL_ABSTRACT is nonzero if the decl represents an abstract instance
345220749Snwhitehorn   of a decl (i.e. one which is nested within an abstract instance of a
346220749Snwhitehorn   inline function.  */
347220749Snwhitehorn
348220749SnwhitehornDEFTREECODE (FUNCTION_DECL, "function_decl", tcc_declaration, 0)
349220749SnwhitehornDEFTREECODE (LABEL_DECL, "label_decl", tcc_declaration, 0)
350220749Snwhitehorn/* The ordering of the following codes is optimized for the checking
351220749Snwhitehorn   macros in tree.h.  Changing the order will degrade the speed of the
352220749Snwhitehorn   compiler.  FIELD_DECL, VAR_DECL, CONST_DECL, PARM_DECL,
353220749Snwhitehorn   TYPE_DECL.  */
354220749SnwhitehornDEFTREECODE (FIELD_DECL, "field_decl", tcc_declaration, 0)
355220749SnwhitehornDEFTREECODE (VAR_DECL, "var_decl", tcc_declaration, 0)
356220749SnwhitehornDEFTREECODE (CONST_DECL, "const_decl", tcc_declaration, 0)
357220749SnwhitehornDEFTREECODE (PARM_DECL, "parm_decl", tcc_declaration, 0)
358220749SnwhitehornDEFTREECODE (TYPE_DECL, "type_decl", tcc_declaration, 0)
359220749SnwhitehornDEFTREECODE (RESULT_DECL, "result_decl", tcc_declaration, 0)
360220749Snwhitehorn
361220749Snwhitehorn/* A namespace declaration.  Namespaces appear in DECL_CONTEXT of other
362220749Snwhitehorn   _DECLs, providing a hierarchy of names.  */
363220749SnwhitehornDEFTREECODE (NAMESPACE_DECL, "namespace_decl", tcc_declaration, 0)
364220749Snwhitehorn
365220749Snwhitehorn/* A translation unit.  This is not technically a declaration, since it
366220749Snwhitehorn   can't be looked up, but it's close enough.  */
367220749SnwhitehornDEFTREECODE (TRANSLATION_UNIT_DECL, "translation_unit_decl",\
368220749Snwhitehorn	     tcc_declaration, 0)
369220749Snwhitehorn
370220749Snwhitehorn/* References to storage.  */
371220749Snwhitehorn
372220749Snwhitehorn/* Value is structure or union component.
373220749Snwhitehorn   Operand 0 is the structure or union (an expression).
374220749Snwhitehorn   Operand 1 is the field (a node of type FIELD_DECL).
375220749Snwhitehorn   Operand 2, if present, is the value of DECL_FIELD_OFFSET, measured
376220749Snwhitehorn   in units of DECL_OFFSET_ALIGN / BITS_PER_UNIT.  */
377220749SnwhitehornDEFTREECODE (COMPONENT_REF, "component_ref", tcc_reference, 3)
378220749Snwhitehorn
379220749Snwhitehorn/* Reference to a group of bits within an object.  Similar to COMPONENT_REF
380220749Snwhitehorn   except the position is given explicitly rather than via a FIELD_DECL.
381220749Snwhitehorn   Operand 0 is the structure or union expression;
382220749Snwhitehorn   operand 1 is a tree giving the number of bits being referenced;
383220749Snwhitehorn   operand 2 is a tree giving the position of the first referenced bit.
384220749Snwhitehorn   The field can be either a signed or unsigned field;
385220749Snwhitehorn   BIT_FIELD_REF_UNSIGNED says which.  */
386220749SnwhitehornDEFTREECODE (BIT_FIELD_REF, "bit_field_ref", tcc_reference, 3)
387220749Snwhitehorn
388220749Snwhitehorn/* The ordering of the following codes is optimized for the checking
389220749Snwhitehorn   macros in tree.h.  Changing the order will degrade the speed of the
390220749Snwhitehorn   compiler.  INDIRECT_REF, ALIGN_INDIRECT_REF, MISALIGNED_INDIRECT_REF.  */
391220749Snwhitehorn
392220749Snwhitehorn/* C unary `*' or Pascal `^'.  One operand, an expression for a pointer.  */
393220749SnwhitehornDEFTREECODE (INDIRECT_REF, "indirect_ref", tcc_reference, 1)
394220749Snwhitehorn
395220749Snwhitehorn/* Like above, but aligns the referenced address (i.e, if the address
396220749Snwhitehorn   in P is not aligned on TYPE_ALIGN boundary, then &(*P) != P).  */
397220749SnwhitehornDEFTREECODE (ALIGN_INDIRECT_REF, "align_indirect_ref", tcc_reference, 1)
398220749Snwhitehorn
399220749Snwhitehorn/* Same as INDIRECT_REF, but also specifies the alignment of the referenced
400220749Snwhitehorn   address:
401220749Snwhitehorn   Operand 0 is the referenced address (a pointer);
402220749Snwhitehorn   Operand 1 is an INTEGER_CST which represents the alignment of the address,
403220749Snwhitehorn   or 0 if the alignment is unknown.  */
404220749SnwhitehornDEFTREECODE (MISALIGNED_INDIRECT_REF, "misaligned_indirect_ref", tcc_reference, 2)
405220749Snwhitehorn
406220749Snwhitehorn/* Array indexing.
407220749Snwhitehorn   Operand 0 is the array; operand 1 is a (single) array index.
408220749Snwhitehorn   Operand 2, if present, is a copy of TYPE_MIN_VALUE of the index.
409220749Snwhitehorn   Operand 3, if present, is the element size, measured in units of
410220749Snwhitehorn   the alignment of the element type.  */
411220749SnwhitehornDEFTREECODE (ARRAY_REF, "array_ref", tcc_reference, 4)
412220749Snwhitehorn
413220749Snwhitehorn/* Likewise, except that the result is a range ("slice") of the array.  The
414220749Snwhitehorn   starting index of the resulting array is taken from operand 1 and the size
415220749Snwhitehorn   of the range is taken from the type of the expression.  */
416220749SnwhitehornDEFTREECODE (ARRAY_RANGE_REF, "array_range_ref", tcc_reference, 4)
417224014Snwhitehorn
418224014Snwhitehorn/* Used to represent lookup of runtime type dependent data.  Often this is
419224014Snwhitehorn   a reference to a vtable, but it needn't be.  Operands are:
420217309Snwhitehorn   OBJ_TYPE_REF_EXPR: An expression that evaluates the value to use.
421217309Snwhitehorn   OBJ_TYPE_REF_OBJECT: Is the object on whose behalf the lookup is
422217309Snwhitehorn   being performed.  Through this the optimizers may be able to statically
423217309Snwhitehorn   determine the dynamic type of the object.
424217309Snwhitehorn   OBJ_TYPE_REF_TOKEN: Something front-end specific used to resolve the
425217309Snwhitehorn   reference to something simpler, usually to the address of a DECL.
426217309Snwhitehorn   Never touched by the middle-end.  Good choices would be either an
427217309Snwhitehorn   identifier or a vtable index.  */
428217309SnwhitehornDEFTREECODE (OBJ_TYPE_REF, "obj_type_ref", tcc_expression, 3)
429217309Snwhitehorn
430217309Snwhitehorn/* The exception object from the runtime.  */
431224014SnwhitehornDEFTREECODE (EXC_PTR_EXPR, "exc_ptr_expr", tcc_expression, 0)
432224014Snwhitehorn
433217309Snwhitehorn/* The filter object from the runtime.  */
434217309SnwhitehornDEFTREECODE (FILTER_EXPR, "filter_expr", tcc_expression, 0)
435217309Snwhitehorn
436220749Snwhitehorn/* Constructor: return an aggregate value made from specified components.
437220749Snwhitehorn   In C, this is used only for structure and array initializers.
438217309Snwhitehorn   The operand is a sequence of component values made out of a VEC of
439217309Snwhitehorn   struct constructor_elt.
440217309Snwhitehorn
441220749Snwhitehorn   For ARRAY_TYPE:
442217309Snwhitehorn   The field INDEX of each constructor_elt is the corresponding index.
443217309Snwhitehorn   If the index is a RANGE_EXPR, it is a short-hand for many nodes,
444217309Snwhitehorn   one for each index in the range.  (If the corresponding field VALUE
445217309Snwhitehorn   has side-effects, they are evaluated once for each element.  Wrap the
446217309Snwhitehorn   value in a SAVE_EXPR if you want to evaluate side effects only once.)
447224014Snwhitehorn
448224014Snwhitehorn   For RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE:
449217309Snwhitehorn   The field INDEX of each node is a FIELD_DECL.  */
450220749SnwhitehornDEFTREECODE (CONSTRUCTOR, "constructor", tcc_exceptional, 0)
451217309Snwhitehorn
452220749Snwhitehorn/* The expression types are mostly straightforward, with the fourth argument
453217309Snwhitehorn   of DEFTREECODE saying how many operands there are.
454217309Snwhitehorn   Unless otherwise specified, the operands are expressions and the
455217309Snwhitehorn   types of all the operands and the expression must all be the same.  */
456217309Snwhitehorn
457217309Snwhitehorn/* Contains two expressions to compute, one followed by the other.
458224014Snwhitehorn   the first value is ignored.  The second one's value is used.  The
459224014Snwhitehorn   type of the first expression need not agree with the other types.  */
460224014SnwhitehornDEFTREECODE (COMPOUND_EXPR, "compound_expr", tcc_expression, 2)
461217309Snwhitehorn
462217309Snwhitehorn/* Assignment expression.  Operand 0 is the what to set; 1, the new value.  */
463217309SnwhitehornDEFTREECODE (MODIFY_EXPR, "modify_expr", tcc_expression, 2)
464217309Snwhitehorn
465217309Snwhitehorn/* Initialization expression.  Operand 0 is the variable to initialize;
466224014Snwhitehorn   Operand 1 is the initializer.  This differs from MODIFY_EXPR in that any
467224014Snwhitehorn   reference to the referent of operand 0 within operand 1 is undefined.  */
468224014SnwhitehornDEFTREECODE (INIT_EXPR, "init_expr", tcc_expression, 2)
469224014Snwhitehorn
470224014Snwhitehorn/* For TARGET_EXPR, operand 0 is the target of an initialization,
471224014Snwhitehorn   operand 1 is the initializer for the target, which may be void
472224014Snwhitehorn     if simply expanding it initializes the target.
473251843Sbapt   operand 2 is the cleanup for this node, if any.
474251843Sbapt   operand 3 is the saved initializer after this node has been
475251843Sbapt   expanded once; this is so we can re-expand the tree later.  */
476224014SnwhitehornDEFTREECODE (TARGET_EXPR, "target_expr", tcc_expression, 4)
477224014Snwhitehorn
478224014Snwhitehorn/* Conditional expression ( ... ? ... : ...  in C).
479224014Snwhitehorn   Operand 0 is the condition.
480224014Snwhitehorn   Operand 1 is the then-value.
481224014Snwhitehorn   Operand 2 is the else-value.
482224014Snwhitehorn   Operand 0 may be of any type.
483224014Snwhitehorn   Operand 1 must have the same type as the entire expression, unless
484224014Snwhitehorn   it unconditionally throws an exception, in which case it should
485224014Snwhitehorn   have VOID_TYPE.  The same constraints apply to operand 2.  */
486224014SnwhitehornDEFTREECODE (COND_EXPR, "cond_expr", tcc_expression, 3)
487224014Snwhitehorn
488220749Snwhitehorn/* Vector conditional expression. It is like COND_EXPR, but with
489224014Snwhitehorn   vector operands.
490224014Snwhitehorn
491224014Snwhitehorn   A = VEC_COND_EXPR ( X < Y, B, C)
492224014Snwhitehorn
493224014Snwhitehorn   means
494217309Snwhitehorn
495224014Snwhitehorn   for (i=0; i<N; i++)
496217309Snwhitehorn     A[i] = X[i] < Y[i] ? B[i] : C[i];
497217309Snwhitehorn*/
498224014SnwhitehornDEFTREECODE (VEC_COND_EXPR, "vec_cond_expr", tcc_expression, 3)
499224014Snwhitehorn
500224014Snwhitehorn/* Declare local variables, including making RTL and allocating space.
501224014Snwhitehorn   BIND_EXPR_VARS is a chain of VAR_DECL nodes for the variables.
502224014Snwhitehorn   BIND_EXPR_BODY is the body, the expression to be computed using
503224014Snwhitehorn   the variables.  The value of operand 1 becomes that of the BIND_EXPR.
504224014Snwhitehorn   BIND_EXPR_BLOCK is the BLOCK that corresponds to these bindings
505224014Snwhitehorn   for debugging purposes.  If this BIND_EXPR is actually expanded,
506224014Snwhitehorn   that sets the TREE_USED flag in the BLOCK.
507224014Snwhitehorn
508224014Snwhitehorn   The BIND_EXPR is not responsible for informing parsers
509224014Snwhitehorn   about these variables.  If the body is coming from the input file,
510224014Snwhitehorn   then the code that creates the BIND_EXPR is also responsible for
511224014Snwhitehorn   informing the parser of the variables.
512224014Snwhitehorn
513224014Snwhitehorn   If the BIND_EXPR is ever expanded, its TREE_USED flag is set.
514224014Snwhitehorn   This tells the code for debugging symbol tables not to ignore the BIND_EXPR.
515224014Snwhitehorn   If the BIND_EXPR should be output for debugging but will not be expanded,
516224014Snwhitehorn   set the TREE_USED flag by hand.
517224014Snwhitehorn
518224014Snwhitehorn   In order for the BIND_EXPR to be known at all, the code that creates it
519224014Snwhitehorn   must also install it as a subblock in the tree of BLOCK
520224014Snwhitehorn   nodes for the function.  */
521224014SnwhitehornDEFTREECODE (BIND_EXPR, "bind_expr", tcc_expression, 3)
522224014Snwhitehorn
523224014Snwhitehorn/* Function call.  Operand 0 is the function.
524224014Snwhitehorn   Operand 1 is the argument list, a list of expressions
525224014Snwhitehorn   made out of a chain of TREE_LIST nodes.
526224014Snwhitehorn   Operand 2 is the static chain argument, or NULL.  */
527224014SnwhitehornDEFTREECODE (CALL_EXPR, "call_expr", tcc_expression, 3)
528224014Snwhitehorn
529224014Snwhitehorn/* Specify a value to compute along with its corresponding cleanup.
530224014Snwhitehorn   Operand 0 is the cleanup expression.
531224014Snwhitehorn   The cleanup is executed by the first enclosing CLEANUP_POINT_EXPR,
532224014Snwhitehorn   which must exist.  This differs from TRY_CATCH_EXPR in that operand 1
533224014Snwhitehorn   is always evaluated when cleanups are run.  */
534224014SnwhitehornDEFTREECODE (WITH_CLEANUP_EXPR, "with_cleanup_expr", tcc_expression, 1)
535217309Snwhitehorn
536224014Snwhitehorn/* Specify a cleanup point.
537224014Snwhitehorn   Operand 0 is an expression that may have cleanups.  If it does, those
538224014Snwhitehorn   cleanups are executed after the expression is expanded.
539224014Snwhitehorn
540224014Snwhitehorn   Note that if the expression is a reference to storage, it is forced out
541224014Snwhitehorn   of memory before the cleanups are run.  This is necessary to handle
542224014Snwhitehorn   cases where the cleanups modify the storage referenced; in the
543224014Snwhitehorn   expression 't.i', if 't' is a struct with an integer member 'i' and a
544224014Snwhitehorn   cleanup which modifies 'i', the value of the expression depends on
545217309Snwhitehorn   whether the cleanup is run before or after 't.i' is evaluated.  When
546224014Snwhitehorn   expand_expr is run on 't.i', it returns a MEM.  This is not good enough;
547224014Snwhitehorn   the value of 't.i' must be forced out of memory.
548224014Snwhitehorn
549224014Snwhitehorn   As a consequence, the operand of a CLEANUP_POINT_EXPR must not have
550224014Snwhitehorn   BLKmode, because it will not be forced out of memory.  */
551217309SnwhitehornDEFTREECODE (CLEANUP_POINT_EXPR, "cleanup_point_expr", tcc_expression, 1)
552224014Snwhitehorn
553224014Snwhitehorn/* The following two codes are used in languages that have types where
554224014Snwhitehorn   some field in an object of the type contains a value that is used in
555224014Snwhitehorn   the computation of another field's offset or size and/or the size of
556224014Snwhitehorn   the type.  The positions and/or sizes of fields can vary from object
557217309Snwhitehorn   to object of the same type or even for one and the same object within
558217309Snwhitehorn   its scope.
559251843Sbapt
560217309Snwhitehorn   Record types with discriminants in Ada or schema types in Pascal are
561217309Snwhitehorn   examples of such types.  This mechanism is also used to create "fat
562217309Snwhitehorn   pointers" for unconstrained array types in Ada; the fat pointer is a
563217309Snwhitehorn   structure one of whose fields is a pointer to the actual array type
564217309Snwhitehorn   and the other field is a pointer to a template, which is a structure
565217309Snwhitehorn   containing the bounds of the array.  The bounds in the type pointed
566217309Snwhitehorn   to by the first field in the fat pointer refer to the values in the
567217309Snwhitehorn   template.
568217309Snwhitehorn
569217309Snwhitehorn   When you wish to construct such a type you need "self-references"
570217309Snwhitehorn   that allow you to reference the object having this type from the
571217309Snwhitehorn   TYPE node, i.e. without having a variable instantiating this type.
572217309Snwhitehorn
573217309Snwhitehorn   Such a "self-references" is done using a PLACEHOLDER_EXPR.  This is
574217309Snwhitehorn   a node that will later be replaced with the object being referenced.
575217309Snwhitehorn   Its type is that of the object and selects which object to use from
576217309Snwhitehorn   a chain of references (see below).  No other slots are used in the
577217309Snwhitehorn   PLACEHOLDER_EXPR.
578217309Snwhitehorn
579217309Snwhitehorn   For example, if your type FOO is a RECORD_TYPE with a field BAR,
580217309Snwhitehorn   and you need the value of <variable>.BAR to calculate TYPE_SIZE
581217309Snwhitehorn   (FOO), just substitute <variable> above with a PLACEHOLDER_EXPR
582217309Snwhitehorn   whose TREE_TYPE is FOO.  Then construct your COMPONENT_REF with
583217309Snwhitehorn   the PLACEHOLDER_EXPR as the first operand (which has the correct
584217309Snwhitehorn   type).  Later, when the size is needed in the program, the back-end
585217309Snwhitehorn   will find this PLACEHOLDER_EXPR and generate code to calculate the
586217309Snwhitehorn   actual size at run-time.  In the following, we describe how this
587217309Snwhitehorn   calculation is done.
588217309Snwhitehorn
589217309Snwhitehorn   When we wish to evaluate a size or offset, we check whether it contains a
590217309Snwhitehorn   PLACEHOLDER_EXPR.  If it does, we call substitute_placeholder_in_expr
591217309Snwhitehorn   passing both that tree and an expression within which the object may be
592217309Snwhitehorn   found.  The latter expression is the object itself in the simple case of
593217309Snwhitehorn   an Ada record with discriminant, but it can be the array in the case of an
594217309Snwhitehorn   unconstrained array.
595217309Snwhitehorn
596217309Snwhitehorn   In the latter case, we need the fat pointer, because the bounds of
597217309Snwhitehorn   the array can only be accessed from it.  However, we rely here on the
598217309Snwhitehorn   fact that the expression for the array contains the dereference of
599217309Snwhitehorn   the fat pointer that obtained the array pointer.  */
600217309Snwhitehorn
601217309Snwhitehorn/* Denotes a record to later be substituted before evaluating this expression.
602217309Snwhitehorn   The type of this expression is used to find the record to replace it.  */
603217309SnwhitehornDEFTREECODE (PLACEHOLDER_EXPR, "placeholder_expr", tcc_exceptional, 0)
604217309Snwhitehorn
605217309Snwhitehorn/* Simple arithmetic.  */
606217309SnwhitehornDEFTREECODE (PLUS_EXPR, "plus_expr", tcc_binary, 2)
607217309SnwhitehornDEFTREECODE (MINUS_EXPR, "minus_expr", tcc_binary, 2)
608217309SnwhitehornDEFTREECODE (MULT_EXPR, "mult_expr", tcc_binary, 2)
609217309Snwhitehorn
610217309Snwhitehorn/* Division for integer result that rounds the quotient toward zero.  */
611217309SnwhitehornDEFTREECODE (TRUNC_DIV_EXPR, "trunc_div_expr", tcc_binary, 2)
612217309Snwhitehorn
613217309Snwhitehorn/* Division for integer result that rounds the quotient toward infinity.  */
614217309SnwhitehornDEFTREECODE (CEIL_DIV_EXPR, "ceil_div_expr", tcc_binary, 2)
615217309Snwhitehorn
616217309Snwhitehorn/* Division for integer result that rounds toward minus infinity.  */
617217309SnwhitehornDEFTREECODE (FLOOR_DIV_EXPR, "floor_div_expr", tcc_binary, 2)
618217309Snwhitehorn
619217309Snwhitehorn/* Division for integer result that rounds toward nearest integer.  */
620217309SnwhitehornDEFTREECODE (ROUND_DIV_EXPR, "round_div_expr", tcc_binary, 2)
621217309Snwhitehorn
622217309Snwhitehorn/* Four kinds of remainder that go with the four kinds of division.  */
623217309SnwhitehornDEFTREECODE (TRUNC_MOD_EXPR, "trunc_mod_expr", tcc_binary, 2)
624217309SnwhitehornDEFTREECODE (CEIL_MOD_EXPR, "ceil_mod_expr", tcc_binary, 2)
625217309SnwhitehornDEFTREECODE (FLOOR_MOD_EXPR, "floor_mod_expr", tcc_binary, 2)
626217309SnwhitehornDEFTREECODE (ROUND_MOD_EXPR, "round_mod_expr", tcc_binary, 2)
627217309Snwhitehorn
628217309Snwhitehorn/* Division for real result.  */
629217309SnwhitehornDEFTREECODE (RDIV_EXPR, "rdiv_expr", tcc_binary, 2)
630217309Snwhitehorn
631217309Snwhitehorn/* Division which is not supposed to need rounding.
632217309Snwhitehorn   Used for pointer subtraction in C.  */
633217309SnwhitehornDEFTREECODE (EXACT_DIV_EXPR, "exact_div_expr", tcc_binary, 2)
634217309Snwhitehorn
635217309Snwhitehorn/* Conversion of real to fixed point: four ways to round,
636217309Snwhitehorn   like the four ways to divide.
637217309Snwhitehorn   CONVERT_EXPR can also be used to convert a real to an integer,
638217309Snwhitehorn   and that is what is used in languages that do not have ways of
639217309Snwhitehorn   specifying which of these is wanted.  Maybe these are not needed.  */
640217309SnwhitehornDEFTREECODE (FIX_TRUNC_EXPR, "fix_trunc_expr", tcc_unary, 1)
641217309SnwhitehornDEFTREECODE (FIX_CEIL_EXPR, "fix_ceil_expr", tcc_unary, 1)
642217309SnwhitehornDEFTREECODE (FIX_FLOOR_EXPR, "fix_floor_expr", tcc_unary, 1)
643217309SnwhitehornDEFTREECODE (FIX_ROUND_EXPR, "fix_round_expr", tcc_unary, 1)
644217309Snwhitehorn
645217309Snwhitehorn/* Conversion of an integer to a real.  */
646217309SnwhitehornDEFTREECODE (FLOAT_EXPR, "float_expr", tcc_unary, 1)
647217309Snwhitehorn
648217309Snwhitehorn/* Unary negation.  */
649217309SnwhitehornDEFTREECODE (NEGATE_EXPR, "negate_expr", tcc_unary, 1)
650217309Snwhitehorn
651217309Snwhitehorn/* Minimum and maximum values.  When used with floating point, if both
652217309Snwhitehorn   operands are zeros, or if either operand is NaN, then it is unspecified
653217309Snwhitehorn   which of the two operands is returned as the result.  */
654217309SnwhitehornDEFTREECODE (MIN_EXPR, "min_expr", tcc_binary, 2)
655217309SnwhitehornDEFTREECODE (MAX_EXPR, "max_expr", tcc_binary, 2)
656217309Snwhitehorn
657217309Snwhitehorn/* Represents the absolute value of the operand.
658217309Snwhitehorn
659217309Snwhitehorn   An ABS_EXPR must have either an INTEGER_TYPE or a REAL_TYPE.  The
660   operand of the ABS_EXPR must have the same type.  */
661DEFTREECODE (ABS_EXPR, "abs_expr", tcc_unary, 1)
662
663/* Shift operations for shift and rotate.
664   Shift means logical shift if done on an
665   unsigned type, arithmetic shift if done on a signed type.
666   The second operand is the number of bits to
667   shift by; it need not be the same type as the first operand and result.
668   Note that the result is undefined if the second operand is larger
669   than or equal to the first operand's type size.  */
670DEFTREECODE (LSHIFT_EXPR, "lshift_expr", tcc_binary, 2)
671DEFTREECODE (RSHIFT_EXPR, "rshift_expr", tcc_binary, 2)
672DEFTREECODE (LROTATE_EXPR, "lrotate_expr", tcc_binary, 2)
673DEFTREECODE (RROTATE_EXPR, "rrotate_expr", tcc_binary, 2)
674
675/* Bitwise operations.  Operands have same mode as result.  */
676DEFTREECODE (BIT_IOR_EXPR, "bit_ior_expr", tcc_binary, 2)
677DEFTREECODE (BIT_XOR_EXPR, "bit_xor_expr", tcc_binary, 2)
678DEFTREECODE (BIT_AND_EXPR, "bit_and_expr", tcc_binary, 2)
679DEFTREECODE (BIT_NOT_EXPR, "bit_not_expr", tcc_unary, 1)
680
681/* ANDIF and ORIF allow the second operand not to be computed if the
682   value of the expression is determined from the first operand.  AND,
683   OR, and XOR always compute the second operand whether its value is
684   needed or not (for side effects).  The operand may have
685   BOOLEAN_TYPE or INTEGER_TYPE.  In either case, the argument will be
686   either zero or one.  For example, a TRUTH_NOT_EXPR will never have
687   an INTEGER_TYPE VAR_DECL as its argument; instead, a NE_EXPR will be
688   used to compare the VAR_DECL to zero, thereby obtaining a node with
689   value zero or one.  */
690DEFTREECODE (TRUTH_ANDIF_EXPR, "truth_andif_expr", tcc_expression, 2)
691DEFTREECODE (TRUTH_ORIF_EXPR, "truth_orif_expr", tcc_expression, 2)
692DEFTREECODE (TRUTH_AND_EXPR, "truth_and_expr", tcc_expression, 2)
693DEFTREECODE (TRUTH_OR_EXPR, "truth_or_expr", tcc_expression, 2)
694DEFTREECODE (TRUTH_XOR_EXPR, "truth_xor_expr", tcc_expression, 2)
695DEFTREECODE (TRUTH_NOT_EXPR, "truth_not_expr", tcc_expression, 1)
696
697/* Relational operators.
698   `EQ_EXPR' and `NE_EXPR' are allowed for any types.
699   The others are allowed only for integer (or pointer or enumeral)
700   or real types.
701   In all cases the operands will have the same type,
702   and the value is always the type used by the language for booleans.  */
703DEFTREECODE (LT_EXPR, "lt_expr", tcc_comparison, 2)
704DEFTREECODE (LE_EXPR, "le_expr", tcc_comparison, 2)
705DEFTREECODE (GT_EXPR, "gt_expr", tcc_comparison, 2)
706DEFTREECODE (GE_EXPR, "ge_expr", tcc_comparison, 2)
707DEFTREECODE (EQ_EXPR, "eq_expr", tcc_comparison, 2)
708DEFTREECODE (NE_EXPR, "ne_expr", tcc_comparison, 2)
709
710/* Additional relational operators for floating point unordered.  */
711DEFTREECODE (UNORDERED_EXPR, "unordered_expr", tcc_comparison, 2)
712DEFTREECODE (ORDERED_EXPR, "ordered_expr", tcc_comparison, 2)
713
714/* These are equivalent to unordered or ...  */
715DEFTREECODE (UNLT_EXPR, "unlt_expr", tcc_comparison, 2)
716DEFTREECODE (UNLE_EXPR, "unle_expr", tcc_comparison, 2)
717DEFTREECODE (UNGT_EXPR, "ungt_expr", tcc_comparison, 2)
718DEFTREECODE (UNGE_EXPR, "unge_expr", tcc_comparison, 2)
719DEFTREECODE (UNEQ_EXPR, "uneq_expr", tcc_comparison, 2)
720
721/* This is the reverse of uneq_expr.  */
722DEFTREECODE (LTGT_EXPR, "ltgt_expr", tcc_comparison, 2)
723
724DEFTREECODE (RANGE_EXPR, "range_expr", tcc_binary, 2)
725
726/* Represents a conversion of type of a value.
727   All conversions, including implicit ones, must be
728   represented by CONVERT_EXPR or NOP_EXPR nodes.  */
729DEFTREECODE (CONVERT_EXPR, "convert_expr", tcc_unary, 1)
730
731/* Represents a conversion expected to require no code to be generated.  */
732DEFTREECODE (NOP_EXPR, "nop_expr", tcc_unary, 1)
733
734/* Value is same as argument, but guaranteed not an lvalue.  */
735DEFTREECODE (NON_LVALUE_EXPR, "non_lvalue_expr", tcc_unary, 1)
736
737/* Represents viewing something of one type as being of a second type.
738   This corresponds to an "Unchecked Conversion" in Ada and roughly to
739   the idiom *(type2 *)&X in C.  The only operand is the value to be
740   viewed as being of another type.  It is undefined if the type of the
741   input and of the expression have different sizes.
742
743   This code may also be used within the LHS of a MODIFY_EXPR, in which
744   case no actual data motion may occur.  TREE_ADDRESSABLE will be set in
745   this case and GCC must abort if it could not do the operation without
746   generating insns.  */
747DEFTREECODE (VIEW_CONVERT_EXPR, "view_convert_expr", tcc_reference, 1)
748
749/* Represents something we computed once and will use multiple times.
750   First operand is that expression.  After it is evaluated once, it
751   will be replaced by the temporary variable that holds the value.  */
752DEFTREECODE (SAVE_EXPR, "save_expr", tcc_expression, 1)
753
754/* & in C.  Value is the address at which the operand's value resides.
755   Operand may have any mode.  Result mode is Pmode.  */
756DEFTREECODE (ADDR_EXPR, "addr_expr", tcc_expression, 1)
757
758/* Operand0 is a function constant; result is part N of a function
759   descriptor of type ptr_mode.  */
760DEFTREECODE (FDESC_EXPR, "fdesc_expr", tcc_expression, 2)
761
762/* Given two real or integer operands of the same type,
763   returns a complex value of the corresponding complex type.  */
764DEFTREECODE (COMPLEX_EXPR, "complex_expr", tcc_binary, 2)
765
766/* Complex conjugate of operand.  Used only on complex types.  */
767DEFTREECODE (CONJ_EXPR, "conj_expr", tcc_unary, 1)
768
769/* Used only on an operand of complex type, these return
770   a value of the corresponding component type.  */
771DEFTREECODE (REALPART_EXPR, "realpart_expr", tcc_reference, 1)
772DEFTREECODE (IMAGPART_EXPR, "imagpart_expr", tcc_reference, 1)
773
774/* Nodes for ++ and -- in C.
775   The second arg is how much to increment or decrement by.
776   For a pointer, it would be the size of the object pointed to.  */
777DEFTREECODE (PREDECREMENT_EXPR, "predecrement_expr", tcc_expression, 2)
778DEFTREECODE (PREINCREMENT_EXPR, "preincrement_expr", tcc_expression, 2)
779DEFTREECODE (POSTDECREMENT_EXPR, "postdecrement_expr", tcc_expression, 2)
780DEFTREECODE (POSTINCREMENT_EXPR, "postincrement_expr", tcc_expression, 2)
781
782/* Used to implement `va_arg'.  */
783DEFTREECODE (VA_ARG_EXPR, "va_arg_expr", tcc_expression, 1)
784
785/* Evaluate operand 1.  If and only if an exception is thrown during
786   the evaluation of operand 1, evaluate operand 2.
787
788   This differs from TRY_FINALLY_EXPR in that operand 2 is not evaluated
789   on a normal or jump exit, only on an exception.  */
790DEFTREECODE (TRY_CATCH_EXPR, "try_catch_expr", tcc_statement, 2)
791
792/* Evaluate the first operand.
793   The second operand is a cleanup expression which is evaluated
794   on any exit (normal, exception, or jump out) from this expression.  */
795DEFTREECODE (TRY_FINALLY_EXPR, "try_finally", tcc_statement, 2)
796
797/* These types of expressions have no useful value,
798   and always have side effects.  */
799
800/* Used to represent a local declaration. The operand is DECL_EXPR_DECL.  */
801DEFTREECODE (DECL_EXPR, "decl_expr", tcc_statement, 1)
802
803/* A label definition, encapsulated as a statement.
804   Operand 0 is the LABEL_DECL node for the label that appears here.
805   The type should be void and the value should be ignored.  */
806DEFTREECODE (LABEL_EXPR, "label_expr", tcc_statement, 1)
807
808/* GOTO.  Operand 0 is a LABEL_DECL node or an expression.
809   The type should be void and the value should be ignored.  */
810DEFTREECODE (GOTO_EXPR, "goto_expr", tcc_statement, 1)
811
812/* RETURN.  Evaluates operand 0, then returns from the current function.
813   Presumably that operand is an assignment that stores into the
814   RESULT_DECL that hold the value to be returned.
815   The operand may be null.
816   The type should be void and the value should be ignored.  */
817DEFTREECODE (RETURN_EXPR, "return_expr", tcc_statement, 1)
818
819/* Exit the inner most loop conditionally.  Operand 0 is the condition.
820   The type should be void and the value should be ignored.  */
821DEFTREECODE (EXIT_EXPR, "exit_expr", tcc_statement, 1)
822
823/* A loop.  Operand 0 is the body of the loop.
824   It must contain an EXIT_EXPR or is an infinite loop.
825   The type should be void and the value should be ignored.  */
826DEFTREECODE (LOOP_EXPR, "loop_expr", tcc_statement, 1)
827
828/* Switch expression.
829
830   TREE_TYPE is the original type of the condition, before any
831   language required type conversions.  It may be NULL, in which case
832   the original type and final types are assumed to be the same.
833
834   Operand 0 is the expression used to perform the branch,
835   Operand 1 is the body of the switch, which probably contains
836     CASE_LABEL_EXPRs.  It may also be NULL, in which case operand 2
837     must not be NULL.
838   Operand 2 is either NULL_TREE or a TREE_VEC of the CASE_LABEL_EXPRs
839     of all the cases.  */
840DEFTREECODE (SWITCH_EXPR, "switch_expr", tcc_statement, 3)
841
842/* Used to represent a case label. The operands are CASE_LOW and
843   CASE_HIGH, respectively. If CASE_LOW is NULL_TREE, the label is a
844   'default' label. If CASE_HIGH is NULL_TREE, the label is a normal case
845   label.  CASE_LABEL is the corresponding LABEL_DECL.  */
846DEFTREECODE (CASE_LABEL_EXPR, "case_label_expr", tcc_statement, 3)
847
848/* RESX.  Resume execution after an exception.  Operand 0 is a
849   number indicating the exception region that is being left.  */
850DEFTREECODE (RESX_EXPR, "resx_expr", tcc_statement, 1)
851
852/* Used to represent an inline assembly statement.  ASM_STRING returns a
853   STRING_CST for the instruction (e.g., "mov x, y"). ASM_OUTPUTS,
854   ASM_INPUTS, and ASM_CLOBBERS represent the outputs, inputs, and clobbers
855   for the statement.  */
856DEFTREECODE (ASM_EXPR, "asm_expr", tcc_statement, 4)
857
858/* Variable references for SSA analysis.  New SSA names are created every
859   time a variable is assigned a new value.  The SSA builder uses SSA_NAME
860   nodes to implement SSA versioning.  */
861DEFTREECODE (SSA_NAME, "ssa_name", tcc_exceptional, 0)
862
863/* SSA PHI operator.  PHI_RESULT is the new SSA_NAME node created by
864   the PHI node.  PHI_ARG_LENGTH is the number of arguments.
865   PHI_ARG_ELT returns the Ith tuple <ssa_name, edge> from the
866   argument list.  Each tuple contains the incoming reaching
867   definition (SSA_NAME node) and the edge via which that definition
868   is coming through.  */
869DEFTREECODE (PHI_NODE, "phi_node", tcc_exceptional, 0)
870
871/* Used to represent a typed exception handler.  CATCH_TYPES is the type (or
872   list of types) handled, and CATCH_BODY is the code for the handler.  */
873DEFTREECODE (CATCH_EXPR, "catch_expr", tcc_statement, 2)
874
875/* Used to represent an exception specification.  EH_FILTER_TYPES is a list
876   of allowed types, and EH_FILTER_FAILURE is an expression to evaluate on
877   failure.  EH_FILTER_MUST_NOT_THROW controls which range type to use when
878   expanding.  */
879DEFTREECODE (EH_FILTER_EXPR, "eh_filter_expr", tcc_statement, 2)
880
881/* Node used for describing a property that is known at compile
882   time.  */
883DEFTREECODE (SCEV_KNOWN, "scev_known", tcc_expression, 0)
884
885/* Node used for describing a property that is not known at compile
886   time.  */
887DEFTREECODE (SCEV_NOT_KNOWN, "scev_not_known", tcc_expression, 0)
888
889/* Polynomial chains of recurrences.
890   Under the form: cr = {CHREC_LEFT (cr), +, CHREC_RIGHT (cr)}.  */
891DEFTREECODE (POLYNOMIAL_CHREC, "polynomial_chrec", tcc_expression, 3)
892
893/* Used to chain children of container statements together.
894   Use the interface in tree-iterator.h to access this node.  */
895DEFTREECODE (STATEMENT_LIST, "statement_list", tcc_exceptional, 0)
896
897/* Value handles.  Artificial nodes to represent expressions in
898   partial redundancy elimination (tree-ssa-pre.c).  These nodes are
899   used for expression canonicalization.  If two expressions compute
900   the same value, they will be assigned the same value handle.  */
901DEFTREECODE (VALUE_HANDLE, "value_handle", tcc_exceptional, 0)
902
903/* Predicate assertion.  Artificial expression generated by the optimizers
904   to keep track of predicate values.  This expression may only appear on
905   the RHS of assignments.
906   
907   Given X = ASSERT_EXPR <Y, EXPR>, the optimizers can infer
908   two things:
909
910   	1- X is a copy of Y.
911	2- EXPR is a GIMPLE conditional expression (as defined by
912	   is_gimple_condexpr) and is known to be true.
913
914   The type of the expression is the same as Y.  */
915DEFTREECODE (ASSERT_EXPR, "assert_expr", tcc_expression, 2)
916
917/* Base class information. Holds information about a class as a
918   baseclass of itself or another class.  */
919DEFTREECODE (TREE_BINFO, "tree_binfo", tcc_exceptional, 0)
920
921/* Records the size for an expression of variable size type.  This is
922   for use in contexts in which we are accessing the entire object,
923   such as for a function call, or block copy.
924   Operand 0 is the real expression.
925   Operand 1 is the size of the type in the expression.  */
926DEFTREECODE (WITH_SIZE_EXPR, "with_size_expr", tcc_expression, 2)
927
928/* Extract elements from two input vectors Operand 0 and Operand 1
929   size VS, according to the offset OFF defined by Operand 2 as
930   follows:
931   If OFF > 0, the last VS - OFF elements of vector OP0 are concatenated to
932   the first OFF elements of the vector OP1.
933   If OFF == 0, then the returned vector is OP1.
934   On different targets OFF may take different forms; It can be an address, in 
935   which case its low log2(VS)-1 bits define the offset, or it can be a mask 
936   generated by the builtin targetm.vectorize.mask_for_load_builtin_decl.  */
937DEFTREECODE (REALIGN_LOAD_EXPR, "realign_load", tcc_expression, 3)
938
939/* Low-level memory addressing.  Operands are SYMBOL (static or global
940   variable), BASE (register), INDEX (register), STEP (integer constant),
941   OFFSET (integer constant).  Corresponding address is
942   SYMBOL + BASE + STEP * INDEX + OFFSET.  Only variations and values valid on
943   the target are allowed.
944   
945   The sixth argument is the reference to the original memory access, which
946   is preserved for the purposes of the RTL alias analysis.  The seventh
947   argument is a tag representing results of the tree level alias analysis.  */
948
949DEFTREECODE (TARGET_MEM_REF, "target_mem_ref", tcc_reference, 7)
950
951/* Reduction operations. 
952   Operations that take a vector of elements and "reduce" it to a scalar
953   result (e.g. summing the elements of the vector, finding the minimum over
954   the vector elements, etc).
955   Operand 0 is a vector; the first element in the vector has the result.
956   Operand 1 is a vector.  */ 
957DEFTREECODE (REDUC_MAX_EXPR, "reduc_max_expr", tcc_unary, 1)
958DEFTREECODE (REDUC_MIN_EXPR, "reduc_min_expr", tcc_unary, 1)
959DEFTREECODE (REDUC_PLUS_EXPR, "reduc_plus_expr", tcc_unary, 1)
960
961/* Whole vector left/right shift in bits.
962   Operand 0 is a vector to be shifted.
963   Operand 1 is an integer shift amount in bits.  */
964DEFTREECODE (VEC_LSHIFT_EXPR, "vec_lshift_expr", tcc_binary, 2)
965DEFTREECODE (VEC_RSHIFT_EXPR, "vec_rshift_expr", tcc_binary, 2)
966
967/*
968Local variables:
969mode:c
970End:
971*/
972