[LLVMdev] [PATCH] Add support for accessing the FS segment register on X86

Dan Gohman gohman at apple.com
Mon May 4 15:42:52 PDT 2009

On May 4, 2009, at 3:30 PM, Chris Lattner wrote:

> On May 4, 2009, at 3:16 PM, Dan Gohman wrote:
>> Hello,
>> The preferred way to do TLS is to use the thread_local keyword.
>> There is x86-64 support for thread_local on ELF; if you need
>> it for other targets, I recommend looking at adapting it.
> That said, the X86 backend supporting access off FS is general
> goodness, right?

Please consider changing clang to expose this functionality via names,
rather than magic numbers. The fact that clang has chosen to expose
x86 esoterica via LLVM-specific magic numbers is distasteful.

Also, please add a note in clang's manual that address-spaces are not
intended to be used for normal TLS. They don't actually work the same
way, and this fact is non-obvious.

Further, please document that address-space qualifiers on variables
with static storage are not actually handled specially. So something
like "address_space(256) int x; address_space(256) int *y = &x" does
not actually result in y pointing at x. Actually, please change the
front-end to outright disallow this.

Do all of those things, and I may agree :-).


More information about the llvm-dev mailing list