shithub: scc

Download patch

ref: da15338f25bea8abab12d0eb8ac9ccf1881ae288
parent: 1af75a9c4d18e2913ef10fdf4ce98b6193d1e032
author: Quentin Rameau <quinq@fifth.space>
date: Fri Jun 3 08:47:56 EDT 2016

[cc2] fix qbe call instruction parameters generation

qbe parser doesn't accept newlines in call PARAMS sets.

--- a/cc2/arch/qbe/code.c
+++ b/cc2/arch/qbe/code.c
@@ -133,8 +133,8 @@
 	[ASCALLL] = {.fun = call, .letter = 'l'},
 	[ASCALLD] = {.fun = call, .letter = 'd'},
 	[ASCALL] = {.fun = ecall},
-	[ASPAR] = {.fun = param, .txt = "\t\t%s %s,\n"},
-	[ASPARE] = {.fun = param, .txt = "\t\t%s %s\n"},
+	[ASPAR] = {.fun = param, .txt = "%s %s, "},
+	[ASPARE] = {.fun = param, .txt = "%s %s"},
 };
 
 static char buff[ADDR_LEN];
@@ -415,7 +415,7 @@
 
        strcpy(to, addr2txt(&pc->to));
        strcpy(from, addr2txt(&pc->from1));
-       printf("\t%s =%c\tcall\t%s(\n", to, p->letter, from);
+       printf("\t%s =%c\tcall\t%s(", to, p->letter, from);
 }
 
 static void
@@ -430,7 +430,7 @@
 static void
 ecall(void)
 {
-	puts("\t\t)");
+	puts(")");
 }
 
 static void