Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.62
 
1.63
 
MAIN:ragge:20030909194158
 
reader.c
_>6161 void cvtemps(struct interpass *epil);
 6262 static int findops(NODE *p);
 6363 static int relops(NODE *p);
<> 64+static int asgops(NODE *p, int);
6465 
<> 66+#define LTMP    1
  67+#define RTMP    2
  68+
6569 #define DELAYS 20
 6670 NODE *deltrees[DELAYS];
 6771 int deli;
     
 !
327331 
 328332         switch (m = p->n_op) {
 329333 
<> 334+        case ASSIGN:
  335+                /*
  336+                 * For ASSIGN the left node must be directly addressable,
  337+                 * the right can be put into a register.
  338+                 * XXX - Will not try to match any smart instructions yet.
  339+                 */
  340+printf("foo\n");
  341+fwalk(p, e2print, 0);
  342+                if (!canaddr(p->n_left)) {
  343+                        if (p->n_left->n_op == UNARY MUL) {
  344+                                offstar(p->n_left->n_left);
  345+                                goto again;
  346+                        }
  347+                        cerror("bad assign lvalue");
  348+                }
  349+printf("foo1\n");
  350+fwalk(p, e2print, 0);
  351+                if (!canaddr(p->n_right)) {
  352+                        if (p->n_right->n_op == UNARY MUL) {
  353+                                offstar(p->n_right->n_left);
  354+                                goto again;
  355+                        }
  356+                        order(p->n_right, INTAREG|INTBREG);
  357+                }
  358+printf("foo2\n");
  359+fwalk(p, e2print, 0);
  360+                rv = asgops(p, cook);
  361+                if (rv < 0)
  362+                        goto nomat;
  363+                if (rv & RTMP)
  364+                        order(p->n_right, INTAREG|INTBREG);
  365+                q = &table[rv >> 2];
  366+printf("foo7\n");
  367+                if (!allo(p, q))
  368+                        cerror("assign allo failed");
  369+printf("foo3\n");
  370+                expand(p, cook, q->cstring);
  371+                reclaim(p, q->rewrite, cook);
  372+printf("foo4\n");
  373+fwalk(p, e2print, 0);
  374+                goto cleanup;
  375+                
330376         case PLUS:
 331377         case MINUS:
 332378         case AND:
     
 !
362408                 /*
 363409                  *
 364410                  */
<>365 -#define LTMP    1
 366 -#define RTMP    2
367411                 m = INTAREG|INTBREG;
 368412                 rv = findops(p);
 369413 foo:            if (rv < 0) {
     
 !
13661410 if (f2debug) { if (rv == -1) printf("relops failed\n"); else printf("relops entry %d, %s %s\n", rv >> 2, rv & RTMP ? "RTMP" : "", rv & LTMP ? "LTMP" : ""); }
 13671411         return rv;
 13681412 }
<_ 1413+
  1414+/*
  1415+ * Find a matching assign op.
  1416+ */
  1417+int
  1418+asgops(NODE *p, int cookie)
  1419+{
  1420+        extern int *qtable[];
  1421+        struct optab *q;
  1422+        int i, shl, shr, rsr;
  1423+        NODE *l, *r;
  1424+        int *ixp;
  1425+        int rv = -1;
  1426+
  1427+if (f2debug) printf("asgops tree: ");
  1428+if (f2debug) prcook(cookie);
  1429+if (f2debug) printf("\n");
  1430+if (f2debug) fwalk(p, e2print, 0);
  1431+
  1432+        ixp = qtable[p->n_op];
  1433+        for (i = 0; ixp[i] >= 0; i++) {
  1434+                q = &table[ixp[i]];
  1435+
  1436+if (f2debug) printf("asgop: ixp %d\n", ixp[i]);
  1437+                l = getlr(p, 'L');
  1438+                r = getlr(p, 'R');
  1439+                if (ttype(l->n_type, q->ltype) == 0 ||
  1440+                    ttype(r->n_type, q->rtype) == 0)
  1441+                        continue; /* Types must be correct */
  1442+
  1443+                if ((cookie & (INTAREG|INTBREG)) &&
  1444+                    (q->rewrite & (RLEFT|RRIGHT)) == 0)
  1445+                        continue; /* must get a result somehere */
  1446+
  1447+if (f2debug) printf("asgop got types\n");
  1448+                shl = tshape(l, q->lshape);
  1449+                if (shl == 0)
  1450+                        continue; /* left shape must always match */
  1451+if (f2debug) printf("asgop lshape %d\n", shl);
  1452+if (f2debug) fwalk(l, e2print, 0);
  1453+                shr = tshape(r, q->rshape);
  1454+                rsr = (q->rshape & (SAREG|STAREG)) != 0;
  1455+                if (shr == 0 && rsr == 0)
  1456+                        continue; /* useless */
  1457+if (f2debug) printf("asgop rshape %d\n", shr);
  1458+if (f2debug) fwalk(r, e2print, 0);
  1459+                if (q->needs & REWRITE)
  1460+                        break;  /* Done here */
  1461+
  1462+                if (shl && shr) {
  1463+                        /*
  1464+                         * Both shapes matches.
  1465+                         * Ideal situation, encode and be done with it.
  1466+                         */
  1467+                        return ixp[i] << 2;
  1468+                }
  1469+if (f2debug) printf("second\n");
  1470+                if (shl) {
  1471+                        /*
  1472+                         * Left shape matched. Right node must be put into
  1473+                         * a temporary register.
  1474+                         */
  1475+                        return (ixp[i] << 2) | RTMP;
  1476+                }
  1477+        }
  1478+if (f2debug) { if (rv == -1) printf("asgops failed\n"); else printf("asgops entry %d, %s %s\n", rv >> 2, rv & RTMP ? "RTMP" : "", rv & LTMP ? "LTMP" : ""); }
  1479+        return rv;
  1480+}
FishEye: Open Source License registered to PCC.
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-12-22 18:43 +0100