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]

find_best_addr tweak


The purpose of this patch is to convince CSE to try to merge
a magic token (UNSPEC_TP) into an address when possible.  I
have a patch that uses this to generate %gs-relative addresses
for tls on x86.  Which I'll be posting shortly.


r~


        * cse.c (find_best_addr): Consider binary operators even if second
        argument is not CONST_INT.

Index: cse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cse.c,v
retrieving revision 1.263
diff -c -p -d -r1.263 cse.c
*** cse.c	4 Jun 2003 07:51:41 -0000	1.263
--- cse.c	4 Jun 2003 21:03:43 -0000
*************** find_best_addr (insn, loc, mode)
*** 3009,3018 ****
    if (flag_expensive_optimizations
        && (GET_RTX_CLASS (GET_CODE (*loc)) == '2'
  	  || GET_RTX_CLASS (GET_CODE (*loc)) == 'c')
!       && GET_CODE (XEXP (*loc, 0)) == REG
!       && GET_CODE (XEXP (*loc, 1)) == CONST_INT)
      {
!       rtx c = XEXP (*loc, 1);
  
        do_not_record = 0;
        hash = HASH (XEXP (*loc, 0), Pmode);
--- 3009,3017 ----
    if (flag_expensive_optimizations
        && (GET_RTX_CLASS (GET_CODE (*loc)) == '2'
  	  || GET_RTX_CLASS (GET_CODE (*loc)) == 'c')
!       && GET_CODE (XEXP (*loc, 0)) == REG)
      {
!       rtx op1 = XEXP (*loc, 1);
  
        do_not_record = 0;
        hash = HASH (XEXP (*loc, 0), Pmode);
*************** find_best_addr (insn, loc, mode)
*** 3054,3060 ****
  		    || exp_equiv_p (p->exp, p->exp, 1, 0)))
  	      {
  		rtx new = simplify_gen_binary (GET_CODE (*loc), Pmode,
! 					       p->exp, c);
  		int new_cost;
  		new_cost = address_cost (new, mode);
  
--- 3053,3059 ----
  		    || exp_equiv_p (p->exp, p->exp, 1, 0)))
  	      {
  		rtx new = simplify_gen_binary (GET_CODE (*loc), Pmode,
! 					       p->exp, op1);
  		int new_cost;
  		new_cost = address_cost (new, mode);
  


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