Browse Source

* only pass the 16-bit zero page registers to the register allocator

Nikolay Nikolov 1 month ago
parent
commit
c0c0ce9f4d
1 changed files with 7 additions and 4 deletions
  1. 7 4
      compiler/mos6502/cgcpu.pas

+ 7 - 4
compiler/mos6502/cgcpu.pas

@@ -188,11 +188,14 @@ unit cgcpu;
         regmap:=get_register_map_for_system(target_info);
         { pass 2 registers less to the register allocator, because we use
           RS_RZW0 as a stack pointer, and RS_RZW1 as a frame pointer }
-        SetLength(usable,regmap.BRegCount+regmap.WRegCount-2);
-        for I:=0 to regmap.BRegCount-1 do
-          usable[I]:=RS_RZB_FIRST+I;
+        //SetLength(usable,regmap.BRegCount+regmap.WRegCount-2);
+        //for I:=0 to regmap.BRegCount-1 do
+        //  usable[I]:=RS_RZB_FIRST+I;
+        //for I:=0 to regmap.WRegCount-3 do
+        //  usable[I+regmap.BRegCount]:=RS_RZW_FIRST+I+2;
+        SetLength(usable,regmap.WRegCount-2);
         for I:=0 to regmap.WRegCount-3 do
-          usable[I+regmap.BRegCount]:=RS_RZW_FIRST+I+2;
+          usable[I]:=RS_RZW_FIRST+I+2;
         {for I:=low(usable) to high(usable) do
           Writeln(usable[I]);}
         rg[R_INTREGISTER]:=trgintcpu.create(R_INTREGISTER,R_SUBWHOLE,usable,first_int_imreg,[RS_RZW1]);