File: win64-byval.ll

package info (click to toggle)
llvm-toolchain-9 1%3A9.0.1-16
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 882,436 kB
  • sloc: cpp: 4,167,636; ansic: 714,256; asm: 457,610; python: 155,927; objc: 65,094; sh: 42,856; lisp: 26,908; perl: 7,786; pascal: 7,722; makefile: 6,881; ml: 5,581; awk: 3,648; cs: 2,027; xml: 888; javascript: 381; ruby: 156
file content (34 lines) | stat: -rw-r--r-- 1,054 bytes parent folder | download | duplicates (2)
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
; RUN: llc -mtriple x86_64-w64-mingw32 %s -o - | FileCheck %s

declare void @foo({ float, double }* byval)
@G = external constant { float, double }

define void @bar()
{
; Make sure we're creating a temporary stack slot, rather than just passing
; the pointer through unmodified.
; CHECK-LABEL: @bar
; CHECK: movq    .refptr.G(%rip), %rax
; CHECK: movq    (%rax), %rcx
; CHECK: movq    8(%rax), %rax
; CHECK: movq    %rax, 40(%rsp)
; CHECK: movq    %rcx, 32(%rsp)
; CHECK: leaq    32(%rsp), %rcx
    call void @foo({ float, double }* byval @G)
    ret void
}

define void @baz({ float, double }* byval %arg)
{
; On Win64 the byval is effectively ignored on declarations, since we do
; pass a real pointer in registers. However, by our semantics if we pass
; the pointer on to another byval function, we do need to make a copy.
; CHECK-LABEL: @baz
; CHECK: movq	(%rcx), %rax
; CHECK: movq	8(%rcx), %rcx
; CHECK: movq	%rcx, 40(%rsp)
; CHECK: movq	%rax, 32(%rsp)
; CHECK: leaq	32(%rsp), %rcx
    call void @foo({ float, double }* byval %arg)
    ret void
}