aboutsummaryrefslogtreecommitdiff
path: root/qbe.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-04-03 00:42:09 -0700
committerMichael Forney <mforney@mforney.org>2019-04-03 00:46:08 -0700
commitb3865e402e426387d4cdccdcd249a02d5ba1bc05 (patch)
treec5182df0ecd07259d84fcd5a313cb295c09ab8a6 /qbe.c
parent05e2f624ebe66b4ccc471ce091b3831773bfb4db (diff)
Make member access its own expression type
Diffstat (limited to 'qbe.c')
-rw-r--r--qbe.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/qbe.c b/qbe.c
index a40540a..66cc271 100644
--- a/qbe.c
+++ b/qbe.c
@@ -479,6 +479,8 @@ objectaddr(struct func *f, struct expr *e)
case EXPRSTRING:
d = stringdecl(e);
return d->value;
+ case EXPRMEMBER:
+ return funcinst(f, IADD, &iptr, funcexpr(f, e->member.base), mkintconst(&iptr, e->member.offset));
case EXPRCOMPOUND:
d = mkdecl(DECLOBJECT, e->type, LINKNONE);
funcinit(f, d, e->compound.init);
@@ -599,6 +601,7 @@ funcexpr(struct func *f, struct expr *e)
if (typeprop(e->type) & PROPINT || e->type->kind == TYPEPOINTER)
return mkintconst(e->type->repr, e->constant.i);
return mkfltconst(e->type->repr, e->constant.f);
+ case EXPRMEMBER:
case EXPRCOMPOUND:
l = objectaddr(f, e);
return funcload(f, e->type, l);