118334Speter/* This file contains the definitions and documentation for the 2132718Skan tree codes used in GCC. 3169689Skan Copyright (C) 1987, 1988, 1993, 1995, 1997, 1998, 2000, 2001, 2004, 2005, 4169689Skan 2006 Free Software Foundation, Inc. 518334Speter 690075SobrienThis file is part of GCC. 718334Speter 890075SobrienGCC is free software; you can redistribute it and/or modify it under 990075Sobrienthe terms of the GNU General Public License as published by the Free 1090075SobrienSoftware Foundation; either version 2, or (at your option) any later 1190075Sobrienversion. 1218334Speter 1390075SobrienGCC is distributed in the hope that it will be useful, but WITHOUT ANY 1490075SobrienWARRANTY; without even the implied warranty of MERCHANTABILITY or 1590075SobrienFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1690075Sobrienfor more details. 1718334Speter 1818334SpeterYou should have received a copy of the GNU General Public License 1990075Sobrienalong with GCC; see the file COPYING. If not, write to the Free 20169689SkanSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 21169689Skan02110-1301, USA. */ 2218334Speter 2318334Speter 24169689Skan/* For tcc_references, tcc_expression, tcc_comparison, tcc_unary, 25169689Skan tcc_binary, and tcc_statement nodes, which use struct tree_exp, the 26169689Skan 4th element is the number of argument slots to allocate. This 27169689Skan determines the size of the tree node object. Other nodes use 28169689Skan different structures, and the size is determined by the tree_union 29169689Skan member structure; the 4th element should be zero. Languages that 30169689Skan define language-specific tcc_exceptional or tcc_constant codes must 31169689Skan define the tree_size langhook to say how big they are. 3218334Speter 33169689Skan These tree codes have been sorted so that the macros in tree.h that 34169689Skan check for various tree codes are optimized into range checks. This 35169689Skan gives a measurable performance improvement. When adding a new 36169689Skan code, consider its placement in relation to the other codes. */ 37169689Skan 3818334Speter/* Any erroneous construct is parsed into a node of this type. 3918334Speter This type of node is accepted without complaint in all contexts 4018334Speter by later parsing activities, to avoid multiple error messages 4118334Speter for one error. 4218334Speter No fields in these nodes are used except the TREE_CODE. */ 43169689SkanDEFTREECODE (ERROR_MARK, "error_mark", tcc_exceptional, 0) 4418334Speter 4518334Speter/* Used to represent a name (such as, in the DECL_NAME of a decl node). 4618334Speter Internally it looks like a STRING_CST node. 4718334Speter There is only one IDENTIFIER_NODE ever made for any particular name. 4818334Speter Use `get_identifier' to get it (or create it, the first time). */ 49169689SkanDEFTREECODE (IDENTIFIER_NODE, "identifier_node", tcc_exceptional, 0) 5018334Speter 5118334Speter/* Has the TREE_VALUE and TREE_PURPOSE fields. */ 5218334Speter/* These nodes are made into lists by chaining through the 5318334Speter TREE_CHAIN field. The elements of the list live in the 5418334Speter TREE_VALUE fields, while TREE_PURPOSE fields are occasionally 5518334Speter used as well to get the effect of Lisp association lists. */ 56169689SkanDEFTREECODE (TREE_LIST, "tree_list", tcc_exceptional, 0) 5718334Speter 5818334Speter/* These nodes contain an array of tree nodes. */ 59169689SkanDEFTREECODE (TREE_VEC, "tree_vec", tcc_exceptional, 0) 6018334Speter 6118334Speter/* A symbol binding block. These are arranged in a tree, 6218334Speter where the BLOCK_SUBBLOCKS field contains a chain of subblocks 6318334Speter chained through the BLOCK_CHAIN field. 6418334Speter BLOCK_SUPERCONTEXT points to the parent block. 6518334Speter For a block which represents the outermost scope of a function, it 6618334Speter points to the FUNCTION_DECL node. 6718334Speter BLOCK_VARS points to a chain of decl nodes. 6818334Speter BLOCK_CHAIN points to the next BLOCK at the same level. 6918334Speter BLOCK_ABSTRACT_ORIGIN points to the original (abstract) tree node which 7018334Speter this block is an instance of, or else is NULL to indicate that this 7118334Speter block is not an instance of anything else. When non-NULL, the value 7218334Speter could either point to another BLOCK node or it could point to a 7318334Speter FUNCTION_DECL node (e.g. in the case of a block representing the 7418334Speter outermost scope of a particular inlining of a function). 75117395Skan BLOCK_ABSTRACT is nonzero if the block represents an abstract 7618334Speter instance of a block (i.e. one which is nested within an abstract 77169689Skan instance of an inline function). 78117395Skan TREE_ASM_WRITTEN is nonzero if the block was actually referenced 7990075Sobrien in the generated assembly. */ 80169689SkanDEFTREECODE (BLOCK, "block", tcc_exceptional, 0) 8118334Speter 8218334Speter/* Each data type is represented by a tree node whose code is one of 8318334Speter the following: */ 8418334Speter/* Each node that represents a data type has a component TYPE_SIZE 8518334Speter containing a tree that is an expression for the size in bits. 8618334Speter The TYPE_MODE contains the machine mode for values of this type. 8718334Speter The TYPE_POINTER_TO field contains a type for a pointer to this type, 8818334Speter or zero if no such has been created yet. 8918334Speter The TYPE_NEXT_VARIANT field is used to chain together types 9018334Speter that are variants made by type modifiers such as "const" and "volatile". 9118334Speter The TYPE_MAIN_VARIANT field, in any member of such a chain, 9218334Speter points to the start of the chain. 9318334Speter The TYPE_NONCOPIED_PARTS field is a list specifying which parts 9418334Speter of an object of this type should *not* be copied by assignment. 9552284Sobrien The TREE_VALUE of each is a FIELD_DECL that should not be 9652284Sobrien copied. The TREE_PURPOSE is an initial value for that field when 9752284Sobrien an object of this type is initialized via an INIT_EXPR. It may 9852284Sobrien be NULL if no special value is required. Even the things in this 9952284Sobrien list are copied if the right-hand side of an assignment is known 10052284Sobrien to be a complete object (rather than being, perhaps, a subobject 10152284Sobrien of some other object.) The determination of what constitutes a 10252284Sobrien complete object is done by fixed_type_p. 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 125169689Skan/* The ordering of the following codes is optimized for the checking 126169689Skan macros in tree.h. Changing the order will degrade the speed of the 127169689Skan compiler. OFFSET_TYPE, ENUMERAL_TYPE, BOOLEAN_TYPE, INTEGER_TYPE, 128169689Skan REAL_TYPE, POINTER_TYPE. */ 129169689Skan 130169689Skan/* An offset is a pointer relative to an object. 131169689Skan The TREE_TYPE field is the type of the object at the offset. 132169689Skan The TYPE_OFFSET_BASETYPE points to the node for the type of object 133169689Skan that the offset is relative to. */ 134169689SkanDEFTREECODE (OFFSET_TYPE, "offset_type", tcc_type, 0) 13518334Speter 13618334Speter/* C enums. The type node looks just like an INTEGER_TYPE node. 13718334Speter The symbols for the values of the enum type are defined by 13818334Speter CONST_DECL nodes, but the type does not point to them; 13918334Speter however, the TYPE_VALUES is a list in which each element's TREE_PURPOSE 14018334Speter is a name and the TREE_VALUE is the value (an INTEGER_CST node). */ 14118334Speter/* A forward reference `enum foo' when no enum named foo is defined yet 14218334Speter has zero (a null pointer) in its TYPE_SIZE. The tag name is in 14318334Speter the TYPE_NAME field. If the type is later defined, the normal 14418334Speter fields are filled in. 14518334Speter RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE forward refs are 14618334Speter treated similarly. */ 147169689SkanDEFTREECODE (ENUMERAL_TYPE, "enumeral_type", tcc_type, 0) 14818334Speter 149169689Skan/* Boolean type (true or false are the only values). Looks like an 150169689Skan INTEGRAL_TYPE. */ 151169689SkanDEFTREECODE (BOOLEAN_TYPE, "boolean_type", tcc_type, 0) 15218334Speter 153169689Skan/* Integer types in all languages, including char in C. 154169689Skan Also used for sub-ranges of other discrete types. 155169689Skan Has components TYPE_MIN_VALUE, TYPE_MAX_VALUE (expressions, inclusive) 156169689Skan and TYPE_PRECISION (number of bits used by this type). 157169689Skan In the case of a subrange type in Pascal, the TREE_TYPE 158169689Skan of this will point at the supertype (another INTEGER_TYPE, 159169689Skan or an ENUMERAL_TYPE or BOOLEAN_TYPE). 160169689Skan Otherwise, the TREE_TYPE is zero. */ 161169689SkanDEFTREECODE (INTEGER_TYPE, "integer_type", tcc_type, 0) 16218334Speter 163169689Skan/* C's float and double. Different floating types are distinguished 164169689Skan by machine mode and by the TYPE_SIZE and the TYPE_PRECISION. */ 165169689SkanDEFTREECODE (REAL_TYPE, "real_type", tcc_type, 0) 166169689Skan 167169689Skan/* The ordering of the following codes is optimized for the checking 168169689Skan macros in tree.h. Changing the order will degrade the speed of the 169169689Skan compiler. POINTER_TYPE, REFERENCE_TYPE. Note that this range 170169689Skan overlaps the previous range of ordered types. */ 171169689Skan 17218334Speter/* All pointer-to-x types have code POINTER_TYPE. 17318334Speter The TREE_TYPE points to the node for the type pointed to. */ 174169689SkanDEFTREECODE (POINTER_TYPE, "pointer_type", tcc_type, 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++. */ 178169689SkanDEFTREECODE (REFERENCE_TYPE, "reference_type", tcc_type, 0) 17918334Speter 180261188Spfg/* APPLE LOCAL begin radar 5732232 - blocks */ 181261188Spfg/* All pointer-to-block types have code BLOCK_POINTER_TYPE. 182261188Spfg The TREE_TYPE points to the node for the type pointed to. */ 183261188SpfgDEFTREECODE (BLOCK_POINTER_TYPE, "block_pointer_type", tcc_type, 0) 184261188Spfg/* APPLE LOCAL end radar 5732232 - blocks */ 185169689Skan/* The ordering of the following codes is optimized for the checking 186169689Skan macros in tree.h. Changing the order will degrade the speed of the 187169689Skan compiler. COMPLEX_TYPE, VECTOR_TYPE, ARRAY_TYPE. */ 188169689Skan 189169689Skan/* Complex number types. The TREE_TYPE field is the data type 190169689Skan of the real and imaginary parts. */ 191169689SkanDEFTREECODE (COMPLEX_TYPE, "complex_type", tcc_type, 0) 19218334Speter 193169689Skan/* Vector types. The TREE_TYPE field is the data type of the vector 194169689Skan elements. The TYPE_PRECISION field is the number of subparts of 195169689Skan the vector. */ 196169689SkanDEFTREECODE (VECTOR_TYPE, "vector_type", tcc_type, 0) 19718334Speter 198169689Skan/* The ordering of the following codes is optimized for the checking 199169689Skan macros in tree.h. Changing the order will degrade the speed of the 200169689Skan compiler. ARRAY_TYPE, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE. 201169689Skan Note that this range overlaps the previous range. */ 202169689Skan 20318334Speter/* Types of arrays. Special fields: 20418334Speter TREE_TYPE Type of an array element. 20518334Speter TYPE_DOMAIN Type to index by. 20618334Speter Its range of values specifies the array length. 20718334Speter The field TYPE_POINTER_TO (TREE_TYPE (array_type)) is always nonzero 20818334Speter and holds the type to coerce a value of that array type to in C. 20918334Speter TYPE_STRING_FLAG indicates a string (in contrast to an array of chars) 210117395Skan in languages (such as Chill) that make a distinction. */ 21118334Speter/* Array types in C or Pascal */ 212169689SkanDEFTREECODE (ARRAY_TYPE, "array_type", tcc_type, 0) 21318334Speter 21418334Speter/* Struct in C, or record in Pascal. */ 21518334Speter/* Special fields: 21650397Sobrien TYPE_FIELDS chain of FIELD_DECLs for the fields of the struct, 21750397Sobrien and VAR_DECLs, TYPE_DECLs and CONST_DECLs for record-scope variables, 21850397Sobrien types and enumerators. 21918334Speter A few may need to be added for Pascal. */ 22018334Speter/* See the comment above, before ENUMERAL_TYPE, for how 22118334Speter forward references to struct tags are handled in C. */ 222169689SkanDEFTREECODE (RECORD_TYPE, "record_type", tcc_type, 0) 22318334Speter 22418334Speter/* Union in C. Like a struct, except that the offsets of the fields 22518334Speter will all be zero. */ 22618334Speter/* See the comment above, before ENUMERAL_TYPE, for how 22718334Speter forward references to union tags are handled in C. */ 228169689SkanDEFTREECODE (UNION_TYPE, "union_type", tcc_type, 0) /* C union type */ 22918334Speter 23018334Speter/* Similar to UNION_TYPE, except that the expressions in DECL_QUALIFIER 23118334Speter in each FIELD_DECL determine what the union contains. The first 23218334Speter field whose DECL_QUALIFIER expression is true is deemed to occupy 23318334Speter the union. */ 234169689SkanDEFTREECODE (QUAL_UNION_TYPE, "qual_union_type", tcc_type, 0) 23518334Speter 236169689Skan/* The ordering of the following codes is optimized for the checking 237169689Skan macros in tree.h. Changing the order will degrade the speed of the 238169689Skan compiler. VOID_TYPE, FUNCTION_TYPE, METHOD_TYPE. */ 239169689Skan 240169689Skan/* The void type in C */ 241169689SkanDEFTREECODE (VOID_TYPE, "void_type", tcc_type, 0) 242169689Skan 24318334Speter/* Type of functions. Special fields: 24418334Speter TREE_TYPE type of value returned. 24518334Speter TYPE_ARG_TYPES list of types of arguments expected. 24618334Speter this list is made of TREE_LIST nodes. 24718334Speter Types of "Procedures" in languages where they are different from functions 24818334Speter have code FUNCTION_TYPE also, but then TREE_TYPE is zero or void type. */ 249169689SkanDEFTREECODE (FUNCTION_TYPE, "function_type", tcc_type, 0) 25018334Speter 251169689Skan/* METHOD_TYPE is the type of a function which takes an extra first 252169689Skan argument for "self", which is not present in the declared argument list. 253169689Skan The TREE_TYPE is the return type of the method. The TYPE_METHOD_BASETYPE 254169689Skan is the type of "self". TYPE_ARG_TYPES is the real argument list, which 255169689Skan includes the hidden argument for "self". */ 256169689SkanDEFTREECODE (METHOD_TYPE, "method_type", tcc_type, 0) 257169689Skan 25818334Speter/* This is a language-specific kind of type. 25918334Speter Its meaning is defined by the language front end. 26018334Speter layout_type does not know how to lay this out, 26118334Speter so the front-end must do so manually. */ 262169689SkanDEFTREECODE (LANG_TYPE, "lang_type", tcc_type, 0) 26318334Speter 26418334Speter/* Expressions */ 26518334Speter 26618334Speter/* First, the constants. */ 26718334Speter 26818334Speter/* Contents are in TREE_INT_CST_LOW and TREE_INT_CST_HIGH fields, 269169689Skan 32 bits each, giving us a 64 bit constant capability. INTEGER_CST 270169689Skan nodes can be shared, and therefore should be considered read only. 271169689Skan They should be copied, before setting a flag such as 272169689Skan TREE_OVERFLOW. If an INTEGER_CST has TREE_OVERFLOW or 273169689Skan TREE_CONSTANT_OVERFLOW already set, it is known to be unique. 274169689Skan INTEGER_CST nodes are created for the integral types, for pointer 275169689Skan types and for vector and float types in some circumstances. */ 276169689SkanDEFTREECODE (INTEGER_CST, "integer_cst", tcc_constant, 0) 27718334Speter 278132718Skan/* Contents are in TREE_REAL_CST field. */ 279169689SkanDEFTREECODE (REAL_CST, "real_cst", tcc_constant, 0) 28018334Speter 28118334Speter/* Contents are in TREE_REALPART and TREE_IMAGPART fields, 282132718Skan whose contents are other constant nodes. */ 283169689SkanDEFTREECODE (COMPLEX_CST, "complex_cst", tcc_constant, 0) 28418334Speter 28596263Sobrien/* Contents are in TREE_VECTOR_CST_ELTS field. */ 286169689SkanDEFTREECODE (VECTOR_CST, "vector_cst", tcc_constant, 0) 28796263Sobrien 288169689Skan/* Contents are TREE_STRING_LENGTH and the actual contents of the string. */ 289169689SkanDEFTREECODE (STRING_CST, "string_cst", tcc_constant, 0) 29018334Speter 291132718Skan/* Declarations. All references to names are represented as ..._DECL 292132718Skan nodes. The decls in one binding context are chained through the 293132718Skan TREE_CHAIN field. Each DECL has a DECL_NAME field which contains 294132718Skan an IDENTIFIER_NODE. (Some decls, most often labels, may have zero 295132718Skan as the DECL_NAME). DECL_CONTEXT points to the node representing 296132718Skan the context in which this declaration has its scope. For 297132718Skan FIELD_DECLs, this is the RECORD_TYPE, UNION_TYPE, or 298132718Skan QUAL_UNION_TYPE node that the field is a member of. For VAR_DECL, 299132718Skan PARM_DECL, FUNCTION_DECL, LABEL_DECL, and CONST_DECL nodes, this 300132718Skan points to either the FUNCTION_DECL for the containing function, the 301132718Skan RECORD_TYPE or UNION_TYPE for the containing type, or NULL_TREE or 302132718Skan a TRANSLATION_UNIT_DECL if the given decl has "file scope". 30318334Speter DECL_ABSTRACT_ORIGIN, if non-NULL, points to the original (abstract) 30418334Speter ..._DECL node of which this decl is an (inlined or template expanded) 30518334Speter instance. 30618334Speter The TREE_TYPE field holds the data type of the object, when relevant. 30718334Speter LABEL_DECLs have no data type. For TYPE_DECL, the TREE_TYPE field 30818334Speter contents are the type whose name is being declared. 30918334Speter The DECL_ALIGN, DECL_SIZE, 31018334Speter and DECL_MODE fields exist in decl nodes just as in type nodes. 31118334Speter They are unused in LABEL_DECL, TYPE_DECL and CONST_DECL nodes. 31218334Speter 313132718Skan DECL_FIELD_BIT_OFFSET holds an integer number of bits offset for 314132718Skan the location. DECL_VOFFSET holds an expression for a variable 315132718Skan offset; it is to be multiplied by DECL_VOFFSET_UNIT (an integer). 31618334Speter These fields are relevant only in FIELD_DECLs and PARM_DECLs. 31718334Speter 31818334Speter DECL_INITIAL holds the value to initialize a variable to, 31918334Speter or the value of a constant. For a function, it holds the body 32018334Speter (a node of type BLOCK representing the function's binding contour 32118334Speter and whose body contains the function's statements.) For a LABEL_DECL 32218334Speter in C, it is a flag, nonzero if the label's definition has been seen. 32318334Speter 32418334Speter PARM_DECLs use a special field: 32518334Speter DECL_ARG_TYPE is the type in which the argument is actually 32618334Speter passed, which may be different from its type within the function. 32718334Speter 32818334Speter FUNCTION_DECLs use four special fields: 32918334Speter DECL_ARGUMENTS holds a chain of PARM_DECL nodes for the arguments. 330169689Skan DECL_RESULT holds a RESULT_DECL node for the value of a function. 331169689Skan The DECL_RTL field is 0 for a function that returns no value. 33218334Speter (C functions returning void have zero here.) 33352284Sobrien The TREE_TYPE field is the type in which the result is actually 33452284Sobrien returned. This is usually the same as the return type of the 33552284Sobrien FUNCTION_DECL, but it may be a wider integer type because of 33652284Sobrien promotion. 33718334Speter DECL_FUNCTION_CODE is a code number that is nonzero for 33818334Speter built-in functions. Its value is an enum built_in_function 33918334Speter that says which built-in function it is. 34018334Speter 34118334Speter DECL_SOURCE_FILE holds a filename string and DECL_SOURCE_LINE 34218334Speter holds a line number. In some cases these can be the location of 34318334Speter a reference, if no definition has been seen. 34418334Speter 345117395Skan DECL_ABSTRACT is nonzero if the decl represents an abstract instance 34618334Speter of a decl (i.e. one which is nested within an abstract instance of a 34718334Speter inline function. */ 34818334Speter 349169689SkanDEFTREECODE (FUNCTION_DECL, "function_decl", tcc_declaration, 0) 350169689SkanDEFTREECODE (LABEL_DECL, "label_decl", tcc_declaration, 0) 351169689Skan/* The ordering of the following codes is optimized for the checking 352169689Skan macros in tree.h. Changing the order will degrade the speed of the 353169689Skan compiler. FIELD_DECL, VAR_DECL, CONST_DECL, PARM_DECL, 354169689Skan TYPE_DECL. */ 355169689SkanDEFTREECODE (FIELD_DECL, "field_decl", tcc_declaration, 0) 356169689SkanDEFTREECODE (VAR_DECL, "var_decl", tcc_declaration, 0) 357169689SkanDEFTREECODE (CONST_DECL, "const_decl", tcc_declaration, 0) 358169689SkanDEFTREECODE (PARM_DECL, "parm_decl", tcc_declaration, 0) 359169689SkanDEFTREECODE (TYPE_DECL, "type_decl", tcc_declaration, 0) 360169689SkanDEFTREECODE (RESULT_DECL, "result_decl", tcc_declaration, 0) 36150397Sobrien 362169689Skan/* Memory tags used in tree-ssa to represent memory locations in 363169689Skan virtual SSA. */ 364169689SkanDEFTREECODE (STRUCT_FIELD_TAG, "struct_field_tag", tcc_declaration, 0) 365169689SkanDEFTREECODE (NAME_MEMORY_TAG, "name_memory_tag", tcc_declaration, 0) 366169689SkanDEFTREECODE (SYMBOL_MEMORY_TAG, "symbol_memory_tag", tcc_declaration, 0) 367169689Skan 36850397Sobrien/* A namespace declaration. Namespaces appear in DECL_CONTEXT of other 36950397Sobrien _DECLs, providing a hierarchy of names. */ 370169689SkanDEFTREECODE (NAMESPACE_DECL, "namespace_decl", tcc_declaration, 0) 371132718Skan 372132718Skan/* A translation unit. This is not technically a declaration, since it 373132718Skan can't be looked up, but it's close enough. */ 374169689SkanDEFTREECODE (TRANSLATION_UNIT_DECL, "translation_unit_decl",\ 375169689Skan tcc_declaration, 0) 37618334Speter 37718334Speter/* References to storage. */ 37818334Speter 37918334Speter/* Value is structure or union component. 380169689Skan Operand 0 is the structure or union (an expression). 381169689Skan Operand 1 is the field (a node of type FIELD_DECL). 382169689Skan Operand 2, if present, is the value of DECL_FIELD_OFFSET, measured 383169689Skan in units of DECL_OFFSET_ALIGN / BITS_PER_UNIT. */ 384169689SkanDEFTREECODE (COMPONENT_REF, "component_ref", tcc_reference, 3) 38518334Speter 38618334Speter/* Reference to a group of bits within an object. Similar to COMPONENT_REF 38718334Speter except the position is given explicitly rather than via a FIELD_DECL. 38818334Speter Operand 0 is the structure or union expression; 38918334Speter operand 1 is a tree giving the number of bits being referenced; 39018334Speter operand 2 is a tree giving the position of the first referenced bit. 39118334Speter The field can be either a signed or unsigned field; 392169689Skan BIT_FIELD_REF_UNSIGNED says which. */ 393169689SkanDEFTREECODE (BIT_FIELD_REF, "bit_field_ref", tcc_reference, 3) 394169689Skan 395169689Skan/* The ordering of the following codes is optimized for the checking 396169689Skan macros in tree.h. Changing the order will degrade the speed of the 397169689Skan compiler. INDIRECT_REF, ALIGN_INDIRECT_REF, MISALIGNED_INDIRECT_REF. */ 398169689Skan 39918334Speter/* C unary `*' or Pascal `^'. One operand, an expression for a pointer. */ 400169689SkanDEFTREECODE (INDIRECT_REF, "indirect_ref", tcc_reference, 1) 40118334Speter 402169689Skan/* Like above, but aligns the referenced address (i.e, if the address 403169689Skan in P is not aligned on TYPE_ALIGN boundary, then &(*P) != P). */ 404169689SkanDEFTREECODE (ALIGN_INDIRECT_REF, "align_indirect_ref", tcc_reference, 1) 40518334Speter 406169689Skan/* Same as INDIRECT_REF, but also specifies the alignment of the referenced 407169689Skan address: 408169689Skan Operand 0 is the referenced address (a pointer); 409169689Skan Operand 1 is an INTEGER_CST which represents the alignment of the address, 410169689Skan or 0 if the alignment is unknown. */ 411169689SkanDEFTREECODE (MISALIGNED_INDIRECT_REF, "misaligned_indirect_ref", tcc_reference, 2) 412169689Skan 41390075Sobrien/* Array indexing. 414169689Skan Operand 0 is the array; operand 1 is a (single) array index. 415169689Skan Operand 2, if present, is a copy of TYPE_MIN_VALUE of the index. 416169689Skan Operand 3, if present, is the element size, measured in units of 417169689Skan the alignment of the element type. */ 418169689SkanDEFTREECODE (ARRAY_REF, "array_ref", tcc_reference, 4) 41918334Speter 42090075Sobrien/* Likewise, except that the result is a range ("slice") of the array. The 42190075Sobrien starting index of the resulting array is taken from operand 1 and the size 42290075Sobrien of the range is taken from the type of the expression. */ 423169689SkanDEFTREECODE (ARRAY_RANGE_REF, "array_range_ref", tcc_reference, 4) 42490075Sobrien 425169689Skan/* Used to represent lookup of runtime type dependent data. Often this is 426169689Skan a reference to a vtable, but it needn't be. Operands are: 427169689Skan OBJ_TYPE_REF_EXPR: An expression that evaluates the value to use. 428169689Skan OBJ_TYPE_REF_OBJECT: Is the object on whose behalf the lookup is 429169689Skan being performed. Through this the optimizers may be able to statically 430169689Skan determine the dynamic type of the object. 431169689Skan OBJ_TYPE_REF_TOKEN: Something front-end specific used to resolve the 432169689Skan reference to something simpler, usually to the address of a DECL. 433169689Skan Never touched by the middle-end. Good choices would be either an 434169689Skan identifier or a vtable index. */ 435169689SkanDEFTREECODE (OBJ_TYPE_REF, "obj_type_ref", tcc_expression, 3) 43690075Sobrien 437169689Skan/* The exception object from the runtime. */ 438169689SkanDEFTREECODE (EXC_PTR_EXPR, "exc_ptr_expr", tcc_expression, 0) 439169689Skan 440169689Skan/* The filter object from the runtime. */ 441169689SkanDEFTREECODE (FILTER_EXPR, "filter_expr", tcc_expression, 0) 442169689Skan 44318334Speter/* Constructor: return an aggregate value made from specified components. 44418334Speter In C, this is used only for structure and array initializers. 445169689Skan The operand is a sequence of component values made out of a VEC of 446169689Skan struct constructor_elt. 44718334Speter 44850397Sobrien For ARRAY_TYPE: 449169689Skan The field INDEX of each constructor_elt is the corresponding index. 450169689Skan If the index is a RANGE_EXPR, it is a short-hand for many nodes, 451169689Skan one for each index in the range. (If the corresponding field VALUE 45250397Sobrien has side-effects, they are evaluated once for each element. Wrap the 45350397Sobrien value in a SAVE_EXPR if you want to evaluate side effects only once.) 45418334Speter 45550397Sobrien For RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE: 456169689Skan The field INDEX of each node is a FIELD_DECL. */ 457169689SkanDEFTREECODE (CONSTRUCTOR, "constructor", tcc_exceptional, 0) 45850397Sobrien 45950397Sobrien/* The expression types are mostly straightforward, with the fourth argument 46050397Sobrien of DEFTREECODE saying how many operands there are. 46150397Sobrien Unless otherwise specified, the operands are expressions and the 46250397Sobrien types of all the operands and the expression must all be the same. */ 46350397Sobrien 46418334Speter/* Contains two expressions to compute, one followed by the other. 46550397Sobrien the first value is ignored. The second one's value is used. The 46650397Sobrien type of the first expression need not agree with the other types. */ 467169689SkanDEFTREECODE (COMPOUND_EXPR, "compound_expr", tcc_expression, 2) 46818334Speter 46918334Speter/* Assignment expression. Operand 0 is the what to set; 1, the new value. */ 470169689SkanDEFTREECODE (MODIFY_EXPR, "modify_expr", tcc_expression, 2) 47118334Speter 47218334Speter/* Initialization expression. Operand 0 is the variable to initialize; 473169689Skan Operand 1 is the initializer. This differs from MODIFY_EXPR in that any 474169689Skan reference to the referent of operand 0 within operand 1 is undefined. */ 475169689SkanDEFTREECODE (INIT_EXPR, "init_expr", tcc_expression, 2) 47618334Speter 47718334Speter/* For TARGET_EXPR, operand 0 is the target of an initialization, 478169689Skan operand 1 is the initializer for the target, which may be void 479169689Skan if simply expanding it initializes the target. 480169689Skan operand 2 is the cleanup for this node, if any. 481169689Skan operand 3 is the saved initializer after this node has been 482169689Skan expanded once; this is so we can re-expand the tree later. */ 483169689SkanDEFTREECODE (TARGET_EXPR, "target_expr", tcc_expression, 4) 48418334Speter 48518334Speter/* Conditional expression ( ... ? ... : ... in C). 48618334Speter Operand 0 is the condition. 48718334Speter Operand 1 is the then-value. 48850397Sobrien Operand 2 is the else-value. 48990075Sobrien Operand 0 may be of any type. 49090075Sobrien Operand 1 must have the same type as the entire expression, unless 49190075Sobrien it unconditionally throws an exception, in which case it should 49290075Sobrien have VOID_TYPE. The same constraints apply to operand 2. */ 493169689SkanDEFTREECODE (COND_EXPR, "cond_expr", tcc_expression, 3) 49418334Speter 495169689Skan/* Vector conditional expression. It is like COND_EXPR, but with 496169689Skan vector operands. 497169689Skan 498169689Skan A = VEC_COND_EXPR ( X < Y, B, C) 499169689Skan 500169689Skan means 501169689Skan 502169689Skan for (i=0; i<N; i++) 503169689Skan A[i] = X[i] < Y[i] ? B[i] : C[i]; 504169689Skan*/ 505169689SkanDEFTREECODE (VEC_COND_EXPR, "vec_cond_expr", tcc_expression, 3) 506169689Skan 50718334Speter/* Declare local variables, including making RTL and allocating space. 508169689Skan BIND_EXPR_VARS is a chain of VAR_DECL nodes for the variables. 509169689Skan BIND_EXPR_BODY is the body, the expression to be computed using 51018334Speter the variables. The value of operand 1 becomes that of the BIND_EXPR. 511169689Skan BIND_EXPR_BLOCK is the BLOCK that corresponds to these bindings 51218334Speter for debugging purposes. If this BIND_EXPR is actually expanded, 51318334Speter that sets the TREE_USED flag in the BLOCK. 51418334Speter 51518334Speter The BIND_EXPR is not responsible for informing parsers 51618334Speter about these variables. If the body is coming from the input file, 517169689Skan then the code that creates the BIND_EXPR is also responsible for 51818334Speter informing the parser of the variables. 51918334Speter 52018334Speter If the BIND_EXPR is ever expanded, its TREE_USED flag is set. 52118334Speter This tells the code for debugging symbol tables not to ignore the BIND_EXPR. 522169689Skan If the BIND_EXPR should be output for debugging but will not be expanded, 52318334Speter set the TREE_USED flag by hand. 52418334Speter 52518334Speter In order for the BIND_EXPR to be known at all, the code that creates it 52618334Speter must also install it as a subblock in the tree of BLOCK 52718334Speter nodes for the function. */ 528169689SkanDEFTREECODE (BIND_EXPR, "bind_expr", tcc_expression, 3) 52918334Speter 53018334Speter/* Function call. Operand 0 is the function. 53118334Speter Operand 1 is the argument list, a list of expressions 532169689Skan made out of a chain of TREE_LIST nodes. 533169689Skan Operand 2 is the static chain argument, or NULL. */ 534169689SkanDEFTREECODE (CALL_EXPR, "call_expr", tcc_expression, 3) 53518334Speter 53618334Speter/* Specify a value to compute along with its corresponding cleanup. 537169689Skan Operand 0 is the cleanup expression. 538169689Skan The cleanup is executed by the first enclosing CLEANUP_POINT_EXPR, 539169689Skan which must exist. This differs from TRY_CATCH_EXPR in that operand 1 540169689Skan is always evaluated when cleanups are run. */ 541169689SkanDEFTREECODE (WITH_CLEANUP_EXPR, "with_cleanup_expr", tcc_expression, 1) 54218334Speter 54318334Speter/* Specify a cleanup point. 54418334Speter Operand 0 is an expression that may have cleanups. If it does, those 54518334Speter cleanups are executed after the expression is expanded. 54618334Speter 54718334Speter Note that if the expression is a reference to storage, it is forced out 54818334Speter of memory before the cleanups are run. This is necessary to handle 54918334Speter cases where the cleanups modify the storage referenced; in the 55018334Speter expression 't.i', if 't' is a struct with an integer member 'i' and a 55118334Speter cleanup which modifies 'i', the value of the expression depends on 55218334Speter whether the cleanup is run before or after 't.i' is evaluated. When 55318334Speter expand_expr is run on 't.i', it returns a MEM. This is not good enough; 55418334Speter the value of 't.i' must be forced out of memory. 55518334Speter 55618334Speter As a consequence, the operand of a CLEANUP_POINT_EXPR must not have 55718334Speter BLKmode, because it will not be forced out of memory. */ 558169689SkanDEFTREECODE (CLEANUP_POINT_EXPR, "cleanup_point_expr", tcc_expression, 1) 55918334Speter 56018334Speter/* The following two codes are used in languages that have types where 56190075Sobrien some field in an object of the type contains a value that is used in 56290075Sobrien the computation of another field's offset or size and/or the size of 56390075Sobrien the type. The positions and/or sizes of fields can vary from object 564132718Skan to object of the same type or even for one and the same object within 565132718Skan its scope. 56618334Speter 56790075Sobrien Record types with discriminants in Ada or schema types in Pascal are 56890075Sobrien examples of such types. This mechanism is also used to create "fat 56990075Sobrien pointers" for unconstrained array types in Ada; the fat pointer is a 57090075Sobrien structure one of whose fields is a pointer to the actual array type 57190075Sobrien and the other field is a pointer to a template, which is a structure 57290075Sobrien containing the bounds of the array. The bounds in the type pointed 57390075Sobrien to by the first field in the fat pointer refer to the values in the 57490075Sobrien template. 57518334Speter 57690075Sobrien When you wish to construct such a type you need "self-references" 57790075Sobrien that allow you to reference the object having this type from the 57890075Sobrien TYPE node, i.e. without having a variable instantiating this type. 57918334Speter 58090075Sobrien Such a "self-references" is done using a PLACEHOLDER_EXPR. This is 58190075Sobrien a node that will later be replaced with the object being referenced. 58290075Sobrien Its type is that of the object and selects which object to use from 58390075Sobrien a chain of references (see below). No other slots are used in the 58490075Sobrien PLACEHOLDER_EXPR. 58518334Speter 58690075Sobrien For example, if your type FOO is a RECORD_TYPE with a field BAR, 58790075Sobrien and you need the value of <variable>.BAR to calculate TYPE_SIZE 58890075Sobrien (FOO), just substitute <variable> above with a PLACEHOLDER_EXPR 589132718Skan whose TREE_TYPE is FOO. Then construct your COMPONENT_REF with 590132718Skan the PLACEHOLDER_EXPR as the first operand (which has the correct 591132718Skan type). Later, when the size is needed in the program, the back-end 592132718Skan will find this PLACEHOLDER_EXPR and generate code to calculate the 593132718Skan actual size at run-time. In the following, we describe how this 594132718Skan calculation is done. 595132718Skan 596169689Skan When we wish to evaluate a size or offset, we check whether it contains a 597169689Skan PLACEHOLDER_EXPR. If it does, we call substitute_placeholder_in_expr 598169689Skan passing both that tree and an expression within which the object may be 599169689Skan found. The latter expression is the object itself in the simple case of 600169689Skan an Ada record with discriminant, but it can be the array in the case of an 601169689Skan unconstrained array. 60218334Speter 60390075Sobrien In the latter case, we need the fat pointer, because the bounds of 60490075Sobrien the array can only be accessed from it. However, we rely here on the 60590075Sobrien fact that the expression for the array contains the dereference of 606169689Skan the fat pointer that obtained the array pointer. */ 60790075Sobrien 608169689Skan/* Denotes a record to later be substituted before evaluating this expression. 609169689Skan The type of this expression is used to find the record to replace it. */ 610169689SkanDEFTREECODE (PLACEHOLDER_EXPR, "placeholder_expr", tcc_exceptional, 0) 61118334Speter 61250397Sobrien/* Simple arithmetic. */ 613169689SkanDEFTREECODE (PLUS_EXPR, "plus_expr", tcc_binary, 2) 614169689SkanDEFTREECODE (MINUS_EXPR, "minus_expr", tcc_binary, 2) 615169689SkanDEFTREECODE (MULT_EXPR, "mult_expr", tcc_binary, 2) 61618334Speter 61718334Speter/* Division for integer result that rounds the quotient toward zero. */ 618169689SkanDEFTREECODE (TRUNC_DIV_EXPR, "trunc_div_expr", tcc_binary, 2) 61918334Speter 62018334Speter/* Division for integer result that rounds the quotient toward infinity. */ 621169689SkanDEFTREECODE (CEIL_DIV_EXPR, "ceil_div_expr", tcc_binary, 2) 62218334Speter 62318334Speter/* Division for integer result that rounds toward minus infinity. */ 624169689SkanDEFTREECODE (FLOOR_DIV_EXPR, "floor_div_expr", tcc_binary, 2) 62518334Speter 62618334Speter/* Division for integer result that rounds toward nearest integer. */ 627169689SkanDEFTREECODE (ROUND_DIV_EXPR, "round_div_expr", tcc_binary, 2) 62818334Speter 62918334Speter/* Four kinds of remainder that go with the four kinds of division. */ 630169689SkanDEFTREECODE (TRUNC_MOD_EXPR, "trunc_mod_expr", tcc_binary, 2) 631169689SkanDEFTREECODE (CEIL_MOD_EXPR, "ceil_mod_expr", tcc_binary, 2) 632169689SkanDEFTREECODE (FLOOR_MOD_EXPR, "floor_mod_expr", tcc_binary, 2) 633169689SkanDEFTREECODE (ROUND_MOD_EXPR, "round_mod_expr", tcc_binary, 2) 63418334Speter 63550397Sobrien/* Division for real result. */ 636169689SkanDEFTREECODE (RDIV_EXPR, "rdiv_expr", tcc_binary, 2) 63718334Speter 63818334Speter/* Division which is not supposed to need rounding. 63918334Speter Used for pointer subtraction in C. */ 640169689SkanDEFTREECODE (EXACT_DIV_EXPR, "exact_div_expr", tcc_binary, 2) 64118334Speter 64218334Speter/* Conversion of real to fixed point: four ways to round, 64318334Speter like the four ways to divide. 64418334Speter CONVERT_EXPR can also be used to convert a real to an integer, 64518334Speter and that is what is used in languages that do not have ways of 64618334Speter specifying which of these is wanted. Maybe these are not needed. */ 647169689SkanDEFTREECODE (FIX_TRUNC_EXPR, "fix_trunc_expr", tcc_unary, 1) 648169689SkanDEFTREECODE (FIX_CEIL_EXPR, "fix_ceil_expr", tcc_unary, 1) 649169689SkanDEFTREECODE (FIX_FLOOR_EXPR, "fix_floor_expr", tcc_unary, 1) 650169689SkanDEFTREECODE (FIX_ROUND_EXPR, "fix_round_expr", tcc_unary, 1) 65118334Speter 65218334Speter/* Conversion of an integer to a real. */ 653169689SkanDEFTREECODE (FLOAT_EXPR, "float_expr", tcc_unary, 1) 65418334Speter 65550397Sobrien/* Unary negation. */ 656169689SkanDEFTREECODE (NEGATE_EXPR, "negate_expr", tcc_unary, 1) 65718334Speter 658169689Skan/* Minimum and maximum values. When used with floating point, if both 659169689Skan operands are zeros, or if either operand is NaN, then it is unspecified 660169689Skan which of the two operands is returned as the result. */ 661169689SkanDEFTREECODE (MIN_EXPR, "min_expr", tcc_binary, 2) 662169689SkanDEFTREECODE (MAX_EXPR, "max_expr", tcc_binary, 2) 66390075Sobrien 66490075Sobrien/* Represents the absolute value of the operand. 66590075Sobrien 66690075Sobrien An ABS_EXPR must have either an INTEGER_TYPE or a REAL_TYPE. The 66790075Sobrien operand of the ABS_EXPR must have the same type. */ 668169689SkanDEFTREECODE (ABS_EXPR, "abs_expr", tcc_unary, 1) 66990075Sobrien 67018334Speter/* Shift operations for shift and rotate. 67190075Sobrien Shift means logical shift if done on an 67290075Sobrien unsigned type, arithmetic shift if done on a signed type. 67318334Speter The second operand is the number of bits to 67490075Sobrien shift by; it need not be the same type as the first operand and result. 67590075Sobrien Note that the result is undefined if the second operand is larger 676169689Skan than or equal to the first operand's type size. */ 677169689SkanDEFTREECODE (LSHIFT_EXPR, "lshift_expr", tcc_binary, 2) 678169689SkanDEFTREECODE (RSHIFT_EXPR, "rshift_expr", tcc_binary, 2) 679169689SkanDEFTREECODE (LROTATE_EXPR, "lrotate_expr", tcc_binary, 2) 680169689SkanDEFTREECODE (RROTATE_EXPR, "rrotate_expr", tcc_binary, 2) 68118334Speter 68218334Speter/* Bitwise operations. Operands have same mode as result. */ 683169689SkanDEFTREECODE (BIT_IOR_EXPR, "bit_ior_expr", tcc_binary, 2) 684169689SkanDEFTREECODE (BIT_XOR_EXPR, "bit_xor_expr", tcc_binary, 2) 685169689SkanDEFTREECODE (BIT_AND_EXPR, "bit_and_expr", tcc_binary, 2) 686169689SkanDEFTREECODE (BIT_NOT_EXPR, "bit_not_expr", tcc_unary, 1) 68718334Speter 68890075Sobrien/* ANDIF and ORIF allow the second operand not to be computed if the 68990075Sobrien value of the expression is determined from the first operand. AND, 69090075Sobrien OR, and XOR always compute the second operand whether its value is 69190075Sobrien needed or not (for side effects). The operand may have 69290075Sobrien BOOLEAN_TYPE or INTEGER_TYPE. In either case, the argument will be 69390075Sobrien either zero or one. For example, a TRUTH_NOT_EXPR will never have 694117395Skan an INTEGER_TYPE VAR_DECL as its argument; instead, a NE_EXPR will be 69590075Sobrien used to compare the VAR_DECL to zero, thereby obtaining a node with 69690075Sobrien value zero or one. */ 697169689SkanDEFTREECODE (TRUTH_ANDIF_EXPR, "truth_andif_expr", tcc_expression, 2) 698169689SkanDEFTREECODE (TRUTH_ORIF_EXPR, "truth_orif_expr", tcc_expression, 2) 699169689SkanDEFTREECODE (TRUTH_AND_EXPR, "truth_and_expr", tcc_expression, 2) 700169689SkanDEFTREECODE (TRUTH_OR_EXPR, "truth_or_expr", tcc_expression, 2) 701169689SkanDEFTREECODE (TRUTH_XOR_EXPR, "truth_xor_expr", tcc_expression, 2) 702169689SkanDEFTREECODE (TRUTH_NOT_EXPR, "truth_not_expr", tcc_expression, 1) 70318334Speter 70418334Speter/* Relational operators. 70518334Speter `EQ_EXPR' and `NE_EXPR' are allowed for any types. 70618334Speter The others are allowed only for integer (or pointer or enumeral) 70718334Speter or real types. 70818334Speter In all cases the operands will have the same type, 70918334Speter and the value is always the type used by the language for booleans. */ 710169689SkanDEFTREECODE (LT_EXPR, "lt_expr", tcc_comparison, 2) 711169689SkanDEFTREECODE (LE_EXPR, "le_expr", tcc_comparison, 2) 712169689SkanDEFTREECODE (GT_EXPR, "gt_expr", tcc_comparison, 2) 713169689SkanDEFTREECODE (GE_EXPR, "ge_expr", tcc_comparison, 2) 714169689SkanDEFTREECODE (EQ_EXPR, "eq_expr", tcc_comparison, 2) 715169689SkanDEFTREECODE (NE_EXPR, "ne_expr", tcc_comparison, 2) 71618334Speter 71790075Sobrien/* Additional relational operators for floating point unordered. */ 718169689SkanDEFTREECODE (UNORDERED_EXPR, "unordered_expr", tcc_comparison, 2) 719169689SkanDEFTREECODE (ORDERED_EXPR, "ordered_expr", tcc_comparison, 2) 72090075Sobrien 721117395Skan/* These are equivalent to unordered or ... */ 722169689SkanDEFTREECODE (UNLT_EXPR, "unlt_expr", tcc_comparison, 2) 723169689SkanDEFTREECODE (UNLE_EXPR, "unle_expr", tcc_comparison, 2) 724169689SkanDEFTREECODE (UNGT_EXPR, "ungt_expr", tcc_comparison, 2) 725169689SkanDEFTREECODE (UNGE_EXPR, "unge_expr", tcc_comparison, 2) 726169689SkanDEFTREECODE (UNEQ_EXPR, "uneq_expr", tcc_comparison, 2) 72790075Sobrien 728169689Skan/* This is the reverse of uneq_expr. */ 729169689SkanDEFTREECODE (LTGT_EXPR, "ltgt_expr", tcc_comparison, 2) 73018334Speter 731169689SkanDEFTREECODE (RANGE_EXPR, "range_expr", tcc_binary, 2) 732169689Skan 73318334Speter/* Represents a conversion of type of a value. 73418334Speter All conversions, including implicit ones, must be 73550397Sobrien represented by CONVERT_EXPR or NOP_EXPR nodes. */ 736169689SkanDEFTREECODE (CONVERT_EXPR, "convert_expr", tcc_unary, 1) 73718334Speter 73818334Speter/* Represents a conversion expected to require no code to be generated. */ 739169689SkanDEFTREECODE (NOP_EXPR, "nop_expr", tcc_unary, 1) 74018334Speter 74118334Speter/* Value is same as argument, but guaranteed not an lvalue. */ 742169689SkanDEFTREECODE (NON_LVALUE_EXPR, "non_lvalue_expr", tcc_unary, 1) 74318334Speter 74490075Sobrien/* Represents viewing something of one type as being of a second type. 74590075Sobrien This corresponds to an "Unchecked Conversion" in Ada and roughly to 74690075Sobrien the idiom *(type2 *)&X in C. The only operand is the value to be 74790075Sobrien viewed as being of another type. It is undefined if the type of the 74890075Sobrien input and of the expression have different sizes. 74990075Sobrien 75090075Sobrien This code may also be used within the LHS of a MODIFY_EXPR, in which 75190075Sobrien case no actual data motion may occur. TREE_ADDRESSABLE will be set in 75290075Sobrien this case and GCC must abort if it could not do the operation without 75390075Sobrien generating insns. */ 754169689SkanDEFTREECODE (VIEW_CONVERT_EXPR, "view_convert_expr", tcc_reference, 1) 75590075Sobrien 75618334Speter/* Represents something we computed once and will use multiple times. 757169689Skan First operand is that expression. After it is evaluated once, it 758169689Skan will be replaced by the temporary variable that holds the value. */ 759169689SkanDEFTREECODE (SAVE_EXPR, "save_expr", tcc_expression, 1) 76018334Speter 76118334Speter/* & in C. Value is the address at which the operand's value resides. 76218334Speter Operand may have any mode. Result mode is Pmode. */ 763169689SkanDEFTREECODE (ADDR_EXPR, "addr_expr", tcc_expression, 1) 76418334Speter 765169689Skan/* Operand0 is a function constant; result is part N of a function 76690075Sobrien descriptor of type ptr_mode. */ 767169689SkanDEFTREECODE (FDESC_EXPR, "fdesc_expr", tcc_expression, 2) 76890075Sobrien 76918334Speter/* Given two real or integer operands of the same type, 77018334Speter returns a complex value of the corresponding complex type. */ 771169689SkanDEFTREECODE (COMPLEX_EXPR, "complex_expr", tcc_binary, 2) 77218334Speter 77350397Sobrien/* Complex conjugate of operand. Used only on complex types. */ 774169689SkanDEFTREECODE (CONJ_EXPR, "conj_expr", tcc_unary, 1) 77518334Speter 77618334Speter/* Used only on an operand of complex type, these return 77718334Speter a value of the corresponding component type. */ 778169689SkanDEFTREECODE (REALPART_EXPR, "realpart_expr", tcc_reference, 1) 779169689SkanDEFTREECODE (IMAGPART_EXPR, "imagpart_expr", tcc_reference, 1) 78018334Speter 781117395Skan/* Nodes for ++ and -- in C. 782117395Skan The second arg is how much to increment or decrement by. 783117395Skan For a pointer, it would be the size of the object pointed to. */ 784169689SkanDEFTREECODE (PREDECREMENT_EXPR, "predecrement_expr", tcc_expression, 2) 785169689SkanDEFTREECODE (PREINCREMENT_EXPR, "preincrement_expr", tcc_expression, 2) 786169689SkanDEFTREECODE (POSTDECREMENT_EXPR, "postdecrement_expr", tcc_expression, 2) 787169689SkanDEFTREECODE (POSTINCREMENT_EXPR, "postincrement_expr", tcc_expression, 2) 78850397Sobrien 78990075Sobrien/* Used to implement `va_arg'. */ 790169689SkanDEFTREECODE (VA_ARG_EXPR, "va_arg_expr", tcc_expression, 1) 79190075Sobrien 79250397Sobrien/* Evaluate operand 1. If and only if an exception is thrown during 79350397Sobrien the evaluation of operand 1, evaluate operand 2. 79450397Sobrien 795169689Skan This differs from TRY_FINALLY_EXPR in that operand 2 is not evaluated 796169689Skan on a normal or jump exit, only on an exception. */ 797169689SkanDEFTREECODE (TRY_CATCH_EXPR, "try_catch_expr", tcc_statement, 2) 79850397Sobrien 79952284Sobrien/* Evaluate the first operand. 800117395Skan The second operand is a cleanup expression which is evaluated 801132718Skan on any exit (normal, exception, or jump out) from this expression. */ 802169689SkanDEFTREECODE (TRY_FINALLY_EXPR, "try_finally", tcc_statement, 2) 80318334Speter 80418334Speter/* These types of expressions have no useful value, 80518334Speter and always have side effects. */ 80618334Speter 807169689Skan/* Used to represent a local declaration. The operand is DECL_EXPR_DECL. */ 808169689SkanDEFTREECODE (DECL_EXPR, "decl_expr", tcc_statement, 1) 809169689Skan 81018334Speter/* A label definition, encapsulated as a statement. 81118334Speter Operand 0 is the LABEL_DECL node for the label that appears here. 81218334Speter The type should be void and the value should be ignored. */ 813169689SkanDEFTREECODE (LABEL_EXPR, "label_expr", tcc_statement, 1) 81418334Speter 81552284Sobrien/* GOTO. Operand 0 is a LABEL_DECL node or an expression. 81618334Speter The type should be void and the value should be ignored. */ 817169689SkanDEFTREECODE (GOTO_EXPR, "goto_expr", tcc_statement, 1) 81818334Speter 81918334Speter/* RETURN. Evaluates operand 0, then returns from the current function. 82018334Speter Presumably that operand is an assignment that stores into the 82118334Speter RESULT_DECL that hold the value to be returned. 82218334Speter The operand may be null. 82318334Speter The type should be void and the value should be ignored. */ 824169689SkanDEFTREECODE (RETURN_EXPR, "return_expr", tcc_statement, 1) 82518334Speter 82618334Speter/* Exit the inner most loop conditionally. Operand 0 is the condition. 82718334Speter The type should be void and the value should be ignored. */ 828169689SkanDEFTREECODE (EXIT_EXPR, "exit_expr", tcc_statement, 1) 82918334Speter 83018334Speter/* A loop. Operand 0 is the body of the loop. 83118334Speter It must contain an EXIT_EXPR or is an infinite loop. 83218334Speter The type should be void and the value should be ignored. */ 833169689SkanDEFTREECODE (LOOP_EXPR, "loop_expr", tcc_statement, 1) 83418334Speter 835169689Skan/* Switch expression. 83652284Sobrien 837169689Skan TREE_TYPE is the original type of the condition, before any 838169689Skan language required type conversions. It may be NULL, in which case 839169689Skan the original type and final types are assumed to be the same. 84052284Sobrien 84152284Sobrien Operand 0 is the expression used to perform the branch, 842169689Skan Operand 1 is the body of the switch, which probably contains 843169689Skan CASE_LABEL_EXPRs. It may also be NULL, in which case operand 2 844169689Skan must not be NULL. 845169689Skan Operand 2 is either NULL_TREE or a TREE_VEC of the CASE_LABEL_EXPRs 846169689Skan of all the cases. */ 847169689SkanDEFTREECODE (SWITCH_EXPR, "switch_expr", tcc_statement, 3) 84890075Sobrien 849169689Skan/* Used to represent a case label. The operands are CASE_LOW and 850169689Skan CASE_HIGH, respectively. If CASE_LOW is NULL_TREE, the label is a 851169689Skan 'default' label. If CASE_HIGH is NULL_TREE, the label is a normal case 852169689Skan label. CASE_LABEL is the corresponding LABEL_DECL. */ 853169689SkanDEFTREECODE (CASE_LABEL_EXPR, "case_label_expr", tcc_statement, 3) 85490075Sobrien 855169689Skan/* RESX. Resume execution after an exception. Operand 0 is a 856169689Skan number indicating the exception region that is being left. */ 857169689SkanDEFTREECODE (RESX_EXPR, "resx_expr", tcc_statement, 1) 858169689Skan 859169689Skan/* Used to represent an inline assembly statement. ASM_STRING returns a 860169689Skan STRING_CST for the instruction (e.g., "mov x, y"). ASM_OUTPUTS, 861169689Skan ASM_INPUTS, and ASM_CLOBBERS represent the outputs, inputs, and clobbers 862169689Skan for the statement. */ 863169689SkanDEFTREECODE (ASM_EXPR, "asm_expr", tcc_statement, 4) 864169689Skan 865169689Skan/* Variable references for SSA analysis. New SSA names are created every 866169689Skan time a variable is assigned a new value. The SSA builder uses SSA_NAME 867169689Skan nodes to implement SSA versioning. */ 868169689SkanDEFTREECODE (SSA_NAME, "ssa_name", tcc_exceptional, 0) 869169689Skan 870169689Skan/* SSA PHI operator. PHI_RESULT is the new SSA_NAME node created by 871169689Skan the PHI node. PHI_ARG_LENGTH is the number of arguments. 872169689Skan PHI_ARG_ELT returns the Ith tuple <ssa_name, edge> from the 873169689Skan argument list. Each tuple contains the incoming reaching 874169689Skan definition (SSA_NAME node) and the edge via which that definition 875169689Skan is coming through. */ 876169689SkanDEFTREECODE (PHI_NODE, "phi_node", tcc_exceptional, 0) 877169689Skan 878169689Skan/* Used to represent a typed exception handler. CATCH_TYPES is the type (or 879169689Skan list of types) handled, and CATCH_BODY is the code for the handler. */ 880169689SkanDEFTREECODE (CATCH_EXPR, "catch_expr", tcc_statement, 2) 881169689Skan 882169689Skan/* Used to represent an exception specification. EH_FILTER_TYPES is a list 883169689Skan of allowed types, and EH_FILTER_FAILURE is an expression to evaluate on 884169689Skan failure. EH_FILTER_MUST_NOT_THROW controls which range type to use when 885169689Skan expanding. */ 886169689SkanDEFTREECODE (EH_FILTER_EXPR, "eh_filter_expr", tcc_statement, 2) 887169689Skan 888169689Skan/* Node used for describing a property that is known at compile 889169689Skan time. */ 890169689SkanDEFTREECODE (SCEV_KNOWN, "scev_known", tcc_expression, 0) 891169689Skan 892169689Skan/* Node used for describing a property that is not known at compile 893169689Skan time. */ 894169689SkanDEFTREECODE (SCEV_NOT_KNOWN, "scev_not_known", tcc_expression, 0) 895169689Skan 896169689Skan/* Polynomial chains of recurrences. 897169689Skan Under the form: cr = {CHREC_LEFT (cr), +, CHREC_RIGHT (cr)}. */ 898169689SkanDEFTREECODE (POLYNOMIAL_CHREC, "polynomial_chrec", tcc_expression, 3) 899169689Skan 900169689Skan/* Used to chain children of container statements together. 901169689Skan Use the interface in tree-iterator.h to access this node. */ 902169689SkanDEFTREECODE (STATEMENT_LIST, "statement_list", tcc_exceptional, 0) 903169689Skan 904169689Skan/* Value handles. Artificial nodes to represent expressions in 905169689Skan partial redundancy elimination (tree-ssa-pre.c). These nodes are 906169689Skan used for expression canonicalization. If two expressions compute 907169689Skan the same value, they will be assigned the same value handle. */ 908169689SkanDEFTREECODE (VALUE_HANDLE, "value_handle", tcc_exceptional, 0) 909169689Skan 910169689Skan/* Predicate assertion. Artificial expression generated by the optimizers 911169689Skan to keep track of predicate values. This expression may only appear on 912169689Skan the RHS of assignments. 913169689Skan 914169689Skan Given X = ASSERT_EXPR <Y, EXPR>, the optimizers can infer 915169689Skan two things: 916169689Skan 917169689Skan 1- X is a copy of Y. 918169689Skan 2- EXPR is a GIMPLE conditional expression (as defined by 919169689Skan is_gimple_condexpr) and is known to be true. 920169689Skan 921169689Skan The type of the expression is the same as Y. */ 922169689SkanDEFTREECODE (ASSERT_EXPR, "assert_expr", tcc_expression, 2) 923169689Skan 924169689Skan/* Base class information. Holds information about a class as a 925169689Skan baseclass of itself or another class. */ 926169689SkanDEFTREECODE (TREE_BINFO, "tree_binfo", tcc_exceptional, 0) 927169689Skan 928169689Skan/* Records the size for an expression of variable size type. This is 929169689Skan for use in contexts in which we are accessing the entire object, 930169689Skan such as for a function call, or block copy. 931169689Skan Operand 0 is the real expression. 932169689Skan Operand 1 is the size of the type in the expression. */ 933169689SkanDEFTREECODE (WITH_SIZE_EXPR, "with_size_expr", tcc_expression, 2) 934169689Skan 935169689Skan/* Extract elements from two input vectors Operand 0 and Operand 1 936169689Skan size VS, according to the offset OFF defined by Operand 2 as 937169689Skan follows: 938169689Skan If OFF > 0, the last VS - OFF elements of vector OP0 are concatenated to 939169689Skan the first OFF elements of the vector OP1. 940169689Skan If OFF == 0, then the returned vector is OP1. 941169689Skan On different targets OFF may take different forms; It can be an address, in 942169689Skan which case its low log2(VS)-1 bits define the offset, or it can be a mask 943169689Skan generated by the builtin targetm.vectorize.mask_for_load_builtin_decl. */ 944169689SkanDEFTREECODE (REALIGN_LOAD_EXPR, "realign_load", tcc_expression, 3) 945169689Skan 946169689Skan/* Low-level memory addressing. Operands are SYMBOL (static or global 947169689Skan variable), BASE (register), INDEX (register), STEP (integer constant), 948169689Skan OFFSET (integer constant). Corresponding address is 949169689Skan SYMBOL + BASE + STEP * INDEX + OFFSET. Only variations and values valid on 950169689Skan the target are allowed. 951169689Skan 952169689Skan The type of STEP, INDEX and OFFSET is sizetype. The type of BASE is 953169689Skan sizetype or a pointer type (if SYMBOL is NULL). 954169689Skan 955169689Skan The sixth argument is the reference to the original memory access, which 956169689Skan is preserved for the purposes of the RTL alias analysis. The seventh 957169689Skan argument is a tag representing results of the tree level alias analysis. */ 958169689Skan 959169689SkanDEFTREECODE (TARGET_MEM_REF, "target_mem_ref", tcc_reference, 7) 960169689Skan 961169689Skan/* The ordering of the codes between OMP_PARALLEL and OMP_CRITICAL is 962169689Skan exposed to TREE_RANGE_CHECK. */ 963169689Skan/* OpenMP - #pragma omp parallel [clause1 ... clauseN] 964169689Skan Operand 0: OMP_PARALLEL_BODY: Code to be executed by all threads. 965169689Skan Operand 1: OMP_PARALLEL_CLAUSES: List of clauses. 966169689Skan Operand 2: OMP_PARALLEL_FN: FUNCTION_DECL used when outlining the 967169689Skan body of the parallel region. Only valid after 968169689Skan pass_lower_omp. 969169689Skan Operand 3: OMP_PARALLEL_DATA_ARG: Local variable in the parent 970169689Skan function containing data to be shared with the child 971169689Skan function. */ 972169689Skan 973169689SkanDEFTREECODE (OMP_PARALLEL, "omp_parallel", tcc_statement, 4) 974169689Skan 975169689Skan/* OpenMP - #pragma omp for [clause1 ... clauseN] 976169689Skan Operand 0: OMP_FOR_BODY: Loop body. 977169689Skan Operand 1: OMP_FOR_CLAUSES: List of clauses. 978169689Skan Operand 2: OMP_FOR_INIT: Initialization code of the form 979169689Skan VAR = N1. 980169689Skan Operand 3: OMP_FOR_COND: Loop conditional expression of the form 981169689Skan VAR { <, >, <=, >= } N2. 982169689Skan Operand 4: OMP_FOR_INCR: Loop index increment of the form 983169689Skan VAR { +=, -= } INCR. 984169689Skan Operand 5: OMP_FOR_PRE_BODY: Filled by the gimplifier with things 985169689Skan from INIT, COND, and INCR that are technically part of the 986169689Skan OMP_FOR structured block, but are evaluated before the loop 987169689Skan body begins. 988169689Skan 989169689Skan VAR must be a signed integer variable, which is implicitly thread 990169689Skan private. N1, N2 and INCR are required to be loop invariant integer 991169689Skan expressions that are evaluated without any synchronization. 992169689Skan The evaluation order, frequency of evaluation and side-effects are 993169689Skan unspecified by the standard. */ 994169689SkanDEFTREECODE (OMP_FOR, "omp_for", tcc_statement, 6) 995169689Skan 996169689Skan/* OpenMP - #pragma omp sections [clause1 ... clauseN] 997169689Skan Operand 0: OMP_SECTIONS_BODY: Sections body. 998169689Skan Operand 1: OMP_SECTIONS_CLAUSES: List of clauses. */ 999169689SkanDEFTREECODE (OMP_SECTIONS, "omp_sections", tcc_statement, 2) 1000169689Skan 1001169689Skan/* OpenMP - #pragma omp single 1002169689Skan Operand 0: OMP_SINGLE_BODY: Single section body. 1003169689Skan Operand 1: OMP_SINGLE_CLAUSES: List of clauses. */ 1004169689SkanDEFTREECODE (OMP_SINGLE, "omp_single", tcc_statement, 2) 1005169689Skan 1006169689Skan/* OpenMP - #pragma omp section 1007169689Skan Operand 0: OMP_SECTION_BODY: Section body. */ 1008169689SkanDEFTREECODE (OMP_SECTION, "omp_section", tcc_statement, 1) 1009169689Skan 1010169689Skan/* OpenMP - #pragma omp master 1011169689Skan Operand 0: OMP_MASTER_BODY: Master section body. */ 1012169689SkanDEFTREECODE (OMP_MASTER, "omp_master", tcc_statement, 1) 1013169689Skan 1014169689Skan/* OpenMP - #pragma omp ordered 1015169689Skan Operand 0: OMP_ORDERED_BODY: Master section body. */ 1016169689SkanDEFTREECODE (OMP_ORDERED, "omp_ordered", tcc_statement, 1) 1017169689Skan 1018169689Skan/* OpenMP - #pragma omp critical [name] 1019169689Skan Operand 0: OMP_CRITICAL_BODY: Critical section body. 1020169689Skan Operand 1: OMP_CRITICAL_NAME: Identifier for critical section. */ 1021169689SkanDEFTREECODE (OMP_CRITICAL, "omp_critical", tcc_statement, 2) 1022169689Skan 1023169689Skan/* Return from an OpenMP directive. */ 1024169689SkanDEFTREECODE (OMP_RETURN, "omp_return", tcc_statement, 0) 1025169689Skan 1026169689Skan/* OpenMP - An intermediate tree code to mark the location of the 1027169689Skan loop or sections iteration in the partially lowered code. */ 1028169689SkanDEFTREECODE (OMP_CONTINUE, "omp_continue", tcc_statement, 0) 1029169689Skan 1030169689Skan/* OpenMP - #pragma omp atomic 1031169689Skan Operand 0: The address at which the atomic operation is to be performed. 1032169689Skan This address should be stabilized with save_expr. 1033169689Skan Operand 1: The expression to evaluate. When the old value of the object 1034169689Skan at the address is used in the expression, it should appear as if 1035169689Skan build_fold_indirect_ref of the address. */ 1036169689SkanDEFTREECODE (OMP_ATOMIC, "omp_atomic", tcc_statement, 2) 1037169689Skan 1038169689Skan/* OpenMP clauses. */ 1039169689SkanDEFTREECODE (OMP_CLAUSE, "omp_clause", tcc_exceptional, 0) 1040169689Skan 1041169689Skan/* Reduction operations. 1042169689Skan Operations that take a vector of elements and "reduce" it to a scalar 1043169689Skan result (e.g. summing the elements of the vector, finding the minimum over 1044169689Skan the vector elements, etc). 1045169689Skan Operand 0 is a vector; the first element in the vector has the result. 1046169689Skan Operand 1 is a vector. */ 1047169689SkanDEFTREECODE (REDUC_MAX_EXPR, "reduc_max_expr", tcc_unary, 1) 1048169689SkanDEFTREECODE (REDUC_MIN_EXPR, "reduc_min_expr", tcc_unary, 1) 1049169689SkanDEFTREECODE (REDUC_PLUS_EXPR, "reduc_plus_expr", tcc_unary, 1) 1050169689Skan 1051169689Skan/* Widenning dot-product. 1052169689Skan The first two arguments are of type t1. 1053169689Skan The third argument and the result are of type t2, such that t2 is at least 1054169689Skan twice the size of t1. DOT_PROD_EXPR(arg1,arg2,arg3) is equivalent to: 1055169689Skan tmp = WIDEN_MULT_EXPR(arg1, arg2); 1056169689Skan arg3 = PLUS_EXPR (tmp, arg3); 1057169689Skan or: 1058169689Skan tmp = WIDEN_MULT_EXPR(arg1, arg2); 1059169689Skan arg3 = WIDEN_SUM_EXPR (tmp, arg3); */ 1060169689SkanDEFTREECODE (DOT_PROD_EXPR, "dot_prod_expr", tcc_expression, 3) 1061169689Skan 1062169689Skan/* Widenning summation. 1063169689Skan The first argument is of type t1. 1064169689Skan The second argument is of type t2, such that t2 is at least twice 1065169689Skan the size of t1. The type of the entire expression is also t2. 1066169689Skan WIDEN_SUM_EXPR is equivalent to first widening (promoting) 1067169689Skan the first argument from type t1 to type t2, and then summing it 1068169689Skan with the second argument. */ 1069169689SkanDEFTREECODE (WIDEN_SUM_EXPR, "widen_sum_expr", tcc_binary, 2) 1070169689Skan 1071169689Skan/* Widenning multiplication. 1072169689Skan The two arguments are of type t1. 1073169689Skan The result is of type t2, such that t2 is at least twice 1074169689Skan the size of t1. WIDEN_MULT_EXPR is equivalent to first widening (promoting) 1075169689Skan the arguments from type t1 to type t2, and then multiplying them. */ 1076169689SkanDEFTREECODE (WIDEN_MULT_EXPR, "widen_mult_expr", tcc_binary, 2) 1077169689Skan 1078169689Skan/* Whole vector left/right shift in bits. 1079169689Skan Operand 0 is a vector to be shifted. 1080169689Skan Operand 1 is an integer shift amount in bits. */ 1081169689SkanDEFTREECODE (VEC_LSHIFT_EXPR, "vec_lshift_expr", tcc_binary, 2) 1082169689SkanDEFTREECODE (VEC_RSHIFT_EXPR, "vec_rshift_expr", tcc_binary, 2) 1083169689Skan 108418334Speter/* 108518334SpeterLocal variables: 108618334Spetermode:c 108718334SpeterEnd: 108818334Speter*/ 1089