aboutsummaryrefslogtreecommitdiff
path: root/qbe.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-02-13 15:29:54 -0800
committerMichael Forney <mforney@mforney.org>2019-02-13 19:42:25 -0800
commit8040e25abcad4b106514315a53f4723e3a387959 (patch)
treefdc1ca82cd666bca9d05036181a4ff1efd776b00 /qbe.c
parenta0c394bdd0f0c554f504ee8119e8304551653562 (diff)
Make basic store independent of ABI
Diffstat (limited to 'qbe.c')
-rw-r--r--qbe.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/qbe.c b/qbe.c
index fde25e2..a45d449 100644
--- a/qbe.c
+++ b/qbe.c
@@ -243,19 +243,13 @@ funcstore(struct function *f, struct type *t, struct value *addr, struct value *
error(&tok.loc, "cannot store to 'const' object");
switch (t->kind) {
case TYPEBASIC:
- switch (t->basic.kind) {
- case BASICBOOL:
- case BASICCHAR: op = ISTOREB; break;
- case BASICSHORT: op = ISTOREH; break;
- case BASICINT: op = ISTOREW; break;
- case BASICLONG: op = ISTOREL; break;
- case BASICLONGLONG: op = ISTOREL; break;
- case BASICFLOAT: op = ISTORES; break;
- case BASICDOUBLE: op = ISTORED; break;
- case BASICLONGDOUBLE:
- fatal("'long double' store is not yet supported");
+ switch (t->size) {
+ case 1: op = ISTOREB; break;
+ case 2: op = ISTOREH; break;
+ case 4: op = typeprop(t) & PROPFLOAT ? ISTORES : ISTOREW; break;
+ case 8: op = typeprop(t) & PROPFLOAT ? ISTORED : ISTOREL; break;
default:
- fatal("internal error; unknown basic type %d", t->basic.kind);
+ fatal("internal error; unimplemented store");
}
break;
case TYPEPOINTER: