2 * C second pass -- tables
5 #if !defined(lint) && defined(DOSCCS)
6 static char sccsid[] = "@(#)c13.c 2.1 (2.11BSD GTE) 10/4/94";
11 * Operator dope table-- see description in c0.
13 /* notes on type safety: */
14 /* LEAF=0 implies node is a tnode and tn_tr1 is valid */
15 /* CNVRT=1 implies node is a tnode and tn_tr1 is valid */
16 /* BINARY=1 implies node is a tnode and tn_tr1, tn_tr2 are valid */
17 /* ASSGOP=1 implies node is a tnode and tn_tr1, tn_tr2 are valid */
19 000000, /* EOFC (0) */
29 000000, /* field selection (10) */
30 000000, /* reverse field selection */
31 /*000001*/000000, /* temporary field selection */
32 000001, /* int->ptr */
33 000001, /* ptr->int */
34 000001, /* long->ptr */
35 000001, /* field assignment */
36 000001, /* >> unsigned */
37 000001, /* >>= unsigned */
39 000400, /* name (20) */
40 000400, /* short constant */
44 000400, /* long const */
45 000400, /* long const <= 16 bits */
46 000400, /* autoi, *r++ */
47 000400, /* autod, *--r */
48 000400, /* () empty arglist */
49 034213, /* ++pre (30) */
58 036001, /* . (structure reference) */
70 001000, /* int -> double */
71 001000, /* double -> int */
75 001000, /* double -> long */
76 001000, /* long -> double */
77 001000, /* integer -> long */
78 000000, /* long -> integer */
100 030001, /* & for tests */
101 032001, /* * (long) */
102 032001, /* / (long) */
103 032001, /* % (long) */
105 012213, /* *= (long) */
106 012213, /* /= (long) */
107 012213, /* %= (long) */
109 014201, /* question '?' (90) */
110 026061, /* long << */
111 012253, /* long <<= */
119 036001, /* call (100) */
122 000000, /* jump cond */
123 000000, /* branch cond */
124 000400, /* set nregs */
128 000000, /* int->char */
129 000000, /* force r0 (110) */
134 000000, /* structure assign */
135 000001, /* struct assignment setup */
136 032001, /* unsigned / */
137 032001, /* unsigned % */
138 012213, /* unsigned /= */
139 012213, /* unsigned %= (120) */
140 032001, /* unsigned long * */
141 032001, /* unsigned long / */
142 032001, /* unsigned long % */
143 012213, /* unsigned long *= */
144 012213, /* unsigned long /= */
145 012213, /* unsigned long %= */
146 01000, /* unsigned long -> float(double) */
147 026061, /* unsigned long >> */
148 012253, /* unsigned long >>= (129) */
162 "field select", /* 10 */
262 "force register", /* 110 */
273 "*", /* unsigned long */
274 "/", /* unsigned long */
275 "%", /* unsigned long */
276 "*=", /* unsigned long */
277 "/=", /* unsigned long */
278 "%=", /* unsigned long */
279 "u_long->double", /* unsigned long */
280 ">>", /* unsigned long */
281 ">>=", /* 129 unsigned long */
285 * Strings for instruction tables.
301 char bic1[] = "bic $1,";
303 char bit1[] = "bit $1,";
305 char bis1[] = "bis $1,";
310 char ashc[] = "ashc";
311 char slmul[] = "lmul";
312 char sldiv[] = "ldiv";
313 char slrem[] = "lrem";
314 char uldiv[] = "uldiv";
315 char ulrem[] = "ulrem";
316 char ualdiv[] = "ualdiv";
317 char ualrem[] = "ualrem";
318 char ultof[] = "ultof";
319 char ulsh[] = "ulsh";
320 char ualsh[] = "ualsh";
321 char almul[] = "almul";
322 char aldiv[] = "aldiv";
323 char alrem[] = "alrem";
324 char udiv[] = "udiv";
325 char urem[] = "urem";
332 char jlos[] = "jlos";
335 char jhis[] = "jhis";
340 char jmijne[] = "jmi\tL%d\njne";
341 char jmijeq[] = "jmi\tL%d\njeq";
344 * Instruction tables, accessed by
345 * I (first operand) or I' (second) macros.
348 struct instab instab[] = {
371 {DIVIDE, _div, _div},
390 {CALL1, stdol, stdol},
392 {LLSHIFT, ashc, ashc},
393 {ASLSHL, ashc, ashc},
394 {LTIMES, slmul, slmul},
395 {LDIV, sldiv, sldiv},
396 {LMOD, slrem, slrem},
397 {LASTIMES, almul, almul},
398 {LASDIV, aldiv, aldiv},
399 {LASMOD, alrem, alrem},
401 {ASULSH, ashc, ashc},
404 {ASUDIV, udiv, udiv},
405 {ASUMOD, urem, urem},
406 {ULTIMES, slmul, slmul}, /* symmetry */
407 {ULDIV, uldiv, uldiv},
408 {ULMOD, ulrem, ulrem},
409 {ULASTIMES, almul, almul}, /* symmetry */
410 {ULASDIV, ualdiv, ualdiv},
411 {ULASMOD, ualrem, ualrem},
412 {ULTOF, ultof, ultof},
413 {ULLSHIFT, ulsh, ulsh},
414 {UASLSHL, ualsh, ualsh},
419 * Similar table for relationals.
420 * The first string is for the positive
421 * test, the second for the inverted one.
422 * The '200+' entries are
423 * used in tests against 0 where a 'tst'
424 * instruction is used; it clears the c-bit
425 * the c-bit so ptr tests are funny.
427 struct instab branchtab[] = {
434 {LESSEQP, jlos, jhi},
436 {GREATQP, jhis, jlo},
438 {200+EQUAL, jeq, jne},
439 {200+NEQUAL, jne, jeq},
440 {200+LESSEQ, jmijeq, jmijne},
441 {200+LESS, jmi, jpl},
442 {200+GREATEQ, jpl, jmi},
443 {200+GREAT, jmijne, jmijeq},
444 {200+LESSEQP, jeq, jne},
445 {200+LESSP, nop, jbr},
446 {200+GREATQP, jbr, nop},
447 {200+GREATP, jne, jeq},
452 int nerror; /* number of hard errors */
453 struct table lsptab[1];
460 int regpanic; /* set when SU register alg. fails */
461 int panicposs; /* set when there might be need for regpanic */
464 int xlab1, xlab2, xop, xzero;