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

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 16:41:26 PDT 2019


dexonsmith added a comment.

In D67568#1670131 <https://reviews.llvm.org/D67568#1670131>, @steven_wu wrote:

> In D67568#1670049 <https://reviews.llvm.org/D67568#1670049>, @kledzik wrote:
>
> > How many symbols are there today?  Do we want this overhead of a function call for each?  Could you instead return a count and array pointer (like argc and argv) or have a "foreach" function that takes a block and calls it back for each symbol?
>
>
> I am just following the old convention. The number of symbols are around 500. `foreach` is not that cheaper because it is one function call per iteration. I am fine with either solution.


Adding an `argv` equivalent seems reasonable to me:

  unsigned int lto_get_num_runtime_lib_symbols(void);
  const char **lto_get_runtime_lib_symbol_names(void);

That locks down the implementation as an array of `const char *` but that's probably fine.



================
Comment at: llvm/include/llvm-c/lto.h:804
+extern unsigned int
+lto_get_num_runtime_lib_symbols();
+
----------------
This is C, so you need `(void)` here to have a prototype.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67568





More information about the llvm-commits mailing list