home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / GCC 1.37.1r14 / usr / gcc-1.37.1r14 / (gcc-1.37.π) / tree.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-05  |  32.0 KB  |  983 lines  |  [TEXT/KAHL]

  1. /* Front-end tree definitions for GNU compiler.
  2.    Copyright (C) 1989 Free Software Foundation, Inc.
  3.    Copyright (C) 1989, 1990 Apple Computer, 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 1, 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. #ifndef __tree__
  21. #define __tree__
  22.  
  23. /* codes of tree nodes */
  24.  
  25. #define DEFTREECODE(SYM, STRING, TYPE, NARGS)   SYM,
  26.  
  27. enum tree_code {
  28. #include "tree.def"
  29.  
  30.   LAST_AND_UNUSED_TREE_CODE    /* A convienent way to get a value for
  31.                    NUM_TREE_CODE.  */
  32. #ifdef MPW_C
  33.  , tree_code_intifier = 1000000
  34. #endif /* MPW_C */
  35. };
  36.  
  37. #undef DEFTREECODE
  38.  
  39. /* Number of tree codes.  */
  40. #define NUM_TREE_CODES ((int)LAST_AND_UNUSED_TREE_CODE)
  41.  
  42. /* Indexed by enum tree_code, contains a character which is
  43.    `e' for an expression, `r' for a reference, `c' for a constant,
  44.    `d' for a decl, `t' for a type, `s' for a statement,
  45.    and `x' for anything else (TREE_LIST, IDENTIFIER, etc).  */
  46.  
  47. extern char *tree_code_type[];
  48.  
  49. /* Number of argument-words in each kind of tree-node.  */
  50.  
  51. extern int tree_code_length[];
  52.  
  53. /* Get the definition of `enum machine_mode' */
  54.  
  55. #ifndef HAVE_MACHINE_MODES
  56. #define DEF_MACHMODE(SYM, NAME, TYPE, SIZE, UNIT, WIDER)  SYM,
  57.  
  58. enum machine_mode {
  59. #include "machmode.def"
  60. #ifdef MPW_C
  61. MAX_MACHINE_MODE, mach_mode_intifier = 1000000 };
  62. #else
  63. MAX_MACHINE_MODE };
  64. #endif /* MPW_C */
  65.  
  66. #undef DEF_MACHMODE
  67.  
  68. #define HAVE_MACHINE_MODES
  69.  
  70. #endif /* not HAVE_MACHINE_MODES */
  71.  
  72. #ifndef NUM_MACHINE_MODES
  73. #define NUM_MACHINE_MODES (int) MAX_MACHINE_MODE
  74. #endif
  75.  
  76. /* Codes that identify the various built in functions
  77.    so that expand_call can identify them quickly.  */
  78.  
  79. enum built_in_function
  80. {
  81.   NOT_BUILT_IN,
  82.   BUILT_IN_ALLOCA,
  83.   BUILT_IN_ABS,
  84.   BUILT_IN_FABS,
  85.   BUILT_IN_LABS,
  86.   BUILT_IN_FFS,
  87.   BUILT_IN_DIV,
  88.   BUILT_IN_LDIV,
  89.   BUILT_IN_FFLOOR,
  90.   BUILT_IN_FCEIL,
  91.   BUILT_IN_FMOD,
  92.   BUILT_IN_FREM,
  93.   BUILT_IN_MEMCPY,
  94.   BUILT_IN_MEMCMP,
  95.   BUILT_IN_MEMSET,
  96.   BUILT_IN_FSQRT,
  97.   BUILT_IN_GETEXP,
  98.   BUILT_IN_GETMAN,
  99.   BUILT_IN_SAVEREGS,
  100.   BUILT_IN_CLASSIFY_TYPE,
  101. #ifdef APPLE_HAX
  102.   /* Hook to add codes for machine-specific builtin functions. */
  103. #ifdef ADDITIONAL_BUILTIN_SYMS
  104.   ADDITIONAL_BUILTIN_SYMS
  105. #endif
  106. #endif /* APPLE_HAX */
  107.  
  108.   /* C++ extensions */
  109.   BUILT_IN_NEW,
  110.   BUILT_IN_VEC_NEW,
  111.   BUILT_IN_DELETE,
  112.   BUILT_IN_VEC_DELETE
  113. #ifdef MPW_C
  114.   ,b_i_f_intifier = 1000000
  115. #endif /* MPW_C */
  116. };
  117.  
  118. /* The definition of tree nodes fills the next several pages.  */
  119.  
  120. /* A tree node can represent a data type, a variable, an expression
  121.    or a statement.  Each node has a TREE_CODE which says what kind of
  122.    thing it represents.  Some common codes are:
  123.    INTEGER_TYPE -- represents a type of integers.
  124.    ARRAY_TYPE -- represents a type of pointer.
  125.    VAR_DECL -- represents a declared variable.
  126.    INTEGER_CST -- represents a constant integer value.
  127.    PLUS_EXPR -- represents a sum (an expression).
  128.  
  129.    As for the contents of a tree node: there are some fields
  130.    that all nodes share.  Each TREE_CODE has various special-purpose
  131.    fields as well.  The fields of a node are never accessed directly,
  132.    always through accessor macros.  */
  133.  
  134. /* This type is used everywhere to refer to a tree node.  */
  135.  
  136. typedef union tree_node *tree;
  137.  
  138. #define NULL_TREE (tree) NULL
  139.  
  140. /* Every kind of tree node starts with this structure,
  141.    so all nodes have these fields.
  142.  
  143.    See the accessor macros, defined below, for documentation of the fields.  */
  144.  
  145. struct tree_common
  146. {
  147.   int uid;
  148.   union tree_node *chain;
  149.   union tree_node *type;
  150. #ifdef MPW_C
  151.   /* MPW C doesn't allow field widths on chars, so use int instead. */
  152.   unsigned int code : 8;
  153. #else
  154.   unsigned char code : 8;
  155. #endif /* MPW_C */
  156.  
  157.   unsigned external_attr : 1;
  158.   unsigned public_attr : 1;
  159.   unsigned static_attr : 1;
  160.   unsigned volatile_attr : 1;
  161.   unsigned packed_attr : 1;
  162.   unsigned readonly_attr : 1;
  163.   unsigned literal_attr : 1;
  164.   unsigned nonlocal_attr : 1;
  165.   unsigned permanent_attr : 1;
  166.   unsigned addressable_attr : 1;
  167.   unsigned regdecl_attr : 1;
  168.   unsigned this_vol_attr : 1;
  169.   unsigned unsigned_attr : 1;
  170.   unsigned asm_written_attr: 1;
  171.   unsigned inline_attr : 1;
  172.   unsigned used_attr : 1;
  173.   unsigned lang_flag_1 : 1;
  174.   unsigned lang_flag_2 : 1;
  175.   unsigned lang_flag_3 : 1;
  176.   unsigned lang_flag_4 : 1;
  177.   /* There is room for four more attributes.  */
  178. #ifdef APPLE_C
  179.   /* To be used for pascal and direct function definitions. */
  180.   unsigned pascal_attr : 1;
  181.   unsigned direct_attr : 1;
  182. #endif /* APPLE_C */
  183. };
  184.  
  185. /* Define accessors for the fields that all tree nodes have
  186.    (though some fields are not used for all kinds of nodes).  */
  187.  
  188. /* The unique id of a tree node distinguishes it from all other nodes
  189.    in the same compiler run.  */
  190. #define TREE_UID(NODE) ((NODE)->common.uid)
  191.  
  192. /* The tree-code says what kind of node it is.
  193.    Codes are defined in tree.def.  */
  194. #define TREE_CODE(NODE) ((enum tree_code) (NODE)->common.code)
  195. #define TREE_SET_CODE(NODE, VALUE) ((NODE)->common.code = (int) (VALUE))
  196.  
  197. /* In all nodes that are expressions, this is the data type of the expression.
  198.    In POINTER_TYPE nodes, this is the type that the pointer points to.
  199.    In ARRAY_TYPE nodes, this is the type of the elements.  */
  200. #define TREE_TYPE(NODE) ((NODE)->common.type)
  201.  
  202. /* Nodes are chained together for many purposes.
  203.    Types are chained together to record them for being output to the debugger
  204.    (see the function `chain_type').
  205.    Decls in the same scope are chained together to record the contents
  206.    of the scope.
  207.    Statement nodes for successive statements used to be chained together.
  208.    Often lists of things are represented by TREE_LIST nodes that
  209.    are chained together.  */
  210.  
  211. #define TREE_CHAIN(NODE) ((NODE)->common.chain)
  212.  
  213. /* Define many boolean fields that all tree nodes have.  */
  214.  
  215. /* In a VAR_DECL or FUNCTION_DECL,
  216.    nonzero means external reference:
  217.    do not allocate storage, and refer to a definition elsewhere.  */
  218. #define TREE_EXTERNAL(NODE) ((NODE)->common.external_attr)
  219.  
  220. /* In a VAR_DECL, nonzero means allocate static storage.
  221.    In a FUNCTION_DECL, currently nonzero if function has been defined.  */
  222. #define TREE_STATIC(NODE) ((NODE)->common.static_attr)
  223.  
  224. /* In a VAR_DECL or FUNCTION_DECL,
  225.    nonzero means name is to be accessible from outside this module.  */
  226. #define TREE_PUBLIC(NODE) ((NODE)->common.public_attr)
  227.  
  228. /* In VAR_DECL nodes, nonzero means address of this is needed.
  229.    So it cannot be in a register.
  230.    In a FUNCTION_DECL, nonzero means its address is needed.
  231.    So it must be compiled even if it is an inline function.
  232.    In CONSTRUCTOR nodes, it means the elements are all constants suitable
  233.    for output as assembly-language initializers.
  234.    In LABEL_DECL nodes, it means a goto for this label has been seen 
  235.    from a place outside all binding contours that restore stack levels,
  236.    or that an error message about jumping into such a binding contour
  237.    has been printed for this label.
  238.    In ..._TYPE nodes, it means that objects of this type must
  239.    be fully addressable.  This means that pieces of this
  240.    object cannot go into register parameters, for example.  */
  241. #define TREE_ADDRESSABLE(NODE) ((NODE)->common.addressable_attr)
  242.  
  243. /* In VAR_DECL nodes, nonzero means declared `register'.  */
  244. #define TREE_REGDECL(NODE) ((NODE)->common.regdecl_attr)
  245.  
  246. /* In any expression, nonzero means it has side effects or reevaluation
  247.    of the whole expression could produce a different value.
  248.    This is set if any subexpression is a function call, a side effect
  249.    or a reference to a volatile variable.
  250.    In a ..._DECL, this is set only if the declaration said `volatile'.
  251.    In a ..._TYPE, nonzero means the type is volatile-qualified.  */
  252. #define TREE_VOLATILE(NODE) ((NODE)->common.volatile_attr)
  253.  
  254. /* Nonzero means this expression is volatile in the C sense:
  255.    its address should be of type `volatile WHATEVER *'.
  256.    If this bit is set, so is `volatile_attr'.  */
  257. #define TREE_THIS_VOLATILE(NODE) ((NODE)->common.this_vol_attr)
  258.  
  259. /* In a VAR_DECL, PARM_DECL or FIELD_DECL, or any kind of ..._REF node,
  260.    nonzero means it may not be the lhs of an assignment.
  261.    In a ..._TYPE node, means this type is const-qualified.  */
  262. #define TREE_READONLY(NODE) ((NODE)->common.readonly_attr)
  263.  
  264. /* Nonzero in a FIELD_DECL means it is a bit-field; it may occupy
  265.    less than a storage unit, and its address may not be taken, etc.
  266.    This controls layout of the containing record.
  267.    In a LABEL_DECL, nonzero means label was defined inside a binding
  268.    contour that restored a stack level and which is now exited.  */
  269. #define TREE_PACKED(NODE) ((NODE)->common.packed_attr)
  270.  
  271. /* Value of expression is constant.
  272.    Always appears in all ..._CST nodes.
  273.    May also appear in an arithmetic expression, an ADDR_EXPR or a CONSTRUCTOR
  274.    if the value is constant.  */
  275. #define TREE_LITERAL(NODE) ((NODE)->common.literal_attr)
  276.  
  277. /* Nonzero in a ..._DECL means this variable is ref'd from a nested function.
  278.    Cannot happen in C because it does not allow nested functions, as of now.
  279.    For VAR_DECL nodes, PARM_DECL nodes, and
  280.    maybe FUNCTION_DECL or LABEL_DECL nodes.
  281.  
  282.    Also set in some languages for variables, etc., outside the normal
  283.    lexical scope, such as class instance variables.  */
  284. #define TREE_NONLOCAL(NODE) ((NODE)->common.nonlocal_attr)
  285.  
  286. /* Nonzero means permanent node;
  287.    node will continue to exist for the entire compiler run.
  288.    Otherwise it will be recycled at the end of the function.  */
  289. #define TREE_PERMANENT(NODE) ((NODE)->common.permanent_attr)
  290.  
  291. /* In INTEGER_TYPE or ENUMERAL_TYPE nodes, means an unsigned type.
  292.    In FIELD_DECL nodes, means an unsigned bit field.  */
  293. #define TREE_UNSIGNED(NODE) ((NODE)->common.unsigned_attr)
  294.  
  295. /* Nonzero in a VAR_DECL means assembler code has been written.
  296.    Nonzero in a FUNCTION_DECL means that the function has been compiled.
  297.    This is interesting in an inline function, since it might not need
  298.    to be compiled separately.  */
  299. #define TREE_ASM_WRITTEN(NODE) ((NODE)->common.asm_written_attr)
  300.  
  301. /* Nonzero in a FUNCTION_DECL means this function can be substituted
  302.    where it is called.  */
  303. #define TREE_INLINE(NODE) ((NODE)->common.inline_attr)
  304.  
  305. /* Nonzero in a _DECL if the name is used in its scope.  */
  306. #define TREE_USED(NODE) ((NODE)->common.used_attr)
  307.  
  308. #ifdef APPLE_C
  309. /* Macros for detection of pascal and direct functions. */
  310. #define TREE_PASCAL(NODE) ((NODE)->common.pascal_attr)
  311. #define TREE_DIRECT(NODE) ((NODE)->common.direct_attr)
  312. #endif /* APPLE_C */
  313.  
  314. #define TREE_LANG_FLAG_1(NODE) ((NODE)->common.lang_flag_1)
  315. #define TREE_LANG_FLAG_2(NODE) ((NODE)->common.lang_flag_2)
  316. #define TREE_LANG_FLAG_3(NODE) ((NODE)->common.lang_flag_3)
  317. #define TREE_LANG_FLAG_4(NODE) ((NODE)->common.lang_flag_4)
  318.  
  319. /* Define additional fields and accessors for nodes representing constants.  */
  320.  
  321. /* In an INTEGER_CST node.  These two together make a 64 bit integer.
  322.    If the data type is signed, the value is sign-extended to 64 bits
  323.    even though not all of them may really be in use.
  324.    In an unsigned constant shorter than 64 bits, the extra bits are 0.  */
  325. #define TREE_INT_CST_LOW(NODE) ((NODE)->int_cst.int_cst_low)
  326. #define TREE_INT_CST_HIGH(NODE) ((NODE)->int_cst.int_cst_high)
  327.  
  328. #define INT_CST_LT(A, B)  \
  329. (TREE_INT_CST_HIGH (A) < TREE_INT_CST_HIGH (B)            \
  330.  || (TREE_INT_CST_HIGH (A) == TREE_INT_CST_HIGH (B)        \
  331.      && ((unsigned) TREE_INT_CST_LOW (A) < (unsigned) TREE_INT_CST_LOW (B))))
  332.  
  333. #define INT_CST_LT_UNSIGNED(A, B)  \
  334. ((unsigned) TREE_INT_CST_HIGH (A) < (unsigned) TREE_INT_CST_HIGH (B)      \
  335.  || ((unsigned) TREE_INT_CST_HIGH (A) == (unsigned) TREE_INT_CST_HIGH (B) \
  336.      && ((unsigned) TREE_INT_CST_LOW (A) < (unsigned) TREE_INT_CST_LOW (B))))
  337.  
  338. struct tree_int_cst
  339. {
  340.   char common[sizeof (struct tree_common)];
  341.   long int_cst_low;
  342.   long int_cst_high;
  343. };
  344.  
  345. /* In REAL_CST, STRING_CST, COMPLEX_CST nodes, and CONSTRUCTOR nodes,
  346.    and generally in all kinds of constants that could
  347.    be given labels (rather than being immediate).  */
  348.  
  349. #define TREE_CST_RTL(NODE) ((NODE)->real_cst.rtl)
  350.  
  351. /* In a REAL_CST node.  */
  352. /* We can represent a real value as either a `double' or a string.
  353.    Strings don't allow for any optimization, but they do allow
  354.    for cross-compilation.  */
  355.  
  356. #define TREE_REAL_CST(NODE) ((NODE)->real_cst.real_cst)
  357.  
  358. #include "real.h"
  359.  
  360. struct tree_real_cst
  361. {
  362.   char common[sizeof (struct tree_common)];
  363.   struct rtx_def *rtl;    /* acts as link to register transfer language
  364.                    (rtl) info */
  365.   REAL_VALUE_TYPE real_cst;
  366. };
  367.  
  368. /* In a STRING_CST */
  369. #define TREE_STRING_LENGTH(NODE) ((NODE)->string.length)
  370. #define TREE_STRING_POINTER(NODE) ((NODE)->string.pointer)
  371.  
  372. struct tree_string
  373. {
  374.   char common[sizeof (struct tree_common)];
  375.   struct rtx_def *rtl;    /* acts as link to register transfer language
  376.                    (rtl) info */
  377.   int length;
  378.   char *pointer;
  379. };
  380.  
  381. /* In a COMPLEX_CST node.  */
  382. #define TREE_REALPART(NODE) ((NODE)->complex.real)
  383. #define TREE_IMAGPART(NODE) ((NODE)->complex.imag)
  384.  
  385. struct tree_complex
  386. {
  387.   char common[sizeof (struct tree_common)];
  388.   struct rtx_def *rtl;    /* acts as link to register transfer language
  389.                    (rtl) info */
  390.   union tree_node *real;
  391.   union tree_node *imag;
  392. };
  393.  
  394. /* Define fields and accessors for some special-purpose tree nodes.  */
  395.  
  396. #define IDENTIFIER_LENGTH(NODE) ((NODE)->identifier.length)
  397. #define IDENTIFIER_POINTER(NODE) ((NODE)->identifier.pointer)
  398.  
  399. struct tree_identifier
  400. {
  401.   char common[sizeof (struct tree_common)];
  402.   int length;
  403.   char *pointer;
  404. };
  405.  
  406. /* In a TREE_LIST node.  */
  407. #define TREE_PURPOSE(NODE) ((NODE)->list.purpose)
  408. #define TREE_VALUE(NODE) ((NODE)->list.value)
  409.  
  410. struct tree_list
  411. {
  412.   char common[sizeof (struct tree_common)];
  413.   union tree_node *purpose;
  414.   union tree_node *value;
  415. };
  416.  
  417. /* Define fields and accessors for some nodes that represent expressions.  */
  418.  
  419. /* In a SAVE_EXPR node.  */
  420. #define SAVE_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[1])
  421.  
  422. /* In a RTL_EXPR node.  */
  423. #define RTL_EXPR_SEQUENCE(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[0])
  424. #define RTL_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[1])
  425.  
  426. /* In a CALL_EXPR node.  */
  427. #define CALL_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[2])
  428.  
  429. /* In a CONSTRUCTOR node.  */
  430. #define CONSTRUCTOR_ELTS(NODE) TREE_OPERAND (NODE, 1)
  431.  
  432. /* In expression and reference nodes.  */
  433. #define TREE_OPERAND(NODE, I) ((NODE)->exp.operands[I])
  434. #define TREE_COMPLEXITY(NODE, I) ((NODE)->exp.complexity)
  435.  
  436. struct tree_exp
  437. {
  438.   char common[sizeof (struct tree_common)];
  439.   int complexity;
  440.   union tree_node *operands[1];
  441. };
  442.  
  443. /* Define fields and accessors for nodes representing data types.  */
  444.  
  445. /* See tree.def for documentation of the use of these fields.
  446.    Look at the documentation of the various ..._TYPE tree codes.  */
  447.  
  448. #define TYPE_SIZE(NODE) ((NODE)->type.size)
  449. #define TYPE_SIZE_UNIT(NODE) ((NODE)->type.size_unit)
  450. #define TYPE_MODE(NODE) ((NODE)->type.mode)
  451. #define TYPE_ALIGN(NODE) ((NODE)->type.align)
  452. #define TYPE_VALUES(NODE) ((NODE)->type.values)
  453. #define TYPE_DOMAIN(NODE) ((NODE)->type.values)
  454. #define TYPE_FIELDS(NODE) ((NODE)->type.values)
  455. #define TYPE_ARG_TYPES(NODE) ((NODE)->type.values)
  456. #define TYPE_METHOD_BASETYPE(NODE) ((NODE)->type.max)
  457. #define TYPE_OFFSET_BASETYPE(NODE) ((NODE)->type.max)
  458. #define TYPE_SEP(NODE) ((NODE)->type.sep)
  459. #define TYPE_SEP_UNIT(NODE) ((NODE)->type.sep_unit)
  460. #define TYPE_POINTER_TO(NODE) ((NODE)->type.pointer_to)
  461. #define TYPE_REFERENCE_TO(NODE) ((NODE)->type.reference_to)
  462. #define TYPE_MIN_VALUE(NODE) ((NODE)->type.sep)
  463. #define TYPE_MAX_VALUE(NODE) ((NODE)->type.max)
  464. #define TYPE_PRECISION(NODE) ((NODE)->type.sep_unit)
  465. #define TYPE_PARSE_INFO(NODE) ((NODE)->type.parse_info)
  466. #define TYPE_SYMTAB_ADDRESS(NODE) ((NODE)->type.symtab_address)
  467. #define TYPE_NAME(NODE) ((NODE)->type.name)
  468. #define TYPE_NEXT_VARIANT(NODE) ((NODE)->type.next_variant)
  469. #define TYPE_MAIN_VARIANT(NODE) ((NODE)->type.main_variant)
  470. #define TYPE_BASETYPES(NODE) ((NODE)->type.basetypes)
  471. #define TYPE_NONCOPIED_PARTS(NODE) ((NODE)->type.noncopied_parts)
  472. #define TYPE_LANG_SPECIFIC(NODE) ((NODE)->type.lang_specific)
  473.  
  474. struct tree_type
  475. {
  476.   char common[sizeof (struct tree_common)];
  477.   union tree_node *values;
  478.   union tree_node *sep;
  479.   union tree_node *size;
  480.  
  481. #ifdef MPW_C
  482.   /* MPW C doesn't allow field widths on enums, so flush width completely. */
  483.   enum machine_mode mode;
  484. #else
  485.   enum machine_mode mode : 8;
  486. #endif /* MPW_C */
  487.   unsigned char size_unit;
  488.   unsigned char align;
  489.   unsigned char sep_unit;
  490.  
  491.   union tree_node *pointer_to;
  492.   union tree_node *reference_to;
  493.   int parse_info;
  494.   int symtab_address;
  495.   union tree_node *name;
  496.   union tree_node *max;
  497.   union tree_node *next_variant;
  498.   union tree_node *main_variant;
  499.   union tree_node *basetypes;
  500.   union tree_node *noncopied_parts;
  501.   /* Points to a structure whose details depend on the language in use.  */
  502.   struct lang_type *lang_specific;
  503. };
  504.  
  505. /* Define fields and accessors for nodes representing declared names.  */
  506.  
  507. #define DECL_VOFFSET(NODE) ((NODE)->decl.voffset)  /* In FIELD_DECLs and maybe PARM_DECLs.  */
  508. #define DECL_RESULT_TYPE(NODE) ((NODE)->decl.voffset) /* In FUNCTION_DECLs.  */
  509. #define DECL_VOFFSET_UNIT(NODE) ((NODE)->decl.voffset_unit)
  510. #define DECL_OFFSET(NODE) ((NODE)->decl.offset)
  511. #define DECL_FUNCTION_CODE(NODE) ((enum built_in_function) (NODE)->decl.offset)
  512. #define DECL_SET_FUNCTION_CODE(NODE,VAL) ((NODE)->decl.offset = (int) (VAL))
  513. #define DECL_NAME(NODE) ((NODE)->decl.name)
  514. #define DECL_PRINT_NAME(NODE) ((NODE)->decl.print_name)
  515. #define DECL_ASSEMBLER_NAME(NODE) ((NODE)->decl.assembler_name)
  516. #define DECL_CONTEXT(NODE) ((NODE)->decl.context)
  517. #define DECL_FIELD_CONTEXT(NODE) ((NODE)->decl.context)
  518. #define DECL_ARGUMENTS(NODE) ((NODE)->decl.arguments)  /* In FUNCTION_DECL.  */
  519. #define DECL_ARG_TYPE(NODE) ((NODE)->decl.arguments)   /* In PARM_DECL.  */
  520. #define DECL_RESULT(NODE) ((NODE)->decl.result)
  521. #define DECL_INITIAL(NODE) ((NODE)->decl.initial)
  522. #define DECL_SOURCE_FILE(NODE) ((NODE)->decl.filename)
  523. #define DECL_SOURCE_LINE(NODE) ((NODE)->decl.linenum)
  524. #define DECL_SIZE(NODE) ((NODE)->decl.size)
  525. #define DECL_SIZE_UNIT(NODE) ((NODE)->decl.size_unit)
  526. #define DECL_ALIGN(NODE) ((NODE)->decl.align)
  527. #define DECL_MODE(NODE) ((NODE)->decl.mode)
  528. #define DECL_RTL(NODE) ((NODE)->decl.rtl)
  529. #define DECL_BLOCK_SYMTAB_ADDRESS(NODE) ((NODE)->decl.block_symtab_address)
  530. #define DECL_SYMTAB_INDEX(NODE) ((NODE)->decl.block_symtab_address)
  531. #define DECL_SAVED_INSNS(NODE) ((NODE)->decl.saved_insns)
  532. #define DECL_FRAME_SIZE(NODE) ((NODE)->decl.frame_size)
  533. #define DECL_LANG_SPECIFIC(NODE) ((NODE)->decl.lang_specific)
  534. #define DECL_PARAM(NODE) ((NODE)->decl.regparams)
  535.  
  536. struct tree_decl
  537. {
  538.   char common[sizeof (struct tree_common)];
  539.   char *filename;
  540.   int linenum;
  541.   union tree_node *size;
  542. #ifdef MPW_C
  543.   /* MPW C doesn't allow field widths on enums, so flush width completely. */
  544.   enum machine_mode mode;
  545. #else
  546.   enum machine_mode mode : 8;
  547. #endif /* not MPW_C */
  548.   unsigned char size_unit;
  549.   unsigned char align;
  550.   unsigned char voffset_unit;
  551.   union tree_node *name;
  552.   union tree_node *context;
  553.   int offset;
  554.   union tree_node *voffset;
  555.   union tree_node *arguments;
  556.   union tree_node *result;
  557.   union tree_node *initial;
  558.   char *print_name;
  559.   char *assembler_name;
  560.   struct rtx_def *rtl;    /* acts as link to register transfer language
  561.                    (rtl) info */
  562.   int frame_size;        /* For FUNCTION_DECLs: size of stack frame */
  563.   struct rtx_def *saved_insns;    /* For FUNCTION_DECLs: points to insn that
  564.                    constitutes its definition on the
  565.                    permanent obstack.  */
  566.   int block_symtab_address;
  567.   /* Points to a structure whose details depend on the language in use.  */
  568.   struct lang_decl *lang_specific;
  569.   parameter *regparams;
  570. };
  571.  
  572. /* Define fields and accessors for nodes representing statements.
  573.    These are now obsolete for C, except for LET_STMT, which is used
  574.    to record the structure of binding contours (and the names declared
  575.    in each contour) for the sake of outputting debugging info.
  576.    Perhaps they will be used once again for other languages.  */
  577.  
  578. /* For LABEL_STMT, GOTO_STMT, RETURN_STMT, LOOP_STMT,
  579.    COMPOUND_STMT, ASM_STMT.  */
  580. #define STMT_SOURCE_LINE(NODE) ((NODE)->stmt.linenum)
  581. #define STMT_SOURCE_FILE(NODE) ((NODE)->stmt.filename)
  582. #define STMT_BODY(NODE) ((NODE)->stmt.body)
  583.  
  584. struct tree_stmt
  585. {
  586.   char common[sizeof (struct tree_common)];
  587.   char *filename;
  588.   int linenum;
  589.   union tree_node *body;
  590. };
  591.  
  592. /* For IF_STMT.  */
  593.  
  594. /* #define STMT_SOURCE_LINE(NODE) */
  595. /* #define STMT_SOURCE_FILE(NODE) */
  596. #define STMT_COND(NODE) ((NODE)->if_stmt.cond)
  597. #define STMT_THEN(NODE) ((NODE)->if_stmt.thenpart)
  598. #define STMT_ELSE(NODE) ((NODE)->if_stmt.elsepart)
  599.  
  600. struct tree_if_stmt
  601. {
  602.   char common[sizeof (struct tree_common)];
  603.   char *filename;
  604.   int linenum;
  605.   union tree_node *cond, *thenpart, *elsepart;
  606. };
  607.  
  608. /* For LET_STMT and WITH_STMT.  */
  609.  
  610. /* #define STMT_SOURCE_LINE(NODE) */
  611. /* #define STMT_SOURCE_FILE(NODE) */
  612. /* #define STMT_BODY(NODE) */
  613. #define STMT_VARS(NODE) ((NODE)->bind_stmt.vars)
  614. #define STMT_SUPERCONTEXT(NODE) ((NODE)->bind_stmt.supercontext)
  615. #define STMT_BIND_SIZE(NODE) ((NODE)->bind_stmt.bind_size)
  616. #define STMT_TYPE_TAGS(NODE) ((NODE)->bind_stmt.type_tags)
  617. #define STMT_SUBBLOCKS(NODE) ((NODE)->bind_stmt.subblocks)
  618.  
  619. struct tree_bind_stmt
  620. {
  621.   char common[sizeof (struct tree_common)];
  622.   char *filename;
  623.   int linenum;
  624.   union tree_node *body, *vars, *supercontext, *bind_size, *type_tags;
  625.   union tree_node *subblocks;
  626. };
  627.  
  628. /* For CASE_STMT.  */
  629.  
  630. #define STMT_CASE_INDEX(NODE) ((NODE)->case_stmt.index)
  631. #define STMT_CASE_LIST(NODE) ((NODE)->case_stmt.case_list)
  632.  
  633. struct tree_case_stmt
  634. {
  635.   char common[sizeof (struct tree_common)];
  636.   char *filename;
  637.   int linenum;
  638.   union tree_node *index, *case_list;
  639. };
  640.  
  641. /* Define the overall contents of a tree node.
  642.    It may be any of the structures declared above
  643.    for various types of node.  */
  644.  
  645. union tree_node
  646. {
  647.   struct tree_common common;
  648.   struct tree_int_cst int_cst;
  649.   struct tree_real_cst real_cst;
  650.   struct tree_string string;
  651.   struct tree_complex complex;
  652.   struct tree_identifier identifier;
  653.   struct tree_decl decl;
  654.   struct tree_type type;
  655.   struct tree_list list;
  656.   struct tree_exp exp;
  657.   struct tree_stmt stmt;
  658.   struct tree_if_stmt if_stmt;
  659.   struct tree_bind_stmt bind_stmt;
  660.   struct tree_case_stmt case_stmt;
  661. };
  662.  
  663. extern char *oballoc ();
  664. extern char *permalloc ();
  665.  
  666. /* Lowest level primitive for allocating a node.
  667.    The TREE_CODE is the only argument.  Contents are initialized
  668.    to zero except for a few of the common fields.  */
  669.  
  670. extern tree make_node ();
  671.  
  672. /* Make a copy of a node, with all the same contents except
  673.    for TREE_UID and TREE_PERMANENT.  (The copy is permanent
  674.    iff nodes being made now are permanent.)  */
  675.  
  676. extern tree copy_node ();
  677.  
  678. /* Make a copy of a chain of TREE_LIST nodes.  */
  679.  
  680. extern tree copy_list ();
  681.  
  682. /* Return the (unique) IDENTIFIER_NODE node for a given name.
  683.    The name is supplied as a char *.  */
  684.  
  685. extern tree get_identifier ();
  686.  
  687. /* Construct various types of nodes.  */
  688.  
  689. extern tree build_int_2 ();
  690. extern tree build_real ();
  691. extern tree build_real_from_string ();
  692. extern tree build_real_from_int_cst ();
  693. extern tree build_complex ();
  694. extern tree build_string ();
  695. #ifdef APPLE_HAX_VA
  696. extern tree build (enum tree_code code, ...);
  697. extern tree build_nt (enum tree_code code, ...);
  698. #else
  699. extern tree build ();
  700. extern tree build_nt ();
  701. #endif
  702. extern tree build_tree_list ();
  703. extern tree build_op_identifier ();
  704. extern tree build_decl ();
  705. extern tree build_let ();
  706.  
  707. /* Construct various nodes representing data types.  */
  708.  
  709. extern tree make_signed_type ();
  710. extern tree make_unsigned_type ();
  711. extern void fixup_unsigned_type ();
  712. extern tree build_pointer_type ();
  713. extern tree build_reference_type ();
  714. extern tree build_index_type ();
  715. extern tree build_array_type ();
  716. extern tree build_function_type ();
  717. extern tree build_method_type ();
  718. extern tree build_offset_type ();
  719. extern tree array_type_nelts ();
  720.  
  721. /* Construct expressions, performing type checking.  */
  722.  
  723. extern tree build_binary_op ();
  724. extern tree build_indirect_ref ();
  725. extern tree build_unary_op ();
  726.  
  727. /* Given a type node TYPE, and CONSTP and VOLATILEP, return a type
  728.    for the same kind of data as TYPE describes.
  729.    Variants point to the "main variant" (which has neither CONST nor VOLATILE)
  730.    via TYPE_MAIN_VARIANT, and it points to a chain of other variants
  731.    so that duplicate variants are never made.
  732.    Only main variants should ever appear as types of expressions.  */
  733.  
  734. extern tree build_type_variant ();
  735.  
  736. /* Given a ..._TYPE node, calculate the TYPE_SIZE, TYPE_SIZE_UNIT,
  737.    TYPE_ALIGN and TYPE_MODE fields.
  738.    If called more than once on one node, does nothing except
  739.    for the first time.  */
  740.  
  741. extern void layout_type ();
  742.  
  743. /* Given a hashcode and a ..._TYPE node (for which the hashcode was made),
  744.    return a canonicalized ..._TYPE node, so that duplicates are not made.
  745.    How the hash code is computed is up to the caller, as long as any two
  746.    callers that could hash identical-looking type nodes agree.  */
  747.  
  748. extern tree type_hash_canon ();
  749.  
  750. /* Given a VAR_DECL, PARM_DECL, RESULT_DECL or FIELD_DECL node,
  751.    calculates the DECL_SIZE, DECL_SIZE_UNIT, DECL_ALIGN and DECL_MODE
  752.    fields.  Call this only once for any given decl node.
  753.  
  754.    Second argument is the boundary that this field can be assumed to
  755.    be starting at (in bits).  Zero means it can be assumed aligned
  756.    on any boundary that may be needed.  */
  757.  
  758. extern void layout_decl ();
  759.  
  760. /* Fold constants as much as possible in an expression.
  761.    Returns the simplified expression.
  762.    Acts only on the top level of the expression;
  763.    if the argument itself cannot be simplified, its
  764.    subexpressions are not changed.  */
  765.  
  766. extern tree fold ();
  767.  
  768. /* combine (tree_code, exp1, exp2) where EXP1 and EXP2 are constants
  769.    returns a constant expression for the result of performing
  770.    the operation specified by TREE_CODE on EXP1 and EXP2.  */
  771.  
  772. extern tree combine ();
  773.  
  774. extern tree convert ();
  775. extern tree convert_units ();
  776. extern tree size_in_bytes ();
  777. extern tree genop ();
  778. extern tree build_int ();
  779. extern tree get_pending_sizes ();
  780.  
  781. /* Type for sizes of data-type.  */
  782.  
  783. extern tree sizetype;
  784.  
  785. /* Concatenate two lists (chains of TREE_LIST nodes) X and Y
  786.    by making the last node in X point to Y.
  787.    Returns X, except if X is 0 returns Y.  */
  788.  
  789. extern tree chainon ();
  790.  
  791. /* Make a new TREE_LIST node from specified PURPOSE, VALUE and CHAIN.  */
  792.  
  793. extern tree tree_cons (), perm_tree_cons (), temp_tree_cons ();
  794. extern tree saveable_tree_cons ();
  795.  
  796. /* Return the last tree node in a chain.  */
  797.  
  798. extern tree tree_last ();
  799.  
  800. /* Reverse the order of elements in a chain, and return the new head.  */
  801.  
  802. extern tree nreverse ();
  803.  
  804. /* Returns the length of a chain of nodes
  805.    (number of chain pointers to follow before reaching a null pointer).  */
  806.  
  807. extern int list_length ();
  808.  
  809. /* integer_zerop (tree x) is nonzero if X is an integer constant of value 0 */
  810.  
  811. extern int integer_zerop ();
  812.  
  813. /* integer_onep (tree x) is nonzero if X is an integer constant of value 1 */
  814.  
  815. extern int integer_onep ();
  816.  
  817. /* integer_all_onesp (tree x) is nonzero if X is an integer constant
  818.    all of whose significant bits are 1.  */
  819.  
  820. extern int integer_all_onesp ();
  821.  
  822. /* type_unsigned_p (tree x) is nonzero if the type X is an unsigned type
  823.    (all of its possible values are >= 0).
  824.    If X is a pointer type, the value is 1.
  825.    If X is a real type, the value is 0.  */
  826.  
  827. extern int type_unsigned_p ();
  828.  
  829. /* staticp (tree x) is nonzero if X is a reference to data allocated
  830.    at a fixed address in memory.  */
  831.  
  832. extern int staticp ();
  833.  
  834. /* Gets an error if argument X is not an lvalue.
  835.    Also returns 1 if X is an lvalue, 0 if not.  */
  836.  
  837. extern int lvalue_or_else ();
  838.  
  839. /* save_expr (EXP) returns an expression equivalent to EXP
  840.    but it can be used multiple times within context CTX
  841.    and only evaluate EXP once.  */
  842.  
  843. extern tree save_expr ();
  844.  
  845. /* stabilize_reference (EXP) returns an reference equivalent to EXP
  846.    but it can be used multiple times
  847.    and only evaluate the subexpressions once.  */
  848.  
  849. extern tree stabilize_reference ();
  850.  
  851. /* Return EXP, stripped of any conversions to wider types
  852.    in such a way that the result of converting to type FOR_TYPE
  853.    is the same as if EXP were converted to FOR_TYPE.
  854.    If FOR_TYPE is 0, it signifies EXP's type.  */
  855.  
  856. extern tree get_unwidened ();
  857.  
  858. /* Return OP or a simpler expression for a narrower value
  859.    which can be sign-extended or zero-extended to give back OP.
  860.    Store in *UNSIGNEDP_PTR either 1 if the value should be zero-extended
  861.    or 0 if the value should be sign-extended.  */
  862.  
  863. extern tree get_narrower ();
  864.  
  865. /* Given PRECISION and UNSIGNEDP, return a suitable type-tree
  866.    for an integer type with at least that precision.
  867.    The definition of this resides in language-specific code
  868.    as the repertoire of available types may vary.  */
  869.  
  870. extern tree type_for_size ();
  871.  
  872. /* Given an integer type T, return a type like T but unsigned.
  873.    If T is unsigned, the value is T.
  874.    The definition of this resides in language-specific code
  875.    as the repertoire of available types may vary.  */
  876.  
  877. extern tree unsigned_type ();
  878.  
  879. /* Given an integer type T, return a type like T but signed.
  880.    If T is signed, the value is T.
  881.    The definition of this resides in language-specific code
  882.    as the repertoire of available types may vary.  */
  883.  
  884. extern tree signed_type ();
  885.  
  886. /* Return the floating type node for a given floating machine mode.  */
  887.  
  888. extern tree get_floating_type ();
  889.  
  890. /* Given the FUNCTION_DECL for the current function,
  891.    return zero if it is ok for this function to be inline.
  892.    Otherwise return a warning message with a single %s
  893.    for the function's name.  */
  894.  
  895. extern char *function_cannot_inline_p ();
  896.  
  897. /* Declare commonly used variables for tree structure.  */
  898.  
  899. /* An integer constant with value 0 */
  900. extern tree integer_zero_node;
  901.  
  902. /* An integer constant with value 1 */
  903. extern tree integer_one_node;
  904.  
  905. /* An integer constant with value 0 whose type is sizetype.  */
  906. extern tree size_zero_node;
  907.  
  908. /* An integer constant with value 1 whose type is sizetype.  */
  909. extern tree size_one_node;
  910.  
  911. /* A constant of type pointer-to-int and value 0 */
  912. extern tree null_pointer_node;
  913.  
  914. /* A node of type ERROR_MARK.  */
  915. extern tree error_mark_node;
  916.  
  917. /* The type node for the void type.  */
  918. extern tree void_type_node;
  919.  
  920. /* The type node for the ordinary (signed) integer type.  */
  921. extern tree integer_type_node;
  922.  
  923. /* The type node for the unsigned integer type.  */
  924. extern tree unsigned_type_node;
  925.  
  926. /* The type node for the ordinary character type.  */
  927. extern tree char_type_node;
  928.  
  929. /* Points to the name of the input file from which the current input
  930.    being parsed originally came (before it went into cpp).  */
  931. extern char *input_filename;
  932.  
  933. /* Current source line number in that file.  */
  934. extern int lineno;
  935.  
  936. /* Nonzero for -pedantic switch: warn about anything
  937.    that standard C forbids.  */
  938. extern int pedantic;
  939.  
  940. /* Nonzero means can safely call expand_expr now;
  941.    otherwise layout_type puts variable sizes onto `pending_sizes' instead.  */
  942.  
  943. extern int immediate_size_expand;
  944.  
  945. /* Points to the FUNCTION_DECL of the function whose body we are reading. */
  946.  
  947. extern tree current_function_decl;
  948.  
  949. /* Nonzero if function being compiled can call setjmp.  */
  950.  
  951. extern int current_function_calls_setjmp;
  952.  
  953. /* Nonzero means all ..._TYPE nodes should be allocated permanently.  */
  954.  
  955. extern int all_types_permanent;
  956.  
  957. /* In stmt.c */
  958.  
  959. extern tree expand_start_stmt_expr ();
  960. extern tree expand_end_stmt_expr ();
  961. extern void expand_expr_stmt (), clear_last_expr ();
  962. extern void expand_label (), expand_goto (), expand_asm ();
  963. extern void expand_start_cond (), expand_end_cond ();
  964. extern void expand_start_else (), expand_end_else ();
  965. extern void expand_start_loop (), expand_start_loop_continue_elsewhere ();
  966. extern void expand_loop_continue_here ();
  967. extern void expand_end_loop ();
  968. extern int expand_continue_loop ();
  969. extern int expand_exit_loop (), expand_exit_loop_if_false ();
  970. extern int expand_exit_something ();
  971.  
  972. extern void expand_start_delayed_expr ();
  973. extern tree expand_end_delayed_expr ();
  974. extern void expand_emit_delayed_expr ();
  975.  
  976. extern void expand_null_return (), expand_return ();
  977. extern void expand_start_bindings (), expand_end_bindings ();
  978. extern void expand_start_case (), expand_end_case ();
  979. extern int pushcase (), pushcase_range ();
  980. extern void expand_start_function (), expand_end_function ();
  981.  
  982. #endif
  983.