[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-10-09 Thread Jacek Caban via Phabricator via cfe-commits
jacek added a comment. In D157547#4653477 , @efriedma wrote: > How important is that particular pattern? I think most patterns involving > assembly should be covered by some combination of naked functions, and > functions defined in separate assembly f

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-10-09 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. > For assembly, I'm not really comfortable with the fix you're proposing; it > relies on the order in which functions are defined in assembly. I think LLVM > usually ends up emitting module-level inline assembly before generated code, > but it seems fragile to depend o

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-10-09 Thread Eli Friedman via Phabricator via cfe-commits
efriedma updated this revision to Diff 557651. efriedma added a comment. Fix the calling convention for functions returning C++ classes. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157547/new/ https://reviews.llvm.org/D157547 Files: clang/lib/

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-10-09 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. For assembly, I'm not really comfortable with the fix you're proposing; it relies on the order in which functions are defined in assembly. I think LLVM usually ends up emitting module-level inline assembly before generated code, but it seems fragile to depend on that

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-10-09 Thread Jacek Caban via Phabricator via cfe-commits
jacek added a comment. It works nice with my testing so far, thanks! I noticed one problem with code that defines symbols in assembly. It conflicts with anti-dependency symbols emitted by codegen and hits an asserts in assembly printer. This commit fixes it for me: https://github.com/cjacek/llv

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-10-04 Thread Eli Friedman via Phabricator via cfe-commits
efriedma updated this revision to Diff 557592. efriedma added a comment. Updated with feedback from @dpaoliello and additional internal testing. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157547/new/ https://reviews.llvm.org/D157547 Files: cl

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-10-02 Thread Daniel Paoliello via Phabricator via cfe-commits
dpaoliello added inline comments. Comment at: llvm/lib/Target/AArch64/AArch64CallingConvention.td:248-257 + // The first 4 FP/Vector arguments are passed in XMM registers. + CCIfType<[f16], + CCAssignToRegWithShadow<[H0, H1, H2, H3], +

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-09-27 Thread Eli Friedman via Phabricator via cfe-commits
efriedma updated this revision to Diff 557412. efriedma added a comment. Rebased Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157547/new/ https://reviews.llvm.org/D157547 Files: clang/lib/CodeGen/CGCXX.cpp llvm/include/llvm/IR/CallingConv.h

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-09-26 Thread Daniel Paoliello via Phabricator via cfe-commits
dpaoliello added a comment. @efriedma the patch is failing to apply - can you please update your baseline, or move this to a GitHub PR? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157547/new/ https://reviews.llvm.org/D157547 ___

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-09-25 Thread Eli Friedman via Phabricator via cfe-commits
efriedma updated this revision to Diff 557335. efriedma added a comment. Revised so guest exit thunks actually work. Thanks for the tip about the symbols; I forgot to look at the object file in addition to the generated assembly. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTIO

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-09-25 Thread Jacek Caban via Phabricator via cfe-commits
jacek added a comment. In D157547#4650643 , @efriedma wrote: > Seems to be working for simple cases, but I'm not sure this is actually > working properly (I'm still seeing LNK1000 crashes). I don't know if it's related to crashes that you're seeing, but

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-09-25 Thread Eli Friedman via Phabricator via cfe-commits
efriedma updated this revision to Diff 557315. efriedma added a comment. Updated with my attempt at guest exit thunks. Seems to be working for simple cases, but I'm not sure this is actually working properly (I'm still seeing LNK1000 crashes). Repository: rG LLVM Github Monorepo CHANGES SIN

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-09-14 Thread Billy Laws via Phabricator via cfe-commits
bylaws added inline comments. Comment at: llvm/lib/Target/AArch64/AArch64MCInstLower.cpp:59 + +StringRef Name = Printer.getSymbol(GV)->getName(); +// Don't mangle ARM64EC runtime functions. bylaws wrote: > This mangling logic is also necessary for dllimpo

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-09-13 Thread Daniel Paoliello via Phabricator via cfe-commits
dpaoliello added inline comments. Comment at: llvm/lib/Target/AArch64/AArch64MCInstLower.cpp:37-38 MCSymbol * AArch64MCInstLower::GetGlobalAddressSymbol(const MachineOperand &MO) const { const GlobalValue *GV = MO.getGlobal(); We now also need to call this

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-09-13 Thread Billy Laws via Phabricator via cfe-commits
bylaws added inline comments. Comment at: llvm/lib/Target/AArch64/AArch64MCInstLower.cpp:59 + +StringRef Name = Printer.getSymbol(GV)->getName(); +// Don't mangle ARM64EC runtime functions. This mangling logic is also necessary for dllimported functions,

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-08-25 Thread Jacek Caban via Phabricator via cfe-commits
jacek added a comment. I published an initial version of my attempt at documenting this stuff here: https://wiki.winehq.org/ARM64ECToolchain. It's not yet complete, but I hope it's already useful. I plan to extend it in the future. If some clarification or more information would be useful, plea

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-08-23 Thread Eli Friedman via Phabricator via cfe-commits
efriedma updated this revision to Diff 552917. efriedma added a comment. Update to address issues found so far. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157547/new/ https://reviews.llvm.org/D157547 Files: clang/lib/CodeGen/CGCXX.cpp llvm/

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-08-23 Thread Daniel Paoliello via Phabricator via cfe-commits
dpaoliello added a comment. Another issue: looks like the names in `AArch64Subtarget.h` need to be fully decorated, including the leading `#` - so `#__chkstk_arm64ec` and `#__security_check_cookie_arm64ec`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-08-22 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments. Comment at: llvm/lib/Target/AArch64/AArch64CallingConvention.td:555-557 +def CSR_Win_AArch64_Arm64EC_Thunk : CalleeSavedRegs<(add X19, X20, X21, X22, X23, X24, + X25, X26, X27, X28, FP, LR,

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-08-22 Thread Daniel Paoliello via Phabricator via cfe-commits
dpaoliello added inline comments. Comment at: llvm/lib/Target/AArch64/AArch64CallingConvention.td:555-557 +def CSR_Win_AArch64_Arm64EC_Thunk : CalleeSavedRegs<(add X19, X20, X21, X22, X23, X24, + X25, X26, X27, X28, FP, LR

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-08-17 Thread Daniel Paoliello via Phabricator via cfe-commits
dpaoliello added inline comments. Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:2726-2729 +// FIXME: For non-dllimport functions, MSVC emits the same entry +// twice, for reasons I don't understand. I have to assume the linker +// ignores the red

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-08-17 Thread Jacek Caban via Phabricator via cfe-commits
jacek added inline comments. Comment at: llvm/lib/Target/AArch64/AArch64MCInstLower.cpp:51-54 +// For ARM64EC, symbol lookup in the MSVC linker has limited awareness +// of ARM64EC mangling ("#"/"$$h"). So object files need to refer to both +// the mangled and unmangl

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-08-16 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments. Comment at: llvm/lib/Target/AArch64/AArch64MCInstLower.cpp:51-54 +// For ARM64EC, symbol lookup in the MSVC linker has limited awareness +// of ARM64EC mangling ("#"/"$$h"). So object files need to refer to both +// the mangled and unma

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-08-16 Thread Jacek Caban via Phabricator via cfe-commits
jacek added inline comments. Comment at: llvm/lib/Target/AArch64/AArch64MCInstLower.cpp:51-54 +// For ARM64EC, symbol lookup in the MSVC linker has limited awareness +// of ARM64EC mangling ("#"/"$$h"). So object files need to refer to both +// the mangled and unmangl

[PATCH] D157547: Arm64EC entry/exit thunks, consolidated.

2023-08-09 Thread Eli Friedman via Phabricator via cfe-commits
efriedma created this revision. efriedma added reviewers: dpaoliello, mstorsjo, bcl5980, jacek. Herald added subscribers: zzheng, hiraditya, kristof.beyls. Herald added a project: All. efriedma requested review of this revision. Herald added projects: clang, LLVM. Herald added a subscriber: cfe-com