Browse Source

m68k: new isregoverlap function, which returns true if the two registers overlap (same type and subreg). use the new r68kbss.inc for regnumber_count_bsstart. other minor tweaks.

git-svn-id: trunk@32655 -
Károly Balogh 9 years ago
parent
commit
9c12615f09
1 changed files with 12 additions and 5 deletions
  1. 12 5
      compiler/m68k/cpubase.pas

+ 12 - 5
compiler/m68k/cpubase.pas

@@ -115,7 +115,6 @@ unit cpubase;
       {$i r68ksup.inc}
       RS_SP = RS_A7;
 
-      { ? whatever... }
       R_SUBWHOLE = R_SUBNONE;
 
       { Available Registers }
@@ -137,8 +136,8 @@ unit cpubase;
 
       maxfpuregs = 8;
 
-{ TODO: FIX BSSTART}
-      regnumber_count_bsstart = 16;
+      { include regnumber_count_bsstart }
+      {$i r68kbss.inc}
 
       regnumber_table : array[tregisterindex] of tregister = (
         {$i r68knum.inc}
@@ -357,6 +356,7 @@ unit cpubase;
 
     function isaddressregister(reg : tregister) : boolean;
     function isintregister(reg : tregister) : boolean;
+    function isregoverlap(reg1: tregister; reg2: tregister): boolean;
 
     function inverse_cond(const c: TAsmCond): TAsmCond; {$ifdef USEINLINE}inline;{$endif USEINLINE}
     function conditions_equal(const c1, c2: TAsmCond): boolean; {$ifdef USEINLINE}inline;{$endif USEINLINE}
@@ -511,16 +511,23 @@ implementation
       end;
 
 
-    function isaddressregister(reg : tregister) : boolean;
+    function isaddressregister(reg : tregister) : boolean; {$ifdef USEINLINE}inline;{$endif USEINLINE}
       begin
         result:=getregtype(reg)=R_ADDRESSREGISTER;
       end;
 
-    function isintregister(reg : tregister) : boolean;
+    function isintregister(reg : tregister) : boolean; {$ifdef USEINLINE}inline;{$endif USEINLINE}
       begin
         result:=getregtype(reg)=R_INTREGISTER;
       end;
 
+    // the function returns true, if the registers overlap (subreg of the same superregister and same type)
+    function isregoverlap(reg1: tregister; reg2: tregister): boolean;
+      begin
+        tregisterrec(reg1).subreg:=R_SUBNONE;
+        tregisterrec(reg2).subreg:=R_SUBNONE;
+        result:=reg1=reg2;
+      end;
 
     function inverse_cond(const c: TAsmCond): TAsmCond; {$ifdef USEINLINE}inline;{$endif USEINLINE}
       const