-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re applying after fixing issues in the diff, sorry for any painful conflicts/merges! Original RFC: http://lists.llvm.org/pipermail/llvm-dev/2017-August/117028.html This change adds a '.stack-size' section containing metadata on function stack sizes to output ELF files behind the new -stack-size-section flag. The section contains pairs of function symbol references (8 byte) and stack sizes (unsigned LEB128). The contents of this section can be used to measure changes to stack sizes between different versions of the compiler or a source base. The advantage of having a section is that we can extract this information when examining binaries that we didn't build, and it allows users and tools easy access to that information just by referencing the binary. There is a follow up change to add an option to clang. Thanks. Reviewers: hfinkel, MatzeB Reviewed By: MatzeB Subscribers: thegameg, asb, llvm-commits Differential Revision: https://reviews.llvm.org/D39788 llvm-svn: 319430
- Loading branch information
1 parent
661e4fb
commit a6bcd53
Showing
9 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| ; RUN: llc < %s -mtriple=x86_64-linux -stack-size-section | FileCheck %s | ||
|
|
||
| ; CHECK-LABEL: func1: | ||
| ; CHECK: .section .stack_sizes,"",@progbits | ||
| ; CHECK-NEXT: .quad 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: .quad func2 | ||
| ; CHECK-NEXT: .byte 24 | ||
| 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" } |