[PATCH 55/83] minor fixes and cleanups for the wasm target (#1)

* wasm: add support to the Makefile.fpc files. Makefiles needs to be regen'd

* wasm: include fpcdefs.inc in all units

* wasm: one more missing fpcdefs.inc

* wasm: define some system macro defaults

* + increase the size of some tsysteminfo fields, as wasm uses longer names, this fixes some warnings

* wasm: fixed mkwasmreg program name

* wasm: don't override MakeCmdLine, the inherited function serves us just fine, as it also replaces . Also fixes a warning about result being uninitialized

From 3f1ed3fd157d3ed217ef8845ade8e3e3630f424b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A1roly=20Balogh?= <charlie@amigaspirit.hu>
Date: Mon, 23 Sep 2019 04:08:46 +0200

git-svn-id: branches/wasm@45932 -
This commit is contained in:
nickysn 2020-07-29 19:02:27 +00:00
parent 95faa8f096
commit a893f06813
10 changed files with 34 additions and 16 deletions

View File

@ -91,6 +91,9 @@ endif
ifeq ($(CPU_TARGET),riscv64)
PPSUF=rv64
endif
ifeq ($(CPU_TARGET),wasm)
PPSUF=wasm
endif
# cross compilers uses full cpu_target, not just ppc-suffix
# (except if the target cannot run a native compiler)

View File

@ -32,7 +32,7 @@ fpcdir=..
unexport FPC_VERSION FPC_COMPILERINFO
# Which platforms are ready for inclusion in the cycle
CYCLETARGETS=i386 powerpc sparc arm x86_64 powerpc64 m68k armeb mipsel mips avr jvm i8086 aarch64 sparc64 riscv32 riscv64
CYCLETARGETS=i386 powerpc sparc arm x86_64 powerpc64 m68k armeb mipsel mips avr jvm i8086 aarch64 sparc64 riscv32 riscv64 wasm
# All supported targets used for clean
ALLTARGETS=$(CYCLETARGETS)
@ -225,6 +225,9 @@ endif
ifeq ($(CPC_TARGET),riscv64)
CPUSUF=rv64
endif
ifeq ($(CPC_TARGET),wasm)
CPUSUF=wasm
endif
# Do not define the default -d$(CPU_TARGET) because that
# will conflict with our -d$(CPC_TARGET)
@ -356,6 +359,11 @@ ifeq ($(PPC_TARGET),riscv64)
override LOCALOPT+=-Furiscv
endif
# WASM specific
ifeq ($(PPC_TARGET),wasm)
override LOCALOPT+=-dNOOPT
endif
OPTWPOCOLLECT=-OWdevirtcalls,optvmts -FW$(BASEDIR)/pp1.wpo
OPTWPOPERFORM=-Owdevirtcalls,optvmts -Fw$(BASEDIR)/pp1.wpo
# symbol liveness WPO requires nm, smart linking and no stripping (the latter
@ -586,8 +594,8 @@ endif
# cpu targets
#####################################################################
PPC_TARGETS=i386 m68k powerpc sparc arm armeb x86_64 powerpc64 mips mipsel avr jvm i8086 aarch64 sparc64 riscv32 riscv64
PPC_SUFFIXES=386 68k ppc sparc arm armeb x64 ppc64 mips mipsel avr jvm 8086 a64 sparc64 rv32 rv64
PPC_TARGETS=i386 m68k powerpc sparc arm armeb x86_64 powerpc64 mips mipsel avr jvm i8086 aarch64 sparc64 riscv32 riscv64 wasm
PPC_SUFFIXES=386 68k ppc sparc arm armeb x64 ppc64 mips mipsel avr jvm 8086 a64 sparc64 rv32 rv64 wasm
INSTALL_TARGETS=$(addsuffix _exe_install,$(sort $(CYCLETARGETS) $(PPC_TARGETS)))
SYMLINKINSTALL_TARGETS=$(addsuffix _symlink_install,$(sort $(CYCLETARGETS) $(PPC_TARGETS)))

View File

@ -3705,6 +3705,13 @@ procedure read_arguments(cmd:TCmdStr);
def_system_macro('FPC_REQUIRES_PROPER_ALIGNMENT');
{$endif riscv64}
{$ifdef wasm}
def_system_macro('CPUWASM');
def_system_macro('CPU32');
def_system_macro('FPC_CURRENCY_IS_INT64');
def_system_macro('FPC_COMP_IS_INT64');
{$endif wasm}
{$if defined(cpu8bitalu)}
def_system_macro('CPUINT8');
{$elseif defined(cpu16bitalu)}

View File

@ -198,14 +198,14 @@ interface
resobjext : string[7];
sharedlibext : string[10];
staticlibext,
staticlibprefix : string[4];
staticlibprefix : string[6];
sharedlibprefix : string[4];
sharedClibext : string[10];
staticClibext,
staticClibprefix : string[4];
staticClibprefix : string[6];
sharedClibprefix : string[4];
importlibprefix : string[10];
importlibext : string[4];
importlibext : string[6];
Cprefix : string[2];
newline : string[2];
dirsep : char;

View File

@ -1,5 +1,7 @@
unit t_wasm;
{$i fpcdefs.inc}
interface
uses

View File

@ -12,7 +12,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
program mkspreg;
program mkwasmreg;
const Version = '1.00';
max_regcount = 200;

View File

@ -55,7 +55,6 @@ interface
function CreateNewAsmWriter: TExternalAssemblerOutputFile; override;
public
constructor CreateWithWriter(info: pasminfo; wr: TExternalAssemblerOutputFile; freewriter, smart: boolean); override;
function MakeCmdLine: TCmdStr;override;
procedure WriteTree(p:TAsmList);override;
procedure WriteAsmList;override;
destructor destroy; override;
@ -471,14 +470,6 @@ implementation
end;
function TBinaryenAssembler.MakeCmdLine: TCmdStr;
begin
Replace(result,'$EXTRAOPT',asmextraopt);
end;
function TBinaryenAssembler.CreateNewAsmWriter: TExternalAssemblerOutputFile;
begin
Result:=TBinaryenAssemblerOutputFile.Create(self);

View File

@ -23,6 +23,9 @@
}
unit agwat;
{$i fpcdefs.inc}
interface
uses

View File

@ -21,6 +21,8 @@
}
unit nwasmflw;
{$i fpcdefs.inc}
interface
uses

View File

@ -1,5 +1,7 @@
unit wasmdef;
{$i fpcdefs.inc}
interface
uses