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.h < prev    next >
C/C++ Source or Header  |  1994-02-06  |  54KB  |  1,438 lines

  1. /* Front-end tree definitions for GNU compiler.
  2.    Copyright (C) 1989 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU CC is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #include "machmode.h"
  21.  
  22. /* codes of tree nodes */
  23.  
  24. #define DEFTREECODE(SYM, STRING, TYPE, NARGS)   SYM,
  25.  
  26. enum tree_code {
  27. #include "tree.def"
  28.  
  29.   LAST_AND_UNUSED_TREE_CODE    /* A convenient way to get a value for
  30.                    NUM_TREE_CODE.  */
  31. };
  32.  
  33. #undef DEFTREECODE
  34.  
  35. /* Number of tree codes.  */
  36. #define NUM_TREE_CODES ((int)LAST_AND_UNUSED_TREE_CODE)
  37.  
  38. /* Indexed by enum tree_code, contains a character which is
  39.    `<' for a comparison expression, `1', for a unary arithmetic
  40.    expression, `2' for a binary arithmetic expression, `e' for
  41.    other types of expressions, `r' for a reference, `c' for a
  42.    constant, `d' for a decl, `t' for a type, `s' for a statement,
  43.    and `x' for anything else (TREE_LIST, IDENTIFIER, etc).  */
  44.  
  45. extern char **tree_code_type;
  46. #define TREE_CODE_CLASS(CODE)    (*tree_code_type[(int) (CODE)])
  47.  
  48. /* Number of argument-words in each kind of tree-node.  */
  49.  
  50. extern int *tree_code_length;
  51.  
  52. /* Names of tree components.  */
  53.  
  54. extern char **tree_code_name;
  55.  
  56. /* Codes that identify the various built in functions
  57.    so that expand_call can identify them quickly.  */
  58.  
  59. enum built_in_function
  60. {
  61.   NOT_BUILT_IN,
  62.   BUILT_IN_ALLOCA,
  63.   BUILT_IN_ABS,
  64.   BUILT_IN_FABS,
  65.   BUILT_IN_LABS,
  66.   BUILT_IN_FFS,
  67.   BUILT_IN_DIV,
  68.   BUILT_IN_LDIV,
  69.   BUILT_IN_FFLOOR,
  70.   BUILT_IN_FCEIL,
  71.   BUILT_IN_FMOD,
  72.   BUILT_IN_FREM,
  73.   BUILT_IN_MEMCPY,
  74.   BUILT_IN_MEMCMP,
  75.   BUILT_IN_MEMSET,
  76.   BUILT_IN_STRCPY,
  77.   BUILT_IN_STRCMP,
  78.   BUILT_IN_STRLEN,
  79.   BUILT_IN_FSQRT,
  80.   BUILT_IN_SIN,
  81.   BUILT_IN_COS,
  82.   BUILT_IN_GETEXP,
  83.   BUILT_IN_GETMAN,
  84.   BUILT_IN_SAVEREGS,
  85.   BUILT_IN_CLASSIFY_TYPE,
  86.   BUILT_IN_NEXT_ARG,
  87.   BUILT_IN_ARGS_INFO,
  88.   BUILT_IN_CONSTANT_P,
  89.   BUILT_IN_FRAME_ADDRESS,
  90.   BUILT_IN_RETURN_ADDRESS,
  91.   BUILT_IN_CALLER_RETURN_ADDRESS,
  92.  
  93.   /* C++ extensions */
  94.   BUILT_IN_NEW,
  95.   BUILT_IN_VEC_NEW,
  96.   BUILT_IN_DELETE,
  97.   BUILT_IN_VEC_DELETE
  98. };
  99.  
  100. /* The definition of tree nodes fills the next several pages.  */
  101.  
  102. /* A tree node can represent a data type, a variable, an expression
  103.    or a statement.  Each node has a TREE_CODE which says what kind of
  104.    thing it represents.  Some common codes are:
  105.    INTEGER_TYPE -- represents a type of integers.
  106.    ARRAY_TYPE -- represents a type of pointer.
  107.    VAR_DECL -- represents a declared variable.
  108.    INTEGER_CST -- represents a constant integer value.
  109.    PLUS_EXPR -- represents a sum (an expression).
  110.  
  111.    As for the contents of a tree node: there are some fields
  112.    that all nodes share.  Each TREE_CODE has various special-purpose
  113.    fields as well.  The fields of a node are never accessed directly,
  114.    always through accessor macros.  */
  115.  
  116. /* This type is used everywhere to refer to a tree node.  */
  117.  
  118. typedef union tree_node *tree;
  119.  
  120. /* Every kind of tree node starts with this structure,
  121.    so all nodes have these fields.
  122.  
  123.    See the accessor macros, defined below, for documentation of the fields.  */
  124.  
  125. struct tree_common
  126. {
  127.   union tree_node *chain;
  128.   union tree_node *type;
  129. #ifdef ONLY_INT_FIELDS
  130.   unsigned int code : 8;
  131. #else
  132.   enum tree_code code : 8;
  133. #endif
  134.  
  135.   unsigned side_effects_flag : 1;
  136.   unsigned constant_flag : 1;
  137.   unsigned permanent_flag : 1;
  138.   unsigned addressable_flag : 1;
  139.   unsigned volatile_flag : 1;
  140.   unsigned readonly_flag : 1;
  141.   unsigned unsigned_flag : 1;
  142.   unsigned asm_written_flag: 1;
  143.  
  144.   unsigned used_flag : 1;
  145.   unsigned raises_flag : 1;
  146.   unsigned static_flag : 1;
  147.   unsigned public_flag : 1;
  148.   unsigned private_flag : 1;
  149.   unsigned protected_flag : 1;
  150.  
  151.   unsigned lang_flag_0 : 1;
  152.   unsigned lang_flag_1 : 1;
  153.   unsigned lang_flag_2 : 1;
  154.   unsigned lang_flag_3 : 1;
  155.   unsigned lang_flag_4 : 1;
  156.   unsigned lang_flag_5 : 1;
  157.   unsigned lang_flag_6 : 1;
  158.   /* There is room for two more flags.  */
  159. };
  160.  
  161. /* Define accessors for the fields that all tree nodes have
  162.    (though some fields are not used for all kinds of nodes).  */
  163.  
  164. /* The tree-code says what kind of node it is.
  165.    Codes are defined in tree.def.  */
  166. #define TREE_CODE(NODE) ((enum tree_code) (NODE)->common.code)
  167. #define TREE_SET_CODE(NODE, VALUE) ((NODE)->common.code = (int) (VALUE))
  168.  
  169. /* In all nodes that are expressions, this is the data type of the expression.
  170.    In POINTER_TYPE nodes, this is the type that the pointer points to.
  171.    In ARRAY_TYPE nodes, this is the type of the elements.  */
  172. #define TREE_TYPE(NODE) ((NODE)->common.type)
  173.  
  174. /* Nodes are chained together for many purposes.
  175.    Types are chained together to record them for being output to the debugger
  176.    (see the function `chain_type').
  177.    Decls in the same scope are chained together to record the contents
  178.    of the scope.
  179.    Statement nodes for successive statements used to be chained together.
  180.    Often lists of things are represented by TREE_LIST nodes that
  181.    are chained together.  */
  182.  
  183. #define TREE_CHAIN(NODE) ((NODE)->common.chain)
  184.  
  185. /* Given an expression as a tree, strip any NON_LVALUE_EXPRs and NOP_EXPRs
  186.    that don't change the machine mode.  */
  187.  
  188. #define STRIP_NOPS(EXP) \
  189.   while ((TREE_CODE (EXP) == NOP_EXPR                \
  190.       || TREE_CODE (EXP) == CONVERT_EXPR            \
  191.       || TREE_CODE (EXP) == NON_LVALUE_EXPR)        \
  192.      && (TYPE_MODE (TREE_TYPE (EXP))            \
  193.          == TYPE_MODE (TREE_TYPE (TREE_OPERAND (EXP, 0)))))    \
  194.     (EXP) = TREE_OPERAND (EXP, 0);
  195.  
  196. /* Like STRIP_NOPS, but don't alter the TREE_TYPE either.  */
  197.  
  198. #define STRIP_TYPE_NOPS(EXP) \
  199.   while ((TREE_CODE (EXP) == NOP_EXPR                \
  200.       || TREE_CODE (EXP) == CONVERT_EXPR            \
  201.       || TREE_CODE (EXP) == NON_LVALUE_EXPR)        \
  202.      && (TREE_TYPE (EXP)                    \
  203.          == TREE_TYPE (TREE_OPERAND (EXP, 0))))        \
  204.     (EXP) = TREE_OPERAND (EXP, 0);
  205.  
  206. /* Define many boolean fields that all tree nodes have.  */
  207.  
  208. /* In VAR_DECL nodes, nonzero means address of this is needed.
  209.    So it cannot be in a register.
  210.    In a FUNCTION_DECL, nonzero means its address is needed.
  211.    So it must be compiled even if it is an inline function.
  212.    In CONSTRUCTOR nodes, it means object constructed must be in memory.
  213.    In LABEL_DECL nodes, it means a goto for this label has been seen 
  214.    from a place outside all binding contours that restore stack levels.
  215.    In ..._TYPE nodes, it means that objects of this type must
  216.    be fully addressable.  This means that pieces of this
  217.    object cannot go into register parameters, for example.
  218.    In IDENTIFIER_NODEs, this means that some extern decl for this name
  219.    had its address taken.  That matters for inline functions.  */
  220. #define TREE_ADDRESSABLE(NODE) ((NODE)->common.addressable_flag)
  221.  
  222. /* In a VAR_DECL, nonzero means allocate static storage.
  223.    In a FUNCTION_DECL, nonzero if function has been defined.
  224.    In a CONSTRUCTOR, nonzero means allocate static storage.  */
  225. #define TREE_STATIC(NODE) ((NODE)->common.static_flag)
  226.  
  227. /* In a CONVERT_EXPR or NOP_EXPR, this means the node was made
  228.    implicitly and should not lead to an "unused value" warning.  */
  229. #define TREE_NO_UNUSED_WARNING(NODE) ((NODE)->common.static_flag)
  230.  
  231. /* In an INTEGER_CST, this means there was overflow in folding.  */
  232. #define TREE_CONSTANT_OVERFLOW(NODE) ((NODE)->common.static_flag)
  233.  
  234. /* Nonzero for a TREE_LIST or TREE_VEC node means that the derivation
  235.    chain is via a `virtual' declaration.  */
  236. #define TREE_VIA_VIRTUAL(NODE) ((NODE)->common.static_flag)
  237.  
  238. /* In a VAR_DECL or FUNCTION_DECL,
  239.    nonzero means name is to be accessible from outside this module.
  240.    In an identifier node, nonzero means an external declaration
  241.    accessible from outside this module was previously seen
  242.    for this name in an inner scope.  */
  243. #define TREE_PUBLIC(NODE) ((NODE)->common.public