summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorSean Eveson <eveson.sean@gmail.com>2018-01-17 09:01:29 +0000
committerSean Eveson <eveson.sean@gmail.com>2018-01-17 09:01:29 +0000
commit2ae6037dd150893c6f54a67dcc4664003306ea8c (patch)
treec4e66ef713be34c62f034ef0d267dd77ef3dc53e /llvm
parent1913115204027ad779949094c454d704462e77d0 (diff)
downloadbcm5719-llvm-2ae6037dd150893c6f54a67dcc4664003306ea8c.tar.gz
bcm5719-llvm-2ae6037dd150893c6f54a67dcc4664003306ea8c.zip
[MC] Fix -stack-size-section on ARM
Change symbol values in the stack_size section from being 8 bytes, to being a target dependent size. Differential Revision: https://reviews.llvm.org/D42108 llvm-svn: 322619
Diffstat (limited to 'llvm')
-rw-r--r--llvm/docs/CodeGenerator.rst2
-rw-r--r--llvm/docs/CommandGuide/llc.rst2
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp3
-rw-r--r--llvm/test/CodeGen/ARM/stack-size-section.ll30
4 files changed, 33 insertions, 4 deletions
diff --git a/llvm/docs/CodeGenerator.rst b/llvm/docs/CodeGenerator.rst
index 5c0fb064959..7329f3d1fe6 100644
--- a/llvm/docs/CodeGenerator.rst
+++ b/llvm/docs/CodeGenerator.rst
@@ -1584,7 +1584,7 @@ Emitting function stack size information
A section containing metadata on function stack sizes will be emitted when
``TargetLoweringObjectFile::StackSizesSection`` is not null, and
``TargetOptions::EmitStackSizeSection`` is set (-stack-size-section). The
-section will contain an array of pairs of function symbol references (8 byte)
+section will contain an array of pairs of function symbol values (pointer size)
and stack sizes (unsigned LEB128). The stack size values only include the space
allocated in the function prologue. Functions with dynamic stack allocations are
not included.
diff --git a/llvm/docs/CommandGuide/llc.rst b/llvm/docs/CommandGuide/llc.rst
index 95945e68d13..11dfc902d20 100644
--- a/llvm/docs/CommandGuide/llc.rst
+++ b/llvm/docs/CommandGuide/llc.rst
@@ -135,7 +135,7 @@ End-user Options
.. option:: -stack-size-section
Emit the .stack_sizes section which contains stack size metadata. The section
- contains an array of pairs of function symbol references (8 byte) and stack
+ contains an array of pairs of function symbol values (pointer size) and stack
sizes (unsigned LEB128). The stack size values only include the space allocated
in the function prologue. Functions with dynamic stack allocations are not
included.
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 7ffb5ddc2d6..cafe489daad 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -976,8 +976,7 @@ void AsmPrinter::emitStackSizeSection(const MachineFunction &MF) {
const MCSymbol *FunctionSymbol = getSymbol(&MF.getFunction());
uint64_t StackSize = FrameInfo.getStackSize();
- OutStreamer->EmitValue(MCSymbolRefExpr::create(FunctionSymbol, OutContext),
- /* size = */ 8);
+ OutStreamer->EmitSymbolValue(FunctionSymbol, TM.getPointerSize());
OutStreamer->EmitULEB128IntValue(StackSize);
OutStreamer->PopSection();
diff --git a/llvm/test/CodeGen/ARM/stack-size-section.ll b/llvm/test/CodeGen/ARM/stack-size-section.ll
new file mode 100644
index 00000000000..851433468b1
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/stack-size-section.ll
@@ -0,0 +1,30 @@
+; RUN: llc < %s -mtriple=armv7-linux -stack-size-section | FileCheck %s
+
+; CHECK-LABEL: func1:
+; CHECK: .section .stack_sizes,"",%progbits
+; CHECK-NEXT: .long func1
+; CHECK-NEXT: .byte 8
+define void @func1(i32, i32) #0 {
+ alloca i32, align 4
+ alloca i32, align 4
+ ret void
+}
+
+; CHECK-LABEL: func2:
+; CHECK: .section .stack_sizes,"",%progbits
+; CHECK-NEXT: .long func2
+; CHECK-NEXT: .byte 16
+define void @func2() #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