user2084755
user2084755

Reputation: 169

How to identify internal llvm functions?

I need to make a method that returns only the name of the functions that are internal. In the example below, I hope to return: _GLOBAL__I_a

Example:

define i32 @ main (i32% argc, i8 **% argv) {...
define i32 @ _Z9Factoriali (i32% M) {nounwind ...
define internal void @ _GLOBAL__I_a () section. "text.startup" {...

What is the best way to identify internal functions?

Upvotes: 2

Views: 530

Answers (1)

Oak
Oak

Reputation: 26868

You can check whether a function has internal linkage by invoking Function::hasInternalLinkage() on it. So your method should iterate over all the functions in the module and return the ones for which hasInternalLinkage returns true.

Upvotes: 3

Related Questions