Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.237
 
1.238
 
MAIN:ragge:20140607140204
 
regs.c
_>295295                 }
 296296                 if (setorder(p) == 0) {
 297297                         /* XXX - should take care of overlapping needs */
 298298                         if (right > left) {
 299299                                 p->n_su |= DORIGHT;
 300300                         } else if (right == left) {
<> 301+#if 0
  302+        /* XXX - need something more clever when large left trees */
301303                                 /* A favor to 2-operand architectures */
 302304                                 if ((q->rewrite & RRIGHT) == 0)
 303305                                         p->n_su |= DORIGHT;
<> 306+#endif
304307                         }
 305308                 }
 306309         } else if (o != LTYPE) {
 307310                 /* One child */
 308311                 need = MAX(right, left) + nreg;
 309312         } else
     
 !
24502453                 }
 24512454                 storemod(p, w->r_color);
 24522455                 break;
 24532456         }
 24542457 }
 24552458 
<> 2459+/*
  2460+ * Check if this node is just something directly addressable.
  2461+ * XXX - should use target canaddr() when we knows that it is OK
  2462+ * for all targets. Can currently be a little too optimistic.
  2463+ */
  2464+static int
  2465+regcanaddr(NODE *p)
  2466+{
  2467+        int o = p->n_op;
  2468+
  2469+        if (o==NAME || o==ICON || o==OREG )
  2470+                return 1;
  2471+        if (o == UMUL) {
  2472+                if (p->n_left->n_op == REG)
  2473+                        return 1;
  2474+                if ((p->n_left->n_op == PLUS || p->n_left->n_op == MINUS) &&
  2475+                    p->n_left->n_left->n_op == REG &&
  2476+                    p->n_left->n_right->n_op == ICON)
  2477+                        return 1;
  2478+        }
  2479+        return 0;
  2480+}
  2481+
24562482 static struct interpass *cip;
 24572483 /*
 24582484  * Rewrite a tree by storing a variable in memory.
 24592485  * XXX - must check if basic block structure is destroyed!
 24602486  */
 24612487 static void
     
 !
24682494         int off;
 24692495 
 24702496         /* XXX - optimize this somewhat */
 24712497         DLIST_FOREACH(w, spole, link) {
 24722498                 if (w != p->n_regw)
 24732499                         continue;
<>2474 -                /* XXX - use canaddr() */
 2475 -                if (p->n_op == OREG || p->n_op == NAME) {
  2500+                if (regcanaddr(p)) {
24762501                         DLIST_REMOVE(w, link);
 24772502 #ifdef PCC_DEBUG
 24782503                         RDEBUG(("Node %d already in memory\n", ASGNUM(w)));
 24792504 #endif
 24802505                         break;
 24812506                 }
     
 !
24862511                 off = freetemp(szty(p->n_type));
 24872512                 l = storenode(p->n_type, off);
 24882513                 /*
 24892514                  * If this is a binode which reclaim a leg, and it had
 24902515                  * to walk down the other leg first, then it must be
 24912516                  * split below this node instead.
<> 2517+                 * Be careful not to store a node that do not involve
  2518+                 * any evaluation (meaningless).
24922519                  */
 24932520                 q = &table[TBLIDX(p->n_su)];
 24942521                 if (optype(p->n_op) == BITYPE &&
<>2495 -                    (q->rewrite & RLEFT && (p->n_su & DORIGHT) == 0)) {
  2522+                    (q->rewrite & RLEFT && (p->n_su & DORIGHT) == 0) &&
  2523+                    regcanaddr(p->n_left) == 0) {
24962524                         nip = ipnode(mkbinode(ASSIGN, storenode(p->n_type, off),
 24972525                             p->n_left, p->n_type));
 24982526                         p->n_left = l;
 24992527                 } else if (optype(p->n_op) == BITYPE &&
<>2500 -                    (q->rewrite & RRIGHT && (p->n_su & DORIGHT) != 0)) {
  2528+                    (q->rewrite & RRIGHT && (p->n_su & DORIGHT) != 0) &&
  2529+                    regcanaddr(p->n_right) == 0) {
<_25012530                         nip = ipnode(mkbinode(ASSIGN, storenode(p->n_type, off),
 25022531                             p->n_right, p->n_type));
 25032532                         p->n_right = l;
 25042533                 } else {
 25052534                         r = talloc();
 25062535                         *r = *p;
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-21 00:43 +0100