Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.20
 
1.21
 
MAIN:pj:20050501100451
 
optim2.c
_>4848 void optdump(struct interpass *ip);
 4949 void printip(struct interpass *pole);
 5050 
<> 51+static struct varinfo defsites;
5152 static struct interpass ipole;
 5253 struct interpass *storesave;
 5354 
     
 !
6768 ancestorwithlowestsemi(struct basicblock *bblock, struct bblockinfo *bbinfo);
 6869 void link(struct basicblock *parent, struct basicblock *child);
 6970 void computeDF(struct basicblock *bblock, struct bblockinfo *bbinfo);
<>70 -void findTemps(struct interpass *ip, struct varinfo *defsites);
  71+void findTemps(struct interpass *ip);
7172 void placePhiFunctions(struct bblockinfo *bbinfo);
 7273 void remunreach(void);
 7374 
     
 !
844845         }
 845846 }
 846847 
<>847 -void findTemps(struct interpass *ip, struct varinfo *defsites)
  848+static struct basicblock *currbb;
  849+static struct interpass *currip;
  850+
  851+/* Helper function for findTemps, Find assignment nodes. */
  852+static void
  853+findasg(NODE *p)
848854 {
<> 855+        struct pvarinfo *pv;
  856+
  857+        if (p->n_op != ASSIGN)
  858+                return;
  859+
  860+        if (p->n_left->n_op != TEMP)
  861+                return;
  862+
  863+        pv = tmpcalloc(sizeof(struct pvarinfo));
  864+        pv->next = defsites.arr[p->n_left->n_lval];
  865+        pv->bb = currbb;
  866+        pv->top = currip->ip_node;
  867+        pv->n = p->n_left;
  868+
  869+        defsites.arr[p->n_left->n_lval] = pv;
  870+}
  871+
  872+/* Walk the interpass looking for assignment nodes. */
  873+void findTemps(struct interpass *ip)
  874+{
849875         if (ip->type != IP_NODE)
 850876                 return;
 851877 
<>852 -        
  878+        currip = ip;
  879+
  880+        walkf(ip->ip_node, findasg);
853881 }
 854882 
 855883 /*
     
 !
863891         struct interpass *ip;
 864892         int maxtmp, i, j, k, l;
 865893         struct pvarinfo *n;
<>866 -        struct varinfo defsites;
867894         struct cfgnode *cnode;
 868895         TWORD ntype;
 869896         NODE *p;
     
 !
875902         defsites.size = maxtmp - defsites.low + 1;
 876903         defsites.arr = tmpcalloc(defsites.size*sizeof(struct pvarinfo *));
 877904 
<> 905+        /* Find all defsites */
878906         DLIST_FOREACH(bb, &bblocks, bbelem) {
<> 907+                currbb = bb;
879908                 ip = bb->first;
 880909 
 881910                 while (ip != bb->last) {
<>882 -                        findTemps(ip, &defsites);
  911+                        findTemps(ip);
883912                         ip = DLIST_NEXT(ip, qelem);
 884913                 }
 885914                 /* Make sure we get the last statement in the bblock */
<>886 -                findTemps(ip, &defsites);
  915+                findTemps(ip);
887916         }
<> 917+        /* For each variable */
888918         for (i = defsites.low; i < defsites.size; i++) {
<> 919+                /* While W not empty */
889920                 while (defsites.arr[i] != NULL) {
<> 921+                        /* Remove some node n from W */
890922                         n = defsites.arr[i];
 891923                         defsites.arr[i] = n->next;
<> 924+                        /* For each y in n->bb->df */
892925                         for (j = 0; j < bbinfo->size; j++) {
 893926                                 if(!TESTBIT(n->bb->df, j))
 894927                                         continue;
 895928                                 ntype = n->n->n_type;
 896929                                 k = 0;
<> 930+                                /* Amount of predecessors for y */
897931                                 SLIST_FOREACH(cnode, &n->bb->parents, cfgelem)
 898932                                         k++;
<> 933+                                /* Construct phi(...) */
899934                                 p = mklnode(TEMP, i, 0, ntype);
 900935                                 for (l = 0; l < k-1; l++)
 901936                                         p = mkbinode(PHI, p,
 902937                                             mklnode(TEMP, i, 0, ntype), ntype);
 903938                                 ip = ipnode(mkbinode(ASSIGN,
 904939                                     mklnode(TEMP, i, 0, ntype), p, ntype));
<> 940+                                /* Insert phi at top of basic block */
<_905941                                 DLIST_INSERT_BEFORE(((struct interpass*)&n->bb->first), ip, qelem);
 906942                                 n->bb->first = ip;
 907943 
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-09-01 13:26 +0200