Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.171
 
1.172
 
MAIN:ragge:20140524151953
 
local2.c
_>446446                 break;
 447447 
 448448         case 'C'/* remove from stack after subroutine call */
<>449 -#ifdef notyet
450449                 if (p->n_left->n_flags & FSTDCALL)
 451450                         break;
<>452 -#endif
453451                 pr = p->n_qual;
<>454 -                if (p->n_op == STCALL || p->n_op == USTCALL)
 455 -                        pr += 4;
456452                 if (p->n_flags & FFPPOP)
 457453                         printf("        fstp    %%st(0)\n");
 458454                 if (p->n_op == UCALL)
     
 !
538534 #endif
 539535                 break;
 540536 
<>541 -        case 'P': /* push hidden argument on stack */
 542 -                printf("\tleal -%d(%%ebp),", stkpos);
 543 -                adrput(stdout, getlr(p, '1'));
 544 -                printf("\n\tpushl ");
 545 -                adrput(stdout, getlr(p, '1'));
 546 -                putchar('\n');
 547 -                break;
 548 -
549537         case 'Q': /* emit struct assign */
 550538                 /*
<>551 -                 * With <= 16 bytes, put out mov's, otherwise use movsb/w/l.
  539+                 * Put out some combination of movs{b,w,l}
552540                  * esi/edi/ecx are available.
<>553 -                 * XXX should not need esi/edi if not rep movsX.
 554 -                 * XXX can save one insn if src ptr in reg.
555541                  */
<>556 -                switch (p->n_stsize) {
 557 -                case 1:
 558 -                        expand(p, INAREG, "     movb (%esi),%cl\n");
 559 -                        expand(p, INAREG, "     movb %cl,AL\n");
 560 -                        break;
 561 -                case 2:
 562 -                        expand(p, INAREG, "     movw (%esi),%cx\n");
 563 -                        expand(p, INAREG, "     movw %cx,AL\n");
 564 -                        break;
 565 -                case 4:
 566 -                        expand(p, INAREG, "     movl (%esi),%ecx\n");
 567 -                        expand(p, INAREG, "     movl %ecx,AL\n");
 568 -                        break;
 569 -                default:
 570 -                        expand(p, INAREG, "     leal AL,%edi\n");
 571 -                        if (p->n_stsize <= 16 && (p->n_stsize & 3) == 0) {
 572 -                                printf("        movl (%%esi),%%ecx\n");
 573 -                                printf("        movl %%ecx,(%%edi)\n");
 574 -                                printf("        movl 4(%%esi),%%ecx\n");
 575 -                                printf("        movl %%ecx,4(%%edi)\n");
 576 -                                if (p->n_stsize > 8) {
 577 -                                        printf("        movl 8(%%esi),%%ecx\n");
 578 -                                        printf("        movl %%ecx,8(%%edi)\n");
 579 -                                }
 580 -                                if (p->n_stsize == 16) {
 581 -                                        printf("\tmovl 12(%%esi),%%ecx\n");
 582 -                                        printf("\tmovl %%ecx,12(%%edi)\n");
 583 -                                }
 584 -                        } else {
 585 -                                if (p->n_stsize > 4) {
 586 -                                        printf("\tmovl $%d,%%ecx\n",
 587 -                                            p->n_stsize >> 2);
 588 -                                        printf("        rep movsl\n");
 589 -                                }
 590 -                                if (p->n_stsize & 2)
 591 -                                        printf("        movsw\n");
 592 -                                if (p->n_stsize & 1)
 593 -                                        printf("        movsb\n");
  542+                expand(p, INAREG, "     leal AL,%edi\n");
  543+                if (p->n_stsize < 32) {
  544+                        int i = p->n_stsize >> 2;
  545+                        while (i) {
  546+                                expand(p, INAREG, "     movsl\n");
  547+                                i--;
594548                         }
<>595 -                        break;
  549+                } else {
  550+                        printf("\tmovl $%d,%%ecx\n", p->n_stsize >> 2);
  551+                        printf("        rep movsl\n");
596552                 }
<> 553+                if (p->n_stsize & 2)
  554+                        printf("        movsw\n");
  555+                if (p->n_stsize & 1)
  556+                        printf("        movsb\n");
597557                 break;
 598558 
 599559         case 'S': /* emit eventual move after cast from longlong */
     
 !
1012972         outfargs(ip, ary, nn, cwp, 'u');
 1013973 }
 1014974 
<> 975+static NODE *
  976+lptr(NODE *p)
  977+{
  978+        if (p->n_op == ASSIGN && p->n_right->n_op == REG &&
  979+            regno(p->n_right) == EBP)
  980+                return p->n_right;
  981+        if (p->n_op == FUNARG && p->n_left->n_op == REG &&
  982+            regno(p->n_left) == EBP)
  983+                return p->n_left;
  984+        return NIL;
  985+}
  986+
  987+/*
  988+ * Find arg reg that should be struct reference instead.
  989+ */
  990+static void
  991+updatereg(NODE *p, void *arg)
  992+{
  993+        NODE *q;
  994+
  995+        if (p->n_op != STCALL)
  996+                return;
  997+        if (p->n_right->n_op != CM)
  998+                p = p->n_right;
  999+        else for (p = p->n_right;
  1000+            p->n_op == CM && p->n_left->n_op == CM; p = p->n_left)
  1001+                ;
  1002+        if (p->n_op == CM) {
  1003+                if ((q = lptr(p->n_left)))
  1004+                        ;
  1005+                else
  1006+                        q = lptr(p->n_right);
  1007+        } else
  1008+                q = lptr(p);
  1009+        if (q == NIL)
  1010+                comperr("bad STCALL hidden reg");
  1011+
  1012+        /* q is now the hidden arg */
  1013+        q->n_op = MINUS;
  1014+        q->n_type = INCREF(CHAR);
  1015+        q->n_left = mklnode(REG, 0, EBP, INCREF(CHAR));
  1016+        q->n_right = mklnode(ICON, stkpos, 0, INT);
  1017+}
  1018+
10151019 void
 10161020 myreader(struct interpass *ipole)
 10171021 {
     
 !
10261030                 if (ip->ip_node->n_op == XASM)
 10271031                         fixxfloat(ip, ip->ip_node);
 10281032         }
<> 1033+        if (stkpos != p2autooff) {
  1034+                DLIST_FOREACH(ip, ipole, qelem) {
  1035+                        if (ip->type != IP_NODE)
  1036+                                continue;
  1037+                        walkf(ip->ip_node, updatereg, 0);
  1038+                }
  1039+        }
10291040         if (stkpos > p2autooff)
 10301041                 p2autooff = stkpos;
 10311042         if (stkpos > p2maxautooff)
     
 !
12021213         p->n_qual = 0;
 12031214         if (p->n_op != CALL && p->n_op != FORTCALL && p->n_op != STCALL)
 12041215                 return;
<>1205 -        for (p = p->n_right; p->n_op == CM; p = p->n_left) {
  1216+        for (p = p->n_right; p->n_op == CM; p = p->n_left) {
12061217                 if (p->n_right->n_op != ASSIGN)
 12071218                         size += argsiz(p->n_right);
 12081219         }
 12091220         if (p->n_op != ASSIGN)
 12101221                 size += argsiz(p);
<>1211 -        
  1222+
<_12121223 #if defined(MACHOABI)
 12131224         int newsize = (size + 15) & ~15;        /* stack alignment */
 12141225         int align = newsize-size;
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-11-01 02:04 +0100