[llvm-dev] Changing address space

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 14 12:53:20 PDT 2015


On 14 October 2015 at 12:38, Erdem Derebaşoğlu <llvm-dev at lists.llvm.org> wrote:
> I mean the address space that LLVM supports. Is there a way to identify
> thread local variables? I will later use a codegen pass to make use of
> address spaces.

C/C++ level thread local variables are explicitly represented in LLVM
IR (search "thread_local"). These are global variables that should
have a different copy in each thread.

But obviously there can also be other variables that are local to a
thread without being officially TLS (function-local variables that
aren't static, pointers obtained via pthread_create_key APIs or some
hand-rolled equivalent, etc).

In general it's probably not even well-defined whether some random
pointer is thread-local or not.

Tim.


More information about the llvm-dev mailing list