File: fastcc.ll

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (79 lines) | stat: -rw-r--r-- 2,237 bytes parent folder | download | duplicates (12)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
; RUN: opt < %s -passes=globalopt -S | FileCheck %s

declare token @llvm.call.preallocated.setup(i32)
declare ptr @llvm.call.preallocated.arg(token, i32)

define internal i32 @f(ptr %m) {
; CHECK-LABEL: define internal fastcc i32 @f
  %v = load i32, ptr %m
  ret i32 %v
}

define internal x86_thiscallcc i32 @g(ptr %m) {
; CHECK-LABEL: define internal fastcc i32 @g
  %v = load i32, ptr %m
  ret i32 %v
}

; Leave this one alone, because the user went out of their way to request this
; convention.
define internal coldcc i32 @h(ptr %m) {
; CHECK-LABEL: define internal coldcc i32 @h
  %v = load i32, ptr %m
  ret i32 %v
}

define internal i32 @j(ptr %m) {
; CHECK-LABEL: define internal i32 @j
  %v = load i32, ptr %m
  ret i32 %v
}

define internal i32 @inalloca(ptr inalloca(i32) %p) {
; CHECK-LABEL: define internal fastcc i32 @inalloca(ptr %p)
  %rv = load i32, ptr %p
  ret i32 %rv
}

define i32 @inalloca2_caller(ptr inalloca(i32) %p) {
  %rv = musttail call i32 @inalloca2(ptr inalloca(i32) %p)
  ret i32 %rv
}
define internal i32 @inalloca2(ptr inalloca(i32) %p) {
; Because of the musttail caller, this inalloca cannot be dropped.
; CHECK-LABEL: define internal i32 @inalloca2(ptr inalloca(i32) %p)
  %rv = load i32, ptr %p
  ret i32 %rv
}

define internal i32 @preallocated(ptr preallocated(i32) %p) {
; CHECK-LABEL: define internal fastcc i32 @preallocated(ptr %p)
  %rv = load i32, ptr %p
  ret i32 %rv
}

define void @call_things() {
  %m = alloca i32
  call i32 @f(ptr %m)
  call x86_thiscallcc i32 @g(ptr %m)
  call coldcc i32 @h(ptr %m)
  call i32 @j(ptr %m)
  %args = alloca inalloca i32
  call i32 @inalloca(ptr inalloca(i32) %args)
  %c = call token @llvm.call.preallocated.setup(i32 1)
  %N = call ptr @llvm.call.preallocated.arg(token %c, i32 0) preallocated(i32)
  call i32 @preallocated(ptr preallocated(i32) %N) ["preallocated"(token %c)]
  ret void
}
; CHECK-LABEL: define void @call_things()
; CHECK: call fastcc i32 @f
; CHECK: call fastcc i32 @g
; CHECK: call coldcc i32 @h
; CHECK: call i32 @j
; CHECK: call fastcc i32 @inalloca(ptr %args)
; CHECK-NOT: llvm.call.preallocated
; CHECK: call fastcc i32 @preallocated(ptr %paarg)

@llvm.used = appending global [1 x ptr] [
   ptr @j
], section "llvm.metadata"