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]

PowerPC TOC/GOT constants


	The following patch fixes the PowerPC port handling of constants
stored in the TOC and GOT by aligning them properly.  This mainly affect
Fortran which passes constants by reference and GCC places those constants
directly in the TOC/GOT.

David


2001-02-08  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
            David Edelsohn  <edelsohn@gnu.org>

        * config/rs6000/rs6000.c (output_toc): Allow 32-bit targets to
        handle DImode constants.  Use one TOC entry for SImode and smaller
        constants, aligned properly.


Index: rs6000.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.166
diff -c -p -r1.166 rs6000.c
*** rs6000.c	2001/02/07 01:05:35	1.166
--- rs6000.c	2001/02/09 03:04:39
*************** rs6000_emit_move (dest, source, mode)
*** 1783,1788 ****
--- 1780,1786 ----
  				  XEXP (operands[1], 0));
  
    emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
+   return;
  }
  
  /* Initialize a variable CUM of type CUMULATIVE_ARGS
*************** output_toc (file, x, labelno, mode)
*** 6910,6919 ****
  	 integer constants in the TOC we have to pad them.
  	 (This is still a win over putting the constants in
  	 a separate constant pool, because then we'd have
! 	 to have both a TOC entry _and_ the actual constant.)  */
!       if (POINTER_SIZE < GET_MODE_BITSIZE (mode))
  	abort ();/* It would be easy to make this work, but it doesn't now.  */
!       if (mode != Pmode)
  	lshift_double (low, high, POINTER_SIZE - GET_MODE_BITSIZE (mode),
  		       POINTER_SIZE, &low, &high, 0);
  
--- 6908,6922 ----
  	 integer constants in the TOC we have to pad them.
  	 (This is still a win over putting the constants in
  	 a separate constant pool, because then we'd have
! 	 to have both a TOC entry _and_ the actual constant.)
! 
!          For a 32-bit target, CONST_INT values are loaded and shifted
! 	 entirely within `low' and can be stored in one TOC entry.  */
! 
!       if (TARGET_64BIT && POINTER_SIZE < GET_MODE_BITSIZE (mode))
  	abort ();/* It would be easy to make this work, but it doesn't now.  */
! 
!       if (POINTER_SIZE > GET_MODE_BITSIZE (mode))
  	lshift_double (low, high, POINTER_SIZE - GET_MODE_BITSIZE (mode),
  		       POINTER_SIZE, &low, &high, 0);
  
*************** output_toc (file, x, labelno, mode)
*** 6928,6939 ****
  	}
        else
  	{
! 	  if (TARGET_MINIMAL_TOC)
! 	    fprintf (file, "\t.long 0x%lx\n\t.long 0x%lx\n",
! 		     (long)high, (long)low);
  	  else
! 	    fprintf (file, "\t.tc ID_%lx_%lx[TC],0x%lx,0x%lx\n",
! 		     (long)high, (long)low, (long)high, (long)low);
  	  return;
  	}
      }
--- 6931,6954 ----
  	}
        else
  	{
! 	  if (POINTER_SIZE < GET_MODE_BITSIZE (mode))
! 	    {
! 	      if (TARGET_MINIMAL_TOC)
! 		fprintf (file, "\t.long 0x%lx\n\t.long 0x%lx\n",
! 			 (long)high, (long)low);
! 	      else
! 		fprintf (file, "\t.tc ID_%lx_%lx[TC],0x%lx,0x%lx\n",
! 			 (long)high, (long)low, (long)high, (long)low);
! 	    }
  	  else
! 	    {
! 	      if (TARGET_MINIMAL_TOC)
! 		fprintf (file, "\t.long 0x%lx\n",
! 			 (long)low);
! 	      else
! 		fprintf (file, "\t.tc IS_%lx[TC],0x%lx\n",
! 			 (long)low, (long)low);
! 	    }
  	  return;
  	}
      }


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