Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.227
 
1.228
 
MAIN:ragge:20080625193321
 
reader.c
_>311311                 deflab(ip->ip_lbl);
 312312                 break;
 313313         case IP_ASM:
<>314 -                printf("%s", ip->ip_asm);
  314+                printf(ip->ip_asm);
315315                 break;
 316316         default:
 317317                 cerror("emit %d", ip->type);
     
 !
589589         p->n_rval = DECRA(p->n_reg, 0);
 590590 }
 591591 
<> 592+#ifndef XASM_TARGARG
  593+#define XASM_TARGARG(x,y) 0
  594+#endif
  595+
592596 /*
 593597  * printout extended assembler.
 594598  */
     
 !
599603         int n = 1, o = 0;
 600604         char *w;
 601605 
<>602 -        for (q = p->n_left; q->n_op == CM; q = q->n_left)
 603 -                n++;
 604 -        nary = tmpalloc(sizeof(NODE *)*n);
 605 -        o = n;
 606 -        for (q = p->n_left; q->n_op == CM; q = q->n_left) {
 607 -                gencode(q->n_right->n_left, INREGS);
 608 -                nary[--o] = q->n_right;
 609 -        }
 610 -        gencode(q->n_left, INREGS);
 611 -        nary[--o] = q;
  606+        if (p->n_left->n_op != ICON || p->n_left->n_type != STRTY) {
  607+                for (q = p->n_left; q->n_op == CM; q = q->n_left)
  608+                        n++;
  609+                nary = tmpalloc(sizeof(NODE *)*n);
  610+                o = n;
  611+                for (q = p->n_left; q->n_op == CM; q = q->n_left) {
  612+                        gencode(q->n_right->n_left, INREGS);
  613+                        nary[--o] = q->n_right;
  614+                }
  615+                gencode(q->n_left, INREGS);
  616+                nary[--o] = q;
  617+        } else
  618+                nary = 0;
612619 
 613620         w = p->n_name;
 614621         putchar('\t');
 615622         while (*w != 0) {
 616623                 if (*w == '%') {
 617624                         if (w[1] == '%')
 618625                                 putchar('%');
<> 626+                        else if (XASM_TARGARG(w, nary))
  627+                                ; /* handled by target */
619628                         else if (w[1] < '0' || w[1] > (n + '0'))
<>620 -                                uerror("bad xasm arg number");
  629+                                uerror("bad xasm arg number %c", w[1]);
621630                         else
 622631                                 adrput(stdout, nary[(int)w[1]-'0']->n_left);
 623632                         w++;
<>624 -                } else if (*w == '\\') {
 625 -                        w++;
 626 -                        switch (*w) {
 627 -                                case 'n': putchar('\n'); break;
 628 -                                case 't': putchar('\t'); break;
 629 -                                case '\\': putchar('\\'); break;
 630 -                        }
  633+                } else if (*w == '\\') { /* Always 3-digit octal */
  634+                        int num = *++w - '0';
  635+                        num = (num << 3) + *++w - '0';
  636+                        num = (num << 3) + *++w - '0';
  637+                        putchar(num);
631638                 } else
 632639                         putchar(*w);
 633640                 w++;
     
 !
12051212 /*
 12061213  * change numeric argument redirections to the correct node type after
 12071214  * cleaning up the other nodes.
<> 1215+ * be careful about input operands that may have different value than output.
12081216  */
 12091217 static void
 12101218 delnums(NODE *p, void *arg)
 12111219 {
<>1212 -        NODE *r = arg;
  1220+        struct interpass *ip = arg, *ip2;
  1221+        NODE *r = ip->ip_node->n_left;
12131222         NODE *q;
 12141223         char *c;
 12151224         int cnt;
     
 !
12181227                 return; /* not numeric */
 12191228         if ((q = listarg(r, p->n_name[0] - '0', &cnt)) == NIL)
 12201229                 comperr("bad delnums");
<>1221 -        tfree(p->n_left);
  1230+        /* move original node to dest */
  1231+        ip2 = ipnode(mkbinode(ASSIGN, tcopy(q->n_left), p->n_left,
  1232+            p->n_left->n_type));
  1233+        DLIST_INSERT_BEFORE(ip, ip2, qelem);
  1234+
12221235         p->n_left = tcopy(q->n_left);
 12231236         c = q->n_name;
 12241237         if (*c == '=')
     
 !
12271240 }
 12281241 
 12291242 /*
<>1230 - * Check that given constraints are valid.  Currently only cc and memory.
 1231 - */
 1232 -static void
 1233 -ccheck(NODE *p, void *arg)
 1234 -{
 1235 -        if (p->n_op == ICON && p->n_type == STRTY)
 1236 -                return; /* no constraints */
 1237 -
 1238 -        if (strcmp(p->n_name, "cc") == 0 || strcmp(p->n_name, "memory") == 0)
 1239 -                return;
 1240 -#ifdef notyet
 1241 -        if (myccheck(p))
 1242 -                return;
 1243 -#endif
 1244 -        comperr("unsupporter xasm constraint %s", p->n_name);
 1245 -}
 1246 -
 1247 -/*
12481243  * Ensure that a node is correct for the destination.
 12491244  */
 12501245 static void
     
 !
12541249         struct interpass *ip2;
 12551250         TWORD t = p->n_left->n_type;
 12561251         NODE *q, *r;
<>1257 -        int cw;
  1252+        int cw, ooff;
12581253 
 12591254         if (myxasm(ip, p))
 12601255                 return/* handled by target-specific code */
     
 !
12841279         case '5': case '6': case '7': case '8': case '9':
 12851280                 break;
 12861281 
<> 1282+        case 'm': /* memory operand */
  1283+                if (p->n_left->n_op != REG && p->n_left->n_op != TEMP)
  1284+                        break;
  1285+                /* store and reload value */
  1286+                q = p->n_left;
  1287+                r = (cw & XASMINOUT ? tcopy(q) : q);
  1288+                ooff = BITOOR(freetemp(szty(t)));
  1289+                p->n_left = mklnode(OREG, ooff, FPREG, t);
  1290+                if ((cw & XASMASG) == 0) {
  1291+                        ip2 = ipnode(mkbinode(ASSIGN,
  1292+                            mklnode(OREG, ooff, FPREG, t), q, t));
  1293+                        DLIST_INSERT_BEFORE(ip, ip2, qelem);
  1294+                }
  1295+                if (cw & (XASMASG|XASMINOUT)) {
  1296+                        /* output parameter */
  1297+                        ip2 = ipnode(mkbinode(ASSIGN, r,
  1298+                            mklnode(OREG, ooff, FPREG, t), t));
  1299+                        DLIST_INSERT_AFTER(ip, ip2, qelem);
  1300+                }
  1301+                break;
  1302+
12871303         case 'n': /* numeric constant */
 12881304                 if (p->n_left->n_op != ICON)
 12891305                         uerror("constant required");
     
 !
13041320         DLIST_FOREACH(ip, pole, qelem) {
 13051321                 if (ip->type != IP_NODE || ip->ip_node->n_op != XASM)
 13061322                         continue;
<> 1323+                thisline = ip->lineno;
13071324                 p = ip->ip_node->n_left;
 13081325 
<> 1326+                if (p->n_op == ICON && p->n_type == STRTY)
  1327+                        continue;
  1328+
13091329                 /* replace numeric redirections with its underlying type */
<>1310 -                flist(p, delnums, p);
  1330+                flist(p, delnums, ip);
  1331+
13111332                 /*
 13121333                  * Ensure that the arg nodes can be directly addressable
 13131334                  * We decide that everything shall be LTYPE here.
 13141335                  */
 13151336                 flist(p, ltypify, ip);
<>1316 -
 1317 -                p = ip->ip_node->n_right;
 1318 -                /* Check validity of statement constraints */
 1319 -                flist(p, ccheck, 0);
<_13201337         }
 13211338 }
 13221339 
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-16 19:31 +0200