cp-tree.def revision 52284
150397Sobrien/* This file contains the definitions and documentation for the
250397Sobrien   additional tree codes used in the GNU C++ compiler (see tree.def
350397Sobrien   for the standard codes).
452284Sobrien   Copyright (C) 1987, 1988, 1990, 1993, 1997, 1998 Free Software Foundation, Inc.
550397Sobrien   Hacked by Michael Tiemann (tiemann@cygnus.com)
650397Sobrien
750397SobrienThis file is part of GNU CC.
850397Sobrien
950397SobrienGNU CC is free software; you can redistribute it and/or modify
1050397Sobrienit under the terms of the GNU General Public License as published by
1150397Sobrienthe Free Software Foundation; either version 2, or (at your option)
1250397Sobrienany later version.
1350397Sobrien
1450397SobrienGNU CC is distributed in the hope that it will be useful,
1550397Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of
1650397SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1750397SobrienGNU General Public License for more details.
1850397Sobrien
1950397SobrienYou should have received a copy of the GNU General Public License
2050397Sobrienalong with GNU CC; see the file COPYING.  If not, write to
2150397Sobrienthe Free Software Foundation, 59 Temple Place - Suite 330,
2250397SobrienBoston, MA 02111-1307, USA.  */
2350397Sobrien
2450397Sobrien 
2550397Sobrien/* Reference to the contents of an offset
2650397Sobrien   (a value whose type is an OFFSET_TYPE).
2750397Sobrien   Operand 0 is the object within which the offset is taken.
2850397Sobrien   Operand 1 is the offset.  The language independent OFFSET_REF
2950397Sobrien   just won't work for us.  */
3050397SobrienDEFTREECODE (OFFSET_REF, "offset_ref", 'r', 2)
3150397Sobrien
3252284Sobrien/* A pointer-to-member constant.  For a pointer-to-member constant
3352284Sobrien   `X::Y' The PTRMEM_CST_CLASS is the RECORD_TYPE for `X' and the
3452284Sobrien   PTRMEM_CST_MEMBER is the _DECL for `Y'.  */
3552284SobrienDEFTREECODE (PTRMEM_CST, "ptrmem_cst", 'c', 1)
3652284Sobrien
3750397Sobrien/* For NEW_EXPR, operand 0 is the placement list.
3850397Sobrien   Operand 1 is the new-declarator.
3950397Sobrien   Operand 2 is the initializer.  */
4050397SobrienDEFTREECODE (NEW_EXPR, "nw_expr", 'e', 3)
4150397SobrienDEFTREECODE (VEC_NEW_EXPR, "vec_nw_expr", 'e', 3)
4250397Sobrien
4350397Sobrien/* For DELETE_EXPR, operand 0 is the store to be destroyed.
4450397Sobrien   Operand 1 is the value to pass to the destroying function
4550397Sobrien   saying whether the store should be deallocated as well.  */
4650397SobrienDEFTREECODE (DELETE_EXPR, "dl_expr", 'e', 2)
4750397SobrienDEFTREECODE (VEC_DELETE_EXPR, "vec_dl_expr", 'e', 2)
4850397Sobrien
4950397Sobrien/* Value is reference to particular overloaded class method.
5050397Sobrien   Operand 0 is the class name (an IDENTIFIER_NODE);
5150397Sobrien   operand 1 is the field (also an IDENTIFIER_NODE).
5250397Sobrien   The COMPLEXITY field holds the class level (usually 0).  */
5350397SobrienDEFTREECODE (SCOPE_REF, "scope_ref", 'r', 2)
5450397Sobrien
5550397Sobrien/* When composing an object with a member, this is the result.
5650397Sobrien   Operand 0 is the object.  Operand 1 is the member (usually
5750397Sobrien   a dereferenced pointer to member).  */
5850397SobrienDEFTREECODE (MEMBER_REF, "member_ref", 'r', 2)
5950397Sobrien
6050397Sobrien/* Type conversion operator in C++.  TREE_TYPE is type that this
6150397Sobrien   operator converts to.  Operand is expression to be converted.  */
6250397SobrienDEFTREECODE (TYPE_EXPR, "type_expr", 'e', 1)
6350397Sobrien
6450397Sobrien/* For AGGR_INIT_EXPR, operand 0 is function which performs initialization,
6550397Sobrien   operand 1 is argument list to initialization function,
6650397Sobrien   and operand 2 is the slot which was allocated for this expression.  */
6750397SobrienDEFTREECODE (AGGR_INIT_EXPR, "aggr_init_expr", 'e', 3)
6850397Sobrien
6950397Sobrien/* A throw expression.  operand 0 is the expression, if there was one,
7050397Sobrien   else it is NULL_TREE.  */
7150397SobrienDEFTREECODE (THROW_EXPR, "throw_expr", 'e', 1)
7250397Sobrien
7350397Sobrien/* Initialization of a vector, used in build_new.  Operand 0 is the target
7450397Sobrien   of the initialization, operand 1 is the initializer, and operand 2 is
7550397Sobrien   the number of elements.  */
7650397SobrienDEFTREECODE (VEC_INIT_EXPR, "vec_init_expr", 'e', 3)
7750397Sobrien
7850397Sobrien/* Template definition.  The following fields have the specified uses,
7950397Sobrien   although there are other macros in cp-tree.h that should be used for
8050397Sobrien   accessing this data.
8150397Sobrien        DECL_ARGUMENTS          template parm vector
8250397Sobrien        DECL_TEMPLATE_INFO      template text &c
8350397Sobrien	DECL_VINDEX		list of instantiations already produced;
8450397Sobrien				only done for functions so far
8550397Sobrien   For class template:
8650397Sobrien        DECL_INITIAL            associated templates (methods &c)
8750397Sobrien        DECL_RESULT             null
8850397Sobrien   For non-class templates:
8950397Sobrien	TREE_TYPE		type of object to be constructed
9050397Sobrien        DECL_RESULT             decl for object to be created
9150397Sobrien                                (e.g., FUNCTION_DECL with tmpl parms used)
9250397Sobrien */
9350397SobrienDEFTREECODE (TEMPLATE_DECL, "template_decl", 'd', 0)
9450397Sobrien
9550397Sobrien/* Index into a template parameter list.  The TEMPLATE_PARM_IDX gives
9650397Sobrien   the index (from 0) of the parameter, while the TEMPLATE_PARM_LEVEL
9750397Sobrien   gives the level (from 1) of the parameter.
9850397Sobrien
9950397Sobrien   Here's an example:
10050397Sobrien   
10150397Sobrien   template <class T> // Index 0, Level 1.
10250397Sobrien   struct S
10350397Sobrien   {
10450397Sobrien      template <class U, // Index 0, Level 2.
10550397Sobrien                class V> // Index 1, Level 2.
10650397Sobrien      void f();
10750397Sobrien   };  
10850397Sobrien
10950397Sobrien   The DESCENDANTS will be a chain of TEMPLATE_PARM_INDEXs descended
11050397Sobrien   from this one.  The first descendant will have the same IDX, but
11150397Sobrien   its LEVEL will be one less.  The TREE_CHAIN field is used to chain
11250397Sobrien   together the descendants.  The TEMPLATE_PARM_DECL is the
11350397Sobrien   declaration of this parameter, either a TYPE_DECL or CONST_DECL.
11450397Sobrien   The TEMPLATE_PARM_ORIG_LEVEL is the LEVEL of the most distant
11550397Sobrien   parent, i.e., the LEVEL that the parameter originally had when it
11650397Sobrien   was declared.  For example, if we instantiate S<int>, we will have:
11750397Sobrien
11850397Sobrien   struct S<int>
11950397Sobrien   {
12050397Sobrien     template <class U, // Index 0, Level 1, Orig Level 2
12150397Sobrien               class V> // Index 1, Level 1, Orig Level 2
12250397Sobrien     void f();
12350397Sobrien   };
12450397Sobrien  
12550397Sobrien   The LEVEL is the level of the parameter when we are worrying about
12650397Sobrien   the types of things; the ORIG_LEVEL is the level when we are
12750397Sobrien   worrying about instantiating things.  */
12850397SobrienDEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", 'x', 
12950397Sobrien	     /* The addition of (sizeof(char*) - 1) in the next
13050397Sobrien		expression is to ensure against the case where
13150397Sobrien		sizeof(char*) does not evenly divide
13250397Sobrien		sizeof(HOST_WIDE_INT).  */
13350397Sobrien	     2 + ((3 * sizeof (HOST_WIDE_INT) + sizeof(char*) - 1)
13450397Sobrien		  / sizeof (char*)))
13550397Sobrien
13650397Sobrien/* Index into a template parameter list.  This parameter must be a type.
13750397Sobrien   The TYPE_FIELDS value will be a TEMPLATE_PARM_INDEX.  */
13850397SobrienDEFTREECODE (TEMPLATE_TYPE_PARM, "template_type_parm", 't', 0)
13950397Sobrien
14050397Sobrien/* Index into a template parameter list.  This parameter must be a type.
14150397Sobrien   If it is used in signature of a template, TEMPLATE_INFO is NULL_TREE.
14250397Sobrien   Otherwise it is used to declare a type like TT<int>.
14350397Sobrien   The TYPE_FIELDS value will be a TEMPLATE_PARM_INDEX.  */
14450397SobrienDEFTREECODE (TEMPLATE_TEMPLATE_PARM, "template_template_parm", 't', 0)
14550397Sobrien
14652284Sobrien/* A type designated by `typename T::t'.  TYPE_CONTEXT is `T',
14752284Sobrien   TYPE_NAME is an IDENTIFIER_NODE for `t'.  If the type was named via
14852284Sobrien   template-id, TYPENAME_TYPE_FULLNAME will hold the TEMPLATE_ID_EXPR.
14952284Sobrien   If TREE_TYPE is present, this type was generated by the implicit
15052284Sobrien   typename extension, and the TREE_TYPE is a _TYPE from a baseclass
15152284Sobrien   of `T'.  */
15250397SobrienDEFTREECODE (TYPENAME_TYPE, "typename_type", 't', 0)
15350397Sobrien
15452284Sobrien/* A type designated by `__typeof (expr)'.  TYPE_FIELDS is the
15552284Sobrien   expression in question.  */
15652284SobrienDEFTREECODE (TYPEOF_TYPE, "typeof_type", 't', 0)
15752284Sobrien
15850397Sobrien/* A thunk is a stub function.
15950397Sobrien
16050397Sobrien   Thunks are used to implement multiple inheritance:
16150397Sobrien   At run-time, such a thunk subtracts THUNK_DELTA (an int, not a tree)
16250397Sobrien   from the this pointer, and then jumps to DECL_INITIAL
16350397Sobrien   (which is an ADDR_EXPR whose operand is a FUNCTION_DECL).
16450397Sobrien
16550397Sobrien   Other kinds of thunks may be defined later. */
16650397SobrienDEFTREECODE (THUNK_DECL, "thunk_decl", 'd', 0)
16750397Sobrien
16850397Sobrien/* A using declaration.  DECL_INITIAL contains the specified scope.  
16950397Sobrien   This is not an alias, but is later expanded into multiple aliases.  */
17050397SobrienDEFTREECODE (USING_DECL, "using_decl", 'd', 0)
17150397Sobrien
17250397Sobrien/* An un-parsed default argument.  Looks like an IDENTIFIER_NODE.  */
17350397SobrienDEFTREECODE (DEFAULT_ARG, "default_arg", 'c', 2)
17450397Sobrien
17552284Sobrien/* A template-id, like foo<int>.  The first operand is the template.
17652284Sobrien   The second is the TREE_LIST or TREE_VEC of explicitly specified
17752284Sobrien   arguments.  The template will be a FUNCTION_DECL, TEMPLATE_DECL, or
17852284Sobrien   an OVERLOAD.  If the template-id refers to a member template, the
17952284Sobrien   template may be an IDENTIFIER_NODE.  */
18050397SobrienDEFTREECODE (TEMPLATE_ID_EXPR, "template_id_expr", 'e', 2)
18150397Sobrien
18252284Sobrien/* An association between name and entity. Parameters are the scope
18352284Sobrien   and the (non-type) value.  TREE_TYPE indicates the type bound to
18452284Sobrien   the name. */
18550397SobrienDEFTREECODE (CPLUS_BINDING, "binding", 'x', 2)
18650397Sobrien
18750397Sobrien/* A list-like node for chaining overloading candidates. TREE_TYPE is 
18850397Sobrien   the original name, and the parameter is the FUNCTION_DECL.  */
18950397SobrienDEFTREECODE (OVERLOAD, "overload", 'x', 1)
19050397Sobrien
19150397Sobrien/* A generic wrapper for something not tree that we want to include in
19250397Sobrien   tree structure.  */
19350397SobrienDEFTREECODE (WRAPPER, "wrapper", 'x', 1)
19450397Sobrien
19550397Sobrien/* A node to remember a source position.  */
19650397SobrienDEFTREECODE (SRCLOC, "srcloc", 'x', 2)
19750397Sobrien
19852284Sobrien/* Used to represent deferred name lookup for dependent names while
19952284Sobrien   parsing a template declaration.  The first argument is an
20052284Sobrien   IDENTIFIER_NODE for the name in question.  The TREE_TYPE is
20152284Sobrien   unused.  */
20252284SobrienDEFTREECODE (LOOKUP_EXPR, "lookup_expr", 'e', 1)
20352284Sobrien
20450397Sobrien/* A whole bunch of tree codes for the initial, superficial parsing of
20550397Sobrien   templates.  */
20650397SobrienDEFTREECODE (MODOP_EXPR, "modop_expr", 'e', 3)
20750397SobrienDEFTREECODE (CAST_EXPR, "cast_expr", '1', 1)
20850397SobrienDEFTREECODE (REINTERPRET_CAST_EXPR, "reinterpret_cast_expr", '1', 1)
20950397SobrienDEFTREECODE (CONST_CAST_EXPR, "const_cast_expr", '1', 1)
21050397SobrienDEFTREECODE (STATIC_CAST_EXPR, "static_cast_expr", '1', 1)
21150397SobrienDEFTREECODE (DYNAMIC_CAST_EXPR, "dynamic_cast_expr", '1', 1)
21250397SobrienDEFTREECODE (SIZEOF_EXPR, "sizeof_expr", '1', 1)
21350397SobrienDEFTREECODE (ALIGNOF_EXPR, "alignof_expr", '1', 1)
21450397SobrienDEFTREECODE (ARROW_EXPR, "arrow_expr", 'e', 1)
21550397SobrienDEFTREECODE (DOTSTAR_EXPR, "dotstar_expr", 'e', 2)
21650397SobrienDEFTREECODE (TYPEID_EXPR, "typeid_expr", 'e', 1)
21750397Sobrien
21850397SobrienDEFTREECODE (EXPR_STMT, "expr_stmt", 'e', 1)
21950397SobrienDEFTREECODE (COMPOUND_STMT, "compound_stmt", 'e', 1)
22050397SobrienDEFTREECODE (DECL_STMT, "decl_stmt", 'e', 3)
22150397SobrienDEFTREECODE (IF_STMT, "if_stmt", 'e', 3)
22250397SobrienDEFTREECODE (FOR_STMT, "for_stmt", 'e', 4)
22350397SobrienDEFTREECODE (WHILE_STMT, "while_stmt", 'e', 2)
22450397SobrienDEFTREECODE (DO_STMT, "do_stmt", 'e', 2)
22550397SobrienDEFTREECODE (RETURN_STMT, "return_stmt", 'e', 1)
22650397SobrienDEFTREECODE (BREAK_STMT, "break_stmt", 'e', 0)
22750397SobrienDEFTREECODE (CONTINUE_STMT, "continue_stmt", 'e', 0)
22850397SobrienDEFTREECODE (SWITCH_STMT, "switch_stmt", 'e', 2)
22950397SobrienDEFTREECODE (GOTO_STMT, "goto_stmt", 'e', 1)
23050397SobrienDEFTREECODE (ASM_STMT, "asm_stmt", 'e', 5)
23150397Sobrien
23250397SobrienDEFTREECODE (CTOR_INITIALIZER, "ctor_initializer", 'e', 2)
23350397SobrienDEFTREECODE (CASE_LABEL, "case_label", 'e', 2)
23450397SobrienDEFTREECODE (RETURN_INIT, "return_init", 'e', 2)
23550397SobrienDEFTREECODE (TRY_BLOCK, "try_stmt", 'e', 2)
23650397SobrienDEFTREECODE (HANDLER, "catch_stmt", 'e', 2)
23750397Sobrien
23850397SobrienDEFTREECODE (TAG_DEFN, "tag_defn", 'e', 0)
23950397Sobrien
24050397Sobrien/* And some codes for expressing conversions for overload resolution.  */
24150397Sobrien
24250397SobrienDEFTREECODE (IDENTITY_CONV, "identity_conv", 'e', 1)
24350397SobrienDEFTREECODE (LVALUE_CONV, "lvalue_conv", 'e', 1)
24450397SobrienDEFTREECODE (QUAL_CONV, "qual_conv", 'e', 1)
24550397SobrienDEFTREECODE (STD_CONV, "std_conv", 'e', 1)
24650397SobrienDEFTREECODE (PTR_CONV, "ptr_conv", 'e', 1)
24750397SobrienDEFTREECODE (PMEM_CONV, "pmem_conv", 'e', 1)
24850397SobrienDEFTREECODE (BASE_CONV, "base_conv", 'e', 1)
24950397SobrienDEFTREECODE (REF_BIND, "ref_bind", 'e', 1)
25050397SobrienDEFTREECODE (USER_CONV, "user_conv", 'e', 2)
25150397SobrienDEFTREECODE (AMBIG_CONV, "ambig_conv", 'e', 1)
25250397SobrienDEFTREECODE (RVALUE_CONV, "rvalue_conv", 'e', 1)
25350397Sobrien
25450397Sobrien/*
25550397SobrienLocal variables:
25650397Sobrienmode:c
25750397SobrienEnd:
25850397Sobrien*/
259