Dear all,
I would like to store thread local variables in a different address space than global variables in an OpenMP program. Is it possible to do it using LLVM (perhaps with an optimization pass)?
Erdem Derebasoglu
Dear all,
I would like to store thread local variables in a different address space than global variables in an OpenMP program. Is it possible to do it using LLVM (perhaps with an optimization pass)?
Erdem Derebasoglu
Do you mean the conceptual address space that LLVM supports, or some kind of “address space” in an OS/Executable kind of sense?
LLVM has support for address spaces, so shouldn’t be very hard to achieve this as a “pass” (assuming you can identify TL variables in the first place).
Obviously at some later stage the address space needs to be taken into account in the code-gen to machine code, as well, which is a slightly different matter.
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.
Erdem
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.