summaryrefslogtreecommitdiff
path: root/6
diff options
context:
space:
mode:
authorOri Bernstein <orib@google.com>2012-08-01 14:56:13 -0400
committerOri Bernstein <orib@google.com>2012-08-01 14:56:13 -0400
commitcf2310b32d61c276fd315107fc673852789c103f (patch)
treeb4f509cac8ab2925a214519db39953b6b1bbe198 /6
parent3f183eeb7fa732ae7cdd87aa4399db38e57f6445 (diff)
downloadmc-cf2310b32d61c276fd315107fc673852789c103f.tar.gz
Rename stuff a bit.
The naming for this code sucks.
Diffstat (limited to '6')
-rw-r--r--6/isel.c11
-rw-r--r--6/simp.c32
2 files changed, 22 insertions, 21 deletions
diff --git a/6/isel.c b/6/isel.c
index 00ea779..3e0ee29 100644
--- a/6/isel.c
+++ b/6/isel.c
@@ -56,12 +56,15 @@ static Mode mode(Node *n)
Type *t;
t = tybase(exprtype(n));
+ /* FIXME: What should the mode for, say, structs be when we have no
+ * intention of loading /through/ the pointer? For now, we'll just say it's
+ * the pointer mode, since we expect to address through the pointer */
switch (t->type) {
case Tyfloat32: return ModeF; break;
case Tyfloat64: return ModeD; break;
default:
if (stacktype(t))
- return ModeNone;
+ return ModeQ;
switch (size(n)) {
case 1: return ModeB; break;
case 2: return ModeS; break;
@@ -70,10 +73,7 @@ static Mode mode(Node *n)
}
break;
}
- /* FIXME: huh. what should the mode for, say, structs
- * be when we have no intention of loading /through/ the
- * pointer? */
- return ModeNone;
+ return ModeQ;
}
static Loc *loc(Isel *s, Node *n)
@@ -614,6 +614,7 @@ Loc *selexpr(Isel *s, Node *n)
void locprint(FILE *fd, Loc *l, char spec)
{
+ assert(l->mode);
switch (l->type) {
case Loclitl:
assert(spec == 'i' || spec == 'x' || spec == 'u');
diff --git a/6/simp.c b/6/simp.c
index 526cf88..1cb55cb 100644
--- a/6/simp.c
+++ b/6/simp.c
@@ -522,7 +522,7 @@ static void simpblk(Simp *s, Node *n)
}
}
-static Node *lowerlit(Simp *s, Node *lit, Node ***l, size_t *nl)
+static Node *simplit(Simp *s, Node *lit, Node ***l, size_t *nl)
{
Node *n, *d, *r;
char lbl[128];
@@ -686,7 +686,7 @@ static Node *simplazy(Simp *s, Node *n, Node *r)
return r;
}
-static Node *lowerslice(Simp *s, Node *n, Node *dst)
+static Node *simpslice(Simp *s, Node *n, Node *dst)
{
Node *t;
Node *start, *end;
@@ -711,7 +711,7 @@ static Node *lowerslice(Simp *s, Node *n, Node *dst)
return t;
}
-static Node *lowercast(Simp *s, Node *n)
+static Node *simpcast(Simp *s, Node *n)
{
Node **args;
Node *sz;
@@ -844,7 +844,7 @@ Node *assign(Simp *s, Node *lhs, Node *rhs)
return r;
}
-static Node *lowertup(Simp *s, Node *n, Node *dst)
+static Node *simptup(Simp *s, Node *n, Node *dst)
{
Node *pdst, *pval, *val, *sz, *stor, **args;
Node *r;
@@ -872,7 +872,7 @@ static Node *lowertup(Simp *s, Node *n, Node *dst)
return dst;
}
-static Node *lowerucon(Simp *s, Node *n, Node *dst)
+static Node *simpucon(Simp *s, Node *n, Node *dst)
{
Node *tmp, *u, *tag, *elt, *sz;
Node *r;
@@ -953,7 +953,7 @@ static Node *rval(Simp *s, Node *n, Node *dst)
r->expr.type = exprtype(n);
break;
case Oslice:
- r = lowerslice(s, n, dst);
+ r = simpslice(s, n, dst);
break;
case Oidx:
t = idxaddr(s, n);
@@ -972,14 +972,14 @@ static Node *rval(Simp *s, Node *n, Node *dst)
}
break;
case Ocons:
- r = lowerucon(s, n, dst);
+ r = simpucon(s, n, dst);
break;
case Otup:
- r = lowertup(s, n, dst);
+ r = simptup(s, n, dst);
break;
case Ocast:
/* slice -> ptr cast */
- r = lowercast(s, n);
+ r = simpcast(s, n);
break;
/* fused ops:
@@ -1031,10 +1031,10 @@ static Node *rval(Simp *s, Node *n, Node *dst)
r = n;
break;
case Lstr: case Lseq: case Lflt:
- r = lowerlit(s, n, &s->blobs, &s->nblobs);
+ r = simplit(s, n, &s->blobs, &s->nblobs);
break;
case Lfunc:
- r = lowerlit(s, n, &file->file.stmts, &file->file.nstmts);
+ r = simplit(s, n, &file->file.stmts, &file->file.nstmts);
break;
}
break;
@@ -1178,7 +1178,7 @@ static void flatten(Simp *s, Node *f)
append(s, s->endlbl);
}
-static Func *lowerfn(Simp *s, char *name, Node *n, int export)
+static Func *simpfn(Simp *s, char *name, Node *n, int export)
{
size_t i;
Func *fn;
@@ -1248,7 +1248,7 @@ static void fillglobls(Stab *st, Htab *globls)
free(k);
}
-static void lowerdcl(Node *dcl, Htab *globls, Func ***fn, size_t *nfn, Node ***blob, size_t *nblob)
+static void simpdcl(Node *dcl, Htab *globls, Func ***fn, size_t *nfn, Node ***blob, size_t *nblob)
{
Simp s = {0,};
char *name;
@@ -1262,7 +1262,7 @@ static void lowerdcl(Node *dcl, Htab *globls, Func ***fn, size_t *nfn, Node ***b
if (isconstfn(dcl)) {
if (!dcl->decl.isextern && !dcl->decl.isgeneric) {
- f = lowerfn(&s, name, dcl->decl.init, dcl->decl.isexport);
+ f = simpfn(&s, name, dcl->decl.init, dcl->decl.isexport);
lappend(fn, nfn, f);
}
} else {
@@ -1273,7 +1273,7 @@ static void lowerdcl(Node *dcl, Htab *globls, Func ***fn, size_t *nfn, Node ***b
else if (!dcl->decl.isconst && !dcl->decl.init)
lappend(&s.blobs, &s.nblobs, dcl);
else
- die("We don't lower globls with nonlit inits yet...");
+ die("We don't simp globls with nonlit inits yet...");
}
*blob = s.blobs;
*nblob = s.nblobs;
@@ -1309,7 +1309,7 @@ void gen(Node *file, char *out)
case Nuse: /* nothing to do */
break;
case Ndecl:
- lowerdcl(n, globls, &fn, &nfn, &blob, &nblob);
+ simpdcl(n, globls, &fn, &nfn, &blob, &nblob);
break;
default:
die("Bad node %s in toplevel", nodestr(n->type));