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: ppc glibc 2.3 failure


Whoops.  Not only did I send it to the wrong list, but I forgot to
include the patch.

Short story-- fixes bug while building glibc from CVS.  A better
solution in the works as well.

Aldy

----- Forwarded message from Aldy Hernandez <aldyh@redhat.com> -----

From: Aldy Hernandez <aldyh@redhat.com>
Subject: Re: ppc glibc 2.3 failure
To: Richard Henderson <rth@redhat.com>, Dale Johannesen <dalej@apple.com>,
	dje@watson.ibm.com, gcc@gcc.gnu.org
Date: Tue, 8 Oct 2002 16:48:33 -0700
User-Agent: Mutt/1.4i

On Mon, Oct 07, 2002 at 05:43:36PM -0700, Richard Henderson wrote:

> rs6000_stack_info needs to produce different results when called
> during the reload loop (since we might be spilling more and more
> registers), but after reload is complete, the values computed
> must *never* change.
> 
> See ia64_compute_frame_size and how it handles "initialized".

I tried to do it the ia64 way, but ran into a problem where we set the
LR in the prologue, and then emit the following call in the body:

(call_insn 35 33 37 0 0x30267480 (parallel [
            (set (reg:SI 3 r3)
                (call (mem:SI (symbol_ref:SI ("getpid")) [0 S4 A8])
                    (const_int 0 [0x0])))
            (use (const_int 0 [0x0]))
            (clobber (reg:SI 65 lr))
	    ^^^^^^^^^^^^^^^^ boo hiss!

As you've suggested, I'm looking at why rs6000_stack_info() did not
pick the clobber in the first place.

Meanwhile... I already had this patch tested, changing
rs6000_ra_ever_killed to use prologue_epilogue_contains.  I updated
comments and typos throughout as well.

Tested on ppc linux.  Bootstrapped and tested everything except Java,
since it's broken on ppc linux right now.

Is this ok (while I investigate why caching the stack info is
broken)?  I just have this pet peeve cuz I can't build glibc :).

2002-10-08  Aldy Hernandez  <aldyh@redhat.com>

	* config/rs6000/rs6000.c (rs6000_ra_ever_killed): Call
	prologue_epilogue_contains instead of using REG_MAYBE_DEAD notes.


Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.389
diff -c -p -r1.389 rs6000.c
*** config/rs6000/rs6000.c	7 Oct 2002 19:12:03 -0000	1.389
--- config/rs6000/rs6000.c	8 Oct 2002 23:44:13 -0000
*************** function_ok_for_sibcall (fndecl)
*** 9446,9452 ****
    return 0;
  }
  
- /* function rewritten to handle sibcalls */
  static int
  rs6000_ra_ever_killed ()
  {
--- 9446,9451 ----
*************** rs6000_ra_ever_killed ()
*** 9458,9476 ****
    if (current_function_is_thunk)
      return 0;
  #endif
!   /* regs_ever_live has LR marked as used if any sibcalls
!      are present.  Which it is, but this should not force
!      saving and restoring in the prologue/epilog.  Likewise,
!      reg_set_between_p thinks a sibcall clobbers LR, so
!      that is inappropriate. */
    /* Also, the prologue can generate a store into LR that
       doesn't really count, like this:
          move LR->R0
          bcl to set PIC register
          move LR->R31
          move R0->LR
!      When we're called from the epilog, we need to avoid counting
!      this as a store; thus we ignore any insns with a REG_MAYBE_DEAD note. */
           
    push_topmost_sequence ();
    top = get_insns ();
--- 9457,9477 ----
    if (current_function_is_thunk)
      return 0;
  #endif
!   /* regs_ever_live has LR marked as used if any sibcalls are present,
!      but this should not force saving and restoring in the
!      pro/epilogue.  Likewise, reg_set_between_p thinks a sibcall
!      clobbers LR, so that is inappropriate. */
! 
    /* Also, the prologue can generate a store into LR that
       doesn't really count, like this:
+ 
          move LR->R0
          bcl to set PIC register
          move LR->R31
          move R0->LR
! 
!      When we're called from the epilogue, we need to avoid counting
!      this as a store.  */
           
    push_topmost_sequence ();
    top = get_insns ();
*************** rs6000_ra_ever_killed ()
*** 9486,9493 ****
  	  else if (GET_CODE (insn) == CALL_INSN 
  		   && !SIBLING_CALL_P (insn))
  	    return 1;
! 	  else if (set_of (reg, insn) != NULL_RTX 
! 		   && find_reg_note (insn, REG_MAYBE_DEAD, NULL_RTX) == 0)
  	    return 1;
      	}
      }
--- 9487,9494 ----
  	  else if (GET_CODE (insn) == CALL_INSN 
  		   && !SIBLING_CALL_P (insn))
  	    return 1;
! 	  else if (set_of (reg, insn) != NULL_RTX
! 		   && !prologue_epilogue_contains (insn))
  	    return 1;
      	}
      }


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