[all-commits] [llvm/llvm-project] c9b36a: Support GCC's -fstack-usage flag

pzhengqc via All-commits all-commits at lists.llvm.org
Sat May 15 10:23:17 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c9b36a041fd70de0617ea7e241f520b345e12cac
      https://github.com/llvm/llvm-project/commit/c9b36a041fd70de0617ea7e241f520b345e12cac
  Author: Pengxuan Zheng <pzheng at quicinc.com>
  Date:   2021-05-15 (Sat, 15 May 2021)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/CodeGenOptions.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/CodeGen/BackendUtil.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    A clang/test/CodeGen/stack-usage.c
    A clang/test/Driver/stack-usage.c
    M llvm/include/llvm/CodeGen/AsmPrinter.h
    M llvm/include/llvm/Target/TargetOptions.h
    M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

  Log Message:
  -----------
  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




More information about the All-commits mailing list