[PATCH] D67568: [LTO][Legacy] Add new C inferface to query libcall functions

Steven Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 16 11:49:28 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL372021: [LTO][Legacy] Add new C inferface to query libcall functions (authored by steven_wu, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D67568?vs=220354&id=220366#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67568

Files:
  llvm/trunk/include/llvm-c/lto.h
  llvm/trunk/include/llvm/LTO/LTO.h
  llvm/trunk/lib/LTO/LTO.cpp
  llvm/trunk/tools/lto/lto.cpp
  llvm/trunk/tools/lto/lto.exports


Index: llvm/trunk/lib/LTO/LTO.cpp
===================================================================
--- llvm/trunk/lib/LTO/LTO.cpp
+++ llvm/trunk/lib/LTO/LTO.cpp
@@ -1011,6 +1011,16 @@
                  std::move(RegularLTO.CombinedModule), ThinLTO.CombinedIndex);
 }
 
+static const char *libcallRoutineNames[] = {
+#define HANDLE_LIBCALL(code, name) name,
+#include "llvm/IR/RuntimeLibcalls.def"
+#undef HANDLE_LIBCALL
+};
+
+ArrayRef<const char*> LTO::getRuntimeLibcallSymbols() {
+  return makeArrayRef(libcallRoutineNames);
+}
+
 /// This class defines the interface to the ThinLTO backend.
 class lto::ThinBackendProc {
 protected:
Index: llvm/trunk/tools/lto/lto.exports
===================================================================
--- llvm/trunk/tools/lto/lto.exports
+++ llvm/trunk/tools/lto/lto.exports
@@ -76,3 +76,4 @@
 lto_input_dispose
 lto_input_get_num_dependent_libraries
 lto_input_get_dependent_library
+lto_runtime_lib_symbols_list
Index: llvm/trunk/tools/lto/lto.cpp
===================================================================
--- llvm/trunk/tools/lto/lto.cpp
+++ llvm/trunk/tools/lto/lto.cpp
@@ -652,3 +652,9 @@
                                                    size_t *size) {
   return LTOModule::getDependentLibrary(unwrap(input), index, size);
 }
+
+extern const char *const *lto_runtime_lib_symbols_list(size_t *size) {
+  auto symbols = lto::LTO::getRuntimeLibcallSymbols();
+  *size = symbols.size();
+  return symbols.data();
+}
Index: llvm/trunk/include/llvm-c/lto.h
===================================================================
--- llvm/trunk/include/llvm-c/lto.h
+++ llvm/trunk/include/llvm-c/lto.h
@@ -44,7 +44,7 @@
  * @{
  */
 
-#define LTO_API_VERSION 24
+#define LTO_API_VERSION 25
 
 /**
  * \since prior to LTO_API_VERSION=3
@@ -593,6 +593,14 @@
                                                     size_t *size);
 
 /**
+ * Returns the list of libcall symbols that can be generated by LTO
+ * that might not be visible from the symbol table of bitcode files.
+ *
+ * \since prior to LTO_API_VERSION=25
+ */
+extern const char *const *lto_runtime_lib_symbols_list(size_t *size);
+
+/**
  * @} // endgoup LLVMCLTO
  * @defgroup LLVMCTLTO ThinLTO
  * @ingroup LLVMC
Index: llvm/trunk/include/llvm/LTO/LTO.h
===================================================================
--- llvm/trunk/include/llvm/LTO/LTO.h
+++ llvm/trunk/include/llvm/LTO/LTO.h
@@ -298,6 +298,10 @@
   /// Cache) for each task identifier.
   Error run(AddStreamFn AddStream, NativeObjectCache Cache = nullptr);
 
+  /// Static method that returns a list of libcall symbols that can be generated
+  /// by LTO but might not be visible from bitcode symbol table.
+  static ArrayRef<const char*> getRuntimeLibcallSymbols();
+
 private:
   Config Conf;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67568.220366.patch
Type: text/x-patch
Size: 2787 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190916/ab145fb6/attachment.bin>


More information about the llvm-commits mailing list