[patch] Respect llvm.used in Internalize

Sean Silva silvas at purdue.edu
Fri Jul 19 12:52:15 PDT 2013


+ at llvm.compiler_used = appending global [1 x void ()*] [void ()* @g],
section "llvm.metadata"

@llvm.compiler.used?

+GlobalVariable *
+llvm::collectUsedGlobalVariables(const Module &M, const char *Name,
+                                 SmallPtrSet<GlobalValue *, 8> &Set) {

(for a future patch). The return value seems kind of arbitrary; it seems to
be just to save a name lookup in the module. Maybe this function should
take a GlobalVariable * instead of a name? and leave it to the client to
extract the GlobalVariable* from the module? You could also then remove the
`const Module &M` parameter. Also, the function does something pretty
specific, so maybe it should have a more specific-sounding name.

-- Sean Silva


On Fri, Jul 19, 2013 at 12:09 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> The language reference says that:
>
> "If a symbol appears in the @llvm.used list, then the compiler,
> assembler, and linker are required to treat the symbol as if there is
> a reference to the symbol that it cannot see"
>
> Since even the linker cannot see the reference, we must assume that
> the reference can be using the symbol table. For example, a debug
> helper function like dump might be referenced from a debugger.
>
> The attached patch makes internalize respect llvm.used.
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130719/c86227a0/attachment.html>


More information about the llvm-commits mailing list