Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.82
 
1.83
 
MAIN:ragge:20120817205958
 
optim2.c
_>704704         DLIST_FOREACH(ip, ipole, qelem) {
 705705                 if (bb == NULL || (ip->type == IP_EPILOG) ||
 706706                     (ip->type == IP_DEFLAB) || (ip->type == IP_DEFNAM)) {
 707707                         bb = tmpalloc(sizeof(struct basicblock));
 708708                         bb->first = ip;
 709709                         SLIST_INIT(&bb->parents);
<>710 -                        bb->ch[0] = bb->ch[1] = NULL;
  710+                        SLIST_INIT(&bb->child);
711711                         bb->dfnum = 0;
 712712                         bb->dfparent = 0;
 713713                         bb->semi = 0;
 714714                         bb->ancestor = 0;
 715715                         bb->idom = 0;
 716716                         bb->samedom = 0;
     
 !
809809                                 comperr("Label out of range: %d, base %d",
 810810                                         bb->last->ip_node->n_left->n_lval,
 811811                                         p2e->labinfo.low);
 812812                         }
 813813                         cnode->bblock = p2e->labinfo.arr[bb->last->ip_node->n_left->n_lval - p2e->labinfo.low];
 814814                         SLIST_INSERT_LAST(&cnode->bblock->parents, pnode, cfgelem);
<>815 -                        CHADD(bb, cnode);
  815+                        SLIST_INSERT_LAST(&bb->child, cnode, chld);
816816                         continue;
 817817                 }
 818818                 if ((bb->last->type == IP_NODE) &&
 819819                     (bb->last->ip_node->n_op == CBRANCH)) {
 820820                         if (bb->last->ip_node->n_right->n_lval - p2e->labinfo.low >
 821821                             p2e->labinfo.size)
 822822                                 comperr("Label out of range: %d",
 823823                                         bb->last->ip_node->n_left->n_lval);
 824824 
 825825                         cnode->bblock = p2e->labinfo.arr[bb->last->ip_node->n_right->n_lval - p2e->labinfo.low];
 826826                         SLIST_INSERT_LAST(&cnode->bblock->parents, pnode, cfgelem);
<>827 -                        CHADD(bb, cnode);
  827+                        SLIST_INSERT_LAST(&bb->child, cnode, chld);
828828                         cnode = tmpalloc(sizeof(struct cfgnode));
 829829                         pnode = tmpalloc(sizeof(struct cfgnode));
 830830                         pnode->bblock = bb;
 831831                 }
 832832 
 833833                 cnode->bblock = DLIST_NEXT(bb, bbelem);
 834834                 SLIST_INSERT_LAST(&cnode->bblock->parents, pnode, cfgelem);
<>835 -                CHADD(bb, cnode);
  835+                SLIST_INSERT_LAST(&bb->child, cnode, chld);
836836         }
 837837 }
 838838 
 839839 void
 840840 cfg_dfs(struct basicblock *bb, unsigned int parent, struct bblockinfo *bbinfo)
 841841 {
<>842 -        struct cfgnode **cn;
  842+        struct cfgnode *cn;
843843 
 844844         if (bb->dfnum != 0)
 845845                 return;
 846846 
 847847         bb->dfnum = ++dfsnum;
 848848         bb->dfparent = parent;
 849849         bbinfo->arr[bb->dfnum] = bb;
<>850 -        FORCH(cn, bb->ch)
 851 -                cfg_dfs((*cn)->bblock, bb->dfnum, bbinfo);
  850+        SLIST_FOREACH(cn, &bb->child, chld)
  851+                cfg_dfs(cn->bblock, bb->dfnum, bbinfo);
852852         /* Don't bring in unreachable nodes in the future */
 853853         bbinfo->size = dfsnum + 1;
 854854 }
 855855 
 856856 static bittype *
 857857 setalloc(int nelem)
     
 !
884884 
 885885         dfsnum = 0;
 886886         cfg_dfs(DLIST_NEXT(&p2e->bblocks, bbelem), 0, &p2e->bbinfo);
 887887 
 888888         if (b2debug) {
 889889                 struct basicblock *bbb;
<>890 -                struct cfgnode *ccnode, **cn;
  890+                struct cfgnode *ccnode, *cn;
891891 
 892892                 DLIST_FOREACH(bbb, &p2e->bblocks, bbelem) {
 893893                         printf("Basic block %d, parents: ", bbb->dfnum);
 894894                         SLIST_FOREACH(ccnode, &bbb->parents, cfgelem) {
 895895                                 printf("%d, ", ccnode->bblock->dfnum);
 896896                         }
 897897                         printf("\nChildren: ");
<>898 -                        FORCH(cn, bbb->ch)
 899 -                                printf("%d, ", (*cn)->bblock->dfnum);
  898+                        SLIST_FOREACH(cn, &bbb->child, chld)
  899+                                printf("%d, ", cn->bblock->dfnum);
900900                         printf("\n");
 901901                 }
 902902         }
 903903 
 904904         for(h = p2e->bbinfo.size - 1; h > 1; h--) {
 905905                 bb = p2e->bbinfo.arr[h];
     
 !
977977         child->ancestor = parent->dfnum;
 978978 }
 979979 
 980980 void
 981981 computeDF(struct p2env *p2e, struct basicblock *bblock)
 982982 {
<>983 -        struct cfgnode **cn;
  983+        struct cfgnode *cn;
984984         int h, i;
 985985         
<>986 -        FORCH(cn, bblock->ch) {
 987 -                if ((*cn)->bblock->idom != bblock->dfnum)
 988 -                        BITSET(bblock->df, (*cn)->bblock->dfnum);
  986+        SLIST_FOREACH(cn, &bblock->child, chld) {
  987+                if (cn->bblock->idom != bblock->dfnum)
  988+                        BITSET(bblock->df, cn->bblock->dfnum);
989989         }
 990990         for (h = 1; h < p2e->bbinfo.size; h++) {
 991991                 if (!TESTBIT(bblock->dfchildren, h))
 992992                         continue;
 993993                 computeDF(p2e, p2e->bbinfo.arr[h]);
 994994                 for (i = 1; i < p2e->bbinfo.size; i++) {
     
 !
12371237 renamevar(struct p2env *p2e,struct basicblock *bb)
 12381238 {
 12391239         struct interpass *ip;
 12401240         int h,j;
 12411241         SLIST_HEAD(, varstack) poplist;
 12421242         struct varstack *stacke;
<>1243 -        struct cfgnode *cfgn2, **cn;
  1243+        struct cfgnode *cfgn2, *cn;
12441244         int tmpregno,newtmpregno;
 12451245         struct phiinfo *phi;
 12461246 
 12471247         SLIST_INIT(&poplist);
 12481248 
 12491249         SLIST_FOREACH(phi,&bb->phi,phielem) {
     
 !
12721272                 if (ip==bb->last)
 12731273                         break;
 12741274 
 12751275                 ip = DLIST_NEXT(ip, qelem);
 12761276         }
 12771277 
<>1278 -        FORCH(cn, bb->ch) {
  1278+        SLIST_FOREACH(cn, &bb->child, chld) {
12791279                 j=0;
 12801280 
<>1281 -                SLIST_FOREACH(cfgn2, &(*cn)->bblock->parents, cfgelem) {
  1281+                SLIST_FOREACH(cfgn2, &cn->bblock->parents, cfgelem) {
12821282                         if (cfgn2->bblock->dfnum==bb->dfnum)
 12831283                                 break;
 12841284                         
 12851285                         j++;
 12861286                 }
 12871287 
<>1288 -                SLIST_FOREACH(phi,&(*cn)->bblock->phi,phielem) {
  1288+                SLIST_FOREACH(phi,&cn->bblock->phi,phielem) {
12891289                         phi->intmpregno[j]=SLIST_FIRST(&defsites.stack[phi->tmpregno-defsites.low])->tmpregno;
 12901290                 }
 12911291         }
 12921292 
 12931293         for (h = 1; h < p2e->bbinfo.size; h++) {
 12941294                 if (!TESTBIT(bb->dfchildren, h))
     
 !
16191619         fprintf(flowdiagramfile,"}");
 16201620 }
 16211621 
 16221622 void
 16231623 printflowdiagram(struct p2env *p2e, char *type) {
 16241624         struct basicblock *bbb;
<>1625 -        struct cfgnode **cn;
  1625+        struct cfgnode *cn;
16261626         struct interpass *ip;
 16271627         struct interpass_prolog *plg;
 16281628         struct phiinfo *phi;
 16291629         char *name;
 16301630         char *filename;
 16311631         int filenamesize;
     
 !
16921692                                 break;
 16931693                         
 16941694                         ip = DLIST_NEXT(ip, qelem);
 16951695                 }
 16961696                 fprintf(flowdiagramfile,"\"]\n");
 16971697                 
<>1698 -                FORCH(cn, bbb->ch) {
  1698+                SLIST_FOREACH(cn, &bbb->child, chld) {
16991699                         char *color="black";
 17001700                         struct interpass *pip=bbb->last;
 17011701 
 17021702                         if (pip->type == IP_NODE && pip->ip_node->n_op == CBRANCH) {
 17031703                                 int label = (int)pip->ip_node->n_right->n_lval;
 17041704                                 
<>1705 -                                if ((*cn)->bblock==p2e->labinfo.arr[label - p2e->ipp->ip_lblnum])
  1705+                                if (cn->bblock==p2e->labinfo.arr[label - p2e->ipp->ip_lblnum])
17061706                                         color="red";
 17071707                         }
 17081708                         
<>1709 -                        fprintf(flowdiagramfile,"bb%p -> bb%p [color=%s]\n", bbb,(*cn)->bblock,color);
  1709+                        fprintf(flowdiagramfile,"bb%p -> bb%p [color=%s]\n", bbb,cn->bblock,color);
17101710                 }
 17111711         }
 17121712         
 17131713         fprintf(flowdiagramfile,"}\n");
 17141714         fclose(flowdiagramfile);
 17151715 }
     
 !
18011801                 changes = 0 ;
 18021802                 
 18031803                 for (indx=0; indx < count; indx++) {
 18041804                         /* find block without trace */
 18051805                         if (map[indx].thread == 0) {
 18061806                                 /* do new thread */
<>1807 -                                struct cfgnode **cn ;
  1807+                                struct cfgnode *cn ;
18081808                                 struct basicblock *block2 = 0;
 18091809                                 unsigned long i ;
 18101810                                 unsigned long added ;
 18111811                                 
 18121812                                 BDEBUG (("new thread %ld at block %ld\n", thread, indx)) ;
 18131813 
     
 !
18271827                                                         /*
 18281828                                                          * pick one from followers. For now (simple), pick the
 18291829                                                          * one who is directly following us. If none of that exists,
 18301830                                                          * this code picks the last one.
 18311831                                                          */
 18321832 
<>1833 -                                                        FORCH(cn, bb->ch) {
 1834 -                                                                block2=(*cn)->bblock ;
  1833+                                                        SLIST_FOREACH(cn, &bb->child, chld) {
  1834+                                                                block2=cn->bblock ;
18351835 #if 1
 18361836                                                                 if (i+1 < count && map[i+1].block == block2)
 18371837                                                                         break ; /* pick that one */
 18381838 #else
 18391839                                                                 if (block2) break ;
 18401840 #endif
     
 !
21062106                         printf("\n");
 21072107                 }
 21082108 #endif
 21092109         }
 21102110         /* do liveness analysis on basic block level */
 21112111         do {
<>2112 -                struct cfgnode **cn;
  2112+                struct cfgnode *cn;
21132113                 int j;
 21142114 
 21152115                 again = 0;
 21162116                 /* XXX - loop should be in reversed execution-order */
 21172117                 DLIST_FOREACH_REVERSE(bb, &p2e->bblocks, bbelem) {
 21182118                         SETCOPY(saved, bb->out, j, xbits);
<>2119 -                        FORCH(cn, bb->ch) {
 2120 -                                SETSET(bb->out, cn[0]->bblock->in, j, xbits);
  2119+                        SLIST_FOREACH(cn, &bb->child, chld) {
  2120+                                SETSET(bb->out, cn->bblock->in, j, xbits);
<_21212121                         }
 21222122                         SETCMP(again, saved, bb->out, j, xbits);
 21232123                         SETCOPY(saved, bb->in, j, xbits);
 21242124                         SETCOPY(bb->in, bb->out, j, xbits);
 21252125                         SETCLEAR(bb->in, bb->killed, j, xbits);
 21262126                         SETSET(bb->in, bb->gen, 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 00:57 +0100