1 # RUN: llc -run-pass=aarch64-expand-pseudo -mtriple=arm64-apple-ios -o - -emit-call-site-info %s -verify-machineinstrs | FileCheck %s
4 define void @test_1_callsite_info() {
8 define void @test_bl_pass_x0_arg() {
12 define void @test_bl_pass_x0_x1_x2_args() {
16 define void @test_bl_pass_w0_w1_args() {
20 define void @test_blr_pass_w0_w1_args() {
24 define void @foo(i32 %a) {
28 define void @test_blr_undef_arg_in_x0() {
32 declare ptr @attachedcall()
34 declare ptr @objc_retainAutoreleasedReturnValue()
38 # CHECK-LABEL: : test_1_callsite_info
40 # CHECK-NEXT: liveins:
42 # CHECK-NEXT: BUNDLE implicit-def $lr, implicit-def $w30, implicit-def $sp, implicit-def $wsp, implicit-def dead $x0, implicit-def $fp, implicit-def $w29, implicit $x0, implicit $sp, implicit $xzr, implicit $fp {
43 # CHECK-NEXT: BLR $x0, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $x0
44 # CHECK-NEXT: ORRXrs $xzr, $fp, 0
45 # CHECK-NEXT: BL @attachedcall, implicit-def $lr, implicit internal $sp
47 # CHECK-NEXT: RET undef $lr, implicit killed $w0
49 name: test_1_callsite_info
51 - {bb: 0, offset: 0, fwdArgRegs:
52 - { arg: 0, reg: '$x0' } }
57 BLR_RVMARKER @attachedcall, $x0, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $x0
58 RET_ReallyLR implicit killed $w0
61 # CHECK-LABEL: : test_bl_pass_x0_arg
63 # CHECK-NEXT: liveins:
65 # CHECK-NEXT: BUNDLE implicit-def $lr, implicit-def $w30, implicit-def $sp, implicit-def $wsp, implicit-def dead $x0, implicit-def $fp, implicit-def $w29, implicit $sp, implicit $x0, implicit $xzr, implicit $fp {
66 # CHECK-NEXT: BL @foo, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $x0
67 # CHECK-NEXT: $fp = ORRXrs $xzr, $fp, 0
68 # CHECK-NEXT: BL @attachedcall, implicit-def $lr, implicit internal $sp
70 # CHECK-NEXT: RET undef $lr, implicit killed $w0
72 name: test_bl_pass_x0_arg
77 BLR_RVMARKER @attachedcall, @foo, $x0, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $x0
78 RET_ReallyLR implicit killed $w0
81 # CHECK-LABEL: : test_bl_pass_x0_x1_x2_args
83 # CHECK-NEXT: liveins:
85 # CHECK-NEXT: BUNDLE implicit-def $lr, implicit-def $w30, implicit-def $sp, implicit-def $wsp, implicit-def $x0, implicit-def $w0, implicit-def $fp, implicit-def $w29, implicit $sp, implicit $x0, implicit $x1, implicit $x2, implicit $xzr, implicit $fp {
86 # CHECK-NEXT: BL @foo, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $x0
87 # CHECK-NEXT: $fp = ORRXrs $xzr, $fp, 0
88 # CHECK-NEXT: BL @attachedcall, implicit-def $lr, implicit internal $sp
90 # CHECK-NEXT: RET undef $lr
92 name: test_bl_pass_x0_x1_x2_args
95 liveins: $lr, $x0, $x1, $x2
97 BLR_RVMARKER @attachedcall, @foo, $x0, $x1, $x2, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $x0
101 # CHECK-LABEL: : test_bl_pass_w0_w1_args
103 # CHECK-NEXT: liveins:
105 # CHECK-NEXT: BUNDLE implicit-def $lr, implicit-def $w30, implicit-def $sp, implicit-def $wsp, implicit-def dead $x0, implicit-def $fp, implicit-def $w29, implicit $sp, implicit $w0, implicit $w1, implicit $xzr, implicit $fp {
106 # CHECK-NEXT: BL @foo, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $w0, implicit $w1, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $x0
107 # CHECK-NEXT: $fp = ORRXrs $xzr, $fp, 0
108 # CHECK-NEXT: BL @attachedcall, implicit-def $lr, implicit internal $sp
110 # CHECK-NEXT: RET undef $lr, implicit killed $w0
112 name: test_bl_pass_w0_w1_args
115 liveins: $lr, $w0, $w1
117 BLR_RVMARKER @attachedcall, @foo, $w0, $w1, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $x0
118 RET_ReallyLR implicit killed $w0
122 # CHECK-LABEL: : test_blr_pass_w0_w1_args
124 # CHECK-NEXT: liveins:
126 # CHECK-NEXT: BUNDLE implicit-def $lr, implicit-def $w30, implicit-def $sp, implicit-def $wsp, implicit-def dead $x0, implicit-def $fp, implicit-def $w29, implicit $x8, implicit $sp, implicit $w0, implicit $w1, implicit $xzr, implicit $fp {
127 # CHECK-NEXT: BLR $x8, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $w0, implicit $w1, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $x0
128 # CHECK-NEXT: $fp = ORRXrs $xzr, $fp, 0
129 # CHECK-NEXT: BL @attachedcall, implicit-def $lr, implicit internal $sp
131 # CHECK-NEXT: RET undef $lr, implicit killed $w0
133 name: test_blr_pass_w0_w1_args
136 liveins: $lr, $x8, $w0, $w1
138 BLR_RVMARKER @attachedcall, $x8, $w0, $w1, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $x0
139 RET_ReallyLR implicit killed $w0
142 # Test for https://github.com/llvm/llvm-project/issues/68005.
144 # CHECK-LABEL: : test_blr_undef_arg_in_x0
146 # CHECK-NEXT: liveins:
148 # CHECK-NEXT: BUNDLE implicit-def $lr, implicit-def $w30, implicit-def $sp, implicit-def $wsp, implicit-def dead $x0, implicit-def $fp, implicit-def $w29, implicit $sp, implicit undef $x0, implicit $xzr, implicit $fp {
149 # CHECK-NEXT: BL @foo, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit undef $x0, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $x0
150 # CHECK-NEXT: $fp = ORRXrs $xzr, $fp, 0
151 # CHECK-NEXT: BL @objc_retainAutoreleasedReturnValue, implicit-def $lr, implicit internal $sp
153 # CHECK-NEXT: RET undef $lr
155 name: test_blr_undef_arg_in_x0
156 tracksRegLiveness: true
161 BLR_RVMARKER @objc_retainAutoreleasedReturnValue, @foo, undef $x0, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $x0