On Thu, May 23, 2013 at 12:06:01PM -0700, Richard Henderson wrote: > > struct foo_c_state > > { > > some_type bar; > > }; > > # define bar ctxt->x_foo_c_bar; > > /* there's a "context *ctxt;" variable somewhere, possibly > > using TLS */ > > I've an idea that this will perform very badly. With ctxt being a global (if > tls) variable, it's call clobbered. Thus we'll wind up reloading it all the > time, which for pic involves another call to the __get_tlsaddr runtime > function.
If all of gcc just has one __thread pointer in it, then we can just use tls_model ("initial-exec") for it and lower that overhead down a lot. Jakub