diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2016-02-24 10:57:08 -0500 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2016-02-24 10:57:08 -0500 |
commit | 08f2c03e30fa4ee1df24d382a1d0a21c879786bb (patch) | |
tree | 7617c691c6e6df5368b7777fc203ded0d69836d1 /lisc/isel.c | |
parent | 43d3f241ba45ca44195f544d660e3a88c82eff08 (diff) | |
download | roux-08f2c03e30fa4ee1df24d382a1d0a21c879786bb.tar.gz |
support memory class arguemnts
Diffstat (limited to 'lisc/isel.c')
-rw-r--r-- | lisc/isel.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lisc/isel.c b/lisc/isel.c index 1db3087..b883fa7 100644 --- a/lisc/isel.c +++ b/lisc/isel.c @@ -660,7 +660,7 @@ selpar(Fn *fn, Ins *i0, Ins *i1) { AClass *ac, *a; Ins *i; - int ni, ns, stk, al; + int ni, ns, s, al; Ref r, r1; ac = alloc((i1-i0) * sizeof ac[0]); @@ -669,15 +669,19 @@ selpar(Fn *fn, Ins *i0, Ins *i1) curi = insb; ni = ns = 0; assert(NAlign == 3); - stk = -2; + s = 4; for (i=i0, a=ac; i<i1; i++, a++) { switch (a->inmem) { case 1: - assert(!"argc todo 2"); + assert(a->align <= 4); /* todo, bigger alignments */ + if (a->align == 4) + s = (s+3) & -4; + fn->tmp[i->to.val].slot = -s; /* HACK! */ + s += a->size; continue; case 2: - stk -= 2; - *curi++ = (Ins){OLoad, i->to, {SLOT(stk)}, i->cls}; + *curi++ = (Ins){OLoad, i->to, {SLOT(-s)}, i->cls}; + s += 2; continue; } r1 = rarg(a->cls[0], &ni, &ns); |