Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.20
 
1.21
 
MAIN:ragge:20100421132629
 
code.c
_>147147         struct symtab *sp;
 148148         extern int gotnr;
 149149         TWORD t;
<>150 -        NODE *p;
  150+        NODE *p, *r, *l;
  151+        int o;
151152 
 152153         gotnr = 0;      /* new number for next fun */
 153154         sp = cftnsp;
 154155         t = DECREF(sp->stype);
<>155 -        if (t != STRTY || t != UNIONTY)
  156+        if (t != STRTY && t != UNIONTY)
156157                 return;
 157158         if (argtyp(t, sp->sdf, sp->ssue) != STRMEM)
 158159                 return;
 159160 
<>160 -        /* Move input value to rax */
 161 -        p = tempnode(stroffset, INCREF(t), sp->sdf, sp->ssue);
 162 -        ecomp(movtoreg(p, RAX));
 163 -#if 0
 164 -        /* Create struct assignment */
 165 -        q = block(OREG, NIL, NIL, PTR+STRTY, 0, cftnsp->ssue);
 166 -        q->n_rval = RBP;
 167 -        q->n_lval = 8; /* return buffer offset */
 168 -        q = buildtree(UMUL, q, NIL);
 169 -        p = block(REG, NIL, NIL, PTR+STRTY, 0, cftnsp->ssue);
 170 -        p = buildtree(UMUL, p, NIL);
 171 -        p = buildtree(ASSIGN, q, p);
  161+        /* call memcpy() to put return struct at destination */
  162+#define  cmop(x,y) block(CM, x, y, INT, 0, MKSUE(INT))
  163+        r = tempnode(stroffset, INCREF(t), sp->sdf, sp->ssue);
  164+        l = block(REG, NIL, NIL, INCREF(t), sp->sdf, sp->ssue);
  165+        regno(l) = RAX;
  166+        o = tsize(t, sp->sdf, sp->ssue)/SZCHAR;
  167+        r = cmop(cmop(r, l), bcon(o));
  168+
  169+        blevel++; /* Remove prototype at exit of function */
  170+        sp = lookup(addname("memcpy"), 0);
  171+        if (sp->stype == UNDEF) {
  172+                sp->ssue = MKSUE(VOID);
  173+                p = talloc();
  174+                p->n_op = NAME;
  175+                p->n_sp = sp;
  176+                p->n_sue = sp->ssue;
  177+                p->n_type = VOID|FTN|(PTR<<TSHIFT);
  178+                defid(p, EXTERN);
  179+                nfree(p);
  180+        }
  181+        blevel--;
  182+
  183+        p = doacall(sp, nametree(sp), r);
172184         ecomp(p);
<>173 -#endif
  185+        
  186+
  187+        /* RAX contains destination after memcpy() */
174188 }
 175189 
 176190 /*
     
 !
193207                 sp = cftnsp;
 194208                 if (argtyp(DECREF(sp->stype), sp->sdf, sp->ssue) == STRMEM) {
 195209                         r = block(REG, NIL, NIL, LONG, 0, MKSUE(LONG));
<>196 -                        regno(r) = ngpr++;
  210+                        regno(r) = argregsi[ngpr++];
197211                         p = tempnode(0, r->n_type, r->n_df, r->n_sue);
 198212                         stroffset = regno(p);
 199213                         ecomp(buildtree(ASSIGN, p, r));
     
 !
382396 {
 383397         NODE *p, *r;
 384398 
<>385 -        /* check num args and type */
 386 -        if (a == NULL || a->n_op != CM || a->n_left->n_op == CM ||
 387 -            !ISPTR(a->n_left->n_type))
 388 -                goto bad;
 389 -
390399         /* use the values from the function header */
 391400         p = a->n_left;
 392401         r = buildtree(ASSIGN, structref(ccopy(p), STREF, reg_save_area),
     
 !
404413         tfree(f);
 405414         tfree(a);
 406415         return r;
<>407 -bad:
 408 -        uerror("bad argument to __builtin_stdarg_start");
 409 -        return bcon(0);
410416 }
 411417 
 412418 /*
     
 !
460466         NODE *ap, *r;
 461467         TWORD dt;
 462468 
<>463 -        /* check num args and type */
 464 -        if (a == NULL || a->n_op != CM || a->n_left->n_op == CM ||
 465 -            !ISPTR(a->n_left->n_type) || a->n_right->n_op != TYPE)
 466 -                goto bad;
 467 -
<_468469         ap = a->n_left;
 469470         dt = a->n_right->n_type;
 470471         if (dt <= ULONGLONG || ISPTR(dt)) {
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-19 21:53 +0200