[PATCH] D126811: [ARM64EC 10/?] Add support for lowering indirect calls.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 1 12:43:22 PDT 2022


efriedma created this revision.
Herald added subscribers: zzheng, hiraditya, kristof.beyls, mgorny.
Herald added a project: All.
efriedma requested review of this revision.
Herald added a project: LLVM.

Part of initial Arm64EC patchset.

On Arm64EC targets, all indirect calls must first check whether the callee is ARM64 or x64 code.  If the callee is ARM64 code, the pointer is directly called; if the callee is x64, it goes through a function to translate the calling convention from ARM64 to x64.

If CFG is enabled, this check is integrated with the CFG check: the call also checks whether the pointer points to a valid target.

The translation of calling conventions is done late; as far as I can tell, the way clang normally translates function types to LLVM IR leaves  enough information to do this correctly.  (If it turns out some case doesn't work, we should be able to bridge the gap using attributes.) I was originally thinking about generating thunks in clang, but there are complications: we'd need to staple the thunk to the call using a bundle, and calls generated by the optimizer wouldn't have access to whatever code clang used.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126811

Files:
  llvm/lib/Target/AArch64/AArch64.h
  llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
  llvm/lib/Target/AArch64/Arm64ECCallLowering.cpp
  llvm/lib/Target/AArch64/CMakeLists.txt
  llvm/test/CodeGen/AArch64/arm64ec-cfg.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126811.433498.patch
Type: text/x-patch
Size: 18905 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220601/694e99ba/attachment.bin>


More information about the llvm-commits mailing list