Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.102
 
1.103
 
MAIN:ragge:20040605082242
 
reader.c
_>7373 int x2debug;
 7474 int udebug = 0;
 7575 int ftnno;
<>76 -static int thisline;
  76+int thisline;
7777 int fregs;
 7878 
 7979 NODE *nodepole;
     
 !
271271 pass2_compile(struct interpass *ip)
 272272 {
 273273         if (ip->type == IP_NODE) {
<> 274+                thisline = ip->lineno;
274275 #ifdef PCC_DEBUG
 275276                 if (e2debug) {
 276277                         fprintf(stderr, "pass2 called on:\n");
     
 !
280281                 ip->ip_node = deluseless(ip->ip_node);
 281282                 if (ip->ip_node == NULL)
 282283                         return;
<> 284+
  285+                mkhardops(ip->ip_node);
  286+                gencall(ip->ip_node);
283287 #ifdef notyet
 284288                 optim1(ip->ip_node);
 285289 #endif
<>286 -                mkhardops(ip->ip_node);
287290         }
 288291         if (Oflag) {
 289292                 if (ip->type == IP_PROLOG)
     
 !
293296         }
 294297         switch (ip->type) {
 295298         case IP_NODE:
<>296 -                thisline = ip->lineno;
297299                 p2compile(ip->ip_node);
 298300                 tfree(ip->ip_node);
 299301                 break;
 300302         case IP_PROLOG:
<>301 -                prologue(ip->ip_regs, ip->ip_auto);
  303+                prologue(ip->ip_regs, ip->ip_auto, ip->ip_retl);
302304                 break;
 303305         case IP_NEWBLK:
 304306                 newblock(ip->ip_regs, ip->ip_auto);
     
 !
373375          * Assign registers for all instructions.
 374376          */
 375377         genregs(p); /* allocate registers for instructions */
<> 378+        mygenregs(p);
376379 #ifdef PCC_DEBUG
 377380         if (udebug) {
 378381                 fprintf(stderr, "gencode called on:\n");
     
 !
634637         case GOTO:
 635638         case FUNARG:
 636639         case UCALL:
<> 640+        case USTCALL:
637641                 if ((rv = finduni(p, cookie)) < 0) {
 638642                         if (setuni(p, cookie))
 639643                                 goto again;
     
 !
15331537 void
 15341538 mkhardops(NODE *p)
 15351539 {
<>1536 -        struct interpass *ip;
15371540         NODE *r, *l, *q;
 15381541         struct hardops *hop;
 15391542         int ty = optype(p->n_op);
<>1540 -        int addto = 0;
15411543 
 15421544         if (ty == UTYPE)
 15431545                 return mkhardops(p->n_left);
     
 !
15551557                 return;
 15561558         }
 15571559 
<> 1560+        l = p->n_left;
15581561         if (p->n_op == STASG) {
<>1559 -                /* Must push the size first */
 1560 -                q = talloc();
 1561 -                q->n_op = ICON;
 1562 -                q->n_type = INT;
 1563 -                q->n_rval = 0;
 1564 -                q->n_lval = p->n_stsize;
 1565 -                q->n_name = "";
 1566 -                r = talloc();
 1567 -                r->n_op = FUNARG;
 1568 -                r->n_type = INT;
 1569 -                r->n_rval = SZINT;
 1570 -                r->n_left = q;
 1571 -                ip = tmpalloc(sizeof(struct interpass));
 1572 -                ip->type = IP_NODE;
 1573 -                ip->ip_node = r;
 1574 -                pass2_compile(ip);
 1575 -                addto = SZINT;
  1562+                if (l->n_op == UMUL) {
  1563+                        /* make it a pointer reference */
  1564+                        r = l;
  1565+                        l = l->n_left;
  1566+                        nfree(r);
  1567+                } else if (l->n_op == NAME) {
  1568+                        l->n_op = ICON; /* Constant reference */
  1569+                        l->n_type = INCREF(l->n_type);
  1570+                } else
  1571+                        comperr("STASG mot UMUL");
15761572         }
 15771573         r = p->n_right;
<>1578 -        l = p->n_left;
15791574 
 15801575         /*
 15811576          * node p must be converted to a call to fun.
 15821577          * arguments first.
 15831578          */
 15841579         q = talloc();
<>1585 -        q->n_op = FUNARG;
 1586 -        q->n_type = r->n_type;
 1587 -        q->n_left = r;
 1588 -        q->n_rval = szty(q->n_type) * SZINT;
 1589 -        addto += q->n_rval;
 1590 -        ip = tmpalloc(sizeof(struct interpass));
 1591 -        ip->type = IP_NODE;
 1592 -        ip->ip_node = q;
 1593 -        pass2_compile(ip);
  1580+        q->n_op = CM;;
  1581+        q->n_left = l;
  1582+        q->n_right = r;
15941583 
 15951584         if (p->n_op == STASG) {
<>1596 -                /* make it a pointer reference */
 1597 -                if (l->n_op != UMUL)
 1598 -                        comperr("STASG mot UMUL");
 1599 -                r = l;
 1600 -                l = l->n_left;
 1601 -                nfree(r);
  1585+                /* Must push the size */
  1586+                
  1587+                l = talloc();
  1588+                l->n_op = ICON;
  1589+                l->n_type = INT;
  1590+                l->n_rval = 0;
  1591+                l->n_lval = p->n_stsize;
  1592+                l->n_name = "";
  1593+                r = talloc();
  1594+                r->n_op = CM;
  1595+                r->n_left = q;
  1596+                r->n_right = l;
  1597+                q = r;
16021598         }
<>1603 -        q = talloc();
 1604 -        q->n_op = FUNARG;
 1605 -        q->n_type = l->n_type;
 1606 -        q->n_left = l;
 1607 -        q->n_rval = szty(q->n_type) * SZINT;
 1608 -        addto += q->n_rval;
 1609 -        ip = tmpalloc(sizeof(struct interpass));
 1610 -        ip->type = IP_NODE;
 1611 -        ip->ip_node = q;
 1612 -        pass2_compile(ip);
  1599+        p->n_op = CALL;
  1600+        p->n_right = q;
16131601 
 16141602         /* Make function name node */
 16151603         q = talloc();
 16161604         q->n_op = ICON;
<>1617 -        q->n_name = hop->fun;
16181605         q->n_rval = q->n_lval = 0;
<>1619 -
  1606+        q->n_name = hop->fun;
16201607         p->n_left = q;
<>1621 -        p->n_op = UCALL;
 1622 -        p->n_rval = addto;
  1608+
<_16231609         /* Done! */
 16241610 }
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-07-10 17:49 +0200