This is the mail archive of the gcc@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: RFC: generate TLS address arithmetic for back-end


On Tue, Nov 23, 2004 at 01:21:08PM -0800, Richard Henderson wrote:
> On Tue, Nov 23, 2004 at 03:11:39PM -0400, Aldy Hernandez wrote:
> > 	* expr.c (expand_expr): case PLUS_EXPR: Treat TLS address
> > 	arithmetic as a constant.
> > 	(tree_tls_address_p): New.
> 
> A better place to attack this is to arrange for the address of
> such variables to be TREE_INVARIANT (if they're not already),
> and to change the test there from TREE_CONSTANT.

Ah...what the heck; I was bored.

TREE_INVARIANT was not being set for addresses of thread-local variables.

Fixing this oversight fixed the whole she-bang since I've the
gimplifier and friends take an alternate path to generate the arithmetic
I need (and this path already takes into account TREE_INVARIANT).

Is the patch below correct, or do TLS addresses have to be marked
constant as well as invariant?

Also, would you like this functionality on by default or dependent on a
target hook?

Thanks.
Aldy

	* tree.c (recompute_tree_invarant_for_addr_expr): The address of a
	thread-local variable is invariant.

Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.445
diff -c -p -r1.445 tree.c
*** tree.c	10 Nov 2004 17:34:39 -0000	1.445
--- tree.c	24 Nov 2004 08:20:56 -0000
*************** do { tree _node = (NODE); \
*** 2421,2427 ****
      {
        if (staticp (node))
  	;
!       else if (decl_function_context (node) == current_function_decl)
  	tc = false;
        else
  	ti = tc = false;
--- 2421,2429 ----
      {
        if (staticp (node))
  	;
!       else if (decl_function_context (node) == current_function_decl
! 	       /* Addresses of thread-local variables are invariant.  */
! 	       || (TREE_CODE (node) == VAR_DECL && DECL_THREAD_LOCAL (node)))
  	tc = false;
        else
  	ti = tc = false;


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