home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1996 December / CD_shareware_12-96.iso / DOS / Programa / CCDL122.ZIP / INCLUDE / EXPR.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-03  |  3.1 KB  |  84 lines

  1. /*
  2.  * 68K/386 32-bit C compiler.
  3.  *
  4.  * copyright (c) 1996, David Lindauer
  5.  * 
  6.  * This compiler is intended for educational use.  It may not be used
  7.  * for profit without the express written consent of the author.
  8.  *
  9.  * It may be freely redistributed, as long as this notice remains intact
  10.  * and sources are distributed along with any executables derived from them.
  11.  *
  12.  * The author is not responsible for damages, either direct or consequential,
  13.  * that may arise from use of this software.
  14.  *
  15.  * v1.5 August 1996
  16.  * David Lindauer, gclind01@starbase.spd.louisville.edu
  17.  *
  18.  * Credits to Mathew Brandt for original K&R C compiler
  19.  *
  20.  */
  21.  
  22. /*      expression tree descriptions    */
  23.  
  24. enum e_node {
  25.         en_void,        /* used for parameter lists */
  26.     en_cb, en_cub, en_cw, en_cuw, en_cl, en_cul, en_cf, en_cd, en_cp, en_cld,
  27.         en_icon, en_acon, en_rcon, en_labcon, en_nacon, en_autocon, en_nalabcon,
  28.     en_absacon,
  29.         en_napccon, en_b_ref, en_w_ref, en_l_ref, en_ub_ref, en_uw_ref,
  30.     en_floatref, en_doubleref, en_longdoubleref, en_autoreg, en_trapcall,
  31.         en_ul_ref, en_fcall, en_fcallb, en_intcall, en_tempref, en_regref,
  32.     en_add, en_sub, en_mul, en_mod,
  33.         en_div, en_lsh, en_rsh, en_cond, en_assign, en_refassign, en_eq, en_ne,
  34.         en_asadd, en_assub, en_asmul, en_asdiv, en_asmod, en_asrsh,
  35.     en_asumul, en_asudiv, en_asumod, en_pmul,
  36.         en_aslsh, en_asand, en_asor, en_uminus, en_not, en_compl,
  37.         en_lt, en_le, en_gt, en_ge, en_and, en_or, en_land, en_lor,
  38.         en_xor, en_ainc, en_adec, en_umul, en_udiv, en_umod, en_ugt,
  39.         en_uge, en_ule, en_ult, en_moveblock, en_stackblock, en_callblock,
  40.     en_pdiv, en_alsh, en_arsh, en_asarsh,en_asalsh, en_bits};
  41.  
  42. /*      statement node descriptions     */
  43.  
  44. enum e_stmt {
  45.         st_line, st_expr, st_while, st_for, st_do, st_if, st_switch,
  46.         st_case, st_goto, st_break, st_continue, st_label,
  47.         st_return, st_block, st__genword };
  48.  
  49. struct enode {
  50.         char        nodetype;
  51.     char bits;
  52.     char startbit;
  53.     char cflags;
  54.     long size; /* For block moves */
  55.         union {
  56.                 long            i;
  57.                 double          f;
  58.                 char            *sp;
  59.                 struct enode    *p[2];
  60.                 } v;
  61.         };
  62.  
  63. struct snode {
  64.         short                 stype;
  65.         struct snode    *next;          /* next statement */
  66.         struct enode    *exp;           /* condition or expression */
  67.         struct snode    *s1, *s2,*lst;       /* internal statements &lineno*/
  68.     /* changed */
  69.     struct snode          *label;         /* label number for goto */
  70.         };
  71.  
  72. struct cse {
  73.         struct cse      *next;
  74.         struct enode    *exp;           /* optimizable expression */
  75.         short           uses;           /* number of uses */
  76.         short            duses;          /* number of dereferenced uses */
  77.     char        size;        /* Size of the expresion */
  78.         char             voidf;          /* cannot optimize flag */
  79.         char             reg;            /* allocated register */
  80.         };
  81.  
  82. #define ENODE struct enode
  83. #define SNODE struct snode
  84. #define CSE struct cse