Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.39
 
1.40
 
MAIN:ragge:20030804141159
 
reader.c
_>5959 int e2print(NODE *p, int down, int *a, int *b);
 6060 void saveip(struct interpass *ip);
 6161 void deljumps(void);
<> 62+void deltemp(NODE *p);
6263 void optdump(struct interpass *ip);
<> 64+void cvtemps(struct interpass *epil);
6365 
 6466 
 6567 #ifdef PCC_DEBUG
     
 !
751753 
 752754 /*
 753755  * change left TEMPs into OREGs
<> 756+ */
  757+void
  758+deltemp(NODE *p)
  759+{
  760+        struct templst *w = templst;
  761+
  762+        if (p->n_op != TEMP)
  763+                return;
  764+        /*
  765+         * the size of a TEMP is in multiples of the reg size.
  766+         */
  767+        p->n_op = OREG;
  768+        p->n_rval = FPREG;
  769+        while (w != NULL) {
  770+                if (w->tempnr == p->n_lval)
  771+                        break;
  772+                w = w->next;
  773+        }
  774+        if (w == NULL) {
  775+                w = tmpalloc(sizeof(struct templst));
  776+                w->tempnr = p->n_lval;
  777+                w->tempoff = BITOOR(freetemp(szty(p->n_type)));
  778+                w->next = templst;
  779+                templst = w;
  780+        }
  781+        p->n_lval = w->tempoff;
  782+        p->n_name = "";
  783+}
  784+
  785+/*
754786  * look for situations where we can turn * into OREG
 755787  */
 756788 void
     
 !
763795         NODE *ql, *qr;
 764796         CONSZ temp;
 765797 
<>766 -        /*
 767 -         * the size of a TEMP is on multiples of the reg size.
 768 -         */
 769 -        if (p->n_op == TEMP) {
 770 -                struct templst *w = templst;
 771 -                p->n_op = OREG;
 772 -                p->n_rval = FPREG;
 773 -                while (w != NULL) {
 774 -                        if (w->tempnr == p->n_lval)
 775 -                                break;
 776 -                        w = w->next;
 777 -                }
 778 -                if (w == NULL) {
 779 -                        w = tmpalloc(sizeof(struct templst));
 780 -                        w->tempnr = p->n_lval;
 781 -                        w->tempoff = BITOOR(freetemp(szty(p->n_type)));
 782 -                        w->next = templst;
 783 -                        templst = w;
 784 -                }
 785 -                p->n_lval = w->tempoff;
 786 -                p->n_name = "";
 787 -                return;
 788 -        }
  798+        deltemp(p);
789799 
 790800         if (p->n_op == UNARY MUL) {
 791801                 q = p->n_left;
     
 !
861871 void
 862872 saveip(struct interpass *ip)
 863873 {
<> 874+        struct interpass *prol;
  875+
864876         SIMPLEQ_INSERT_TAIL(&ipole, ip, sqelem);
 865877 
 866878         if (ip->type != IP_EPILOG)
 867879                 return;
 868880         saving = -1;
 869881 
<>870 -        deljumps();
  882+        cvtemps(ip);    /* Convert TEMPs to OREGs */
  883+        deljumps();     /* Delete redundant jumps and dead code */
871884 
<> 885+        prol = SIMPLEQ_FIRST(&ipole);
  886+        prol->ip_auto = ip->ip_auto;
  887+        prol->ip_regs = ip->ip_regs;
  888+
  889+#ifdef MYOPTIM
  890+        myoptim(prol);
  891+#endif
  892+
872893         while ((ip = SIMPLEQ_FIRST(&ipole))) {
 873894                 SIMPLEQ_REMOVE_HEAD(&ipole, sqelem);
 874895                 pass2_compile(ip);
 875896         }
 876897 }
 877898 
<> 899+/*
  900+ * Convert TEMPs to OREGs.
  901+ * XXX - ugly.
  902+ */
878903 void
<> 904+cvtemps(struct interpass *epil)
  905+{
  906+        struct interpass *ip;
  907+
  908+        autooff = maxautooff;
  909+        SIMPLEQ_FOREACH(ip, &ipole, sqelem) {
  910+                if (ip->type != IP_NODE)
  911+                        continue;
  912+                walkf(ip->ip_node, deltemp);
  913+        }
  914+        epil->ip_auto = maxautooff;
  915+}
  916+
  917+void
<_879918 deljumps()
 880919 {
 881920         struct interpass *ip, *n;
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 00:20 +0100