home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d110 / pdc.lha / Pdc / src / Expr.h < prev    next >
C/C++ Source or Header  |  1987-10-28  |  2KB  |  70 lines

  1. /*
  2.  *68000 C compiler
  3.  *
  4.  *Copyright 1984, 1985, 1986 Matthew Brandt.
  5.  *  all commercial rights reserved.
  6.  *
  7.  *This compiler is intended as an instructive tool for personal use. Any
  8.  *use for profit without the written consent of the author is prohibited.
  9.  *
  10.  *This compiler may be distributed freely for non-commercial use as long
  11.  *as this notice stays intact. Please forward any enhancements or questions
  12.  *to:
  13.  *
  14.  *Matthew Brandt
  15.  *Box 920337
  16.  *Norcross, Ga 30092
  17.  */
  18.  
  19. /*      expression tree descriptions    */
  20.  
  21. enum e_node {
  22.         en_void,        /* used for parameter lists */
  23.     en_info,    /* info about parameters    */
  24.         en_cbw, en_cbl, en_cwl, en_cld, en_cfd,
  25.         en_icon, en_fcon, en_labcon, en_nacon, en_autocon,
  26.         en_b_ref, en_w_ref, en_l_ref, en_ub_ref, en_uw_ref,
  27.         en_ul_ref, en_fcall, en_tempref, en_add, en_sub, en_mul, en_mod,
  28.         en_div, en_lsh, en_rsh, en_cond, en_assign, en_eq, en_ne,
  29.         en_asadd, en_assub, en_asmul, en_asdiv, en_asmod, en_asrsh,
  30.         en_aslsh, en_asand, en_asor, en_uminus, en_not, en_compl,
  31.         en_lt, en_le, en_gt, en_ge, en_and, en_or, en_land, en_lor,
  32.         en_xor, en_ainc, en_adec, en_umul, en_udiv, en_umod, en_ugt,
  33.         en_uge, en_ule, en_ult };
  34.  
  35. /*      statement node descriptions     */
  36.  
  37. enum e_stmt {
  38.         st_expr, st_while, st_for, st_do, st_if, st_switch,
  39.         st_case, st_goto, st_break, st_continue, st_label,
  40.         st_return };
  41.  
  42. struct enode {
  43.         enum e_node     nodetype;
  44.         short           constflag;
  45.         union {
  46.                 long            i;
  47.                 double          f;
  48.                 char            *sp;
  49.                 struct enode    *p[2];
  50.                 } v;
  51.         };
  52.  
  53. struct snode {
  54.         enum e_stmt     stype;
  55.         struct snode    *next;          /* next statement */
  56.         struct enode    *exp;           /* condition or expression */
  57.         struct snode    *s1, *s2;       /* internal statements */
  58.         long        *label;         /* label number for goto */
  59.         };
  60.  
  61. struct cse {
  62.         struct cse      *next;
  63.         struct enode    *exp;           /* optimizable expression */
  64.         int             uses;           /* number of uses */
  65.         int             duses;          /* number of dereferenced uses */
  66.         int             voidf;          /* cannot optimize flag */
  67.         int             reg;            /* allocated register */
  68.         };
  69.  
  70.