[PATCH] D105907: [CallGraphSection] Add call graph section options and documentation

Necip Fazil Yildiran via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 17 19:42:17 PDT 2021


necipfazil updated this revision to Diff 359592.
necipfazil added a comment.

Change call graph section layout

- Changed the call graph section layout
- Extended the example
- Updated the documentation

In the previous version, the call graph section layout was optimized for
entries with unique type ids in which to list any indirect calls and targets
with such type id. However, the implementation requirements prevented sharing
information from different functions in the same entry. The main reason is
the need for separate entries per functions to allow dead-stripping.

As the previous layout was suboptimal for per-function call graph section
entries, a new layout is created. Please see the updated documentation for the
new layout.

The new layout has the following advantages:

- The previous layout allowed multiple indirect targets to be listed in a single entry. However, there was no use since each entry was created for a single function. With the new layout, an entry is said to belong to a function, and lists info on the function and its indirect callsites. Consequently, the layout is designed for per-function entry approach.
- The previous layout listed callsites per type id as `(TypeId, CallSitesWithTypeIdCount, [CallSite1WithTypeId, ...])`. However, now that the callsites are listed per function, a small number of callsites are expected for each type id. Therefore, they are now listed as `(TypeId, CallSite)` pairs to avoid wasting space on count values that are usually 1.
- In the previous layout, if a function was not an indirect target, its entry PC was not included. This prevented making the distinction between
  1. the non-indirect target functions and 2) those functions that we had no information about (e.g., functions from linked objects with no call graph section). With the new layout, the function entry PC is always listed. It is marked as non-indirect target if so. For completeness, the user still needs to take any function with missing information as receiver to any indirect calls. However, the user can avoid doing the same for the non-indirect targets as their entry PCs are now listed, which improves the precision for the resulting call graph.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105907/new/

https://reviews.llvm.org/D105907

Files:
  clang/docs/CallGraphSection.rst
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/clang_f_opts.c
  llvm/include/llvm/CodeGen/CommandFlags.h
  llvm/include/llvm/Target/TargetOptions.h
  llvm/lib/CodeGen/CommandFlags.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105907.359592.patch
Type: text/x-patch
Size: 19725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210718/cd724775/attachment.bin>


More information about the llvm-commits mailing list