ref: 09c9fde65f9ee0cd014980450c3065c607c84e28
parent: e9673ae0c19b8dfc8df20080c7b3fc5a7208e7d8
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Apr 4 12:39:57 EDT 2016
[cc2] Do not use size2asm in default initializer QBE IR lacks fill with value command, so the previous implementation was wrong. This implementation takes the approach of using always a fill command with any non initialized data. It is simpler for us, and it is simpler for QBE.
--- a/cc2/arch/qbe/code.c
+++ b/cc2/arch/qbe/code.c
@@ -34,6 +34,8 @@
{
char *s;
+ /* In qbe we can ignore the aligment because it handles it */
+
if (tp->flags & STRF) {
abort();
} else {
@@ -51,11 +53,10 @@
s = "q\t";
break;
default:
- s = "z\t%llu\t";
- break;
+ abort();
}
}
- printf(s, (unsigned long long) tp->size);
+ fputs(s, stdout);
}
void
@@ -65,12 +66,10 @@
return;
if (sym->kind == GLOB)
fputs("export ", stdout);
- printf("data %c%s = {\n", sigil(sym), sym->name);
+ printf("data $%s = {\n", sym->name);
if (sym->type.flags & INITF)
return;
- putchar('\t');
- size2asm(&sym->type);
- puts("0\n}");
+ printf("\tz\t%llu\n}\n", (unsigned long long) sym->type.size);
}
void
--
⑨