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

From 7705a37c1f11687c3d465c4645357d6679150996 Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <skalogryz.lists@gmail.com>
Date: Wed, 28 Aug 2019 17:01:14 -0400

git-svn-id: branches/wasm@45879 -
This commit is contained in:
nickysn 2020-07-29 16:01:48 +00:00
parent 5daf992919
commit 95bed362ba
7 changed files with 54 additions and 18 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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}

View File

@ -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}

View File

@ -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

View File

@ -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}

View File

@ -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="2"/>
<FormatVersion Value="1"/> <Modes Count="1">
</local> <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>