File: tailccbyval64.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (42 lines) | stat: -rw-r--r-- 1,497 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux | FileCheck %s

; FIXME: Win64 does not support byval.

; Expect the entry point.
; CHECK-LABEL: tailcaller:

; Expect 2 rep;movs because of tail call byval lowering.
; CHECK: rep;
; CHECK: rep;

; A sequence of copyto/copyfrom virtual registers is used to deal with byval
; lowering appearing after moving arguments to registers. The following two
; checks verify that the register allocator changes those sequences to direct
; moves to argument register where it can (for registers that are not used in
; byval lowering - not rsi, not rdi, not rcx).
; Expect argument 4 to be moved directly to register edx.
; CHECK: movl $7, %edx

; Expect argument 6 to be moved directly to register r8.
; CHECK: movl $17, %r8d

; Expect not call but jmp to @tailcallee.
; CHECK: jmp tailcallee

; Expect the trailer.
; CHECK: .size tailcaller

%struct.s = type { i64, i64, i64, i64, i64, i64, i64, i64,
                   i64, i64, i64, i64, i64, i64, i64, i64,
                   i64, i64, i64, i64, i64, i64, i64, i64 }

declare  tailcc i64 @tailcallee(ptr byval(%struct.s) %a, i64 %val, i64 %val2, i64 %val3, i64 %val4, i64 %val5)


define  tailcc i64 @tailcaller(i64 %b, ptr byval(%struct.s) %a) {
entry:
        %tmp2 = getelementptr %struct.s, ptr %a, i32 0, i32 1
        %tmp3 = load i64, ptr %tmp2, align 8
        %tmp4 = tail call tailcc i64 @tailcallee(ptr byval(%struct.s) %a , i64 %tmp3, i64 %b, i64 7, i64 13, i64 17)
        ret i64 %tmp4
}