home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / gcc-2.3.3-src.lha / GNU / src / amiga / gcc-2.3.3 / tree.def < prev    next >
Text File  |  1994-02-06  |  29KB  |  633 lines

  1. /* This file contains the definitions and documentation for the
  2.    tree codes used in the GNU C compiler.
  3.    Copyright (C) 1987, 1988 Free Software Foundation, Inc.
  4.  
  5. This file is part of GNU CC.
  6.  
  7. GNU CC is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2, or (at your option)
  10. any later version.
  11.  
  12. GNU CC is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with GNU CC; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21.  
  22. /* The third argument can be:
  23.    "x" for an exceptional code (fits no category).
  24.    "t" for a type object code.
  25.    "b" for a lexical block.
  26.    "c" for codes for constants.
  27.    "d" for codes for declarations (also serving as variable refs).
  28.    "r" for codes for references to storage.
  29.    "<" for codes for comparison expressions.
  30.    "1" for codes for unary arithmetic expressions.
  31.    "2" for codes for binary arithmetic expressions.
  32.    "s" for codes for expressions with inherent side effects.
  33.    "e" for codes for other kinds of expressions.  */
  34.  
  35. /* For `r', `e', `<', `1', `2', `s' and `x' nodes,
  36.    the 4th element is the number of argument slots to allocate.
  37.    This determines the size of the tree node object.  */
  38.  
  39. /* Any erroneous construct is parsed into a node of this type.
  40.    This type of node is accepted without complaint in all contexts
  41.    by later parsing activities, to avoid multiple error messages
  42.    for one error.
  43.    No fields in these nodes are used except the TREE_CODE.  */
  44. DEFTREECODE (ERROR_MARK, "error_mark", "x", 0)
  45.  
  46. /* Used to represent a name (such as, in the DECL_NAME of a decl node).
  47.    Internally it looks like a STRING_CST node.
  48.    There is only one IDENTIFIER_NODE ever made for any particular name.
  49.    Use `get_identifier' to get it (or create it, the first time).  */
  50. DEFTREECODE (IDENTIFIER_NODE, "identifier_node", "x", -1)
  51.  
  52. /* Used to hold information to identify an operator (or combination
  53.    of two operators) considered as a `noun' rather than a `verb'.
  54.    The first operand is encoded in the TREE_TYPE field.  */
  55. DEFTREECODE (OP_IDENTIFIER, "op_identifier", "x", 2)
  56.  
  57. /* Has the TREE_VALUE and TREE_PURPOSE fields.  */
  58. /* These nodes are made into lists by chaining through the
  59.    TREE_CHAIN field.  The elements of the list live in the
  60.    TREE_VALUE fields, while TREE_PURPOSE fields are occasionally
  61.    used as well to get the effect of Lisp association lists.  */
  62. DEFTREECODE (TREE_LIST, "tree_list", "x", 2)
  63.  
  64. /* These nodes contain an array of tree nodes.  */
  65. DEFTREECODE (TREE_VEC, "tree_vec", "x", 2)
  66.  
  67. /* A symbol binding block.  These are arranged in a tree,
  68.    where the BLOCK_SUBBLOCKS field contains a chain of subblocks
  69.    chained through the BLOCK_CHAIN field.
  70.    BLOCK_SUPERCONTEXT points to the parent block.
  71.      For a block which represents the outermost scope of a function, it
  72.      points to the FUNCTION_DECL node.
  73.    BLOCK_VARS points to a chain of decl nodes.
  74.    BLOCK_TYPE_TAGS points to a chain of types which have their own names.
  75.    BLOCK_CHAIN points to the next BLOCK at the same level.
  76.    BLOCK_ABSTRACT_ORIGIN points to the original (abstract) tree node which
  77.    this block is an instance of, or else is NULL to indicate that this
  78.    block is not an instance of anything else.  When non-NULL, the value
  79.    could either point to another BLOCK node or it could point to a
  80.    FUNCTION_DECL node (e.g. in the case of a block representing the
  81.    outermost scope of a particular inlining of a function).
  82.    BLOCK_ABSTRACT is non-zero if the block represents an abstract
  83.    instance of a block (i.e. one which is nested within an abstract
  84.    instance of a inline function. */
  85. DEFTREECODE (BLOCK, "block", "b", 0)
  86.  
  87. /* Each data type is represented by a tree node whose code is one of
  88.    the following:  */
  89. /* Each node that represents a data type has a component TYPE_SIZE
  90.    containing a tree that is an expression for the size in bits.
  91.    The TYPE_MODE contains the machine mode for values of this type.
  92.    The TYPE_POINTER_TO field contains a type for a pointer to this type,
  93.      or zero if no such has been created yet.
  94.    The TYPE_NEXT_VARIANT field is used to chain together types
  95.      that are variants made by type modifiers such as "const" and "volatile".
  96.    The TYPE_MAIN_VARIANT field, in any member of such a chain,
  97.      points to the start of the chain.
  98.    The TYPE_NONCOPIED_PARTS field is a list specifying which parts
  99.      of an object of this type should *not* be copied by assignment.
  100.      The TREE_PURPOSE of each element is the offset of the part
  101.      and the TREE_VALUE is the size in bits of the part.
  102.    The TYPE_NAME field contains info on the name used in the program
  103.      for this type (for GDB symbol table output).  It is either a
  104.      TYPE_DECL node, for types that are typedefs, or an IDENTIFIER_NODE
  105.      in the case of structs, unions or enums that are known with a tag,
  106.      or zero for types that have no special name.
  107.    The TYPE_CONTEXT for any sort of type which could have a name or
  108.     which could have named members (e.g. tagged types in C/C++) will
  109.     point to the node which represents the scope of the given type, or
  110.     will be NULL_TREE if the type has "file scope".  For most types, this
  111.     will point to a BLOCK node or a FUNCTION_DECL node, but it could also
  112.     point to a FUNCTION_TYPE node (for types whose scope is limited to the
  113.     formal parameter list of some function type specification) or it
  114.     could point to a RECORD_TYPE or UNION_TYPE node (for C++ "member" types).
  115.     For non-tagged-types, TYPE_CONTEXT need not be set to anything in
  116.     particular, since any type which is of some type category  (e.g.
  117.     an array type or a function type) which cannot either have a name
  118.     itself or have named members doesn't really have a "scope" per se.  */
  119. /* TREE_CHAIN is used for ENUMERAL_TYPE, RECORD_TYPE and UNION_TYPE
  120.    nodes used as forward-references to names; see below.  */
  121.  
  122. DEFTREECODE (VOID_TYPE, "void_type", "t", 0)    /* The void type in C */
  123.  
  124. /* Integer types in all languages, including char in C.  */
  125. /* Has components TYPE_MIN_VALUE, TYPE_MAX_VALUE (expressions, inclusive)
  126.    and TYPE_PRECISION (number of bits used by this type).
  127.    In the case of a subrange type in Pascal, the TREE_TYPE
  128.    of this will point at the supertype (another INTEGER_TYPE).
  129.    Otherwise, the TREE_TYPE is zero.  */
  130. DEFTREECODE (INTEGER_TYPE, "integer_type", "t", 0)
  131.  
  132. /* C's float and double.  Different floating types are distinguished
  133.    by machine mode and by the TYPE_SIZE and the TYPE_PRECISION.  */
  134. DEFTREECODE (REAL_TYPE, "real_type", "t", 0)
  135.  
  136. /* Complex number types.  The TREE_TYPE field is the data type
  137.    of the real and imaginary parts.  */
  138. DEFTREECODE (COMPLEX_TYPE, "complex_type", "t", 0)
  139.  
  140. /* C enums.  The type node looks just like an INTEGER_TYPE node.
  141.    The symbols for the values of the enum type are defined by
  142.    CONST_DECL nodes, but the type does not point to them;
  143.    however, the TREE_VALUES is a list in which each elements' TREE_PURPOSE
  144.    is a name and the TREE_VALUE is the value (an INTEGER_CST node).  */
  145. /* A forward reference `enum foo' when no enum named foo is defined yet
  146.    has zero (a null pointer) in its TYPE_SIZE.  The tag name is in
  147.    the TYPE_NAME field.  If the type is later defined, the normal
  148.    fields are filled in.
  149.    RECORD_TYPE and UNION_TYPE forward refs are treated similarly.  */
  150. DEFTREECODE (ENUMERAL_TYPE, "enumeral_type", "t", 0)
  151.  
  152. /* Pascal's boolean type (true or false are the only values);
  153.    no special fields needed.  */
  154. DEFTREECODE (BOOLEAN_TYPE, "boolean_type", "t", 0)
  155.  
  156. /* CHAR in Pascal; not used in C.
  157.    No special fields needed.  */
  158. DEFTREECODE (CHAR_TYPE, "char_type", "t", 0)
  159.  
  160. /* All pointer-to-x types have code POINTER_TYPE.
  161.    The TREE_TYPE points to the node for the type pointed to.  */
  162. DEFTREECODE (POINTER_TYPE, "pointer_type", "t", 0)
  163.  
  164. /* An