scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 7b4df93c6808bb73a3bfc1389f9f2a15dde30796
parent 7d416c42124594d23b5c26d6951b748a43b4de65
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 26 Jan 2016 14:17:49 +0100

[cc2-z80] Fix emision of strings

Strings of 2 bytes were emitted with DW directives.

Diffstat:
Mcc2/arch/z80/code.c | 28++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/cc2/arch/z80/code.c b/cc2/arch/z80/code.c @@ -152,19 +152,23 @@ size2asm(Type *tp) /* * In z80 we can ignore the alignment */ - switch (tp->size) { - case 1: + if (tp->flags & STRF) { s = "\tDB\t"; - break; - case 2: - s = "\tDW\t"; - break; - case 4: - s = "\tDD\t"; - break; - default: - s = (tp->flags & STRF) ? "\tTEXT\t" : "\tDS\t%llu,"; - break; + } else { + switch (tp->size) { + case 1: + s = "\tDB\t"; + break; + case 2: + s = "\tDW\t"; + break; + case 4: + s = "\tDD\t"; + break; + default: + s = "\tDS\t%llu,"; + break; + } } printf(s, (unsigned long long) tp->size); }