Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.96
 
1.97
 
MAIN:ragge:20040525155236
 
reader.c
_>8383 void saveip(struct interpass *ip);
 8484 void deljumps(void);
 8585 void deltemp(NODE *p);
<> 86+void mkhardops(NODE *p);
8687 void optdump(struct interpass *ip);
 8788 void cvtemps(struct interpass *epil);
 8889 int findops(NODE *p, int);
     
 !
279280                 ip->ip_node = deluseless(ip->ip_node);
 280281                 if (ip->ip_node == NULL)
 281282                         return;
<> 283+#ifdef notyet
  284+                optim1(ip->ip_node);
  285+#endif
  286+                mkhardops(ip->ip_node);
282287         }
 283288         if (Oflag) {
 284289                 if (ip->type == IP_PROLOG)
     
 !
376381 #endif
 377382         switch (p->n_op) {
 378383         case CBRANCH:
<>379 -                o = p->n_left->n_op;
 380 -                gencode(p, FORCC);
 381 -                cbgen(o, p->n_right->n_lval);
  384+                /* Only emit branch insn if RESCC */
  385+                if (table[TBLIDX(p->n_left->n_su)].rewrite & RESCC) {
  386+                        o = p->n_left->n_op;
  387+                        gencode(p, FORCC);
  388+                        cbgen(o, p->n_right->n_lval);
  389+                } else
  390+                        gencode(p, FORCC);
382391                 break;
 383392         case FORCE:
 384393                 gencode(p->n_left, INTAREG|INTBREG);
     
 !
744753         if ((p->n_su & RMASK) && (p->n_su & LMASK) &&
 745754             right + szty(p->n_left->n_type) > fregs &&
 746755             left + szty(p->n_right->n_type) > fregs) {
<> 756+                int r = p->n_right->n_op;
  757+                int l = p->n_left->n_op;
747758                 /*
 748759                  * Must store one subtree. Store the tree
 749760                  * with highest SU, or left.
<> 761+                 * Be careful to not try to store an OREG.
750762                  */
<>751 -                if (right > left)
  763+                if (r == OREG && l == OREG)
  764+                        comperr("sucomp: cannot generate code, node %p", p);
  765+                if ((right > left && r != OREG) || l == OREG)
752766                         p->n_right = store(p->n_right);
 753767                 else
 754768                         p->n_left = store(p->n_left);
     
 !
15941608 #endif
 15951609         }
 15961610 
<_ 1611+/*
  1612+ * Convert unimplemented ops to function calls.
  1613+ */
  1614+void
  1615+mkhardops(NODE *p)
  1616+{
  1617+        struct interpass *ip;
  1618+        NODE *r, *l, *q;
  1619+        struct hardops *hop;
  1620+        int ty = optype(p->n_op);
  1621+
  1622+        if (ty == UTYPE)
  1623+                return mkhardops(p->n_left);
  1624+        if (ty != BITYPE)
  1625+                return;
  1626+        for (hop = hardops; hop->op != 0; hop++)
  1627+                if (hop->op == p->n_op && hop->type == p->n_type)
  1628+                        break;
  1629+
  1630+        /* Traverse down only if find hardop failed */
  1631+        /* otherwise traversal down will be done in pass2_compile() */
  1632+        if (hop->op == 0) {
  1633+                mkhardops(p->n_left);
  1634+                mkhardops(p->n_right);
  1635+                return;
  1636+        }
  1637+
  1638+        r = p->n_right;
  1639+        l = p->n_left;
  1640+        /*
  1641+         * node p must be converted to a call to fun.
  1642+         * arguments first.
  1643+         */
  1644+        q = talloc();
  1645+        q->n_op = FUNARG;
  1646+        q->n_type = r->n_type;
  1647+        q->n_left = r;
  1648+        q->n_rval = szty(q->n_type) * SZINT;
  1649+        ip = tmpalloc(sizeof(struct interpass));
  1650+        ip->type = IP_NODE;
  1651+        ip->ip_node = q;
  1652+        pass2_compile(ip);
  1653+
  1654+        q = talloc();
  1655+        q->n_op = FUNARG;
  1656+        q->n_type = l->n_type;
  1657+        q->n_left = l;
  1658+        q->n_rval = szty(q->n_type) * SZINT;
  1659+        ip = tmpalloc(sizeof(struct interpass));
  1660+        ip->type = IP_NODE;
  1661+        ip->ip_node = q;
  1662+        pass2_compile(ip);
  1663+
  1664+        /* Make function name node */
  1665+        q = talloc();
  1666+        q->n_op = ICON;
  1667+        q->n_name = hop->fun;
  1668+        q->n_rval = q->n_lval = 0;
  1669+
  1670+        p->n_left = q;
  1671+        p->n_op = UCALL;
  1672+        p->n_rval = szty(p->n_type) * SZINT * 2;
  1673+        /* Done! */
  1674+}
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-08-31 06:16 +0200