[hackers] [scc] [cc2-qbe] Add float types to size2asm/size2stack || Roberto E. Vargas Caballero
commit 60bbc9b93785a652d0f89146e3eefe9d2d0fb52b
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sun Jan 22 11:30:15 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sun Jan 22 11:30:15 2017 +0100
[cc2-qbe] Add float types to size2asm/size2stack
diff --git a/cc2/arch/qbe/code.c b/cc2/arch/qbe/code.c
index a0b7bc7..bca8020 100644
--- a/cc2/arch/qbe/code.c
+++ b/cc2/arch/qbe/code.c
_AT_@ -250,10 +250,8 @@ size2asm(Type *tp)
{
if (tp->flags & STRF) {
return "b";
- } else {
+ } else if (tp->flags & INTF) {
switch (tp->size) {
- case 0:
- return "";
case 1:
return "b";
case 2:
_AT_@ -262,10 +260,14 @@ size2asm(Type *tp)
return "w";
case 8:
return "l";
- default:
- abort();
}
+ } else if (tp->flags & FLOATF) {
+ if (tp->size == 4)
+ return "s";
+ else if (tp->size == 8)
+ return "d";
}
+ abort();
}
void
_AT_@ -306,20 +308,23 @@ data(Node *np)
static char *
size2stack(Type *tp)
{
- switch (tp->size) {
- case 0:
- return "w";
- case 1:
- return "w";
- case 2:
- return "w";
- case 4:
- return "w";
- case 8:
- return "l";
- default:
- abort();
+ if (tp->flags & INTF) {
+ switch (tp->size) {
+ case 0:
+ case 1:
+ case 2:
+ case 4:
+ return "w";
+ case 8:
+ return "l";
+ }
+ } else if (tp->flags & FLOATF) {
+ if (tp->size == 4)
+ return "s";
+ else if (tp->size == 8)
+ return "d";
}
+ abort();
}
void
Received on Sun Jan 22 2017 - 11:30:29 CET
This archive was generated by hypermail 2.3.0
: Sun Jan 22 2017 - 11:36:17 CET