1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/CodeGen/AArch64/shadow-call-stack.ll
Francis Visoiu Mistrih 61294491c1 [AArch64] Provide Darwin variants of most calling conventions
With the new SVE stack layout, we now need to provide a Darwin variant
for all the calling conventions based on the main AAPCS CSR save order.

This also changes APCS_SwiftError to have a Darwin and a non-Darwin
version, assuming it could be used on other platforms these days, and
restricts the AArch64_CXX_TLS calling convention to Darwin.

Differential Revision: https://reviews.llvm.org/D73805
2020-05-20 16:03:48 -07:00

61 lines
1.3 KiB
LLVM

; RUN: llc -verify-machineinstrs -o - %s -mtriple=aarch64-linux-gnu -mattr=+reserve-x18 | FileCheck %s
; RUN: not --crash llc -verify-machineinstrs -o - %s -mtriple=arm64-apple-darwin 2>&1 | FileCheck %s --check-prefix=DARWIN
; DARWIN: ShadowCallStack attribute not supported on Darwin.
define void @f1() shadowcallstack {
; CHECK: f1:
; CHECK-NOT: x18
; CHECK: ret
ret void
}
declare void @foo()
define void @f2() shadowcallstack {
; CHECK: f2:
; CHECK-NOT: x18
; CHECK: b foo
tail call void @foo()
ret void
}
declare i32 @bar()
define i32 @f3() shadowcallstack {
; CHECK: f3:
; CHECK: str x30, [x18], #8
; CHECK: .cfi_escape 0x16, 0x12, 0x02, 0x82, 0x78
; CHECK: str x30, [sp, #-16]!
%res = call i32 @bar()
%res1 = add i32 %res, 1
; CHECK: ldr x30, [sp], #16
; CHECK: ldr x30, [x18, #-8]!
; CHECK: ret
ret i32 %res
}
define i32 @f4() shadowcallstack {
; CHECK: f4:
%res1 = call i32 @bar()
%res2 = call i32 @bar()
%res3 = call i32 @bar()
%res4 = call i32 @bar()
%res12 = add i32 %res1, %res2
%res34 = add i32 %res3, %res4
%res1234 = add i32 %res12, %res34
; CHECK: ldp x30,{{.*}}, [sp
; CHECK: ldr x30, [x18, #-8]!
; CHECK: ret
ret i32 %res1234
}
define i32 @f5() shadowcallstack nounwind {
; CHECK: f5:
; CHECK-NOT: .cfi_escape
%res = call i32 @bar()
%res1 = add i32 %res, 1
ret i32 %res
}