ref: efc299ce722e23e8732273a3244ffadae9df6407
parent: 384853dbfb1e264e360d552e96c225028e975fd7
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun Jan 22 06:30:15 EST 2017
[cc2-qbe] Add float types to size2asm/size2stack
--- a/cc2/arch/qbe/code.c
+++ b/cc2/arch/qbe/code.c
@@ -250,10 +250,8 @@
{ if (tp->flags & STRF) {return "b";
- } else {+ } else if (tp->flags & INTF) { switch (tp->size) {- case 0:
- return "";
case 1:
return "b";
case 2:
@@ -262,10 +260,14 @@
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
@@ -306,20 +308,23 @@
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
--
⑨