[PATCH] D10524: Clang/driver: emulated TLS mode.

Joerg Sonnenberger joerg at britannica.bec.de
Wed Jul 15 13:29:07 PDT 2015


On Wed, Jul 15, 2015 at 10:41:20AM -0700, Chih-hung Hsieh wrote:
> New suggested changes:
> (a) Do not add -ftls-model=emulated.
> (b) Add -femulated-tls flag, which sets up some TargetMachine internal flag.
> (c) No C/C++ attribute tls_model("emulated") nor IR thread_local(emulated)
> attribute, but there is internal TLSModel::emulated
> (d) TargetMachine::getTLSModel and getSelectedTLSModel returns
> TLSModel::emulated when -femulated-tls is true. This overwrites the
> thread_local(*) attributes specified for the variable in IR.

I still think (d) is wrong. If the flag is specified, you want to scan
all modules for TLS variable. If you find any, replace the access with
the appropiate emulation glue. I'm not sure how globals are handled with
emutls, so there might be cheaper ways to do per-function.

Joerg



More information about the llvm-commits mailing list