File: stacksize.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (86 lines) | stat: -rw-r--r-- 4,013 bytes parent folder | download | duplicates (27)
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
80
81
82
83
84
85
86
; For ELFv2 ABI, we can avoid allocating the parameter area in the stack frame of the caller function
; if all the arguments can be passed to the callee in registers.
; For ELFv1 ABI, we always need to allocate the parameter area.

; Tests for ELFv2 ABI
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=PPC64-ELFV2
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=PPC64-ELFV2

; Tests for ELFv1 ABI
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=PPC64-ELFV1
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=PPC64-ELFV1

; If the callee has at most eight integer args, parameter area can be ommited for ELFv2 ABI.

; PPC64-ELFV2-LABEL: WithoutParamArea1:
; PPC64-ELFV2-NOT: stw {{[0-9]+}}, -{{[0-9]+}}(1)
; PPC64-ELFV2: stdu 1, -32(1)
; PPC64-ELFV2: addi 1, 1, 32
; PPC64-ELFV2-NOT: lwz {{[0-9]+}}, -{{[0-9]+}}(1)
; PPC64-ELFV1-LABEL: WithoutParamArea1:
; PPC64-ELFV1-NOT: stw {{[0-9]+}}, -{{[0-9]+}}(1)
; PPC64-ELFV1: stdu 1, -112(1)
; PPC64-ELFV1: addi 1, 1, 112
; PPC64-ELFV1-NOT: lwz {{[0-9]+}}, -{{[0-9]+}}(1)
define signext i32 @WithoutParamArea1(i32 signext %a) local_unnamed_addr #0 {
entry:
  %call = tail call signext i32 @onearg(i32 signext %a) #2
  ret i32 %call
}

; PPC64-ELFV2-LABEL: WithoutParamArea2:
; PPC64-ELFV2-NOT: stw {{[0-9]+}}, -{{[0-9]+}}(1)
; PPC64-ELFV2: stdu 1, -32(1)
; PPC64-ELFV2: addi 1, 1, 32
; PPC64-ELFV2-NOT: lwz {{[0-9]+}}, -{{[0-9]+}}(1)
; PPC64-ELFV1-LABEL: WithoutParamArea2:
; PPC64-ELFV1-NOT: stw {{[0-9]+}}, -{{[0-9]+}}(1)
; PPC64-ELFV1: stdu 1, -112(1)
; PPC64-ELFV1: addi 1, 1, 112
; PPC64-ELFV1-NOT: lwz {{[0-9]+}}, -{{[0-9]+}}(1)
define signext i32 @WithoutParamArea2(i32 signext %a) local_unnamed_addr #0 {
entry:
  %call = tail call signext i32 @eightargs(i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a) #2
  ret i32 %call
}

; If the callee has more than eight integer args or variable number of args, 
; parameter area cannot be ommited even for ELFv2 ABI

; PPC64-ELFV2-LABEL: WithParamArea1:
; PPC64-ELFV2-NOT: stw {{[0-9]+}}, -{{[0-9]+}}(1)
; PPC64-ELFV2: stdu 1, -96(1)
; PPC64-ELFV2: addi 1, 1, 96
; PPC64-ELFV2-NOT: lwz {{[0-9]+}}, -{{[0-9]+}}(1)
; PPC64-ELFV1-LABEL: WithParamArea1:
; PPC64-ELFV1-NOT: stw {{[0-9]+}}, -{{[0-9]+}}(1)
; PPC64-ELFV1: stdu 1, -112(1)
; PPC64-ELFV1: addi 1, 1, 112
; PPC64-ELFV1-NOT: lwz {{[0-9]+}}, -{{[0-9]+}}(1)
define signext i32 @WithParamArea1(i32 signext %a) local_unnamed_addr #0 {
entry:
  %call = tail call signext i32 (i32, ...) @varargs(i32 signext %a, i32 signext %a) #2
  ret i32 %call
}

; PPC64-ELFV2-LABEL: WithParamArea2:
; PPC64-ELFV2-NOT: stw {{[0-9]+}}, -{{[0-9]+}}(1)
; PPC64-ELFV2: stdu 1, -112(1)
; PPC64-ELFV2: addi 1, 1, 112
; PPC64-ELFV2-NOT: lwz {{[0-9]+}}, -{{[0-9]+}}(1)
; PPC64-ELFV1-LABEL: WithParamArea2:
; PPC64-ELFV1-NOT: stw {{[0-9]+}}, -{{[0-9]+}}(1)
; PPC64-ELFV1: stdu 1, -128(1)
; PPC64-ELFV1: addi 1, 1, 128
; PPC64-ELFV1-NOT: lwz {{[0-9]+}}, -{{[0-9]+}}(1)
define signext i32 @WithParamArea2(i32 signext %a) local_unnamed_addr #0 {
entry:
  %call = tail call signext i32 @nineargs(i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a) #2
  ret i32 %call
}

declare signext i32 @onearg(i32 signext) local_unnamed_addr #1
declare signext i32 @eightargs(i32 signext, i32 signext, i32 signext, i32 signext, i32 signext, i32 signext, i32 signext, i32 signext) local_unnamed_addr #1
declare signext i32 @nineargs(i32 signext, i32 signext, i32 signext, i32 signext, i32 signext, i32 signext, i32 signext, i32 signext, i32 signext) local_unnamed_addr #1
declare signext i32 @varargs(i32 signext, ...) local_unnamed_addr #1