1File: ICODE.H                                                             Page       1
     1   /*
     2   	Copyright 1982
     3   	Alcyon Corporation
     4   	8716 Production Ave.
     5   	San Diego, Ca.  92121
     6   */
     7   #include "machine.h"
     8   	/*
     9   	 * intermediate code operators
    10   	 * 0=>EOF, special operator
    11   	 */
    12   #define	EOF		0
    13    
    14   	/*1-59=>operators that generate code (entries in code gen optab)*/
    15   #define	ADD		1
    16   #define	SUB		2
    17   #define	MULT	3
    18   #define	DIV		4
    19   #define	MOD		5
    20   #define	RSH		6
    21   #define	LSH		7
    22   #define	AND		8
    23   #define	OR		9
    24   #define	XOR		10
    25   #define	NOT		11
    26   #define	UMINUS	12
    27   #define	COMPL	13
    28   #define	PREDEC	14
    29   #define	PREINC	15
    30   #define	POSTDEC	16
    31   #define	POSTINC	17
    32   #define	ASSIGN	18
    33   #define	EQADD	19
    34   #define	EQSUB	20
    35   #define	EQMULT	21
    36   #define	EQDIV	22
    37   #define	EQMOD	23
    38   #define	EQRSH	24
    39   #define	EQLSH	25
    40   #define	EQAND	26
    41   #define	EQOR	27
    42   #define	EQXOR	28
    43   #define	FJSR	29
    44   #define	EQUALS	30
    45   #define	NEQUALS	31
    46   #define	GREAT	32
    47   #define	GREATEQ	33
    48   #define	LESS	34
    49   #define	LESSEQ	35
    50   #define	INT2L	36
    51   #define	LONG2I	37
    52    
    53   	/*machine dependent operators that generate code*/
    54   #define	BTST	38
    55   #define	LOAD	39
    56   #define	LMULT	40
    57   #define	LDIV	41
    58   #define	LMOD	42
    59   #define	LEQMULT	43
1File: ICODE.H                                                             Page       2
    60   #define	LEQDIV	44
    61   #define	LEQMOD	45
    62   #define EQADDR	46
    63   #define	EQNOT	47
    64   #define	EQNEG	48
    65   #define	DOCAST	49
    66    
    67   #define STASSIGN	50	/*[vlh]*/
    68   #define LONG2F	51		/*[vlh] 3.4*/
    69   #define FLOAT2L	52		/*[vlh] 3.4*/
    70   #define INT2F	53		/*[vlh] 3.4*/
    71   #define FLOAT2I	54		/*[vlh] 3.4*/
    72   #define	LCGENOP	55		/*change if adding more operators...*/
    73    
    74   	/*intermediate code operators that do not generate code*/
    75   #define	ADDR	60
    76   #define	INDR	61
    77   #define	LAND	62
    78   #define	LOR		63
    79   #define	QMARK	64
    80   #define	COLON	65
    81   #define	COMMA	66
    82   #define	CINT	67
    83   #define CLONG	68
    84   #define	SYMBOL	69
    85   #define	AUTOINC	70
    86   #define	AUTODEC	71
    87   #define	CALL	72
    88   #define	NACALL	73
    89   #define BFIELD	74
    90   #define IFGOTO	75
    91   #define	INIT	76
    92   #define	CFORREG	77
    93   #define	DCLONG	78
    94   #define CFLOAT	79	/*[vlh] 3.4*/
    95    
    96   	/*operators local to parser*/
    97   #define CAST	80
    98   #define	SEMI	81
    99   #define	LCURBR	82
   100   #define	RCURBR	83
   101   #define	LBRACK	84
   102   #define	RBRACK	85
   103   #define	LPAREN	86
   104   #define	RPAREN	87
   105   #define	STRING	88
   106   #define	RESWORD	89
   107   #define	APTR	90
   108   #define	PERIOD	91
   109   #define SIZEOF	92
   110   #define	MPARENS	93
   111   #define	FRETURN	94
   112   #define	STACKEND	100
   113    
   114   	/*data types*/
   115   #define	TYPELESS	0
   116   #define	CHAR		1
   117   #define	SHORT		2
   118   #define	INT			3
1File: ICODE.H                                                             Page       3
   119   #define	LONG		4
   120   #define	UCHAR		5
   121   #define	USHORT		6
   122   #define UNSIGNED 	7
   123   #define	ULONG		8
   124   #define	FLOAT		9
   125   #define	DOUBLE		10
   126    
   127   	/*data types local to parser*/
   128   #define	STRUCT		11
   129   #define	FRSTRUCT	12
   130   #define	LLABEL		13
   131    
   132   	/*type flags and definitions*/
   133   #define	TYPE		017
   134   #define	SUPTYP		060
   135   #define	ALLTYPE		077
   136   #define	POINTER		020
   137   #define	FUNCTION	040
   138   #define	ARRAY		060
   139   #define	SUTYPLEN	2
   140    
   141   	/*data registers*/
   142   #define	DREG0	0
   143   #define	DREG2	2
   144   #define	DREG3	3
   145   #define	DREG4	4
   146   #define	DREG5	5
   147   #define	DREG6	6
   148   #define	DREG7	7
   149   #define	AREG3	11
   150   #define	AREG4	12
   151   #define	AREG5	13
   152    
   153   	/*storage classes*/
   154   #define	AUTO		1
   155   #define	REGISTER	2
   156   #define	EXTERNAL	3
   157   #define	STATIC		4
   158   #define	REGOFF		5
   159   #define	EXTOFF		6
   160   #define	STATOFF		7
   161   #define	INDEXED		8
   162    
   163   	/*exclusively code generator storage classes*/
   164   #define	CINDR		9
   165   #define	CLINDR		10
   166   #define CFINDR		11	/* [vlh] 3.4 */
   167    
   168   	/*exclusively parser storage classes*/
   169   #define	STRPROTO	9
   170   #define PDECLIST	10
   171   #define	PARMLIST	11
   172   #define	BFIELDCL	12
   173   #define UNELCL		13
   174   #define	STELCL		14
   175    
   176    
   177   	/*opinfo table bits*/
1File: ICODE.H                                                             Page       4
   178   #define	OPPRI		077
   179   #define	OPBIN		0100
   180   #define	OPLVAL		0200
   181   #define	OPREL		0400
   182   #define	OPASSIGN	01000
   183   #define	OPLWORD		02000
   184   #define	OPRWORD		04000
   185   #define	OPCOM		010000
   186   #define	OPRAS		020000
   187   #define	OPTERM		040000
   188   #define	OPCONVS		0100000
   189    
   190   	/*68000 definitions*/
   191   #define	PTRSIZE		4
   192   #define	INTSIZE		2
   193   #define	LONGSIZE	4
   194   #define	SSIZE		8				/* chars per symbol */
   195   #define	TRUE		1
   196   #define	FALSE		0
   197   #define TABC		'\t'			/* tab character */
   198   #define EOLC		'\n'			/* end of line character */
   199   #define	BITSPBYTE	8
   200    
   201   	/*operator class priorities*/
   202   #define	TRMPRI		0				/* terminal nodes */
   203   #define	RPNPRI		1				/* ) and ] */
   204   #define	CALPRI		2				/* in-stack call, ( or [ */
   205   #define	COLPRI		3				/* init or case priority for : or , */
   206   #define	STKPRI		4				/* priority of end of stack */
   207   #define	COMPRI		5				/* normal priority for , */
   208   #define	ASGPRI		6				/* =, +=, -=, *=, /=, %=, ... */
   209   #define	QMKPRI		7				/* ?: */
   210   #define	LORPRI		8				/* || */
   211   #define	LNDPRI		9				/* && */
   212   #define	ORPRI		10				/* |, ! */
   213   #define	ANDPRI		11				/* & */
   214   #define	EQLPRI		12				/* ==, != */
   215   #define	RELPRI		13				/* >, <, >=, <= */
   216   #define	SHFPRI		14				/* <<, >> */
   217   #define	ADDPRI		15				/* +, - */
   218   #define	MULPRI		16				/* *, /, % */
   219   #define	UNOPRI		17				/* ++, --, &, *, -, ~, sizeof */
   220   #define	LPNPRI		18				/* ., ->, [, (, function call */
   221   #define	PSTPRI		19				/* in-stack post--, post++ */
   222    
   223   struct io_buf {
   224   	int io_fd;
   225   	int io_nc;
   226   	char *io_p;
   227   	char io_b[512];
   228   };
   229    
   230   #ifdef PDP11
   231   struct { short hiword; short loword; };
   232   #endif
   233   #ifdef MC68000
   234   struct { short hiword; short loword; };
   235   #endif
   236   #ifdef VAX
1File: ICODE.H                                                             Page       5
   237   struct { short loword; short hiword; };
   238   #endif
   239    
   240   #define	EXPSIZE		1024
   241   int exprarea[EXPSIZE];
   242    
   243   /* v6io buffer declaration */
   244   #define BLEN	512
   245    
   246   struct iobuf{
   247   	int fildes;
   248   	int nunused;
   249   	char *xfree;
   250   	char buff[BLEN];
   251   };
