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: [RFC] use symbol_ref flags for rs6000


The only problem with this on darwin, it is okay to call the static int so that will become a regression.

Thanks,
Andrew Pinski

Simple test case:
int main()
{
        static int thunk[5]={0x4e800020};
        ((int (*)(void))thunk) ();
}


On Thursday, May 1, 2003, at 18:17 US/Eastern, David Edelsohn wrote:


Jakub Jelinek writes:

Jakub> This line was added by me because of ppc64. Jakub> If ppc64 backend is fixed, it should be deleted again IMHO.

Yes, and I appreciate your providing the work-around.

If you and Richard agree this is an error that should be fixed in
the backend, the solution is appended. This tests SYMBOL_REF_FUNCTION_P
for patterns which will produce direct calls and explicitly forces an
indirect call when the flag is not set. Is that what you two recommend?


David

Index: rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.463
diff -c -p -r1.463 rs6000.c
*** rs6000.c	1 May 2003 17:05:17 -0000	1.463
--- rs6000.c	1 May 2003 22:09:11 -0000
*************** symbol_ref_operand (op, mode)
*** 2073,2079 ****
    if (mode != VOIDmode && GET_MODE (op) != mode)
      return 0;

!   return (GET_CODE (op) == SYMBOL_REF);
  }

/* Return 1 if the operand, used inside a MEM, is a valid first argument
--- 2073,2079 ----
if (mode != VOIDmode && GET_MODE (op) != mode)
return 0;


!   return (GET_CODE (op) == SYMBOL_REF && SYMBOL_REF_FUNCTION_P (op));
  }

/* Return 1 if the operand, used inside a MEM, is a valid first argument
*************** current_file_function_operand (op, mode)
*** 2102,2118 ****
rtx op;
enum machine_mode mode ATTRIBUTE_UNUSED;
{
! if (GET_CODE (op) == SYMBOL_REF
! && (SYMBOL_REF_LOCAL_P (op)
! || (op == XEXP (DECL_RTL (current_function_decl), 0))))
! {
! #ifdef ENABLE_CHECKING
! if (!SYMBOL_REF_FUNCTION_P (op))
! abort ();
! #endif
! return 1;
! }
! return 0;
}


  /* Return 1 if this operand is a valid input for a move insn.  */
--- 2102,2111 ----
       rtx op;
       enum machine_mode mode ATTRIBUTE_UNUSED;
  {
!   return (GET_CODE (op) == SYMBOL_REF
! 	  && SYMBOL_REF_FUNCTION_P (op)
! 	  && (SYMBOL_REF_LOCAL_P (op)
! 	      || (op == XEXP (DECL_RTL (current_function_decl), 0))));
  }

  /* Return 1 if this operand is a valid input for a move insn.  */
Index: rs6000.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.md,v
retrieving revision 1.250
diff -c -p -r1.250 rs6000.md
*** rs6000.md	1 May 2003 17:05:18 -0000	1.250
--- rs6000.md	1 May 2003 22:09:11 -0000
***************
*** 10089,10094 ****
--- 10180,10186 ----
    operands[0] = XEXP (operands[0], 0);

    if (GET_CODE (operands[0]) != SYMBOL_REF
+       || !SYMBOL_REF_FUNCTION_P (operands[0])
        || (INTVAL (operands[2]) & CALL_LONG) != 0)
      {
        if (INTVAL (operands[2]) & CALL_LONG)
***************
*** 10136,10141 ****
--- 10228,10234 ----
    operands[1] = XEXP (operands[1], 0);

    if (GET_CODE (operands[1]) != SYMBOL_REF
+       || !SYMBOL_REF_FUNCTION_P (operands[1])
        || (INTVAL (operands[3]) & CALL_LONG) != 0)
      {
        if (INTVAL (operands[3]) & CALL_LONG)




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