This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rs6000] Don't emit libcall notes around TLS address


On Sunday 12 June 2005 00:34, Richard Henderson wrote:
> On Sun, Jun 12, 2005 at 12:07:32AM +0200, Steven Bosscher wrote:
> > I'm willing to look for a replacement, but I have no idea when this
> > code is actually triggered ...
>
> static __thread int a, b;
>
> int foo (void)
> {
>   return a + b;
> }
>
> Compile with -fpic.  There should only be one call to __tls_get_addr.
> Hmm.  Also thinking about this, global-dynamic model tls symbols are
> affected as well, though not in the same way.

Looks the global-dynamic case is easier than the local-dynamic case...

>   extern __thread int a;
>   extern void bar (int);
>   int foo (void)
>   {
>     bar(a);
>     bar(a);
>     bar(a);
>   }

IIUC this be done with a const builtin to turn it into something like

int foo2 (void)
{
  int *t1 = builtin_get_tls_addr (a);
  bar (*t1);
  int *t2 = builtin_get_tls_addr (a);
  bar (*t2);
  int *t3 = builtin_get_tls_addr (a);
  bar (*t3);
}

which PRE would turn into this:

int foo2 (void)
{
  int *t1 = builtin_get_tls_addr (a);
  bar (*t1);
  bar (*t1);
  bar (*t1);
}

Right?

If so, would you have ideas for a similar trick for the local-dynamic
case?

Gr.
Steven



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]