2
0
Эх сурвалжийг харах

+ some basic stuff for MIPS64

florian 3 жил өмнө
parent
commit
e9e8013316

+ 5 - 0
compiler/constexp.pas

@@ -26,6 +26,9 @@ unit constexp;
 
 interface
 
+  uses
+    sfpux80;
+
 type  Tconstexprint=record
         overflow:boolean;
         case signed:boolean of
@@ -37,6 +40,8 @@ type  Tconstexprint=record
 
       errorproc=procedure (i:longint);
 
+      TConstExprFloat = float128;
+
 {"Uses verbose" gives a dependency on cpuinfo through globals. This leads
  build trouble when compiling the directory utils, since the cpu directory
  isn't searched there. Therefore we use a procvar and make verbose install

+ 6 - 2
compiler/entfile.pas

@@ -161,7 +161,9 @@ const
     { 19 } 32 {'riscv32'},
     { 20 } 64 {'riscv64'},
     { 21 } 32 {'xtensa'},
-    { 22 } 16 {'z80'}
+    { 22 } 16 {'z80'},
+    { 23 } 64 {'mips64'},
+    { 24 } 64 {'mips64el'}
     );
   CpuAluBitSize : array[tsystemcpu] of longint =
     (
@@ -187,7 +189,9 @@ const
     { 19 } 32 {'riscv32'},
     { 20 } 64 {'riscv64'},
     { 21 } 32 {'xtensa'},
-    { 22 }  8 {'z80'}
+    { 22 }  8 {'z80'},
+    { 23 } 64 {'mips64'},
+    { 24 } 64 {'mips64el'}
     );
 {$endif generic_cpu}
 

+ 3 - 0
compiler/fpcdefs.inc

@@ -262,14 +262,17 @@
 
 {$ifdef mipsel}
   {$define mips}
+  {$define mips32}
 {$else not mipsel}
   { Define both mips and mipseb if mipsel is not defined
     but mips cpu is wanted. }
   {$ifdef mipseb}
     {$define mips}
+    {$define mips32}
   {$endif mipseb}
   {$ifdef mips}
     {$define mipseb}
+    {$define mips32}
   {$endif mips}
 {$endif mipsel}
 

+ 7 - 0
compiler/globals.pas

@@ -541,10 +541,17 @@ interface
         fputype : fpu_none;
   {$endif avr}
   {$ifdef mips}
+  {$ifdef mips64}
+        cputype : cpu_mips3;
+        optimizecputype : cpu_mips3;
+        asmcputype : cpu_none;
+        fputype : fpu_mips3;
+  {$else mips64}
         cputype : cpu_mips2;
         optimizecputype : cpu_mips2;
         asmcputype : cpu_none;
         fputype : fpu_mips2;
+  {$endif mips64}
   {$endif mips}
   {$ifdef jvm}
         cputype : cpu_none;

+ 6 - 2
compiler/systems.inc

@@ -56,7 +56,9 @@
              cpu_riscv32,                  { 19 }
              cpu_riscv64,                  { 20 }
              cpu_xtensa,                   { 21 }
-             cpu_z80                       { 22 }
+             cpu_z80,                      { 22 }
+             cpu_mips64,                   { 23 }
+             cpu_mips64el                  { 24 }
        );
 
        tasmmode= (asmmode_none
@@ -205,7 +207,9 @@
              system_m68k_sinclairql,    { 113 }
              system_wasm32_wasi,        { 114 }
              system_aarch64_freebsd,    { 115 }
-             system_aarch64_embedded    { 116 }
+             system_aarch64_embedded,   { 116 }
+             system_mips64_linux,       { 117 }
+             system_mips64el_linux      { 118 }
        );
 
      type

+ 10 - 3
compiler/systems.pas

@@ -479,7 +479,7 @@ interface
             ('','i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64',
              'mips','arm', 'powerpc64', 'avr', 'mipsel','jvm', 'i8086',
              'aarch64', 'wasm32', 'sparc64', 'riscv32', 'riscv64', 'xtensa',
-             'z80');
+             'z80', 'mips64', 'mips64el');
 
        abiinfo : array[tabi] of tabiinfo = (
          (name: 'DEFAULT'; supported: true),
@@ -1123,7 +1123,7 @@ begin
   default_target(system_avr_embedded);
 {$endif avr}
 
-{$ifdef mips}
+{$ifdef mips32}
 {$ifdef mipsel}
   {$ifdef cpumipsel}
     default_target(source_info.system);
@@ -1133,7 +1133,7 @@ begin
 {$else mipsel}
   default_target(system_mipseb_linux);
 {$endif mipsel}
-{$endif mips}
+{$endif mips32}
 
 {$ifdef jvm}
   default_target(system_jvm_java32);
@@ -1204,6 +1204,13 @@ begin
   {$endif ndef default_target_set}
 {$endif xtensa}
 
+{$ifdef mips64}
+  default_target(system_mips64_linux);
+{$endif mips64}
+
+{$ifdef mips64el}
+  default_target(system_mips64el_linux);
+{$endif mips64el}
 end;
 
 

+ 152 - 2
compiler/systems/i_linux.pas

@@ -964,7 +964,7 @@ unit i_linux;
 
        system_mipseb_linux_info : tsysteminfo =
           (
-            system       : system_mipseb_LINUX;
+            system       : system_mipseb_linux;
             name         : 'Linux for MIPSEB';
             shortname    : 'Linux';
             flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,
@@ -1034,7 +1034,7 @@ unit i_linux;
 
        system_mipsel_linux_info : tsysteminfo =
           (
-            system       : system_mipsel_LINUX;
+            system       : system_mipsel_linux;
             name         : 'Linux for MIPSEL';
             shortname    : 'Linux';
             flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,
@@ -1102,6 +1102,146 @@ unit i_linux;
             llvmdatalayout : 'e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32-S64';
           );
 
+       system_mips64_linux_info : tsysteminfo =
+          (
+            system       : system_mips64_linux;
+            name         : 'Linux for MIPS64';
+            shortname    : 'Linux';
+            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,
+                            tf_requires_proper_alignment,tf_library_needs_pic,
+                            tf_pic_uses_got,tf_safecall_exceptions,
+                            tf_smartlink_sections,tf_has_winlike_resources,tf_supports_hidden_symbols];
+            cpu          : cpu_mips64;
+            unit_env     : 'LINUXUNITS';
+            extradefines : 'UNIX;HASUNIX';
+            exeext       : '';
+            defext       : '.def';
+            scriptext    : '.sh';
+            smartext     : '.sl';
+            unitext      : '.ppu';
+            unitlibext   : '.ppl';
+            asmext       : '.s';
+            objext       : '.o';
+            resext       : '.res';
+            resobjext    : '.or';
+            sharedlibext : '.so';
+            staticlibext : '.a';
+            staticlibprefix : 'libp';
+            sharedlibprefix : 'lib';
+            sharedClibext : '.so';
+            staticClibext : '.a';
+            staticClibprefix : 'lib';
+            sharedClibprefix : 'lib';
+            importlibprefix : 'libimp';
+            importlibext : '.a';
+//            p_ext_support : false;
+            Cprefix      : '';
+            newline      : #10;
+            dirsep       : '/';
+            assem        : as_gas;
+            assemextern  : as_gas;
+            link         : ld_none;
+            linkextern   : ld_linux;
+            ar           : ar_gnu_ar;
+            res          : res_elf;
+            dbg          : dbg_stabs;
+            script       : script_unix;
+            endian       : endian_big;
+            alignment    :
+              (
+                procalign       : 4;
+                loopalign       : 4;
+                jumpalign       : 0;
+                jumpalignskipmax    : 0;
+                coalescealign   : 0;
+                coalescealignskipmax: 0;
+                constalignmin   : 0;
+                constalignmax   : 8;
+                varalignmin     : 0;
+                varalignmax     : 8;
+                localalignmin   : 4;
+                localalignmax   : 8;
+                recordalignmin  : 0;
+                recordalignmax  : 8;
+                maxCrecordalign : 8
+              );
+            first_parm_offset : 0;
+            stacksize    : 32*1024*1024;
+            stackalign   : 8;
+            abi : abi_default;
+            llvmdatalayout : 'e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32-S64';
+          );
+
+       system_mips64el_linux_info : tsysteminfo =
+          (
+            system       : system_mips64el_linux;
+            name         : 'Linux for MIPS64EL';
+            shortname    : 'Linux';
+            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,
+                            tf_requires_proper_alignment,tf_library_needs_pic,
+                            tf_pic_uses_got,tf_safecall_exceptions,
+                            tf_smartlink_sections,tf_has_winlike_resources,tf_supports_hidden_symbols];
+            cpu          : cpu_mips64el;
+            unit_env     : 'LINUXUNITS';
+            extradefines : 'UNIX;HASUNIX';
+            exeext       : '';
+            defext       : '.def';
+            scriptext    : '.sh';
+            smartext     : '.sl';
+            unitext      : '.ppu';
+            unitlibext   : '.ppl';
+            asmext       : '.s';
+            objext       : '.o';
+            resext       : '.res';
+            resobjext    : '.or';
+            sharedlibext : '.so';
+            staticlibext : '.a';
+            staticlibprefix : 'libp';
+            sharedlibprefix : 'lib';
+            sharedClibext : '.so';
+            staticClibext : '.a';
+            staticClibprefix : 'lib';
+            sharedClibprefix : 'lib';
+            importlibprefix : 'libimp';
+            importlibext : '.a';
+//            p_ext_support : false;
+            Cprefix      : '';
+            newline      : #10;
+            dirsep       : '/';
+            assem        : as_gas;
+            assemextern  : as_gas;
+            link         : ld_none;
+            linkextern   : ld_linux;
+            ar           : ar_gnu_ar;
+            res          : res_elf;
+            dbg          : dbg_dwarf4;
+            script       : script_unix;
+            endian       : endian_little;
+            alignment    :
+              (
+                procalign       : 4;
+                loopalign       : 4;
+                jumpalign       : 0;
+                jumpalignskipmax    : 0;
+                coalescealign   : 0;
+                coalescealignskipmax: 0;
+                constalignmin   : 0;
+                constalignmax   : 8;
+                varalignmin     : 0;
+                varalignmax     : 8;
+                localalignmin   : 4;
+                localalignmax   : 8;
+                recordalignmin  : 0;
+                recordalignmax  : 8;
+                maxCrecordalign : 8
+              );
+            first_parm_offset : 0;
+            stacksize    : 32*1024*1024;
+            stackalign   : 8;
+            abi : abi_default;
+            llvmdatalayout : 'e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32-S64';
+          );
+
        system_riscv32_linux_info : tsysteminfo =
           (
             system       : system_riscv32_linux;
@@ -1394,5 +1534,15 @@ initialization
     set_source_info(system_xtensa_linux_info);
   {$endif linux}
 {$endif CPUXTENSA}
+{$ifdef CPUMIPS64EB}
+  {$ifdef linux}
+    set_source_info(system_mips64_linux_info);
+  {$endif linux}
+{$endif CPUMIPS64EB}
+{$ifdef CPUMIPS64EL}
+  {$ifdef linux}
+    set_source_info(system_mips64el_linux_info);
+  {$endif linux}
+{$endif CPUMIPS64EL}
 end.
 

+ 9 - 3
compiler/utils/ppuutils/ppudump.pp

@@ -87,7 +87,9 @@ const
     { 19 } 'riscv32',
     { 20 } 'riscv64',
     { 21 } 'xtensa',
-    { 22 } 'z80'
+    { 22 } 'z80',
+    { 23 } 'mips64',
+    { 24 } 'mips64el'
     );
 
   CpuHasController : array[tsystemcpu] of boolean =
@@ -114,7 +116,9 @@ const
     { 19 } false {'riscv32'},
     { 20 } false {'riscv64'},
     { 21 } true  {'xtensa'},
-    { 22 } true  {'z80'}
+    { 22 } true  {'z80'},
+    { 23 } false {'mips64'},
+    { 24 } false {'mips64el'}
     );
 
 { List of all supported system-cpu couples }
@@ -236,7 +240,9 @@ const
   { 113 } 'SinclairQL-m68k',
   { 114 } 'WASI-WASM32',
   { 115 } 'FreeBSD-AArch64',
-  { 116 } 'Embedded-aarch64'
+  { 116 } 'Embedded-aarch64',
+  { 117 } 'Linux-MIPS64',
+  { 118 } 'Linux-MIPS64el'
   );
 
 const