[clang] [lld] [llvm] [WebAssembly] Define call-indirect-overlong and bulk-memory-opt features (PR #117087)

2024-11-21 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/117087 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lld] [llvm] [WebAssembly] Define call-indirect-overlong and bulk-memory-opt features (PR #117087)

2024-11-21 Thread Heejin Ahn via cfe-commits
@@ -310,6 +332,18 @@ bool WebAssemblyTargetInfo::handleTargetFeatures( << Feature << "-target-feature"; return false; } + + // The reference-types feature included the change to `call_indirect` + // encodings to support overlong immediates. + if (HasReferenceTy

[clang] [lld] [llvm] [WebAssembly] Define call-indirect-overlong and bulk-memory-opt features (PR #117087)

2024-11-21 Thread Heejin Ahn via cfe-commits
@@ -79,6 +81,8 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro("__wasm_atomics__"); if (HasBulkMemory) Builder.defineMacro("__wasm_bulk_memory__"); + if (HasBulkMemoryOpt) +Builder.defineMacro("__wasm_bulk_memory_opt_

[clang] [lld] [llvm] [WebAssembly] Define call-indirect-overlong and bulk-memory-opt features (PR #117087)

2024-11-21 Thread Heejin Ahn via cfe-commits
@@ -114,19 +122,20 @@ def : ProcessorModel<"mvp", NoSchedModel, []>; // consideration given to available support in relevant engines and tools, and // the importance of the features. def : ProcessorModel<"generic", NoSchedModel, - [FeatureBulkMemory, Featur

[clang] [lld] [llvm] [WebAssembly] Define call-indirect-overlong and bulk-memory-opt features (PR #117087)

2024-11-21 Thread Heejin Ahn via cfe-commits
@@ -114,19 +122,20 @@ def : ProcessorModel<"mvp", NoSchedModel, []>; // consideration given to available support in relevant engines and tools, and // the importance of the features. def : ProcessorModel<"generic", NoSchedModel, - [FeatureBulkMemory, Featur

[clang] [lld] [llvm] [WebAssembly] Define call-indirect-overlong and bulk-memory-opt features (PR #117087)

2024-11-21 Thread Heejin Ahn via cfe-commits
@@ -265,6 +279,14 @@ bool WebAssemblyTargetInfo::handleTargetFeatures( HasReferenceTypes = false; continue; } +if (Feature == "+call-indirect-overlong") { + HasCallIndirectOverlong = true; + continue; +} +if (Feature == "-call-indirect-over

[clang] [lld] [llvm] [WebAssembly] Define call-indirect-overlong and bulk-memory-opt features (PR #117087)

2024-11-21 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/117087 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lld] [llvm] [WebAssembly] Define call-indirect-overlong and bulk-memory-opt features (PR #117087)

2024-11-21 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin commented: All of the below are nits on feature name ordering: https://github.com/llvm/llvm-project/pull/117087 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] [lld] [llvm] [WebAssembly] Define call-indirect-overlong and bulk-memory-opt features (PR #117087)

2024-11-21 Thread Heejin Ahn via cfe-commits
@@ -34,6 +34,15 @@ WebAssemblySubtarget::initializeSubtargetDependencies(StringRef CPU, CPU = "generic"; ParseSubtargetFeatures(CPU, /*TuneCPU*/ CPU, FS); + + // reference-types implies call-indirect-overlong + if (HasReferenceTypes) +HasCallIndirectOverlong = tru

[clang] [lld] [llvm] [WebAssembly] Define call-indirect-overlong and bulk-memory-opt features (PR #117087)

2024-11-21 Thread Heejin Ahn via cfe-commits
@@ -114,19 +122,20 @@ def : ProcessorModel<"mvp", NoSchedModel, []>; // consideration given to available support in relevant engines and tools, and // the importance of the features. def : ProcessorModel<"generic", NoSchedModel, - [FeatureBulkMemory, Featur

[clang] [WebAssembly] Enable Wasm EH features only once (PR #124042)

2025-01-23 Thread Heejin Ahn via cfe-commits
aheejin wrote: @llvm-ci The failure seems irrelevant. https://github.com/llvm/llvm-project/pull/124042 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WebAssembly] Fix EH feature flags when compiling multiple files (PR #124374)

2025-01-24 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/124374 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WebAssembly] Fix EH feature flags when compiling multiple files (PR #124374)

2025-01-24 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/124374 #124042 caused a problem that when invoking `clang` with multiple files, the static `HasRun` variables were set when processing the first file so the appropriate feature flags were not added from the second fi

[clang] [WebAssembly] Enable Wasm EH features only once (PR #124042)

2025-01-23 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/124042 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WebAssembly] Refactor Wasm EH/SjLj error checking (PR #122466)

2025-01-10 Thread Heejin Ahn via cfe-commits
@@ -120,26 +120,33 @@ // 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'

[clang] [WebAssembly] Refactor Wasm EH/SjLj error checking (PR #122466)

2025-01-10 Thread Heejin Ahn via cfe-commits
@@ -154,46 +161,46 @@ // WASM_EXCEPTIONS_NO_REFERENCE_TYPES: invalid argument '-fwasm-exceptions' not allowed with '-mno-reference-types' // '-mllvm -wasm-enable-sjlj' sets +exception-handling, +multivalue, -// +reference-types and '-exception-model=wasm' +// +reference-type

[clang] [WebAssembly] Refactor Wasm EH/SjLj error checking (PR #122466)

2025-01-10 Thread Heejin Ahn via cfe-commits
@@ -120,26 +120,33 @@ // 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'

[clang] [WebAssembly] Refactor Wasm EH/SjLj error checking (PR #122466)

2025-01-10 Thread Heejin Ahn via cfe-commits
@@ -413,53 +422,11 @@ void WebAssembly::addClangTargetOptions(const ArgList &DriverArgs, } } -if (Opt.starts_with("-wasm-enable-sjlj")) { - // '-mllvm -wasm-enable-sjlj' is not compatible with - // '-mno-exception-handling' - if (DriverArgs.hasFla

[clang] [WebAssembly] Refactor Wasm EH/SjLj error checking (PR #122466)

2025-01-10 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/122466 There were many overlaps between error checking and feature enabling routines for Wasm EH and Wasm SjLj. This tries to factor out those common routines in separate lambda functions. This is not NFC because thi

[clang] [WebAssembly] Refactor Wasm EH/SjLj error checking (PR #122466)

2025-01-10 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/122466 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WebAssembly] Add error checking for -wasm-use-legacy-ch (PR #122526)

2025-01-10 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/122526 This adds checks for `-wasm-use-legacy-eh`. While this option is true by default in the backend, it is not supposed to be given to the Clang when Wasm EH is not used. >From 0a64591d452b5f79d911d4a4ce36016761df

[clang] [clang][docs] Fix typos concerning wasm __funcref (PR #124365)

2025-02-18 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/124365 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WebAssembly] Rename functions in wasm-eh.cpp (PR #130220)

2025-03-07 Thread Heejin Ahn via cfe-commits
aheejin wrote: @llvm-ci The CI failure does not look relevant. https://github.com/llvm/llvm-project/pull/130220 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WebAssembly] Rename functions in wasm-eh.cpp (PR #130220)

2025-03-06 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/130220 I think it is generally better for tests have some descriptive function names so that we can insert new tests in the middle and don't have to renumber all tests. Also recently I added a (named) test to this fi

[clang] [WebAssembly] Rename functions in wasm-eh.cpp (PR #130220)

2025-03-07 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/130220 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WebAssembly] Generate __clang_call_terminate for Emscripten EH (PR #129020)

2025-02-27 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/129020 >From 92861b903905d4f3d2fa39772033282b2dbad758 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Thu, 27 Feb 2025 03:09:45 + Subject: [PATCH 1/3] [WebAssembly] Generate __clang_call_terminate for Emscripten E

[clang] [WebAssembly] Generate __clang_call_terminate for Emscripten EH (PR #129020)

2025-02-27 Thread Heejin Ahn via cfe-commits
@@ -0,0 +1,13 @@ +// RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fexceptions -fcxx-exceptions -emit-llvm -o - -std=c++11 2>&1 | FileCheck %s aheejin wrote: We don't do anything differently wrt EH depending on whether it is `unknown` or `emscripten` tripl

[clang] [WebAssembly] Generate __clang_call_terminate for Emscripten EH (PR #129020)

2025-02-27 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/129020 >From 92861b903905d4f3d2fa39772033282b2dbad758 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Thu, 27 Feb 2025 03:09:45 + Subject: [PATCH 1/2] [WebAssembly] Generate __clang_call_terminate for Emscripten E

[clang] [WebAssembly] Generate __clang_call_terminate for Emscripten EH (PR #129020)

2025-02-27 Thread Heejin Ahn via cfe-commits
@@ -5150,9 +5150,14 @@ WebAssemblyCXXABI::emitTerminateForUnexpectedException(CodeGenFunction &CGF, // Itanium ABI calls __clang_call_terminate(), which __cxa_begin_catch() on // the violating exception to mark it handled, but it is currently hard to do // with wasm EH i

[clang] [WebAssembly] Generate __clang_call_terminate for Emscripten EH (PR #129020)

2025-02-27 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/129020 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WebAssembly] Generate invokes with llvm.wasm.(re)throw (PR #128105)

2025-02-24 Thread Heejin Ahn via cfe-commits
@@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -triple wasm32-unknown-unknown -fexceptions -fcxx-exceptions -target-feature +reference-types -target-feature +exception-handling -target-feature +multivalue -exception-model=wasm -emit-llvm -o - %s | FileCheck %s + +// Check if __builtin_wa

[clang] [WebAssembly] Generate invokes with llvm.wasm.(re)throw (PR #128105)

2025-02-24 Thread Heejin Ahn via cfe-commits
@@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -triple wasm32-unknown-unknown -fexceptions -fcxx-exceptions -target-feature +reference-types -target-feature +exception-handling -target-feature +multivalue -exception-model=wasm -emit-llvm -o - %s | FileCheck %s + +// Check if __builtin_wa

[clang] [WebAssembly] Generate invokes with llvm.wasm.(re)throw (PR #128105)

2025-02-25 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/128105 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WebAssembly] Generate invokes with llvm.wasm.(re)throw (PR #128105)

2025-02-25 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/128105 >From 8702f84a3f3271e97bc963e997b9f441f05e83da Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Thu, 20 Feb 2025 22:23:33 + Subject: [PATCH] [WebAssembly] Generate invokes with llvm.wasm.(re)throw Even thoug

[clang] [WebAssembly] Generate __clang_call_terminate for Emscripten EH (PR #129020)

2025-02-27 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/129020 When an exception thrown ends up calling `std::terminate`, for example, because an exception is thrown within a `noexcept` function or an exception is thrown from `__cxa_end_catch` during handling the previous

[clang] [lld] [llvm] [LLVM][WebAssembly] Implement branch hinting proposal (PR #146230)

2025-07-01 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/146230 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lld] [llvm] [LLVM][WebAssembly] Implement branch hinting proposal (PR #146230)

2025-07-01 Thread Heejin Ahn via cfe-commits
@@ -5276,6 +5276,8 @@ def mtail_call : Flag<["-"], "mtail-call">, Group; def mno_tail_call : Flag<["-"], "mno-tail-call">, Group; def mwide_arithmetic : Flag<["-"], "mwide-arithmetic">, Group; def mno_wide_arithmetic : Flag<["-"], "mno-wide-arithmetic">, Group; +def mbranch_

[clang] [lld] [llvm] [LLVM][WebAssembly] Implement branch hinting proposal (PR #146230)

2025-07-01 Thread Heejin Ahn via cfe-commits
@@ -2562,8 +2565,9 @@ void WebAssemblyCFGStackify::rewriteDepthImmediates(MachineFunction &MF) { MO = MachineOperand::CreateImm(getDelegateDepth(Stack, MO.getMBB())); else if (MI.getOpcode() == WebAssembly::RETHROW) MO = MachineOperand::CreateImm(ge

[clang] [lld] [llvm] [LLVM][WebAssembly] Implement branch hinting proposal (PR #146230)

2025-07-01 Thread Heejin Ahn via cfe-commits
@@ -2608,6 +2612,21 @@ void WebAssemblyCFGStackify::rewriteDepthImmediates(MachineFunction &MF) { Stack.push_back(std::make_pair(&MBB, &MI)); break; + case WebAssembly::BR_IF: { +// this is the last place where we can easily calculate the branch +

[clang] [lld] [llvm] [LLVM][WebAssembly] Implement branch hinting proposal (PR #146230)

2025-07-01 Thread Heejin Ahn via cfe-commits
@@ -2608,6 +2612,21 @@ void WebAssemblyCFGStackify::rewriteDepthImmediates(MachineFunction &MF) { Stack.push_back(std::make_pair(&MBB, &MI)); break; + case WebAssembly::BR_IF: { +// this is the last place where we can easily calculate the branch +

[clang] [lld] [llvm] [LLVM][WebAssembly] Implement branch hinting proposal (PR #146230)

2025-07-01 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin commented: Thanks! So far I've only read the CFG parts and feature-adding parts, but some comments: https://github.com/llvm/llvm-project/pull/146230 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[clang] [llvm] WebAssembly: Stop changing MCAsmInfo's ExceptionsType based on flags (PR #146343)

2025-07-01 Thread Heejin Ahn via cfe-commits
@@ -1,4 +1,4 @@ -# RUN: llc -mtriple=wasm32-unknown-unknown -wasm-use-legacy-eh -exception-model=wasm -mattr=+exception-handling -run-pass wasm-cfg-stackify %s -o - | FileCheck %s +# RUN: llc -mtriple=wasm32-unknown-unknown -wasm-use-legacy-eh -wasm-enable-sjlj -exception-model

[clang] [llvm] WebAssembly: Stop changing MCAsmInfo's ExceptionsType based on flags (PR #146343)

2025-07-01 Thread Heejin Ahn via cfe-commits
aheejin wrote: > > And it was a little confusing that the PR description argues we should > > remove `-wasm-enable-eh/sjlj` options, which disagree, when the code seems > > to fix something else. Those flags control behaviors, not exception models, > > so we still need them. For example, someo

[clang] [lld] [llvm] [LLVM][WebAssembly] Implement branch hinting proposal (PR #146230)

2025-07-01 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/146230 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [WebAssembly] Add gc target feature to addBleedingEdgeFeatures (PR #151294)

2025-07-30 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin approved this pull request. What was the cause for the yesterday's error? https://github.com/llvm/llvm-project/pull/151294 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang] [llvm] [WebAssembly] Add gc target feature to addBleedingEdgeFeatures (PR #151107)

2025-07-29 Thread Heejin Ahn via cfe-commits
aheejin wrote: Tests failures don't seem to be related to this PR. Merged. https://github.com/llvm/llvm-project/pull/151107 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [WebAssembly] Add gc target feature to addBleedingEdgeFeatures (PR #151107)

2025-07-29 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin closed https://github.com/llvm/llvm-project/pull/151107 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [WebAssembly] Add gc target feature to addBleedingEdgeFeatures (PR #151107)

2025-07-29 Thread Heejin Ahn via cfe-commits
aheejin wrote: > https://github.com/llvm/llvm-project/blob/main/clang/test/Driver/wasm-features.c > needs to be updated too. For example, this is `fp16`: > > https://github.com/llvm/llvm-project/blob/052b836d2384c8a583ae5f945dcdcfba2004bbb0/clang/test/Driver/wasm-features.c#L38-L42 I don't thi

[libunwind] [libunwind] Use consistent indentation in `__libunwind_config.h` (PR #152861)

2025-08-11 Thread Heejin Ahn via cfe-commits
@@ -11,6 +11,8 @@ #define _LIBUNWIND_VERSION 15000 +// Disable clang-format as it makes the huge conditions unreadable. +// clang-format off aheejin wrote: Sorry maybe I'm missing something, but your change doesn't look like it's flattening everything: http

[libunwind] [libunwind] Use consistent indentation in `__libunwind_config.h` (PR #152861)

2025-08-11 Thread Heejin Ahn via cfe-commits
@@ -11,6 +11,8 @@ #define _LIBUNWIND_VERSION 15000 +// Disable clang-format as it makes the huge conditions unreadable. +// clang-format off aheejin wrote: Sorry I thought this makes incorrect indentations correct..? https://github.com/llvm/llvm-project/pu

[libunwind] [libunwind] Use consistent indentation in `__libunwind_config.h` (PR #152861)

2025-08-11 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/152861 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libunwind] [libunwind] Use consistent indentation in `__libunwind_config.h` (PR #152861)

2025-08-09 Thread Heejin Ahn via cfe-commits
@@ -11,6 +11,8 @@ #define _LIBUNWIND_VERSION 15000 +// Disable clang-format as it makes the huge conditions unreadable. +// clang-format off aheejin wrote: If the point is making indentations correct, why disable clang-format? https://github.com/llvm/llvm-p

[clang] [llvm] Add __builtin_wasm_js_catch (PR #153767)

2025-08-15 Thread Heejin Ahn via cfe-commits
aheejin wrote: I'm not sure if I understand why this is necessary. > This is a setjmp-like API that catches JavaScript errors. Its signature is > `externref_t __builtin_wasm_js_catch(int *status);` The first time it > returns, the return value is `null` and *status is set to 0. If we later cal

[clang] [libunwind] [llvm] [wasm] Toolchain support for `wasm32-wali-linux-musl` target (PR #156087)

2025-09-05 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin edited https://github.com/llvm/llvm-project/pull/156087 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libunwind] [llvm] [wasm] Toolchain support for `wasm32-wali-linux-musl` target (PR #156087)

2025-09-05 Thread Heejin Ahn via cfe-commits
@@ -199,6 +199,7 @@ class Triple { SUSE, OpenEmbedded, Intel, +WALI, aheejin wrote: It being a vendor seems weird because the current list of vendors basically only include companies. > think to minimize `cfg` changes and have quick support t

<    1   2   3   4