[PATCH] D53998: [COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry

Mandeep Singh Grang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 2 11:24:38 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL346024: [COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry (authored by mgrang, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D53998?vs=172238&id=172404#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D53998

Files:
  cfe/trunk/lib/CodeGen/CGBuiltin.cpp
  cfe/trunk/test/CodeGen/ms-setjmp.c


Index: cfe/trunk/test/CodeGen/ms-setjmp.c
===================================================================
--- cfe/trunk/test/CodeGen/ms-setjmp.c
+++ cfe/trunk/test/CodeGen/ms-setjmp.c
@@ -25,7 +25,7 @@
   // X64-NEXT:  ret i32 %[[call]]
 
   // AARCH64-LABEL: define dso_local i32 @test_setjmp
-  // AARCH64:       %[[addr:.*]] = call i8* @llvm.frameaddress(i32 0)
+  // AARCH64:       %[[addr:.*]] = call i8* @llvm.sponentry()
   // AARCH64:       %[[call:.*]] = call i32 @_setjmpex(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @jb, i32 0, i32 0), i8* %[[addr]])
   // AARCH64-NEXT:  ret i32 %[[call]]
 }
@@ -38,7 +38,7 @@
   // X64-NEXT:  ret i32 %[[call]]
 
   // AARCH64-LABEL: define dso_local i32 @test_setjmpex
-  // AARCH64:       %[[addr:.*]] = call i8* @llvm.frameaddress(i32 0)
+  // AARCH64:       %[[addr:.*]] = call i8* @llvm.sponentry()
   // AARCH64:       %[[call:.*]] = call i32 @_setjmpex(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @jb, i32 0, i32 0), i8* %[[addr]])
   // AARCH64-NEXT:  ret i32 %[[call]]
 }
Index: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp
@@ -711,8 +711,11 @@
   } else {
     Name = SJKind == MSVCSetJmpKind::_setjmp ? "_setjmp" : "_setjmpex";
     Arg1Ty = CGF.Int8PtrTy;
-    Arg1 = CGF.Builder.CreateCall(CGF.CGM.getIntrinsic(Intrinsic::frameaddress),
-                                  llvm::ConstantInt::get(CGF.Int32Ty, 0));
+    if (CGF.getTarget().getTriple().getArch() == llvm::Triple::aarch64) {
+      Arg1 = CGF.Builder.CreateCall(CGF.CGM.getIntrinsic(Intrinsic::sponentry));
+    } else
+      Arg1 = CGF.Builder.CreateCall(CGF.CGM.getIntrinsic(Intrinsic::frameaddress),
+                                    llvm::ConstantInt::get(CGF.Int32Ty, 0));
   }
 
   // Mark the call site and declaration with ReturnsTwice.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53998.172404.patch
Type: text/x-patch
Size: 1922 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181102/eb2e8ff8/attachment.bin>


More information about the cfe-commits mailing list