Kaynağa Gözat

Use the correct frame pointer register: A6 on Unixes and A5 on everything else. The only
open question is embedded systems (currently it counts as "everything else").

git-svn-id: trunk@22741 -

svenbarth 13 yıl önce
ebeveyn
işleme
786e814d49
2 değiştirilmiş dosya ile 27 ekleme ve 4 silme
  1. 3 3
      compiler/m68k/cpubase.pas
  2. 24 1
      compiler/m68k/cpupi.pas

+ 3 - 3
compiler/m68k/cpubase.pas

@@ -254,9 +254,9 @@ unit cpubase;
       NR_STACK_POINTER_REG = NR_SP;
       RS_STACK_POINTER_REG = RS_SP;
       {# Frame pointer register }
-{ TODO: FIX ME!!! frame pointer is A5 on Amiga, but A6 on unixes?}
-      NR_FRAME_POINTER_REG = NR_A5;
-      RS_FRAME_POINTER_REG = RS_A5;
+{ Frame pointer register (initialized in tm68kprocinfo.init_framepointer) }
+      RS_FRAME_POINTER_REG: tsuperregister = RS_NO;
+      NR_FRAME_POINTER_REG: tregister = NR_NO;
 
       {# Register for addressing absolute data in a position independant way,
          such as in PIC code. The exact meaning is ABI specific. For

+ 24 - 1
compiler/m68k/cpupi.pas

@@ -28,14 +28,37 @@ unit cpupi;
   interface
 
     uses
-      procinfo,cgbase,psub;
+      psub;
 
     type
       tm68kprocinfo = class(tcgprocinfo)
+        procedure init_framepointer;override;
       end;
 
   implementation
 
+    uses
+      procinfo,
+      cpubase,
+      systems;
+
+  { tm68kprocinfo }
+
+    procedure tm68kprocinfo.init_framepointer;
+      begin
+        { ToDo : what about system_m68k_embedded? }
+        if target_info.system in [system_m68k_linux,system_m68k_netbsd,system_m68k_openbsd] then
+          begin
+            RS_FRAME_POINTER_REG:=RS_A6;
+            NR_FRAME_POINTER_REG:=NR_A6;
+          end
+        else
+          begin
+            NR_FRAME_POINTER_REG:=NR_A5;
+            RS_FRAME_POINTER_REG:=RS_A5;
+          end;
+      end;
+
 begin
    cprocinfo:=tm68kprocinfo;
 end.