Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.9
 
1.10
 
MAIN:ragge:20090525191904
 
local2.c
_>5050 static void
 5151 prtprolog(struct interpass_prolog *ipp, int addto)
 5252 {
<>53 -//      static int lwnr;
5453         int i;
 5554 
 5655         /* XXX should look if there is any need to emit this */
 5756         printf("\tpushq %%rbp\n");
 5857         printf("\tmovq %%rsp,%%rbp\n");
<> 58+        addto = (addto+15) & ~15; /* 16-byte aligned */
5959         if (addto)
 6060                 printf("\tsubq $%d,%%rsp\n", addto);
<> 61+
  62+        /* save permanent registers */
6163         for (i = 0; i < MAXREGS; i++)
<>62 -                if (TESTBIT(ipp->ipp_regs, i)) {
  64+                if (TESTBIT(ipp->ipp_regs, i))
6365                         fprintf(stdout, "\tmov %s,-%d(%s)\n",
 6466                             rnames[i], regoff[i], rnames[FPREG]);
 6567 }
<>66 -#if 0
 67 -        if (kflag == 0)
 68 -                return;
6968 
<>70 -        /* if ebx are not saved to stack, it must be moved into another reg */
 71 -        /* check and emit the move before GOT stuff */
 72 -        if (!TESTBIT(ipp->ipp_regs, EBX)) {
 73 -                struct interpass *ip = (struct interpass *)ipp;
 74 -
 75 -                ip = DLIST_PREV(ip, qelem);
 76 -                ip = DLIST_PREV(ip, qelem);
 77 -                ip = DLIST_PREV(ip, qelem);
 78 -                if (ip->type != IP_NODE || ip->ip_node->n_op != ASSIGN ||
 79 -                    ip->ip_node->n_left->n_op != REG)
 80 -                        comperr("prtprolog pic error");
 81 -                ip = (struct interpass *)ipp;
 82 -                ip = DLIST_NEXT(ip, qelem);
 83 -                if (ip->type != IP_NODE || ip->ip_node->n_op != ASSIGN ||
 84 -                    ip->ip_node->n_left->n_op != REG)
 85 -                        comperr("prtprolog pic error2");
 86 -                printf("        movl %s,%s\n",
 87 -                    rnames[ip->ip_node->n_right->n_rval],
 88 -                    rnames[ip->ip_node->n_left->n_rval]);
 89 -                tfree(ip->ip_node);
 90 -                DLIST_REMOVE(ip, qelem);
 91 -        }
 92 -        printf("        call .LW%d\n", ++lwnr);
 93 -        printf(".LW%d:\n", lwnr);
 94 -        printf("        popl %%ebx\n");
 95 -        printf("        addl $_GLOBAL_OFFSET_TABLE_+[.-.LW%d], %%ebx\n", lwnr);
 96 -#endif
 97 -}
 98 -
9969 /*
 10070  * calculate stack size and offsets
 10171  */
     
 !
10979                 addto -= AUTOINIT/SZCHAR;
 11080         for (i = 0; i < MAXREGS; i++)
 11181                 if (TESTBIT(ipp->ipp_regs, i)) {
<>112 -                        addto += SZINT/SZCHAR;
  82+                        addto += SZLONG/SZCHAR;
11383                         regoff[i] = addto;
 11484                 }
 11585         return addto;
     
 !
12595 #ifdef LANG_F77
 12696         if (ipp->ipp_vis)
 12797                 printf("        .globl %s\n", ipp->ipp_name);
<>128 -        printf("        .align 4\n");
  98+        printf("        .align 16\n");
12999         printf("%s:\n", ipp->ipp_name);
 130100 #endif
 131101         /*
     
 !
147117         /* return from function code */
 148118         for (i = 0; i < MAXREGS; i++)
 149119                 if (TESTBIT(ipp->ipp_regs, i))
<>150 -                        fprintf(stdout, "       movl -%d(%s),%s\n",
  120+                        fprintf(stdout, "       movq -%d(%s),%s\n",
151121                             regoff[i], rnames[FPREG], rnames[i]);
 152122 
 153123         /* struct return needs special treatment */
     
 !
158128         } else {
 159129                 printf("        leave\n");
 160130         }
<>161 -        printf("\t.size %s,.-%s\n", ipp->ipp_name,
 162 -            ipp->ipp_name);
  131+        printf("\t.size %s,.-%s\n", ipp->ipp_name, ipp->ipp_name);
163132 }
 164133 
 165134 /*
     
 !
390359 {
 391360         TWORD t = p->n_type;
 392361 
<>393 -        if (t < LONG || t == FLOAT || t > BTMASK)
 394 -                return 4;
 395 -        if (t == LONG || t == ULONG || t == LONGLONG || t == ULONGLONG ||
 396 -            t == DOUBLE)
 397 -                return 8;
  362+        if (p->n_left->n_op == REG)
  363+                return 0; /* not on stack */
398364         if (t == LDOUBLE)
 399365                 return 16;
 400366         if (t == STRTY || t == UNIONTY)
 401367                 return p->n_stsize;
<>402 -        comperr("argsiz");
 403 -        return 0;
  368+        return 8;
404369 }
 405370 
 406371 void
     
 !
422387 #endif
 423388 
 424389         case 'C'/* remove from stack after subroutine call */
<>425 -#if 0
 426 -                if (p->n_left->n_flags & FSTDCALL)
 427 -                        break;
428390                 pr = p->n_qual;
 429391                 if (p->n_op == STCALL || p->n_op == USTCALL)
<>430 -                        pr += 4;
  392+                        pr += 4; /* XXX */
431393                 if (p->n_op == UCALL)
 432394                         return; /* XXX remove ZC from UCALL */
 433395                 if (pr)
<>434 -                        printf("        addl $%d, %s\n", pr, rnames[ESP]);
 435 -#endif
  396+                        printf("        addq $%d, %s\n", pr, rnames[RSP]);
436397                 break;
 437398 
 438399 #if 0
     
 !
514475                 }
 515476                 break;
 516477 #endif
<> 478+        case 'Q': /* emit struct assign */
  479+                /* XXX - optimize for small structs */
  480+                printf("\tmovq $%d,%%rdx\n", p->n_stsize);
  481+                expand(p, INAREG, "\tmovq AR,%rsi\n");
  482+                expand(p, INAREG, "\tleaq AL,%rdi\n\n");
  483+                printf("\tcall memcpy\n");
  484+                break;
  485+
517486         case 'R': /* print opname based on right type */
 518487         case 'L': /* print opname based on left type */
 519488                 switch (getlr(p, c)->n_type) {
     
 !
946915         for (p = p->n_right; p->n_op == CM; p = p->n_left)
 947916                 size += argsiz(p->n_right);
 948917         size += argsiz(p);
<>949 -        if (kflag)
 950 -                size -= 4;
  918+        size = (size+15) & ~15;
  919+        if (size)
  920+                printf("        subq $%d,%s\n", size, rnames[RSP]);
<_951921         op->n_qual = size; /* XXX */
 952922 }
 953923 
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-21 12:11 +0200