https://github.com/anematode updated https://github.com/llvm/llvm-project/pull/124365
>From 2508da6fd7f38101011573460724f13df1c1616d Mon Sep 17 00:00:00 2001 From: Timothy Herchen <timothy.herc...@gmail.com> Date: Fri, 24 Jan 2025 15:13:30 -0800 Subject: [PATCH 1/2] [clang][docs] Fix typos concerning wasm __funcref --- clang/docs/LanguageExtensions.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index c42b88015e2695..ddb11cc6efb232 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -2632,7 +2632,7 @@ with the current table size. .. code-block:: c++ typedef void (*__funcref funcref_t)(); - static __funcref table[0]; + static funcref_t table[0]; size_t getSize() { return __builtin_wasm_table_size(table); @@ -2654,10 +2654,10 @@ or -1. It will return -1 if not enough space could be allocated. .. code-block:: c++ typedef void (*__funcref funcref_t)(); - static __funcref table[0]; + static funcref_t table[0]; // grow returns the new table size or -1 on error. - int grow(__funcref fn, int delta) { + int grow(funcref_t fn, int delta) { int prevSize = __builtin_wasm_table_grow(table, fn, delta); if (prevSize == -1) return -1; >From 5721ec3228edebb3170df3a8dc80ef12076f5ea8 Mon Sep 17 00:00:00 2001 From: Timothy Herchen <timothy.herc...@gmail.com> Date: Sat, 25 Jan 2025 20:19:00 -0800 Subject: [PATCH 2/2] [wasm] disallow tail calls when passing structs on the stack --- llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp index 02db1b142a22b5..ec745ebabb4f63 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp @@ -1211,6 +1211,15 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI, } } } + + // If outgoing arguments are passed via the stack, we cannot tail call + for (const ISD::OutputArg &Out : CLI.Outs) { + if (Out.Flags.isByVal() && Out.Flags.getByValSize() != 0) { + NoTail( + "WebAssembly does not support tail calling with stack arguments"); + break; + } + } } SmallVectorImpl<ISD::InputArg> &Ins = CLI.Ins; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits