[PATCH] D50016: IR: Add entry/exit instrumentation symbols to the libcall list.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 30 14:55:19 PDT 2018


pcc created this revision.
pcc added a reviewer: tejohnson.
Herald added subscribers: dexonsmith, hiraditya, mehdi_amini.

This is necessary in order for these symbols to be handled correctly
during LTO.


Repository:
  rL LLVM

https://reviews.llvm.org/D50016

Files:
  llvm/include/llvm/IR/RuntimeLibcalls.def
  llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp


Index: llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
===================================================================
--- llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
+++ llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
@@ -20,6 +20,9 @@
 
 static void insertCall(Function &CurFn, StringRef Func,
                        Instruction *InsertionPt, DebugLoc DL) {
+  // If you add code to recognize a new instrumentation function here, the
+  // function also needs to be added to include/llvm/IR/RuntimeLibcalls.def
+  // so that it is handled correctly by LTO.
   Module &M = *InsertionPt->getParent()->getParent()->getParent();
   LLVMContext &C = InsertionPt->getParent()->getContext();
 
Index: llvm/include/llvm/IR/RuntimeLibcalls.def
===================================================================
--- llvm/include/llvm/IR/RuntimeLibcalls.def
+++ llvm/include/llvm/IR/RuntimeLibcalls.def
@@ -522,6 +522,18 @@
 // Deoptimization
 HANDLE_LIBCALL(DEOPTIMIZE, "__llvm_deoptimize")
 
+// Entry/exit instrumentation (lib/Transforms/Utils/EntryExitInstrumenter.cpp).
+HANDLE_LIBCALL(ENTRYEXIT1, "mcount")
+HANDLE_LIBCALL(ENTRYEXIT2, ".mcount")
+HANDLE_LIBCALL(ENTRYEXIT3, "\01__gnu_mcount_nc")
+HANDLE_LIBCALL(ENTRYEXIT4, "\01_mcount")
+HANDLE_LIBCALL(ENTRYEXIT5, "\01mcount")
+HANDLE_LIBCALL(ENTRYEXIT6, "__mcount")
+HANDLE_LIBCALL(ENTRYEXIT7, "_mcount")
+HANDLE_LIBCALL(ENTRYEXIT8, "__cyg_profile_func_enter_bare")
+HANDLE_LIBCALL(ENTRYEXIT9, "__cyg_profile_func_enter")
+HANDLE_LIBCALL(ENTRYEXIT10, "__cyg_profile_func_exit")
+
 HANDLE_LIBCALL(UNKNOWN_LIBCALL, nullptr)
 
 #undef HANDLE_LIBCALL


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50016.158089.patch
Type: text/x-patch
Size: 1619 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180730/2c3966e0/attachment.bin>


More information about the llvm-commits mailing list