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

Defined variables

add defined in line 256; used 4 times
aldiv defined in line 280; used 2 times
  • in line 350(2)
almul defined in line 279; used 2 times
  • in line 349(2)
alrem defined in line 281; used 2 times
  • in line 351(2)
ash defined in line 263; used 4 times
ashc defined in line 275; used 8 times
asl defined in line 264; used 2 times
asr defined in line 262; used 2 times
bic defined in line 265; used 3 times
bic1 defined in line 266; used 3 times
bis defined in line 269; used 2 times
bis1 defined in line 270; used 2 times
bit defined in line 267; used 1 times
bit1 defined in line 268; used 1 times
branchtab defined in line 365; never used
clr defined in line 253; used 1 times
cmp defined in line 254; used 10 times
com defined in line 273; used 2 times
  • in line 341(2)
dec defined in line 259; used 4 times
div defined in line 261; used 10 times
inc defined in line 258; used 4 times
instab defined in line 300; never used
jbr defined in line 293; used 2 times
jeq defined in line 282; used 6 times
jge defined in line 287; used 4 times
jgt defined in line 285; used 4 times
jhi defined in line 289; used 2 times
jhis defined in line 291; used 2 times
jle defined in line 284; used 4 times
jlo defined in line 290; used 2 times
jlos defined in line 288; used 2 times
jlt defined in line 286; used 4 times
jne defined in line 283; used 6 times
mov defined in line 252; used 2 times
mul defined in line 260; used 4 times
neg defined in line 272; used 2 times
  • in line 340(2)
nop defined in line 292; used 2 times
opdope defined in line 9; never used
opntab defined in line 129; never used
sldiv defined in line 277; used 2 times
  • in line 347(2)
slmul defined in line 276; used 2 times
  • in line 346(2)
slrem defined in line 278; used 2 times
  • in line 348(2)
stdol defined in line 274; used 2 times
  • in line 342(2)
sub defined in line 257; used 4 times
tst defined in line 255; used 11 times
xor defined in line 271; used 4 times
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 984
Valid CSS Valid XHTML 1.0 Strict