[llvm] r348337 - AArch64: support funclets in fastcall and swift_call

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 4 23:09:20 PST 2018


Author: compnerd
Date: Tue Dec  4 23:09:20 2018
New Revision: 348337

URL: http://llvm.org/viewvc/llvm-project?rev=348337&view=rev
Log:
AArch64: support funclets in fastcall and swift_call

Functions annotated with `__fastcall` or `__attribute__((__fastcall__))`
or `__attribute__((__swiftcall__))` may contain SEH handlers even on
Win64.  This matches the behaviour of cl which allows for
`__try`/`__except` inside a `__fastcall` function.  This was detected
while trying to self-host clang on Windows ARM64.

Added:
    llvm/trunk/test/CodeGen/AArch64/windows-SEH-support.ll
Modified:
    llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h

Modified: llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h?rev=348337&r1=348336&r2=348337&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h Tue Dec  4 23:09:20 2018
@@ -385,6 +385,8 @@ public:
   bool isCallingConvWin64(CallingConv::ID CC) const {
     switch (CC) {
     case CallingConv::C:
+    case CallingConv::Fast:
+    case CallingConv::Swift:
       return isTargetWindows();
     case CallingConv::Win64:
       return true;

Added: llvm/trunk/test/CodeGen/AArch64/windows-SEH-support.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/windows-SEH-support.ll?rev=348337&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/windows-SEH-support.ll (added)
+++ llvm/trunk/test/CodeGen/AArch64/windows-SEH-support.ll Tue Dec  4 23:09:20 2018
@@ -0,0 +1,36 @@
+; RUN: llc -mtriple aarch64-unknown-windows-msvc -filetype asm -o /dev/null %s
+
+declare dllimport void @f() local_unnamed_addr
+
+declare dso_local i32 @__C_specific_handler(...)
+
+define hidden swiftcc void @g() unnamed_addr personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
+entry:
+  invoke void @f() to label %__try.cont unwind label %catch.dispatch
+
+catch.dispatch:                                   ; preds = %entry
+  %0 = catchswitch within none [label %__except] unwind to caller
+
+__except:
+  %1 = catchpad within %0 [i8* null]              ; preds = %catch.dispatch
+  catchret from %1 to label %__try.cont
+
+__try.cont:                                       ; preds = %__except, %entry
+  ret void
+}
+
+define hidden fastcc void @h() unnamed_addr personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
+entry:
+  invoke void @f() to label %__try.cont unwind label %catch.dispatch
+
+catch.dispatch:                                   ; preds = %entry
+  %0 = catchswitch within none [label %__except] unwind to caller
+
+__except:                                         ; preds = %catch.dispatch
+  %1 = catchpad within %0 [i8* null]
+  catchret from %1 to label %__try.cont
+
+__try.cont:                                       ; preds = %__except, %entry
+  ret void
+}
+




More information about the llvm-commits mailing list