Browse Source

* fold the MIPS tabitype into tabi as the former wasn't really used or hooked up anyway; this way the ABI can be set using -Ca<abi>

Sven/Sarah Barth 1 year ago
parent
commit
f584c559fd
4 changed files with 33 additions and 49 deletions
  1. 21 1
      compiler/mips/cpugas.pas
  2. 2 46
      compiler/mips/cpuinfo.pas
  3. 4 0
      compiler/systems.inc
  4. 6 2
      compiler/systems.pas

+ 21 - 1
compiler/mips/cpugas.pas

@@ -57,6 +57,26 @@ unit cpugas;
       globals, verbose, itcpugas, cgbase, cgutils;
       globals, verbose, itcpugas, cgbase, cgutils;
 
 
 
 
+      { abi strings as accepted by
+        GNU assembler in -abi=XXX option }
+      function gas_abitype(abi : tabi) : string;
+        begin
+          case abi of
+            abi_eabi:
+              result:='eabi';
+            abi_mips_o32:
+              result:='32';
+            abi_mips_n32:
+              result:='n32';
+            abi_mips_o64:
+              result:='o64';
+            abi_mips_n64:
+              result:='64';
+            else
+              result:='32';
+          end;
+        end;
+
       function asm_regname(reg : TRegister) : string;
       function asm_regname(reg : TRegister) : string;
 
 
         begin
         begin
@@ -83,7 +103,7 @@ unit cpugas;
       begin
       begin
          result := Inherited MakeCmdLine;
          result := Inherited MakeCmdLine;
          { ABI selection }
          { ABI selection }
-         Replace(result,'$ABI','-mabi='+abitypestr[mips_abi]);
+         Replace(result,'$ABI','-mabi='+gas_abitype(target_info.abi));
          { ARCH selection }
          { ARCH selection }
          Replace(result,'$ARCH','-march='+lower(cputypestr[current_settings.cputype]));
          Replace(result,'$ARCH','-march='+lower(cputypestr[current_settings.cputype]));
 //          Replace(result,'$ARCH','-march=pic32mx -mtune=pic32mx');      
 //          Replace(result,'$ARCH','-march=pic32mx -mtune=pic32mx');      

+ 2 - 46
compiler/mips/cpuinfo.pas

@@ -19,7 +19,8 @@ Unit CPUInfo;
 Interface
 Interface
 
 
   uses
   uses
-    globtype;
+    globtype,
+    systems;
 
 
 Type
 Type
    bestreal = double;
    bestreal = double;
@@ -47,17 +48,6 @@ Type
 
 
    tfputype =(fpu_none,fpu_soft,fpu_mips2,fpu_mips3);
    tfputype =(fpu_none,fpu_soft,fpu_mips2,fpu_mips3);
 
 
-   tabitype = 
-     (
-     abi_none,
-     abi_default,
-     abi_o32,
-     abi_n32,
-     abi_o64,
-     abi_n64,
-     abi_eabi
-     );
-
 Const
 Const
    {# Size of native extended floating point type }
    {# Size of native extended floating point type }
    extended_size = 8;
    extended_size = 8;
@@ -92,20 +82,6 @@ Const
      'MIPS2','MIPS3'
      'MIPS2','MIPS3'
    );
    );
 
 
-   { abi strings as accepted by 
-     GNU assembler in -abi=XXX option }
-   abitypestr : array[tabitype] of string[4] =
-     ({ abi_none    } '',
-      { abi_default } '32',
-      { abi_o32     } '32',
-      { abi_n32     } 'n32',
-      { abi_o64     } 'o64',
-      { abi_n64     } '64',
-      { abi_eabi    } 'eabi'
-     );
-
-   mips_abi : tabitype = abi_default;
-
 type
 type
    tcpuflags=(
    tcpuflags=(
      CPUMIPS_HAS_CMOV,             { conditional move instructions (mips4+) }
      CPUMIPS_HAS_CMOV,             { conditional move instructions (mips4+) }
@@ -248,26 +224,6 @@ const
    level3optimizerswitches = level2optimizerswitches;
    level3optimizerswitches = level2optimizerswitches;
    level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [];
    level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [];
 
 
-function SetMipsABIType(const s : string) : boolean;
-
 Implementation
 Implementation
 
 
-uses
-  cutils;
-
-function SetMipsABIType(const s : string) : boolean;
-
-  var
-    abi : tabitype;
-  begin
-    SetMipsABIType:=false;
-    for abi := low(tabitype) to high(tabitype) do
-      if (lower(s)=abitypestr[abi]) then
-        begin
-          mips_abi:=abi;
-          SetMipsABIType:=true;
-          break;
-        end;
-  end;
-           
 end.
 end.

+ 4 - 0
compiler/systems.inc

@@ -389,6 +389,10 @@
             ,abi_i386_dynalignedstack
             ,abi_i386_dynalignedstack
             ,abi_xtensa_windowed
             ,abi_xtensa_windowed
             ,abi_xtensa_call0
             ,abi_xtensa_call0
+            ,abi_mips_o32
+            ,abi_mips_n32
+            ,abi_mips_o64
+            ,abi_mips_n64
        );
        );
 
 
        tcgbackend = (
        tcgbackend = (

+ 6 - 2
compiler/systems.pas

@@ -490,7 +490,7 @@ interface
          (name: 'AIX'    ; supported:{$if defined(powerpc) or defined(powerpc64)}true{$else}false{$endif}),
          (name: 'AIX'    ; supported:{$if defined(powerpc) or defined(powerpc64)}true{$else}false{$endif}),
          (name: 'DARWIN'    ; supported:{$if defined(powerpc) or defined(powerpc64)}true{$else}false{$endif}),
          (name: 'DARWIN'    ; supported:{$if defined(powerpc) or defined(powerpc64)}true{$else}false{$endif}),
          (name: 'ELFV2'  ; supported:{$if defined(powerpc64)}true{$else}false{$endif}),
          (name: 'ELFV2'  ; supported:{$if defined(powerpc64)}true{$else}false{$endif}),
-         (name: 'EABI'   ; supported:{$if defined(arm)}true{$else}false{$endif}),
+         (name: 'EABI'   ; supported:{$if defined(arm) or defined(mips)}true{$else}false{$endif}),
          (name: 'ARMEB'  ; supported:{$ifdef FPC_ARMEB}true{$else}false{$endif}),
          (name: 'ARMEB'  ; supported:{$ifdef FPC_ARMEB}true{$else}false{$endif}),
          (name: 'EABIHF' ; supported:{$if defined(arm)}true{$else}false{$endif}),
          (name: 'EABIHF' ; supported:{$if defined(arm)}true{$else}false{$endif}),
          (name: 'OLDWIN32GNU'; supported:{$ifdef I386}true{$else}false{$endif}),
          (name: 'OLDWIN32GNU'; supported:{$ifdef I386}true{$else}false{$endif}),
@@ -504,7 +504,11 @@ interface
          (name: 'RISCV64LPD'; supported:{$if defined(riscv64)}true{$else}false{$endif}),
          (name: 'RISCV64LPD'; supported:{$if defined(riscv64)}true{$else}false{$endif}),
          (name: 'LINUX386_SYSV'; supported:{$if defined(i386)}true{$else}false{$endif}),
          (name: 'LINUX386_SYSV'; supported:{$if defined(i386)}true{$else}false{$endif}),
          (name: 'WINDOWED'; supported:{$if defined(xtensa)}true{$else}false{$endif}),
          (name: 'WINDOWED'; supported:{$if defined(xtensa)}true{$else}false{$endif}),
-         (name: 'CALL0'; supported:{$if defined(xtensa)}true{$else}false{$endif})
+         (name: 'CALL0'; supported:{$if defined(xtensa)}true{$else}false{$endif}),
+         (name: 'O32'; supported:{$if defined(mips)}true{$else}false{$endif}),
+         (name: 'N32'; supported:{$if defined(mips)}true{$else}false{$endif}),
+         (name: 'O64'; supported:{$if defined(mips)}true{$else}false{$endif}),
+         (name: 'N64'; supported:{$if defined(mips)}true{$else}false{$endif})
        );
        );
 
 
        cgbackend2str: array[tcgbackend] of ansistring = (
        cgbackend2str: array[tcgbackend] of ansistring = (