Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.83
 
1.84
 
MAIN:ragge:20120818154413
 
optim2.c
_>315315                         q = ip->ip_node;
 316316                         switch (q->n_op) {
 317317                         case GOTO:
<>318 -                                p->op = JBR;
 319 -                                p->labno = q->n_left->n_lval;
  318+                                if (q->n_left->n_op == ICON) {
  319+                                        p->op = JBR;
  320+                                        p->labno = q->n_left->n_lval;
  321+                                } else
  322+                                        p->op = STMT;
320323                                 break;
 321324                         case CBRANCH:
 322325                                 p->op = CBR;
     
 !
359362         }
 360363 }
 361364 
<> 365+/*
  366+ * Traverse to the first statement behind a label.
  367+ */
362368 static struct dlnod *
 363369 nonlab(struct dlnod *p)
 364370 {
     
 !
385391         }
 386392 }
 387393 
<> 394+/*
  395+ * Change a label number for jump/branch instruction to labno.
  396+ */
388397 static void
 389398 setlab(struct dlnod *p, int labno)
 390399 {
     
 !
399408 }
 400409 
 401410 /*
<> 411+ * See if a label is used outside of us.
  412+ */
  413+static int
  414+inuse(struct p2env *p2e, int lbl)
  415+{
  416+        int *l;
  417+
  418+        for (l = p2e->epp->ip_labels; *l; l++)
  419+                if (*l == lbl)
  420+                        return 1;
  421+        return 0;
  422+}
  423+
  424+/*
402425  * Label reference counting and removal of unused labels.
 403426  */
 404427 #define LABHS 127
     
 !
413436         for (hp = labhash; hp < &labhash[LABHS];)
 414437                 *hp++ = 0;
 415438         /* Enter labels into hash.  Later overwrites earlier */
<>416 -        for (p = dl->forw; p!=0; p = p->forw)
  439+        for (p = dl->forw; p!=0; p = p->forw) {
417440                 if (p->op==LABEL) {
 418441                         labhash[p->labno % LABHS] = p;
 419442                         p->refc = 0;
<> 443+                        if (inuse(p2e, p->labno))
  444+                                p->refc = 1000; /* never remove */
420445                 }
<>421 -
  446+        }
422447         /* search for jumps to labels and fill in reference */
 423448         for (p = dl->forw; p!=0; p = p->forw) {
 424449                 if (p->op==JBR || p->op==CBR) {
     
 !
790815         struct cfgnode *cnode;
 791816         struct cfgnode *pnode;
 792817         struct basicblock *bb;
<>793 -        
 794 -        DLIST_FOREACH(bb, &p2e->bblocks, bbelem) {
  818+        NODE *p;
795819 
<>796 -                if (bb->first->type == IP_EPILOG) {
  820+#ifdef notyet
  821+        DLIST_FOREACH(bb, &p2e->bblocks, bbelem) {
  822+                if (bb->first->type == IP_EPILOG)
797823                         break;
<> 824+
  825+                if (bb->last->type == IP_NODE) {
  826+                        p = bb->last->ip_node;
  827+                        switch (p->n_op) {
  828+                        case GOTO:
  829+                                if (p->n_left->n_op == ICON) {
  830+                                        lbchk(p2e, p->n_left->n_lval);
  831+                                        fillcnode(p2e, p->n_left->n_lval, bb);
  832+                                } else {
  833+                                }
  834+                                break;
  835+
  836+                        case CBRANCH:
  837+                                lbchk(p2e, p->n_right->n_lval);
  838+                                fillcnode(p2e, p->n_right->n_lval, bb);
  839+                                ...
  840+
  841+                        default:
  842+                                ...
  843+                        }
  844+                } else {
  845+                        ...
798846                 }
<> 847+        }
  848+#endif
799849 
<> 850+        DLIST_FOREACH(bb, &p2e->bblocks, bbelem) {
  851+                if (bb->first->type == IP_EPILOG)
  852+                        break;
  853+        
800854                 cnode = tmpalloc(sizeof(struct cfgnode));
 801855                 pnode = tmpalloc(sizeof(struct cfgnode));
 802856                 pnode->bblock = bb;
 803857 
<>804 -                if ((bb->last->type == IP_NODE) &&
 805 -                    (bb->last->ip_node->n_op == GOTO) &&
 806 -                    (bb->last->ip_node->n_left->n_op == ICON))  {
 807 -                        if (bb->last->ip_node->n_left->n_lval - p2e->labinfo.low >
 808 -                            p2e->labinfo.size) {
 809 -                                comperr("Label out of range: %d, base %d",
 810 -                                        bb->last->ip_node->n_left->n_lval,
 811 -                                        p2e->labinfo.low);
  858+                p = bb->last->ip_node;
  859+                if (bb->last->type == IP_NODE && p->n_op == GOTO) {
  860+                        if (p->n_left->n_op == ICON) {
  861+                                if (p->n_left->n_lval - p2e->labinfo.low > p2e->labinfo.size)
  862+                                        comperr("Label out of range: %d, base %d",
  863+                                            p->n_left->n_lval, p2e->labinfo.low);
  864+                                cnode->bblock = p2e->labinfo.arr[p->n_left->n_lval - p2e->labinfo.low];
  865+                                SLIST_INSERT_LAST(&cnode->bblock->parents, pnode, cfgelem);
  866+                                SLIST_INSERT_LAST(&bb->child, cnode, chld);
  867+                        } else {
  868+                                int *l;
  869+                                /* XXX assume all labels are valid as dest */
  870+                                for (l = p2e->epp->ip_labels; *l; l++) {
  871+                                        cnode->bblock = p2e->labinfo.arr[*l - p2e->labinfo.low];
  872+                                        SLIST_INSERT_LAST(&cnode->bblock->parents, pnode, cfgelem);
  873+                                        SLIST_INSERT_LAST(&bb->child, cnode, chld);
  874+                                        cnode = tmpalloc(sizeof(struct cfgnode));
  875+                                        pnode = tmpalloc(sizeof(struct cfgnode));
  876+                                        pnode->bblock = bb;
  877+                                }
812878                         }
<>813 -                        cnode->bblock = p2e->labinfo.arr[bb->last->ip_node->n_left->n_lval - p2e->labinfo.low];
 814 -                        SLIST_INSERT_LAST(&cnode->bblock->parents, pnode, cfgelem);
 815 -                        SLIST_INSERT_LAST(&bb->child, cnode, chld);
816879                         continue;
 817880                 }
<>818 -                if ((bb->last->type == IP_NODE) &&
 819 -                    (bb->last->ip_node->n_op == CBRANCH)) {
 820 -                        if (bb->last->ip_node->n_right->n_lval - p2e->labinfo.low >
 821 -                            p2e->labinfo.size)
 822 -                                comperr("Label out of range: %d",
 823 -                                        bb->last->ip_node->n_left->n_lval);
  881+                if ((bb->last->type == IP_NODE) && p->n_op == CBRANCH) {
  882+                        if (p->n_right->n_lval - p2e->labinfo.low > p2e->labinfo.size)
  883+                                comperr("Label out of range: %d", p->n_left->n_lval);
824884 
<>825 -                        cnode->bblock = p2e->labinfo.arr[bb->last->ip_node->n_right->n_lval - p2e->labinfo.low];
  885+                        cnode->bblock = p2e->labinfo.arr[p->n_right->n_lval - p2e->labinfo.low];
826886                         SLIST_INSERT_LAST(&cnode->bblock->parents, pnode, cfgelem);
 827887                         SLIST_INSERT_LAST(&bb->child, cnode, chld);
 828888                         cnode = tmpalloc(sizeof(struct cfgnode));
     
 !
15031563            0, "NODE", "PROLOG", "STKOFF", "EPILOG", "DEFLAB", "DEFNAM", "ASM" };
 15041564         struct interpass_prolog *ipplg, *epplg;
 15051565         unsigned i;
<> 1566+        int *l;
15061567 
 15071568         if (ip->type > MAXIP)
 15081569                 printf("IP(%d) (%p): ", ip->type, ip);
     
 !
15301591                 for (i = 0; i < NIPPREGS; i++)
 15311592                         printf("%s0x%lx", i? ":" : " ",
 15321593                             (long) epplg->ipp_regs[i]);
<>1533 -                printf(" autos %d mintemp %d minlbl %d\n",
  1594+                printf(" autos %d mintemp %d minlbl %d\ncgoto labels: ",
15341595                     epplg->ipp_autos, epplg->ip_tmpnum, epplg->ip_lblnum);
<> 1596+                for (l = epplg->ip_labels; *l; l++)
  1597+                        printf("%d ", *l);
  1598+                printf("\n");
<_15351599                 break;
 15361600         case IP_DEFLAB: printf(LABFMT "\n", ip->ip_lbl); break;
 15371601         case IP_DEFNAM: printf("\n"); break;
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-10-31 21:49 +0100