aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-03-31 20:03:28 -0700
committerMichael Forney <mforney@mforney.org>2021-03-31 20:03:38 -0700
commitad5a1742dd520d8374be275252121ce52cd3a2ce (patch)
tree9c79c332d6472f7b0ff352e167f8441300c65f38
parent5ff1d2fa7f389f68846407667c489fe791113d37 (diff)
downloadcproc-ad5a1742dd520d8374be275252121ce52cd3a2ce.tar.xz
qbe: Slight simplification
-rw-r--r--qbe.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/qbe.c b/qbe.c
index e521af2..01dd2d3 100644
--- a/qbe.c
+++ b/qbe.c
@@ -1083,7 +1083,7 @@ emitrepr(struct repr *r, struct value *v, bool ext)
{
if (!r)
fatal("type has no QBE representation");
- if (v)
+ if (v && v->kind == VALUE_TYPE)
emitvalue(v);
else
putchar(ext ? r->ext : r->base);
@@ -1152,7 +1152,7 @@ emitinst(struct inst **instp, struct inst **instend)
if (inst->res.kind) {
emitvalue(&inst->res);
fputs(" =", stdout);
- emitrepr(inst->res.repr, inst->arg[1] && inst->arg[1]->kind == VALUE_TYPE ? inst->arg[1] : NULL, false);
+ emitrepr(inst->res.repr, inst->arg[1], false);
putchar(' ');
}
fputs(instname[inst->kind], stdout);
@@ -1340,7 +1340,7 @@ emitdata(struct decl *d, struct init *init)
while (init) {
cur = init;
- while (init = init->next, init && init->start * 8 + init->bits.before < cur->end * 8 - cur->bits.after) {
+ while ((init = init->next) && init->start * 8 + init->bits.before < cur->end * 8 - cur->bits.after) {
/*
XXX: Currently, if multiple union members are
initialized, these assertions may not hold.