[clang] [clang] add unnamed_addr function attribute (PR #92499)

2024-05-21 Thread YAMAMOTO Takashi via cfe-commits
yamt wrote: > That said, the description of the use case is ~3 short sentences. ok. here is a concrete example and a bit longer explanation: https://github.com/yamt/toywasm/blob/9ee6ec86f56723819fd8411866094f72247dba78/lib/insn.c#L515-L527 https://github.com/llvm/llvm-project/pull/92499

[clang] [clang] add unnamed_addr function attribute (PR #92499)

2024-05-20 Thread YAMAMOTO Takashi via cfe-commits
yamt wrote: > If we're going to do this, it should probably also work for constants. for completeness, maybe. i myself have no use cases though. > Also, I think I'd prefer to sort out the situation with the C++ standard's > rules for constant merging before we start extending those rules. See

[clang] [clang] add unnamed_addr function attribute (PR #92499)

2024-05-20 Thread YAMAMOTO Takashi via cfe-commits
yamt wrote: > Hmm... I'm not sure this meets our requirements for inclusion as an > attribute. The semantics of this are pretty opaque, no obvious significant > motivation/applicability in the base languages, etc. There doesn't seem to be > any reasonable use case that I can see. do you mean

[clang] [clang] add unnamed_addr function attribute (PR #92499)

2024-05-19 Thread YAMAMOTO Takashi via cfe-commits
@@ -1944,6 +1944,13 @@ def ReturnsTwice : InheritableAttr { let SimpleHandler = 1; } +def UnnamedAddr : InheritableAttr { + let Spellings = [Clang<"unnamed_addr">]; + let Subjects = SubjectList<[Function]>; + let Documentation = [Undocumented]; yamt

[clang] [clang] add unnamed_addr function attribute (PR #92499)

2024-05-19 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt updated https://github.com/llvm/llvm-project/pull/92499 >From 52b744c91bdba1cf8cda9d6164ec8fc130d75fab Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 17 May 2024 14:47:06 +0900 Subject: [PATCH 1/3] [clang] add unnamed_addr function attribute It simply

[clang] [clang] add unnamed_addr function attribute (PR #92499)

2024-05-17 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt edited https://github.com/llvm/llvm-project/pull/92499 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] clang: add unnamed_addr function attribute (PR #92499)

2024-05-17 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt updated https://github.com/llvm/llvm-project/pull/92499 >From 52b744c91bdba1cf8cda9d6164ec8fc130d75fab Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 17 May 2024 14:47:06 +0900 Subject: [PATCH] [clang] add unnamed_addr function attribute It simply applies

[clang] clang: add unnamed_addr function attribute (PR #92499)

2024-05-16 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt created https://github.com/llvm/llvm-project/pull/92499 It simply applies the LLVM attribute with the same name to the function. Sometimes, a programmer knows that function pointer uniqueness doesn't really matter for some of their functions. In that case, this

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-25 Thread YAMAMOTO Takashi via cfe-commits
yamt 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

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-21 Thread YAMAMOTO Takashi via cfe-commits
yamt 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

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-20 Thread YAMAMOTO Takashi via cfe-commits
yamt wrote: @aheejin may i rebase this PR as it now has conflicts? 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)

2024-03-15 Thread YAMAMOTO Takashi via cfe-commits
yamt wrote: @aheejin i updated the rest of comments 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)

2024-03-15 Thread YAMAMOTO Takashi via cfe-commits
yamt wrote: > i tried to run the relevant emscripten tests. but i have not succeeded yet > even w/o these changes. (i'm an emscripten newbie.) they passed with the latest version of this PR and the emscripten PR. https://github.com/llvm/llvm-project/pull/84137

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-15 Thread YAMAMOTO Takashi via cfe-commits
@@ -198,9 +198,18 @@ /// /// If there are calls to setjmp() /// -/// 2) and 3): The same as 2) and 3) in Emscripten SjLj. -/// (setjmpTable/setjmpTableSize initialization + setjmp callsite -/// transformation) +/// 2) In the function entry that calls setjmp, initialize +///

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-15 Thread YAMAMOTO Takashi via cfe-commits
@@ -198,9 +198,18 @@ /// /// If there are calls to setjmp() /// -/// 2) and 3): The same as 2) and 3) in Emscripten SjLj. -/// (setjmpTable/setjmpTableSize initialization + setjmp callsite -/// transformation) +/// 2) In the function entry that calls setjmp, initialize +///

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-15 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt updated https://github.com/llvm/llvm-project/pull/84137 >From 6c1bfa0aa292d81102a9aeb86ca4264516beb634 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 9 Feb 2024 15:49:55 +0900 Subject: [PATCH 01/26] [WebAssembly] Implement an alternative translation for

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-14 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt 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)

2024-03-13 Thread YAMAMOTO Takashi via cfe-commits
yamt wrote: > If possible, can you not force-push? It's hard to track changes between > commits with force-pushes. Thank you! i had to rebase for some unrelated reasons. i will avoid it next time. https://github.com/llvm/llvm-project/pull/84137 ___

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-13 Thread YAMAMOTO Takashi via cfe-commits
yamt wrote: @aheejin @sbc100 i think i resolved most of your feedback in this PR and the emscripten PR. i tried to run the relevant emscripten tests. but i have not succeeded yet even w/o these changes. (i'm an emscripten newbie.) https://github.com/llvm/llvm-project/pull/84137

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-13 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt ready_for_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)

2024-03-13 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt 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)

2024-03-13 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt updated https://github.com/llvm/llvm-project/pull/84137 >From 6c1bfa0aa292d81102a9aeb86ca4264516beb634 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 9 Feb 2024 15:49:55 +0900 Subject: [PATCH 01/20] [WebAssembly] Implement an alternative translation for

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-13 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt 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)

2024-03-13 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt updated https://github.com/llvm/llvm-project/pull/84137 >From 6c1bfa0aa292d81102a9aeb86ca4264516beb634 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 9 Feb 2024 15:49:55 +0900 Subject: [PATCH 01/19] [WebAssembly] Implement an alternative translation for

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-13 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt updated https://github.com/llvm/llvm-project/pull/84137 >From 6c1bfa0aa292d81102a9aeb86ca4264516beb634 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 9 Feb 2024 15:49:55 +0900 Subject: [PATCH 01/17] [WebAssembly] Implement an alternative translation for

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-13 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt 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)

2024-03-13 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt 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)

2024-03-13 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt converted_to_draft 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)

2024-03-12 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt updated https://github.com/llvm/llvm-project/pull/84137 >From 6c1bfa0aa292d81102a9aeb86ca4264516beb634 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 9 Feb 2024 15:49:55 +0900 Subject: [PATCH 01/13] [WebAssembly] Implement an alternative translation for

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-11 Thread YAMAMOTO Takashi via cfe-commits
yamt wrote: @aheejin @sbc100 let me confirm the plan on this PR. i can remove the option `-mllvm -experimental-wasm-enable-alt-sjlj` by making it unconditionally true, and update tests, right? https://github.com/llvm/llvm-project/pull/84137 ___

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-11 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt updated https://github.com/llvm/llvm-project/pull/84137 >From 1283ae6b5536810f8fbe183eda80997aa9f5cdc3 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 9 Feb 2024 15:49:55 +0900 Subject: [PATCH 1/7] [WebAssembly] Implement an alternative translation for

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-11 Thread YAMAMOTO Takashi via cfe-commits
yamt wrote: > > Given that we don't need `setjmpTableSize` anymore and `setjmpTable` > > doesn't change, we don't need the whole block here from line 1463 ~ line > > 1503 doing SSA updates anymore: > > i get errors like the following if i simply put the SSA update things in >

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-10 Thread YAMAMOTO Takashi via cfe-commits
yamt wrote: > Given that we don't need `setjmpTableSize` anymore and `setjmpTable` doesn't > change, we don't need the whole block here from line 1463 ~ line 1503 doing > SSA updates anymore: i get errors like the following if i simply put the SSA update things in `!EnableWasmAltSjLj` block.

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-10 Thread YAMAMOTO Takashi via cfe-commits
yamt wrote: > @yamt, do you want to submit a PR to emscripten adding new library functions? > I can do that too, but given that this is your code, if you want to do it > it'd be good. About where to add them... to make the transition smooth, >

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-10 Thread YAMAMOTO Takashi via cfe-commits
yamt wrote: > > In terms of getting this landed and tested, I wonder which path we should > > take: > > > > 1. Land this now, without tests, then update emscripten then come back and > > flip the default, at which point the existing tests will get updated. > > 2. Duplicate/update the the

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-10 Thread YAMAMOTO Takashi via cfe-commits
@@ -1738,10 +1792,16 @@ void WebAssemblyLowerEmscriptenEHSjLj::handleLongjmpableCallsForWasmSjLj( BasicBlock *ThenBB = BasicBlock::Create(C, "if.then", ); BasicBlock *EndBB = BasicBlock::Create(C, "if.end", ); Value *EnvP = IRB.CreateBitCast(Env, getAddrPtrType(),

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-10 Thread YAMAMOTO Takashi via cfe-commits
@@ -999,25 +1017,43 @@ bool WebAssemblyLowerEmscriptenEHSjLj::runOnModule(Module ) { // Register __wasm_longjmp function, which calls __builtin_wasm_longjmp. FunctionType *FTy = FunctionType::get( IRB.getVoidTy(), {Int8PtrTy, IRB.getInt32Ty()}, false); -

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-10 Thread YAMAMOTO Takashi via cfe-commits
@@ -1291,19 +1327,29 @@ bool WebAssemblyLowerEmscriptenEHSjLj::runSjLjOnFunction(Function ) { Type *IntPtrTy = getAddrIntType(); Constant *size = ConstantInt::get(IntPtrTy, 40); IRB.SetInsertPoint(SetjmpTableSize); - auto *SetjmpTable = IRB.CreateMalloc(IntPtrTy,

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-10 Thread YAMAMOTO Takashi via cfe-commits
@@ -1291,19 +1327,29 @@ bool WebAssemblyLowerEmscriptenEHSjLj::runSjLjOnFunction(Function ) { Type *IntPtrTy = getAddrIntType(); Constant *size = ConstantInt::get(IntPtrTy, 40); IRB.SetInsertPoint(SetjmpTableSize); - auto *SetjmpTable = IRB.CreateMalloc(IntPtrTy,

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-10 Thread YAMAMOTO Takashi via cfe-commits
@@ -1291,19 +1327,29 @@ bool WebAssemblyLowerEmscriptenEHSjLj::runSjLjOnFunction(Function ) { Type *IntPtrTy = getAddrIntType(); Constant *size = ConstantInt::get(IntPtrTy, 40); IRB.SetInsertPoint(SetjmpTableSize); - auto *SetjmpTable = IRB.CreateMalloc(IntPtrTy,

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-07 Thread YAMAMOTO Takashi via cfe-commits
@@ -999,25 +1002,42 @@ bool WebAssemblyLowerEmscriptenEHSjLj::runOnModule(Module ) { // Register __wasm_longjmp function, which calls __builtin_wasm_longjmp. FunctionType *FTy = FunctionType::get( IRB.getVoidTy(), {Int8PtrTy, IRB.getInt32Ty()}, false); -

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-07 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt updated https://github.com/llvm/llvm-project/pull/84137 >From 1283ae6b5536810f8fbe183eda80997aa9f5cdc3 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 9 Feb 2024 15:49:55 +0900 Subject: [PATCH 1/3] [WebAssembly] Implement an alternative translation for

[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

2024-03-06 Thread YAMAMOTO Takashi via cfe-commits
https://github.com/yamt created https://github.com/llvm/llvm-project/pull/84137 Instead of maintaining per-function-invocation malloc()'ed tables to track which functions each label belongs to, store the equivalent info in jump buffers (jmp_buf) themselves. Also, use a less emscripten-looking