Преглед изворни кода

[PATCH 02/83] updating common FPC sources for WASM target

From 7705a37c1f11687c3d465c4645357d6679150996 Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <[email protected]>
Date: Wed, 28 Aug 2019 17:01:14 -0400

git-svn-id: branches/wasm@45879 -
nickysn пре 5 година
родитељ
комит
95bed362ba
7 измењених фајлова са 54 додато и 18 уклоњено
  1. 8 0
      compiler/aasmtai.pas
  2. 7 0
      compiler/cgutils.pas
  3. 10 0
      compiler/fpcdefs.inc
  4. 6 0
      compiler/globals.pas
  5. 11 6
      compiler/ncgflw.pas
  6. 6 0
      compiler/pp.pas
  7. 6 12
      compiler/ppcjvm.lpi

+ 8 - 0
compiler/aasmtai.pas

@@ -280,6 +280,10 @@ interface
        ,top_fenceflags
        ,top_fenceflags
        ,top_roundingmode
        ,top_roundingmode
 {$endif defined(riscv32) or defined(riscv64)}
 {$endif defined(riscv32) or defined(riscv64)}
+{$ifdef wasm}
+       ,top_single
+       ,top_double
+{$endif wasm}
        );
        );
 
 
       { kinds of operations that an instruction can perform on an operand }
       { kinds of operations that an instruction can perform on an operand }
@@ -497,6 +501,10 @@ interface
             top_fenceflags : (fenceflags : TFenceFlags);
             top_fenceflags : (fenceflags : TFenceFlags);
             top_roundingmode : (roundingmode : TRoundingMode);
             top_roundingmode : (roundingmode : TRoundingMode);
         {$endif defined(riscv32) or defined(riscv64)}
         {$endif defined(riscv32) or defined(riscv64)}
+        {$ifdef wasm}
+            top_single : (sval:single);
+            top_double : (dval:double);
+        {$endif wasm}
         end;
         end;
         poper=^toper;
         poper=^toper;
 
 

+ 7 - 0
compiler/cgutils.pas

@@ -106,6 +106,13 @@ unit cgutils;
          indexoffset: aint;
          indexoffset: aint;
          checkcast: boolean;
          checkcast: boolean;
 {$endif jvm}
 {$endif jvm}
+{$ifdef wasm}
+        arrayreftype: tarrayreftype;
+        indexbase: tregister;
+        indexsymbol: tasmsymbol;
+        indexoffset: aint;
+        checkcast: boolean;
+{$endif wasm}
          volatility: tvolatilityset;
          volatility: tvolatilityset;
          alignment : byte;
          alignment : byte;
       end;
       end;

+ 10 - 0
compiler/fpcdefs.inc

@@ -335,3 +335,13 @@
   {$define cpucg64shiftsupport}
   {$define cpucg64shiftsupport}
   {$define symansistr}
   {$define symansistr}
 {$endif}
 {$endif}
+
+{$ifdef wasm}
+  {$define cpu32bit}
+  {$define cpu64bitalu}
+  {$define cpu32bitaddr}
+  {$define cpuhighleveltarget}
+  {$define symansistr}
+  {$define SUPPORT_GET_FRAME}
+{$endif}
+

+ 6 - 0
compiler/globals.pas

@@ -549,6 +549,12 @@ interface
         asmcputype : cpu_none;
         asmcputype : cpu_none;
         fputype : fpu_fd;
         fputype : fpu_fd;
   {$endif riscv64}
   {$endif riscv64}
+  {$ifdef wasm}
+        cputype : cpu_none;
+        optimizecputype : cpu_none;
+        asmcputype : cpu_none;
+        fputype : fpu_standard;
+  {$endif wasm}
 {$endif not GENERIC_CPU}
 {$endif not GENERIC_CPU}
         asmmode : asmmode_standard;
         asmmode : asmmode_standard;
 {$ifndef jvm}
 {$ifndef jvm}

+ 11 - 6
compiler/ncgflw.pas

@@ -24,6 +24,11 @@ unit ncgflw;
 
 
 {$i fpcdefs.inc}
 {$i fpcdefs.inc}
 
 
+{$if defined(jvm) or defined(wasm)}
+  {$define SkipABIEH}
+{$endif}
+
+
 interface
 interface
 
 
     uses
     uses
@@ -75,9 +80,9 @@ interface
 
 
        tcgraisenode = class(traisenode)
        tcgraisenode = class(traisenode)
          function pass_1: tnode;override;
          function pass_1: tnode;override;
-{$ifndef jvm}
+{$ifndef SkipABIEH}
          procedure pass_generate_code;override;
          procedure pass_generate_code;override;
-{$endif jvm}
+{$endif SkipABIEH}
        end;
        end;
 
 
        tcgtryexceptnode = class(ttryexceptnode)
        tcgtryexceptnode = class(ttryexceptnode)
@@ -115,9 +120,9 @@ implementation
       cpubase,
       cpubase,
       tgobj,paramgr,
       tgobj,paramgr,
       cgobj,hlcgobj,nutils
       cgobj,hlcgobj,nutils
-{$ifndef jvm}
+{$ifndef SkipABIEH}
       ,psabiehpi
       ,psabiehpi
-{$endif jvm}
+{$endif}
       ;
       ;
 {*****************************************************************************
 {*****************************************************************************
                          Second_While_RepeatN
                          Second_While_RepeatN
@@ -1112,7 +1117,7 @@ implementation
           end;
           end;
       end;
       end;
 
 
-{$ifndef jvm}
+{$ifndef SkipABIEH}
     { has to be factored out as well }
     { has to be factored out as well }
     procedure tcgraisenode.pass_generate_code;
     procedure tcgraisenode.pass_generate_code;
       var
       var
@@ -1159,7 +1164,7 @@ implementation
             include(flowcontrol,fc_catching_exceptions);
             include(flowcontrol,fc_catching_exceptions);
           end;
           end;
       end;
       end;
-{$endif jvm}
+{$endif SkipABIEH}
 
 
 
 
 begin
 begin

+ 6 - 0
compiler/pp.pas

@@ -176,6 +176,12 @@ program pp;
   {$endif CPUDEFINED}
   {$endif CPUDEFINED}
   {$define CPUDEFINED}
   {$define CPUDEFINED}
 {$endif RISCV64}
 {$endif RISCV64}
+{$ifdef WASM}
+  {$ifdef CPUDEFINED}
+    {$fatal ONLY one of the switches for the CPU type must be defined}
+  {$endif CPUDEFINED}
+  {$define CPUDEFINED}
+{$endif WASM}
 
 
 {$ifndef CPUDEFINED}
 {$ifndef CPUDEFINED}
   {$fatal A CPU type switch must be defined}
   {$fatal A CPU type switch must be defined}

+ 6 - 12
compiler/ppcjvm.lpi

@@ -1,7 +1,7 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <CONFIG>
 <CONFIG>
   <ProjectOptions>
   <ProjectOptions>
-    <Version Value="9"/>
+    <Version Value="11"/>
     <PathDelim Value="\"/>
     <PathDelim Value="\"/>
     <General>
     <General>
       <Flags>
       <Flags>
@@ -19,19 +19,17 @@
     </BuildModes>
     </BuildModes>
     <PublishOptions>
     <PublishOptions>
       <Version Value="2"/>
       <Version Value="2"/>
-      <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
-      <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
     </PublishOptions>
     </PublishOptions>
     <RunParams>
     <RunParams>
-      <local>
-        <FormatVersion Value="1"/>
-      </local>
+      <FormatVersion Value="2"/>
+      <Modes Count="1">
+        <Mode0 Name="default"/>
+      </Modes>
     </RunParams>
     </RunParams>
     <Units Count="1">
     <Units Count="1">
       <Unit0>
       <Unit0>
         <Filename Value="pp.pas"/>
         <Filename Value="pp.pas"/>
         <IsPartOfProject Value="True"/>
         <IsPartOfProject Value="True"/>
-        <UnitName Value="pp"/>
       </Unit0>
       </Unit0>
     </Units>
     </Units>
   </ProjectOptions>
   </ProjectOptions>
@@ -63,12 +61,8 @@
       <ConfigFile>
       <ConfigFile>
         <StopAfterErrCount Value="50"/>
         <StopAfterErrCount Value="50"/>
       </ConfigFile>
       </ConfigFile>
-      <CompilerMessages>
-        <UseMsgFile Value="True"/>
-      </CompilerMessages>
       <CustomOptions Value="-djvm
       <CustomOptions Value="-djvm
 -dnoopt"/>
 -dnoopt"/>
-      <CompilerPath Value="$(CompPath)"/>
     </Other>
     </Other>
   </CompilerOptions>
   </CompilerOptions>
 </CONFIG>
 </CONFIG>