summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/SystemZ
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2018-03-02 20:38:41 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2018-03-02 20:38:41 +0000
commit32063888700f57bf57ede4f24efb727fd3f284c5 (patch)
tree9dd67ed03061f0555db86ba467a1b715c4608221 /llvm/test/CodeGen/SystemZ
parent18f6930fef2d76a9dc62409213eba9d851f1b350 (diff)
downloadbcm5719-llvm-32063888700f57bf57ede4f24efb727fd3f284c5.tar.gz
bcm5719-llvm-32063888700f57bf57ede4f24efb727fd3f284c5.zip
[SystemZ] Fix common-code users of stack size
On SystemZ we need to provide a register save area of 160 bytes to any called function. This size needs to be added when allocating stack in the function prologue. However, it was not accounted for as part of MachineFrameInfo::getStackSize(); instead the back-end used a private routine getAllocatedStackSize(). This is OK for code-gen purposes, but it breaks other users of the getStackSize() routine, in particular it breaks the recently- added -stack-size-section feature. Fix this by updating the main stack size tracked by common code (in emitPrologue) instead of using the private routine. No change in code generation intended. llvm-svn: 326610
Diffstat (limited to 'llvm/test/CodeGen/SystemZ')
-rw-r--r--llvm/test/CodeGen/SystemZ/stack-size-section.ll38
1 files changed, 38 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/SystemZ/stack-size-section.ll b/llvm/test/CodeGen/SystemZ/stack-size-section.ll
new file mode 100644
index 00000000000..52dffc80308
--- /dev/null
+++ b/llvm/test/CodeGen/SystemZ/stack-size-section.ll
@@ -0,0 +1,38 @@
+; RUN: llc < %s -mtriple=s390x-linux-gnu -stack-size-section | FileCheck %s
+
+; CHECK-LABEL: func1:
+; CHECK: .section .stack_sizes,"",@progbits
+; CHECK-NEXT: .quad func1
+; CHECK-NEXT: .byte 0
+define void @func1(i32, i32) #0 {
+ ret void
+}
+
+; CHECK-LABEL: func2:
+; CHECK: .section .stack_sizes,"",@progbits
+; CHECK-NEXT: .quad func2
+; CHECK-NEXT: .ascii "\250\001"
+define void @func2(i32, i32) #0 {
+ alloca i32, align 4
+ alloca i32, align 4
+ ret void
+}
+
+; CHECK-LABEL: func3:
+; CHECK: .section .stack_sizes,"",@progbits
+; CHECK-NEXT: .quad func3
+; CHECK-NEXT: .ascii "\250\001"
+define void @func3() #0 {
+ alloca i32, align 4
+ call void @func1(i32 1, i32 2)
+ ret void
+}
+
+; CHECK-LABEL: dynalloc:
+; CHECK-NOT: .section .stack_sizes
+define void @dynalloc(i32 %N) #0 {
+ alloca i32, i32 %N
+ ret void
+}
+
+attributes #0 = { "no-frame-pointer-elim"="true" }
OpenPOWER on IntegriCloud