From 8040e25abcad4b106514315a53f4723e3a387959 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Wed, 13 Feb 2019 15:29:54 -0800 Subject: Make basic store independent of ABI --- qbe.c | 18 ++++++------------ 1 file 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: -- cgit v1.2.3