summaryrefslogtreecommitdiff
path: root/6
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-03-03 21:24:31 -0800
committerOri Bernstein <ori@eigenstate.org>2017-03-03 21:24:31 -0800
commit1debb50046fe922df2ee5c0cc411f1b0749a474f (patch)
tree0d4137fc2dfca22dd9dbfb41a7fa144ce99be2ee /6
parent6d09377e5186878ab25d9fcae4bac0b90bcc4b58 (diff)
downloadmc-1debb50046fe922df2ee5c0cc411f1b0749a474f.tar.gz
Clean up Plan 9 assembly generation code.
Unused vars and stuff.
Diffstat (limited to '6')
-rw-r--r--6/genp9.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/6/genp9.c b/6/genp9.c
index d5ea670..10092f5 100644
--- a/6/genp9.c
+++ b/6/genp9.c
@@ -357,9 +357,9 @@ static void genfunc(FILE *fd, Func *fn, Htab *globls, Htab *strtab)
writeasm(fd, &is, fn);
}
-static size_t writetextbytes(FILE *fd, char *name, size_t off, char *p, size_t sz)
+static size_t writetextbytes(FILE *fd, char *p, size_t sz)
{
- size_t i, len;
+ size_t i;
assert(sz != 0);
for (i = 0; i < sz; i++)
@@ -368,7 +368,7 @@ static size_t writetextbytes(FILE *fd, char *name, size_t off, char *p, size_t s
return sz;
}
-static size_t encodetextmin(FILE *fd, uvlong val, size_t off, char *lbl)
+static size_t encodetextmin(FILE *fd, uvlong val)
{
size_t i, shift, n;
uint8_t b;
@@ -396,7 +396,7 @@ static size_t encodetextmin(FILE *fd, uvlong val, size_t off, char *lbl)
return i;
}
-static size_t writetextblob(FILE *fd, Blob *b, size_t off, char *lbl)
+static size_t writetextblob(FILE *fd, Blob *b)
{
size_t i, n;
@@ -421,7 +421,7 @@ static size_t writetextblob(FILE *fd, Blob *b, size_t off, char *lbl)
n += 8;
break;
case Btimin:
- n += encodetextmin(fd, b->ival, off+n, lbl);
+ n += encodetextmin(fd, b->ival);
break;
case Btref:
if (b->ref.isextern || b->ref.str[0] == '.')
@@ -432,11 +432,11 @@ static size_t writetextblob(FILE *fd, Blob *b, size_t off, char *lbl)
n += 8;
break;
case Btbytes:
- n += writetextbytes(fd, lbl, off+n, b->bytes.buf, b->bytes.len);
+ n += writetextbytes(fd, b->bytes.buf, b->bytes.len);
break;
case Btseq:
for (i = 0; i < b->seq.nsub; i++)
- n += writetextblob(fd, b->seq.sub[i], off+n, lbl);
+ n += writetextblob(fd, b->seq.sub[i]);
break;
case Btpad:
for (i = 0; i < b->npad; i++)
@@ -450,7 +450,6 @@ static size_t writetextblob(FILE *fd, Blob *b, size_t off, char *lbl)
static void gentype(FILE *fd, Type *ty)
{
Blob *b;
- char lbl[1024];
ty = tydedup(ty);
if (ty->type == Tyvar || ty->isemitted)
@@ -460,14 +459,11 @@ static void gentype(FILE *fd, Type *ty)
b = tydescblob(ty);
if (!b)
return;
- if (b->isglobl) {
- fprintf(fd, "TEXT %s%s+0(SB),2,$0\n", Symprefix, b->lbl, (uvlong)blobsz(b));
- bprintf(lbl, sizeof lbl, "%s%s", Symprefix, b->lbl);
- } else {
- fprintf(fd, "TEXT %s%s<>+0(SB),2,$0\n", Symprefix, b->lbl, (uvlong)blobsz(b));
- bprintf(lbl, sizeof lbl, "%s%s<>", Symprefix, b->lbl);
- }
- writetextblob(fd, b, 0, lbl);
+ if (b->isglobl)
+ fprintf(fd, "TEXT %s%s+0(SB),2,$0\n", Symprefix, b->lbl);
+ else
+ fprintf(fd, "TEXT %s%s<>+0(SB),2,$0\n", Symprefix, b->lbl);
+ writetextblob(fd, b);
}
static void gentypes(FILE *fd)