r345808 - [COFF, ARM64] Implement llvm.addressofreturnaddress intrinsic
Mandeep Singh Grang via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 31 18:35:35 PDT 2018
Author: mgrang
Date: Wed Oct 31 18:35:34 2018
New Revision: 345808
URL: http://llvm.org/viewvc/llvm-project?rev=345808&view=rev
Log:
[COFF, ARM64] Implement llvm.addressofreturnaddress intrinsic
Modified:
cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/ms-intrinsics.c
Modified: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAArch64.def?rev=345808&r1=345807&r2=345808&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsAArch64.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsAArch64.def Wed Oct 31 18:35:34 2018
@@ -121,6 +121,7 @@ TARGET_HEADER_BUILTIN(_ReadWriteBarrier,
TARGET_HEADER_BUILTIN(__getReg, "ULLii", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_ReadStatusReg, "ii", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_WriteStatusReg, "vii", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_AddressOfReturnAddress, "v*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
#undef BUILTIN
#undef LANGBUILTIN
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=345808&r1=345807&r2=345808&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Wed Oct 31 18:35:34 2018
@@ -6770,6 +6770,11 @@ Value *CodeGenFunction::EmitAArch64Built
return Builder.CreateCall(F, { Metadata, ArgValue });
}
+ if (BuiltinID == AArch64::BI_AddressOfReturnAddress) {
+ llvm::Value *F = CGM.getIntrinsic(Intrinsic::addressofreturnaddress);
+ return Builder.CreateCall(F);
+ }
+
// Find out if any arguments are required to be integer constant
// expressions.
unsigned ICEArguments = 0;
Modified: cfe/trunk/test/CodeGen/ms-intrinsics.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-intrinsics.c?rev=345808&r1=345807&r2=345808&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/ms-intrinsics.c (original)
+++ cfe/trunk/test/CodeGen/ms-intrinsics.c Wed Oct 31 18:35:34 2018
@@ -137,7 +137,7 @@ void *test_ReturnAddress() {
// CHECK: = tail call i8* @llvm.returnaddress(i32 0)
// CHECK: ret i8*
-#if defined(__i386__) || defined(__x86_64__)
+#if defined(__i386__) || defined(__x86_64__) || defined (__aarch64__)
void *test_AddressOfReturnAddress() {
return _AddressOfReturnAddress();
}
More information about the cfe-commits
mailing list