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]

Re: A patch for i386.c


On Mon, Sep 13, 1999 at 10:57:58AM -0700, H.J. Lu wrote:
> gcc.c-torture/compile/calls.c fails on Solaris/x86 with the native as
> and will fail on Linux/x86 with the next Linux binutils since gcc
> generates invalid asm code. This patch fixes it.

I checked the following into mainline.


r~


        * i386.c (call_insn_operand): Reject const_int.
        (expander_call_insn_operand): Use call_insn_operand.

Index: i386.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/i386/i386.c,v
retrieving revision 1.91
diff -c -p -d -r1.91 i386.c
*** i386.c	1999/09/12 01:51:27	1.91
--- i386.c	1999/09/13 22:17:03
*************** pic_symbolic_operand (op, mode)
*** 931,940 ****
    return 0;
  }
  
! /* Test for a valid operand for a call instruction.
!    Don't allow the arg pointer register or virtual regs
!    since they may change into reg + const, which the patterns
!    can't handle yet.  */
  
  int
  call_insn_operand (op, mode)
--- 931,939 ----
    return 0;
  }
  
! /* Test for a valid operand for a call instruction.  Don't allow the
!    arg pointer register or virtual regs since they may decay into
!    reg + const, which the patterns can't handle.  */
  
  int
  call_insn_operand (op, mode)
*************** call_insn_operand (op, mode)
*** 953,988 ****
  	      && REGNO (op) <= LAST_VIRTUAL_REGISTER)))
      return 0;
  
    /* Otherwise we can allow any general_operand in the address.  */
    return general_operand (op, Pmode);
  }
  
! /* Like call_insn_operand but allow (mem (symbol_ref ...))
!    even if pic.  */
  
  int
  expander_call_insn_operand (op, mode)
       rtx op;
!      enum machine_mode mode ATTRIBUTE_UNUSED;
  {
!   if (GET_CODE (op) != MEM)
!     return 0;
!   op = XEXP (op, 0);
! 
!   /* Direct symbol references.  */
!   if (CONSTANT_ADDRESS_P (op))
      return 1;
- 
-   /* Disallow indirect through a virtual register.  This leads to
-      compiler aborts when trying to eliminate them.  */
-   if (GET_CODE (op) == REG
-       && (op == arg_pointer_rtx
- 	  || (REGNO (op) >= FIRST_PSEUDO_REGISTER
- 	      && REGNO (op) <= LAST_VIRTUAL_REGISTER)))
-     return 0;
  
!   /* Otherwise we can allow any general_operand in the address.  */
!   return general_operand (op, mode);
  }
  
  int
--- 952,978 ----
  	      && REGNO (op) <= LAST_VIRTUAL_REGISTER)))
      return 0;
  
+   /* Disallow `call 1234'.  Due to varying assembler lameness this
+      gets either rejected or translated to `call .+1234'.  */
+   if (GET_CODE (op) == CONST_INT)
+     return 0;
+ 
    /* Otherwise we can allow any general_operand in the address.  */
    return general_operand (op, Pmode);
  }
  
! /* Like call_insn_operand but allow (mem (symbol_ref ...)) even if pic.  */
  
  int
  expander_call_insn_operand (op, mode)
       rtx op;
!      enum machine_mode mode;
  {
!   if (GET_CODE (op) == MEM
!       && GET_CODE (XEXP (op, 0)) == SYMBOL_REF)
      return 1;
  
!   return call_insn_operand (op, mode);
  }
  
  int


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