tra added a comment.

In D106315#2899928 <https://reviews.llvm.org/D106315#2899928>, @yaxunl wrote:

> Yes that's possible. However that would require FE to know these functions 
> and declare them, whereas the current approach leave the concern to the 
> device library.

I was thinking of just adding a pointer to an array of pointers to 
`@llvm.compiler.used`.
The array itself would come from the bitcode library and would be populated 
there.  I'm not sure if it's doable without knowing the array size, though.

e.g

  ; Added by compiler
  @llvm.compiler.used = appending global [1 x i8*] [i8* bitcast ([16 x i8*]* 
@_ZL5funcs to i8*)], section "llvm.metadata"
  
  ; comes from the bitcode library, initialized with the pointers to functions 
you need to keep.
  @_ZL5funcs = internal global [16 x i8*] zeroinitializer, align 4

It should be possible to make the pointer to the array opaque with an 
intermadiate variable in the library.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106315

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to