1: /*
   2:  * C second pass -- tables
   3:  */
   4: 
   5: #if !defined(lint) && defined(DOSCCS)
   6: static  char    sccsid[] = "@(#)c13.c	2.1 (2.11BSD GTE) 10/4/94";
   7: #endif
   8: 
   9: #include "c1.h"
  10: /*
  11:  * Operator dope table-- see description in c0.
  12:  */
  13: int opdope[] = {
  14:     000000, /* EOFC (0) */
  15:     000000, /* ; */
  16:     000000, /* { */
  17:     000000, /* } */
  18:     036000, /* [ */
  19:     002000, /* ] */
  20:     036000, /* ( */
  21:     002000, /* ) */
  22:     014201, /* : */
  23:     007001, /* , */
  24:     000000, /* field selection (10) */
  25:     000000, /* reverse field selection */
  26:     000001, /* temporary field selection */
  27:     000001, /* int->ptr */
  28:     000001, /* ptr->int */
  29:     000001, /* long->ptr */
  30:     000001, /* field assignment */
  31:     000001, /* >> unsigned */
  32:     000001, /* >>= unsigned */
  33:     000000, /* keyword */
  34:     000400, /* name (20) */
  35:     000400, /* short constant */
  36:     000400, /* string */
  37:     000400, /* float */
  38:     000400, /* double */
  39:     000400, /* long const */
  40:     000400, /* long const <= 16 bits */
  41:     000400, /* autoi, *r++ */
  42:     000400, /* autod, *--r */
  43:     000400, /* () empty arglist */
  44:     034213, /* ++pre (30) */
  45:     034213, /* --pre */
  46:     034213, /* ++post */
  47:     034213, /* --post */
  48:     034220, /* !un */
  49:     034202, /* &un */
  50:     034220, /* *un */
  51:     034200, /* -un */
  52:     034220, /* ~un */
  53:     036001, /* . (structure reference) */
  54:     030101, /* + (40) */
  55:     030001, /* - */
  56:     032101, /* * */
  57:     032001, /* / */
  58:     032001, /* % */
  59:     026061, /* >> */
  60:     026061, /* << */
  61:     020161, /* & */
  62:     016161, /* | */
  63:     016161, /* ^ */
  64:     036001, /* -> (50) */
  65:     001000, /* int -> double */
  66:     001000, /* double -> int */
  67:     000001, /* && */
  68:     000001, /* || */
  69:     030001, /* &~ */
  70:     001000, /* double -> long */
  71:     001000, /* long -> double */
  72:     001000, /* integer -> long */
  73:     000000, /* long -> integer */
  74:     022005, /* == (60) */
  75:     022005, /* != */
  76:     024005, /* <= */
  77:     024005, /* < */
  78:     024005, /* >= */
  79:     024005, /* > */
  80:     024005, /* <p */
  81:     024005, /* <=p */
  82:     024005, /* >p */
  83:     024005, /* >=p */
  84:     012213, /* += (70) */
  85:     012213, /* -= */
  86:     012213, /* *= */
  87:     012213, /* /= */
  88:     012213, /* %= */
  89:     012253, /* >>= */
  90:     012253, /* <<= */
  91:     012253, /* &= */
  92:     012253, /* |= */
  93:     012253, /* ^= */
  94:     012213, /* = (80) */
  95:     030001, /* & for tests */
  96:     032001, /*  * (long) */
  97:     032001, /*  / (long) */
  98:     032001, /* % (long) */
  99:     012253, /* &= ~ */
 100:     012213, /* *= (long) */
 101:     012213, /* /= (long) */
 102:     012213, /* %= (long) */
 103:     000000, /* (89) */
 104:     014201, /* question '?' (90) */
 105:     026061, /* long << */
 106:     012253, /* long <<= */
 107:     000101, /* max */
 108:     000101, /* maxp */
 109:     000101, /* min */
 110:     000101, /* minp */
 111:     000001, /* , */
 112:     000000, /* call1 */
 113:     000000, /* call2 */
 114:     036001, /* call (100) */
 115:     036000, /* mcall */
 116:     000000, /* goto */
 117:     000000, /* jump cond */
 118:     000000, /* branch cond */
 119:     000400, /* set nregs */
 120:     000000, /* load */
 121:     030001, /* ptoi1 */
 122:     000000, /* (108) */
 123:     000000, /* int->char */
 124:     000000, /* force r0 (110) */
 125:     000000, /* branch */
 126:     000000, /* label */
 127:     000000, /* nlabel */
 128:     000000, /* rlabel */
 129:     000000, /* structure assign */
 130:     000001, /* struct assignment setup */
 131:     032001, /* unsigned / */
 132:     032001, /* unsigned % */
 133:     012213, /* unsigned /= */
 134:     012213, /* unsigned %= (120) */
 135:     032001, /* unsigned long * */
 136:     032001, /* unsigned long / */
 137:     032001, /* unsigned long % */
 138:     012213, /* unsigned long *= */
 139:     012213, /* unsigned long /= */
 140:     012213, /* unsigned long %= */
 141:     01000,  /* unsigned long -> float(double) */
 142:     026061, /* unsigned long >> */
 143:     012253, /* unsigned long >>= (129) */
 144: };
 145: 
 146: char    *opntab[] = {
 147:     0,          /* 0 */
 148:     0,
 149:     0,
 150:     0,
 151:     0,
 152:     0,
 153:     0,
 154:     0,
 155:     ":",
 156:     ",",
 157:     "field select",     /* 10 */
 158:     0,
 159:     0,
 160:     "int->ptr",
 161:     "ptr->int",
 162:     "long->ptr",
 163:     "field assign",
 164:     ">>",
 165:     ">>=",
 166:     "keyword",
 167:     "name",         /* 20 */
 168:     "short constant",
 169:     "string",
 170:     "float",
 171:     "double",
 172:     "long constant",
 173:     "long constant",
 174:     "*r++",
 175:     "*--r",
 176:     "()",
 177:     "++pre",        /* 30 */
 178:     "--pre",
 179:     "++post",
 180:     "--post",
 181:     "!un",
 182:     "&",
 183:     "*",
 184:     "-",
 185:     "~",
 186:     ".",
 187:     "+",            /* 40 */
 188:     "-",
 189:     "*",
 190:     "/",
 191:     "%",
 192:     ">>",
 193:     "<<",
 194:     "&",
 195:     "|",
 196:     "^",
 197:     "->",           /* 50 */
 198:     "int->double",
 199:     "double->int",
 200:     "&&",
 201:     "||",
 202:     "&~",
 203:     "double->long",
 204:     "long->double",
 205:     "integer->long",
 206:     "long->integer",
 207:     "==",           /* 60 */
 208:     "!=",
 209:     "<=",
 210:     "<",
 211:     ">=",
 212:     ">",
 213:     "<p",
 214:     "<=p",
 215:     ">p",
 216:     ">=p",
 217:     "+=",           /* 70 */
 218:     "-=",
 219:     "*=",
 220:     "/=",
 221:     "%=",
 222:     ">>=",
 223:     "<<=",
 224:     "&=",
 225:     "|=",
 226:     "^=",
 227:     "=",            /* 80 */
 228:     "& for tests",
 229:     "*",
 230:     "/",
 231:     "%",
 232:     "&= ~",
 233:     "*=",
 234:     "/=",
 235:     "%=",
 236:     0,
 237:     "?",            /* 90 */
 238:     "<<",
 239:     "<<=",
 240:     "\\/",
 241:     "\\/",
 242:     "/\\",
 243:     "/\\",
 244:     ",",
 245:     "call1",
 246:     "call2",
 247:     "call",         /* 100 */
 248:     "mcall",
 249:     "goto",
 250:     "jump cond",
 251:     "branch cond",
 252:     "set nregs",
 253:     "load value",
 254:     "ptr->integer",
 255:     0,
 256:     "int->char",
 257:     "force register",   /* 110 */
 258:     "branch",
 259:     "label",
 260:     "nlabel",
 261:     "rlabel",
 262:     "=structure",
 263:     "= (struct setup)",
 264:     "/",
 265:     "%",
 266:     "/=",
 267:     "%=",           /* 120 */
 268:     "*",            /* unsigned long */
 269:     "/",            /* unsigned long */
 270:     "%",            /* unsigned long */
 271:     "*=",           /* unsigned long */
 272:     "/=",           /* unsigned long */
 273:     "%=",           /* unsigned long */
 274:     "u_long->double",   /* unsigned long */
 275:     ">>",           /* unsigned long */
 276:     ">>=",          /* 129 unsigned long */
 277: };
 278: 
 279: /*
 280:  * Strings for instruction tables.
 281:  */
 282: char    mov[]   = "mov";
 283: char    clr[]   = "clr";
 284: char    cmp[]   = "cmp";
 285: char    tst[]   = "tst";
 286: char    add[]   = "add";
 287: char    sub[]   = "sub";
 288: char    inc[]   = "inc";
 289: char    dec[]   = "dec";
 290: char    mul[]   = "mul";
 291: char    div[]   = "div";
 292: char    asr[]   = "asr";
 293: char    ash[]   = "ash";
 294: char    asl[]   = "asl";
 295: char    bic[]   = "bic";
 296: char    bic1[]  = "bic $1,";
 297: char    bit[]   = "bit";
 298: char    bit1[]  = "bit $1,";
 299: char    bis[]   = "bis";
 300: char    bis1[]  = "bis $1,";
 301: char    xor[]   = "xor";
 302: char    neg[]   = "neg";
 303: char    com[]   = "com";
 304: char    stdol[] = "*$";
 305: char    ashc[]  = "ashc";
 306: char    slmul[] = "lmul";
 307: char    sldiv[] = "ldiv";
 308: char    slrem[] = "lrem";
 309: char    uldiv[] = "uldiv";
 310: char    ulrem[] = "ulrem";
 311: char    ualdiv[] = "ualdiv";
 312: char    ualrem[] = "ualrem";
 313: char    ultof[] = "ultof";
 314: char    ulsh[] = "ulsh";
 315: char    ualsh[] = "ualsh";
 316: char    almul[] = "almul";
 317: char    aldiv[] = "aldiv";
 318: char    alrem[] = "alrem";
 319: char    udiv[]  = "udiv";
 320: char    urem[]  = "urem";
 321: char    jeq[]   = "jeq";
 322: char    jne[]   = "jne";
 323: char    jle[]   = "jle";
 324: char    jgt[]   = "jgt";
 325: char    jlt[]   = "jlt";
 326: char    jge[]   = "jge";
 327: char    jlos[]  = "jlos";
 328: char    jhi[]   = "jhi";
 329: char    jlo[]   = "jlo";
 330: char    jhis[]  = "jhis";
 331: char    nop[]   = "/nop";
 332: char    jbr[]   = "jbr";
 333: char    jpl[] = "jpl";
 334: char    jmi[] = "jmi";
 335: char    jmijne[] = "jmi\tL%d\njne";
 336: char    jmijeq[] = "jmi\tL%d\njeq";
 337: 
 338: /*
 339:  * Instruction tables, accessed by
 340:  * I (first operand) or I' (second) macros.
 341:  */
 342: 
 343: struct instab instab[] = {
 344:     LOAD,   mov,    tst,
 345:     ASSIGN, mov,    clr,
 346:     EQUAL,  cmp,    tst,
 347:     NEQUAL, cmp,    tst,
 348:     LESSEQ, cmp,    tst,
 349:     LESS,   cmp,    tst,
 350:     GREATEQ,cmp,    tst,
 351:     GREAT,  cmp,    tst,
 352:     LESSEQP,cmp,    tst,
 353:     LESSP,  cmp,    tst,
 354:     GREATQP,cmp,    tst,
 355:     GREATP, cmp,    tst,
 356:     PLUS,   add,    inc,
 357:     ASPLUS, add,    inc,
 358:     MINUS,  sub,    dec,
 359:     ASMINUS,sub,    dec,
 360:     INCBEF, add,    inc,
 361:     DECBEF, sub,    dec,
 362:     INCAFT, add,    inc,
 363:     DECAFT, sub,    dec,
 364:     TIMES,  mul,    mul,
 365:     ASTIMES,mul,    mul,
 366:     DIVIDE, div,    div,
 367:     ASDIV,  div,    div,
 368:     MOD,    div,    div,
 369:     ASMOD,  div,    div,
 370:     PTOI,   div,    div,
 371:     RSHIFT, ash,    asr,
 372:     ASRSH,  ash,    asr,
 373:     LSHIFT, ash,    asl,
 374:     ASLSH,  ash,    asl,
 375:     AND,    bic,    bic1,
 376:     ANDN,   bic,    bic1,
 377:     ASANDN, bic,    bic1,
 378:     TAND,   bit,    bit1,
 379:     OR, bis,    bis1,
 380:     ASOR,   bis,    bis1,
 381:     EXOR,   xor,    xor,
 382:     ASXOR,  xor,    xor,
 383:     NEG,    neg,    neg,
 384:     COMPL,  com,    com,
 385:     CALL1,  stdol,  stdol,
 386:     CALL2,  "", "",
 387:     LLSHIFT,ashc,   ashc,
 388:     ASLSHL, ashc,   ashc,
 389:     LTIMES, slmul,  slmul,
 390:     LDIV,   sldiv,  sldiv,
 391:     LMOD,   slrem,  slrem,
 392:     LASTIMES,almul, almul,
 393:     LASDIV, aldiv,  aldiv,
 394:     LASMOD, alrem,  alrem,
 395:     ULSH,   ashc,   ashc,
 396:     ASULSH, ashc,   ashc,
 397:     UDIV,   udiv,   udiv,
 398:     UMOD,   urem,   urem,
 399:     ASUDIV, udiv,   udiv,
 400:     ASUMOD, urem,   urem,
 401:     ULTIMES,slmul,  slmul,      /* symmetry */
 402:     ULDIV,  uldiv,  uldiv,
 403:     ULMOD,  ulrem,  ulrem,
 404:     ULASTIMES,almul,almul,      /* symmetry */
 405:     ULASDIV,ualdiv, ualdiv,
 406:     ULASMOD,ualrem, ualrem,
 407:     ULTOF,  ultof,  ultof,
 408:     ULLSHIFT, ulsh, ulsh,
 409:     UASLSHL, ualsh, ualsh,
 410:     0,  0,  0};
 411: 
 412: /*
 413:  * Similar table for relationals.
 414:  * The first string is for the positive
 415:  * test, the second for the inverted one.
 416:  * The '200+' entries are
 417:  * used in tests against 0 where a 'tst'
 418:  * instruction is used; it clears the c-bit
 419:  * the c-bit so ptr tests are funny.
 420:  */
 421: struct instab branchtab[] = {
 422:     EQUAL,  jeq,    jne,
 423:     NEQUAL, jne,    jeq,
 424:     LESSEQ, jle,    jgt,
 425:     LESS,   jlt,    jge,
 426:     GREATEQ,jge,    jlt,
 427:     GREAT,  jgt,    jle,
 428:     LESSEQP,jlos,   jhi,
 429:     LESSP,  jlo,    jhis,
 430:     GREATQP,jhis,   jlo,
 431:     GREATP, jhi,    jlos,
 432:     200+EQUAL,  jeq,    jne,
 433:     200+NEQUAL, jne,    jeq,
 434:     200+LESSEQ, jmijeq, jmijne,
 435:     200+LESS,   jmi,    jpl,
 436:     200+GREATEQ,    jpl,    jmi,
 437:     200+GREAT,  jmijne, jmijeq,
 438:     200+LESSEQP,    jeq,    jne,
 439:     200+LESSP,  nop,    jbr,
 440:     200+GREATQP,    jbr,    nop,
 441:     200+GREATP, jne,    jeq,
 442:     0,  0,  0 };

Defined variables

add defined in line 286; used 4 times
aldiv defined in line 317; used 2 times
  • in line 393(2)
almul defined in line 316; used 4 times
alrem defined in line 318; used 2 times
  • in line 394(2)
ash defined in line 293; used 4 times
ashc defined in line 305; used 8 times
asl defined in line 294; used 2 times
asr defined in line 292; used 2 times
bic defined in line 295; used 3 times
bic1 defined in line 296; used 3 times
bis defined in line 299; used 2 times
bis1 defined in line 300; used 2 times
bit defined in line 297; used 1 times
bit1 defined in line 298; used 1 times
branchtab defined in line 421; never used
clr defined in line 283; used 1 times
cmp defined in line 284; used 10 times
com defined in line 303; used 2 times
  • in line 384(2)
dec defined in line 289; used 4 times
div defined in line 291; used 10 times
inc defined in line 288; used 4 times
instab defined in line 343; never used
jbr defined in line 332; used 2 times
jeq defined in line 321; used 6 times
jge defined in line 326; used 2 times
jgt defined in line 324; used 2 times
jhi defined in line 328; used 2 times
jhis defined in line 330; used 2 times
jle defined in line 323; used 2 times
jlo defined in line 329; used 2 times
jlos defined in line 327; used 2 times
jlt defined in line 325; used 2 times
jmi defined in line 334; used 2 times
jmijeq defined in line 336; used 2 times
jmijne defined in line 335; used 2 times
jne defined in line 322; used 6 times
jpl defined in line 333; used 2 times
mov defined in line 282; used 2 times
mul defined in line 290; used 4 times
neg defined in line 302; used 2 times
  • in line 383(2)
nop defined in line 331; used 2 times
opdope defined in line 13; never used
opntab defined in line 146; never used
sccsid defined in line 6; never used
sldiv defined in line 307; used 2 times
  • in line 390(2)
slmul defined in line 306; used 4 times
slrem defined in line 308; used 2 times
  • in line 391(2)
stdol defined in line 304; used 2 times
  • in line 385(2)
sub defined in line 287; used 4 times
tst defined in line 285; used 11 times
ualdiv defined in line 311; used 2 times
  • in line 405(2)
ualrem defined in line 312; used 2 times
  • in line 406(2)
ualsh defined in line 315; used 2 times
  • in line 409(2)
udiv defined in line 319; used 4 times
uldiv defined in line 309; used 2 times
  • in line 402(2)
ulrem defined in line 310; used 2 times
  • in line 403(2)
ulsh defined in line 314; used 2 times
  • in line 408(2)
ultof defined in line 313; used 2 times
  • in line 407(2)
urem defined in line 320; used 4 times
xor defined in line 301; used 4 times
Last modified: 1994-10-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3237
Valid CSS Valid XHTML 1.0 Strict