1: /* @(#)c1.h 2.2 SCCS id keyword */
2: /*
3: * C code generator header
4: */
5:
6: #include <stdio.h>
7: #include <whoami.h>
8:
9: #define LTYPE long /* change to int for no long consts */
10: #define NCPS 8
11: #define NULL 0
12:
13: /*
14: * Tree node for unary and binary
15: */
16: struct tnode {
17: int op;
18: int type;
19: int degree;
20: struct tnode *tr1, *tr2;
21: };
22:
23: /*
24: * tree names for locals
25: */
26: struct tname {
27: int op;
28: int type;
29: char class;
30: char regno;
31: int offset;
32: int nloc;
33: };
34:
35: /*
36: * tree names for externals
37: */
38: struct xtname {
39: int op;
40: int type;
41: char class;
42: char regno;
43: int offset;
44: char name[NCPS];
45: };
46:
47: struct tconst {
48: int op;
49: int type;
50: int value;
51: };
52:
53: /*
54: * long constants
55: */
56: struct lconst {
57: int op;
58: int type;
59: LTYPE lvalue;
60: };
61:
62: struct ftconst {
63: int op;
64: int type;
65: int value;
66: double fvalue;
67: };
68:
69: /*
70: * Node used for field assignemnts
71: */
72: struct fasgn {
73: int op;
74: int type;
75: int degree;
76: struct tnode *tr1, *tr2;
77: int mask;
78: };
79:
80: struct optab {
81: char tabdeg1;
82: char tabtyp1;
83: char tabdeg2;
84: char tabtyp2;
85: char *tabstring;
86: };
87:
88: struct table {
89: int tabop;
90: struct optab *tabp;
91: };
92:
93: struct instab {
94: int iop;
95: char *str1;
96: char *str2;
97: };
98:
99: struct swtab {
100: int swlab;
101: int swval;
102: };
103:
104: char maprel[];
105: char notrel[];
106: int nreg;
107: int isn;
108: int namsiz;
109: int line;
110: int nerror;
111: struct table cctab[];
112: struct table efftab[];
113: struct table regtab[];
114: struct table sptab[];
115: struct table lsptab[1];
116: struct instab instab[];
117: struct instab branchtab[];
118: int opdope[];
119: char *opntab[];
120: int nstack;
121: int nfloat;
122: struct tname sfuncr;
123: char *funcbase;
124: char *curbase;
125: char *coremax;
126: struct tconst czero, cone;
127: struct ftconst fczero;
128: long totspace;
129: #ifdef MENLO_OVLY
130: int ovlyflag;
131: #endif
132: /*
133: * Some special stuff for long comparisons
134: */
135: int xlab1, xlab2, xop, xzero;
136:
137: /*
138: operators
139: */
140: #define EOFC 0
141: #define SEMI 1
142: #define LBRACE 2
143: #define RBRACE 3
144: #define LBRACK 4
145: #define RBRACK 5
146: #define LPARN 6
147: #define RPARN 7
148: #define COLON 8
149: #define COMMA 9
150: #define FSEL 10
151: #define FSELR 11
152: #define FSELT 12
153: #define FSELA 16
154: #define ULSH 17
155: #define ASULSH 18
156:
157: #define KEYW 19
158: #define NAME 20
159: #define CON 21
160: #define STRING 22
161: #define FCON 23
162: #define SFCON 24
163: #define LCON 25
164: #define SLCON 26
165:
166: #define AUTOI 27
167: #define AUTOD 28
168: #define INCBEF 30
169: #define DECBEF 31
170: #define INCAFT 32
171: #define DECAFT 33
172: #define EXCLA 34
173: #define AMPER 35
174: #define STAR 36
175: #define NEG 37
176: #define COMPL 38
177:
178: #define DOT 39
179: #define PLUS 40
180: #define MINUS 41
181: #define TIMES 42
182: #define DIVIDE 43
183: #define MOD 44
184: #define RSHIFT 45
185: #define LSHIFT 46
186: #define AND 47
187: #define ANDN 55
188: #define OR 48
189: #define EXOR 49
190: #define ARROW 50
191: #define ITOF 51
192: #define FTOI 52
193: #define LOGAND 53
194: #define LOGOR 54
195: #define FTOL 56
196: #define LTOF 57
197: #define ITOL 58
198: #define LTOI 59
199: #define ITOP 13
200: #define PTOI 14
201: #define LTOP 15
202:
203: #define EQUAL 60
204: #define NEQUAL 61
205: #define LESSEQ 62
206: #define LESS 63
207: #define GREATEQ 64
208: #define GREAT 65
209: #define LESSEQP 66
210: #define LESSP 67
211: #define GREATQP 68
212: #define GREATP 69
213:
214: #define ASPLUS 70
215: #define ASMINUS 71
216: #define ASTIMES 72
217: #define ASDIV 73
218: #define ASMOD 74
219: #define ASRSH 75
220: #define ASLSH 76
221: #define ASAND 77
222: #define ASOR 78
223: #define ASXOR 79
224: #define ASSIGN 80
225: #define TAND 81
226: #define LTIMES 82
227: #define LDIV 83
228: #define LMOD 84
229: #define ASANDN 85
230: #define LASTIMES 86
231: #define LASDIV 87
232: #define LASMOD 88
233:
234: #define QUEST 90
235: #define MAX 93
236: #define MAXP 94
237: #define MIN 95
238: #define MINP 96
239: #define LLSHIFT 91
240: #define ASLSHL 92
241: #define SEQNC 97
242: #define CALL1 98
243: #define CALL2 99
244: #define CALL 100
245: #define MCALL 101
246: #define JUMP 102
247: #define CBRANCH 103
248: #define INIT 104
249: #define SETREG 105
250: #define LOAD 106
251: #define ITOC 109
252: #define RFORCE 110
253:
254: /*
255: * Intermediate code operators
256: */
257: #define BRANCH 111
258: #define LABEL 112
259: #define NLABEL 113
260: #define RLABEL 114
261: #define STRASG 115
262: #define STRSET 116
263: #define BDATA 200
264: #define PROG 202
265: #define DATA 203
266: #define BSS 204
267: #define CSPACE 205
268: #define SSPACE 206
269: #define SYMDEF 207
270: #define SAVE 208
271: #define RETRN 209
272: #define EVEN 210
273: #define PROFIL 212
274: #define SWIT 213
275: #define EXPR 214
276: #define SNAME 215
277: #define RNAME 216
278: #define ANAME 217
279: #define NULLOP 218
280: #define SETSTK 219
281: #define SINIT 220
282: #define GLOBAL 221
283: #define C3BRANCH 222
284:
285: /*
286: * types
287: */
288: #define INT 0
289: #define CHAR 1
290: #define FLOAT 2
291: #define DOUBLE 3
292: #define STRUCT 4
293: #define RSTRUCT 5
294: #define LONG 6
295: #define UNSIGN 7
296:
297: #define TYLEN 2
298: #define TYPE 07
299: #define XTYPE (03<<3)
300: #define PTR 010
301: #define FUNC 020
302: #define ARRAY 030
303:
304: /*
305: storage classes
306: */
307: #define KEYWC 1
308: #define MOS 10
309: #define AUTO 11
310: #define EXTERN 12
311: #define STATIC 13
312: #define REG 14
313: #define STRTAG 15
314: #define ARG 16
315: #define OFFS 20
316: #define XOFFS 21
317: #define SOFFS 22
318:
319: /*
320: Flag bits
321: */
322:
323: #define BINARY 01
324: #define LVALUE 02
325: #define RELAT 04
326: #define ASSGOP 010
327: #define LWORD 020
328: #define RWORD 040
329: #define COMMUTE 0100
330: #define RASSOC 0200
331: #define LEAF 0400
332: #define CNVRT 01000
Defined variables
cctab
defined in line
111; used 17 times
- in /usr/src/cmd/c/c10.c line
204,
262,
336,
349,
357,
371,
425,
435,
495,
626,
740,
827,
912
- in /usr/src/cmd/c/c11.c line
635,
671,
694,
961
cone
defined in line
126; used 2 times
efftab
defined in line
112; used 14 times
- in /usr/src/cmd/c/c10.c line
212,
251,
303,
340,
353,
497,
892,
914
- in /usr/src/cmd/c/c11.c line
613,
955-958(2),
1123,
1145,
1160
isn
defined in line
107; used 25 times
- in /usr/src/cmd/c/c10.c line
426-431(3),
437-441(2),
1065-1066(3)
- in /usr/src/cmd/c/c11.c line
402,
412-413(3),
451-458(4),
588,
602,
736,
1015,
1114,
1154-1155(3)
- in /usr/src/cmd/c/c12.c line
312
line
defined in line
109; used 3 times
nreg
defined in line
106; used 8 times
opdope
defined in line
118; used 31 times
- in /usr/src/cmd/c/c10.c line
108,
123-130(4),
148,
203,
337,
357,
420,
507,
644,
819-823(2),
851,
944
- in /usr/src/cmd/c/c11.c line
30-33(2),
270,
286,
622,
631,
637,
674,
1063
- in /usr/src/cmd/c/c12.c line
28,
78,
248,
465,
540,
1001
xop
defined in line
135; used 4 times
Defined struct's
fasgn
defined in line
72; used 6 times
instab
defined in line
93; used 12 times
lconst
defined in line
56; used 10 times
optab
defined in line
80; used 4 times
swtab
defined in line
99; used 10 times
table
defined in line
88; used 26 times
tname
defined in line
26; used 10 times
tnode
defined in line
16; used 166 times
- in line 20(2),
76(2)
- in /usr/src/cmd/c/c10.c line
92(2),
98-99(4),
182-187(4),
405-411(6),
811-815(4),
845-848(4),
933-935(4),
960-962(4),
1006-1009(6),
1031(2),
1083-1087(6),
1100-1102(4),
1190(2)
- in /usr/src/cmd/c/c11.c line
17-19(4),
42-45(4),
130-132(4),
142-144(4),
159-161(4),
200-203(4),
245-248(4),
265-267(4),
280(2),
513(2),
525-528(4),
573-577(4),
663-667(4),
799-800(4),
1106(2),
1164(2)
- in /usr/src/cmd/c/c12.c line
11-17(6),
270-273(4),
556-558(4),
602-603(4),
610-611(4),
717-721(8),
781-783(4),
848-850(4),
946-948(4),
992-994(4),
1044-1046(4),
1057-1059(4)
Defined macros
AMPER
defined in line
173; used 13 times
AND
defined in line
186; used 6 times
ANDN
defined in line
187; used 4 times
ARG
defined in line
314;
never used
ASOR
defined in line
222; used 2 times
AUTO
defined in line
309; used 1 times
BSS
defined in line
266;
never used
CALL
defined in line
244; used 2 times
CHAR
defined in line
289; used 18 times
- in /usr/src/cmd/c/c10.c line
474(2),
583,
592(2),
866,
1110
- in /usr/src/cmd/c/c11.c line
34,
149,
209,
221
- in /usr/src/cmd/c/c12.c line
42,
136-139(2),
348,
472,
505,
643
CON
defined in line
159; used 50 times
- in /usr/src/cmd/c/c10.c line
25-26(2),
203,
466,
719,
1126,
1132-1135(2),
1147,
1175
- in /usr/src/cmd/c/c11.c line
23,
190,
258,
516,
641,
688
- in /usr/src/cmd/c/c12.c line
98,
110,
136,
149-154(2),
187,
209,
222,
237(2),
248,
290,
324,
344,
358,
416,
448,
476,
485,
509,
517,
624(2),
649,
656,
728-732(2),
856,
865,
964-965(2),
1013,
1049-1051(2)
DATA
defined in line
265;
never used
DOT
defined in line
178;
never used
EOFC
defined in line
140;
never used
EQUAL
defined in line
203; used 17 times
EVEN
defined in line
272;
never used
EXOR
defined in line
189; used 2 times
EXPR
defined in line
275; used 1 times
FCON
defined in line
161; used 10 times
FSEL
defined in line
150; used 3 times
FTOI
defined in line
192; used 1 times
FTOL
defined in line
195; used 2 times
FUNC
defined in line
301;
never used
GREAT
defined in line
208; used 12 times
INIT
defined in line
248;
never used
INT
defined in line
288; used 27 times
- in /usr/src/cmd/c/c10.c line
25-26(2),
317,
1042,
1054,
1114-1117(2)
- in /usr/src/cmd/c/c11.c line
209-211(2),
999,
1023(3),
1131
- in /usr/src/cmd/c/c12.c line
43,
61,
195,
290,
371,
417,
473,
506,
589-590(3),
857,
866
ITOC
defined in line
251;
never used
ITOF
defined in line
191; used 1 times
ITOL
defined in line
197; used 18 times
- in /usr/src/cmd/c/c10.c line
314,
454,
629,
1174
- in /usr/src/cmd/c/c11.c line
27,
623(2),
688,
999
- in /usr/src/cmd/c/c12.c line
97,
110,
320,
484,
499,
517,
856,
865,
1051
ITOP
defined in line
199; used 1 times
JUMP
defined in line
246;
never used
KEYW
defined in line
157;
never used
LCON
defined in line
163; used 16 times
- in /usr/src/cmd/c/c10.c line
1128,
1154,
1178
- in /usr/src/cmd/c/c11.c line
1003
- in /usr/src/cmd/c/c12.c line
111,
292,
308,
480,
487,
513,
519,
638,
854,
863,
930-935(2)
LDIV
defined in line
227; used 1 times
LEAF
defined in line
331; used 10 times
LESS
defined in line
206; used 12 times
LMOD
defined in line
228; used 1 times
LOAD
defined in line
250; used 5 times
LONG
defined in line
294; used 38 times
- in /usr/src/cmd/c/c10.c line
313,
363,
454(2),
495,
657,
771,
1046,
1072,
1196
- in /usr/src/cmd/c/c11.c line
191-194(2),
252,
287,
630-631(2),
692,
957,
999-1004(2),
1133
- in /usr/src/cmd/c/c12.c line
67,
97,
123,
201,
216,
246,
293,
302,
320,
441,
488,
500,
520,
689,
936,
1038,
1074
LTOF
defined in line
196; used 2 times
LTOI
defined in line
198; used 8 times
LTOP
defined in line
201;
never used
LTYPE
defined in line
9; used 1 times
MAX
defined in line
235;
never used
MAXP
defined in line
236;
never used
MIN
defined in line
237;
never used
MINP
defined in line
238;
never used
MOD
defined in line
183; used 3 times
MOS
defined in line
308;
never used
NAME
defined in line
158; used 25 times
- in /usr/src/cmd/c/c10.c line
28,
281,
297,
349-353(2),
862,
883,
889,
940,
965,
1049
- in /usr/src/cmd/c/c11.c line
103,
190,
221,
982,
1135-1136(2)
- in /usr/src/cmd/c/c12.c line
23,
130(2),
347,
413,
434,
442-447(2)
NCPS
defined in line
10; used 1 times
NEG
defined in line
175; used 2 times
NULL
defined in line
11;
never used
OFFS
defined in line
315; used 5 times
OR
defined in line
188; used 2 times
PLUS
defined in line
179; used 24 times
- in /usr/src/cmd/c/c10.c line
465-468(2),
853-857(2),
894,
969-972(2),
1054
- in /usr/src/cmd/c/c11.c line
256,
1176
- in /usr/src/cmd/c/c12.c line
68,
371,
414,
447,
635,
649,
668,
692,
736,
762,
965,
973-975(2)
- in /usr/src/cmd/c/c13.c line
313
PROG
defined in line
264;
never used
PTOI
defined in line
200; used 3 times
PTR
defined in line
300; used 13 times
REG
defined in line
312; used 11 times
RELAT
defined in line
325; used 14 times
- in /usr/src/cmd/c/c10.c line
203,
357,
425,
454
- in /usr/src/cmd/c/c11.c line
270,
286,
622,
631,
637,
674
- in /usr/src/cmd/c/c12.c line
128,
245-248(2),
465
SAVE
defined in line
270;
never used
SEMI
defined in line
141;
never used
STAR
defined in line
174; used 16 times
- in /usr/src/cmd/c/c10.c line
143,
150,
634,
715,
857,
969,
1012,
1049,
1093
- in /usr/src/cmd/c/c11.c line
251,
1135-1136(2),
1172
- in /usr/src/cmd/c/c12.c line
137,
281,
411
SWIT
defined in line
274;
never used
TAND
defined in line
225; used 3 times
TIMES
defined in line
181; used 12 times
TYPE
defined in line
298; used 8 times
ULSH
defined in line
154; used 3 times
UNSIGN
defined in line
295; used 26 times
- in /usr/src/cmd/c/c10.c line
736,
772
- in /usr/src/cmd/c/c11.c line
28-30(2),
209-211(2),
627(2)
- in /usr/src/cmd/c/c12.c line
67,
99-104(3),
191,
223-228(2),
300-303(2),
319,
402,
489,
495,
521,
567,
591,
662,
693
Usage of this include