Various bits of cleanup; we should almost be ready to try sending this to the
authorDavid Given <dg@cowlark.com>
Sat, 15 Oct 2016 21:39:38 +0000 (23:39 +0200)
committerDavid Given <dg@cowlark.com>
Sat, 15 Oct 2016 21:39:38 +0000 (23:39 +0200)
assembler soon...

mach/proto/mcg/main.c
mach/proto/mcg/powerpc.c
mach/proto/mcg/procedure.c

index 36696bc..b518bff 100644 (file)
@@ -101,6 +101,8 @@ int main(int argc, char* const argv[])
     else
         outputfile = stdout;
 
+    fprintf(outputfile, ".sect .text\n.sect .rom\n.sect .data\n.sect .bss\n");
+
     /* Reads in the EM, outputs the data sections, parses any code and
      * generates IR trees. */
 
index fbd669e..1c900be 100644 (file)
@@ -30,9 +30,9 @@ struct hop* platform_prologue(void)
        hop_add_insel(hop, "! spills_size = %d bytes", current_proc->spills_size);
        hop_add_insel(hop, "! locals_size = %d bytes", current_proc->locals_size);
        hop_add_insel(hop, "addi sp, sp, %d", -(current_proc->fp_to_ab + current_proc->locals_size));
-       hop_add_insel(hop, "mfspr 0, lr");
+       hop_add_insel(hop, "mfspr r0, lr");
        hop_add_insel(hop, "stw fp, %d(sp)", current_proc->fp_to_st + current_proc->locals_size);
-       hop_add_insel(hop, "stw 0, %d(sp)", current_proc->fp_to_st + current_proc->locals_size + 4);
+       hop_add_insel(hop, "stw r0, %d(sp)", current_proc->fp_to_st + current_proc->locals_size + 4);
        hop_add_insel(hop, "addi fp, sp, %d", current_proc->locals_size);
 
        return hop;
index 1484c2a..320dedf 100644 (file)
@@ -110,6 +110,7 @@ static void emit_procedure(struct procedure* proc)
 {
     int i, j;
 
+    fprintf(outputfile, "\n.sect .text\n");
     for (i=0; i<dominance.preorder.count; i++)
     {
         struct basicblock* bb = dominance.preorder.item[i];