[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-09-06 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl updated this revision to Diff 556089. brendandahl added a comment. Rebase and fix unused variable warning. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156172/new/ https://reviews.llvm.org/D156172 Files: clang/lib/CodeGen/CodeGenMod

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-08-24 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl added a comment. @efriedma ping Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156172/new/ https://reviews.llvm.org/D156172 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://list

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-08-08 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl added a comment. @efriedma I've updated the patch to fix the decl-use-decl example and added a test for it. Anything else? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156172/new/ https://reviews.llvm.org/D156172

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-08-03 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl updated this revision to Diff 546986. brendandahl added a comment. Cleanup some extra brackets. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156172/new/ https://reviews.llvm.org/D156172 Files: clang/lib/CodeGen/CodeGenModule.cpp c

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-08-03 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl updated this revision to Diff 546966. brendandahl added a comment. Update deferred annotations whenever EmitGlobalDefinition is called with a FunctionDecl and it has already been used or defined. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-08-02 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl updated this revision to Diff 546632. brendandahl added a comment. Switch to emitting annotations and the end. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156172/new/ https://reviews.llvm.org/D156172 Files: clang/lib/CodeGen/CodeGe

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-07-27 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl added a comment. I looked into the above issue with mixing declarations and definitions and I think I can fix that by leaving the AddGlobalAnnotations call in EmitGlobalFunctionDefinition and only calling AddGlobalAnnotations from GetOrCreateLLVMFunction when it's for a definition.

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-07-25 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl added a comment. That example appears to still work the same with my patch: @xxx = global ptr @foo, align 8 @.str = private unnamed_addr constant [4 x i8] c"bar\00", section "llvm.metadata" @.str.1 = private unnamed_addr constant [8 x i8] c"main2.c\00", section "llvm.metadata"

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-07-25 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl added a comment. A little more context for the new reviewers. Over in this patch I added support for annotations to be emitted into WebAssembly. We'd like to use this to mark imported (declarations) and exported (definitions) of functions with spec

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-07-24 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl created this revision. Herald added a project: All. brendandahl requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Previously, annotations were only emitted for function definitions. With this change annotations are also emitted fo

[PATCH] D150803: [WebAssembly] Support `annotate` clang attributes for marking functions.

2023-07-11 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl updated this revision to Diff 539191. brendandahl added a comment. Rebase on main. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150803/new/ https://reviews.llvm.org/D150803 Files: lld/test/wasm/func-attr-tombstone.s lld/test/wasm/

[PATCH] D150803: [WebAssembly] Support `annotate` clang attributes for marking functions.

2023-06-27 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl marked an inline comment as not done. brendandahl added inline comments. Comment at: llvm/test/MC/WebAssembly/func-attr.s:21 +# CHECK-OBJ-NEXT: Offset: 0x0 +# CHECK-OBJ-NEXT: Name:func_attr.custom0 sbc100 wrote: > Sho

[PATCH] D150803: [WebAssembly] Support `annotate` clang attributes for marking functions.

2023-06-27 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl updated this revision to Diff 535187. brendandahl added a comment. Remove annotate arguments. Change name from func_attr to llvm.func_attr. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150803/new/ https://reviews.llvm.org/D150803 File

[PATCH] D150803: [WebAssembly] Support `annotate` clang attributes for marking functions.

2023-06-27 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl added inline comments. Comment at: llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp:585-598 +// The fifth field is an optional pointer to the arguments. Append each +// argument to the name separated by a '.'. +auto *ArgsVar = dyn_cast(CS->getOperand

[PATCH] D150803: Add a new `wasm_custom` clang attribute for marking functions.

2023-06-27 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl added a comment. In D150803#4440802 , @aaron.ballman wrote: > Marking as requested changes so it's clear there's more worth discussing, so > we don't accidentally land this. I've switched to using `annotate` now. Let me know if there's anyt

[PATCH] D150803: Add a new `wasm_custom` clang attribute for marking functions.

2023-06-27 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl updated this revision to Diff 535126. brendandahl added a comment. Use the annotate attribute to generate custom sections. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150803/new/ https://reviews.llvm.org/D150803 Files: lld/test/was

[PATCH] D150803: Add a new `wasm_custom` clang attribute for marking functions.

2023-06-22 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl added inline comments. Comment at: clang/include/clang/Basic/AttrDocs.td:5608-5612 +Clang supports the ``__attribute__((wasm_async))`` +attribute for the WebAssembly target. This attribute may be attached to a +function definition, which indicates the function will be

[PATCH] D150803: Add a new `wasm_custom` clang attribute for marking functions.

2023-06-21 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl added inline comments. Comment at: clang/include/clang/Basic/AttrDocs.td:5608-5612 +Clang supports the ``__attribute__((wasm_async))`` +attribute for the WebAssembly target. This attribute may be attached to a +function definition, which indicates the function will be

[PATCH] D150803: Add a new `wasm_custom` clang attribute for marking functions.

2023-06-20 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl added a comment. @aaron.ballman or @erichkeane Did you want to re-review after that latest changes (more generic attribute) or are things good to go? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150803/new/ https://reviews.llvm.org/D1

[PATCH] D150803: Add a new `wasm_custom` clang attribute for marking functions.

2023-06-14 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl updated this revision to Diff 531390. brendandahl marked an inline comment as done. brendandahl added a comment. Review comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150803/new/ https://reviews.llvm.org/D150803 Files: clang

[PATCH] D150803: Add a new `wasm_custom` clang attribute for marking functions.

2023-06-14 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl marked 4 inline comments as done. brendandahl added inline comments. Comment at: lld/test/wasm/custom-undefine.s:17 +.type bar,@function +bar: +.functype bar () -> () dschuff wrote: > I don't fully understand how this test is d

[PATCH] D150803: Add a new `wasm_custom` clang attribute for marking functions.

2023-06-13 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl updated this revision to Diff 531014. brendandahl added a comment. Fix few remaining issues. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150803/new/ https://reviews.llvm.org/D150803 Files: clang/docs/ReleaseNotes.rst clang/includ

[PATCH] D150803: [WebAssembly] Add a new `wasm_async` clang attribute for marking async functions.

2023-06-13 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl updated this revision to Diff 531008. brendandahl added a comment. After some feedback, a few people have indicated they'd like to do something similar to this, but for their own attributes. I've changed to a more generic attribute that allows arbitrary strings. Now a custom section

[PATCH] D150803: [WebAssembly] Add a new `wasm_async` clang attribute for marking async functions.

2023-06-06 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl marked an inline comment as done. brendandahl added a comment. In D150803#4389062 , @sunfish wrote: > In D150803#4389040 , @dschuff wrote: > >> Hm, this is interesting because in the long term we plan

[PATCH] D150803: [WebAssembly] Add a new `wasm_async` clang attribute for marking async functions.

2023-06-06 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl marked 2 inline comments as done. brendandahl added inline comments. Comment at: clang/lib/Sema/SemaDeclAttr.cpp:7638 + D->addAttr(::new (S.Context) WebAssemblyAsyncAttr(S.Context, AL)); + D->addAttr(UsedAttr::CreateImplicit(S.Context)); +} erichkea

[PATCH] D150803: [WebAssembly] Add a new `wasm_async` clang attribute for marking async functions.

2023-06-06 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl updated this revision to Diff 529028. brendandahl added a comment. Review comments. Add tombstone for unused functions. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150803/new/ https://reviews.llvm.org/D150803 Files: clang/docs/Rele

[PATCH] D150803: [WebAssembly] Add a new `wasm_async` clang attribute for marking async functions.

2023-06-01 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl added inline comments. Comment at: clang/lib/CodeGen/TargetInfo.cpp:892 if (const auto *Attr = FD->getAttr()) { -llvm::Function *Fn = cast(GV); +auto *Fn = cast(GV); llvm::AttrBuilder B(GV->getContext()); Whoops, I chan

[PATCH] D150803: [WebAssembly] Add a new `wasm_async` clang attribute for marking async functions.

2023-05-31 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl updated this revision to Diff 527218. brendandahl marked an inline comment as done. brendandahl added a comment. Address comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150803/new/ https://reviews.llvm.org/D150803 Files: clan

[PATCH] D150803: [WebAssembly] Add a new `wasm_async` clang attribute for marking async functions.

2023-05-31 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl marked 12 inline comments as done. brendandahl added inline comments. Comment at: clang/lib/Sema/SemaDeclAttr.cpp:7645 + if (FD->isThisDeclarationADefinition()) { +S.Diag(D->getLocation(), diag::err_alias_is_definition) << FD << 0; +return; a

[PATCH] D150803: [WebAssembly] Add a new `wasm_async` clang attribute for marking async functions.

2023-05-24 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl added inline comments. Comment at: clang/include/clang/Basic/Attr.td:1984 + TargetSpecificAttr { + let Spellings = [Clang<"wasm_async">]; + let Documentation = [WebAssemblyAsyncDocs]; sbc100 wrote: > Should we call this em_asyn

[PATCH] D150803: [WebAssembly] Add a new `wasm_async` clang attribute for marking async functions.

2023-05-24 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl updated this revision to Diff 525348. brendandahl marked 5 inline comments as done. brendandahl added a comment. Review comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150803/new/ https://reviews.llvm.org/D150803 Files: clang

[PATCH] D150803: [WebAssembly] Add a new `wasm_async` clang attribute for marking async functions.

2023-05-17 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl created this revision. brendandahl added a reviewer: sbc100. Herald added subscribers: pmatos, asb, jdoerfert, ecnelises, sunfish, hiraditya, jgravelle-google, dschuff. Herald added a reviewer: aaron.ballman. Herald added a project: All. brendandahl requested review of this revision. H