public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Non-call exceptions and libcalls
@ 2001-06-20  8:39 mike stump
  0 siblings, 0 replies; 6+ messages in thread
From: mike stump @ 2001-06-20  8:39 UTC (permalink / raw)
  To: aph; +Cc: gcc

> From: Andrew Haley <aph@cambridge.redhat.com>
> Date: Wed, 20 Jun 2001 12:11:17 +0100 (BST)
> To: mike stump <mrs@windriver.com>

> Well, I *do* check may_trap_p (equiv) before marking the libcall as
> "may throw".

Ah, beautiful.  Sorry I missed it the first time.  Sounds good all the
way around to me then.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Non-call exceptions and libcalls
  2001-06-19  9:13 Andrew Haley
@ 2001-06-20  9:24 ` Richard Henderson
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2001-06-20  9:24 UTC (permalink / raw)
  To: Andrew Haley; +Cc: gcc

On Tue, Jun 19, 2001 at 05:13:18PM +0100, Andrew Haley wrote:
> 	* optabs.c (emit_libcall_block): When using non-call exceptions,
> 	don't mark libcalls never throwing.  */

Ok.


r~

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Non-call exceptions and libcalls
  2001-06-19 18:17 mike stump
  2001-06-20  4:11 ` Andrew Haley
@ 2001-06-20  9:23 ` Richard Henderson
  1 sibling, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2001-06-20  9:23 UTC (permalink / raw)
  To: mike stump; +Cc: aph, gcc

On Tue, Jun 19, 2001 at 06:17:30PM -0700, mike stump wrote:
> I think that's a fine sledge hammer, though, I can't help but wonder
> if with just a little bit more work, we could fine tune it so that
> only the few routines that might throw get this type of treatment.

Did you not see the may_trap_p in the patch?


r~

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Non-call exceptions and libcalls
  2001-06-19 18:17 mike stump
@ 2001-06-20  4:11 ` Andrew Haley
  2001-06-20  9:23 ` Richard Henderson
  1 sibling, 0 replies; 6+ messages in thread
From: Andrew Haley @ 2001-06-20  4:11 UTC (permalink / raw)
  To: mike stump; +Cc: gcc

mike stump writes:
 > > From: Andrew Haley <aph@cambridge.redhat.com>
 > > Date: Tue, 19 Jun 2001 17:13:18 +0100 (BST)
 > > To: gcc@gcc.gnu.org
 > 
 > > All libcalls are marked as "cannot throw", but in the case of
 > > -fnon-call-exceptions this isn't true: if a divide insn can throw an
 > > exception, so can a call to __divdi3.
 > 
 > > What do people think?
 > 
 > I think that's a fine sledge hammer, though, I can't help but wonder
 > if with just a little bit more work, we could fine tune it so that
 > only the few routines that might throw get this type of treatment.

Well, I *do* check may_trap_p (equiv) before marking the libcall as
"may throw".  With regard to compiling some of the libcalls with
unwind info, there's no need to do that with more than a very few of
these: the divide routines and a couple that read/write memory.

Andrew.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Non-call exceptions and libcalls
@ 2001-06-19 18:17 mike stump
  2001-06-20  4:11 ` Andrew Haley
  2001-06-20  9:23 ` Richard Henderson
  0 siblings, 2 replies; 6+ messages in thread
From: mike stump @ 2001-06-19 18:17 UTC (permalink / raw)
  To: aph, gcc

> From: Andrew Haley <aph@cambridge.redhat.com>
> Date: Tue, 19 Jun 2001 17:13:18 +0100 (BST)
> To: gcc@gcc.gnu.org

> All libcalls are marked as "cannot throw", but in the case of
> -fnon-call-exceptions this isn't true: if a divide insn can throw an
> exception, so can a call to __divdi3.

> What do people think?

I think that's a fine sledge hammer, though, I can't help but wonder
if with just a little bit more work, we could fine tune it so that
only the few routines that might throw get this type of treatment.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Non-call exceptions and libcalls
@ 2001-06-19  9:13 Andrew Haley
  2001-06-20  9:24 ` Richard Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Haley @ 2001-06-19  9:13 UTC (permalink / raw)
  To: gcc

All libcalls are marked as "cannot throw", but in the case of
-fnon-call-exceptions this isn't true: if a divide insn can throw an
exception, so can a call to __divdi3.

In gcj 3.0 we get around this problem by calling a divide subroutine
in libgcj for every division, but this is a temporary fix that we'd
like to get rid of.  It is very inefficient, obviously.

This patch removes "can't throw" notes in libcall blocks where
appropriate.  

In addition, some of the functions in libgcc2 must be compiled with
-fnon-call-exceptions so that we can unwind through them.

What do people think?

Andrew.


2001-06-14  Andrew Haley  <aph@cambridge.redhat.com>

	* optabs.c (emit_libcall_block): When using non-call exceptions,
	don't mark libcalls never throwing.  */

Index: optabs.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/optabs.c,v
retrieving revision 1.87.4.4
diff -c -2 -p -r1.87.4.4 optabs.c
*** optabs.c	2001/05/13 07:09:55	1.87.4.4
--- optabs.c	2001/06/14 18:11:34
*************** emit_libcall_block (insns, target, resul
*** 2809,2829 ****
    if (! REG_P (target) || REG_USERVAR_P (target))
      target = gen_reg_rtx (GET_MODE (target));
! 
    /* look for any CALL_INSNs in this sequence, and attach a REG_EH_REGION
       reg note to indicate that this call cannot throw or execute a nonlocal
       goto (unless there is already a REG_EH_REGION note, in which case
       we update it).  */
! 
!   for (insn = insns; insn; insn = NEXT_INSN (insn))
!     if (GET_CODE (insn) == CALL_INSN)
!       {
! 	rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX);
! 
! 	if (note != 0)
! 	  XEXP (note, 0) = GEN_INT (-1);
! 	else
! 	  REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EH_REGION, GEN_INT (-1),
! 						REG_NOTES (insn));
!       }
  
    /* First emit all insns that set pseudos.  Remove them from the list as
--- 2809,2842 ----
    if (! REG_P (target) || REG_USERVAR_P (target))
      target = gen_reg_rtx (GET_MODE (target));
!   
!   /* If we're using non-call exceptions, a libcall corresponding to an
!      operation that may trap may also trap.  */
!   if (flag_non_call_exceptions && may_trap_p (equiv))
!     {
!       for (insn = insns; insn; insn = NEXT_INSN (insn))
! 	if (GET_CODE (insn) == CALL_INSN)
! 	  {
! 	    rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX);
! 	    
! 	    if (note != 0 && INTVAL (XEXP (note, 0)) <= 0)
! 	      remove_note (insn, note);
! 	  }
!     }
!   else
    /* look for any CALL_INSNs in this sequence, and attach a REG_EH_REGION
       reg note to indicate that this call cannot throw or execute a nonlocal
       goto (unless there is already a REG_EH_REGION note, in which case
       we update it).  */
!     for (insn = insns; insn; insn = NEXT_INSN (insn))
!       if (GET_CODE (insn) == CALL_INSN)
! 	{
! 	  rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX);
! 	
! 	  if (note != 0)
! 	    XEXP (note, 0) = GEN_INT (-1);
! 	  else
! 	    REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EH_REGION, GEN_INT (-1),
! 						  REG_NOTES (insn));
! 	}
  
    /* First emit all insns that set pseudos.  Remove them from the list as

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-06-20  9:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-20  8:39 Non-call exceptions and libcalls mike stump
  -- strict thread matches above, loose matches on Subject: below --
2001-06-19 18:17 mike stump
2001-06-20  4:11 ` Andrew Haley
2001-06-20  9:23 ` Richard Henderson
2001-06-19  9:13 Andrew Haley
2001-06-20  9:24 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).