Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.170
 
1.171
 
MAIN:gmcgarry:20080415095232
 
regs.c
_>2828 
 2929 #include "pass2.h"
 3030 #include <string.h>
<> 31+#ifdef HAVE_STRINGS_H
3132 #include <strings.h>
<> 33+#endif
  34+#ifdef HAVE_STDINT_H
3235 #include <stdint.h>
<> 36+#endif
3337 #include <stdlib.h>
 3438 #ifdef HAVE_ALLOCA_H
 3539 #include <alloca.h>
     
 !
166170         REGW *nb = &nblock[regno(p)];
 167171         if (nb->link.q_forw == 0) {
 168172                 DLIST_INSERT_AFTER(&initial, nb, link);
<> 173+#ifdef PCC_DEBUG
169174                 ASGNUM(nb) = regno(p);
 170175                 RDEBUG(("Adding longtime %d for tmp %d\n",
 171176                     nb->nodnum, regno(p)));
<> 177+#endif
172178         }
 173179         if (nb->r_class == 0)
 174180                 nb->r_class = gclass(p->n_type);
<> 181+#ifdef PCC_DEBUG
175182         RDEBUG(("newblock: p %p, node %d class %d\n",
 176183             p, nb->nodnum, nb->r_class));
<> 184+#endif
177185         return nb;
 178186 }
 179187 
     
 !
284292                 return need;
 285293         }
 286294 
<> 295+#ifdef PCC_DEBUG
287296 #define ADCL(n, cl)     \
 288297         for (i = 0; i < n; i++, w++) {  w->r_class = cl; \
 289298                 DLIST_INSERT_BEFORE(&initial, w, link);  SETNUM(w); \
 290299                 UDEBUG(("Adding " #n " %d\n", w->nodnum)); \
 291300         }
<> 301+#else
  302+#define ADCL(n, cl)     \
  303+        for (i = 0; i < n; i++, w++) {  w->r_class = cl; \
  304+                DLIST_INSERT_BEFORE(&initial, w, link);  SETNUM(w); \
  305+        }
  306+#endif
292307 
 293308         UDEBUG(("node %p numregs %d\n", p, nxreg+1));
 294309         w = p->n_regw = tmpalloc(sizeof(REGW) * (nxreg+1));
     
 !
301316         SETNUM(w);
 302317         if (w->r_class)
 303318                 DLIST_INSERT_BEFORE(&initial, w, link);
<> 319+#ifdef PCC_DEBUG
304320         UDEBUG(("Adding short %d class %d\n", w->nodnum, w->r_class));
<> 321+#endif
305322         w++;
 306323         ADCL(nareg, CLASSA);
 307324         ADCL(nbreg, CLASSB);
     
 !
501518 {
 502519         struct lives *l;
 503520 
<> 521+#ifdef PCC_DEBUG
504522         RDEBUG(("LIVEDELR: %d\n", x->nodnum));
<> 523+#endif
505524         DLIST_FOREACH(l, &lused, link) {
 506525                 if (l->var != x)
 507526                         continue;
     
 !
598617 {
 599618         ADJL *x;
 600619 
<> 620+#ifdef PCC_DEBUG
601621         RRDEBUG(("AddEdge: u %d v %d\n", ASGNUM(u), ASGNUM(v)));
 602622 
<>603 -#ifdef PCC_DEBUG
604623 #if 0
 605624         if (ASGNUM(u) == 0)
 606625                 comperr("AddEdge 0");
     
 !
702721         int i, j, k;
 703722         struct lives *l;
 704723 
<> 724+#ifdef PCC_DEBUG
705725         RDEBUG(("addalledges for %d\n", e->nodnum));
<> 726+#endif
706727 
 707728         if (e->r_class == -1)
 708729                 return; /* unused */
     
 !
731752         /* short-lived temps */
 732753         RDEBUG(("addalledges shortlived "));
 733754         DLIST_FOREACH(l, &lused, link) {
<> 755+#ifdef PCC_DEBUG
734756                 RRDEBUG(("%d ", ASGNUM(l->var)));
<> 757+#endif
735758                 AddEdge(l->var, e);
 736759         }
 737760         RDEBUG(("done\n"));
     
 !
747770 
 748771         if (def == use)
 749772                 return; /* no move to itself XXX - ``shouldn't happen'' */
<> 773+#ifdef PCC_DEBUG
750774         RDEBUG(("moveadd: def %d use %d\n", ASGNUM(def), ASGNUM(use)));
<> 775+#endif
751776 
 752777         r = WORKLISTMOVEADD(use, def);
 753778         MOVELISTADD(def, r);
     
 !
13331358 {
 13341359         int wast;
 13351360 
<> 1361+#ifdef PCC_DEBUG
13361362         RRDEBUG(("DecrementDegree: w %d, c %d\n", ASGNUM(w), c));
<> 1363+#endif
13371364 
 13381365         wast = trivially_colorable(w);
 13391366         NCLASS(w, c)--;
     
 !
13581385 
 13591386         w = POPWLIST(simplifyWorklist);
 13601387         PUSHWLIST(w, selectStack);
<> 1388+#ifdef PCC_DEBUG
13611389         RDEBUG(("Simplify: node %d class %d\n", ASGNUM(w), w->r_class));
<> 1390+#endif
13621391 
 13631392         l = w->r_adjList;
 13641393         for (; l; l = l->r_next) {
     
 !
13801409 static int
 13811410 OK(REGW *t, REGW *r)
 13821411 {
<> 1412+#ifdef PCC_DEBUG
13831413         RDEBUG(("OK: t %d CLASS(t) %d adjSet(%d,%d)=%d\n",
 13841414             ASGNUM(t), CLASS(t), ASGNUM(t), ASGNUM(r), adjSet(t, r)));
 13851415 
<>1386 -#ifdef PCC_DEBUG
13871416         if (rdebug > 1) {
 13881417                 ADJL *w;
 13891418                 int ndeg = 0;
     
 !
14421471 #ifdef oldcons
 14431472         int i, ncl[NUMCLASS+1];
 14441473 
<> 1474+#ifdef PCC_DEBUG
14451475         if (CLASS(u) != CLASS(v))
 14461476                 comperr("Conservative: u(%d = %d), v(%d = %d)",
 14471477                     ASGNUM(u), CLASS(u), ASGNUM(v), CLASS(v));
<> 1478+#endif
14481479 
 14491480         for (i = 0; i < NUMCLASS+1; i++)
 14501481                 ncl[i] = 0;
 14511482 
<> 1483+#ifdef PCC_DEBUG
14521484         RDEBUG(("Conservative (%d,%d)\n", ASGNUM(u), ASGNUM(v)));
<> 1485+#endif
14531486 
 14541487         for (w = ADJLIST(u); w; w = w->r_next) {
 14551488                 n = w->a_temp;
     
 !
15441577         ADJL *l;
 15451578         REGW *t;
 15461579 
<> 1580+#ifdef PCC_DEBUG
15471581         RDEBUG(("Combine (%d,%d)\n", ASGNUM(u), ASGNUM(v)));
<> 1582+#endif
15481583 
 15491584         if (ONLIST(v) == &freezeWorklist) {
 15501585                 DELWLIST(v);
     
 !
15531588         }
 15541589         PUSHWLIST(v, coalescedNodes);
 15551590         ALIAS(v) = u;
<> 1591+#ifdef PCC_DEBUG
15561592         if (rdebug) {
 15571593                 printf("adjlist(%d): ", ASGNUM(v));
 15581594                 for (l = ADJLIST(v); l; l = l->r_next)
 15591595                         printf("%d ", l->a_temp->nodnum);
 15601596                 printf("\n");
 15611597         }
<> 1598+#endif
15621599 #if 1
 15631600 {
 15641601         MOVL *m0 = MOVELIST(v);
     
 !
15961633                 DELWLIST(u);
 15971634                 PUSHWLIST(u, spillWorklist);
 15981635         }
<> 1636+#ifdef PCC_DEBUG
15991637 if (rdebug) {
 16001638         ADJL *w;
 16011639         printf("Combine %d class (%d): ", ASGNUM(u), CLASS(u));
     
 !
16081646         }
 16091647         printf("\n");
 16101648 }
<> 1649+#endif
16111650 }
 16121651 
 16131652 static void
     
 !
16251664         else
 16261665                 u = x, v = y;
 16271666 
<> 1667+#ifdef PCC_DEBUG
16281668         RDEBUG(("Coalesce: src %d dst %d u %d v %d x %d y %d\n",
 16291669             ASGNUM(m->src), ASGNUM(m->dst), ASGNUM(u), ASGNUM(v),
 16301670             ASGNUM(x), ASGNUM(y)));
<> 1671+#endif
16311672 
 16321673         if (CLASS(m->src) != CLASS(m->dst))
 16331674                 comperr("Coalesce: src class %d, dst class %d",
     
 !
16721713                         v = GetAlias(x);
 16731714                 else
 16741715                         v = GetAlias(y);
<> 1716+#ifdef PCC_DEBUG
16751717                 RDEBUG(("FreezeMoves: u %d (%d,%d) v %d\n",
 16761718                     ASGNUM(u),ASGNUM(x),ASGNUM(y),ASGNUM(v)));
<> 1719+#endif
16771720                 DLIST_REMOVE(m, link);
 16781721                 PUSHMLIST(m, frozenMoves, FROZEN);
 16791722                 if (ONLIST(v) != &freezeWorklist)
     
 !
17011744          */
 17021745         u = POPWLIST(freezeWorklist);
 17031746         PUSHWLIST(u, simplifyWorklist);
<> 1747+#ifdef PCC_DEBUG
17041748         RDEBUG(("Freeze %d\n", ASGNUM(u)));
<> 1749+#endif
17051750         FreezeMoves(u);
 17061751 }
 17071752 
     
 !
17111756         REGW *w;
 17121757 
 17131758         RDEBUG(("SelectSpill\n"));
<> 1759+#ifdef PCC_DEBUG
17141760         if (rdebug)
 17151761                 DLIST_FOREACH(w, &spillWorklist, link)
 17161762                         printf("SelectSpill: %d\n", ASGNUM(w));
<> 1763+#endif
17171764 
 17181765         /* First check if we can spill register variables */
 17191766         DLIST_FOREACH(w, &spillWorklist, link) {
     
 !
17471794         DLIST_REMOVE(w, link);
 17481795 
 17491796         PUSHWLIST(w, simplifyWorklist);
<> 1797+#ifdef PCC_DEBUG
17501798         RDEBUG(("Freezing node %d\n", ASGNUM(w)));
<> 1799+#endif
17511800         FreezeMoves(w);
 17521801 }
 17531802 
     
 !
18111860         while (!WLISTEMPTY(selectStack)) {
 18121861                 w = POPWLIST(selectStack);
 18131862                 okColors = classmask(CLASS(w));
<> 1863+#ifdef PCC_DEBUG
18141864                 RDEBUG(("classmask av %d, class %d: %x\n",
 18151865                     w->nodnum, CLASS(w), okColors));
<> 1866+#endif
18161867 
 18171868                 for (x = ADJLIST(w); x; x = x->r_next) {
 18181869                         o = GetAlias(x->a_temp);
<> 1870+#ifdef PCC_DEBUG
18191871                         RRDEBUG(("Adj(%d): %d (%d)\n",
 18201872                             ASGNUM(w), ASGNUM(o), ASGNUM(x->a_temp)));
<> 1873+#endif
18211874 
 18221875                         if (ONLIST(o) == &coloredNodes ||
 18231876                             ONLIST(o) == &precolored) {
     
 !
18311884                 }
 18321885                 if (okColors == 0) {
 18331886                         PUSHWLIST(w, spilledNodes);
<> 1887+#ifdef PCC_DEBUG
18341888                         RDEBUG(("Spilling node %d\n", ASGNUM(w)));
<> 1889+#endif
18351890                 } else {
 18361891                         PUSHWLIST(w, coloredNodes);
 18371892                         c = ffs(okColors)-1;
 18381893                         COLOR(w) = color2reg(c, CLASS(w));
<> 1894+#ifdef PCC_DEBUG
18391895                         RDEBUG(("Coloring %d with %s, free %x\n",
 18401896                             ASGNUM(w), rnames[COLOR(w)], okColors));
<> 1897+#endif
18411898                 }
 18421899         }
 18431900         DLIST_FOREACH(w, &coalescedNodes, link) {
 18441901                 REGW *ww = GetAlias(w);
 18451902                 COLOR(w) = COLOR(ww);
 18461903                 if (ONLIST(ww) == &spilledNodes) {
<> 1904+#ifdef PCC_DEBUG
18471905                         RDEBUG(("coalesced node %d spilled\n", w->nodnum));
<> 1906+#endif
18481907                         ww = DLIST_PREV(w, link);
 18491908                         DLIST_REMOVE(w, link);
 18501909                         PUSHWLIST(w, spilledNodes);
 18511910                         w = ww;
<>1852 -                } else
  1911+                } else {
  1912+#ifdef PCC_DEBUG
18531913                         RDEBUG(("Giving coalesced node %d color %s\n",
 18541914                             w->nodnum, rnames[COLOR(w)]));
<> 1915+#endif
  1916+                }
18551917         }
 18561918 
<> 1919+#ifdef PCC_DEBUG
18571920         if (rdebug)
 18581921                 DLIST_FOREACH(w, &coloredNodes, link)
 18591922                         printf("%d: color %s\n", ASGNUM(w), rnames[COLOR(w)]);
<> 1923+#endif
18601924         if (DLIST_ISEMPTY(&spilledNodes, link)) {
 18611925                 struct interpass *ip2;
 18621926                 DLIST_FOREACH(ip2, ip, qelem)
     
 !
19141978                 /* XXX - use canaddr() */
 19151979                 if (p->n_op == OREG || p->n_op == NAME) {
 19161980                         DLIST_REMOVE(w, link);
<> 1981+#ifdef PCC_DEBUG
19171982                         RDEBUG(("Node %d already in memory\n", ASGNUM(w)));
<> 1983+#endif
19181984                         break;
 19191985                 }
<> 1986+#ifdef PCC_DEBUG
19201987                 RDEBUG(("rewriting node %d\n", ASGNUM(w)));
<> 1988+#endif
19211989 
 19221990                 off = BITOOR(freetemp(szty(p->n_type)));
 19231991                 l = mklnode(OREG, off, FPREG, p->n_type);
     
 !
22582326         RDEBUG(("nsucomp allocated %d temps (%d,%d)\n",
 22592327             tempmax-tempmin, tempmin, tempmax));
 22602328 
<> 2329+#ifdef PCC_DEBUG
22612330         use_regw = 1;
<> 2331+#endif
22622332         RPRINTIP(ipole);
<> 2333+#ifdef PCC_DEBUG
22632334         use_regw = 0;
<> 2335+#endif
<_22642336         RDEBUG(("ngenregs: numtemps %d (%d, %d)\n", tempmax-tempmin,
 22652337                     tempmin, tempmax));
 22662338 
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-11-01 12:16 +0100