[PATCH] D13319: Eliminate __llvm_profile_register calls

David Li via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 30 16:52:10 PDT 2015


davidxl created this revision.
davidxl added reviewers: bogner, rsmith.
davidxl added subscribers: cfe-commits, llvm-commits.
Herald added subscribers: srhines, danalbert, tberghammer.

With PGO, the instrumented binary needs to dump __llvm_prf_data, __llvm_prf_cnts, and __llvm_prf_names data sections. The runtime needs to figure out the start and end addresses of the sections. The way it is implemented for Linux is emit function calls during start up time to register the __llvm_profile_data variables created for the functions, and runtime library tracks the start and end.  On Darwin, special section symbol is used so this is avoided.

This is not only inefficient, but also wastes lots of space in text.

This patch proposes using linker script to solve the problem.  The changes in clang FE is basically refactoring. The core changes are in projects/compiler_rt/profile and llvm.

http://reviews.llvm.org/D13319

Files:
  include/clang/Driver/ToolChain.h
  lib/Driver/SanitizerArgs.cpp
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  lib/Transforms/Instrumentation/InstrProfiling.cpp
  lib/profile/CMakeLists.txt
  lib/profile/InstrProfilingPlatformOther.c
  lib/profile/prf_data.x
  test/Instrumentation/InstrProfiling/platform.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13319.36164.patch
Type: text/x-patch
Size: 22280 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150930/256c89eb/attachment-0001.bin>


More information about the cfe-commits mailing list