Parcourir la source

m68k: needs_unaligned helper. returns true when the given reference with the given size needs to be loaded with unaligned support on the given cpu

git-svn-id: trunk@33806 -
Károly Balogh il y a 9 ans
Parent
commit
b6d845e732
1 fichiers modifiés avec 8 ajouts et 0 suppressions
  1. 8 0
      compiler/m68k/cpubase.pas

+ 8 - 0
compiler/m68k/cpubase.pas

@@ -364,6 +364,7 @@ unit cpubase;
     function isintregister(reg : tregister) : boolean;
     function fpuregopsize: TOpSize; {$ifdef USEINLINE}inline;{$endif USEINLINE}
     function fpuregsize: aint; {$ifdef USEINLINE}inline;{$endif USEINLINE}
+    function needs_unaligned(const refalignment: aint; const size: tcgsize): boolean;
     function isregoverlap(reg1: tregister; reg2: tregister): boolean;
 
     function inverse_cond(const c: TAsmCond): TAsmCond; {$ifdef USEINLINE}inline;{$endif USEINLINE}
@@ -553,6 +554,13 @@ implementation
         result:=fpu_regsize[current_settings.fputype = fpu_coldfire];
       end;
 
+    function needs_unaligned(const refalignment: aint; const size: tcgsize): boolean;
+      begin
+        result:=not(CPUM68K_HAS_UNALIGNED in cpu_capabilities[current_settings.cputype]) and
+                (refalignment = 1) and
+                (tcgsize2size[size] > 1);
+      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