blob: d5d4df55ee45fa87286c9a659b8651411357b58b [file] [log] [blame]
Juergen Ributzkaad2363f2014-10-17 17:39:00 +00001; RUN: llc -mtriple=x86_64-unknown-linux -mcpu=corei7 < %s | FileCheck %s
2
3; Test invoking of patchpoints
4;
5define i64 @patchpoint_invoke(i64 %p1, i64 %p2) {
6entry:
7; CHECK-LABEL: patchpoint_invoke:
8; CHECK-NEXT: .cfi_startproc
9; CHECK: [[FUNC_BEGIN:.L.*]]:
10; CHECK: .cfi_lsda 3, [[EXCEPTION_LABEL:.L[^ ]*]]
11; CHECK: pushq %rbp
12
13; Unfortunately, hardcode the name of the label that begins the patchpoint:
14; CHECK: .Ltmp0:
15; CHECK: movabsq $-559038736, %r11
16; CHECK-NEXT: callq *%r11
17; CHECK-NEXT: xchgw %ax, %ax
18; CHECK-NEXT: [[PP_END:.L.*]]:
19; CHECK: ret
20 %resolveCall = inttoptr i64 -559038736 to i8*
21 %result = invoke i64 (i64, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.i64(i64 2, i32 15, i8* %resolveCall, i32 1, i64 %p1, i64 %p2)
22 to label %success unwind label %threw
23
24success:
25 ret i64 %result
26
27threw:
28 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
29 catch i8* null
30 ret i64 0
31}
32
33; Verify that the exception table was emitted:
34; CHECK: [[EXCEPTION_LABEL]]:
35; CHECK-NEXT: .byte 255
36; CHECK-NEXT: .byte 3
37; CHECK-NEXT: .byte 21
38; CHECK-NEXT: .byte 3
39; CHECK-NEXT: .byte 13
40; Verify that the unwind data covers the entire patchpoint region:
41; CHECK-NEXT: [[RANGE_OFFSET:.L[^ ]*]] = .Ltmp0-[[FUNC_BEGIN]]
42; CHECK-NEXT: .long [[RANGE_OFFSET]]
43; CHECK-NEXT: [[RANGE_LENGTH:.L[^ ]*]] = [[PP_END]]-.Ltmp0
44; CHECK-NEXT: .long [[RANGE_LENGTH]]
45
46
47; Verify that the stackmap section got emitted:
48; CHECK-LABEL: __LLVM_StackMaps:
49; Header
50; CHECK-NEXT: .byte 1
51; CHECK-NEXT: .byte 0
52; CHECK-NEXT: .short 0
53; Num Functions
54; CHECK-NEXT: .long 1
55; Num LargeConstants
56; CHECK-NEXT: .long 0
57; Num Callsites
58; CHECK-NEXT: .long 1
59; CHECK-NEXT: .quad patchpoint_invoke
60
61
62declare void @llvm.experimental.stackmap(i64, i32, ...)
63declare void @llvm.experimental.patchpoint.void(i64, i32, i8*, i32, ...)
64declare i64 @llvm.experimental.patchpoint.i64(i64, i32, i8*, i32, ...)
65declare i32 @__gxx_personality_v0(...)