i386.c patch

Alasdair Baird alasdair@wildcat.demon.co.uk
Sat Jul 4 16:43:00 GMT 1998


This patch fixes two problems I uncovered in i386.c using
some runtime checking of rtl types at the time the rtl access
macros are used.  The first problem showed up as use of INTVAL
on something other than a CONST_INT, while the second was using
SET_SRC(insn) where SET_SRC(PATTERN(insn)) was intended.


   Alasdair.



Sun Jul  5 00:38:23 BST 1998	Alasdair Baird	<alasdair@wildcat.demon.co.uk>

    i386.c (output_pic_addr_const): Check for CONST_INT before using INTVAL.
    (is_fp_dest): Look at PATTERN within insn.


    
*** i386.c.orig	Sat Jul  4 23:01:53 1998
--- i386.c	Sun Jul  5 00:16:57 1998
*************** output_pic_addr_const (file, x, code)
*** 3035,3048 ****
        if (GET_CODE (XEXP (x, 0)) == CONST_INT)
  	{
  	  output_pic_addr_const (file, XEXP (x, 0), code);
! 	  if (INTVAL (XEXP (x, 1)) >= 0)
  	    fprintf (file, "+");
  	  output_pic_addr_const (file, XEXP (x, 1), code);
  	}
        else
  	{
  	  output_pic_addr_const (file, XEXP (x, 1), code);
! 	  if (INTVAL (XEXP (x, 0)) >= 0)
  	    fprintf (file, "+");
  	  output_pic_addr_const (file, XEXP (x, 0), code);
  	}
--- 3035,3050 ----
        if (GET_CODE (XEXP (x, 0)) == CONST_INT)
  	{
  	  output_pic_addr_const (file, XEXP (x, 0), code);
! 	  if (GET_CODE (XEXP(x, 1)) != CONST_INT
! 	      || INTVAL (XEXP (x, 1)) >= 0)
  	    fprintf (file, "+");
  	  output_pic_addr_const (file, XEXP (x, 1), code);
  	}
        else
  	{
  	  output_pic_addr_const (file, XEXP (x, 1), code);
! 	  if (GET_CODE (XEXP(x, 0)) != CONST_INT
! 	      || INTVAL (XEXP (x, 0)) >= 0)
  	    fprintf (file, "+");
  	  output_pic_addr_const (file, XEXP (x, 0), code);
  	}
*************** is_fp_dest (insn)
*** 4840,4846 ****
  	  || GET_MODE (SET_DEST (PATTERN (insn))) == XFmode)
        && GET_CODE (SET_DEST (PATTERN (insn))) == REG
        && REGNO (SET_DEST (PATTERN (insn))) >= FIRST_FLOAT_REG
!       && GET_CODE (SET_SRC (insn)) != MEM)
      return 1;
  
    return 0;
--- 4842,4848 ----
  	  || GET_MODE (SET_DEST (PATTERN (insn))) == XFmode)
        && GET_CODE (SET_DEST (PATTERN (insn))) == REG
        && REGNO (SET_DEST (PATTERN (insn))) >= FIRST_FLOAT_REG
!       && GET_CODE (SET_SRC (PATTERN (insn))) != MEM)
      return 1;
  
    return 0;



More information about the Gcc-patches mailing list