[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-21 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I think the underlying functionality is pretty clearly useful: identical code folding gives significant codesize reductions. In fact, on Windows, the linker does this kind of folding automatically by default (despite the fact that it isn't standards-compliant). I imagine

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

2024-05-21 Thread Erich Keane via cfe-commits
erichkeane 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

[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-20 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: 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

[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 Eli Friedman via cfe-commits
efriedma-quic wrote: If we're going to do this, it should probably also work for constants. 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 #63628. https://github.com/llvm/llvm-project/pull/92499

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

2024-05-17 Thread via cfe-commits
https://github.com/Sirraide 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 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]; Sirraide

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

2024-05-17 Thread via cfe-commits
https://github.com/Sirraide commented: I’m not sure how useful such an attribute would be, but the implementation of this looks ok, though this needs some documentation, a release note, and some sema tests to make sure we diagnose it when it’s applied to a non-function and codegen tests as

[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 via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: YAMAMOTO Takashi (yamt) Changes 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] 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