[clang] [llvm] [WebAssembly] support getVT from `externref` and `funcref` (PR #97080)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/97080 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] support getVT from `externref` and `funcref` (PR #97080)
@@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -O2 -triple wasm32-unknown-unknown-wasm -target-feature +reference-types -emit-llvm -o - %s | FileCheck %s aheejin wrote: ```suggestion // RUN: %clang_cc1 -O2 -triple wasm32-unknown-unknown -target-feature +reference-types -emit-llvm -o - %s | FileCheck %s ``` https://github.com/llvm/llvm-project/pull/97080 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] support getVT from `externref` and `funcref` (PR #97080)
@@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -O2 -triple wasm32-unknown-unknown-wasm -target-feature +reference-types -emit-llvm -o - %s | FileCheck %s aheejin wrote: By the way, this command succeeds even without this patch. The test should be something that fails now and succeeds with the fix. https://github.com/llvm/llvm-project/pull/97080 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] support getVT from `externref` and `funcref` (PR #97080)
@@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -O2 -triple wasm32-unknown-unknown-wasm -target-feature +reference-types -emit-llvm -o - %s | FileCheck %s + +// From issue 69894. Reftypes need to be marked as not valid as vector elements. aheejin wrote: If you would like to refer to an issue, I think including the URL is more convenient: `https://github.com/llvm/llvm-project/issues/69894` https://github.com/llvm/llvm-project/pull/97080 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] support getVT from `externref` and `funcref` (PR #97080)
https://github.com/aheejin commented: What happens if you compile a file that really vectorizes reference types? The attached test doesn't seem to actually end up getting vectorized after all. Can you add a test that get vectorized? https://github.com/llvm/llvm-project/pull/97080 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Re-enable reference types by default (PR #93261)
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/93261 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Re-enable reference types by default (PR #93261)
aheejin wrote: Given that the node version in Chromium CI has been updated successfully (https://chromium-review.googlesource.com/c/emscripten-releases/+/5503423), I'm gonna land this. https://github.com/llvm/llvm-project/pull/93261 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement all f16x8 binary instructions. (PR #93360)
https://github.com/aheejin approved this pull request. https://github.com/llvm/llvm-project/pull/93360 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement all f16x8 binary instructions. (PR #93360)
@@ -152,6 +153,18 @@ def F64x2 : Vec { let prefix = "f64x2"; } +def F16x8 : Vec { + let vt = v8f16; + let int_vt = v8i16; + let lane_vt = f32; + let lane_rc = F32; + let lane_bits = 16; + let lane_idx = LaneIdx8; + let lane_load = int_wasm_loadf16_f32; + let splat = PatFrag<(ops node:$x), (v8f16 (splat_vector (f16 $x)))>; + let prefix = "f16x8"; +} + defvar AllVecs = [I8x16, I16x8, I32x4, I64x2, F32x4, F64x2]; aheejin wrote: Given that we can't add `F16x8` here, it's not "all vectors" anymore... Should we rename it to something? If so, to what? https://github.com/llvm/llvm-project/pull/93360 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement all f16x8 binary instructions. (PR #93360)
@@ -1199,6 +1213,7 @@ def : Pat<(v2f64 (froundeven (v2f64 V128:$src))), (NEAREST_F64x2 V128:$src)>; multiclass SIMDBinaryFP baseInst> { defm "" : SIMDBinary; defm "" : SIMDBinary; + defm "" : SIMDBinary; aheejin wrote: I understand why it's added, and I wish we can multi-inherit from `SIMDBinary` and `HALF_PRECISION_I`, but I'm not sure if we can do it... (Can we?) I'm not strongly opinionated about it and it's basically just a matter of preference, but how about adding a `multiclass` like `HalfPrecisionBinary` or something that inherits from `SIMDBinary`? https://github.com/llvm/llvm-project/pull/93360 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement all f16x8 binary instructions. (PR #93360)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/93360 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement all f16x8 binary instructions. (PR #93360)
https://github.com/aheejin commented: Now you have commit access! https://github.com/llvm/llvm-project/pull/93360 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement prototype f16x8.splat instruction. (PR #93228)
aheejin wrote: I guess you've likely already found it but anyway it's here: https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access It's basically "Email Chris". https://github.com/llvm/llvm-project/pull/93228 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement prototype f16x8.splat instruction. (PR #93228)
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/93228 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Re-enable reference types by default (PR #93261)
https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/93261 >From 25fc2c2caa1b6bdc4883b1349fa4e75e670a0ffa Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 24 May 2024 01:02:26 + Subject: [PATCH 1/2] Re-enable reference types by default Now that we are about to upgrade emsdk's default node to v18.20.3 (https://github.com/emscripten-core/emsdk/pull/1387), we can re-enable reference-types by default again. This effectively reverts #90792. --- clang/docs/ReleaseNotes.rst| 8 clang/lib/Basic/Targets/WebAssembly.cpp| 2 +- clang/test/Preprocessor/wasm-target-features.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 2b35e2162ab5b..dfc1af8c4be8a 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -881,10 +881,10 @@ AIX Support WebAssembly Support ^^^ -The -mcpu=generic configuration now enables multivalue feature, which is -standardized and available in all major engines. Enabling multivalue here only -enables the language feature but does not turn on the multivalue ABI (this -enables non-ABI uses of multivalue, like exnref). +The -mcpu=generic configuration now enables multivalue and reference-types.These +proposals are standardized and available in all major engines. Enabling +multivalue here only enables the language feature but does not turn on the +multivalue ABI (this enables non-ABI uses of multivalue, like exnref). AVR Support ^^^ diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index 5a000314a72ce..1e565f0a5319f 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -153,6 +153,7 @@ bool WebAssemblyTargetInfo::initFeatureMap( auto addGenericFeatures = [&]() { Features["multivalue"] = true; Features["mutable-globals"] = true; +Features["reference-types"] = true; Features["sign-ext"] = true; }; auto addBleedingEdgeFeatures = [&]() { @@ -164,7 +165,6 @@ bool WebAssemblyTargetInfo::initFeatureMap( Features["half-precision"] = true; Features["multimemory"] = true; Features["nontrapping-fptoint"] = true; -Features["reference-types"] = true; Features["tail-call"] = true; setSIMDLevel(Features, RelaxedSIMD, true); }; diff --git a/clang/test/Preprocessor/wasm-target-features.c b/clang/test/Preprocessor/wasm-target-features.c index 9d49e3af603f8..d5539163b3bf5 100644 --- a/clang/test/Preprocessor/wasm-target-features.c +++ b/clang/test/Preprocessor/wasm-target-features.c @@ -164,6 +164,7 @@ // // GENERIC-INCLUDE-DAG: #define __wasm_multivalue__ 1{{$}} // GENERIC-INCLUDE-DAG: #define __wasm_mutable_globals__ 1{{$}} +// GENERIC-INCLUDE-DAG: #define __wasm_reference_types__ 1{{$}} // GENERIC-INCLUDE-DAG: #define __wasm_sign_ext__ 1{{$}} // // RUN: %clang -E -dM %s -o - 2>&1 \ @@ -180,7 +181,6 @@ // GENERIC-NOT: #define __wasm_half_precision__ 1{{$}} // GENERIC-NOT: #define __wasm_multimemory__ 1{{$}} // GENERIC-NOT: #define __wasm_nontrapping_fptoint__ 1{{$}} -// GENERIC-NOT: #define __wasm_reference_types__ 1{{$}} // GENERIC-NOT: #define __wasm_relaxed_simd__ 1{{$}} // GENERIC-NOT: #define __wasm_simd128__ 1{{$}} // GENERIC-NOT: #define __wasm_tail_call__ 1{{$}} >From fdddba56cc93c2d3d11237cceb48501c10e1efb2 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 24 May 2024 01:08:38 + Subject: [PATCH 2/2] space --- clang/docs/ReleaseNotes.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index dfc1af8c4be8a..8a91b94c7e802 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -881,8 +881,8 @@ AIX Support WebAssembly Support ^^^ -The -mcpu=generic configuration now enables multivalue and reference-types.These -proposals are standardized and available in all major engines. Enabling +The -mcpu=generic configuration now enables multivalue and reference-types. +These proposals are standardized and available in all major engines. Enabling multivalue here only enables the language feature but does not turn on the multivalue ABI (this enables non-ABI uses of multivalue, like exnref). ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Re-enable reference types by default (PR #93261)
aheejin wrote: This should land after the node-updating PRs land. https://github.com/llvm/llvm-project/pull/93261 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Re-enable reference types by default (PR #93261)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/93261 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Re-enable reference types by default (PR #93261)
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/93261 Now that we are about to upgrade emsdk's default node to v18.20.3 (https://github.com/emscripten-core/emsdk/pull/1387), we can re-enable reference-types by default again. This effectively reverts #90792. >From 25fc2c2caa1b6bdc4883b1349fa4e75e670a0ffa Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 24 May 2024 01:02:26 + Subject: [PATCH] Re-enable reference types by default Now that we are about to upgrade emsdk's default node to v18.20.3 (https://github.com/emscripten-core/emsdk/pull/1387), we can re-enable reference-types by default again. This effectively reverts #90792. --- clang/docs/ReleaseNotes.rst| 8 clang/lib/Basic/Targets/WebAssembly.cpp| 2 +- clang/test/Preprocessor/wasm-target-features.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 2b35e2162ab5b..dfc1af8c4be8a 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -881,10 +881,10 @@ AIX Support WebAssembly Support ^^^ -The -mcpu=generic configuration now enables multivalue feature, which is -standardized and available in all major engines. Enabling multivalue here only -enables the language feature but does not turn on the multivalue ABI (this -enables non-ABI uses of multivalue, like exnref). +The -mcpu=generic configuration now enables multivalue and reference-types.These +proposals are standardized and available in all major engines. Enabling +multivalue here only enables the language feature but does not turn on the +multivalue ABI (this enables non-ABI uses of multivalue, like exnref). AVR Support ^^^ diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index 5a000314a72ce..1e565f0a5319f 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -153,6 +153,7 @@ bool WebAssemblyTargetInfo::initFeatureMap( auto addGenericFeatures = [&]() { Features["multivalue"] = true; Features["mutable-globals"] = true; +Features["reference-types"] = true; Features["sign-ext"] = true; }; auto addBleedingEdgeFeatures = [&]() { @@ -164,7 +165,6 @@ bool WebAssemblyTargetInfo::initFeatureMap( Features["half-precision"] = true; Features["multimemory"] = true; Features["nontrapping-fptoint"] = true; -Features["reference-types"] = true; Features["tail-call"] = true; setSIMDLevel(Features, RelaxedSIMD, true); }; diff --git a/clang/test/Preprocessor/wasm-target-features.c b/clang/test/Preprocessor/wasm-target-features.c index 9d49e3af603f8..d5539163b3bf5 100644 --- a/clang/test/Preprocessor/wasm-target-features.c +++ b/clang/test/Preprocessor/wasm-target-features.c @@ -164,6 +164,7 @@ // // GENERIC-INCLUDE-DAG: #define __wasm_multivalue__ 1{{$}} // GENERIC-INCLUDE-DAG: #define __wasm_mutable_globals__ 1{{$}} +// GENERIC-INCLUDE-DAG: #define __wasm_reference_types__ 1{{$}} // GENERIC-INCLUDE-DAG: #define __wasm_sign_ext__ 1{{$}} // // RUN: %clang -E -dM %s -o - 2>&1 \ @@ -180,7 +181,6 @@ // GENERIC-NOT: #define __wasm_half_precision__ 1{{$}} // GENERIC-NOT: #define __wasm_multimemory__ 1{{$}} // GENERIC-NOT: #define __wasm_nontrapping_fptoint__ 1{{$}} -// GENERIC-NOT: #define __wasm_reference_types__ 1{{$}} // GENERIC-NOT: #define __wasm_relaxed_simd__ 1{{$}} // GENERIC-NOT: #define __wasm_simd128__ 1{{$}} // GENERIC-NOT: #define __wasm_tail_call__ 1{{$}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement prototype f16x8.splat instruction. (PR #93228)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/93228 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement prototype f16x8.splat instruction. (PR #93228)
https://github.com/aheejin approved this pull request. LGTM % `!HasHalfPrecision` thing By the way I guess you can try getting a commit access soon? I think it is still "Send an an email to Chris" though... https://github.com/llvm/llvm-project/pull/93228 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement prototype f16x8.splat instruction. (PR #93228)
@@ -90,6 +90,7 @@ class LLVM_LIBRARY_VISIBILITY WebAssemblyTargetInfo : public TargetInfo { StringRef getABI() const override; bool setABI(const std::string ) override; + bool useFP16ConversionIntrinsics() const override { return false; } aheejin wrote: I am not very familiar with the places where the function is used, but `!HasHalfPrecision` seems safer. https://github.com/llvm/llvm-project/pull/93228 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] [libunwind] [WebAssembly] __USING_WASM_EXCEPTIONS__ -> __WASM_EXCEPTIONS__ (PR #92840)
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/92840 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] [libunwind] [WebAssembly] __USING_WASM_EXCEPTIONS__ -> __WASM_EXCEPTIONS__ (PR #92840)
aheejin wrote: The other CI failure doesn't seem to be related. Merging. https://github.com/llvm/llvm-project/pull/92840 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] [libunwind] [WebAssembly] __USING_WASM_EXCEPTIONS__ -> __WASM_EXCEPTIONS__ (PR #92840)
https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/92840 >From e04e685a8fbf3e7915a9eaff3798fe77d15aab0c Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Sat, 18 May 2024 01:55:29 + Subject: [PATCH] [WebAssembly] __USING_WASM_EXCEPTIONS__ -> __WASM_EXCEPTIONS__ We've decided to change `__USING_WASM_EXCEPTIONS__` preprocessor to `__WASM_EXCEPTIONS__` given that it's more concise. --- libcxxabi/include/cxxabi.h| 2 +- libcxxabi/src/cxa_exception.cpp | 2 +- libcxxabi/src/cxa_exception.h | 2 +- libcxxabi/src/cxa_personality.cpp | 36 +++ libunwind/src/Unwind-wasm.c | 4 ++-- libunwind/src/libunwind.cpp | 4 ++-- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/libcxxabi/include/cxxabi.h b/libcxxabi/include/cxxabi.h index d0701181751c5..9d9beecf751fc 100644 --- a/libcxxabi/include/cxxabi.h +++ b/libcxxabi/include/cxxabi.h @@ -53,7 +53,7 @@ __cxa_init_primary_exception(void* object, std::type_info* tinfo, void(_LIBCXXAB // 2.4.3 Throwing the Exception Object extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_throw(void *thrown_exception, std::type_info *tinfo, -#ifdef __USING_WASM_EXCEPTIONS__ +#ifdef __WASM_EXCEPTIONS__ // In Wasm, a destructor returns its argument void *(_LIBCXXABI_DTOR_FUNC *dest)(void *)); #else diff --git a/libcxxabi/src/cxa_exception.cpp b/libcxxabi/src/cxa_exception.cpp index 65e9f4504ddad..3141d50a6bb92 100644 --- a/libcxxabi/src/cxa_exception.cpp +++ b/libcxxabi/src/cxa_exception.cpp @@ -267,7 +267,7 @@ will call terminate, assuming that there was no handler for the exception. */ void -#ifdef __USING_WASM_EXCEPTIONS__ +#ifdef __WASM_EXCEPTIONS__ // In Wasm, a destructor returns its argument __cxa_throw(void *thrown_object, std::type_info *tinfo, void *(_LIBCXXABI_DTOR_FUNC *dest)(void *)) { #else diff --git a/libcxxabi/src/cxa_exception.h b/libcxxabi/src/cxa_exception.h index 10712f6f47bb5..7800b940b83f7 100644 --- a/libcxxabi/src/cxa_exception.h +++ b/libcxxabi/src/cxa_exception.h @@ -43,7 +43,7 @@ struct _LIBCXXABI_HIDDEN __cxa_exception { // Manage the exception object itself. std::type_info *exceptionType; -#ifdef __USING_WASM_EXCEPTIONS__ +#ifdef __WASM_EXCEPTIONS__ // In Wasm, a destructor returns its argument void *(_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *); #else diff --git a/libcxxabi/src/cxa_personality.cpp b/libcxxabi/src/cxa_personality.cpp index d95d781319401..843a18a4cbd8a 100644 --- a/libcxxabi/src/cxa_personality.cpp +++ b/libcxxabi/src/cxa_personality.cpp @@ -70,7 +70,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, +--+--+-+-++--+ | callSiteTableLength | (ULEB128) | Call Site Table length, used to find Action table | +-+---+---+ -#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__) +-+---++ | Beginning of Call Site TableThe current ip lies within the | | ... (start, length) range of one of these| @@ -84,7 +84,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, | +-+-+--+ | | ... | +--+ -#else // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__ +#else // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ +-+---++ | Beginning of Call Site TableThe current ip is a 1-based index into | | ... this table. Or it is -1 meaning no | @@ -97,7 +97,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, | +-+-+--+ | | ... | +--+ -#endif // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__ +#endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ +-+ | Beginning of Action Table ttypeIndex == 0 : cleanup | | ... ttypeIndex > 0 : catch | @@ -547,7 +547,7 @@ void set_registers(_Unwind_Exception* unwind_exception, _Unwind_Context* context, const scan_results& results) {
[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/92192 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)
aheejin wrote: I'd appreciate if someone LGTM this. Thanks! https://github.com/llvm/llvm-project/pull/92192 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] [libunwind] [WebAssembly] __USING_WASM_EXCEPTIONS__ -> __WASM_EXCEPTIONS__ (PR #92840)
aheejin wrote: It is hard to fix the clang-format errors because the modified files generally don't conform to the clang-format style anyway, so clang-format my change currently affects hundreds of unrelated lines. ```console aheejin@aheejin:~/llvm-project/libunwind$ git clang-format main changed files: libcxxabi/include/cxxabi.h libcxxabi/src/cxa_exception.cpp libcxxabi/src/cxa_personality.cpp aheejin@aheejin:~/llvm-project/libunwind$ git diff --stat libcxxabi/include/cxxabi.h| 13 +- libcxxabi/src/cxa_exception.cpp | 2 +- libcxxabi/src/cxa_personality.cpp | 256 ++-- 3 files changed, 123 insertions(+), 148 deletions(-) ``` https://github.com/llvm/llvm-project/pull/92840 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] [libunwind] [WebAssembly] __USING_WASM_EXCEPTIONS__ -> __WASM_EXCEPTIONS__ (PR #92840)
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/92840 We've decided to change `__USING_WASM_EXCEPTIONS__` preprocessor to `__WASM_EXCEPTIONS__` given that it's more concise. >From e04e685a8fbf3e7915a9eaff3798fe77d15aab0c Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Sat, 18 May 2024 01:55:29 + Subject: [PATCH] [WebAssembly] __USING_WASM_EXCEPTIONS__ -> __WASM_EXCEPTIONS__ We've decided to change `__USING_WASM_EXCEPTIONS__` preprocessor to `__WASM_EXCEPTIONS__` given that it's more concise. --- libcxxabi/include/cxxabi.h| 2 +- libcxxabi/src/cxa_exception.cpp | 2 +- libcxxabi/src/cxa_exception.h | 2 +- libcxxabi/src/cxa_personality.cpp | 36 +++ libunwind/src/Unwind-wasm.c | 4 ++-- libunwind/src/libunwind.cpp | 4 ++-- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/libcxxabi/include/cxxabi.h b/libcxxabi/include/cxxabi.h index d0701181751c5..9d9beecf751fc 100644 --- a/libcxxabi/include/cxxabi.h +++ b/libcxxabi/include/cxxabi.h @@ -53,7 +53,7 @@ __cxa_init_primary_exception(void* object, std::type_info* tinfo, void(_LIBCXXAB // 2.4.3 Throwing the Exception Object extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_throw(void *thrown_exception, std::type_info *tinfo, -#ifdef __USING_WASM_EXCEPTIONS__ +#ifdef __WASM_EXCEPTIONS__ // In Wasm, a destructor returns its argument void *(_LIBCXXABI_DTOR_FUNC *dest)(void *)); #else diff --git a/libcxxabi/src/cxa_exception.cpp b/libcxxabi/src/cxa_exception.cpp index 65e9f4504ddad..3141d50a6bb92 100644 --- a/libcxxabi/src/cxa_exception.cpp +++ b/libcxxabi/src/cxa_exception.cpp @@ -267,7 +267,7 @@ will call terminate, assuming that there was no handler for the exception. */ void -#ifdef __USING_WASM_EXCEPTIONS__ +#ifdef __WASM_EXCEPTIONS__ // In Wasm, a destructor returns its argument __cxa_throw(void *thrown_object, std::type_info *tinfo, void *(_LIBCXXABI_DTOR_FUNC *dest)(void *)) { #else diff --git a/libcxxabi/src/cxa_exception.h b/libcxxabi/src/cxa_exception.h index 10712f6f47bb5..7800b940b83f7 100644 --- a/libcxxabi/src/cxa_exception.h +++ b/libcxxabi/src/cxa_exception.h @@ -43,7 +43,7 @@ struct _LIBCXXABI_HIDDEN __cxa_exception { // Manage the exception object itself. std::type_info *exceptionType; -#ifdef __USING_WASM_EXCEPTIONS__ +#ifdef __WASM_EXCEPTIONS__ // In Wasm, a destructor returns its argument void *(_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *); #else diff --git a/libcxxabi/src/cxa_personality.cpp b/libcxxabi/src/cxa_personality.cpp index d95d781319401..843a18a4cbd8a 100644 --- a/libcxxabi/src/cxa_personality.cpp +++ b/libcxxabi/src/cxa_personality.cpp @@ -70,7 +70,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, +--+--+-+-++--+ | callSiteTableLength | (ULEB128) | Call Site Table length, used to find Action table | +-+---+---+ -#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__) +-+---++ | Beginning of Call Site TableThe current ip lies within the | | ... (start, length) range of one of these| @@ -84,7 +84,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, | +-+-+--+ | | ... | +--+ -#else // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__ +#else // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ +-+---++ | Beginning of Call Site TableThe current ip is a 1-based index into | | ... this table. Or it is -1 meaning no | @@ -97,7 +97,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, | +-+-+--+ | | ... | +--+ -#endif // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__ +#endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ +-+ | Beginning of Action Table ttypeIndex == 0 : cleanup | | ... ttypeIndex > 0 : catch | @@ -547,7 +547,7 @@ void
[clang] [WebAssembly] Define __WASM_EXCEPTIONS__ for -fwasm-exceptions (PR #92604)
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/92604 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)
@@ -20,7 +20,7 @@ .text #endif -#if !defined(__USING_SJLJ_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__wasm__) aheejin wrote: Can I land this? Thank you for your review! https://github.com/llvm/llvm-project/pull/92192 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Define __WASM_EXCEPTIONS__ for -fwasm-exceptions (PR #92604)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/92604 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Define __WASM_EXCEPTIONS__ for -fwasm-exceptions (PR #92604)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/92604 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Define __USING_WASM_EXCEPTIONS__ for -fwasm-exceptions (PR #92604)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/92604 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Define __USING_WASM_EXCEPTIONS__ for -fwasm-exceptions (PR #92604)
https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/92604 >From bedab4dc6edc3fd44d79c42d4fd62dc1a6937fb0 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 17 May 2024 20:41:21 + Subject: [PATCH 1/3] [WebAssembly] Define __USING_WASM_EXCEPTIONS__ for -fwasm-exceptions When using other specific exception options in Clang, such as `-fseh-exceptions` or `-fsjlj-exceptions`, Clang defines a corresponding preprocessor such as `-D__USING_SJLJ_EXCEPTIONS__`. Emscripten does that in our own build system: https://github.com/emscripten-core/emscripten/blob/7dcd7f40749918e141dc33397d2f4311dd80637a/tools/system_libs.py#L1577-L1578 But to make Wasm EH usable in non-Emscripten toolchain, this has to be defined somewhere else. This PR makes Wasm EH consistent with other exception scheme by letting it defined by Clang depending on the exception option. --- clang/lib/Frontend/InitPreprocessor.cpp | 2 ++ clang/test/CodeGenCXX/wasm-eh.cpp | 4 2 files changed, 6 insertions(+) diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index c1d209466ffe5..3cc85ff502776 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -1006,6 +1006,8 @@ static void InitializePredefinedMacros(const TargetInfo , else if (LangOpts.hasDWARFExceptions() && (TI.getTriple().isThumb() || TI.getTriple().isARM())) Builder.defineMacro("__ARM_DWARF_EH__"); + else if (LangOpts.hasWasmExceptions()) +Builder.defineMacro("__USING_WASM_EXCEPTIONS__"); if (LangOpts.Deprecated) Builder.defineMacro("__DEPRECATED"); diff --git a/clang/test/CodeGenCXX/wasm-eh.cpp b/clang/test/CodeGenCXX/wasm-eh.cpp index af023f52191b9..09588985d4e74 100644 --- a/clang/test/CodeGenCXX/wasm-eh.cpp +++ b/clang/test/CodeGenCXX/wasm-eh.cpp @@ -1,4 +1,8 @@ // REQUIRES: webassembly-registered-target + +// RUN: %clang -E -dM %s -target wasm32-unknown-unknown -fwasm-exceptions | FileCheck %s -check-prefix PREPROCESSOR +// PREPROCESSOR: #define __USING_WASM_EXCEPTIONS__ 1 + // RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -mllvm -wasm-enable-eh -exception-model=wasm -target-feature +exception-handling -emit-llvm -o - -std=c++11 | FileCheck %s // RUN: %clang_cc1 %s -triple wasm64-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -mllvm -wasm-enable-eh -exception-model=wasm -target-feature +exception-handling -emit-llvm -o - -std=c++11 | FileCheck %s >From 38b517419cb60e9fb88828847fd8d57542e9a651 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 17 May 2024 21:25:07 + Subject: [PATCH 2/3] Add Wasm condition --- clang/lib/Frontend/InitPreprocessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 3cc85ff502776..f76f16e2228e7 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -1006,7 +1006,7 @@ static void InitializePredefinedMacros(const TargetInfo , else if (LangOpts.hasDWARFExceptions() && (TI.getTriple().isThumb() || TI.getTriple().isARM())) Builder.defineMacro("__ARM_DWARF_EH__"); - else if (LangOpts.hasWasmExceptions()) + else if (LangOpts.hasWasmExceptions() && TI.getTriple().isWasm()) Builder.defineMacro("__USING_WASM_EXCEPTIONS__"); if (LangOpts.Deprecated) >From 8d57019721697c1367e5aca99e032e7c094aedb2 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 17 May 2024 23:07:19 + Subject: [PATCH 3/3] __USING_WASM_EXCEPTIONS__ -> __WASM_EXCEPTIONS__ --- clang/lib/Frontend/InitPreprocessor.cpp | 2 +- clang/test/CodeGenCXX/wasm-eh.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index f76f16e2228e7..68760e3e0 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -1007,7 +1007,7 @@ static void InitializePredefinedMacros(const TargetInfo , (TI.getTriple().isThumb() || TI.getTriple().isARM())) Builder.defineMacro("__ARM_DWARF_EH__"); else if (LangOpts.hasWasmExceptions() && TI.getTriple().isWasm()) -Builder.defineMacro("__USING_WASM_EXCEPTIONS__"); +Builder.defineMacro("__WASM_EXCEPTIONS__"); if (LangOpts.Deprecated) Builder.defineMacro("__DEPRECATED"); diff --git a/clang/test/CodeGenCXX/wasm-eh.cpp b/clang/test/CodeGenCXX/wasm-eh.cpp index 09588985d4e74..b70c07386fd14 100644 --- a/clang/test/CodeGenCXX/wasm-eh.cpp +++ b/clang/test/CodeGenCXX/wasm-eh.cpp @@ -1,7 +1,7 @@ // REQUIRES: webassembly-registered-target // RUN: %clang -E -dM %s -target wasm32-unknown-unknown -fwasm-exceptions | FileCheck %s -check-prefix PREPROCESSOR -// PREPROCESSOR: #define __USING_WASM_EXCEPTIONS__ 1 +// PREPROCESSOR: #define __WASM_EXCEPTIONS__ 1
[clang] [WebAssembly] Define __USING_WASM_EXCEPTIONS__ for -fwasm-exceptions (PR #92604)
@@ -1006,6 +1006,8 @@ static void InitializePredefinedMacros(const TargetInfo , else if (LangOpts.hasDWARFExceptions() && (TI.getTriple().isThumb() || TI.getTriple().isARM())) Builder.defineMacro("__ARM_DWARF_EH__"); + else if (LangOpts.hasWasmExceptions() && TI.getTriple().isWasm()) +Builder.defineMacro("__USING_WASM_EXCEPTIONS__"); aheejin wrote: I see. And come to think of it, as you said, I may not need to worry about the predefined macros in other users because they might be redundant but this will not break them because we define the macro in Clang. Will update this to `__WASM_EXCEPTIONS__`, and update the macro in other parts of LLVM and Emscripten as follow-ups. https://github.com/llvm/llvm-project/pull/92604 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Define __USING_WASM_EXCEPTIONS__ for -fwasm-exceptions (PR #92604)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/92604 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Define __USING_WASM_EXCEPTIONS__ for -fwasm-exceptions (PR #92604)
@@ -1006,6 +1006,8 @@ static void InitializePredefinedMacros(const TargetInfo , else if (LangOpts.hasDWARFExceptions() && (TI.getTriple().isThumb() || TI.getTriple().isARM())) Builder.defineMacro("__ARM_DWARF_EH__"); + else if (LangOpts.hasWasmExceptions() && TI.getTriple().isWasm()) +Builder.defineMacro("__USING_WASM_EXCEPTIONS__"); aheejin wrote: Changing it in LLVM and Emscripten is not a big problem, but I'm still somewhat worried about non-Emscripten toolchain users who have `-D__USING_WASM_EXCEPTIONS__` somewhere in their build configuration. I can add some comment on the previous issues for Wasm EH library porting and change the parts of WASI toolchain that uses the macro. And why do you think we should remove this define here in Clang (assuming we change this to whatever we like)? This is consistent with what other exception modes are doing, and people need this `define` somewhere. https://github.com/llvm/llvm-project/pull/92604 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Define __USING_WASM_EXCEPTIONS__ for -fwasm-exceptions (PR #92604)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/92604 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Define __USING_WASM_EXCEPTIONS__ for -fwasm-exceptions (PR #92604)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/92604 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Define __USING_WASM_EXCEPTIONS__ for -fwasm-exceptions (PR #92604)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/92604 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Define __USING_WASM_EXCEPTIONS__ for -fwasm-exceptions (PR #92604)
@@ -1006,6 +1006,8 @@ static void InitializePredefinedMacros(const TargetInfo , else if (LangOpts.hasDWARFExceptions() && (TI.getTriple().isThumb() || TI.getTriple().isARM())) Builder.defineMacro("__ARM_DWARF_EH__"); + else if (LangOpts.hasWasmExceptions() && TI.getTriple().isWasm()) +Builder.defineMacro("__USING_WASM_EXCEPTIONS__"); aheejin wrote: I like it more too. I started using `__USING_WASM_EXCEPTIONS__` mostly because to be consistent with `__USING_SJLJ_EXCEPTIONS__`, which Wasm EH share many traits. There are many lines in libc++abi and libunwind where both SjLj and Wasm include or exclude by `ifdef`s like this https://github.com/llvm/llvm-project/blob/bdfb04a63d73c31ee75395064762d0d6ccb45819/libcxxabi/src/cxa_personality.cpp#L645 Not sure if it was really necessary to be consistent with it though. But anyway to do that we need to fix it everywhere, both in LLVM and Emscripten and libraries (libc++abi and libunwind). And it is likely other toolchains (like WASI) users have been defining `__USING_WASM_EXCEPTIONS__` somewhere in their build system already given that we have not been defining this in Clang so far. Do you think it's worth changing or feasible? https://github.com/llvm/llvm-project/pull/92604 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Define __USING_WASM_EXCEPTIONS__ for -fwasm-exceptions (PR #92604)
https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/92604 >From bedab4dc6edc3fd44d79c42d4fd62dc1a6937fb0 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 17 May 2024 20:41:21 + Subject: [PATCH 1/2] [WebAssembly] Define __USING_WASM_EXCEPTIONS__ for -fwasm-exceptions When using other specific exception options in Clang, such as `-fseh-exceptions` or `-fsjlj-exceptions`, Clang defines a corresponding preprocessor such as `-D__USING_SJLJ_EXCEPTIONS__`. Emscripten does that in our own build system: https://github.com/emscripten-core/emscripten/blob/7dcd7f40749918e141dc33397d2f4311dd80637a/tools/system_libs.py#L1577-L1578 But to make Wasm EH usable in non-Emscripten toolchain, this has to be defined somewhere else. This PR makes Wasm EH consistent with other exception scheme by letting it defined by Clang depending on the exception option. --- clang/lib/Frontend/InitPreprocessor.cpp | 2 ++ clang/test/CodeGenCXX/wasm-eh.cpp | 4 2 files changed, 6 insertions(+) diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index c1d209466ffe5..3cc85ff502776 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -1006,6 +1006,8 @@ static void InitializePredefinedMacros(const TargetInfo , else if (LangOpts.hasDWARFExceptions() && (TI.getTriple().isThumb() || TI.getTriple().isARM())) Builder.defineMacro("__ARM_DWARF_EH__"); + else if (LangOpts.hasWasmExceptions()) +Builder.defineMacro("__USING_WASM_EXCEPTIONS__"); if (LangOpts.Deprecated) Builder.defineMacro("__DEPRECATED"); diff --git a/clang/test/CodeGenCXX/wasm-eh.cpp b/clang/test/CodeGenCXX/wasm-eh.cpp index af023f52191b9..09588985d4e74 100644 --- a/clang/test/CodeGenCXX/wasm-eh.cpp +++ b/clang/test/CodeGenCXX/wasm-eh.cpp @@ -1,4 +1,8 @@ // REQUIRES: webassembly-registered-target + +// RUN: %clang -E -dM %s -target wasm32-unknown-unknown -fwasm-exceptions | FileCheck %s -check-prefix PREPROCESSOR +// PREPROCESSOR: #define __USING_WASM_EXCEPTIONS__ 1 + // RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -mllvm -wasm-enable-eh -exception-model=wasm -target-feature +exception-handling -emit-llvm -o - -std=c++11 | FileCheck %s // RUN: %clang_cc1 %s -triple wasm64-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -mllvm -wasm-enable-eh -exception-model=wasm -target-feature +exception-handling -emit-llvm -o - -std=c++11 | FileCheck %s >From 38b517419cb60e9fb88828847fd8d57542e9a651 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 17 May 2024 21:25:07 + Subject: [PATCH 2/2] Add Wasm condition --- clang/lib/Frontend/InitPreprocessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 3cc85ff502776..f76f16e2228e7 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -1006,7 +1006,7 @@ static void InitializePredefinedMacros(const TargetInfo , else if (LangOpts.hasDWARFExceptions() && (TI.getTriple().isThumb() || TI.getTriple().isARM())) Builder.defineMacro("__ARM_DWARF_EH__"); - else if (LangOpts.hasWasmExceptions()) + else if (LangOpts.hasWasmExceptions() && TI.getTriple().isWasm()) Builder.defineMacro("__USING_WASM_EXCEPTIONS__"); if (LangOpts.Deprecated) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Define __USING_WASM_EXCEPTIONS__ for -fwasm-exceptions (PR #92604)
https://github.com/aheejin ready_for_review https://github.com/llvm/llvm-project/pull/92604 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Define __USING_WASM_EXCEPTIONS__ for -fwasm-exceptions (PR #92604)
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/92604 When using other specific exception options in Clang, such as `-fseh-exceptions` or `-fsjlj-exceptions`, Clang defines a corresponding preprocessor such as `-D__USING_SJLJ_EXCEPTIONS__`. Emscripten does that in our own build system: https://github.com/emscripten-core/emscripten/blob/7dcd7f40749918e141dc33397d2f4311dd80637a/tools/system_libs.py#L1577-L1578 But to make Wasm EH usable in non-Emscripten toolchain, this has to be defined somewhere else. This PR makes Wasm EH consistent with other exception scheme by letting it defined by Clang depending on the exception option. >From bedab4dc6edc3fd44d79c42d4fd62dc1a6937fb0 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 17 May 2024 20:41:21 + Subject: [PATCH] [WebAssembly] Define __USING_WASM_EXCEPTIONS__ for -fwasm-exceptions When using other specific exception options in Clang, such as `-fseh-exceptions` or `-fsjlj-exceptions`, Clang defines a corresponding preprocessor such as `-D__USING_SJLJ_EXCEPTIONS__`. Emscripten does that in our own build system: https://github.com/emscripten-core/emscripten/blob/7dcd7f40749918e141dc33397d2f4311dd80637a/tools/system_libs.py#L1577-L1578 But to make Wasm EH usable in non-Emscripten toolchain, this has to be defined somewhere else. This PR makes Wasm EH consistent with other exception scheme by letting it defined by Clang depending on the exception option. --- clang/lib/Frontend/InitPreprocessor.cpp | 2 ++ clang/test/CodeGenCXX/wasm-eh.cpp | 4 2 files changed, 6 insertions(+) diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index c1d209466ffe5..3cc85ff502776 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -1006,6 +1006,8 @@ static void InitializePredefinedMacros(const TargetInfo , else if (LangOpts.hasDWARFExceptions() && (TI.getTriple().isThumb() || TI.getTriple().isARM())) Builder.defineMacro("__ARM_DWARF_EH__"); + else if (LangOpts.hasWasmExceptions()) +Builder.defineMacro("__USING_WASM_EXCEPTIONS__"); if (LangOpts.Deprecated) Builder.defineMacro("__DEPRECATED"); diff --git a/clang/test/CodeGenCXX/wasm-eh.cpp b/clang/test/CodeGenCXX/wasm-eh.cpp index af023f52191b9..09588985d4e74 100644 --- a/clang/test/CodeGenCXX/wasm-eh.cpp +++ b/clang/test/CodeGenCXX/wasm-eh.cpp @@ -1,4 +1,8 @@ // REQUIRES: webassembly-registered-target + +// RUN: %clang -E -dM %s -target wasm32-unknown-unknown -fwasm-exceptions | FileCheck %s -check-prefix PREPROCESSOR +// PREPROCESSOR: #define __USING_WASM_EXCEPTIONS__ 1 + // RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -mllvm -wasm-enable-eh -exception-model=wasm -target-feature +exception-handling -emit-llvm -o - -std=c++11 | FileCheck %s // RUN: %clang_cc1 %s -triple wasm64-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -mllvm -wasm-enable-eh -exception-model=wasm -target-feature +exception-handling -emit-llvm -o - -std=c++11 | FileCheck %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)
@@ -20,7 +20,7 @@ .text #endif -#if !defined(__USING_SJLJ_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__wasm__) aheejin wrote: Removed the clang change and `LIBUNWIND_USES_WASM_EXCEPTIONS`. https://github.com/llvm/llvm-project/pull/92192 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)
https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/92192 >From 95b9e56ac8bdd3b0bde08f63f64e35d47a61b784 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 14 May 2024 22:08:20 + Subject: [PATCH 1/4] [libunwind][WebAssembly] Make libunwind compilable This tries to make Wasm compilable in LLVM tree with CMake for non-Emscripten platform. This - Adds `-D__USING_WASM_EXCEPTIONS__` when you compile with `-fwasm-exceptions` (like other EH options) in Clang - Exclude `UnwindLevel1.c` when compiling with Wasm - Changed some `__USING_WASM_EXCEPTIONS__` to `__wasm__`; they should be applied when compiling with Wasm w/o exceptions. - Define some unused macros to make it compile --- clang/lib/Frontend/InitPreprocessor.cpp | 2 ++ libunwind/cmake/config-ix.cmake | 1 + libunwind/include/__libunwind_config.h | 4 libunwind/src/UnwindLevel1.c| 3 ++- libunwind/src/libunwind.cpp | 4 ++-- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index c1d209466ffe5..3cc85ff502776 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -1006,6 +1006,8 @@ static void InitializePredefinedMacros(const TargetInfo , else if (LangOpts.hasDWARFExceptions() && (TI.getTriple().isThumb() || TI.getTriple().isARM())) Builder.defineMacro("__ARM_DWARF_EH__"); + else if (LangOpts.hasWasmExceptions()) +Builder.defineMacro("__USING_WASM_EXCEPTIONS__"); if (LangOpts.Deprecated) Builder.defineMacro("__DEPRECATED"); diff --git a/libunwind/cmake/config-ix.cmake b/libunwind/cmake/config-ix.cmake index 126c872f0d489..d505ee1d346fa 100644 --- a/libunwind/cmake/config-ix.cmake +++ b/libunwind/cmake/config-ix.cmake @@ -109,6 +109,7 @@ check_cxx_compiler_flag(-nostdinc++ CXX_SUPPORTS_NOSTDINCXX_FLAG) check_symbol_exists(__arm__ "" LIBUNWIND_TARGET_ARM) check_symbol_exists(__USING_SJLJ_EXCEPTIONS__ "" LIBUNWIND_USES_SJLJ_EXCEPTIONS) check_symbol_exists(__ARM_DWARF_EH__ "" LIBUNWIND_USES_DWARF_EH) +check_symbol_exists(__USING_WASM_EXCEPTIONS__ "" LIBUNWIND_USES_WASM_EXCEPTIONS) if(LIBUNWIND_TARGET_ARM AND NOT LIBUNWIND_USES_SJLJ_EXCEPTIONS AND NOT LIBUNWIND_USES_DWARF_EH) # This condition is copied from __libunwind_config.h diff --git a/libunwind/include/__libunwind_config.h b/libunwind/include/__libunwind_config.h index 8db336b2d727c..7d87831a80446 100644 --- a/libunwind/include/__libunwind_config.h +++ b/libunwind/include/__libunwind_config.h @@ -180,6 +180,10 @@ #endif #define _LIBUNWIND_HIGHEST_DWARF_REGISTER \ _LIBUNWIND_HIGHEST_DWARF_REGISTER_LOONGARCH +#elif defined(__wasm__) +// Unused +# define _LIBUNWIND_CONTEXT_SIZE 0 +# define _LIBUNWIND_CURSOR_SIZE 0 # else # error "Unsupported architecture." # endif diff --git a/libunwind/src/UnwindLevel1.c b/libunwind/src/UnwindLevel1.c index 05d0f2cb0a0a7..48e7bc3b9e00e 100644 --- a/libunwind/src/UnwindLevel1.c +++ b/libunwind/src/UnwindLevel1.c @@ -31,7 +31,8 @@ #include "libunwind_ext.h" #include "unwind.h" -#if !defined(_LIBUNWIND_ARM_EHABI) && !defined(__USING_SJLJ_EXCEPTIONS__) +#if !defined(_LIBUNWIND_ARM_EHABI) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ +!defined(__wasm__) #ifndef _LIBUNWIND_SUPPORT_SEH_UNWIND diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp index 217dde9098637..7e5c6bd263e14 100644 --- a/libunwind/src/libunwind.cpp +++ b/libunwind/src/libunwind.cpp @@ -26,7 +26,7 @@ #include #endif -#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__wasm__) #include "AddressSpace.hpp" #include "UnwindCursor.hpp" @@ -348,7 +348,7 @@ void __unw_remove_dynamic_eh_frame_section(unw_word_t eh_frame_start) { #endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) #endif // !defined(__USING_SJLJ_EXCEPTIONS__) && - // !defined(__USING_WASM_EXCEPTIONS__) + // !defined(__wasm__) #ifdef __APPLE__ >From 496e9b1652a2799c77626082a337803f9c907a3a Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 14 May 2024 23:48:37 + Subject: [PATCH 2/4] clang-format --- libunwind/include/__libunwind_config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libunwind/include/__libunwind_config.h b/libunwind/include/__libunwind_config.h index 7d87831a80446..028b9e3baa806 100644 --- a/libunwind/include/__libunwind_config.h +++ b/libunwind/include/__libunwind_config.h @@ -182,8 +182,8 @@ _LIBUNWIND_HIGHEST_DWARF_REGISTER_LOONGARCH #elif defined(__wasm__) // Unused -# define _LIBUNWIND_CONTEXT_SIZE 0 -# define _LIBUNWIND_CURSOR_SIZE 0 +#define _LIBUNWIND_CONTEXT_SIZE 0 +#define _LIBUNWIND_CURSOR_SIZE 0 # else # error "Unsupported architecture." # endif >From 86179cc37229612c4ee0011a4db8e738587b95db Mon Sep 17 00:00:00 2001 From:
[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)
@@ -20,7 +20,7 @@ .text #endif -#if !defined(__USING_SJLJ_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__wasm__) aheejin wrote: `__wasm__` is defined whenever we compile the code to wasm, and `__USING_WASM_EXCEPTIONS__` is defined when we compile the code to wasm and use Wasm exceptions (`-fwasm-exeptions`). And this code should be excluded whenever it is compiled to wasm, even if `-fwasm-exceptions` is not used. https://github.com/llvm/llvm-project/pull/92192 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)
aheejin wrote: Can someone review this? https://github.com/llvm/llvm-project/pull/92192 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)
https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/92192 >From 95b9e56ac8bdd3b0bde08f63f64e35d47a61b784 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 14 May 2024 22:08:20 + Subject: [PATCH 1/3] [libunwind][WebAssembly] Make libunwind compilable This tries to make Wasm compilable in LLVM tree with CMake for non-Emscripten platform. This - Adds `-D__USING_WASM_EXCEPTIONS__` when you compile with `-fwasm-exceptions` (like other EH options) in Clang - Exclude `UnwindLevel1.c` when compiling with Wasm - Changed some `__USING_WASM_EXCEPTIONS__` to `__wasm__`; they should be applied when compiling with Wasm w/o exceptions. - Define some unused macros to make it compile --- clang/lib/Frontend/InitPreprocessor.cpp | 2 ++ libunwind/cmake/config-ix.cmake | 1 + libunwind/include/__libunwind_config.h | 4 libunwind/src/UnwindLevel1.c| 3 ++- libunwind/src/libunwind.cpp | 4 ++-- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index c1d209466ffe5..3cc85ff502776 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -1006,6 +1006,8 @@ static void InitializePredefinedMacros(const TargetInfo , else if (LangOpts.hasDWARFExceptions() && (TI.getTriple().isThumb() || TI.getTriple().isARM())) Builder.defineMacro("__ARM_DWARF_EH__"); + else if (LangOpts.hasWasmExceptions()) +Builder.defineMacro("__USING_WASM_EXCEPTIONS__"); if (LangOpts.Deprecated) Builder.defineMacro("__DEPRECATED"); diff --git a/libunwind/cmake/config-ix.cmake b/libunwind/cmake/config-ix.cmake index 126c872f0d489..d505ee1d346fa 100644 --- a/libunwind/cmake/config-ix.cmake +++ b/libunwind/cmake/config-ix.cmake @@ -109,6 +109,7 @@ check_cxx_compiler_flag(-nostdinc++ CXX_SUPPORTS_NOSTDINCXX_FLAG) check_symbol_exists(__arm__ "" LIBUNWIND_TARGET_ARM) check_symbol_exists(__USING_SJLJ_EXCEPTIONS__ "" LIBUNWIND_USES_SJLJ_EXCEPTIONS) check_symbol_exists(__ARM_DWARF_EH__ "" LIBUNWIND_USES_DWARF_EH) +check_symbol_exists(__USING_WASM_EXCEPTIONS__ "" LIBUNWIND_USES_WASM_EXCEPTIONS) if(LIBUNWIND_TARGET_ARM AND NOT LIBUNWIND_USES_SJLJ_EXCEPTIONS AND NOT LIBUNWIND_USES_DWARF_EH) # This condition is copied from __libunwind_config.h diff --git a/libunwind/include/__libunwind_config.h b/libunwind/include/__libunwind_config.h index 8db336b2d727c..7d87831a80446 100644 --- a/libunwind/include/__libunwind_config.h +++ b/libunwind/include/__libunwind_config.h @@ -180,6 +180,10 @@ #endif #define _LIBUNWIND_HIGHEST_DWARF_REGISTER \ _LIBUNWIND_HIGHEST_DWARF_REGISTER_LOONGARCH +#elif defined(__wasm__) +// Unused +# define _LIBUNWIND_CONTEXT_SIZE 0 +# define _LIBUNWIND_CURSOR_SIZE 0 # else # error "Unsupported architecture." # endif diff --git a/libunwind/src/UnwindLevel1.c b/libunwind/src/UnwindLevel1.c index 05d0f2cb0a0a7..48e7bc3b9e00e 100644 --- a/libunwind/src/UnwindLevel1.c +++ b/libunwind/src/UnwindLevel1.c @@ -31,7 +31,8 @@ #include "libunwind_ext.h" #include "unwind.h" -#if !defined(_LIBUNWIND_ARM_EHABI) && !defined(__USING_SJLJ_EXCEPTIONS__) +#if !defined(_LIBUNWIND_ARM_EHABI) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ +!defined(__wasm__) #ifndef _LIBUNWIND_SUPPORT_SEH_UNWIND diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp index 217dde9098637..7e5c6bd263e14 100644 --- a/libunwind/src/libunwind.cpp +++ b/libunwind/src/libunwind.cpp @@ -26,7 +26,7 @@ #include #endif -#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__wasm__) #include "AddressSpace.hpp" #include "UnwindCursor.hpp" @@ -348,7 +348,7 @@ void __unw_remove_dynamic_eh_frame_section(unw_word_t eh_frame_start) { #endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) #endif // !defined(__USING_SJLJ_EXCEPTIONS__) && - // !defined(__USING_WASM_EXCEPTIONS__) + // !defined(__wasm__) #ifdef __APPLE__ >From 496e9b1652a2799c77626082a337803f9c907a3a Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 14 May 2024 23:48:37 + Subject: [PATCH 2/3] clang-format --- libunwind/include/__libunwind_config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libunwind/include/__libunwind_config.h b/libunwind/include/__libunwind_config.h index 7d87831a80446..028b9e3baa806 100644 --- a/libunwind/include/__libunwind_config.h +++ b/libunwind/include/__libunwind_config.h @@ -182,8 +182,8 @@ _LIBUNWIND_HIGHEST_DWARF_REGISTER_LOONGARCH #elif defined(__wasm__) // Unused -# define _LIBUNWIND_CONTEXT_SIZE 0 -# define _LIBUNWIND_CURSOR_SIZE 0 +#define _LIBUNWIND_CONTEXT_SIZE 0 +#define _LIBUNWIND_CURSOR_SIZE 0 # else # error "Unsupported architecture." # endif >From 86179cc37229612c4ee0011a4db8e738587b95db Mon Sep 17 00:00:00 2001 From:
[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)
https://github.com/aheejin ready_for_review https://github.com/llvm/llvm-project/pull/92192 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/92192 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)
https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/92192 >From 95b9e56ac8bdd3b0bde08f63f64e35d47a61b784 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 14 May 2024 22:08:20 + Subject: [PATCH 1/3] [libunwind][WebAssembly] Make libunwind compilable This tries to make Wasm compilable in LLVM tree with CMake for non-Emscripten platform. This - Adds `-D__USING_WASM_EXCEPTIONS__` when you compile with `-fwasm-exceptions` (like other EH options) in Clang - Exclude `UnwindLevel1.c` when compiling with Wasm - Changed some `__USING_WASM_EXCEPTIONS__` to `__wasm__`; they should be applied when compiling with Wasm w/o exceptions. - Define some unused macros to make it compile --- clang/lib/Frontend/InitPreprocessor.cpp | 2 ++ libunwind/cmake/config-ix.cmake | 1 + libunwind/include/__libunwind_config.h | 4 libunwind/src/UnwindLevel1.c| 3 ++- libunwind/src/libunwind.cpp | 4 ++-- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index c1d209466ffe5..3cc85ff502776 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -1006,6 +1006,8 @@ static void InitializePredefinedMacros(const TargetInfo , else if (LangOpts.hasDWARFExceptions() && (TI.getTriple().isThumb() || TI.getTriple().isARM())) Builder.defineMacro("__ARM_DWARF_EH__"); + else if (LangOpts.hasWasmExceptions()) +Builder.defineMacro("__USING_WASM_EXCEPTIONS__"); if (LangOpts.Deprecated) Builder.defineMacro("__DEPRECATED"); diff --git a/libunwind/cmake/config-ix.cmake b/libunwind/cmake/config-ix.cmake index 126c872f0d489..d505ee1d346fa 100644 --- a/libunwind/cmake/config-ix.cmake +++ b/libunwind/cmake/config-ix.cmake @@ -109,6 +109,7 @@ check_cxx_compiler_flag(-nostdinc++ CXX_SUPPORTS_NOSTDINCXX_FLAG) check_symbol_exists(__arm__ "" LIBUNWIND_TARGET_ARM) check_symbol_exists(__USING_SJLJ_EXCEPTIONS__ "" LIBUNWIND_USES_SJLJ_EXCEPTIONS) check_symbol_exists(__ARM_DWARF_EH__ "" LIBUNWIND_USES_DWARF_EH) +check_symbol_exists(__USING_WASM_EXCEPTIONS__ "" LIBUNWIND_USES_WASM_EXCEPTIONS) if(LIBUNWIND_TARGET_ARM AND NOT LIBUNWIND_USES_SJLJ_EXCEPTIONS AND NOT LIBUNWIND_USES_DWARF_EH) # This condition is copied from __libunwind_config.h diff --git a/libunwind/include/__libunwind_config.h b/libunwind/include/__libunwind_config.h index 8db336b2d727c..7d87831a80446 100644 --- a/libunwind/include/__libunwind_config.h +++ b/libunwind/include/__libunwind_config.h @@ -180,6 +180,10 @@ #endif #define _LIBUNWIND_HIGHEST_DWARF_REGISTER \ _LIBUNWIND_HIGHEST_DWARF_REGISTER_LOONGARCH +#elif defined(__wasm__) +// Unused +# define _LIBUNWIND_CONTEXT_SIZE 0 +# define _LIBUNWIND_CURSOR_SIZE 0 # else # error "Unsupported architecture." # endif diff --git a/libunwind/src/UnwindLevel1.c b/libunwind/src/UnwindLevel1.c index 05d0f2cb0a0a7..48e7bc3b9e00e 100644 --- a/libunwind/src/UnwindLevel1.c +++ b/libunwind/src/UnwindLevel1.c @@ -31,7 +31,8 @@ #include "libunwind_ext.h" #include "unwind.h" -#if !defined(_LIBUNWIND_ARM_EHABI) && !defined(__USING_SJLJ_EXCEPTIONS__) +#if !defined(_LIBUNWIND_ARM_EHABI) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ +!defined(__wasm__) #ifndef _LIBUNWIND_SUPPORT_SEH_UNWIND diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp index 217dde9098637..7e5c6bd263e14 100644 --- a/libunwind/src/libunwind.cpp +++ b/libunwind/src/libunwind.cpp @@ -26,7 +26,7 @@ #include #endif -#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__wasm__) #include "AddressSpace.hpp" #include "UnwindCursor.hpp" @@ -348,7 +348,7 @@ void __unw_remove_dynamic_eh_frame_section(unw_word_t eh_frame_start) { #endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) #endif // !defined(__USING_SJLJ_EXCEPTIONS__) && - // !defined(__USING_WASM_EXCEPTIONS__) + // !defined(__wasm__) #ifdef __APPLE__ >From 496e9b1652a2799c77626082a337803f9c907a3a Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 14 May 2024 23:48:37 + Subject: [PATCH 2/3] clang-format --- libunwind/include/__libunwind_config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libunwind/include/__libunwind_config.h b/libunwind/include/__libunwind_config.h index 7d87831a80446..028b9e3baa806 100644 --- a/libunwind/include/__libunwind_config.h +++ b/libunwind/include/__libunwind_config.h @@ -182,8 +182,8 @@ _LIBUNWIND_HIGHEST_DWARF_REGISTER_LOONGARCH #elif defined(__wasm__) // Unused -# define _LIBUNWIND_CONTEXT_SIZE 0 -# define _LIBUNWIND_CURSOR_SIZE 0 +#define _LIBUNWIND_CONTEXT_SIZE 0 +#define _LIBUNWIND_CURSOR_SIZE 0 # else # error "Unsupported architecture." # endif >From 86179cc37229612c4ee0011a4db8e738587b95db Mon Sep 17 00:00:00 2001 From:
[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)
https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/92192 >From 95b9e56ac8bdd3b0bde08f63f64e35d47a61b784 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 14 May 2024 22:08:20 + Subject: [PATCH 1/2] [libunwind][WebAssembly] Make libunwind compilable This tries to make Wasm compilable in LLVM tree with CMake for non-Emscripten platform. This - Adds `-D__USING_WASM_EXCEPTIONS__` when you compile with `-fwasm-exceptions` (like other EH options) in Clang - Exclude `UnwindLevel1.c` when compiling with Wasm - Changed some `__USING_WASM_EXCEPTIONS__` to `__wasm__`; they should be applied when compiling with Wasm w/o exceptions. - Define some unused macros to make it compile --- clang/lib/Frontend/InitPreprocessor.cpp | 2 ++ libunwind/cmake/config-ix.cmake | 1 + libunwind/include/__libunwind_config.h | 4 libunwind/src/UnwindLevel1.c| 3 ++- libunwind/src/libunwind.cpp | 4 ++-- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index c1d209466ffe5..3cc85ff502776 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -1006,6 +1006,8 @@ static void InitializePredefinedMacros(const TargetInfo , else if (LangOpts.hasDWARFExceptions() && (TI.getTriple().isThumb() || TI.getTriple().isARM())) Builder.defineMacro("__ARM_DWARF_EH__"); + else if (LangOpts.hasWasmExceptions()) +Builder.defineMacro("__USING_WASM_EXCEPTIONS__"); if (LangOpts.Deprecated) Builder.defineMacro("__DEPRECATED"); diff --git a/libunwind/cmake/config-ix.cmake b/libunwind/cmake/config-ix.cmake index 126c872f0d489..d505ee1d346fa 100644 --- a/libunwind/cmake/config-ix.cmake +++ b/libunwind/cmake/config-ix.cmake @@ -109,6 +109,7 @@ check_cxx_compiler_flag(-nostdinc++ CXX_SUPPORTS_NOSTDINCXX_FLAG) check_symbol_exists(__arm__ "" LIBUNWIND_TARGET_ARM) check_symbol_exists(__USING_SJLJ_EXCEPTIONS__ "" LIBUNWIND_USES_SJLJ_EXCEPTIONS) check_symbol_exists(__ARM_DWARF_EH__ "" LIBUNWIND_USES_DWARF_EH) +check_symbol_exists(__USING_WASM_EXCEPTIONS__ "" LIBUNWIND_USES_WASM_EXCEPTIONS) if(LIBUNWIND_TARGET_ARM AND NOT LIBUNWIND_USES_SJLJ_EXCEPTIONS AND NOT LIBUNWIND_USES_DWARF_EH) # This condition is copied from __libunwind_config.h diff --git a/libunwind/include/__libunwind_config.h b/libunwind/include/__libunwind_config.h index 8db336b2d727c..7d87831a80446 100644 --- a/libunwind/include/__libunwind_config.h +++ b/libunwind/include/__libunwind_config.h @@ -180,6 +180,10 @@ #endif #define _LIBUNWIND_HIGHEST_DWARF_REGISTER \ _LIBUNWIND_HIGHEST_DWARF_REGISTER_LOONGARCH +#elif defined(__wasm__) +// Unused +# define _LIBUNWIND_CONTEXT_SIZE 0 +# define _LIBUNWIND_CURSOR_SIZE 0 # else # error "Unsupported architecture." # endif diff --git a/libunwind/src/UnwindLevel1.c b/libunwind/src/UnwindLevel1.c index 05d0f2cb0a0a7..48e7bc3b9e00e 100644 --- a/libunwind/src/UnwindLevel1.c +++ b/libunwind/src/UnwindLevel1.c @@ -31,7 +31,8 @@ #include "libunwind_ext.h" #include "unwind.h" -#if !defined(_LIBUNWIND_ARM_EHABI) && !defined(__USING_SJLJ_EXCEPTIONS__) +#if !defined(_LIBUNWIND_ARM_EHABI) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ +!defined(__wasm__) #ifndef _LIBUNWIND_SUPPORT_SEH_UNWIND diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp index 217dde9098637..7e5c6bd263e14 100644 --- a/libunwind/src/libunwind.cpp +++ b/libunwind/src/libunwind.cpp @@ -26,7 +26,7 @@ #include #endif -#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__wasm__) #include "AddressSpace.hpp" #include "UnwindCursor.hpp" @@ -348,7 +348,7 @@ void __unw_remove_dynamic_eh_frame_section(unw_word_t eh_frame_start) { #endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) #endif // !defined(__USING_SJLJ_EXCEPTIONS__) && - // !defined(__USING_WASM_EXCEPTIONS__) + // !defined(__wasm__) #ifdef __APPLE__ >From 496e9b1652a2799c77626082a337803f9c907a3a Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 14 May 2024 23:48:37 + Subject: [PATCH 2/2] clang-format --- libunwind/include/__libunwind_config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libunwind/include/__libunwind_config.h b/libunwind/include/__libunwind_config.h index 7d87831a80446..028b9e3baa806 100644 --- a/libunwind/include/__libunwind_config.h +++ b/libunwind/include/__libunwind_config.h @@ -182,8 +182,8 @@ _LIBUNWIND_HIGHEST_DWARF_REGISTER_LOONGARCH #elif defined(__wasm__) // Unused -# define _LIBUNWIND_CONTEXT_SIZE 0 -# define _LIBUNWIND_CURSOR_SIZE 0 +#define _LIBUNWIND_CONTEXT_SIZE 0 +#define _LIBUNWIND_CURSOR_SIZE 0 # else # error "Unsupported architecture." # endif ___ cfe-commits mailing list
[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/92192 This tries to make Wasm compilable in LLVM tree with CMake for non-Emscripten platform. This - Adds `-D__USING_WASM_EXCEPTIONS__` when you compile with `-fwasm-exceptions` (like other EH options) in Clang - Exclude `UnwindLevel1.c` when compiling with Wasm - Changed some `__USING_WASM_EXCEPTIONS__` to `__wasm__`; they should be applied when compiling with Wasm w/o exceptions. - Define some unused macros to make it compile >From 95b9e56ac8bdd3b0bde08f63f64e35d47a61b784 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 14 May 2024 22:08:20 + Subject: [PATCH] [libunwind][WebAssembly] Make libunwind compilable This tries to make Wasm compilable in LLVM tree with CMake for non-Emscripten platform. This - Adds `-D__USING_WASM_EXCEPTIONS__` when you compile with `-fwasm-exceptions` (like other EH options) in Clang - Exclude `UnwindLevel1.c` when compiling with Wasm - Changed some `__USING_WASM_EXCEPTIONS__` to `__wasm__`; they should be applied when compiling with Wasm w/o exceptions. - Define some unused macros to make it compile --- clang/lib/Frontend/InitPreprocessor.cpp | 2 ++ libunwind/cmake/config-ix.cmake | 1 + libunwind/include/__libunwind_config.h | 4 libunwind/src/UnwindLevel1.c| 3 ++- libunwind/src/libunwind.cpp | 4 ++-- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index c1d209466ffe5..3cc85ff502776 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -1006,6 +1006,8 @@ static void InitializePredefinedMacros(const TargetInfo , else if (LangOpts.hasDWARFExceptions() && (TI.getTriple().isThumb() || TI.getTriple().isARM())) Builder.defineMacro("__ARM_DWARF_EH__"); + else if (LangOpts.hasWasmExceptions()) +Builder.defineMacro("__USING_WASM_EXCEPTIONS__"); if (LangOpts.Deprecated) Builder.defineMacro("__DEPRECATED"); diff --git a/libunwind/cmake/config-ix.cmake b/libunwind/cmake/config-ix.cmake index 126c872f0d489..d505ee1d346fa 100644 --- a/libunwind/cmake/config-ix.cmake +++ b/libunwind/cmake/config-ix.cmake @@ -109,6 +109,7 @@ check_cxx_compiler_flag(-nostdinc++ CXX_SUPPORTS_NOSTDINCXX_FLAG) check_symbol_exists(__arm__ "" LIBUNWIND_TARGET_ARM) check_symbol_exists(__USING_SJLJ_EXCEPTIONS__ "" LIBUNWIND_USES_SJLJ_EXCEPTIONS) check_symbol_exists(__ARM_DWARF_EH__ "" LIBUNWIND_USES_DWARF_EH) +check_symbol_exists(__USING_WASM_EXCEPTIONS__ "" LIBUNWIND_USES_WASM_EXCEPTIONS) if(LIBUNWIND_TARGET_ARM AND NOT LIBUNWIND_USES_SJLJ_EXCEPTIONS AND NOT LIBUNWIND_USES_DWARF_EH) # This condition is copied from __libunwind_config.h diff --git a/libunwind/include/__libunwind_config.h b/libunwind/include/__libunwind_config.h index 8db336b2d727c..7d87831a80446 100644 --- a/libunwind/include/__libunwind_config.h +++ b/libunwind/include/__libunwind_config.h @@ -180,6 +180,10 @@ #endif #define _LIBUNWIND_HIGHEST_DWARF_REGISTER \ _LIBUNWIND_HIGHEST_DWARF_REGISTER_LOONGARCH +#elif defined(__wasm__) +// Unused +# define _LIBUNWIND_CONTEXT_SIZE 0 +# define _LIBUNWIND_CURSOR_SIZE 0 # else # error "Unsupported architecture." # endif diff --git a/libunwind/src/UnwindLevel1.c b/libunwind/src/UnwindLevel1.c index 05d0f2cb0a0a7..48e7bc3b9e00e 100644 --- a/libunwind/src/UnwindLevel1.c +++ b/libunwind/src/UnwindLevel1.c @@ -31,7 +31,8 @@ #include "libunwind_ext.h" #include "unwind.h" -#if !defined(_LIBUNWIND_ARM_EHABI) && !defined(__USING_SJLJ_EXCEPTIONS__) +#if !defined(_LIBUNWIND_ARM_EHABI) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ +!defined(__wasm__) #ifndef _LIBUNWIND_SUPPORT_SEH_UNWIND diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp index 217dde9098637..7e5c6bd263e14 100644 --- a/libunwind/src/libunwind.cpp +++ b/libunwind/src/libunwind.cpp @@ -26,7 +26,7 @@ #include #endif -#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__wasm__) #include "AddressSpace.hpp" #include "UnwindCursor.hpp" @@ -348,7 +348,7 @@ void __unw_remove_dynamic_eh_frame_section(unw_word_t eh_frame_start) { #endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) #endif // !defined(__USING_SJLJ_EXCEPTIONS__) && - // !defined(__USING_WASM_EXCEPTIONS__) + // !defined(__wasm__) #ifdef __APPLE__ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement prototype f32.store_f16 instruction. (PR #91545)
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/91545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement prototype f32.store_f16 instruction. (PR #91545)
https://github.com/aheejin approved this pull request. LGTM with removing the pure attribute https://github.com/llvm/llvm-project/pull/91545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement prototype f32.store_f16 instruction. (PR #91545)
@@ -192,6 +192,7 @@ TARGET_BUILTIN(__builtin_wasm_relaxed_dot_bf16x8_add_f32_f32x4, "V4fV8UsV8UsV4f" // Half-Precision (fp16) TARGET_BUILTIN(__builtin_wasm_loadf16_f32, "fh*", "nU", "half-precision") +TARGET_BUILTIN(__builtin_wasm_storef16_f32, "vfh*", "nU", "half-precision") aheejin wrote: I'm not exactly sure about the definition, but Builtins.def says it should be in sync with `Builtin::Context` class: https://github.com/llvm/llvm-project/blob/b942c24845a39e6161c8623b1efc4e2083d879e9/clang/include/clang/Basic/Builtins.def#L67-L68 And `Builtin::Context` says this: https://github.com/llvm/llvm-project/blob/b942c24845a39e6161c8623b1efc4e2083d879e9/clang/include/clang/Basic/Builtins.h#L115-L118 So I guess stores cannot be considered as pure, because they have side effects. https://github.com/llvm/llvm-project/pull/91545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement prototype f32.store_f16 instruction. (PR #91545)
@@ -171,12 +171,16 @@ defm STORE8_I64 : WebAssemblyStore; defm STORE16_I64 : WebAssemblyStore; defm STORE32_I64 : WebAssemblyStore; +defm STORE_F16_F32 : WebAssemblyStore; aheejin wrote: How about adding one for `LOAD` too? https://github.com/llvm/llvm-project/pull/91545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement prototype f32.store_f16 instruction. (PR #91545)
@@ -192,6 +192,7 @@ TARGET_BUILTIN(__builtin_wasm_relaxed_dot_bf16x8_add_f32_f32x4, "V4fV8UsV8UsV4f" // Half-Precision (fp16) TARGET_BUILTIN(__builtin_wasm_loadf16_f32, "fh*", "nU", "half-precision") +TARGET_BUILTIN(__builtin_wasm_storef16_f32, "vfh*", "nU", "half-precision") aheejin wrote: Can stores be considered pure? https://github.com/llvm/llvm-project/pull/91545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement prototype f32.store_f16 instruction. (PR #91545)
@@ -171,12 +171,16 @@ defm STORE8_I64 : WebAssemblyStore; defm STORE16_I64 : WebAssemblyStore; defm STORE32_I64 : WebAssemblyStore; +defm STORE_F16_F32 : WebAssemblyStore; aheejin wrote: ```suggestion // Half-precision store. defm STORE_F16_F32 : WebAssemblyStore; ``` How about adding one-line comment? The same for `LOAD` too. Also 80-col wrapping. https://github.com/llvm/llvm-project/pull/91545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Make EH depend on multivalue and reference-types (PR #91299)
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/91299 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Make EH depend on multivalue and reference-types (PR #91299)
aheejin wrote: According to https://webassembly.org/features/, EH is supported from node v17, which is also Emscripten test infra requires: https://github.com/emscripten-core/emscripten/blob/2fefc1911e2e6265174c3fd5da38c8e9ab7abb60/test/common.py#L866-L868 So EH tests should have been already being skipped in Chromium CI, so I don't think the same problem will happen there. https://github.com/llvm/llvm-project/pull/91299 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Make EH depend on multivalue and reference-types (PR #91299)
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/91299 This PR turns on multivalue and reference-types features when exception-handling feature is turned on, and errors out when disabling of those dependent features is explicitly requested. I think doing this would be safe anyway regardless of whether or when we end up turning on reference-types by default. We currently don't yet have a experimental flag for the Clang and LLVM for the new experimental EH yet. But I think it should be fine to turn those features on even if the LLVM does not yet generate the new EH instructions, for the same reason we tried to turn them on by default and the browsers that support EH also support multivalue and reference-types anyway. >From 527209b600696885ab926cbf09c88feed8a18544 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 7 May 2024 05:31:24 + Subject: [PATCH] [WebAssembly] Make EH depend on multivalue and reference-types This PR turns on multivalue and reference-types features when exception-handling feature is turned on, and errors out when disabling of those dependent features is explicitly requested. I think doing this would be safe anyway regardless of whether or when we end up turning on reference-types by default. We currently don't yet have a experimental flag for the Clang and LLVM for the new experimental EH yet. But I think it should be fine to turn those features on even if the LLVM does not yet generate the new EH instructions, for the same reason we tried to turn them on by default and the browsers that support EH also support multivalue and reference-types anyway. --- clang/lib/Driver/ToolChains/WebAssembly.cpp | 34 ++ clang/test/Driver/wasm-toolchain.c | 39 + 2 files changed, 67 insertions(+), 6 deletions(-) diff --git a/clang/lib/Driver/ToolChains/WebAssembly.cpp b/clang/lib/Driver/ToolChains/WebAssembly.cpp index b7c6efab83e806..5b763df9b33293 100644 --- a/clang/lib/Driver/ToolChains/WebAssembly.cpp +++ b/clang/lib/Driver/ToolChains/WebAssembly.cpp @@ -347,6 +347,23 @@ void WebAssembly::addClangTargetOptions(const ArgList , // Backend needs -wasm-enable-eh to enable Wasm EH CC1Args.push_back("-mllvm"); CC1Args.push_back("-wasm-enable-eh"); + +// New Wasm EH spec (adopted in Oct 2023) requires multivalue and +// reference-types. +if (DriverArgs.hasFlag(options::OPT_mno_multivalue, + options::OPT_mmultivalue, false)) { + getDriver().Diag(diag::err_drv_argument_not_allowed_with) + << "-fwasm-exceptions" << "-mno-multivalue"; +} +if (DriverArgs.hasFlag(options::OPT_mno_reference_types, + options::OPT_mreference_types, false)) { + getDriver().Diag(diag::err_drv_argument_not_allowed_with) + << "-fwasm-exceptions" << "-mno-reference-types"; +} +CC1Args.push_back("-target-feature"); +CC1Args.push_back("+multivalue"); +CC1Args.push_back("-target-feature"); +CC1Args.push_back("+reference-types"); } for (const Arg *A : DriverArgs.filtered(options::OPT_mllvm)) { @@ -408,6 +425,23 @@ void WebAssembly::addClangTargetOptions(const ArgList , CC1Args.push_back("+exception-handling"); // Backend needs '-exception-model=wasm' to use Wasm EH instructions CC1Args.push_back("-exception-model=wasm"); + + // New Wasm EH spec (adopted in Oct 2023) requires multivalue and + // reference-types. + if (DriverArgs.hasFlag(options::OPT_mno_multivalue, + options::OPT_mmultivalue, false)) { +getDriver().Diag(diag::err_drv_argument_not_allowed_with) +<< "-mllvm -wasm-enable-sjlj" << "-mno-multivalue"; + } + if (DriverArgs.hasFlag(options::OPT_mno_reference_types, + options::OPT_mreference_types, false)) { +getDriver().Diag(diag::err_drv_argument_not_allowed_with) +<< "-mllvm -wasm-enable-sjlj" << "-mno-reference-types"; + } + CC1Args.push_back("-target-feature"); + CC1Args.push_back("+multivalue"); + CC1Args.push_back("-target-feature"); + CC1Args.push_back("+reference-types"); } } } diff --git a/clang/test/Driver/wasm-toolchain.c b/clang/test/Driver/wasm-toolchain.c index dabf0ac2433bbb..7c26c2c13c0baf 100644 --- a/clang/test/Driver/wasm-toolchain.c +++ b/clang/test/Driver/wasm-toolchain.c @@ -120,11 +120,12 @@ // RUN: | FileCheck -check-prefix=EMSCRIPTEN_EH_ALLOWED_WO_ENABLE %s // EMSCRIPTEN_EH_ALLOWED_WO_ENABLE: invalid argument '-mllvm -emscripten-cxx-exceptions-allowed' only allowed with '-mllvm -enable-emscripten-cxx-exceptions' -// '-fwasm-exceptions' sets +exception-handling and '-mllvm -wasm-enable-eh' +// '-fwasm-exceptions' sets +exception-handling, -multivalue, -reference-types +// and '-mllvm -wasm-enable-eh' // RUN: %clang -### --target=wasm32-unknown-unknown \ // RUN:--sysroot=/foo %s
[clang] [llvm] [WebAssembly] Implement prototype f32.load_f16 instruction. (PR #90906)
https://github.com/aheejin approved this pull request. https://github.com/llvm/llvm-project/pull/90906 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Add all remaining features to bleeding-edge (PR #90875)
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/90875 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement prototype f32.load_f16 instruction. (PR #90906)
@@ -321,6 +321,18 @@ def int_wasm_relaxed_dot_bf16x8_add_f32: [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v4f32_ty], [IntrNoMem, IntrSpeculatable]>; +//===--===// +// Half-precision intrinsics (experimental) +//===--===// + +// TODO: Replace these intrinsic with normal ISel patterns once the XXX +// instructions are merged to the proposal. +def int_wasm_loadf16_f32: + Intrinsic<[llvm_float_ty], +[llvm_ptr_ty], +[IntrReadMem, IntrArgMemOnly], + "", [SDNPMemOperand]>; aheejin wrote: Hmm I'm not sure. If this works without the name I guess it's fine. https://github.com/llvm/llvm-project/pull/90906 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement prototype f32.load_f16 instruction. (PR #90906)
@@ -38,6 +38,13 @@ multiclass RELAXED_I; } +multiclass HALF_PRECISION_I pattern_r, string asmstr_r = "", +string asmstr_s = "", bits<32> simdop = -1> { + defm "" : ABSTRACT_SIMD_I; +} + aheejin wrote: Is this used in this PR? If not, how about adding this when this is used? https://github.com/llvm/llvm-project/pull/90906 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement prototype f32.load_f16 instruction. (PR #90906)
@@ -321,6 +321,18 @@ def int_wasm_relaxed_dot_bf16x8_add_f32: [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v4f32_ty], [IntrNoMem, IntrSpeculatable]>; +//===--===// +// Half-precision intrinsics (experimental) +//===--===// + +// TODO: Replace these intrinsic with normal ISel patterns once the XXX +// instructions are merged to the proposal. +def int_wasm_loadf16_f32: + Intrinsic<[llvm_float_ty], +[llvm_ptr_ty], +[IntrReadMem, IntrArgMemOnly], + "", [SDNPMemOperand]>; aheejin wrote: Why is the name empty? https://github.com/llvm/llvm-project/pull/90906 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement prototype f32.load_f16 instruction. (PR #90906)
https://github.com/aheejin commented: Given that this uses `LOADPAT`, how about adding offset tests like other loads in https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/WebAssembly/offset.ll ? https://github.com/llvm/llvm-project/pull/90906 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement prototype f32.load_f16 instruction. (PR #90906)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/90906 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Add all remaining features to bleeding-edge (PR #90875)
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/90875 I'm not entirely sure what the criteria for 'bleeding-edge' used to be, but at this point it seems to be the set of all added features in LLVM. This adds remaining features to bleeding-edge config. >From 90b8bf241af9e668a5d2a3bf7ff2f7ab3c3a70d9 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Mon, 29 Apr 2024 23:14:58 + Subject: [PATCH] [WebAssembly] Add all remaining features to bleeding-edge I'm not entirely sure what the criteria for 'bleeding-edge' used to be, but at this point it seems to be the set of all added features in LLVM. This adds remaining features to bleeding-edge config. --- clang/lib/Basic/Targets/WebAssembly.cpp| 4 +++- clang/test/Preprocessor/wasm-target-features.c | 14 +++--- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index 2140451aab6d03..5a000314a72cee 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -159,12 +159,14 @@ bool WebAssemblyTargetInfo::initFeatureMap( addGenericFeatures(); Features["atomics"] = true; Features["bulk-memory"] = true; +Features["exception-handling"] = true; +Features["extended-const"] = true; Features["half-precision"] = true; Features["multimemory"] = true; Features["nontrapping-fptoint"] = true; Features["reference-types"] = true; Features["tail-call"] = true; -setSIMDLevel(Features, SIMD128, true); +setSIMDLevel(Features, RelaxedSIMD, true); }; if (CPU == "generic") { addGenericFeatures(); diff --git a/clang/test/Preprocessor/wasm-target-features.c b/clang/test/Preprocessor/wasm-target-features.c index 5a4f85461d5aa2..9d49e3af603f82 100644 --- a/clang/test/Preprocessor/wasm-target-features.c +++ b/clang/test/Preprocessor/wasm-target-features.c @@ -194,26 +194,18 @@ // // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_atomics__ 1{{$}} // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_bulk_memory__ 1{{$}} +// BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_exception_handling__ 1{{$}} +// BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_extended_const__ 1{{$}} // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_half_precision__ 1{{$}} // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_multimemory__ 1{{$}} // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_multivalue__ 1{{$}} // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_mutable_globals__ 1{{$}} // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_nontrapping_fptoint__ 1{{$}} // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_reference_types__ 1{{$}} +// BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_relaxed_simd__ 1{{$}} // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_sign_ext__ 1{{$}} // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_simd128__ 1{{$}} // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_tail_call__ 1{{$}} -// -// RUN: %clang -E -dM %s -o - 2>&1 \ -// RUN: -target wasm32-unknown-unknown -mcpu=bleeding-edge \ -// RUN: | FileCheck %s -check-prefix=BLEEDING-EDGE -// RUN: %clang -E -dM %s -o - 2>&1 \ -// RUN: -target wasm64-unknown-unknown -mcpu=bleeding-edge \ -// RUN: | FileCheck %s -check-prefix=BLEEDING-EDGE -// -// BLEEDING-EDGE-NOT: #define __wasm_exception_handling__ 1{{$}} -// BLEEDING-EDGE-NOT: #define __wasm_extended_const__ 1{{$}} -// BLEEDING-EDGE-NOT: #define __wasm_relaxed_simd__ 1{{$}} // RUN: %clang -E -dM %s -o - 2>&1 \ // RUN: -target wasm32-unknown-unknown -mcpu=bleeding-edge -mno-simd128 \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Sort target features (NFC) (PR #90777)
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/90777 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Disable reference types in generic CPU (PR #90792)
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/90792 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Disable reference types in generic CPU (PR #90792)
aheejin wrote: Will land this given that this is necessary to unblock the rolls and the full CI will take more than a full day. https://github.com/llvm/llvm-project/pull/90792 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Disable reference types in generic CPU (PR #90792)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/90792 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Disable reference types in generic CPU (PR #90792)
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/90792 #80923 newly enabled multivalue and reference-types in the generic CPU. But enabling reference-types ended up breaking up Wasm's Chromium CI (https://chromium-review.googlesource.com/c/emscripten-releases/+/5500231) because the way the table index is encoded different from MVP (u32) vs. reference-types (LEB), which caused different encodings for `call_indirect`. And Chromium CI's and Emscripten's minimum required node version is v16, which does not yet support reference-types, which does not recognize that table index encoding. reference-types is first supported in node v17.2. We knew the current minimum required node for Emscripten (v16) did not support reference-types, but thought it was fine because unless you explicitly use `__funcref` or `__externref` things would be fine, and if you want to use them explicitly, you would have a newer node. But it turned out it also affected the encoding of `call_indirect`. While we are discussing the potential solutions, I will disable reference-types to unblock the rolls. >From b96e36be110517740b39b9ae305edc0bbc595260 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Wed, 1 May 2024 22:49:22 + Subject: [PATCH] [WebAssembly] Disable reference types in generic CPU #80923 newly enabled multivalue and reference-types in the generic CPU. But enabling reference-types ended up breaking up Wasm's Chromium CI (https://chromium-review.googlesource.com/c/emscripten-releases/+/5500231) because the way the table index is encoded different from MVP (u32) vs. reference-types (LEB), which caused different encodings for `call_indirect`. And Chromium CI's and Emscripten's minimum required node version is v16, which does not yet support reference-types, which does not recognize that table index encoding. reference-types is first supported in node v17.2. We knew the current minimum required node for Emscripten (v16) did not support reference-types, but thought it was fine because unless you explicitly use `__funcref` or `__externref` things would be fine, and if you want to use them explicitly, you would have a newer node. But it turned out it also affected the encoding of `call_indirect`. While we are discussing the potential solutions, I will disable reference-types to unblock the rolls. --- clang/docs/ReleaseNotes.rst| 8 clang/lib/Basic/Targets/WebAssembly.cpp| 2 +- clang/test/Preprocessor/wasm-target-features.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 2c5308fbcb319a..0e3f7cf89ca885 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -742,10 +742,10 @@ AIX Support WebAssembly Support ^^^ -The -mcpu=generic configuration now enables multivalue and reference-types.These -proposals are standardized and available in all major engines. Enabling -multivalue here only enables the language feature but does not turn on the -multivalue ABI (this enables non-ABI uses of multivalue, like exnref). +The -mcpu=generic configuration now enables multivalue feature, which is +standardized and available in all major engines. Enabling multivalue here only +enables the language feature but does not turn on the multivalue ABI (this +enables non-ABI uses of multivalue, like exnref). AVR Support ^^^ diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index 1f0418b21c1f86..a6d820e108088f 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -153,7 +153,6 @@ bool WebAssemblyTargetInfo::initFeatureMap( auto addGenericFeatures = [&]() { Features["multivalue"] = true; Features["mutable-globals"] = true; -Features["reference-types"] = true; Features["sign-ext"] = true; }; auto addBleedingEdgeFeatures = [&]() { @@ -162,6 +161,7 @@ bool WebAssemblyTargetInfo::initFeatureMap( Features["bulk-memory"] = true; Features["multimemory"] = true; Features["nontrapping-fptoint"] = true; +Features["reference-types"] = true; Features["tail-call"] = true; Features["half-precision"] = true; setSIMDLevel(Features, SIMD128, true); diff --git a/clang/test/Preprocessor/wasm-target-features.c b/clang/test/Preprocessor/wasm-target-features.c index 72ecc60a6e7898..5a4f85461d5aa2 100644 --- a/clang/test/Preprocessor/wasm-target-features.c +++ b/clang/test/Preprocessor/wasm-target-features.c @@ -164,7 +164,6 @@ // // GENERIC-INCLUDE-DAG: #define __wasm_multivalue__ 1{{$}} // GENERIC-INCLUDE-DAG: #define __wasm_mutable_globals__ 1{{$}} -// GENERIC-INCLUDE-DAG: #define __wasm_reference_types__ 1{{$}} // GENERIC-INCLUDE-DAG: #define __wasm_sign_ext__ 1{{$}} // // RUN: %clang -E -dM %s -o - 2>&1 \ @@ -181,6 +180,7 @@ // GENERIC-NOT: #define __wasm_half_precision__ 1{{$}} //
[clang] [llvm] [WebAssembly] Sort target features (NFC) (PR #90777)
https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/90777 >From b9fd03c2740fe924c0ea49bb78c9898412364105 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Mon, 29 Apr 2024 22:16:46 + Subject: [PATCH 1/2] [WebAssembly] Sort target features (NFC) --- clang/include/clang/Driver/Options.td | 40 ++--- clang/lib/Basic/Targets/WebAssembly.cpp | 166 +- clang/lib/Basic/Targets/WebAssembly.h | 18 +- clang/test/Driver/wasm-features.c | 88 +- llvm/lib/Target/WebAssembly/WebAssembly.td| 64 +++ .../WebAssembly/WebAssemblyInstrInfo.td | 72 .../Target/WebAssembly/WebAssemblySubtarget.h | 32 ++-- 7 files changed, 241 insertions(+), 239 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 864da4e1157f7d..5b79b066d384ad 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -4895,34 +4895,34 @@ def mharden_sls_EQ : Joined<["-"], "mharden-sls=">, Group, " blr(ARM/AArch64), comdat(ARM/AArch64), nocomdat(ARM/AArch64)," " return(X86), indirect-jmp(X86)">; -def msimd128 : Flag<["-"], "msimd128">, Group; -def mno_simd128 : Flag<["-"], "mno-simd128">, Group; -def mrelaxed_simd : Flag<["-"], "mrelaxed-simd">, Group; -def mno_relaxed_simd : Flag<["-"], "mno-relaxed-simd">, Group; -def mhalf_precision : Flag<["-"], "mhalf-precision">, Group; -def mno_half_precision : Flag<["-"], "mno-half-precision">, Group; -def mnontrapping_fptoint : Flag<["-"], "mnontrapping-fptoint">, Group; -def mno_nontrapping_fptoint : Flag<["-"], "mno-nontrapping-fptoint">, Group; -def msign_ext : Flag<["-"], "msign-ext">, Group; -def mno_sign_ext : Flag<["-"], "mno-sign-ext">, Group; -def mexception_handing : Flag<["-"], "mexception-handling">, Group; -def mno_exception_handing : Flag<["-"], "mno-exception-handling">, Group; def matomics : Flag<["-"], "matomics">, Group; def mno_atomics : Flag<["-"], "mno-atomics">, Group; def mbulk_memory : Flag<["-"], "mbulk-memory">, Group; def mno_bulk_memory : Flag<["-"], "mno-bulk-memory">, Group; -def mmutable_globals : Flag<["-"], "mmutable-globals">, Group; -def mno_mutable_globals : Flag<["-"], "mno-mutable-globals">, Group; -def mmultivalue : Flag<["-"], "mmultivalue">, Group; -def mno_multivalue : Flag<["-"], "mno-multivalue">, Group; -def mtail_call : Flag<["-"], "mtail-call">, Group; -def mno_tail_call : Flag<["-"], "mno-tail-call">, Group; -def mreference_types : Flag<["-"], "mreference-types">, Group; -def mno_reference_types : Flag<["-"], "mno-reference-types">, Group; +def mexception_handing : Flag<["-"], "mexception-handling">, Group; +def mno_exception_handing : Flag<["-"], "mno-exception-handling">, Group; def mextended_const : Flag<["-"], "mextended-const">, Group; def mno_extended_const : Flag<["-"], "mno-extended-const">, Group; +def mhalf_precision : Flag<["-"], "mhalf-precision">, Group; +def mno_half_precision : Flag<["-"], "mno-half-precision">, Group; def mmultimemory : Flag<["-"], "mmultimemory">, Group; def mno_multimemory : Flag<["-"], "mno-multimemory">, Group; +def mmultivalue : Flag<["-"], "mmultivalue">, Group; +def mno_multivalue : Flag<["-"], "mno-multivalue">, Group; +def mmutable_globals : Flag<["-"], "mmutable-globals">, Group; +def mno_mutable_globals : Flag<["-"], "mno-mutable-globals">, Group; +def mnontrapping_fptoint : Flag<["-"], "mnontrapping-fptoint">, Group; +def mno_nontrapping_fptoint : Flag<["-"], "mno-nontrapping-fptoint">, Group; +def mreference_types : Flag<["-"], "mreference-types">, Group; +def mno_reference_types : Flag<["-"], "mno-reference-types">, Group; +def mrelaxed_simd : Flag<["-"], "mrelaxed-simd">, Group; +def mno_relaxed_simd : Flag<["-"], "mno-relaxed-simd">, Group; +def msign_ext : Flag<["-"], "msign-ext">, Group; +def mno_sign_ext : Flag<["-"], "mno-sign-ext">, Group; +def msimd128 : Flag<["-"], "msimd128">, Group; +def mno_simd128 : Flag<["-"], "mno-simd128">, Group; +def mtail_call : Flag<["-"], "mtail-call">, Group; +def mno_tail_call : Flag<["-"], "mno-tail-call">, Group; def mexec_model_EQ : Joined<["-"], "mexec-model=">, Group, Values<"command,reactor">, HelpText<"Execution model (WebAssembly only)">, diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index 1f0418b21c1f86..a363478680570c 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -45,20 +45,20 @@ bool WebAssemblyTargetInfo::setABI(const std::string ) { bool WebAssemblyTargetInfo::hasFeature(StringRef Feature) const { return llvm::StringSwitch(Feature) - .Case("simd128", SIMDLevel >= SIMD128) - .Case("relaxed-simd", SIMDLevel >= RelaxedSIMD) + .Case("atomics", HasAtomics) + .Case("bulk-memory", HasBulkMemory) +
[clang] [llvm] [WebAssembly] Sort target features (NFC) (PR #90777)
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/90777 None >From b9fd03c2740fe924c0ea49bb78c9898412364105 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Mon, 29 Apr 2024 22:16:46 + Subject: [PATCH] [WebAssembly] Sort target features (NFC) --- clang/include/clang/Driver/Options.td | 40 ++--- clang/lib/Basic/Targets/WebAssembly.cpp | 166 +- clang/lib/Basic/Targets/WebAssembly.h | 18 +- clang/test/Driver/wasm-features.c | 88 +- llvm/lib/Target/WebAssembly/WebAssembly.td| 64 +++ .../WebAssembly/WebAssemblyInstrInfo.td | 72 .../Target/WebAssembly/WebAssemblySubtarget.h | 32 ++-- 7 files changed, 241 insertions(+), 239 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 864da4e1157f7d..5b79b066d384ad 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -4895,34 +4895,34 @@ def mharden_sls_EQ : Joined<["-"], "mharden-sls=">, Group, " blr(ARM/AArch64), comdat(ARM/AArch64), nocomdat(ARM/AArch64)," " return(X86), indirect-jmp(X86)">; -def msimd128 : Flag<["-"], "msimd128">, Group; -def mno_simd128 : Flag<["-"], "mno-simd128">, Group; -def mrelaxed_simd : Flag<["-"], "mrelaxed-simd">, Group; -def mno_relaxed_simd : Flag<["-"], "mno-relaxed-simd">, Group; -def mhalf_precision : Flag<["-"], "mhalf-precision">, Group; -def mno_half_precision : Flag<["-"], "mno-half-precision">, Group; -def mnontrapping_fptoint : Flag<["-"], "mnontrapping-fptoint">, Group; -def mno_nontrapping_fptoint : Flag<["-"], "mno-nontrapping-fptoint">, Group; -def msign_ext : Flag<["-"], "msign-ext">, Group; -def mno_sign_ext : Flag<["-"], "mno-sign-ext">, Group; -def mexception_handing : Flag<["-"], "mexception-handling">, Group; -def mno_exception_handing : Flag<["-"], "mno-exception-handling">, Group; def matomics : Flag<["-"], "matomics">, Group; def mno_atomics : Flag<["-"], "mno-atomics">, Group; def mbulk_memory : Flag<["-"], "mbulk-memory">, Group; def mno_bulk_memory : Flag<["-"], "mno-bulk-memory">, Group; -def mmutable_globals : Flag<["-"], "mmutable-globals">, Group; -def mno_mutable_globals : Flag<["-"], "mno-mutable-globals">, Group; -def mmultivalue : Flag<["-"], "mmultivalue">, Group; -def mno_multivalue : Flag<["-"], "mno-multivalue">, Group; -def mtail_call : Flag<["-"], "mtail-call">, Group; -def mno_tail_call : Flag<["-"], "mno-tail-call">, Group; -def mreference_types : Flag<["-"], "mreference-types">, Group; -def mno_reference_types : Flag<["-"], "mno-reference-types">, Group; +def mexception_handing : Flag<["-"], "mexception-handling">, Group; +def mno_exception_handing : Flag<["-"], "mno-exception-handling">, Group; def mextended_const : Flag<["-"], "mextended-const">, Group; def mno_extended_const : Flag<["-"], "mno-extended-const">, Group; +def mhalf_precision : Flag<["-"], "mhalf-precision">, Group; +def mno_half_precision : Flag<["-"], "mno-half-precision">, Group; def mmultimemory : Flag<["-"], "mmultimemory">, Group; def mno_multimemory : Flag<["-"], "mno-multimemory">, Group; +def mmultivalue : Flag<["-"], "mmultivalue">, Group; +def mno_multivalue : Flag<["-"], "mno-multivalue">, Group; +def mmutable_globals : Flag<["-"], "mmutable-globals">, Group; +def mno_mutable_globals : Flag<["-"], "mno-mutable-globals">, Group; +def mnontrapping_fptoint : Flag<["-"], "mnontrapping-fptoint">, Group; +def mno_nontrapping_fptoint : Flag<["-"], "mno-nontrapping-fptoint">, Group; +def mreference_types : Flag<["-"], "mreference-types">, Group; +def mno_reference_types : Flag<["-"], "mno-reference-types">, Group; +def mrelaxed_simd : Flag<["-"], "mrelaxed-simd">, Group; +def mno_relaxed_simd : Flag<["-"], "mno-relaxed-simd">, Group; +def msign_ext : Flag<["-"], "msign-ext">, Group; +def mno_sign_ext : Flag<["-"], "mno-sign-ext">, Group; +def msimd128 : Flag<["-"], "msimd128">, Group; +def mno_simd128 : Flag<["-"], "mno-simd128">, Group; +def mtail_call : Flag<["-"], "mtail-call">, Group; +def mno_tail_call : Flag<["-"], "mno-tail-call">, Group; def mexec_model_EQ : Joined<["-"], "mexec-model=">, Group, Values<"command,reactor">, HelpText<"Execution model (WebAssembly only)">, diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index 1f0418b21c1f86..a363478680570c 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -45,20 +45,20 @@ bool WebAssemblyTargetInfo::setABI(const std::string ) { bool WebAssemblyTargetInfo::hasFeature(StringRef Feature) const { return llvm::StringSwitch(Feature) - .Case("simd128", SIMDLevel >= SIMD128) - .Case("relaxed-simd", SIMDLevel >= RelaxedSIMD) + .Case("atomics", HasAtomics) + .Case("bulk-memory", HasBulkMemory) +
[clang] [WebAssembly] Add preprocessor define for half-precision (PR #90528)
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/90528 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Add preprocessor define for half-precision (PR #90528)
aheejin wrote: cc @brendandahl (I couldn't add you as a reviewer because you didn't pop up in the reviewers list) Also, this just adds the preprocessor directive, but I'm wondering whether you really meant to add this to bleeding-edge: https://github.com/llvm/llvm-project/commit/d9fd0ddef38bb9d5cce7300ff820272183c09fcd#r141495634 https://github.com/llvm/llvm-project/pull/90528 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Add preprocessor define for half-precision (PR #90528)
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/90528 This adds the preprocessor define for the half-precision feature and also adds preprocessor tests. >From 036d8a7486eab8ee2b434826c6ad5807daba2574 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Mon, 29 Apr 2024 22:02:52 + Subject: [PATCH] [WebAssembly] Add preprocessor define for half-precision This adds the preprocessor define for the half-precision feature and also adds preprocessor tests. --- clang/lib/Basic/Targets/WebAssembly.cpp| 2 ++ clang/test/Preprocessor/wasm-target-features.c | 12 2 files changed, 14 insertions(+) diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index 0db7b668d8a0ac..1f0418b21c1f86 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -100,6 +100,8 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions , Builder.defineMacro("__wasm_extended_const__"); if (HasMultiMemory) Builder.defineMacro("__wasm_multimemory__"); + if (HasHalfPrecision) +Builder.defineMacro("__wasm_half_precision__"); Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1"); Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2"); diff --git a/clang/test/Preprocessor/wasm-target-features.c b/clang/test/Preprocessor/wasm-target-features.c index 19bd918543dfea..72ecc60a6e7898 100644 --- a/clang/test/Preprocessor/wasm-target-features.c +++ b/clang/test/Preprocessor/wasm-target-features.c @@ -43,6 +43,15 @@ // // EXTENDED-CONST: #define __wasm_extended_const__ 1{{$}} +// RUN: %clang -E -dM %s -o - 2>&1 \ +// RUN: -target wasm32-unknown-unknown -mhalf-precision \ +// RUN: | FileCheck %s -check-prefix=HALF-PRECISION +// RUN: %clang -E -dM %s -o - 2>&1 \ +// RUN: -target wasm64-unknown-unknown -mhalf-precision \ +// RUN: | FileCheck %s -check-prefix=HALF-PRECISION +// +// HALF-PRECISION: #define __wasm_half_precision__ 1{{$}} + // RUN: %clang -E -dM %s -o - 2>&1 \ // RUN: -target wasm32-unknown-unknown -mmultimemory \ // RUN: | FileCheck %s -check-prefix=MULTIMEMORY @@ -135,6 +144,7 @@ // MVP-NOT: #define __wasm_bulk_memory__ 1{{$}} // MVP-NOT: #define __wasm_exception_handling__ 1{{$}} // MVP-NOT: #define __wasm_extended_const__ 1{{$}} +// MVP-NOT: #define __wasm_half_precision__ 1{{$}} // MVP-NOT: #define __wasm_multimemory__ 1{{$}} // MVP-NOT: #define __wasm_multivalue__ 1{{$}} // MVP-NOT: #define __wasm_mutable_globals__ 1{{$}} @@ -168,6 +178,7 @@ // GENERIC-NOT: #define __wasm_bulk_memory__ 1{{$}} // GENERIC-NOT: #define __wasm_exception_handling__ 1{{$}} // GENERIC-NOT: #define __wasm_extended_const__ 1{{$}} +// GENERIC-NOT: #define __wasm_half_precision__ 1{{$}} // GENERIC-NOT: #define __wasm_multimemory__ 1{{$}} // GENERIC-NOT: #define __wasm_nontrapping_fptoint__ 1{{$}} // GENERIC-NOT: #define __wasm_relaxed_simd__ 1{{$}} @@ -183,6 +194,7 @@ // // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_atomics__ 1{{$}} // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_bulk_memory__ 1{{$}} +// BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_half_precision__ 1{{$}} // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_multimemory__ 1{{$}} // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_multivalue__ 1{{$}} // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_mutable_globals__ 1{{$}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Enable multivalue and reference-types in generic CPU config (PR #80923)
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/80923 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Enable multivalue and reference-types in generic CPU config (PR #80923)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/80923 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Enable multivalue and reference-types in generic CPU config (PR #80923)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/80923 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Enable multivalue and reference-types in generic CPU config (PR #80923)
https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/80923 >From d6fd48794112d6c140024d7cd55b5fe5e55e Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 6 Feb 2024 00:31:59 + Subject: [PATCH 1/5] [WebAssembly] Add more features to generic CPU config This enables nontrapping-fptoint, multivlaue, reference-types, and bulk-memory in `-mcpu=generic` configuration. These proposals have been standardized and supported in all major browsers for several years at this point: https://github.com/WebAssembly/proposals/blob/main/finished-proposals.md --- clang/docs/ReleaseNotes.rst| 4 clang/lib/Basic/Targets/WebAssembly.cpp| 18 -- clang/test/Preprocessor/wasm-target-features.c | 8 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 802c44b6c86080..5a07dcca106876 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -259,6 +259,10 @@ AIX Support WebAssembly Support ^^^ +The -mcpu=generic configuration now enables nontrapping-fptoint, multivalue, +reference-types, and bulk-memory.These proposals are standardized and available +in all major engines. + AVR Support ^^^ diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index f1c925d90cb649..38fe4013090f40 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -147,19 +147,25 @@ void WebAssemblyTargetInfo::setFeatureEnabled(llvm::StringMap , bool WebAssemblyTargetInfo::initFeatureMap( llvm::StringMap , DiagnosticsEngine , StringRef CPU, const std::vector ) const { - if (CPU == "bleeding-edge") { -Features["nontrapping-fptoint"] = true; + auto addGenericFeatures = [&]() { Features["sign-ext"] = true; +Features["mutable-globals"] = true; +Features["nontrapping-fptoint"] = true; Features["bulk-memory"] = true; +Features["reference-types"] = true; +Features["multivalue"] = true; + }; + auto addBleedingEdgeFeatures = [&]() { Features["atomics"] = true; -Features["mutable-globals"] = true; Features["tail-call"] = true; -Features["reference-types"] = true; Features["multimemory"] = true; setSIMDLevel(Features, SIMD128, true); + }; + if (CPU == "bleeding-edge") { +addGenericFeatures(); +addBleedingEdgeFeatures(); } else if (CPU == "generic") { -Features["sign-ext"] = true; -Features["mutable-globals"] = true; +addGenericFeatures(); } return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); diff --git a/clang/test/Preprocessor/wasm-target-features.c b/clang/test/Preprocessor/wasm-target-features.c index eccd432aa8eee6..5834e6d183bc9c 100644 --- a/clang/test/Preprocessor/wasm-target-features.c +++ b/clang/test/Preprocessor/wasm-target-features.c @@ -155,15 +155,15 @@ // // GENERIC-DAG:#define __wasm_sign_ext__ 1{{$}} // GENERIC-DAG:#define __wasm_mutable_globals__ 1{{$}} -// GENERIC-NOT:#define __wasm_nontrapping_fptoint__ 1{{$}} -// GENERIC-NOT:#define __wasm_bulk_memory__ 1{{$}} +// GENERIC-DAG:#define __wasm_nontrapping_fptoint__ 1{{$}} +// GENERIC-DAG:#define __wasm_bulk_memory__ 1{{$}} +// GENERIC-DAG:#define __wasm_multivalue__ 1{{$}} +// GENERIC-DAG:#define __wasm_reference_types__ 1{{$}} // GENERIC-NOT:#define __wasm_simd128__ 1{{$}} // GENERIC-NOT:#define __wasm_atomics__ 1{{$}} // GENERIC-NOT:#define __wasm_tail_call__ 1{{$}} // GENERIC-NOT:#define __wasm_multimemory__ 1{{$}} // GENERIC-NOT:#define __wasm_exception_handling__ 1{{$}} -// GENERIC-NOT:#define __wasm_multivalue__ 1{{$}} -// GENERIC-NOT:#define __wasm_reference_types__ 1{{$}} // GENERIC-NOT:#define __wasm_extended_const__ 1{{$}} // RUN: %clang -E -dM %s -o - 2>&1 \ >From 01ac8bd38aaa86e62b00709790a36e050528f853 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 23 Feb 2024 00:31:41 + Subject: [PATCH 2/5] Mention that ABI is not turned on --- clang/docs/ReleaseNotes.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 5a07dcca106876..ec85d8882c1861 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -261,7 +261,8 @@ WebAssembly Support The -mcpu=generic configuration now enables nontrapping-fptoint, multivalue, reference-types, and bulk-memory.These proposals are standardized and available -in all major engines. +in all major engines. Enabling multivalue here only enables the language feature +but does not turn on the multivalue ABI. AVR Support ^^^ >From de6aa6aa0891bb11ae7402d2cbccbcd82cd4fc77 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 23 Apr 2024 13:21:15 + Subject: [PATCH 3/5] Enable only multivalue and reference types --- clang/docs/ReleaseNotes.rst| 8
[clang] [WebAssembly] Enable multivalue and reference-types in generic CPU config (PR #80923)
https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/80923 >From d6fd48794112d6c140024d7cd55b5fe5e55e Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 6 Feb 2024 00:31:59 + Subject: [PATCH 1/5] [WebAssembly] Add more features to generic CPU config This enables nontrapping-fptoint, multivlaue, reference-types, and bulk-memory in `-mcpu=generic` configuration. These proposals have been standardized and supported in all major browsers for several years at this point: https://github.com/WebAssembly/proposals/blob/main/finished-proposals.md --- clang/docs/ReleaseNotes.rst| 4 clang/lib/Basic/Targets/WebAssembly.cpp| 18 -- clang/test/Preprocessor/wasm-target-features.c | 8 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 802c44b6c86080..5a07dcca106876 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -259,6 +259,10 @@ AIX Support WebAssembly Support ^^^ +The -mcpu=generic configuration now enables nontrapping-fptoint, multivalue, +reference-types, and bulk-memory.These proposals are standardized and available +in all major engines. + AVR Support ^^^ diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index f1c925d90cb649..38fe4013090f40 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -147,19 +147,25 @@ void WebAssemblyTargetInfo::setFeatureEnabled(llvm::StringMap , bool WebAssemblyTargetInfo::initFeatureMap( llvm::StringMap , DiagnosticsEngine , StringRef CPU, const std::vector ) const { - if (CPU == "bleeding-edge") { -Features["nontrapping-fptoint"] = true; + auto addGenericFeatures = [&]() { Features["sign-ext"] = true; +Features["mutable-globals"] = true; +Features["nontrapping-fptoint"] = true; Features["bulk-memory"] = true; +Features["reference-types"] = true; +Features["multivalue"] = true; + }; + auto addBleedingEdgeFeatures = [&]() { Features["atomics"] = true; -Features["mutable-globals"] = true; Features["tail-call"] = true; -Features["reference-types"] = true; Features["multimemory"] = true; setSIMDLevel(Features, SIMD128, true); + }; + if (CPU == "bleeding-edge") { +addGenericFeatures(); +addBleedingEdgeFeatures(); } else if (CPU == "generic") { -Features["sign-ext"] = true; -Features["mutable-globals"] = true; +addGenericFeatures(); } return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); diff --git a/clang/test/Preprocessor/wasm-target-features.c b/clang/test/Preprocessor/wasm-target-features.c index eccd432aa8eee6..5834e6d183bc9c 100644 --- a/clang/test/Preprocessor/wasm-target-features.c +++ b/clang/test/Preprocessor/wasm-target-features.c @@ -155,15 +155,15 @@ // // GENERIC-DAG:#define __wasm_sign_ext__ 1{{$}} // GENERIC-DAG:#define __wasm_mutable_globals__ 1{{$}} -// GENERIC-NOT:#define __wasm_nontrapping_fptoint__ 1{{$}} -// GENERIC-NOT:#define __wasm_bulk_memory__ 1{{$}} +// GENERIC-DAG:#define __wasm_nontrapping_fptoint__ 1{{$}} +// GENERIC-DAG:#define __wasm_bulk_memory__ 1{{$}} +// GENERIC-DAG:#define __wasm_multivalue__ 1{{$}} +// GENERIC-DAG:#define __wasm_reference_types__ 1{{$}} // GENERIC-NOT:#define __wasm_simd128__ 1{{$}} // GENERIC-NOT:#define __wasm_atomics__ 1{{$}} // GENERIC-NOT:#define __wasm_tail_call__ 1{{$}} // GENERIC-NOT:#define __wasm_multimemory__ 1{{$}} // GENERIC-NOT:#define __wasm_exception_handling__ 1{{$}} -// GENERIC-NOT:#define __wasm_multivalue__ 1{{$}} -// GENERIC-NOT:#define __wasm_reference_types__ 1{{$}} // GENERIC-NOT:#define __wasm_extended_const__ 1{{$}} // RUN: %clang -E -dM %s -o - 2>&1 \ >From 01ac8bd38aaa86e62b00709790a36e050528f853 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 23 Feb 2024 00:31:41 + Subject: [PATCH 2/5] Mention that ABI is not turned on --- clang/docs/ReleaseNotes.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 5a07dcca106876..ec85d8882c1861 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -261,7 +261,8 @@ WebAssembly Support The -mcpu=generic configuration now enables nontrapping-fptoint, multivalue, reference-types, and bulk-memory.These proposals are standardized and available -in all major engines. +in all major engines. Enabling multivalue here only enables the language feature +but does not turn on the multivalue ABI. AVR Support ^^^ >From de6aa6aa0891bb11ae7402d2cbccbcd82cd4fc77 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 23 Apr 2024 13:21:15 + Subject: [PATCH 3/5] Enable only multivalue and reference types --- clang/docs/ReleaseNotes.rst| 8
[clang] [WebAssembly] Tidy up wasm-target-features.c (PR #89778)
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/89778 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Fix uses of -DAG and -NOT in wasm-target-features.c (PR #89777)
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/89777 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Tidy up wasm-target-features.c (PR #89778)
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/89778 This tidies up `wasm-target-features.c` cosmetically: - Sorts the feature tests alphabetically - Adds a space after colons >From 0d0a07ee86159ca3b706a1d17506b531e45c57d6 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 23 Apr 2024 14:40:38 + Subject: [PATCH] [WebAssembly] Tidy up wasm-target-features.c This tidies up `wasm-target-features.c` cosmetically: - Sorts the feature tests alphabetically - Adds a space after colons --- clang/lib/Basic/Targets/WebAssembly.cpp | 12 +- .../test/Preprocessor/wasm-target-features.c | 135 +- 2 files changed, 73 insertions(+), 74 deletions(-) diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index f1c925d90cb649..d473fd19086460 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -148,18 +148,18 @@ bool WebAssemblyTargetInfo::initFeatureMap( llvm::StringMap , DiagnosticsEngine , StringRef CPU, const std::vector ) const { if (CPU == "bleeding-edge") { -Features["nontrapping-fptoint"] = true; -Features["sign-ext"] = true; -Features["bulk-memory"] = true; Features["atomics"] = true; +Features["bulk-memory"] = true; +Features["multimemory"] = true; Features["mutable-globals"] = true; -Features["tail-call"] = true; +Features["nontrapping-fptoint"] = true; Features["reference-types"] = true; -Features["multimemory"] = true; +Features["sign-ext"] = true; +Features["tail-call"] = true; setSIMDLevel(Features, SIMD128, true); } else if (CPU == "generic") { -Features["sign-ext"] = true; Features["mutable-globals"] = true; +Features["sign-ext"] = true; } return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); diff --git a/clang/test/Preprocessor/wasm-target-features.c b/clang/test/Preprocessor/wasm-target-features.c index eccd432aa8eee6..b460b6d67c9353 100644 --- a/clang/test/Preprocessor/wasm-target-features.c +++ b/clang/test/Preprocessor/wasm-target-features.c @@ -1,38 +1,29 @@ // RUN: %clang -E -dM %s -o - 2>&1 \ -// RUN: -target wasm32-unknown-unknown -msimd128 \ -// RUN: | FileCheck %s -check-prefix=SIMD128 -// RUN: %clang -E -dM %s -o - 2>&1 \ -// RUN: -target wasm64-unknown-unknown -msimd128 \ -// RUN: | FileCheck %s -check-prefix=SIMD128 -// -// SIMD128:#define __wasm_simd128__ 1{{$}} - -// RUN: %clang -E -dM %s -o - 2>&1 \ -// RUN: -target wasm32-unknown-unknown -mrelaxed-simd \ -// RUN: | FileCheck %s -check-prefix=RELAXED-SIMD +// RUN: -target wasm32-unknown-unknown -matomics \ +// RUN: | FileCheck %s -check-prefix=ATOMICS // RUN: %clang -E -dM %s -o - 2>&1 \ -// RUN: -target wasm64-unknown-unknown -mrelaxed-simd \ -// RUN: | FileCheck %s -check-prefix=RELAXED-SIMD +// RUN: -target wasm64-unknown-unknown -matomics \ +// RUN: | FileCheck %s -check-prefix=ATOMICS // -// RELAXED-SIMD:#define __wasm_relaxed_simd__ 1{{$}} +// ATOMICS: #define __wasm_atomics__ 1{{$}} // RUN: %clang -E -dM %s -o - 2>&1 \ -// RUN: -target wasm32-unknown-unknown -mnontrapping-fptoint \ -// RUN: | FileCheck %s -check-prefix=NONTRAPPING-FPTOINT +// RUN: -target wasm32-unknown-unknown -pthread \ +// RUN: | FileCheck %s -check-prefix=PTHREAD // RUN: %clang -E -dM %s -o - 2>&1 \ -// RUN: -target wasm64-unknown-unknown -mnontrapping-fptoint \ -// RUN: | FileCheck %s -check-prefix=NONTRAPPING-FPTOINT +// RUN: -target wasm64-unknown-unknown -pthread \ +// RUN: | FileCheck %s -check-prefix=PTHREAD // -// NONTRAPPING-FPTOINT:#define __wasm_nontrapping_fptoint__ 1{{$}} +// PTHREAD: #define __wasm_atomics__ 1{{$}} // RUN: %clang -E -dM %s -o - 2>&1 \ -// RUN: -target wasm32-unknown-unknown -msign-ext \ -// RUN: | FileCheck %s -check-prefix=SIGN-EXT +// RUN: -target wasm32-unknown-unknown -mbulk-memory \ +// RUN: | FileCheck %s -check-prefix=BULK-MEMORY // RUN: %clang -E -dM %s -o - 2>&1 \ -// RUN: -target wasm64-unknown-unknown -msign-ext \ -// RUN: | FileCheck %s -check-prefix=SIGN-EXT +// RUN: -target wasm64-unknown-unknown -mbulk-memory \ +// RUN: | FileCheck %s -check-prefix=BULK-MEMORY // -// SIGN-EXT:#define __wasm_sign_ext__ 1{{$}} +// BULK-MEMORY: #define __wasm_bulk_memory__ 1{{$}} // RUN: %clang -E -dM %s -o - 2>&1 \ // RUN: -target wasm32-unknown-unknown -mexception-handling \ @@ -41,34 +32,34 @@ // RUN: -target wasm64-unknown-unknown -mexception-handling \ // RUN: | FileCheck %s -check-prefix=EXCEPTION-HANDLING // -// EXCEPTION-HANDLING:#define __wasm_exception_handling__ 1{{$}} +// EXCEPTION-HANDLING: #define __wasm_exception_handling__ 1{{$}} // RUN: %clang -E -dM %s -o - 2>&1 \ -// RUN: -target wasm32-unknown-unknown -mbulk-memory \ -// RUN: | FileCheck %s -check-prefix=BULK-MEMORY +// RUN: -target wasm32-unknown-unknown -mextended-const \ +//
[clang] [WebAssembly] Fix uses of -DAG and -NOT in wasm-target-features.c (PR #89777)
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/89777 We are currently using `PREFIX-DAG` and `PREFIX-NOT` within a single `PREFIX` test in a mixed way, but `-DAG` and `-NOT` do not work that way. For example: Result: ``` 1 2 3 ``` Test file: ```c // CHECK-DAG: 3 // CHECK-DAG: 1 // CHECK-NOT: 2 ``` This does not work. The last line `CHECK-NOT: 2` does not trigger any error, because we've already covered all three lines (1~3) while matching `CHECK-DAG: 3` and `CHECK-DAG: 1`, and FileCheck tries to check the line `CHECK-NOT: 2` _after_ the line `3`. Actually, we have ```c // BLEEDING-EDGE-NOT:#define __wasm_reference_types__ 1{{$}} ``` even though reference-types is enabled in 'bleeding-edge' config, and this has not triggered any error. This section (https://llvm.org/docs/CommandGuide/FileCheck.html#the-check-dag-directive) explains the interactions between `CHECK-DAG` and `CHECK-NOT`s: > As a result, the surrounding `CHECK-DAG:` directives cannot be reordered, > i.e. all occurrences matching `CHECK-DAG:` before `CHECK-NOT:` must not fall > behind occurrences matching `CHECK-DAG:` after `CHECK-NOT:`. So in order to test the 'include' lists and 'not-include' lists, we have to run the tests twice with different prefixes. This splits `GENERIC` and `BLEEDING-EDGE` tests in two configs (`***-INCLUDE` and `***`) to test them correctly. This also adds some spaces after colons, sorts the feature lists, and adds `1{{$}}` to the `MVP` tests to make them consistent with `GENERIC` and `BLEEDING-EDGE` tests. >From 3743f9a04ec4704674a51fe49d1caa4d2792f1d4 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 23 Apr 2024 14:38:35 + Subject: [PATCH] [WebAssembly] Fix uses of -DAG and -NOT in wasm-target-features.c We are currently using `PREFIX-DAG` and `PREFIX-NOT` within a single `PREFIX` test in a mixed way, but `-DAG` and `-NOT` do not work that way. For example: Result: ``` 1 2 3 ``` Test file: ```c // CHECK-DAG: 3 // CHECK-DAG: 1 // CHECK-NOT: 2 ``` This does not work. The last line `CHECK-NOT: 2` does not trigger any error, because we've already covered all three lines (1~3) while matching `CHECK-DAG: 3` and `CHECK-DAG: 1`, and FileCheck tries to check the line `CHECK-NOT: 2` _after_ the line `3`. Actually, we have ```c // BLEEDING-EDGE-NOT:#define __wasm_reference_types__ 1{{$}} ``` even though reference-types is enabled in 'bleeding-edge' config, and this has not triggered any error. This section (https://llvm.org/docs/CommandGuide/FileCheck.html#the-check-dag-directive) explains the interactions between `CHECK-DAG` and `CHECK-NOT`s: > As a result, the surrounding `CHECK-DAG:` directives cannot be > reordered, i.e. all occurrences matching `CHECK-DAG:` before > `CHECK-NOT:` must not fall behind occurrences matching `CHECK-DAG:` > after `CHECK-NOT:`. So in order to test the 'include' lists and 'not-include' lists, we have to run the tests twice with different prefixes. This splits `GENERIC` and `BLEEDING-EDGE` tests in two configs (`***-INCLUDE` and `***`) to test them correctly. This also adds some spaces after colons, sorts the feature lists, and adds `1{{$}}` to the `MVP` tests to make them consistent with `GENERIC` and `BLEEDING-EDGE` tests. --- .../test/Preprocessor/wasm-target-features.c | 93 +++ 1 file changed, 55 insertions(+), 38 deletions(-) diff --git a/clang/test/Preprocessor/wasm-target-features.c b/clang/test/Preprocessor/wasm-target-features.c index eccd432aa8eee6..983cd01cf8117e 100644 --- a/clang/test/Preprocessor/wasm-target-features.c +++ b/clang/test/Preprocessor/wasm-target-features.c @@ -132,20 +132,30 @@ // RUN: -target wasm64-unknown-unknown -mcpu=mvp \ // RUN: | FileCheck %s -check-prefix=MVP // -// MVP-NOT:#define __wasm_simd128__ -// MVP-NOT:#define __wasm_nontrapping_fptoint__ -// MVP-NOT:#define __wasm_sign_ext__ -// MVP-NOT:#define __wasm_exception_handling__ -// MVP-NOT:#define __wasm_bulk_memory__ -// MVP-NOT:#define __wasm_atomics__ -// MVP-NOT:#define __wasm_mutable_globals__ -// MVP-NOT:#define __wasm_multivalue__ -// MVP-NOT:#define __wasm_tail_call__ -// MVP-NOT:#define __wasm_reference_types__ -// MVP-NOT:#define __wasm_extended_const__ -// MVP-NOT:#define __wasm_multimemory__ -// MVP-NOT:#define __wasm_relaxed_simd__ +// MVP-NOT: #define __wasm_atomics__ 1{{$}} +// MVP-NOT: #define __wasm_bulk_memory__ 1{{$}} +// MVP-NOT: #define __wasm_exception_handling__ 1{{$}} +// MVP-NOT: #define __wasm_extended_const__ 1{{$}} +// MVP-NOT: #define __wasm_multimemory__ 1{{$}} +// MVP-NOT: #define __wasm_multivalue__ 1{{$}} +// MVP-NOT: #define __wasm_mutable_globals__ 1{{$}} +// MVP-NOT: #define __wasm_nontrapping_fptoint__ 1{{$}} +// MVP-NOT: #define __wasm_reference_types__ 1{{$}} +// MVP-NOT: #define __wasm_relaxed_simd__ 1{{$}} +// MVP-NOT: #define __wasm_sign_ext__ 1{{$}} +// MVP-NOT: #define __wasm_simd128__ 1{{$}} +// MVP-NOT: #define __wasm_tail_call__ 1{{$}} +// RUN: %clang -E -dM
[clang] [WebAssembly] Enable multivalue and reference-types in generic CPU config (PR #80923)
https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/80923 >From d6fd48794112d6c140024d7cd55b5fe5e55e Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 6 Feb 2024 00:31:59 + Subject: [PATCH 1/4] [WebAssembly] Add more features to generic CPU config This enables nontrapping-fptoint, multivlaue, reference-types, and bulk-memory in `-mcpu=generic` configuration. These proposals have been standardized and supported in all major browsers for several years at this point: https://github.com/WebAssembly/proposals/blob/main/finished-proposals.md --- clang/docs/ReleaseNotes.rst| 4 clang/lib/Basic/Targets/WebAssembly.cpp| 18 -- clang/test/Preprocessor/wasm-target-features.c | 8 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 802c44b6c86080..5a07dcca106876 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -259,6 +259,10 @@ AIX Support WebAssembly Support ^^^ +The -mcpu=generic configuration now enables nontrapping-fptoint, multivalue, +reference-types, and bulk-memory.These proposals are standardized and available +in all major engines. + AVR Support ^^^ diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index f1c925d90cb649..38fe4013090f40 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -147,19 +147,25 @@ void WebAssemblyTargetInfo::setFeatureEnabled(llvm::StringMap , bool WebAssemblyTargetInfo::initFeatureMap( llvm::StringMap , DiagnosticsEngine , StringRef CPU, const std::vector ) const { - if (CPU == "bleeding-edge") { -Features["nontrapping-fptoint"] = true; + auto addGenericFeatures = [&]() { Features["sign-ext"] = true; +Features["mutable-globals"] = true; +Features["nontrapping-fptoint"] = true; Features["bulk-memory"] = true; +Features["reference-types"] = true; +Features["multivalue"] = true; + }; + auto addBleedingEdgeFeatures = [&]() { Features["atomics"] = true; -Features["mutable-globals"] = true; Features["tail-call"] = true; -Features["reference-types"] = true; Features["multimemory"] = true; setSIMDLevel(Features, SIMD128, true); + }; + if (CPU == "bleeding-edge") { +addGenericFeatures(); +addBleedingEdgeFeatures(); } else if (CPU == "generic") { -Features["sign-ext"] = true; -Features["mutable-globals"] = true; +addGenericFeatures(); } return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); diff --git a/clang/test/Preprocessor/wasm-target-features.c b/clang/test/Preprocessor/wasm-target-features.c index eccd432aa8eee6..5834e6d183bc9c 100644 --- a/clang/test/Preprocessor/wasm-target-features.c +++ b/clang/test/Preprocessor/wasm-target-features.c @@ -155,15 +155,15 @@ // // GENERIC-DAG:#define __wasm_sign_ext__ 1{{$}} // GENERIC-DAG:#define __wasm_mutable_globals__ 1{{$}} -// GENERIC-NOT:#define __wasm_nontrapping_fptoint__ 1{{$}} -// GENERIC-NOT:#define __wasm_bulk_memory__ 1{{$}} +// GENERIC-DAG:#define __wasm_nontrapping_fptoint__ 1{{$}} +// GENERIC-DAG:#define __wasm_bulk_memory__ 1{{$}} +// GENERIC-DAG:#define __wasm_multivalue__ 1{{$}} +// GENERIC-DAG:#define __wasm_reference_types__ 1{{$}} // GENERIC-NOT:#define __wasm_simd128__ 1{{$}} // GENERIC-NOT:#define __wasm_atomics__ 1{{$}} // GENERIC-NOT:#define __wasm_tail_call__ 1{{$}} // GENERIC-NOT:#define __wasm_multimemory__ 1{{$}} // GENERIC-NOT:#define __wasm_exception_handling__ 1{{$}} -// GENERIC-NOT:#define __wasm_multivalue__ 1{{$}} -// GENERIC-NOT:#define __wasm_reference_types__ 1{{$}} // GENERIC-NOT:#define __wasm_extended_const__ 1{{$}} // RUN: %clang -E -dM %s -o - 2>&1 \ >From 01ac8bd38aaa86e62b00709790a36e050528f853 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 23 Feb 2024 00:31:41 + Subject: [PATCH 2/4] Mention that ABI is not turned on --- clang/docs/ReleaseNotes.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 5a07dcca106876..ec85d8882c1861 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -261,7 +261,8 @@ WebAssembly Support The -mcpu=generic configuration now enables nontrapping-fptoint, multivalue, reference-types, and bulk-memory.These proposals are standardized and available -in all major engines. +in all major engines. Enabling multivalue here only enables the language feature +but does not turn on the multivalue ABI. AVR Support ^^^ >From de6aa6aa0891bb11ae7402d2cbccbcd82cd4fc77 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 23 Apr 2024 13:21:15 + Subject: [PATCH 3/4] Enable only multivalue and reference types --- clang/docs/ReleaseNotes.rst| 8
[clang] [WebAssembly] Enable multivalue and reference-types in generic CPU config (PR #80923)
aheejin wrote: cc @kripken too (You don't show up in the reviewers list, so I couldn't add you) https://github.com/llvm/llvm-project/pull/80923 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Enable multivalue and reference-types in generic CPU config (PR #80923)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/80923 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Add more features to generic CPU config (PR #80923)
https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/80923 >From d6fd48794112d6c140024d7cd55b5fe5e55e Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 6 Feb 2024 00:31:59 + Subject: [PATCH 1/3] [WebAssembly] Add more features to generic CPU config This enables nontrapping-fptoint, multivlaue, reference-types, and bulk-memory in `-mcpu=generic` configuration. These proposals have been standardized and supported in all major browsers for several years at this point: https://github.com/WebAssembly/proposals/blob/main/finished-proposals.md --- clang/docs/ReleaseNotes.rst| 4 clang/lib/Basic/Targets/WebAssembly.cpp| 18 -- clang/test/Preprocessor/wasm-target-features.c | 8 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 802c44b6c86080..5a07dcca106876 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -259,6 +259,10 @@ AIX Support WebAssembly Support ^^^ +The -mcpu=generic configuration now enables nontrapping-fptoint, multivalue, +reference-types, and bulk-memory.These proposals are standardized and available +in all major engines. + AVR Support ^^^ diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index f1c925d90cb649..38fe4013090f40 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -147,19 +147,25 @@ void WebAssemblyTargetInfo::setFeatureEnabled(llvm::StringMap , bool WebAssemblyTargetInfo::initFeatureMap( llvm::StringMap , DiagnosticsEngine , StringRef CPU, const std::vector ) const { - if (CPU == "bleeding-edge") { -Features["nontrapping-fptoint"] = true; + auto addGenericFeatures = [&]() { Features["sign-ext"] = true; +Features["mutable-globals"] = true; +Features["nontrapping-fptoint"] = true; Features["bulk-memory"] = true; +Features["reference-types"] = true; +Features["multivalue"] = true; + }; + auto addBleedingEdgeFeatures = [&]() { Features["atomics"] = true; -Features["mutable-globals"] = true; Features["tail-call"] = true; -Features["reference-types"] = true; Features["multimemory"] = true; setSIMDLevel(Features, SIMD128, true); + }; + if (CPU == "bleeding-edge") { +addGenericFeatures(); +addBleedingEdgeFeatures(); } else if (CPU == "generic") { -Features["sign-ext"] = true; -Features["mutable-globals"] = true; +addGenericFeatures(); } return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); diff --git a/clang/test/Preprocessor/wasm-target-features.c b/clang/test/Preprocessor/wasm-target-features.c index eccd432aa8eee6..5834e6d183bc9c 100644 --- a/clang/test/Preprocessor/wasm-target-features.c +++ b/clang/test/Preprocessor/wasm-target-features.c @@ -155,15 +155,15 @@ // // GENERIC-DAG:#define __wasm_sign_ext__ 1{{$}} // GENERIC-DAG:#define __wasm_mutable_globals__ 1{{$}} -// GENERIC-NOT:#define __wasm_nontrapping_fptoint__ 1{{$}} -// GENERIC-NOT:#define __wasm_bulk_memory__ 1{{$}} +// GENERIC-DAG:#define __wasm_nontrapping_fptoint__ 1{{$}} +// GENERIC-DAG:#define __wasm_bulk_memory__ 1{{$}} +// GENERIC-DAG:#define __wasm_multivalue__ 1{{$}} +// GENERIC-DAG:#define __wasm_reference_types__ 1{{$}} // GENERIC-NOT:#define __wasm_simd128__ 1{{$}} // GENERIC-NOT:#define __wasm_atomics__ 1{{$}} // GENERIC-NOT:#define __wasm_tail_call__ 1{{$}} // GENERIC-NOT:#define __wasm_multimemory__ 1{{$}} // GENERIC-NOT:#define __wasm_exception_handling__ 1{{$}} -// GENERIC-NOT:#define __wasm_multivalue__ 1{{$}} -// GENERIC-NOT:#define __wasm_reference_types__ 1{{$}} // GENERIC-NOT:#define __wasm_extended_const__ 1{{$}} // RUN: %clang -E -dM %s -o - 2>&1 \ >From 01ac8bd38aaa86e62b00709790a36e050528f853 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 23 Feb 2024 00:31:41 + Subject: [PATCH 2/3] Mention that ABI is not turned on --- clang/docs/ReleaseNotes.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 5a07dcca106876..ec85d8882c1861 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -261,7 +261,8 @@ WebAssembly Support The -mcpu=generic configuration now enables nontrapping-fptoint, multivalue, reference-types, and bulk-memory.These proposals are standardized and available -in all major engines. +in all major engines. Enabling multivalue here only enables the language feature +but does not turn on the multivalue ABI. AVR Support ^^^ >From de6aa6aa0891bb11ae7402d2cbccbcd82cd4fc77 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 23 Apr 2024 13:21:15 + Subject: [PATCH 3/3] Enable only multivalue and reference types --- clang/docs/ReleaseNotes.rst| 8
[clang] [WebAssembly] Add more features to generic CPU config (PR #80923)
aheejin wrote: This first tried to enable four features (reference-types, multivalue, bulk-memory, and nontrapping-fptoint), but I think now we can enable the two first: reference-types and multivalue. These two were actually the first motivation I started this (these are necessary for the new EH spec adopted in Oct 2023). I believe I ran all emscripten tests with these two enabled and I don't think more tests fail than the current status. (We have some tests failing even now in the modes that are not regularly checked by CI, but enabling these two doesn't change that.) Usually, when we enable new features, we provide corresponding lowering pass in Binaryen to support legacy users. But I don't think that's necessary or even possible for these two. You can lower neither all multivalue-returning functions away (especially when they are imported or exported), nor reference types away. But I think it's fine, given that these two features are not really generated unless you opt into it, for example, by explicitly using `__funcref` or `__externref`. And after #88492, multivalue code is not gonna be generated unless you explicitly use a multivalue ABI like `-Xclang -target-abi -Xclang experimental-mv` or use the new EH instructions (`try_table` vaiants) in LLVM, which have not been implemented yet. So even if we enable these two features, the legacy users wouldn't be suddenly getting reference types or multivalue in their code. I'll modify this PR to enable the two features (multivalue and reference-types) first. That way I think we can land this soon. WDYT? https://github.com/llvm/llvm-project/pull/80923 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)
https://github.com/aheejin approved this pull request. https://github.com/llvm/llvm-project/pull/84137 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)
aheejin wrote: I'm not sure about the common practice in this repo, but Github in general supports merge workflows much better. Especially in a long-running large PRs, if you force-push, it's hard for the reviewers to know what has changed since their last review, because all the history his lost and they have to look at the whole diff again. And many PRs in this repo tend to be bigger and long-running than other repos in my opinion. Also Github supports a nice feature called "New changed since you last reviewed" ![image](https://github.com/llvm/llvm-project/assets/8726997/72b62f34-86a3-4195-9a17-9a8276d2a886) and this feature is usable only with the merge workflow. (The screenshot is not mine; I got it from Google) I wonder why the merge workflow is harder to review. https://github.com/llvm/llvm-project/pull/84137 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)
aheejin wrote: @yamt Given that this PR is not large and we already went through it anyway, nevermind what I said about rebasing, and please use whatever method you are convenient with. But just FYI you can do `git merge` to avoid rebasing (I'm not asking you to do it here; just in case you aren't aware) https://github.com/llvm/llvm-project/pull/84137 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/84137 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/84137 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits