Commit Graph

490 Commits

Author SHA1 Message Date
Nikolay Nikolov
f32ef29253 * WebAssembly high level code generator: use the global.get and global.set
instructions to access references to symbols of type AT_WASM_GLOBAL
2022-07-26 02:13:09 +03:00
Nikolay Nikolov
c6af4df9b9 + declare user-defined wasm globals in the llvm-mc assembly output 2022-07-25 05:35:00 +03:00
Nikolay Nikolov
6e1d7b4e57 + introduced methods for converting WebAssembly global var types from a Pascal type to TWasmBasicType 2022-07-25 02:44:51 +03:00
Nikolay Nikolov
7bd1ac4507 * fixed comment 2022-07-25 01:57:13 +03:00
Nikolay Nikolov
90b8b9d121 * don't reserve bss data for wasm global vars 2022-07-25 01:17:28 +03:00
Nikolay Nikolov
8d441929a8 + introduced tcpustaticvarsym.is_wasm_global 2022-07-25 01:09:09 +03:00
Nikolay Nikolov
5395e52539 - disable the cs_opt_nodecse optimization from the -O2 for the WebAssembly target, because it causes a crash, when compiling the classes unit 2022-07-15 21:40:18 +03:00
Nikolay Nikolov
b900be6142 + added WebAssembly intrinsics for reading __tls_size, __tls_align and __tls_base 2022-07-14 04:15:47 +03:00
Nikolay Nikolov
7475d22154 + declare the three magic global variables (__tls_size, __tls_align, __tls_base), created by the linker, when WebAssembly multithreading is enabled 2022-07-14 03:57:06 +03:00
Nikolay Nikolov
4db653998b + generate proper WebAssembly threadvar access when multithreading is turned on 2022-07-14 02:39:07 +03:00
Nikolay Nikolov
557e823734 + introduced trefaddr.addr_got_tls, to be used for generating WebAssembly threadvar access, when WASM multithreading is turned on 2022-07-14 00:28:03 +03:00
Nikolay Nikolov
b821b9d502 + WebAssembly multithreading: also declare threadvar sections as TLS and prefix their name with '.tbss' when using the external assembler 2022-07-13 23:50:48 +03:00
Nikolay Nikolov
b923613ead + make use of the unsigned remainder instructions in WebAssembly (i32.rem_s, i64.rem_u) 2022-06-22 03:37:36 +03:00
Nikolay Nikolov
9b16fafc52 + generate exception checks after calls to fpc_overflow class in WebAssembly
branchful exceptions mode, because fpc_overflow can raise an exception in case
  unit SysUtils is included.
2022-06-22 03:21:21 +03:00
Nikolay Nikolov
b2350d90ea * fixed typo in comment 2022-06-22 02:09:05 +03:00
Nikolay Nikolov
90e43e055b * fixed WebAssembly code generation for integer unary minus with overflow checking 2022-06-22 01:47:07 +03:00
Nikolay Nikolov
b11434a6f8 + WebAssembly: use the 64-bit div instruction, instead of an RTL helper for 64-bit division 2022-06-22 01:10:02 +03:00
Nikolay Nikolov
4d6e3b4e1a * Don't call secondpass(left) in twasmtypeconvnode.second_int_to_real, this fixes bug #39735. 2022-06-21 23:59:25 +03:00
Nikolay Nikolov
bc6ab39ea2 * WebAssembly exceptions fix: fixed raise without parameters in except..end
blocks in WebAssembly native and branchful exceptions mode. Fixes #39752
2022-06-21 05:43:35 +03:00
Pierre Muller
2307dc8f26 Try to fix real constant problems for llvm compiler 2022-06-07 23:51:27 +02:00
Nikolay Nikolov
d378240134 + added the WebAssembly saturating truncation instructions to the internal assembler 2022-05-28 17:41:28 +03:00
Nikolay Nikolov
0ba7ef98b3 + support the memory.init and the data.drop instructions in the internal asm writer for WebAssembly 2022-05-28 16:00:43 +03:00
Nikolay Nikolov
3a095f5ed5 + support all the new types in encode_wasm_basic_type 2022-05-28 00:30:43 +03:00
Nikolay Nikolov
907e8402ab + added the WebAssembly reference and vector types to TWasmBasicType 2022-05-28 00:16:51 +03:00
Nikolay Nikolov
2888710594 + added the WebAssembly table instructions 2022-05-28 00:02:27 +03:00
Nikolay Nikolov
534383f686 + added the WebAssembly reference instructions ref.null, ref.is_null and ref.func 2022-05-27 23:58:27 +03:00
Nikolay Nikolov
e2eadc51a3 + added the memory.init and data.drop instructions 2022-05-27 23:38:49 +03:00
Nikolay Nikolov
dbba2d2746 + implemented popcnt via the popcnt instruction in WebAssembly 2022-05-27 23:23:27 +03:00
Nikolay Nikolov
66b471e516 + support different versions of llvm-mc (version 10 seems to be the earliest that works) 2022-05-26 15:06:35 +03:00
Nikolay Nikolov
16f5863847 + added WebAssembly atomic store intrinsics 2022-05-25 19:22:45 +03:00
Nikolay Nikolov
0103964250 + implemented WebAssembly atomic load intrinsics 2022-05-25 18:55:41 +03:00
Nikolay Nikolov
9274f17c52 + reserved inline numbers for the WebAssembly atomic loads and stores 2022-05-24 16:06:05 +03:00
Nikolay Nikolov
e74797d411 * replaced several internal errors, related to the WebAssembly labels
resolution with more meaningful error messages, in order to ease the
  debugging of the compiler. Based on patch by Pierre.
2022-05-24 11:44:15 +03:00
Nikolay Nikolov
6e4e3b8580 * fixed WebAssembly code generation in thlcgwasm.g_overflowCheck_loc (patch by Pierre) 2022-05-24 11:06:59 +03:00
Nikolay Nikolov
8bea5dd41e * WebAssembly code generation fix in thlcgwasm.a_op_reg_reg_reg_checkoverflow, based on patch by Pierre (but simplified, to use a single block) 2022-05-24 11:00:10 +03:00
Nikolay Nikolov
283c213a0c * patch by Pierre, which fixes WebAssembly code generation for signed div/mod with overflow checking 2022-05-24 10:47:38 +03:00
Nikolay Nikolov
f1cb5d8f71 + support intrinsic for the memory.atomic.notify WebAssembly instruction 2022-05-21 18:03:14 +03:00
Nikolay Nikolov
86643710c4 + support intrinsics for the WebAssembly memory.atomic.wait32 and memory.atomic.wait64 instructions 2022-05-21 17:53:38 +03:00
Nikolay Nikolov
3cfdf000a2 + support the new WebAssembly threads and atomics instructions in the internal assembler 2022-05-21 17:24:21 +03:00
Nikolay Nikolov
e03b920520 + added intrinsic support for the WebAssembly cmpxchg atomic operations as well 2022-05-21 02:52:31 +03:00
Nikolay Nikolov
d8f06aa4f1 + added instrinsic support for the all the 2-parameter read-modify-write
WebAssembly atomic operations (add, sub, and, or, xor, xchg). Note that they
  are not implemented in the internal assembler, yet.
2022-05-20 17:36:37 +03:00
Pierre Muller
be969205ad Do not alloc/dealloc NR_DEFAULTFLAGS for wasm32, as it is NR_NO 2022-05-17 22:47:13 +02:00
Nikolay Nikolov
812736bd41 + support the atomic.fence instruction in the WebAssembly internal object writer 2022-05-13 22:56:36 +03:00
Nikolay Nikolov
1d70437017 + added intrinsic (for RTL internal use) that emits the WebAssembly atomic.fence instruction 2022-05-13 22:46:27 +03:00
Nikolay Nikolov
ddab39dbdc + enable the atomics extension on the llvm-mc command line (extension appears
to be recognized since LLVM 8.0, so it should be safe to always enable this
  from the llvm-mc command line)
2022-05-13 21:15:54 +03:00
Nikolay Nikolov
5198e47e36 + added the atomic memory access WebAssembly instructions from the threading proposal for WebAssembly 2022-05-13 20:55:12 +03:00
florian
27fb9086aa * cleanup: cs_opt_loopunroll is a generic optimization for a long time already 2022-03-08 23:03:18 +01:00
Nikolay Nikolov
2c0f10d988 * when adding WebAssembly object info, traverse through current_module.used_units,
as well as the usedunits global. This resolves #39543
2022-02-12 08:32:48 +02:00
Nikolay Nikolov
c4f9ec91c9 + fix support for 8-byte records, held in a register pair on the WebAssembly target. This fixes #39524 2022-01-25 13:03:35 +02:00
florian
6404478ea4 * cleanup of VER3_0 defines 2021-11-17 22:19:57 +01:00