mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 03:29:57 +00:00
c9b36a041f
This patch adds support for GCC's -fstack-usage flag. With this flag, a stack usage file (i.e., .su file) is generated for each input source file. The format of the stack usage file is also similar to what is used by GCC. For each function defined in the source file, a line with the following information is produced in the .su file. <source_file>:<line_number>:<function_name> <size_in_byte> <static/dynamic> "Static" means that the function's frame size is static and the size info is an accurate reflection of the frame size. While "dynamic" means the function's frame size can only be determined at run-time because the function manipulates the stack dynamically (e.g., due to variable size objects). The size info only reflects the size of the fixed size frame objects in this case and therefore is not a reliable measure of the total frame size. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D100509
20 lines
403 B
C
20 lines
403 B
C
// REQUIRES: aarch64-registered-target
|
|
|
|
// RUN: rm -rf %t && mkdir %t && cd %t
|
|
// RUN: %clang_cc1 -triple aarch64-unknown -stack-usage-file b.su -emit-obj %s -o b.o
|
|
// RUN: FileCheck %s < b.su
|
|
|
|
// CHECK: stack-usage.c:[[#@LINE+1]]:foo {{[0-9]+}} static
|
|
int foo() {
|
|
char a[8];
|
|
|
|
return 0;
|
|
}
|
|
|
|
// CHECK: stack-usage.c:[[#@LINE+1]]:bar {{[0-9]+}} dynamic
|
|
int bar(int len) {
|
|
char a[len];
|
|
|
|
return 1;
|
|
}
|