Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.78
 
1.79
 
MAIN:ragge:20100604071846
 
optim2.c
_>4343 
 4444 #define mktemp(n, t)    mklnode(TEMP, 0, n, t)
 4545 
<> 46+#define CHADD(bb,c)     { if (bb->ch[0] == 0) bb->ch[0] = c; \
  47+                          else if (bb->ch[1] == 0) bb->ch[1] = c; \
  48+                          else comperr("triple cfnodes"); }
  49+#define FORCH(cn, chp)  \
  50+        for (cn = &chp[0]; cn < &chp[2] && cn[0]; cn++)
  51+
4652 /* main switch for new things not yet ready for all-day use */
 4753 /* #define ENABLE_NEW */
 4854 
     
 !
700706                     (ip->type == IP_DEFLAB) || (ip->type == IP_DEFNAM)) {
 701707                         bb = tmpalloc(sizeof(struct basicblock));
 702708                         bb->first = ip;
<>703 -                        SLIST_INIT(&bb->children);
704709                         SLIST_INIT(&bb->parents);
<> 710+                        bb->ch[0] = bb->ch[1] = NULL;
705711                         bb->dfnum = 0;
 706712                         bb->dfparent = 0;
 707713                         bb->semi = 0;
     
 !
806812                         }
 807813                         cnode->bblock = p2e->labinfo.arr[bb->last->ip_node->n_left->n_lval - p2e->labinfo.low];
 808814                         SLIST_INSERT_LAST(&cnode->bblock->parents, pnode, cfgelem);
<>809 -                        SLIST_INSERT_LAST(&bb->children, cnode, cfgelem);
  815+                        CHADD(bb, cnode);
810816                         continue;
 811817                 }
 812818                 if ((bb->last->type == IP_NODE) &&
     
 !
818824 
 819825                         cnode->bblock = p2e->labinfo.arr[bb->last->ip_node->n_right->n_lval - p2e->labinfo.low];
 820826                         SLIST_INSERT_LAST(&cnode->bblock->parents, pnode, cfgelem);
<>821 -                        SLIST_INSERT_LAST(&bb->children, cnode, cfgelem);
  827+                        CHADD(bb, cnode);
822828                         cnode = tmpalloc(sizeof(struct cfgnode));
 823829                         pnode = tmpalloc(sizeof(struct cfgnode));
 824830                         pnode->bblock = bb;
 825831                 }
 826832 
 827833                 cnode->bblock = DLIST_NEXT(bb, bbelem);
 828834                 SLIST_INSERT_LAST(&cnode->bblock->parents, pnode, cfgelem);
<>829 -                SLIST_INSERT_LAST(&bb->children, cnode, cfgelem);
  835+                CHADD(bb, cnode);
830836         }
 831837 }
 832838 
 833839 void
 834840 cfg_dfs(struct basicblock *bb, unsigned int parent, struct bblockinfo *bbinfo)
 835841 {
<>836 -        struct cfgnode *cnode;
 837 -        
  842+        struct cfgnode **cn;
  843+
838844         if (bb->dfnum != 0)
 839845                 return;
 840846 
 841847         bb->dfnum = ++dfsnum;
 842848         bb->dfparent = parent;
 843849         bbinfo->arr[bb->dfnum] = bb;
<>844 -        SLIST_FOREACH(cnode, &bb->children, cfgelem) {
 845 -                cfg_dfs(cnode->bblock, bb->dfnum, bbinfo);
 846 -        }
  850+        FORCH(cn, bb->ch)
  851+                cfg_dfs((*cn)->bblock, bb->dfnum, bbinfo);
847852         /* Don't bring in unreachable nodes in the future */
 848853         bbinfo->size = dfsnum + 1;
 849854 }
     
 !
882887 
 883888         if (b2debug) {
 884889                 struct basicblock *bbb;
<>885 -                struct cfgnode *ccnode;
  890+                struct cfgnode *ccnode, **cn;
886891 
 887892                 DLIST_FOREACH(bbb, &p2e->bblocks, bbelem) {
 888893                         printf("Basic block %d, parents: ", bbb->dfnum);
 889894                         SLIST_FOREACH(ccnode, &bbb->parents, cfgelem) {
 890895                                 printf("%d, ", ccnode->bblock->dfnum);
 891896                         }
 892897                         printf("\nChildren: ");
<>893 -                        SLIST_FOREACH(ccnode, &bbb->children, cfgelem) {
 894 -                                printf("%d, ", ccnode->bblock->dfnum);
 895 -                        }
  898+                        FORCH(cn, bbb->ch)
  899+                                printf("%d, ", (*cn)->bblock->dfnum);
896900                         printf("\n");
 897901                 }
 898902         }
     
 !
976980 void
 977981 computeDF(struct p2env *p2e, struct basicblock *bblock)
 978982 {
<>979 -        struct cfgnode *cnode;
  983+        struct cfgnode **cn;
980984         int h, i;
 981985         
<>982 -        SLIST_FOREACH(cnode, &bblock->children, cfgelem) {
 983 -                if (cnode->bblock->idom != bblock->dfnum)
 984 -                        BITSET(bblock->df, cnode->bblock->dfnum);
  986+        FORCH(cn, bblock->ch) {
  987+                if ((*cn)->bblock->idom != bblock->dfnum)
  988+                        BITSET(bblock->df, (*cn)->bblock->dfnum);
985989         }
 986990         for (h = 1; h < p2e->bbinfo.size; h++) {
 987991                 if (!TESTBIT(bblock->dfchildren, h))
     
 !
12361240         int h,j;
 12371241         SLIST_HEAD(, varstack) poplist;
 12381242         struct varstack *stacke;
<>1239 -        struct cfgnode *cfgn;
 1240 -        struct cfgnode *cfgn2;
  1243+        struct cfgnode *cfgn2, **cn;
12411244         int tmpregno,newtmpregno;
 12421245         struct phiinfo *phi;
 12431246 
     
 !
12721275                 ip = DLIST_NEXT(ip, qelem);
 12731276         }
 12741277 
<>1275 -        SLIST_FOREACH(cfgn,&bb->children,cfgelem) {
  1278+        FORCH(cn, bb->ch) {
12761279                 j=0;
 12771280 
<>1278 -                SLIST_FOREACH(cfgn2, &cfgn->bblock->parents, cfgelem) {
  1281+                SLIST_FOREACH(cfgn2, &(*cn)->bblock->parents, cfgelem) {
12791282                         if (cfgn2->bblock->dfnum==bb->dfnum)
 12801283                                 break;
 12811284                         
 12821285                         j++;
 12831286                 }
 12841287 
<>1285 -                SLIST_FOREACH(phi,&cfgn->bblock->phi,phielem) {
  1288+                SLIST_FOREACH(phi,&(*cn)->bblock->phi,phielem) {
12861289                         phi->intmpregno[j]=SLIST_FIRST(&defsites.stack[phi->tmpregno-defsites.low])->tmpregno;
 12871290                 }
<>1288 -                
12891291         }
 12901292 
 12911293         for (h = 1; h < p2e->bbinfo.size; h++) {
     
 !
16201622 void
 16211623 printflowdiagram(struct p2env *p2e, char *type) {
 16221624         struct basicblock *bbb;
<>1623 -        struct cfgnode *ccnode;
  1625+        struct cfgnode **cn;
16241626         struct interpass *ip;
 16251627         struct interpass_prolog *plg;
 16261628         struct phiinfo *phi;
     
 !
16931695                 }
 16941696                 fprintf(flowdiagramfile,"\"]\n");
 16951697                 
<>1696 -                SLIST_FOREACH(ccnode, &bbb->children, cfgelem) {
  1698+                FORCH(cn, bbb->ch) {
16971699                         char *color="black";
 16981700                         struct interpass *pip=bbb->last;
 16991701 
 17001702                         if (pip->type == IP_NODE && pip->ip_node->n_op == CBRANCH) {
 17011703                                 int label = (int)pip->ip_node->n_right->n_lval;
 17021704                                 
<>1703 -                                if (ccnode->bblock==p2e->labinfo.arr[label - p2e->ipp->ip_lblnum])
  1705+                                if ((*cn)->bblock==p2e->labinfo.arr[label - p2e->ipp->ip_lblnum])
17041706                                         color="red";
 17051707                         }
 17061708                         
<>1707 -                        fprintf(flowdiagramfile,"bb%p -> bb%p [color=%s]\n", bbb,ccnode->bblock,color);
  1709+                        fprintf(flowdiagramfile,"bb%p -> bb%p [color=%s]\n", bbb,(*cn)->bblock,color);
17081710                 }
 17091711         }
 17101712         
     
 !
18021804                         /* find block without trace */
 18031805                         if (map[indx].thread == 0) {
 18041806                                 /* do new thread */
<>1805 -                                struct cfgnode *cnode ;
  1807+                                struct cfgnode **cn ;
18061808                                 struct basicblock *block2 = 0;
 18071809                                 unsigned long i ;
 18081810                                 unsigned long added ;
     
 !
18281830                                                          * this code picks the last one.
 18291831                                                          */
 18301832 
<>1831 -                                                        SLIST_FOREACH(cnode, &bb->children, cfgelem) {
 1832 -                                                                block2=cnode->bblock ;
  1833+                                                        FORCH(cn, bb->ch) {
  1834+                                                                block2=(*cn)->bblock ;
18331835 #if 1
 18341836                                                                 if (i+1 < count && map[i+1].block == block2)
 18351837                                                                         break ; /* pick that one */
     
 !
20552057 {
 20562058         struct basicblock *bb;
 20572059         struct interpass *ip;
<>2058 -        struct cfgnode *cn;
20592060         bittype *saved;
 20602061         int i, mintemp, again;
 20612062 
     
 !
21062107         }
 21072108         /* do liveness analysis on basic block level */
 21082109         do {
<> 2110+                struct cfgnode **cn;
21092111                 int j;
 21102112 
 21112113                 again = 0;
 21122114                 /* XXX - loop should be in reversed execution-order */
 21132115                 DLIST_FOREACH_REVERSE(bb, &p2e->bblocks, bbelem) {
 21142116                         SETCOPY(saved, bb->out, j, xbits);
<>2115 -                        SLIST_FOREACH(cn, &bb->children, cfgelem) {
 2116 -                                SETSET(bb->out, cn->bblock->in, j, xbits);
  2117+                        FORCH(cn, bb->ch) {
  2118+                                SETSET(bb->out, cn[0]->bblock->in, j, xbits);
<_21172119                         }
 21182120                         SETCMP(again, saved, bb->out, j, xbits);
 21192121                         SETCOPY(saved, bb->in, j, xbits);
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 20:29 +0100