[PATCH] D61894: [RFC] [AArch64] Add a target feature flag for restoring X18 after foreign function calls

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 14 06:10:58 PDT 2019


mstorsjo created this revision.
mstorsjo added reviewers: rnk, t.p.northover.
Herald added subscribers: kristof.beyls, javed.absar.
Herald added a project: LLVM.

This is a different, more comprehensive solution to the same issue as D61892 <https://reviews.llvm.org/D61892> (https://bugs.winehq.org/show_bug.cgi?id=38780).

This is an incomplete PoC patch; in -O0 mode, the function calls are lowered with GlobalISel which doesn't use the modified functions in AArch64ISelLowering.cpp. When GlobalISel lowers a call in IRTranslator::translateCall in lib/CodeGen/GlobalISel/IRTranslator.cpp, it doesn't have target specific knowledge where it could check for this AArch64 specific feature flag.

Currently this is implemented as target feature flag (used via clang as `-Xclang -target-feature -Xclang +protect-x18`). This is not ideal though, because it's hard to check for this feature flag in e.g. a configure script; on clang versions that don't have the flag, test compiling with this flag does work but emits a warning (which -Werror doesn't make into an error either).


Repository:
  rL LLVM

https://reviews.llvm.org/D61894

Files:
  lib/Target/AArch64/AArch64.td
  lib/Target/AArch64/AArch64ISelLowering.cpp
  lib/Target/AArch64/AArch64MachineFunctionInfo.h
  lib/Target/AArch64/AArch64Subtarget.h
  test/CodeGen/AArch64/protect-x18.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61894.199418.patch
Type: text/x-patch
Size: 7776 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190514/6c30c3b1/attachment.bin>


More information about the llvm-commits mailing list