summaryrefslogtreecommitdiff
path: root/6
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-10-21 23:11:41 -0700
committerOri Bernstein <ori@eigenstate.org>2015-11-06 00:38:56 -0800
commit26e54d3c7cbaab5efa5e63a32b87b49328fd5f6b (patch)
tree9059ca3618cafeda101f73a402a32763b4b75127 /6
parent7f04fcc98b500a390d5b89ca766982afa6feb168 (diff)
downloadmc-26e54d3c7cbaab5efa5e63a32b87b49328fd5f6b.tar.gz
Pass the basic tests. we still fail complex ones.
Diffstat (limited to '6')
-rw-r--r--6/simp.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/6/simp.c b/6/simp.c
index f0aa0e3..88a60cd 100644
--- a/6/simp.c
+++ b/6/simp.c
@@ -510,6 +510,7 @@ static Node *uconid(Simp *s, Node *n)
{
Ucon *uc;
+ n = rval(s, n, NULL);
if (exprop(n) != Oucon)
return load(addr(s, n, mktype(n->loc, Tyuint)));
@@ -860,6 +861,10 @@ static Node *lval(Simp *s, Node *n)
case Oucon: r = rval(s, n, NULL); break;
case Oarr: r = rval(s, n, NULL); break;
case Ogap: r = temp(s, n); break;
+
+ /* not actually expressible as lvalues in syntax, but we generate them */
+ case Oudata: r = rval(s, n, NULL); break;
+ case Outag: r = rval(s, n, NULL); break;
default:
fatal(n, "%s cannot be an lvalue", opstr[exprop(n)]);
break;
@@ -1713,7 +1718,8 @@ static Node *rval(Simp *s, Node *n, Node *dst)
case Otupget:
assert(exprop(args[1]) == Olit);
i = args[1]->expr.args[0]->lit.intval;
- r = tupget(s, args[0], i, dst);
+ t = rval(s, args[0], NULL);
+ r = tupget(s, t, i, dst);
break;
case Obad:
die("bad operator");
@@ -1762,7 +1768,9 @@ static Node *simp(Simp *s, Node *n)
case Nifstmt: simpif(s, n, NULL); break;
case Nloopstmt: simploop(s, n); break;
case Niterstmt: simpiter(s, n); break;
- case Nmatchstmt: simpmatch(s, n); break;
+ case Nmatchstmt: /*simpmatch(s, n); break;*/
+ simp(s, gensimpmatch(n));
+ break;
case Nexpr:
if (islbl(n))
append(s, n);