diff options
author | Pengxuan Zheng <pzheng@quicinc.com> | 2021-04-14 13:54:47 -0700 |
---|---|---|
committer | Pengxuan Zheng <pzheng@quicinc.com> | 2021-05-15 10:22:49 -0700 |
commit | c9b36a041fd70de0617ea7e241f520b345e12cac (patch) | |
tree | d02aca40fc1be96306414e90a24dac344fcb8a04 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | c012a388a15b34c39b53cbfff1b175ac03206dfa (diff) | |
download | llvm-c9b36a041fd70de0617ea7e241f520b345e12cac.zip llvm-c9b36a041fd70de0617ea7e241f520b345e12cac.tar.gz llvm-c9b36a041fd70de0617ea7e241f520b345e12cac.tar.bz2 |
Support GCC's -fstack-usage flag
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
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index e8e0e2d..9cb859f 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1931,6 +1931,9 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, if (UsingSampleProfile) NeedLocTracking = true; + if (!Opts.StackUsageOutput.empty()) + NeedLocTracking = true; + // If the user requested a flag that requires source locations available in // the backend, make sure that the backend tracks source location information. if (NeedLocTracking && Opts.getDebugInfo() == codegenoptions::NoDebugInfo) |