tree.def revision 50397
118334Speter/* This file contains the definitions and documentation for the 218334Speter tree codes used in the GNU C compiler. 350397Sobrien Copyright (C) 1987, 1988, 1993, 1995, 1997 Free Software Foundation, Inc. 418334Speter 518334SpeterThis file is part of GNU CC. 618334Speter 718334SpeterGNU CC is free software; you can redistribute it and/or modify 818334Speterit under the terms of the GNU General Public License as published by 918334Speterthe Free Software Foundation; either version 2, or (at your option) 1018334Speterany later version. 1118334Speter 1218334SpeterGNU CC is distributed in the hope that it will be useful, 1318334Speterbut WITHOUT ANY WARRANTY; without even the implied warranty of 1418334SpeterMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1518334SpeterGNU General Public License for more details. 1618334Speter 1718334SpeterYou should have received a copy of the GNU General Public License 1818334Speteralong with GNU CC; see the file COPYING. If not, write to 1918334Speterthe Free Software Foundation, 59 Temple Place - Suite 330, 2018334SpeterBoston, MA 02111-1307, USA. */ 2118334Speter 2218334Speter 2318334Speter/* The third argument can be: 2450397Sobrien 'x' for an exceptional code (fits no category). 2550397Sobrien 't' for a type object code. 2650397Sobrien 'b' for a lexical block. 2750397Sobrien 'c' for codes for constants. 2850397Sobrien 'd' for codes for declarations (also serving as variable refs). 2950397Sobrien 'r' for codes for references to storage. 3050397Sobrien '<' for codes for comparison expressions. 3150397Sobrien '1' for codes for unary arithmetic expressions. 3250397Sobrien '2' for codes for binary arithmetic expressions. 3350397Sobrien 's' for codes for expressions with inherent side effects. 3450397Sobrien 'e' for codes for other kinds of expressions. */ 3518334Speter 3618334Speter/* For `r', `e', `<', `1', `2', `s' and `x' nodes, 3718334Speter the 4th element is the number of argument slots to allocate. 3818334Speter This determines the size of the tree node object. */ 3918334Speter 4018334Speter/* Any erroneous construct is parsed into a node of this type. 4118334Speter This type of node is accepted without complaint in all contexts 4218334Speter by later parsing activities, to avoid multiple error messages 4318334Speter for one error. 4418334Speter No fields in these nodes are used except the TREE_CODE. */ 4550397SobrienDEFTREECODE (ERROR_MARK, "error_mark", 'x', 0) 4618334Speter 4718334Speter/* Used to represent a name (such as, in the DECL_NAME of a decl node). 4818334Speter Internally it looks like a STRING_CST node. 4918334Speter There is only one IDENTIFIER_NODE ever made for any particular name. 5018334Speter Use `get_identifier' to get it (or create it, the first time). */ 5150397SobrienDEFTREECODE (IDENTIFIER_NODE, "identifier_node", 'x', -1) 5218334Speter 5318334Speter/* Used to hold information to identify an operator (or combination 5418334Speter of two operators) considered as a `noun' rather than a `verb'. 5518334Speter The first operand is encoded in the TREE_TYPE field. */ 5650397SobrienDEFTREECODE (OP_IDENTIFIER, "op_identifier", 'x', 2) 5718334Speter 5818334Speter/* Has the TREE_VALUE and TREE_PURPOSE fields. */ 5918334Speter/* These nodes are made into lists by chaining through the 6018334Speter TREE_CHAIN field. The elements of the list live in the 6118334Speter TREE_VALUE fields, while TREE_PURPOSE fields are occasionally 6218334Speter used as well to get the effect of Lisp association lists. */ 6350397SobrienDEFTREECODE (TREE_LIST, "tree_list", 'x', 2) 6418334Speter 6518334Speter/* These nodes contain an array of tree nodes. */ 6650397SobrienDEFTREECODE (TREE_VEC, "tree_vec", 'x', 2) 6718334Speter 6818334Speter/* A symbol binding block. These are arranged in a tree, 6918334Speter where the BLOCK_SUBBLOCKS field contains a chain of subblocks 7018334Speter chained through the BLOCK_CHAIN field. 7118334Speter BLOCK_SUPERCONTEXT points to the parent block. 7218334Speter For a block which represents the outermost scope of a function, it 7318334Speter points to the FUNCTION_DECL node. 7418334Speter BLOCK_VARS points to a chain of decl nodes. 7518334Speter BLOCK_TYPE_TAGS points to a chain of types which have their own names. 7618334Speter BLOCK_CHAIN points to the next BLOCK at the same level. 7718334Speter BLOCK_ABSTRACT_ORIGIN points to the original (abstract) tree node which 7818334Speter this block is an instance of, or else is NULL to indicate that this 7918334Speter block is not an instance of anything else. When non-NULL, the value 8018334Speter could either point to another BLOCK node or it could point to a 8118334Speter FUNCTION_DECL node (e.g. in the case of a block representing the 8218334Speter outermost scope of a particular inlining of a function). 8318334Speter BLOCK_ABSTRACT is non-zero if the block represents an abstract 8418334Speter instance of a block (i.e. one which is nested within an abstract 8518334Speter instance of a inline function. */ 8650397SobrienDEFTREECODE (BLOCK, "block", 'b', 0) 8718334Speter 8818334Speter/* Each data type is represented by a tree node whose code is one of 8918334Speter the following: */ 9018334Speter/* Each node that represents a data type has a component TYPE_SIZE 9118334Speter containing a tree that is an expression for the size in bits. 9218334Speter The TYPE_MODE contains the machine mode for values of this type. 9318334Speter The TYPE_POINTER_TO field contains a type for a pointer to this type, 9418334Speter or zero if no such has been created yet. 9518334Speter The TYPE_NEXT_VARIANT field is used to chain together types 9618334Speter that are variants made by type modifiers such as "const" and "volatile". 9718334Speter The TYPE_MAIN_VARIANT field, in any member of such a chain, 9818334Speter points to the start of the chain. 9918334Speter The TYPE_NONCOPIED_PARTS field is a list specifying which parts 10018334Speter of an object of this type should *not* be copied by assignment. 10118334Speter The TREE_PURPOSE of each element is the offset of the part 10218334Speter and the TREE_VALUE is the size in bits of the part. 10318334Speter The TYPE_NAME field contains info on the name used in the program 10418334Speter for this type (for GDB symbol table output). It is either a 10518334Speter TYPE_DECL node, for types that are typedefs, or an IDENTIFIER_NODE 10618334Speter in the case of structs, unions or enums that are known with a tag, 10718334Speter or zero for types that have no special name. 10818334Speter The TYPE_CONTEXT for any sort of type which could have a name or 10918334Speter which could have named members (e.g. tagged types in C/C++) will 11018334Speter point to the node which represents the scope of the given type, or 11118334Speter will be NULL_TREE if the type has "file scope". For most types, this 11218334Speter will point to a BLOCK node or a FUNCTION_DECL node, but it could also 11318334Speter point to a FUNCTION_TYPE node (for types whose scope is limited to the 11418334Speter formal parameter list of some function type specification) or it 11518334Speter could point to a RECORD_TYPE, UNION_TYPE or QUAL_UNION_TYPE node 11618334Speter (for C++ "member" types). 11718334Speter For non-tagged-types, TYPE_CONTEXT need not be set to anything in 11818334Speter particular, since any type which is of some type category (e.g. 11918334Speter an array type or a function type) which cannot either have a name 12018334Speter itself or have named members doesn't really have a "scope" per se. 12118334Speter The TREE_CHAIN field is used as a forward-references to names for 12218334Speter ENUMERAL_TYPE, RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE nodes; 12318334Speter see below. */ 12418334Speter 12550397SobrienDEFTREECODE (VOID_TYPE, "void_type", 't', 0) /* The void type in C */ 12618334Speter 12718334Speter/* Integer types in all languages, including char in C. 12818334Speter Also used for sub-ranges of other discrete types. 12918334Speter Has components TYPE_MIN_VALUE, TYPE_MAX_VALUE (expressions, inclusive) 13018334Speter and TYPE_PRECISION (number of bits used by this type). 13118334Speter In the case of a subrange type in Pascal, the TREE_TYPE 13218334Speter of this will point at the supertype (another INTEGER_TYPE, 13318334Speter or an ENUMERAL_TYPE, CHAR_TYPE, or BOOLEAN_TYPE). 13418334Speter Otherwise, the TREE_TYPE is zero. */ 13550397SobrienDEFTREECODE (INTEGER_TYPE, "integer_type", 't', 0) 13618334Speter 13718334Speter/* C's float and double. Different floating types are distinguished 13818334Speter by machine mode and by the TYPE_SIZE and the TYPE_PRECISION. */ 13950397SobrienDEFTREECODE (REAL_TYPE, "real_type", 't', 0) 14018334Speter 14118334Speter/* Complex number types. The TREE_TYPE field is the data type 14218334Speter of the real and imaginary parts. */ 14350397SobrienDEFTREECODE (COMPLEX_TYPE, "complex_type", 't', 0) 14418334Speter 14518334Speter/* C enums. The type node looks just like an INTEGER_TYPE node. 14618334Speter The symbols for the values of the enum type are defined by 14718334Speter CONST_DECL nodes, but the type does not point to them; 14818334Speter however, the TYPE_VALUES is a list in which each element's TREE_PURPOSE 14918334Speter is a name and the TREE_VALUE is the value (an INTEGER_CST node). */ 15018334Speter/* A forward reference `enum foo' when no enum named foo is defined yet 15118334Speter has zero (a null pointer) in its TYPE_SIZE. The tag name is in 15218334Speter the TYPE_NAME field. If the type is later defined, the normal 15318334Speter fields are filled in. 15418334Speter RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE forward refs are 15518334Speter treated similarly. */ 15650397SobrienDEFTREECODE (ENUMERAL_TYPE, "enumeral_type", 't', 0) 15718334Speter 15818334Speter/* Pascal's boolean type (true or false are the only values); 15918334Speter no special fields needed. */ 16050397SobrienDEFTREECODE (BOOLEAN_TYPE, "boolean_type", 't', 0) 16118334Speter 16218334Speter/* CHAR in Pascal; not used in C. 16318334Speter No special fields needed. */ 16450397SobrienDEFTREECODE (CHAR_TYPE, "char_type", 't', 0) 16518334Speter 16618334Speter/* All pointer-to-x types have code POINTER_TYPE. 16718334Speter The TREE_TYPE points to the node for the type pointed to. */ 16850397SobrienDEFTREECODE (POINTER_TYPE, "pointer_type", 't', 0) 16918334Speter 17018334Speter/* An offset is a pointer relative to an object. 17118334Speter The TREE_TYPE field is the type of the object at the offset. 17218334Speter The TYPE_OFFSET_BASETYPE points to the node for the type of object 17318334Speter that the offset is relative to. */ 17450397SobrienDEFTREECODE (OFFSET_TYPE, "offset_type", 't', 0) 17518334Speter 17618334Speter/* A reference is like a pointer except that it is coerced 17718334Speter automatically to the value it points to. Used in C++. */ 17850397SobrienDEFTREECODE (REFERENCE_TYPE, "reference_type", 't', 0) 17918334Speter 18018334Speter/* METHOD_TYPE is the type of a function which takes an extra first 18118334Speter argument for "self", which is not present in the declared argument list. 18218334Speter The TREE_TYPE is the return type of the method. The TYPE_METHOD_BASETYPE 18318334Speter is the type of "self". TYPE_ARG_TYPES is the real argument list, which 18418334Speter includes the hidden argument for "self". */ 18550397SobrienDEFTREECODE (METHOD_TYPE, "method_type", 't', 0) 18618334Speter 18718334Speter/* Used for Pascal; details not determined right now. */ 18850397SobrienDEFTREECODE (FILE_TYPE, "file_type", 't', 0) 18918334Speter 19018334Speter/* Types of arrays. Special fields: 19118334Speter TREE_TYPE Type of an array element. 19218334Speter TYPE_DOMAIN Type to index by. 19318334Speter Its range of values specifies the array length. 19418334Speter TYPE_SEP Expression for units from one elt to the next. 19518334Speter TYPE_SEP_UNIT Number of bits in a unit for previous. 19618334Speter The field TYPE_POINTER_TO (TREE_TYPE (array_type)) is always nonzero 19718334Speter and holds the type to coerce a value of that array type to in C. 19818334Speter TYPE_STRING_FLAG indicates a string (in contrast to an array of chars) 19918334Speter in languages (such as Chill) that make a distinction. */ 20018334Speter/* Array types in C or Pascal */ 20150397SobrienDEFTREECODE (ARRAY_TYPE, "array_type", 't', 0) 20218334Speter 20318334Speter/* Types of sets for Pascal. Special fields are the same as 20418334Speter in an array type. The target type is always a boolean type. 20518334Speter Used for both bitstrings and powersets in Chill; 20618334Speter TYPE_STRING_FLAG indicates a bitstring. */ 20750397SobrienDEFTREECODE (SET_TYPE, "set_type", 't', 0) 20818334Speter 20918334Speter/* Struct in C, or record in Pascal. */ 21018334Speter/* Special fields: 21150397Sobrien TYPE_FIELDS chain of FIELD_DECLs for the fields of the struct, 21250397Sobrien and VAR_DECLs, TYPE_DECLs and CONST_DECLs for record-scope variables, 21350397Sobrien types and enumerators. 21418334Speter A few may need to be added for Pascal. */ 21518334Speter/* See the comment above, before ENUMERAL_TYPE, for how 21618334Speter forward references to struct tags are handled in C. */ 21750397SobrienDEFTREECODE (RECORD_TYPE, "record_type", 't', 0) 21818334Speter 21918334Speter/* Union in C. Like a struct, except that the offsets of the fields 22018334Speter will all be zero. */ 22118334Speter/* See the comment above, before ENUMERAL_TYPE, for how 22218334Speter forward references to union tags are handled in C. */ 22350397SobrienDEFTREECODE (UNION_TYPE, "union_type", 't', 0) /* C union type */ 22418334Speter 22518334Speter/* Similar to UNION_TYPE, except that the expressions in DECL_QUALIFIER 22618334Speter in each FIELD_DECL determine what the union contains. The first 22718334Speter field whose DECL_QUALIFIER expression is true is deemed to occupy 22818334Speter the union. */ 22950397SobrienDEFTREECODE (QUAL_UNION_TYPE, "qual_union_type", 't', 0) 23018334Speter 23118334Speter/* Type of functions. Special fields: 23218334Speter TREE_TYPE type of value returned. 23318334Speter TYPE_ARG_TYPES list of types of arguments expected. 23418334Speter this list is made of TREE_LIST nodes. 23518334Speter Types of "Procedures" in languages where they are different from functions 23618334Speter have code FUNCTION_TYPE also, but then TREE_TYPE is zero or void type. */ 23750397SobrienDEFTREECODE (FUNCTION_TYPE, "function_type", 't', 0) 23818334Speter 23918334Speter/* This is a language-specific kind of type. 24018334Speter Its meaning is defined by the language front end. 24118334Speter layout_type does not know how to lay this out, 24218334Speter so the front-end must do so manually. */ 24350397SobrienDEFTREECODE (LANG_TYPE, "lang_type", 't', 0) 24418334Speter 24518334Speter/* Expressions */ 24618334Speter 24718334Speter/* First, the constants. */ 24818334Speter 24918334Speter/* Contents are in TREE_INT_CST_LOW and TREE_INT_CST_HIGH fields, 25018334Speter 32 bits each, giving us a 64 bit constant capability. 25118334Speter Note: constants of type char in Pascal are INTEGER_CST, 25218334Speter and so are pointer constants such as nil in Pascal or NULL in C. 25318334Speter `(int *) 1' in C also results in an INTEGER_CST. */ 25450397SobrienDEFTREECODE (INTEGER_CST, "integer_cst", 'c', 2) 25518334Speter 25618334Speter/* Contents are in TREE_REAL_CST field. Also there is TREE_CST_RTL. */ 25750397SobrienDEFTREECODE (REAL_CST, "real_cst", 'c', 3) 25818334Speter 25918334Speter/* Contents are in TREE_REALPART and TREE_IMAGPART fields, 26018334Speter whose contents are other constant nodes. 26118334Speter Also there is TREE_CST_RTL. */ 26250397SobrienDEFTREECODE (COMPLEX_CST, "complex_cst", 'c', 3) 26318334Speter 26418334Speter/* Contents are TREE_STRING_LENGTH and TREE_STRING_POINTER fields. 26518334Speter Also there is TREE_CST_RTL. */ 26650397SobrienDEFTREECODE (STRING_CST, "string_cst", 'c', 3) 26718334Speter 26818334Speter/* Declarations. All references to names are represented as ..._DECL nodes. 26918334Speter The decls in one binding context are chained through the TREE_CHAIN field. 27018334Speter Each DECL has a DECL_NAME field which contains an IDENTIFIER_NODE. 27118334Speter (Some decls, most often labels, may have zero as the DECL_NAME). 27218334Speter DECL_CONTEXT points to the node representing the context in which 27318334Speter this declaration has its scope. For FIELD_DECLs, this is the 27418334Speter RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE node that the field 27518334Speter is a member of. For VAR_DECL, PARM_DECL, FUNCTION_DECL, LABEL_DECL, 27650397Sobrien and CONST_DECL nodes, this points to either the FUNCTION_DECL for the 27750397Sobrien containing function, the RECORD_TYPE or UNION_TYPE for the containing 27850397Sobrien type, or NULL_TREE if the given decl has "file scope". 27918334Speter DECL_ABSTRACT_ORIGIN, if non-NULL, points to the original (abstract) 28018334Speter ..._DECL node of which this decl is an (inlined or template expanded) 28118334Speter instance. 28218334Speter The TREE_TYPE field holds the data type of the object, when relevant. 28318334Speter LABEL_DECLs have no data type. For TYPE_DECL, the TREE_TYPE field 28418334Speter contents are the type whose name is being declared. 28518334Speter The DECL_ALIGN, DECL_SIZE, 28618334Speter and DECL_MODE fields exist in decl nodes just as in type nodes. 28718334Speter They are unused in LABEL_DECL, TYPE_DECL and CONST_DECL nodes. 28818334Speter 28918334Speter DECL_OFFSET holds an integer number of bits offset for the location. 29018334Speter DECL_VOFFSET holds an expression for a variable offset; it is 29118334Speter to be multiplied by DECL_VOFFSET_UNIT (an integer). 29218334Speter These fields are relevant only in FIELD_DECLs and PARM_DECLs. 29318334Speter 29418334Speter DECL_INITIAL holds the value to initialize a variable to, 29518334Speter or the value of a constant. For a function, it holds the body 29618334Speter (a node of type BLOCK representing the function's binding contour 29718334Speter and whose body contains the function's statements.) For a LABEL_DECL 29818334Speter in C, it is a flag, nonzero if the label's definition has been seen. 29918334Speter 30018334Speter PARM_DECLs use a special field: 30118334Speter DECL_ARG_TYPE is the type in which the argument is actually 30218334Speter passed, which may be different from its type within the function. 30318334Speter 30418334Speter FUNCTION_DECLs use four special fields: 30518334Speter DECL_ARGUMENTS holds a chain of PARM_DECL nodes for the arguments. 30618334Speter DECL_RESULT holds a RESULT_DECL node for the value of a function, 30718334Speter or it is 0 for a function that returns no value. 30818334Speter (C functions returning void have zero here.) 30918334Speter DECL_RESULT_TYPE holds the type in which the result is actually 31018334Speter returned. This is usually the same as the type of DECL_RESULT, 31118334Speter but (1) it may be a wider integer type and 31218334Speter (2) it remains valid, for the sake of inlining, even after the 31318334Speter function's compilation is done. 31418334Speter DECL_FUNCTION_CODE is a code number that is nonzero for 31518334Speter built-in functions. Its value is an enum built_in_function 31618334Speter that says which built-in function it is. 31718334Speter 31818334Speter DECL_SOURCE_FILE holds a filename string and DECL_SOURCE_LINE 31918334Speter holds a line number. In some cases these can be the location of 32018334Speter a reference, if no definition has been seen. 32118334Speter 32218334Speter DECL_ABSTRACT is non-zero if the decl represents an abstract instance 32318334Speter of a decl (i.e. one which is nested within an abstract instance of a 32418334Speter inline function. */ 32518334Speter 32650397SobrienDEFTREECODE (FUNCTION_DECL, "function_decl", 'd', 0) 32750397SobrienDEFTREECODE (LABEL_DECL, "label_decl", 'd', 0) 32850397SobrienDEFTREECODE (CONST_DECL, "const_decl", 'd', 0) 32950397SobrienDEFTREECODE (TYPE_DECL, "type_decl", 'd', 0) 33050397SobrienDEFTREECODE (VAR_DECL, "var_decl", 'd', 0) 33150397SobrienDEFTREECODE (PARM_DECL, "parm_decl", 'd', 0) 33250397SobrienDEFTREECODE (RESULT_DECL, "result_decl", 'd', 0) 33350397SobrienDEFTREECODE (FIELD_DECL, "field_decl", 'd', 0) 33450397Sobrien 33550397Sobrien/* A namespace declaration. Namespaces appear in DECL_CONTEXT of other 33650397Sobrien _DECLs, providing a hierarchy of names. */ 33750397SobrienDEFTREECODE (NAMESPACE_DECL, "namespace_decl", 'd', 0) 33818334Speter 33918334Speter/* References to storage. */ 34018334Speter 34118334Speter/* Value is structure or union component. 34218334Speter Operand 0 is the structure or union (an expression); 34318334Speter operand 1 is the field (a node of type FIELD_DECL). */ 34450397SobrienDEFTREECODE (COMPONENT_REF, "component_ref", 'r', 2) 34518334Speter 34618334Speter/* Reference to a group of bits within an object. Similar to COMPONENT_REF 34718334Speter except the position is given explicitly rather than via a FIELD_DECL. 34818334Speter Operand 0 is the structure or union expression; 34918334Speter operand 1 is a tree giving the number of bits being referenced; 35018334Speter operand 2 is a tree giving the position of the first referenced bit. 35118334Speter The field can be either a signed or unsigned field; 35218334Speter TREE_UNSIGNED says which. */ 35350397SobrienDEFTREECODE (BIT_FIELD_REF, "bit_field_ref", 'r', 3) 35418334Speter 35518334Speter/* C unary `*' or Pascal `^'. One operand, an expression for a pointer. */ 35650397SobrienDEFTREECODE (INDIRECT_REF, "indirect_ref", 'r', 1) 35718334Speter 35818334Speter/* Pascal `^` on a file. One operand, an expression for the file. */ 35950397SobrienDEFTREECODE (BUFFER_REF, "buffer_ref", 'r', 1) 36018334Speter 36118334Speter/* Array indexing in languages other than C. 36218334Speter Operand 0 is the array; operand 1 is a list of indices 36318334Speter stored as a chain of TREE_LIST nodes. */ 36450397SobrienDEFTREECODE (ARRAY_REF, "array_ref", 'r', 2) 36518334Speter 36618334Speter/* Constructor: return an aggregate value made from specified components. 36718334Speter In C, this is used only for structure and array initializers. 36850397Sobrien Also used for SET_TYPE in Chill (and potentially Pascal). 36918334Speter The first "operand" is really a pointer to the RTL, 37018334Speter for constant constructors only. 37118334Speter The second operand is a list of component values 37250397Sobrien made out of a chain of TREE_LIST nodes. 37318334Speter 37450397Sobrien For ARRAY_TYPE: 37550397Sobrien The TREE_PURPOSE of each node is the corresponding index. 37650397Sobrien If the TREE_PURPOSE is a RANGE_EXPR, it is a short-hand for many nodes, 37750397Sobrien one for each index in the range. (If the corresponding TREE_VALUE 37850397Sobrien has side-effects, they are evaluated once for each element. Wrap the 37950397Sobrien value in a SAVE_EXPR if you want to evaluate side effects only once.) 38018334Speter 38150397Sobrien For RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE: 38250397Sobrien The TREE_PURPOSE of each node is a FIELD_DECL. 38350397Sobrien 38450397Sobrien For SET_TYPE: 38550397Sobrien The TREE_VALUE specifies a value (index) in the set that is true. 38650397Sobrien If TREE_PURPOSE is non-NULL, it specifies the lower limit of a 38750397Sobrien range of true values. Elements not listed are false (not in the set). */ 38850397SobrienDEFTREECODE (CONSTRUCTOR, "constructor", 'e', 2) 38950397Sobrien 39050397Sobrien/* The expression types are mostly straightforward, with the fourth argument 39150397Sobrien of DEFTREECODE saying how many operands there are. 39250397Sobrien Unless otherwise specified, the operands are expressions and the 39350397Sobrien types of all the operands and the expression must all be the same. */ 39450397Sobrien 39518334Speter/* Contains two expressions to compute, one followed by the other. 39650397Sobrien the first value is ignored. The second one's value is used. The 39750397Sobrien type of the first expression need not agree with the other types. */ 39850397SobrienDEFTREECODE (COMPOUND_EXPR, "compound_expr", 'e', 2) 39918334Speter 40018334Speter/* Assignment expression. Operand 0 is the what to set; 1, the new value. */ 40150397SobrienDEFTREECODE (MODIFY_EXPR, "modify_expr", 'e', 2) 40218334Speter 40318334Speter/* Initialization expression. Operand 0 is the variable to initialize; 40418334Speter Operand 1 is the initializer. */ 40550397SobrienDEFTREECODE (INIT_EXPR, "init_expr", 'e', 2) 40618334Speter 40718334Speter/* For TARGET_EXPR, operand 0 is the target of an initialization, 40818334Speter operand 1 is the initializer for the target, 40950397Sobrien and operand 2 is the cleanup for this node, if any. 41050397Sobrien and operand 3 is the saved initializer after this node has been 41150397Sobrien expanded once, this is so we can re-expand the tree later. */ 41250397SobrienDEFTREECODE (TARGET_EXPR, "target_expr", 'e', 4) 41318334Speter 41418334Speter/* Conditional expression ( ... ? ... : ... in C). 41518334Speter Operand 0 is the condition. 41618334Speter Operand 1 is the then-value. 41750397Sobrien Operand 2 is the else-value. 41850397Sobrien Operand 0 may be of any type, but the types of operands 1 and 2 41950397Sobrien must be the same and the same as the type of this expression. */ 42050397SobrienDEFTREECODE (COND_EXPR, "cond_expr", 'e', 3) 42118334Speter 42218334Speter/* Declare local variables, including making RTL and allocating space. 42318334Speter Operand 0 is a chain of VAR_DECL nodes for the variables. 42418334Speter Operand 1 is the body, the expression to be computed using 42518334Speter the variables. The value of operand 1 becomes that of the BIND_EXPR. 42618334Speter Operand 2 is the BLOCK that corresponds to these bindings 42718334Speter for debugging purposes. If this BIND_EXPR is actually expanded, 42818334Speter that sets the TREE_USED flag in the BLOCK. 42918334Speter 43018334Speter The BIND_EXPR is not responsible for informing parsers 43118334Speter about these variables. If the body is coming from the input file, 43218334Speter then the code that creates the BIND_EXPR is also responsible for 43318334Speter informing the parser of the variables. 43418334Speter 43518334Speter If the BIND_EXPR is ever expanded, its TREE_USED flag is set. 43618334Speter This tells the code for debugging symbol tables not to ignore the BIND_EXPR. 43718334Speter If the BIND_EXPR should be output for debugging but will not be expanded, 43818334Speter set the TREE_USED flag by hand. 43918334Speter 44018334Speter In order for the BIND_EXPR to be known at all, the code that creates it 44118334Speter must also install it as a subblock in the tree of BLOCK 44218334Speter nodes for the function. */ 44350397SobrienDEFTREECODE (BIND_EXPR, "bind_expr", 'e', 3) 44418334Speter 44518334Speter/* Function call. Operand 0 is the function. 44618334Speter Operand 1 is the argument list, a list of expressions 44718334Speter made out of a chain of TREE_LIST nodes. 44818334Speter There is no operand 2. That slot is used for the 44918334Speter CALL_EXPR_RTL macro (see preexpand_calls). */ 45050397SobrienDEFTREECODE (CALL_EXPR, "call_expr", 'e', 3) 45118334Speter 45218334Speter/* Call a method. Operand 0 is the method, whose type is a METHOD_TYPE. 45318334Speter Operand 1 is the expression for "self". 45418334Speter Operand 2 is the list of explicit arguments. */ 45550397SobrienDEFTREECODE (METHOD_CALL_EXPR, "method_call_expr", 'e', 4) 45618334Speter 45718334Speter/* Specify a value to compute along with its corresponding cleanup. 45818334Speter Operand 0 argument is an expression whose value needs a cleanup. 45918334Speter Operand 1 is an RTL_EXPR which will eventually represent that value. 46018334Speter Operand 2 is the cleanup expression for the object. 46118334Speter The RTL_EXPR is used in this expression, which is how the expression 46218334Speter manages to act on the proper value. 46318334Speter The cleanup is executed by the first enclosing CLEANUP_POINT_EXPR, if 46418334Speter it exists, otherwise it is the responsibility of the caller to manually 46550397Sobrien call expand_start_target_temps/expand_end_target_temps, as needed. 46618334Speter 46750397Sobrien This differs from TRY_CATCH_EXPR in that operand 2 is always 46850397Sobrien evaluated when an exception isn't thrown when cleanups are run. */ 46950397SobrienDEFTREECODE (WITH_CLEANUP_EXPR, "with_cleanup_expr", 'e', 3) 47050397Sobrien 47118334Speter/* Specify a cleanup point. 47218334Speter Operand 0 is an expression that may have cleanups. If it does, those 47318334Speter cleanups are executed after the expression is expanded. 47418334Speter 47518334Speter Note that if the expression is a reference to storage, it is forced out 47618334Speter of memory before the cleanups are run. This is necessary to handle 47718334Speter cases where the cleanups modify the storage referenced; in the 47818334Speter expression 't.i', if 't' is a struct with an integer member 'i' and a 47918334Speter cleanup which modifies 'i', the value of the expression depends on 48018334Speter whether the cleanup is run before or after 't.i' is evaluated. When 48118334Speter expand_expr is run on 't.i', it returns a MEM. This is not good enough; 48218334Speter the value of 't.i' must be forced out of memory. 48318334Speter 48418334Speter As a consequence, the operand of a CLEANUP_POINT_EXPR must not have 48518334Speter BLKmode, because it will not be forced out of memory. */ 48650397SobrienDEFTREECODE (CLEANUP_POINT_EXPR, "cleanup_point_expr", 'e', 1) 48718334Speter 48818334Speter/* The following two codes are used in languages that have types where 48918334Speter the position and/or sizes of fields vary from object to object of the 49018334Speter same type, i.e., where some other field in the object contains a value 49118334Speter that is used in the computation of another field's offset or size. 49218334Speter 49318334Speter For example, a record type with a discriminant in Ada is such a type. 49418334Speter This mechanism is also used to create "fat pointers" for unconstrained 49518334Speter array types in Ada; the fat pointer is a structure one of whose fields is 49618334Speter a pointer to the actual array type and the other field is a pointer to a 49718334Speter template, which is a structure containing the bounds of the array. The 49818334Speter bounds in the type pointed to by the first field in the fat pointer refer 49918334Speter to the values in the template. 50018334Speter 50118334Speter These "self-references" are doing using a PLACEHOLDER_EXPR. This is a 50218334Speter node that will later be replaced with the object being referenced. Its type 50318334Speter is that of the object and selects which object to use from a chain of 50418334Speter references (see below). 50518334Speter 50618334Speter When we wish to evaluate a size or offset, we check it is contains a 50718334Speter placeholder. If it does, we construct a WITH_RECORD_EXPR that contains 50818334Speter both the expression we wish to evaluate and an expression within which the 50918334Speter object may be found. The latter expression is the object itself in 51018334Speter the simple case of an Ada record with discriminant, but it can be the 51118334Speter array in the case of an unconstrained array. 51218334Speter 51318334Speter In the latter case, we need the fat pointer, because the bounds of the 51418334Speter array can only be accessed from it. However, we rely here on the fact that 51518334Speter the expression for the array contains the dereference of the fat pointer 51618334Speter that obtained the array pointer. 51718334Speter 51818334Speter Accordingly, when looking for the object to substitute in place of 51918334Speter a PLACEHOLDER_EXPR, we look down the first operand of the expression 52018334Speter passed as the second operand to WITH_RECORD_EXPR until we find something 52118334Speter of the desired type or reach a constant. */ 52218334Speter 52318334Speter/* Denotes a record to later be supplied with a WITH_RECORD_EXPR when 52418334Speter evaluating this expression. The type of this expression is used to 52518334Speter find the record to replace it. */ 52650397SobrienDEFTREECODE (PLACEHOLDER_EXPR, "placeholder_expr", 'x', 0) 52718334Speter 52818334Speter/* Provide an expression that references a record to be used in place 52918334Speter of a PLACEHOLDER_EXPR. The record to be used is the record within 53018334Speter operand 1 that has the same type as the PLACEHOLDER_EXPR in 53118334Speter operand 0. */ 53250397SobrienDEFTREECODE (WITH_RECORD_EXPR, "with_record_expr", 'e', 2) 53318334Speter 53450397Sobrien/* Simple arithmetic. */ 53550397SobrienDEFTREECODE (PLUS_EXPR, "plus_expr", '2', 2) 53650397SobrienDEFTREECODE (MINUS_EXPR, "minus_expr", '2', 2) 53750397SobrienDEFTREECODE (MULT_EXPR, "mult_expr", '2', 2) 53818334Speter 53918334Speter/* Division for integer result that rounds the quotient toward zero. */ 54050397SobrienDEFTREECODE (TRUNC_DIV_EXPR, "trunc_div_expr", '2', 2) 54118334Speter 54218334Speter/* Division for integer result that rounds the quotient toward infinity. */ 54350397SobrienDEFTREECODE (CEIL_DIV_EXPR, "ceil_div_expr", '2', 2) 54418334Speter 54518334Speter/* Division for integer result that rounds toward minus infinity. */ 54650397SobrienDEFTREECODE (FLOOR_DIV_EXPR, "floor_div_expr", '2', 2) 54718334Speter 54818334Speter/* Division for integer result that rounds toward nearest integer. */ 54950397SobrienDEFTREECODE (ROUND_DIV_EXPR, "round_div_expr", '2', 2) 55018334Speter 55118334Speter/* Four kinds of remainder that go with the four kinds of division. */ 55250397SobrienDEFTREECODE (TRUNC_MOD_EXPR, "trunc_mod_expr", '2', 2) 55350397SobrienDEFTREECODE (CEIL_MOD_EXPR, "ceil_mod_expr", '2', 2) 55450397SobrienDEFTREECODE (FLOOR_MOD_EXPR, "floor_mod_expr", '2', 2) 55550397SobrienDEFTREECODE (ROUND_MOD_EXPR, "round_mod_expr", '2', 2) 55618334Speter 55750397Sobrien/* Division for real result. */ 55850397SobrienDEFTREECODE (RDIV_EXPR, "rdiv_expr", '2', 2) 55918334Speter 56018334Speter/* Division which is not supposed to need rounding. 56118334Speter Used for pointer subtraction in C. */ 56250397SobrienDEFTREECODE (EXACT_DIV_EXPR, "exact_div_expr", '2', 2) 56318334Speter 56418334Speter/* Conversion of real to fixed point: four ways to round, 56518334Speter like the four ways to divide. 56618334Speter CONVERT_EXPR can also be used to convert a real to an integer, 56718334Speter and that is what is used in languages that do not have ways of 56818334Speter specifying which of these is wanted. Maybe these are not needed. */ 56950397SobrienDEFTREECODE (FIX_TRUNC_EXPR, "fix_trunc_expr", '1', 1) 57050397SobrienDEFTREECODE (FIX_CEIL_EXPR, "fix_ceil_expr", '1', 1) 57150397SobrienDEFTREECODE (FIX_FLOOR_EXPR, "fix_floor_expr", '1', 1) 57250397SobrienDEFTREECODE (FIX_ROUND_EXPR, "fix_round_expr", '1', 1) 57318334Speter 57418334Speter/* Conversion of an integer to a real. */ 57550397SobrienDEFTREECODE (FLOAT_EXPR, "float_expr", '1', 1) 57618334Speter 57718334Speter/* Exponentiation. Operands may have any types; 57818334Speter constraints on value type are not known yet. */ 57950397SobrienDEFTREECODE (EXPON_EXPR, "expon_expr", '2', 2) 58018334Speter 58150397Sobrien/* Unary negation. */ 58250397SobrienDEFTREECODE (NEGATE_EXPR, "negate_expr", '1', 1) 58318334Speter 58450397SobrienDEFTREECODE (MIN_EXPR, "min_expr", '2', 2) 58550397SobrienDEFTREECODE (MAX_EXPR, "max_expr", '2', 2) 58650397SobrienDEFTREECODE (ABS_EXPR, "abs_expr", '1', 1) 58750397SobrienDEFTREECODE (FFS_EXPR, "ffs_expr", '1', 1) 58818334Speter 58918334Speter/* Shift operations for shift and rotate. 59018334Speter Shift is supposed to mean logical shift if done on an 59118334Speter unsigned type, arithmetic shift on a signed type. 59218334Speter The second operand is the number of bits to 59350397Sobrien shift by; it need not be the same type as the first operand and result. */ 59450397SobrienDEFTREECODE (LSHIFT_EXPR, "lshift_expr", '2', 2) 59550397SobrienDEFTREECODE (RSHIFT_EXPR, "rshift_expr", '2', 2) 59650397SobrienDEFTREECODE (LROTATE_EXPR, "lrotate_expr", '2', 2) 59750397SobrienDEFTREECODE (RROTATE_EXPR, "rrotate_expr", '2', 2) 59818334Speter 59918334Speter/* Bitwise operations. Operands have same mode as result. */ 60050397SobrienDEFTREECODE (BIT_IOR_EXPR, "bit_ior_expr", '2', 2) 60150397SobrienDEFTREECODE (BIT_XOR_EXPR, "bit_xor_expr", '2', 2) 60250397SobrienDEFTREECODE (BIT_AND_EXPR, "bit_and_expr", '2', 2) 60350397SobrienDEFTREECODE (BIT_ANDTC_EXPR, "bit_andtc_expr", '2', 2) 60450397SobrienDEFTREECODE (BIT_NOT_EXPR, "bit_not_expr", '1', 1) 60518334Speter 60618334Speter/* Combination of boolean values or of integers considered only 60718334Speter as zero or nonzero. ANDIF and ORIF allow the second operand 60818334Speter not to be computed if the value of the expression is determined 60918334Speter from the first operand. AND, OR, and XOR always compute the second 61018334Speter operand whether its value is needed or not (for side effects). */ 61150397SobrienDEFTREECODE (TRUTH_ANDIF_EXPR, "truth_andif_expr", 'e', 2) 61250397SobrienDEFTREECODE (TRUTH_ORIF_EXPR, "truth_orif_expr", 'e', 2) 61350397SobrienDEFTREECODE (TRUTH_AND_EXPR, "truth_and_expr", 'e', 2) 61450397SobrienDEFTREECODE (TRUTH_OR_EXPR, "truth_or_expr", 'e', 2) 61550397SobrienDEFTREECODE (TRUTH_XOR_EXPR, "truth_xor_expr", 'e', 2) 61650397SobrienDEFTREECODE (TRUTH_NOT_EXPR, "truth_not_expr", 'e', 1) 61718334Speter 61818334Speter/* Relational operators. 61918334Speter `EQ_EXPR' and `NE_EXPR' are allowed for any types. 62018334Speter The others are allowed only for integer (or pointer or enumeral) 62118334Speter or real types. 62218334Speter In all cases the operands will have the same type, 62318334Speter and the value is always the type used by the language for booleans. */ 62450397SobrienDEFTREECODE (LT_EXPR, "lt_expr", '<', 2) 62550397SobrienDEFTREECODE (LE_EXPR, "le_expr", '<', 2) 62650397SobrienDEFTREECODE (GT_EXPR, "gt_expr", '<', 2) 62750397SobrienDEFTREECODE (GE_EXPR, "ge_expr", '<', 2) 62850397SobrienDEFTREECODE (EQ_EXPR, "eq_expr", '<', 2) 62950397SobrienDEFTREECODE (NE_EXPR, "ne_expr", '<', 2) 63018334Speter 63118334Speter/* Operations for Pascal sets. Not used now. */ 63250397SobrienDEFTREECODE (IN_EXPR, "in_expr", '2', 2) 63350397SobrienDEFTREECODE (SET_LE_EXPR, "set_le_expr", '<', 2) 63450397SobrienDEFTREECODE (CARD_EXPR, "card_expr", '1', 1) 63550397SobrienDEFTREECODE (RANGE_EXPR, "range_expr", '2', 2) 63618334Speter 63718334Speter/* Represents a conversion of type of a value. 63818334Speter All conversions, including implicit ones, must be 63950397Sobrien represented by CONVERT_EXPR or NOP_EXPR nodes. */ 64050397SobrienDEFTREECODE (CONVERT_EXPR, "convert_expr", '1', 1) 64118334Speter 64218334Speter/* Represents a conversion expected to require no code to be generated. */ 64350397SobrienDEFTREECODE (NOP_EXPR, "nop_expr", '1', 1) 64418334Speter 64518334Speter/* Value is same as argument, but guaranteed not an lvalue. */ 64650397SobrienDEFTREECODE (NON_LVALUE_EXPR, "non_lvalue_expr", '1', 1) 64718334Speter 64818334Speter/* Represents something we computed once and will use multiple times. 64918334Speter First operand is that expression. Second is the function decl 65018334Speter in which the SAVE_EXPR was created. The third operand is the RTL, 65118334Speter nonzero only after the expression has been computed. */ 65250397SobrienDEFTREECODE (SAVE_EXPR, "save_expr", 'e', 3) 65318334Speter 65450397Sobrien/* For a UNSAVE_EXPR, operand 0 is the value to unsave. By unsave, we 65550397Sobrien mean that all _EXPRs such as TARGET_EXPRs, SAVE_EXPRs, 65650397Sobrien CALL_EXPRs and RTL_EXPRs, that are protected 65750397Sobrien from being evaluated more than once should be reset so that a new 65850397Sobrien expand_expr call of this expr will cause those to be re-evaluated. 65950397Sobrien This is useful when we want to reuse a tree in different places, 66050397Sobrien but where we must re-expand. */ 66150397SobrienDEFTREECODE (UNSAVE_EXPR, "unsave_expr", 'e', 1) 66250397Sobrien 66318334Speter/* Represents something whose RTL has already been expanded 66418334Speter as a sequence which should be emitted when this expression is expanded. 66518334Speter The first operand is the RTL to emit. It is the first of a chain of insns. 66618334Speter The second is the RTL expression for the result. */ 66750397SobrienDEFTREECODE (RTL_EXPR, "rtl_expr", 'e', 2) 66818334Speter 66918334Speter/* & in C. Value is the address at which the operand's value resides. 67018334Speter Operand may have any mode. Result mode is Pmode. */ 67150397SobrienDEFTREECODE (ADDR_EXPR, "addr_expr", 'e', 1) 67218334Speter 67318334Speter/* Non-lvalue reference or pointer to an object. */ 67450397SobrienDEFTREECODE (REFERENCE_EXPR, "reference_expr", 'e', 1) 67518334Speter 67618334Speter/* Operand is a function constant; result is a function variable value 67718334Speter of typeEPmode. Used only for languages that need static chains. */ 67850397SobrienDEFTREECODE (ENTRY_VALUE_EXPR, "entry_value_expr", 'e', 1) 67918334Speter 68018334Speter/* Given two real or integer operands of the same type, 68118334Speter returns a complex value of the corresponding complex type. */ 68250397SobrienDEFTREECODE (COMPLEX_EXPR, "complex_expr", '2', 2) 68318334Speter 68450397Sobrien/* Complex conjugate of operand. Used only on complex types. */ 68550397SobrienDEFTREECODE (CONJ_EXPR, "conj_expr", '1', 1) 68618334Speter 68718334Speter/* Used only on an operand of complex type, these return 68818334Speter a value of the corresponding component type. */ 68950397SobrienDEFTREECODE (REALPART_EXPR, "realpart_expr", '1', 1) 69050397SobrienDEFTREECODE (IMAGPART_EXPR, "imagpart_expr", '1', 1) 69118334Speter 69218334Speter/* Nodes for ++ and -- in C. 69318334Speter The second arg is how much to increment or decrement by. 69418334Speter For a pointer, it would be the size of the object pointed to. */ 69550397SobrienDEFTREECODE (PREDECREMENT_EXPR, "predecrement_expr", 'e', 2) 69650397SobrienDEFTREECODE (PREINCREMENT_EXPR, "preincrement_expr", 'e', 2) 69750397SobrienDEFTREECODE (POSTDECREMENT_EXPR, "postdecrement_expr", 'e', 2) 69850397SobrienDEFTREECODE (POSTINCREMENT_EXPR, "postincrement_expr", 'e', 2) 69950397Sobrien 70050397Sobrien/* Evaluate operand 1. If and only if an exception is thrown during 70150397Sobrien the evaluation of operand 1, evaluate operand 2. 70250397Sobrien 70350397Sobrien This differs from WITH_CLEANUP_EXPR, in that operand 2 is never 70450397Sobrien evaluated unless an exception is throw. */ 70550397SobrienDEFTREECODE (TRY_CATCH_EXPR, "try_catch_expr", 'e', 2) 70650397Sobrien 70750397Sobrien/* Pop the top element off the dynamic handler chain. Used in 70850397Sobrien conjunction with setjmp/longjmp based exception handling, see 70950397Sobrien except.c for more details. This is meant to be used only by the 71050397Sobrien exception handling backend, expand_dhc_cleanup specifically. */ 71150397SobrienDEFTREECODE (POPDHC_EXPR, "popdhc_expr", 's', 0) 71250397Sobrien 71350397Sobrien/* Pop the top element off the dynamic cleanup chain. Used in 71450397Sobrien conjunction with the exception handling. This is meant to be used 71550397Sobrien only by the exception handling backend. */ 71650397SobrienDEFTREECODE (POPDCC_EXPR, "popdcc_expr", 's', 0) 71718334Speter 71818334Speter/* These types of expressions have no useful value, 71918334Speter and always have side effects. */ 72018334Speter 72118334Speter/* A label definition, encapsulated as a statement. 72218334Speter Operand 0 is the LABEL_DECL node for the label that appears here. 72318334Speter The type should be void and the value should be ignored. */ 72450397SobrienDEFTREECODE (LABEL_EXPR, "label_expr", 's', 1) 72518334Speter 72618334Speter/* GOTO. Operand 0 is a LABEL_DECL node. 72718334Speter The type should be void and the value should be ignored. */ 72850397SobrienDEFTREECODE (GOTO_EXPR, "goto_expr", 's', 1) 72918334Speter 73018334Speter/* RETURN. Evaluates operand 0, then returns from the current function. 73118334Speter Presumably that operand is an assignment that stores into the 73218334Speter RESULT_DECL that hold the value to be returned. 73318334Speter The operand may be null. 73418334Speter The type should be void and the value should be ignored. */ 73550397SobrienDEFTREECODE (RETURN_EXPR, "return_expr", 's', 1) 73618334Speter 73718334Speter/* Exit the inner most loop conditionally. Operand 0 is the condition. 73818334Speter The type should be void and the value should be ignored. */ 73950397SobrienDEFTREECODE (EXIT_EXPR, "exit_expr", 's', 1) 74018334Speter 74118334Speter/* A loop. Operand 0 is the body of the loop. 74218334Speter It must contain an EXIT_EXPR or is an infinite loop. 74318334Speter The type should be void and the value should be ignored. */ 74450397SobrienDEFTREECODE (LOOP_EXPR, "loop_expr", 's', 1) 74518334Speter 74650397Sobrien/* Used to represent a tree node, such as IDENTIFIER_NODE or an EXPR 74750397Sobrien node, adding several location information: a file name, a line 74850397Sobrien number and column number. It is expanded as the node it refers to 74950397Sobrien and can be considered a no-op "conversion" with an annotation. */ 75050397SobrienDEFTREECODE (EXPR_WITH_FILE_LOCATION, "expr_with_file_location", '1', 2) 75118334Speter/* 75218334SpeterLocal variables: 75318334Spetermode:c 75418334SpeterEnd: 75518334Speter*/ 756