Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.10
 
1.11
 
MAIN:ragge:20140603201950
 
local2.c
_>4040         printf(LABFMT ":\n", label);
 4141 }
 4242 
<>43 -static int prolnum;
 44 -static struct ldq {
 45 -        struct ldq *next;
 46 -        int val;
 47 -        int lab;
 48 -        char *name;
 49 -} *ldq;
 50 -
 51 -
5243 void
 5344 prologue(struct interpass_prolog *ipp)
 5445 {
<>55 -        int i, j;
  46+        int totstk;
5647 
<>57 -        for (j = i = 0; i < MAXREGS; i++)
 58 -                if (TESTBIT(ipp->ipp_regs, i))
 59 -                        j++;
  48+        totstk = p2maxautooff/(SZINT/SZCHAR);
6049 
<>61 -        printf(".LP%d:  .word 0%o\n", prolnum, j);
  50+        if (totstk)
  51+                printf("        .word 0%o\n", totstk);
  52+        printf("%s:\n", ipp->ipp_name);
6253         if (ipp->ipp_vis)
 6354                 printf("        .globl %s\n", ipp->ipp_name);
<>64 -        printf("%s:\n", ipp->ipp_name);
 65 -        printf("        sta 3,@40\n");  /* save ret pc on stack */
 66 -        printf("        lda 2,.LP%d-.,1\n", prolnum);
 67 -        printf("        jsr @45\n");
 68 -        prolnum++;
  55+        printf("        mov 3,0\n");    /* put ret pc in ac0 */
  56+        printf("        jsr @16\n");    /* jump to prolog */
6957 }
 7058 
 7159 void
 7260 eoftn(struct interpass_prolog *ipp)
 7361 {
<>74 -        int i, j;
7562 
 7663         if (ipp->ipp_ip.ip_lbl == 0)
 7764                 return; /* no code needs to be generated */
 7865 
<>79 -        /* return from function code */
 80 -        for (j = i = 0; i < MAXREGS; i++)
 81 -                if (TESTBIT(ipp->ipp_regs, i))
 82 -                        j++;
 83 -        printf("        lda 2,.LP%d-.,1\n", prolnum);
 84 -        printf("        jmp @46\n");
 85 -        printf(".LP%d:  .word 0%o\n", prolnum, j);
 86 -        prolnum++;
 87 -        while (ldq) {
 88 -                printf(".LP%d:  .word 0%o", ldq->lab, ldq->val);
 89 -                if (ldq->name && *ldq->name)
 90 -                        printf("+%s", ldq->name);
 91 -                printf("\n");
 92 -                ldq = ldq->next;
 93 -        }
  66+        printf("        jmp @17\n");
9467 }
 9568 
 9669 /*
     
 !
247220 void
 248221 zzzcode(NODE *p, int c)
 249222 {
<>250 -        struct ldq *ld;
  223+        int pr;
251224 
 252225         switch (c) {
<> 226+
  227+        case 'C'/* remove from stack after subroutine call */
  228+                pr = p->n_qual;
  229+                switch (pr) {
  230+                case 1:
  231+                        printf("\tisz sp\n");
  232+                        break;
  233+                case 2:
  234+                        printf("\tisz sp\n\tisz sp\n");
  235+                        break;
  236+                case 3:
  237+                        printf("\tisz sp\n\tisz sp\n\tisz sp\n");
  238+                        break;
  239+                case 4:
  240+                        printf("\tisz sp\n\tisz sp\n\tisz sp\n\tisz sp\n");
  241+                        break;
  242+                default:
  243+                        printf("        lda 2,[0%o]\n", pr);
  244+                        printf("        lda 3,sp\n");
  245+                        printf("        add 2,3\n");
  246+                        printf("        sta 3,sp\n");
  247+                        break;
  248+                }
  249+                break;
  250+#if 0
253251         case 'A': /* print out a skip ending if any numbers in queue */
 254252                 if (ldq == NULL)
 255253                         return;
     
 !
277275         case 'D': /* fix reference to external variable via indirection */
 278276                 zzzcode(p, 'B');
 279277                 break;
<> 278+#endif
280279 
 281280         default:
 282281                 comperr("zzzcode %c", c);
     
 !
357356 void
 358357 adrcon(CONSZ val)
 359358 {
<>360 -        printf("$" CONFMT, val);
  359+        printf("[" CONFMT "]", val);
361360 }
 362361 
 363362 /*
<>364 - * Conput should only be used by e2print on Nova.
  363+ * Conput prints out a constant.
365364  */
 366365 void
 367366 conput(FILE *fp, NODE *p)
     
 !
373372                 if (p->n_name[0] != '\0') {
 374373                         fprintf(fp, "%s", p->n_name);
 375374                         if (val)
<>376 -                                fprintf(fp, "+%d", val);
  375+                                fprintf(fp, "+0%o", val);
377376                 } else
<>378 -                        fprintf(fp, "%d", val);
  377+                        fprintf(fp, "0%o", val);
379378                 return;
 380379 
 381380         default:
     
 !
423422 void
 424423 adrput(FILE *io, NODE *p)
 425424 {
<> 425+        int i;
426426         /* output an address, with offsets, from p */
 427427 
<> 428+static int looping = 7;
  429+if (looping == 0) {
  430+        looping = 1;
  431+        printf("adrput %p\n", p);
  432+        fwalk(p, e2print, 0);
  433+        looping = 0;
  434+}
428435         if (p->n_op == FLD)
 429436                 p = p->n_left;
 430437 
 431438         switch (p->n_op) {
<> 439+        case ICON:
  440+                /* addressable value of the constant */
  441+                fputc('[', io);
  442+                if (p->n_type == INCREF(CHAR) || p->n_type == INCREF(UCHAR))
  443+                        printf(".byteptr ");
  444+                conput(io, p);
  445+                fputc(']', io);
  446+                break;
432447 
 433448         case NAME:
<>434 -                if (p->n_name[0] != '\0')
  449+                if (p->n_name[0] != '\0') {
435450                         fputs(p->n_name, io);
<>436 -                if (p->n_lval != 0)
 437 -                        fprintf(io, "+" CONFMT, p->n_lval);
 438 -                return;
  451+                        if (p->n_lval != 0)
  452+                                fprintf(io, "+" CONFMT, p->n_lval);
  453+                } else
  454+                        fprintf(io, CONFMT, p->n_lval);
  455+                break;;
439456 
 440457         case OREG:
<>441 -                printf("%d,%s", (int)p->n_lval, rnames[p->n_rval]);
 442 -                return;
  458+                if (p->n_name[0])
  459+                        comperr("name in OREG");
  460+                i = (int)p->n_lval;
  461+                if (i < 0) {
  462+                        putchar('-');
  463+                        i = -i;
  464+                }
  465+                printf("0%o,%s", i, rnames[regno(p)]);
  466+                break;
443467 
<>444 -        case ICON:
 445 -                /* addressable value of the constant */
 446 -                fputc('$', io);
 447 -                conput(io, p);
 448 -                return;
 449 -
450468         case REG:
<>451 -                switch (p->n_type) {
 452 -                case LONGLONG:
 453 -                case ULONGLONG:
 454 -                        fprintf(io, "%%%c%c%c", rnames[p->n_rval][0],
 455 -                            rnames[p->n_rval][1], rnames[p->n_rval][2]);
 456 -                        break;
 457 -                case SHORT:
 458 -                case USHORT:
 459 -                        fprintf(io, "%%%s", &rnames[p->n_rval][2]);
 460 -                        break;
 461 -                default:
 462 -                        fprintf(io, "%s", rnames[p->n_rval]);
 463 -                }
 464 -                return;
  469+                fprintf(io, "%s", rnames[p->n_rval]);
  470+                break;
465471 
 466472         default:
 467473                 comperr("illegal address, op %d, node %p", p->n_op, p);
<>468 -                return;
  474+                break;
469475 
 470476         }
 471477 }
     
 !
508514 int
 509515 COLORMAP(int c, int *r)
 510516 {
<>511 -        int num;
  517+        int num = 0;
512518 
 513519         switch (c) {
 514520         case CLASSA:
<>515 -                num = r[CLASSB] + r[CLASSA];
 516 -                return num < 4;
  521+                num = (r[CLASSA]+r[CLASSB]) < AREGCNT;
  522+                break;
517523         case CLASSB:
<>518 -                num = r[CLASSB] + r[CLASSA];
 519 -                return num < 2;
  524+                num = (r[CLASSB]+r[CLASSA]) < BREGCNT;
  525+                break;
520526         case CLASSC:
<>521 -                return r[CLASSC] < CREGCNT;
  527+                num = r[CLASSC] < CREGCNT;
  528+                break;
522529         case CLASSD:
<>523 -                return r[CLASSD] < DREGCNT;
  530+                num = r[CLASSD] < DREGCNT;
  531+                break;
  532+        case CLASSE:
  533+                num = r[CLASSE] < EREGCNT;
  534+                break;
524535         }
<>525 -        return 0; /* XXX gcc */
  536+        return num;
526537 }
 527538 
 528539 char *rnames[] = {
<>529 -        "0", "1", "2", "3",
 530 -        "050", "051", "052", "053", "054", "055", "056", "057",
 531 -        "060", "061", "062", "063", "064", "065", "066", "067",
 532 -        "070", "071", "072", "073", "074", "075", "076", "077",
 533 -        "041", "040"
  540+        "0", "1", "2", "3", "2", "3", "fp", "sp"
534541 };
 535542 
 536543 /*
     
 !
539546 int
 540547 gclass(TWORD t)
 541548 {
<>542 -        return CLASSA;
  549+        return ISPTR(t) ? CLASSB : CLASSA;
543550 }
 544551 
 545552 /*
     
 !
548555 void
 549556 lastcall(NODE *p)
 550557 {
<> 558+        NODE *op = p;
  559+        int size = 0;
  560+
  561+        p->n_qual = 0;
  562+        if (p->n_op != CALL && p->n_op != FORTCALL && p->n_op != STCALL)
  563+                return;
  564+        for (p = p->n_right; p->n_op == CM; p = p->n_left) {
  565+                if (p->n_right->n_op != ASSIGN)
  566+                        size += szty(p->n_right->n_type);
  567+        }
  568+        if (p->n_op != ASSIGN)
  569+                size += szty(p->n_type);
  570+
  571+        op->n_qual = size; /* XXX */
551572 }
 552573 
 553574 /*
     
 !
556577 int
 557578 special(NODE *p, int shape)
 558579 {
<> 580+        switch (shape) {
  581+        case SLDFPSP:
  582+                return regno(p) == FPREG || regno(p) == STKREG;
  583+        }
559584         return SRNOPE;
 560585 }
 561586 
     
 !
575600 {
 576601         return 0;
 577602 }
<_ 603+
  604+void
  605+storemod(NODE *q, int off)
  606+{
  607+        NODE *l, *r, *p;
  608+
  609+        if (off < MAXZP*2) {
  610+                q->n_op = NAME;
  611+                q->n_name = "";
  612+                q->n_lval = -off/2 + ZPOFF;
  613+        } else {
  614+                l = mklnode(REG, 0, FPREG, INCREF(q->n_type));
  615+                r = mklnode(ICON, off, 0, INT);
  616+                p = mkbinode(PLUS, l, r, INCREF(q->n_type));
  617+                q->n_op = UMUL;
  618+                q->n_left = p;
  619+        }
  620+        q->n_rval = q->n_su = 0;
  621+}
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-23 03:36 +0200