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]

Re: RFA: non-const libcalls


>>>>> "Richard" == Richard Henderson <rth@redhat.com> writes:

    Richard> Short term, you should probably revert Bernd's patch.
    Richard> Long term, we should revamp all of this nonsense.

Thank you for investigating.

  > (Oddly, we do attach CALL_INSN_FUNCTION_USAGE notes indicating that
  > the *arguments* are clobbered -- even though they aren't.

  They might be.  That memory is available to the callee as a
  home for that varaible.  If the variable is modified within
  the callee, it is allowed to spill the value there instead 
  of in a new spot in the stack frame.

Right.  I meant that for some particular functions, we know they won't
do this, and we could optimize better by knowing that.  But, certainly
the current behavior is conservative, which is good.

I agree about the revamping.  I don't think emit_libcall_block should
be the one deciding which calls are `const'; that's a property of the
function itself.  We ought to have something in the optab that
indicates that.

Bootstrapped on sparc-sun-solaris2.8, applied on the branch and on the
mainline.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2001-05-11  Mark Mitchell  <mark@codesourcery.com>

	* optabs.c (emit_libcall_block): Don't mark calls as CONST_CALL_P.

Index: optabs.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/optabs.c,v
retrieving revision 1.87.4.1
diff -c -p -r1.87.4.1 optabs.c
*** optabs.c	2001/04/14 03:32:47	1.87.4.1
--- optabs.c	2001/05/11 15:13:13
*************** emit_libcall_block (insns, target, resul
*** 2813,2826 ****
    /* 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).  Also set the CONST_CALL_P flag.  */
  
    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);
  
- 	CONST_CALL_P (insn) = 1;
  	if (note != 0)
  	  XEXP (note, 0) = GEN_INT (-1);
  	else
--- 2813,2825 ----
    /* 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


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