|
|
1.1 root 1: /* @(#)cpass1.h 1.1 86/02/03 SMI */
2:
3:
4: # include "machdep.h"
5: # include "mip.h"
6:
7: /* storage classes */
8: # define SNULL 0
9: # define AUTO 1
10: # define EXTERN 2
11: # define STATIC 3
12: # define REGISTER 4
13: # define EXTDEF 5
14: # define LABEL 6
15: # define ULABEL 7
16: # define MOS 8
17: # define PARAM 9
18: # define STNAME 10
19: # define MOU 11
20: # define UNAME 12
21: # define TYPEDEF 13
22: # define FORTRAN 14
23: # define ENAME 15
24: # define MOE 16
25: # define UFORTRAN 17
26: # define USTATIC 18
27: /* field size is ORed in */
28: # define FIELD 0100
29: # define FLDSIZ 077
30: # ifndef BUG1
31: extern char *scnames();
32: # endif
33:
34: /* location counters */
35: # define PROG 0
36: # define DATA 1
37: # define ADATA 2
38: # define STRNG 3
39: # define ISTRNG 4
40: # define STAB 5
41:
42:
43: /* symbol table flags */
44: # define SMOS 01
45: # define SHIDDEN 02
46: # define SHIDES 04
47: # define SSET 010
48: # define SREF 020
49: # define SNONUNIQ 040
50: # define STAG 0100
51: # define SPRFORWARD 0200
52:
53: # ifndef FIXDEF
54: # define FIXDEF(p)
55: #endif
56: # ifndef FIXARG
57: # define FIXARG(p)
58: # endif
59: # ifndef FIXSTRUCT
60: # define FIXSTRUCT(a,b)
61: # endif
62:
63: /* alignment of initialized quantities */
64: # ifndef AL_INIT
65: # define AL_INIT ALINT
66: # endif
67:
68: struct symtab {
69: #ifndef FLEXNAMES
70: char sname[NCHNAM];
71: #else
72: char *sname;
73: #endif
74: TWORD stype; /* type word */
75:
76: char sclass; /* storage class */
77: char slevel; /* scope level */
78: char sflags; /* flags for set, use, hidden, mos, etc. */
79: int offset; /* offset or value */
80: short dimoff; /* offset into the dimension table */
81: short sizoff; /* offset into the size table */
82: short suse; /* line number of last use of the variable */
83: int hashVal;
84: struct symtab *next;
85: };
86:
87: # define STP(x) ((struct symtab *)(x)) /* casting */
88:
89: # ifdef ONEPASS
90: /* NOPREF must be defined for use in first pass tree machine */
91: # define NOPREF 020000 /* no preference for register assignment */
92: #else
93:
94: union ndu {
95: struct {
96: int op;
97: TWORD type;
98: int cdim, csiz;
99: }fn; /* front node */
100: struct {
101: int op;
102: TWORD type;
103: int cdim, csiz;
104: NODE *left;
105: NODE * right;
106: }in; /* interior node */
107:
108: struct {
109: /* this structure is the same as above,
110: but is used when a value, rather than
111: address, is kept in +left */
112: int op;
113: TWORD type;
114: int cdim, csiz;
115: CONSZ lval;
116: int rval;
117: }tn; /* terminal node */
118:
119: struct {
120: /* this structure is used when a floating point constant
121: is being computed */
122: int op;
123: TWORD type;
124: int cdim, csiz;
125: double dval;
126: }fpn; /* floating point node */
127:
128: };
129: # endif
130:
131: struct sw {
132: CONSZ sval;
133: int slab;
134: };
135:
136: extern struct sw swtab[];
137: extern struct sw *swp;
138: extern int swx;
139:
140: extern int ftnno;
141: extern int blevel;
142: extern int instruct, stwart;
143:
144: extern int lineno, nerrors;
145: typedef union {
146: int intval;
147: NODE * nodep;
148: } YYSTYPE;
149: extern YYSTYPE yylval;
150:
151: extern CONSZ lastcon;
152: extern double dcon;
153:
154: extern char ftitle[];
155: extern char ititle[];
156: extern struct symtab *stab[];
157: extern int curftn;
158: extern int curclass;
159: extern int curdim;
160: extern int *dimtab;
161: extern int paramstk[];
162: extern int paramno;
163: extern int autooff, argoff, strucoff;
164: extern int regvar;
165: extern int minrvar;
166: extern int brkflag;
167: extern char yytext[];
168:
169: extern int strflg;
170:
171: extern OFFSZ inoff;
172:
173: extern int reached;
174:
175: /* tunnel to buildtree for name id's */
176:
177: extern int idname;
178:
179: extern int cflag, hflag, pflag;
180:
181: /* various labels */
182: extern int brklab;
183: extern int contlab;
184: extern int flostat;
185: extern int retlab;
186: extern int retstat;
187: extern int asavbc[], *psavbc;
188:
189: /* flags used in structures/unions */
190:
191: # define SEENAME 01
192: # define INSTRUCT 02
193: # define INUNION 04
194: # define FUNNYNAME 010
195: # define TAGNAME 020
196:
197: /* flags used in the (elementary) flow analysis ... */
198:
199: # define FBRK 02
200: # define FCONT 04
201: # define FDEF 010
202: # define FLOOP 020
203:
204: /* flags used for return status */
205:
206: # define RETVAL 1
207: # define NRETVAL 2
208:
209: /* used to mark a constant with no name field */
210:
211: # define NONAME 040000
212:
213: /* mark an offset which is undefined */
214:
215: # define NOOFFSET (-10201)
216:
217: /* declarations of various functions */
218:
219: extern NODE
220: *buildtree(),
221: *bdty(),
222: *mkty(),
223: *rstruct(),
224: *dclstruct(),
225: *getstr(),
226: *tymerge(),
227: *stref(),
228: *offcon(),
229: *bcon(),
230: *bpsize(),
231: *convert(),
232: *pconvert(),
233: *oconvert(),
234: *ptmatch(),
235: *tymatch(),
236: *makety(),
237: *block(),
238: *doszof(),
239: *talloc(),
240: *optim(),
241: *strargs(),
242: *clocal();
243:
244: OFFSZ tsize(),
245: psize();
246:
247: TWORD types();
248:
249:
250: double atof();
251:
252: char *exname(), *exdcon();
253:
254: # define checkst(x)
255:
256: # ifndef CHARCAST
257: /* to make character constants into character connstants */
258: /* this is a macro to defend against cross-compilers, etc. */
259: # define CHARCAST(x) (char)(x)
260: # endif
261:
262: # define BCSZ 100 /* size of the table to save break and continue labels */
263: # define SYMTSZ 307 /* size of the symbol table (was 1300) */
264: # define DIMTABSZ 2048 /* size of increments of dimension/size table */
265: # define PARAMSZ 500 /* size of the parameter stack */
266: # define SWITSZ 500 /* size of switch table */
267: /* special interfaces for yacc alone */
268: /* These serve as abbreviations of 2 or more ops:
269: ASOP =, = ops
270: RELOP LE,LT,GE,GT
271: EQUOP EQ,NE
272: DIVOP DIV,MOD
273: SHIFTOP LS,RS
274: ICOP ICR,DECR
275: UNOP NOT,COMPL
276: STROP DOT,STREF
277:
278: */
279: # define ASOP 25
280: # define RELOP 26
281: # define EQUOP 27
282: # define DIVOP 28
283: # define SHIFTOP 29
284: # define INCOP 30
285: # define UNOP 31
286: # define STROP 32
287:
288: # define LP 50
289: # define RP 51
290: # define LC 52
291: # define RC 53
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.