| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
#include "pass2.h" |
| 64 |
|
| 65 |
#ifdef HAVE_STRINGS_H |
| 66 |
#include <strings.h> |
| 67 |
#endif |
| 68 |
|
| 69 |
void setclass(int tmp, int class); |
| 70 |
int getclass(int tmp); |
| 71 |
|
| 72 |
#ifdef PCC_DEBUG |
| 73 |
static char *srtyp[] = { "SRNOPE", "SRDIR", "SROREG", "SRREG" }; |
| 74 |
#endif |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
int |
| 85 |
tshape(NODE *p, int shape) |
| 86 |
{ |
| 87 |
int o, mask; |
| 88 |
|
| 89 |
o = p->n_op; |
| 90 |
|
| 91 |
#ifdef PCC_DEBUG |
| 92 |
if (s2debug) |
| 93 |
printf("tshape(%p, %s) op = %s\n", p, prcook(shape), opst[o]); |
| 94 |
#endif |
| 95 |
|
| 96 |
if (shape & SPECIAL) { |
| 97 |
|
| 98 |
switch (shape) { |
| 99 |
case SZERO: |
| 100 |
case SONE: |
| 101 |
case SMONE: |
| 102 |
case SSCON: |
| 103 |
case SCCON: |
| 104 |
if (o != ICON || p->n_name[0]) |
| 105 |
return SRNOPE; |
| 106 |
if (getlval(p)== 0 && shape == SZERO) |
| 107 |
return SRDIR; |
| 108 |
if (getlval(p) == 1 && shape == SONE) |
| 109 |
return SRDIR; |
| 110 |
if (getlval(p) == -1 && shape == SMONE) |
| 111 |
return SRDIR; |
| 112 |
if (getlval(p) > -257 && getlval(p) < 256 && |
| 113 |
shape == SCCON) |
| 114 |
return SRDIR; |
| 115 |
if (getlval(p) > -32769 && getlval(p) < 32768 && |
| 116 |
shape == SSCON) |
| 117 |
return SRDIR; |
| 118 |
return SRNOPE; |
| 119 |
|
| 120 |
case SSOREG: |
| 121 |
if (o == OREG && !R2TEST(p->n_rval)) |
| 122 |
return SRDIR; |
| 123 |
return SRNOPE; |
| 124 |
|
| 125 |
default: |
| 126 |
return (special(p, shape)); |
| 127 |
} |
| 128 |
} |
| 129 |
|
| 130 |
if (shape & SANY) |
| 131 |
return SRDIR; |
| 132 |
|
| 133 |
if ((shape&INTEMP) && shtemp(p)) |
| 134 |
return SRDIR; |
| 135 |
|
| 136 |
if ((shape&SWADD) && (o==NAME||o==OREG)) |
| 137 |
if (BYTEOFF(getlval(p))) |
| 138 |
return SRNOPE; |
| 139 |
|
| 140 |
switch (o) { |
| 141 |
|
| 142 |
case NAME: |
| 143 |
if (shape & SNAME) |
| 144 |
return SRDIR; |
| 145 |
break; |
| 146 |
|
| 147 |
case ICON: |
| 148 |
case FCON: |
| 149 |
if (shape & SCON) |
| 150 |
return SRDIR; |
| 151 |
break; |
| 152 |
|
| 153 |
case FLD: |
| 154 |
if (shape & SFLD) |
| 155 |
return flshape(p->n_left); |
| 156 |
break; |
| 157 |
|
| 158 |
case CCODES: |
| 159 |
if (shape & SCC) |
| 160 |
return SRDIR; |
| 161 |
break; |
| 162 |
|
| 163 |
case REG: |
| 164 |
case TEMP: |
| 165 |
mask = PCLASS(p); |
| 166 |
if (shape & mask) |
| 167 |
return SRDIR; |
| 168 |
break; |
| 169 |
|
| 170 |
case OREG: |
| 171 |
if (shape & SOREG) |
| 172 |
return SRDIR; |
| 173 |
break; |
| 174 |
|
| 175 |
case UMUL: |
| 176 |
#if 0 |
| 177 |
if (shumul(p->n_left) & shape) |
| 178 |
return SROREG; |
| 179 |
break; |
| 180 |
#else |
| 181 |
return shumul(p->n_left, shape); |
| 182 |
#endif |
| 183 |
|
| 184 |
} |
| 185 |
return SRNOPE; |
| 186 |
} |
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
int |
| 192 |
ttype(TWORD t, int tword) |
| 193 |
{ |
| 194 |
if (tword & TANY) |
| 195 |
return(1); |
| 196 |
|
| 197 |
#ifdef PCC_DEBUG |
| 198 |
if (t2debug) |
| 199 |
printf("ttype(0x%x, 0x%x)\n", t, tword); |
| 200 |
#endif |
| 201 |
if (ISPTR(t) && ISFTN(DECREF(t)) && (tword & TFTN)) { |
| 202 |
|
| 203 |
return 1; |
| 204 |
} |
| 205 |
if (ISPTR(t) && (tword&TPTRTO)) { |
| 206 |
do { |
| 207 |
t = DECREF(t); |
| 208 |
} while (ISARY(t)); |
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
return (ttype(t, tword&(~TPTRTO))); |
| 213 |
} |
| 214 |
if (t != BTYPE(t)) |
| 215 |
return (tword & TPOINT); |
| 216 |
if (tword & TPTRTO) |
| 217 |
return(0); |
| 218 |
|
| 219 |
switch (t) { |
| 220 |
case CHAR: |
| 221 |
return( tword & TCHAR ); |
| 222 |
case SHORT: |
| 223 |
return( tword & TSHORT ); |
| 224 |
case STRTY: |
| 225 |
case UNIONTY: |
| 226 |
return( tword & TSTRUCT ); |
| 227 |
case INT: |
| 228 |
return( tword & TINT ); |
| 229 |
case UNSIGNED: |
| 230 |
return( tword & TUNSIGNED ); |
| 231 |
case USHORT: |
| 232 |
return( tword & TUSHORT ); |
| 233 |
case UCHAR: |
| 234 |
return( tword & TUCHAR ); |
| 235 |
case ULONG: |
| 236 |
return( tword & TULONG ); |
| 237 |
case LONG: |
| 238 |
return( tword & TLONG ); |
| 239 |
case LONGLONG: |
| 240 |
return( tword & TLONGLONG ); |
| 241 |
case ULONGLONG: |
| 242 |
return( tword & TULONGLONG ); |
| 243 |
case FLOAT: |
| 244 |
return( tword & TFLOAT ); |
| 245 |
case DOUBLE: |
| 246 |
return( tword & TDOUBLE ); |
| 247 |
case LDOUBLE: |
| 248 |
return( tword & TLDOUBLE ); |
| 249 |
} |
| 250 |
|
| 251 |
return(0); |
| 252 |
} |
| 253 |
|
| 254 |
#define FLDSZ(x) UPKFSZ(x) |
| 255 |
#if TARGET_ENDIAN == TARGET_LE |
| 256 |
#define FLDSHF(x) UPKFOFF(x) |
| 257 |
#else |
| 258 |
#define FLDSHF(x) (SZINT - FLDSZ(x) - UPKFOFF(x)) |
| 259 |
#endif |
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
void |
| 265 |
expand(NODE *p, int cookie, char *cp) |
| 266 |
{ |
| 267 |
CONSZ val; |
| 268 |
|
| 269 |
#if 0 |
| 270 |
printf("expand\n"); |
| 271 |
fwalk(p, e2print, 0); |
| 272 |
#endif |
| 273 |
|
| 274 |
for( ; *cp; ++cp ){ |
| 275 |
switch( *cp ){ |
| 276 |
|
| 277 |
default: |
| 278 |
putchar(*cp); |
| 279 |
continue; |
| 280 |
|
| 281 |
case 'Z': |
| 282 |
zzzcode( p, *++cp ); |
| 283 |
continue; |
| 284 |
|
| 285 |
case 'F': |
| 286 |
if (cookie & FOREFF) { |
| 287 |
while (*cp && *cp != '\n') |
| 288 |
cp++; |
| 289 |
if (*cp == 0) |
| 290 |
return; |
| 291 |
} |
| 292 |
continue; |
| 293 |
|
| 294 |
case 'S': |
| 295 |
if (fldexpand(p, cookie, &cp)) |
| 296 |
continue; |
| 297 |
printf("%d", FLDSZ(p->n_rval)); |
| 298 |
continue; |
| 299 |
|
| 300 |
case 'H': |
| 301 |
if (fldexpand(p, cookie, &cp)) |
| 302 |
continue; |
| 303 |
printf("%d", FLDSHF(p->n_rval)); |
| 304 |
continue; |
| 305 |
|
| 306 |
case 'M': |
| 307 |
case 'N': |
| 308 |
if (fldexpand(p, cookie, &cp)) |
| 309 |
continue; |
| 310 |
val = 1; |
| 311 |
val <<= FLDSZ(p->n_rval); |
| 312 |
--val; |
| 313 |
val <<= FLDSHF(p->n_rval); |
| 314 |
adrcon( *cp=='M' ? val : ~val ); |
| 315 |
continue; |
| 316 |
|
| 317 |
case 'L': |
| 318 |
if (*++cp == 'C') |
| 319 |
printf(LABFMT, p->n_label); |
| 320 |
else |
| 321 |
printf(LABFMT, (int)getlval(getlr(p,*cp))); |
| 322 |
continue; |
| 323 |
|
| 324 |
case 'O': |
| 325 |
#ifdef FINDMOPS |
| 326 |
if (p->n_op == ASSIGN) |
| 327 |
hopcode(*++cp, p->n_right->n_op); |
| 328 |
else |
| 329 |
#endif |
| 330 |
hopcode( *++cp, p->n_op ); |
| 331 |
continue; |
| 332 |
|
| 333 |
case 'B': |
| 334 |
val = getlval(getlr(p,*++cp)); |
| 335 |
val = BYTEOFF(val); |
| 336 |
printf( CONFMT, val ); |
| 337 |
continue; |
| 338 |
|
| 339 |
case 'C': |
| 340 |
conput(stdout, getlr( p, *++cp ) ); |
| 341 |
continue; |
| 342 |
|
| 343 |
case 'I': |
| 344 |
insput( getlr( p, *++cp ) ); |
| 345 |
continue; |
| 346 |
|
| 347 |
case 'A': |
| 348 |
adrput(stdout, getlr( p, *++cp ) ); |
| 349 |
continue; |
| 350 |
|
| 351 |
case 'U': |
| 352 |
upput(getlr(p, *++cp), SZLONG); |
| 353 |
continue; |
| 354 |
|
| 355 |
} |
| 356 |
|
| 357 |
} |
| 358 |
|
| 359 |
} |
| 360 |
|
| 361 |
NODE resc[NRESC]; |
| 362 |
|
| 363 |
NODE * |
| 364 |
getlr(NODE *p, int c) |
| 365 |
{ |
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
switch (c) { |
| 370 |
|
| 371 |
case '1': |
| 372 |
case '2': |
| 373 |
case '3': |
| 374 |
case 'D': |
| 375 |
if (c == 'D') |
| 376 |
c = 0; |
| 377 |
else |
| 378 |
c -= '0'; |
| 379 |
if (resc[c].n_op == FREE) |
| 380 |
comperr("getlr: free node"); |
| 381 |
return &resc[c]; |
| 382 |
|
| 383 |
case 'L': |
| 384 |
return( optype( p->n_op ) == LTYPE ? p : p->n_left ); |
| 385 |
|
| 386 |
case 'R': |
| 387 |
return( optype( p->n_op ) != BITYPE ? p : p->n_right ); |
| 388 |
|
| 389 |
} |
| 390 |
cerror( "bad getlr: %c", c ); |
| 391 |
|
| 392 |
return NULL; |
| 393 |
} |
| 394 |
|
| 395 |
#ifdef PCC_DEBUG |
| 396 |
#define F2DEBUG(x) if (f2debug) printf x |
| 397 |
#define F2WALK(x) if (f2debug) fwalk(x, e2print, 0) |
| 398 |
#else |
| 399 |
#define F2DEBUG(x) |
| 400 |
#define F2WALK(x) |
| 401 |
#endif |
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
static int |
| 413 |
swmatch(NODE *p, int shape, int w) |
| 414 |
{ |
| 415 |
int rv = 0; |
| 416 |
|
| 417 |
F2DEBUG(("swmatch: p=%p, shape=%s, w=%s\n", p, prcook(shape), srtyp[w])); |
| 418 |
|
| 419 |
switch (w) { |
| 420 |
case SRREG: |
| 421 |
rv = geninsn(p, shape); |
| 422 |
break; |
| 423 |
|
| 424 |
case SROREG: |
| 425 |
|
| 426 |
if (p->n_op != UMUL && p->n_op != FLD) |
| 427 |
comperr("swmatch %p", p); |
| 428 |
if (p->n_op == FLD) { |
| 429 |
offstar(p->n_left->n_left, shape); |
| 430 |
p->n_left->n_su = 0; |
| 431 |
} else |
| 432 |
offstar(p->n_left, shape); |
| 433 |
p->n_su = 0; |
| 434 |
rv = ffs(shape)-1; |
| 435 |
break; |
| 436 |
|
| 437 |
case 0: |
| 438 |
if (optype(p->n_op) == BITYPE) |
| 439 |
swmatch(p->n_right, 0, 0); |
| 440 |
if (optype(p->n_op) != LTYPE) |
| 441 |
swmatch(p->n_left, 0, 0); |
| 442 |
p->n_su = 0; |
| 443 |
} |
| 444 |
return rv; |
| 445 |
|
| 446 |
} |
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
|
| 453 |
static int |
| 454 |
chcheck(NODE *p, int shape, int rew) |
| 455 |
{ |
| 456 |
int sh, sha; |
| 457 |
|
| 458 |
sha = shape; |
| 459 |
if (shape & SPECIAL) |
| 460 |
shape = 0; |
| 461 |
|
| 462 |
switch ((sh = tshape(p, sha))) { |
| 463 |
case SRNOPE: |
| 464 |
if (shape & INREGS) |
| 465 |
sh = SRREG; |
| 466 |
break; |
| 467 |
|
| 468 |
case SROREG: |
| 469 |
case SRDIR: |
| 470 |
if (rew == 0) |
| 471 |
break; |
| 472 |
if (shape & INREGS) |
| 473 |
sh = SRREG; |
| 474 |
else |
| 475 |
sh = SRNOPE; |
| 476 |
break; |
| 477 |
} |
| 478 |
return sh; |
| 479 |
} |
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
static int |
| 493 |
shswitch(int sh, NODE *p, int shape, int cookie, int rew, int go) |
| 494 |
{ |
| 495 |
int lsh; |
| 496 |
|
| 497 |
F2DEBUG(("shswitch: p=%p, shape=%s, ", p, prcook(shape))); |
| 498 |
F2DEBUG(("cookie=%s, rew=0x%x, go=%s\n", prcook(cookie), rew, srtyp[go])); |
| 499 |
|
| 500 |
switch (go) { |
| 501 |
case SRDIR: |
| 502 |
(void)swmatch(p, 0, 0); |
| 503 |
break; |
| 504 |
|
| 505 |
case SROREG: |
| 506 |
(void)swmatch(p, shape, SROREG); |
| 507 |
break; |
| 508 |
|
| 509 |
case SRREG: |
| 510 |
lsh = shape & (FORCC | INREGS); |
| 511 |
if (rew && cookie != FOREFF) |
| 512 |
lsh &= (cookie & (FORCC | INREGS)); |
| 513 |
lsh = swmatch(p, lsh, SRREG); |
| 514 |
if (rew) |
| 515 |
sh = lsh; |
| 516 |
break; |
| 517 |
} |
| 518 |
return sh; |
| 519 |
} |
| 520 |
|
| 521 |
#ifdef NEWNEED |
| 522 |
char * |
| 523 |
hasneed(char *w, int need) |
| 524 |
{ |
| 525 |
if (w) |
| 526 |
for (; *w; w += NEEDADD(*w)) { |
| 527 |
if (*w == need) |
| 528 |
return w; |
| 529 |
} |
| 530 |
return 0; |
| 531 |
} |
| 532 |
|
| 533 |
char * |
| 534 |
hasneed2(char *w, int need, int need2) |
| 535 |
{ |
| 536 |
if (w) |
| 537 |
for (; *w; w += NEEDADD(*w)) { |
| 538 |
if (*w == need && w[1] == need2) |
| 539 |
return w; |
| 540 |
} |
| 541 |
return 0; |
| 542 |
} |
| 543 |
#endif |
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
int |
| 555 |
findops(NODE *p, int cookie) |
| 556 |
{ |
| 557 |
extern int *qtable[]; |
| 558 |
struct optab *q, *qq = NULL; |
| 559 |
int i, shl, shr, *ixp, sh; |
| 560 |
int lvl = 10, idx = 0, gol = 0, gor = 0; |
| 561 |
NODE *l, *r; |
| 562 |
|
| 563 |
F2DEBUG(("findops node %p (%s)\n", p, prcook(cookie))); |
| 564 |
F2WALK(p); |
| 565 |
|
| 566 |
ixp = qtable[p->n_op]; |
| 567 |
l = getlr(p, 'L'); |
| 568 |
r = getlr(p, 'R'); |
| 569 |
for (i = 0; ixp[i] >= 0; i++) { |
| 570 |
q = &table[ixp[i]]; |
| 571 |
|
| 572 |
F2DEBUG(("findop: ixp %d str %s\n", ixp[i], q->cstring)); |
| 573 |
if (!acceptable(q)) |
| 574 |
continue; |
| 575 |
|
| 576 |
if (ttype(l->n_type, q->ltype) == 0 || |
| 577 |
ttype(r->n_type, q->rtype) == 0) |
| 578 |
continue; |
| 579 |
|
| 580 |
if ((cookie & q->visit) == 0) |
| 581 |
continue; |
| 582 |
|
| 583 |
F2DEBUG(("findop got types\n")); |
| 584 |
|
| 585 |
if ((shl = chcheck(l, q->lshape, q->rewrite & RLEFT)) == SRNOPE) |
| 586 |
continue; |
| 587 |
|
| 588 |
F2DEBUG(("findop lshape %s\n", srtyp[shl])); |
| 589 |
F2WALK(l); |
| 590 |
|
| 591 |
if ((shr = chcheck(r, q->rshape, q->rewrite & RRIGHT)) == SRNOPE) |
| 592 |
continue; |
| 593 |
|
| 594 |
F2DEBUG(("findop rshape %s\n", srtyp[shr])); |
| 595 |
F2WALK(r); |
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
if (xssa && (q->rewrite & RLEFT) == 0 && |
| 600 |
(q->lshape & (INREGS)) && shl == SRDIR) |
| 601 |
shl = SRREG; |
| 602 |
|
| 603 |
#ifdef NEWNEED |
| 604 |
if (hasneed(q->needs, cNREW) != 0) |
| 605 |
break; |
| 606 |
#else |
| 607 |
if (q->needs & REWRITE) |
| 608 |
break; |
| 609 |
#endif |
| 610 |
|
| 611 |
if (lvl <= (shl + shr)) |
| 612 |
continue; |
| 613 |
lvl = shl + shr; |
| 614 |
qq = q; |
| 615 |
idx = ixp[i]; |
| 616 |
gol = shl; |
| 617 |
gor = shr; |
| 618 |
} |
| 619 |
if (lvl == 10) { |
| 620 |
F2DEBUG(("findops failed\n")); |
| 621 |
if (setbin(p)) |
| 622 |
return FRETRY; |
| 623 |
return FFAIL; |
| 624 |
} |
| 625 |
|
| 626 |
F2DEBUG(("findops entry %d(%s,%s)\n", idx, srtyp[gol], srtyp[gor])); |
| 627 |
|
| 628 |
sh = -1; |
| 629 |
|
| 630 |
if (cookie == FORCC) |
| 631 |
cookie = INREGS; |
| 632 |
|
| 633 |
sh = shswitch(sh, p->n_left, qq->lshape, cookie, |
| 634 |
qq->rewrite & RLEFT, gol); |
| 635 |
sh = shswitch(sh, p->n_right, qq->rshape, cookie, |
| 636 |
qq->rewrite & RRIGHT, gor); |
| 637 |
|
| 638 |
if (sh == -1) { |
| 639 |
if (cookie == FOREFF || cookie == FORCC) |
| 640 |
sh = 0; |
| 641 |
else |
| 642 |
sh = ffs(cookie & qq->visit & INREGS)-1; |
| 643 |
} |
| 644 |
F2DEBUG(("findops: node %p sh %d (%s)\n", p, sh, prcook(1 << sh))); |
| 645 |
p->n_su = MKIDX(idx, 0); |
| 646 |
SCLASS(p->n_su, sh); |
| 647 |
return sh; |
| 648 |
} |
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
|
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
|
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
int |
| 669 |
relops(NODE *p) |
| 670 |
{ |
| 671 |
extern int *qtable[]; |
| 672 |
struct optab *q; |
| 673 |
int i, shl = 0, shr = 0, sh; |
| 674 |
NODE *l, *r; |
| 675 |
int *ixp, idx = 0; |
| 676 |
int lvl = 10, gol = 0, gor = 0; |
| 677 |
|
| 678 |
F2DEBUG(("relops tree:\n")); |
| 679 |
F2WALK(p); |
| 680 |
|
| 681 |
l = getlr(p, 'L'); |
| 682 |
r = getlr(p, 'R'); |
| 683 |
ixp = qtable[p->n_op]; |
| 684 |
for (i = 0; ixp[i] >= 0; i++) { |
| 685 |
q = &table[ixp[i]]; |
| 686 |
|
| 687 |
F2DEBUG(("relops: ixp %d\n", ixp[i])); |
| 688 |
if (!acceptable(q)) |
| 689 |
continue; |
| 690 |
|
| 691 |
if (ttype(l->n_type, q->ltype) == 0 || |
| 692 |
ttype(r->n_type, q->rtype) == 0) |
| 693 |
continue; |
| 694 |
|
| 695 |
F2DEBUG(("relops got types\n")); |
| 696 |
if ((shl = chcheck(l, q->lshape, 0)) == SRNOPE) |
| 697 |
continue; |
| 698 |
F2DEBUG(("relops lshape %d\n", shl)); |
| 699 |
F2WALK(p); |
| 700 |
if ((shr = chcheck(r, q->rshape, 0)) == SRNOPE) |
| 701 |
continue; |
| 702 |
F2DEBUG(("relops rshape %d\n", shr)); |
| 703 |
F2WALK(p); |
| 704 |
#ifdef NEWNEED |
| 705 |
if (hasneed(q->needs, cNREW) != 0) |
| 706 |
break; |
| 707 |
#else |
| 708 |
if (q->needs & REWRITE) |
| 709 |
break; |
| 710 |
#endif |
| 711 |
|
| 712 |
if (lvl <= (shl + shr)) |
| 713 |
continue; |
| 714 |
lvl = shl + shr; |
| 715 |
idx = ixp[i]; |
| 716 |
gol = shl; |
| 717 |
gor = shr; |
| 718 |
} |
| 719 |
if (lvl == 10) { |
| 720 |
F2DEBUG(("relops failed\n")); |
| 721 |
if (setbin(p)) |
| 722 |
return FRETRY; |
| 723 |
return FFAIL; |
| 724 |
} |
| 725 |
F2DEBUG(("relops entry %d(%s %s)\n", idx, srtyp[gol], srtyp[gor])); |
| 726 |
|
| 727 |
q = &table[idx]; |
| 728 |
|
| 729 |
(void)shswitch(-1, p->n_left, q->lshape, INREGS, |
| 730 |
q->rewrite & RLEFT, gol); |
| 731 |
|
| 732 |
(void)shswitch(-1, p->n_right, q->rshape, INREGS, |
| 733 |
q->rewrite & RRIGHT, gor); |
| 734 |
|
| 735 |
sh = 0; |
| 736 |
if (q->rewrite & RLEFT) |
| 737 |
sh = ffs(q->lshape & INREGS)-1; |
| 738 |
else if (q->rewrite & RRIGHT) |
| 739 |
sh = ffs(q->rshape & INREGS)-1; |
| 740 |
|
| 741 |
F2DEBUG(("relops: node %p\n", p)); |
| 742 |
p->n_su = MKIDX(idx, 0); |
| 743 |
SCLASS(p->n_su, sh); |
| 744 |
return 0; |
| 745 |
} |
| 746 |
|
| 747 |
|
| 748 |
|
| 749 |
|
| 750 |
|
| 751 |
|
| 752 |
|
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
|
| 757 |
|
| 758 |
|
| 759 |
|
| 760 |
int |
| 761 |
findasg(NODE *p, int cookie) |
| 762 |
{ |
| 763 |
extern int *qtable[]; |
| 764 |
struct optab *q; |
| 765 |
int i, sh, shl, shr, lvl = 10; |
| 766 |
NODE *l, *r; |
| 767 |
int *ixp; |
| 768 |
struct optab *qq = NULL; |
| 769 |
int idx = 0, gol = 0, gor = 0; |
| 770 |
|
| 771 |
shl = shr = 0; |
| 772 |
|
| 773 |
F2DEBUG(("findasg tree: %s\n", prcook(cookie))); |
| 774 |
F2WALK(p); |
| 775 |
|
| 776 |
ixp = qtable[p->n_op]; |
| 777 |
l = getlr(p, 'L'); |
| 778 |
r = getlr(p, 'R'); |
| 779 |
for (i = 0; ixp[i] >= 0; i++) { |
| 780 |
q = &table[ixp[i]]; |
| 781 |
|
| 782 |
F2DEBUG(("findasg: ixp %d\n", ixp[i])); |
| 783 |
if (!acceptable(q)) |
| 784 |
continue; |
| 785 |
|
| 786 |
if (ttype(l->n_type, q->ltype) == 0 || |
| 787 |
ttype(r->n_type, q->rtype) == 0) |
| 788 |
continue; |
| 789 |
|
| 790 |
if ((cookie & q->visit) == 0) |
| 791 |
continue; |
| 792 |
|
| 793 |
F2DEBUG(("findasg got types\n")); |
| 794 |
#ifdef mach_pdp11 |
| 795 |
if (p->n_op == STASG && ISPTR(l->n_type)) { |
| 796 |
|
| 797 |
|
| 798 |
if ((shl = chcheck(l, q->lshape, |
| 799 |
q->rewrite & RLEFT)) == SRNOPE) |
| 800 |
continue; |
| 801 |
} else |
| 802 |
#endif |
| 803 |
{ |
| 804 |
if ((shl = tshape(l, q->lshape)) == SRNOPE) |
| 805 |
continue; |
| 806 |
if (shl == SRREG) |
| 807 |
continue; |
| 808 |
} |
| 809 |
|
| 810 |
F2DEBUG(("findasg lshape %d\n", shl)); |
| 811 |
F2WALK(l); |
| 812 |
|
| 813 |
if ((shr = chcheck(r, q->rshape, q->rewrite & RRIGHT)) == SRNOPE) |
| 814 |
continue; |
| 815 |
|
| 816 |
F2DEBUG(("findasg rshape %d\n", shr)); |
| 817 |
F2WALK(r); |
| 818 |
#ifdef NEWNEED |
| 819 |
if (hasneed(q->needs, cNREW) != 0) |
| 820 |
break; |
| 821 |
#else |
| 822 |
if (q->needs & REWRITE) |
| 823 |
break; |
| 824 |
#endif |
| 825 |
|
| 826 |
if (lvl <= (shl + shr)) |
| 827 |
continue; |
| 828 |
|
| 829 |
lvl = shl + shr; |
| 830 |
qq = q; |
| 831 |
idx = ixp[i]; |
| 832 |
gol = shl; |
| 833 |
gor = shr; |
| 834 |
} |
| 835 |
|
| 836 |
if (lvl == 10) { |
| 837 |
F2DEBUG(("findasg failed\n")); |
| 838 |
if (setasg(p, cookie)) |
| 839 |
return FRETRY; |
| 840 |
return FFAIL; |
| 841 |
} |
| 842 |
F2DEBUG(("findasg entry %d(%s,%s)\n", idx, srtyp[gol], srtyp[gor])); |
| 843 |
|
| 844 |
sh = -1; |
| 845 |
sh = shswitch(sh, p->n_left, qq->lshape, cookie, |
| 846 |
qq->rewrite & RLEFT, gol); |
| 847 |
|
| 848 |
sh = shswitch(sh, p->n_right, qq->rshape, cookie, |
| 849 |
qq->rewrite & RRIGHT, gor); |
| 850 |
|
| 851 |
#ifdef mach_pdp11 |
| 852 |
lvl = 0; |
| 853 |
if (cookie == FOREFF) |
| 854 |
lvl = RVEFF, sh = 0; |
| 855 |
else if (cookie == FORCC) |
| 856 |
lvl = RVCC, sh = 0; |
| 857 |
else if (sh == -1) { |
| 858 |
sh = ffs(cookie & qq->visit & INREGS)-1; |
| 859 |
#ifdef PCC_DEBUG |
| 860 |
if (sh == -1) |
| 861 |
comperr("findasg bad shape"); |
| 862 |
#endif |
| 863 |
SCLASS(lvl,sh); |
| 864 |
} else |
| 865 |
SCLASS(lvl,sh); |
| 866 |
p->n_su = MKIDX(idx, lvl); |
| 867 |
#else |
| 868 |
if (sh == -1) { |
| 869 |
if (cookie == FOREFF) |
| 870 |
sh = 0; |
| 871 |
else |
| 872 |
sh = ffs(cookie & qq->visit & INREGS)-1; |
| 873 |
} |
| 874 |
F2DEBUG(("findasg: node %p class %d\n", p, sh)); |
| 875 |
|
| 876 |
p->n_su = MKIDX(idx, 0); |
| 877 |
SCLASS(p->n_su, sh); |
| 878 |
#endif |
| 879 |
#ifdef FINDMOPS |
| 880 |
p->n_su &= ~ISMOPS; |
| 881 |
#endif |
| 882 |
return sh; |
| 883 |
} |
| 884 |
|
| 885 |
|
| 886 |
|
| 887 |
|
| 888 |
|
| 889 |
int |
| 890 |
findumul(NODE *p, int cookie) |
| 891 |
{ |
| 892 |
extern int *qtable[]; |
| 893 |
struct optab *q = NULL; |
| 894 |
int i, shl = 0, shr = 0, sh; |
| 895 |
int *ixp; |
| 896 |
|
| 897 |
F2DEBUG(("findumul p %p (%s)\n", p, prcook(cookie))); |
| 898 |
F2WALK(p); |
| 899 |
|
| 900 |
ixp = qtable[p->n_op]; |
| 901 |
for (i = 0; ixp[i] >= 0; i++) { |
| 902 |
q = &table[ixp[i]]; |
| 903 |
|
| 904 |
F2DEBUG(("findumul: ixp %d\n", ixp[i])); |
| 905 |
if (!acceptable(q)) |
| 906 |
continue; |
| 907 |
|
| 908 |
if ((q->visit & cookie) == 0) |
| 909 |
continue; |
| 910 |
|
| 911 |
if (ttype(p->n_type, q->rtype) == 0) |
| 912 |
continue; |
| 913 |
|
| 914 |
|
| 915 |
F2DEBUG(("findumul got types, rshape %s\n", prcook(q->rshape))); |
| 916 |
|
| 917 |
|
| 918 |
|
| 919 |
|
| 920 |
|
| 921 |
if ((shl = chcheck(p, q->rshape, 0)) == SRNOPE) |
| 922 |
continue; |
| 923 |
|
| 924 |
shr = 0; |
| 925 |
|
| 926 |
#ifdef NEWNEED |
| 927 |
if (hasneed(q->needs, cNREW) != 0) |
| 928 |
break; |
| 929 |
#else |
| 930 |
if (q->needs & REWRITE) |
| 931 |
break; |
| 932 |
#endif |
| 933 |
|
| 934 |
F2DEBUG(("findumul got shape %s\n", srtyp[shl])); |
| 935 |
|
| 936 |
break; |
| 937 |
} |
| 938 |
if (ixp[i] < 0) { |
| 939 |
F2DEBUG(("findumul failed\n")); |
| 940 |
if (setuni(p, cookie)) |
| 941 |
return FRETRY; |
| 942 |
return FFAIL; |
| 943 |
} |
| 944 |
F2DEBUG(("findumul entry %d(%s %s)\n", ixp[i], srtyp[shl], srtyp[shr])); |
| 945 |
|
| 946 |
sh = shswitch(-1, p, q->rshape, cookie, q->rewrite & RLEFT, shl); |
| 947 |
if (sh == -1) |
| 948 |
sh = ffs(cookie & q->visit & INREGS)-1; |
| 949 |
|
| 950 |
F2DEBUG(("findumul: node %p (%s)\n", p, prcook(1 << sh))); |
| 951 |
p->n_su = MKIDX(ixp[i], 0); |
| 952 |
SCLASS(p->n_su, sh); |
| 953 |
F2WALK(p); |
| 954 |
return sh; |
| 955 |
} |
| 956 |
|
| 957 |
|
| 958 |
|
| 959 |
|
| 960 |
int |
| 961 |
findleaf(NODE *p, int cookie) |
| 962 |
{ |
| 963 |
extern int *qtable[]; |
| 964 |
struct optab *q = NULL; |
| 965 |
int i, sh; |
| 966 |
int *ixp; |
| 967 |
|
| 968 |
F2DEBUG(("findleaf p %p (%s)\n", p, prcook(cookie))); |
| 969 |
F2WALK(p); |
| 970 |
|
| 971 |
ixp = qtable[p->n_op]; |
| 972 |
for (i = 0; ixp[i] >= 0; i++) { |
| 973 |
q = &table[ixp[i]]; |
| 974 |
|
| 975 |
F2DEBUG(("findleaf: ixp %d\n", ixp[i])); |
| 976 |
if (!acceptable(q)) |
| 977 |
continue; |
| 978 |
if ((q->visit & cookie) == 0) |
| 979 |
continue; |
| 980 |
|
| 981 |
if (ttype(p->n_type, q->rtype) == 0 || |
| 982 |
ttype(p->n_type, q->ltype) == 0) |
| 983 |
continue; |
| 984 |
|
| 985 |
F2DEBUG(("findleaf got types, rshape %s\n", prcook(q->rshape))); |
| 986 |
|
| 987 |
if (chcheck(p, q->rshape, 0) != SRDIR) |
| 988 |
continue; |
| 989 |
|
| 990 |
#ifdef NEWNEED |
| 991 |
if (hasneed(q->needs, cNREW) != 0) |
| 992 |
break; |
| 993 |
#else |
| 994 |
if (q->needs & REWRITE) |
| 995 |
break; |
| 996 |
#endif |
| 997 |
|
| 998 |
break; |
| 999 |
} |
| 1000 |
if (ixp[i] < 0) { |
| 1001 |
F2DEBUG(("findleaf failed\n")); |
| 1002 |
if (setuni(p, cookie)) |
| 1003 |
return FRETRY; |
| 1004 |
return FFAIL; |
| 1005 |
} |
| 1006 |
F2DEBUG(("findleaf entry %d\n", ixp[i])); |
| 1007 |
|
| 1008 |
sh = ffs(cookie & q->visit & INREGS)-1; |
| 1009 |
F2DEBUG(("findleaf: node %p (%s)\n", p, prcook(1 << sh))); |
| 1010 |
p->n_su = MKIDX(ixp[i], 0); |
| 1011 |
SCLASS(p->n_su, sh); |
| 1012 |
return sh; |
| 1013 |
} |
| 1014 |
|
| 1015 |
|
| 1016 |
|
| 1017 |
|
| 1018 |
|
| 1019 |
|
| 1020 |
|
| 1021 |
int |
| 1022 |
finduni(NODE *p, int cookie) |
| 1023 |
{ |
| 1024 |
extern int *qtable[]; |
| 1025 |
struct optab *q; |
| 1026 |
NODE *l, *r; |
| 1027 |
int i, shl = 0, num = 4; |
| 1028 |
int *ixp, idx = 0; |
| 1029 |
int sh; |
| 1030 |
|
| 1031 |
F2DEBUG(("finduni tree: %s\n", prcook(cookie))); |
| 1032 |
F2WALK(p); |
| 1033 |
|
| 1034 |
l = getlr(p, 'L'); |
| 1035 |
if (p->n_op == CALL || p->n_op == FORTCALL || p->n_op == STCALL) |
| 1036 |
r = p; |
| 1037 |
else |
| 1038 |
r = getlr(p, 'R'); |
| 1039 |
ixp = qtable[p->n_op]; |
| 1040 |
for (i = 0; ixp[i] >= 0; i++) { |
| 1041 |
q = &table[ixp[i]]; |
| 1042 |
|
| 1043 |
F2DEBUG(("finduni: ixp %d\n", ixp[i])); |
| 1044 |
if (!acceptable(q)) |
| 1045 |
continue; |
| 1046 |
|
| 1047 |
if (ttype(l->n_type, q->ltype) == 0) |
| 1048 |
continue; |
| 1049 |
|
| 1050 |
F2DEBUG(("finduni got left type\n")); |
| 1051 |
if (ttype(r->n_type, q->rtype) == 0) |
| 1052 |
continue; |
| 1053 |
|
| 1054 |
F2DEBUG(("finduni got types\n")); |
| 1055 |
if ((shl = chcheck(l, q->lshape, q->rewrite & RLEFT)) == SRNOPE) |
| 1056 |
continue; |
| 1057 |
|
| 1058 |
F2DEBUG(("finduni got shapes %d\n", shl)); |
| 1059 |
|
| 1060 |
if ((cookie & q->visit) == 0) |
| 1061 |
continue; |
| 1062 |
|
| 1063 |
|
| 1064 |
|
| 1065 |
if ((q->rewrite & RLEFT) && (shl == SRDIR) ) |
| 1066 |
shl = SRREG; |
| 1067 |
|
| 1068 |
F2DEBUG(("finduni got cookie\n")); |
| 1069 |
#ifdef NEWNEED |
| 1070 |
if (hasneed(q->needs, cNREW) != 0) |
| 1071 |
break; |
| 1072 |
#else |
| 1073 |
if (q->needs & REWRITE) |
| 1074 |
break; |
| 1075 |
#endif |
| 1076 |
|
| 1077 |
if (shl >= num) |
| 1078 |
continue; |
| 1079 |
num = shl; |
| 1080 |
idx = ixp[i]; |
| 1081 |
|
| 1082 |
if (shl == SRDIR) |
| 1083 |
break; |
| 1084 |
} |
| 1085 |
|
| 1086 |
if (num == 4) { |
| 1087 |
F2DEBUG(("finduni failed\n")); |
| 1088 |
} else |
| 1089 |
F2DEBUG(("finduni entry %d(%s)\n", idx, srtyp[num])); |
| 1090 |
|
| 1091 |
if (num == 4) { |
| 1092 |
if (setuni(p, cookie)) |
| 1093 |
return FRETRY; |
| 1094 |
return FFAIL; |
| 1095 |
} |
| 1096 |
q = &table[idx]; |
| 1097 |
|
| 1098 |
sh = shswitch(-1, p->n_left, q->lshape, cookie, |
| 1099 |
q->rewrite & RLEFT, num); |
| 1100 |
if (sh == -1) |
| 1101 |
sh = ffs(cookie & q->visit & INREGS)-1; |
| 1102 |
if (sh == -1) |
| 1103 |
sh = 0; |
| 1104 |
|
| 1105 |
F2DEBUG(("finduni: node %p (%s)\n", p, prcook(1 << sh))); |
| 1106 |
p->n_su = MKIDX(idx, 0); |
| 1107 |
SCLASS(p->n_su, sh); |
| 1108 |
return sh; |
| 1109 |
} |
| 1110 |
|
| 1111 |
#ifdef FINDMOPS |
| 1112 |
|
| 1113 |
|
| 1114 |
|
| 1115 |
|
| 1116 |
|
| 1117 |
|
| 1118 |
|
| 1119 |
|
| 1120 |
|
| 1121 |
|
| 1122 |
|
| 1123 |
|
| 1124 |
|
| 1125 |
|
| 1126 |
int |
| 1127 |
findmops(NODE *p, int cookie) |
| 1128 |
{ |
| 1129 |
extern int *qtable[]; |
| 1130 |
struct optab *q; |
| 1131 |
int i, sh, shl, shr, lvl = 10; |
| 1132 |
NODE *l, *r; |
| 1133 |
int *ixp; |
| 1134 |
struct optab *qq = NULL; |
| 1135 |
int idx = 0, gol = 0, gor = 0; |
| 1136 |
|
| 1137 |
shl = shr = 0; |
| 1138 |
|
| 1139 |
F2DEBUG(("findmops tree: %s\n", prcook(cookie))); |
| 1140 |
F2WALK(p); |
| 1141 |
|
| 1142 |
l = getlr(p, 'L'); |
| 1143 |
r = getlr(p, 'R'); |
| 1144 |
|
| 1145 |
|
| 1146 |
if (optype(r->n_op) != BITYPE || treecmp(l, r->n_left) == 0) |
| 1147 |
return FFAIL; |
| 1148 |
|
| 1149 |
F2DEBUG(("findmops is useable\n")); |
| 1150 |
|
| 1151 |
|
| 1152 |
ixp = qtable[r->n_op]; |
| 1153 |
l = getlr(r, 'L'); |
| 1154 |
r = getlr(r, 'R'); |
| 1155 |
|
| 1156 |
for (i = 0; ixp[i] >= 0; i++) { |
| 1157 |
q = &table[ixp[i]]; |
| 1158 |
|
| 1159 |
F2DEBUG(("findmops: ixp %d\n", ixp[i])); |
| 1160 |
if (!acceptable(q)) |
| 1161 |
continue; |
| 1162 |
|
| 1163 |
if (ttype(l->n_type, q->ltype) == 0 || |
| 1164 |
ttype(r->n_type, q->rtype) == 0) |
| 1165 |
continue; |
| 1166 |
|
| 1167 |
F2DEBUG(("findmops got types\n")); |
| 1168 |
|
| 1169 |
switch (cookie) { |
| 1170 |
case FOREFF: |
| 1171 |
if ((q->visit & FOREFF) == 0) |
| 1172 |
continue; |
| 1173 |
break; |
| 1174 |
case FORCC: |
| 1175 |
if ((q->visit & FORCC) == 0) |
| 1176 |
continue; |
| 1177 |
break; |
| 1178 |
default: |
| 1179 |
if ((cookie & q->visit) == 0) |
| 1180 |
continue; |
| 1181 |
if (((cookie & INREGS & q->lshape) == 0) || !isreg(l)) |
| 1182 |
continue; |
| 1183 |
break; |
| 1184 |
} |
| 1185 |
F2DEBUG(("findmops cookie\n")); |
| 1186 |
|
| 1187 |
|
| 1188 |
|
| 1189 |
|
| 1190 |
if ((shl = tshape(l, q->lshape)) != SRDIR && (shl != SROREG)) |
| 1191 |
continue; |
| 1192 |
|
| 1193 |
F2DEBUG(("findmops lshape %s\n", srtyp[shl])); |
| 1194 |
F2WALK(l); |
| 1195 |
|
| 1196 |
if ((shr = chcheck(r, q->rshape, 0)) == SRNOPE) |
| 1197 |
continue; |
| 1198 |
|
| 1199 |
F2DEBUG(("findmops rshape %s\n", srtyp[shr])); |
| 1200 |
|
| 1201 |
|
| 1202 |
|
| 1203 |
|
| 1204 |
if ((q->rewrite & (RLEFT|RRIGHT)) != RLEFT) |
| 1205 |
continue; |
| 1206 |
|
| 1207 |
F2DEBUG(("rewrite OK\n")); |
| 1208 |
|
| 1209 |
F2WALK(r); |
| 1210 |
#ifdef NEWNEED |
| 1211 |
if (hasneed(q->needs, cNREW) != 0) |
| 1212 |
break; |
| 1213 |
#else |
| 1214 |
if (q->needs & REWRITE) |
| 1215 |
break; |
| 1216 |
#endif |
| 1217 |
|
| 1218 |
if (lvl <= (shl + shr)) |
| 1219 |
continue; |
| 1220 |
|
| 1221 |
lvl = shl + shr; |
| 1222 |
qq = q; |
| 1223 |
idx = ixp[i]; |
| 1224 |
gol = shl; |
| 1225 |
gor = shr; |
| 1226 |
} |
| 1227 |
|
| 1228 |
if (lvl == 10) |
| 1229 |
return FFAIL; |
| 1230 |
F2DEBUG(("findmops entry %d(%s,%s)\n", idx, srtyp[gol], srtyp[gor])); |
| 1231 |
|
| 1232 |
|
| 1233 |
|
| 1234 |
|
| 1235 |
|
| 1236 |
|
| 1237 |
sh = -1; |
| 1238 |
sh = shswitch(sh, p->n_left, qq->lshape, cookie, |
| 1239 |
qq->rewrite & RLEFT, gol); |
| 1240 |
sh = shswitch(sh, r, qq->rshape, cookie, 0, gor); |
| 1241 |
|
| 1242 |
if (sh == -1) { |
| 1243 |
if (cookie & (FOREFF|FORCC)) |
| 1244 |
sh = 0; |
| 1245 |
else |
| 1246 |
sh = ffs(cookie & qq->visit & INREGS)-1; |
| 1247 |
} |
| 1248 |
F2DEBUG(("findmops done: node %p class %d\n", p, sh)); |
| 1249 |
|
| 1250 |
|
| 1251 |
|
| 1252 |
p->n_su = MKIDX(idx, 0); |
| 1253 |
p->n_su |= ISMOPS; |
| 1254 |
SCLASS(p->n_su, sh); |
| 1255 |
|
| 1256 |
return sh; |
| 1257 |
} |
| 1258 |
|
| 1259 |
|
| 1260 |
|
| 1261 |
|
| 1262 |
int |
| 1263 |
treecmp(NODE *p1, NODE *p2) |
| 1264 |
{ |
| 1265 |
if (p1->n_op != p2->n_op) |
| 1266 |
return 0; |
| 1267 |
|
| 1268 |
switch (p1->n_op) { |
| 1269 |
case SCONV: |
| 1270 |
case UMUL: |
| 1271 |
return treecmp(p1->n_left, p2->n_left); |
| 1272 |
|
| 1273 |
case OREG: |
| 1274 |
if (getlval(p1) != getlval(p2) || p1->n_rval != p2->n_rval) |
| 1275 |
return 0; |
| 1276 |
break; |
| 1277 |
|
| 1278 |
case NAME: |
| 1279 |
case ICON: |
| 1280 |
if (strcmp(p1->n_name, p2->n_name)) |
| 1281 |
return 0; |
| 1282 |
|
| 1283 |
if (getlval(p1) != getlval(p2)) |
| 1284 |
return 0; |
| 1285 |
break; |
| 1286 |
|
| 1287 |
case TEMP: |
| 1288 |
#ifdef notyet |
| 1289 |
|
| 1290 |
|
| 1291 |
if (xssa) |
| 1292 |
break; |
| 1293 |
#endif |
| 1294 |
case REG: |
| 1295 |
if (p1->n_rval != p2->n_rval) |
| 1296 |
return 0; |
| 1297 |
break; |
| 1298 |
case LS: |
| 1299 |
case RS: |
| 1300 |
case PLUS: |
| 1301 |
case MINUS: |
| 1302 |
case MUL: |
| 1303 |
case DIV: |
| 1304 |
if (treecmp(p1->n_left, p2->n_left) == 0 || |
| 1305 |
treecmp(p1->n_right, p2->n_right) == 0) |
| 1306 |
return 0; |
| 1307 |
break; |
| 1308 |
|
| 1309 |
default: |
| 1310 |
return 0; |
| 1311 |
} |
| 1312 |
return 1; |
| 1313 |
} |
| 1314 |
#endif |