[PATCH] D53541: [COFF, ARM64] Add aarch64_seh_recoverfp intrinsic

Mandeep Singh Grang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 22 17:40:44 PDT 2018


mgrang created this revision.
mgrang added reviewers: rnk, compnerd, mstorsjo, TomTan, efriedma.
Herald added subscribers: chrib, kristof.beyls, javed.absar.

This patch mimics X86 behavior and add aarch64_seh_recoverfp similar to x86_seh_recoverfp.
This patch is needed by https://reviews.llvm.org/D53540.


Repository:
  rC Clang

https://reviews.llvm.org/D53541

Files:
  lib/CodeGen/CGException.cpp
  test/CodeGen/exceptions-seh.c


Index: test/CodeGen/exceptions-seh.c
===================================================================
--- test/CodeGen/exceptions-seh.c
+++ test/CodeGen/exceptions-seh.c
@@ -99,7 +99,7 @@
 // X64: call i8* @llvm.localrecover(i8* bitcast (i32 ()* @filter_expr_capture to i8*), i8* %[[fp]], i32 0)
 //
 // ARM64-LABEL: define internal i32 @"?filt$0 at 0@filter_expr_capture@@"(i8* %exception_pointers, i8* %frame_pointer)
-// ARM64: %[[fp:[^ ]*]] = call i8* @llvm.x86.seh.recoverfp(i8* bitcast (i32 ()* @filter_expr_capture to i8*), i8* %frame_pointer)
+// ARM64: %[[fp:[^ ]*]] = call i8* @llvm.aarch64.seh.recoverfp(i8* bitcast (i32 ()* @filter_expr_capture to i8*), i8* %frame_pointer)
 // ARM64: call i8* @llvm.localrecover(i8* bitcast (i32 ()* @filter_expr_capture to i8*), i8* %[[fp]], i32 0)
 //
 // X86-LABEL: define internal i32 @"?filt$0 at 0@filter_expr_capture@@"()
Index: lib/CodeGen/CGException.cpp
===================================================================
--- lib/CodeGen/CGException.cpp
+++ lib/CodeGen/CGException.cpp
@@ -1777,6 +1777,8 @@
     // frame pointer of the parent function. We only need to do this in filters,
     // since finally funclets recover the parent FP for us.
     llvm::Function *RecoverFPIntrin =
+        CGM.getTarget().getTriple().getArch() == llvm::Triple::aarch64 ?
+        CGM.getIntrinsic(llvm::Intrinsic::aarch64_seh_recoverfp) :
         CGM.getIntrinsic(llvm::Intrinsic::x86_seh_recoverfp);
     llvm::Constant *ParentI8Fn =
         llvm::ConstantExpr::getBitCast(ParentCGF.CurFn, Int8PtrTy);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53541.170539.patch
Type: text/x-patch
Size: 1551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181023/2e2196de/attachment.bin>


More information about the cfe-commits mailing list