powerpc-unknown-linux-gnu bootstrap fix

Matt Kraai kraai@alumni.cmu.edu
Sun May 18 23:17:00 GMT 2003


On Thu, May 15, 2003 at 03:46:58PM -0700, Geoff Keating wrote:
> David Edelsohn <dje@watson.ibm.com> writes:
> 
> > >>>>> Richard Henderson writes:
> > 
> > Richard> On Wed, May 14, 2003 at 01:03:12PM -0400, David Edelsohn wrote:
> > >> Richard, would it be better to change g_switch_value to unsigned
> > >> int or unsigned HOST_WIDE_INT?
> > 
> > Richard> Yes.
> > 
> > 	I just noticed that this is fairly ugly.  Half the time
> > g_switch_value is tested against SIZE (unsigned HOST_WIDE_INT) and the
> > other half again int_size_in_bytes (signed HOST_WIDE_INT).  It's not going
> > to be easy to reliably rationalize this either way.  Maybe we should just
> > punt with a cast in sysv4.h -- alpha.c does that already.  Comments?
> 
> I think g_switch_value should be unsigned, because the reason
> int_size_in_bytes is signed is that it can return -1 meaning "I
> dunno", and that's a special case that the port maintainer should take
> care to handle specially.

The following patch makes g_switch_value an unsigned
HOST_WIDE_INT.

Tested by building cc1 for alpha-unknown-linux-gnu, frv-foo-elf,
and m32r-foo-elf, and by bootstrapping and regression testing on
powerpc-unknown-linux-gnu.

OK to commit?

-- 
Matt Kraai <kraai@alumni.cmu.edu>
Debian GNU/Linux Peon

	* flags.h (g_switch_value): Change to an unsigned
	HOST_WIDE_INT.
	* toplev.c (g_switch_value): Likewise.

	* config/alpha/alpha.c (small_symbolic_operand): Remove
	g_switch_value cast. 
	(alpha_in_small_data_p): Cast size to an unsigned
	HOST_WIDE_INT.

	* config/frv/frv.c (frv_in_small_data_p): Cast size to an
	unsigned HOST_WIDE_INT.
	* config/frv/frv.h (g_switch_value, g_switch_set): Remove.
	(ASM_OUTPUT_ALIGNED_DECL_LOCAL): Declare g_switch_set.

	* config/m32r/m32r.c (m32r_in_small_data_p): Cast size to an
	unsigned HOST_WIDE_INT.
	(m32r_asm_file_start): Use HOST_WIDE_INT_PRINT_UNSIGNED.
	* config/m32r/m32r.h (g_switch_value, g_switch_set): Remove.
	(ASM_OUTPUT_ALIGNED_COMMON): Declare g_switch_value.

	* config/rs6000/rs6000.c (rs6000_file_start): Use
	HOST_WIDE_INT_PRINT_UNSIGNED.
	(small_data_operand): Cast summand to unsigned HOST_WIDE_INT.
	(rs6000_elf_in_small_data_p): Cast size to unsigned
	HOST_WIDE_INT.
	* config/rs6000/sysv4.h (g_switch_value, g_switch_set):
	Remove.
	(SUBTARGET_OVERRIDE_OPTIONS): Declare g_switch_value and
	g_switch_set.
	(ASM_OUTPUT_ALIGNED_LOCAL): Declare g_switch_value and remove
	g_switch_value cast.

Index: gcc/flags.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flags.h,v
retrieving revision 1.107
diff -c -3 -p -r1.107 flags.h
*** gcc/flags.h	7 May 2003 22:11:33 -0000	1.107
--- gcc/flags.h	18 May 2003 21:19:28 -0000
*************** extern int frame_pointer_needed;
*** 586,592 ****
  extern int flag_trapv;
  
  /* Value of the -G xx switch, and whether it was passed or not.  */
! extern int g_switch_value;
  extern int g_switch_set;
  
  /* Values of the -falign-* flags: how much to align labels in code. 
--- 586,592 ----
  extern int flag_trapv;
  
  /* Value of the -G xx switch, and whether it was passed or not.  */
! extern unsigned HOST_WIDE_INT g_switch_value;
  extern int g_switch_set;
  
  /* Values of the -falign-* flags: how much to align labels in code. 
Index: gcc/toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.757
diff -c -3 -p -r1.757 toplev.c
*** gcc/toplev.c	14 May 2003 07:29:41 -0000	1.757
--- gcc/toplev.c	18 May 2003 21:19:48 -0000
*************** enum graph_dump_types graph_dump_format;
*** 329,335 ****
  char *asm_file_name;
  
  /* Value of the -G xx switch, and whether it was passed or not.  */
! int g_switch_value;
  int g_switch_set;
  
  /* Type(s) of debugging information we are producing (if any).
--- 329,335 ----
  char *asm_file_name;
  
  /* Value of the -G xx switch, and whether it was passed or not.  */
! unsigned HOST_WIDE_INT g_switch_value;
  int g_switch_set;
  
  /* Type(s) of debugging information we are producing (if any).
Index: gcc/config/alpha/alpha.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.c,v
retrieving revision 1.306
diff -c -3 -p -r1.306 alpha.c
*** gcc/config/alpha/alpha.c	16 May 2003 18:57:37 -0000	1.306
--- gcc/config/alpha/alpha.c	18 May 2003 21:20:19 -0000
*************** small_symbolic_operand (op, mode)
*** 1166,1172 ****
    /* ??? There's no encode_section_info equivalent for the rtl
       constant pool, so SYMBOL_FLAG_SMALL never gets set.  */
    if (CONSTANT_POOL_ADDRESS_P (op))
!     return GET_MODE_SIZE (get_pool_mode (op)) <= (unsigned) g_switch_value;
  
    return (SYMBOL_REF_LOCAL_P (op)
  	  && SYMBOL_REF_SMALL_P (op)
--- 1166,1172 ----
    /* ??? There's no encode_section_info equivalent for the rtl
       constant pool, so SYMBOL_FLAG_SMALL never gets set.  */
    if (CONSTANT_POOL_ADDRESS_P (op))
!     return GET_MODE_SIZE (get_pool_mode (op)) <= g_switch_value;
  
    return (SYMBOL_REF_LOCAL_P (op)
  	  && SYMBOL_REF_SMALL_P (op)
*************** alpha_in_small_data_p (exp)
*** 1891,1897 ****
  
        /* If this is an incomplete type with size 0, then we can't put it
  	 in sdata because it might be too big when completed.  */
!       if (size > 0 && size <= g_switch_value)
  	return true;
      }
  
--- 1891,1897 ----
  
        /* If this is an incomplete type with size 0, then we can't put it
  	 in sdata because it might be too big when completed.  */
!       if (size > 0 && (unsigned HOST_WIDE_INT) size <= g_switch_value)
  	return true;
      }
  
Index: gcc/config/frv/frv.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/frv/frv.c,v
retrieving revision 1.23
diff -c -3 -p -r1.23 frv.c
*** gcc/config/frv/frv.c	16 May 2003 18:57:40 -0000	1.23
--- gcc/config/frv/frv.c	18 May 2003 21:20:42 -0000
*************** frv_in_small_data_p (decl)
*** 9714,9720 ****
      return false;
  
    size = int_size_in_bytes (TREE_TYPE (decl));
!   if (size > 0 && size <= g_switch_value)
      return true;
  
    /* If we already know which section the decl should be in, see if
--- 9714,9720 ----
      return false;
  
    size = int_size_in_bytes (TREE_TYPE (decl));
!   if (size > 0 && (unsigned HOST_WIDE_INT) size <= g_switch_value)
      return true;
  
    /* If we already know which section the decl should be in, see if
Index: gcc/config/frv/frv.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/frv/frv.h,v
retrieving revision 1.22
diff -c -3 -p -r1.22 frv.h
*** gcc/config/frv/frv.h	12 May 2003 09:51:24 -0000	1.22
--- gcc/config/frv/frv.h	18 May 2003 21:20:59 -0000
*************** extern int target_flags;
*** 554,562 ****
  #define SDATA_DEFAULT_SIZE 8
  #endif
  
- extern int g_switch_value;        /* value of the -G xx switch */
- extern int g_switch_set;          /* whether -G xx was passed.  */
- 
  
  /* Storage Layout */
  
--- 554,559 ----
*************** extern int size_directive_output;
*** 2783,2788 ****
--- 2780,2787 ----
  #undef ASM_OUTPUT_ALIGNED_DECL_LOCAL
  #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE, ALIGN)	\
  do {                                                                   	\
+   extern unsigned HOST_WIDE_INT g_switch_value;				\
+ 									\
    if ((SIZE) > 0 && (SIZE) <= g_switch_value)				\
      sbss_section ();                                                 	\
    else                                                                 	\
Index: gcc/config/m32r/m32r.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r.c,v
retrieving revision 1.64
diff -c -3 -p -r1.64 m32r.c
*** gcc/config/m32r/m32r.c	9 May 2003 06:37:20 -0000	1.64
--- gcc/config/m32r/m32r.c	18 May 2003 21:21:09 -0000
*************** m32r_in_small_data_p (decl)
*** 433,439 ****
  	{
  	  int size = int_size_in_bytes (TREE_TYPE (decl));
  
! 	  if (size > 0 && size <= g_switch_value)
  	    return true;
  	}
      }
--- 433,439 ----
  	{
  	  int size = int_size_in_bytes (TREE_TYPE (decl));
  
! 	  if (size > 0 && (unsigned HOST_WIDE_INT) size <= g_switch_value)
  	    return true;
  	}
      }
*************** m32r_asm_file_start (file)
*** 2208,2214 ****
       FILE * file;
  {
    if (flag_verbose_asm)
!     fprintf (file, "%s M32R/D special options: -G %d\n",
  	     ASM_COMMENT_START, g_switch_value);
  }
  
--- 2208,2215 ----
       FILE * file;
  {
    if (flag_verbose_asm)
!     fprintf (file,
! 	     "%s M32R/D special options: -G " HOST_WIDE_INT_PRINT_UNSIGNED "\n",
  	     ASM_COMMENT_START, g_switch_value);
  }
  
Index: gcc/config/m32r/m32r.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r.h,v
retrieving revision 1.82
diff -c -3 -p -r1.82 m32r.h
*** gcc/config/m32r/m32r.h	12 May 2003 09:51:29 -0000	1.82
--- gcc/config/m32r/m32r.h	18 May 2003 21:21:16 -0000
*************** extern enum m32r_model m32r_model;
*** 350,358 ****
  #define SDATA_DEFAULT_SIZE 8
  #endif
  
- extern int g_switch_value;		/* value of the -G xx switch */
- extern int g_switch_set;		/* whether -G xx was passed.  */
- 
  enum m32r_sdata { M32R_SDATA_NONE, M32R_SDATA_SDATA, M32R_SDATA_USE };
  
  extern enum m32r_sdata m32r_sdata;
--- 350,355 ----
*************** extern char m32r_punct_chars[256];
*** 1690,1695 ****
--- 1687,1694 ----
  #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)		\
    do									\
      {									\
+       extern unsigned HOST_WIDE_INT g_switch_value;			\
+ 									\
        if (! TARGET_SDATA_NONE						\
  	  && (SIZE) > 0 && (SIZE) <= g_switch_value)			\
  	fprintf ((FILE), "%s", SCOMMON_ASM_OP);				\
Index: gcc/config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.478
diff -c -3 -p -r1.478 rs6000.c
*** gcc/config/rs6000/rs6000.c	17 May 2003 16:57:17 -0000	1.478
--- gcc/config/rs6000/rs6000.c	18 May 2003 21:21:54 -0000
*************** rs6000_file_start (file, default_cpu)
*** 950,956 ****
  
        if (rs6000_sdata && g_switch_value)
  	{
! 	  fprintf (file, "%s -G %d", start, g_switch_value);
  	  start = "";
  	}
  #endif
--- 950,957 ----
  
        if (rs6000_sdata && g_switch_value)
  	{
! 	  fprintf (file, "%s -G " HOST_WIDE_INT_PRINT_UNSIGNED, start,
! 		   g_switch_value);
  	  start = "";
  	}
  #endif
*************** small_data_operand (op, mode)
*** 2254,2260 ****
        /* We have to be careful here, because it is the referenced address
          that must be 32k from _SDA_BASE_, not just the symbol.  */
        summand = INTVAL (XEXP (sum, 1));
!       if (summand < 0 || summand > g_switch_value)
         return 0;
  
        sym_ref = XEXP (sum, 0);
--- 2255,2261 ----
        /* We have to be careful here, because it is the referenced address
          that must be 32k from _SDA_BASE_, not just the symbol.  */
        summand = INTVAL (XEXP (sum, 1));
!       if (summand < 0 || (unsigned HOST_WIDE_INT) summand > g_switch_value)
         return 0;
  
        sym_ref = XEXP (sum, 0);
*************** rs6000_elf_in_small_data_p (decl)
*** 13452,13458 ****
        HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (decl));
  
        if (size > 0
! 	  && size <= g_switch_value
  	  /* If it's not public, and we're not going to reference it there,
  	     there's no need to put it in the small data section.  */
  	  && (rs6000_sdata != SDATA_DATA || TREE_PUBLIC (decl)))
--- 13453,13459 ----
        HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (decl));
  
        if (size > 0
! 	  && (unsigned HOST_WIDE_INT) size <= g_switch_value
  	  /* If it's not public, and we're not going to reference it there,
  	     there's no need to put it in the small data section.  */
  	  && (rs6000_sdata != SDATA_DATA || TREE_PUBLIC (decl)))
Index: gcc/config/rs6000/sysv4.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/sysv4.h,v
retrieving revision 1.127
diff -c -3 -p -r1.127 sysv4.h
*** gcc/config/rs6000/sysv4.h	15 May 2003 02:35:19 -0000	1.127
--- gcc/config/rs6000/sysv4.h	18 May 2003 21:22:00 -0000
*************** extern const char *rs6000_tls_size_strin
*** 89,99 ****
    { "tls-size=", &rs6000_tls_size_string,					\
     N_("Specify bit size of immediate TLS offsets"), 0 }
  
- /* Max # of bytes for variables to automatically be put into the .sdata
-    or .sdata2 sections.  */
- extern int g_switch_value;		/* Value of the -G xx switch.  */
- extern int g_switch_set;		/* Whether -G xx was passed.  */
- 
  #define SDATA_DEFAULT_SIZE 8
  
  /* Note, V.4 no longer uses a normal TOC, so make -mfull-toc, be just
--- 89,94 ----
*************** extern int g_switch_set;		/* Whether -G 
*** 171,176 ****
--- 166,174 ----
  
  #define SUBTARGET_OVERRIDE_OPTIONS					\
  do {									\
+   extern unsigned HOST_WIDE_INT g_switch_value;				\
+   extern int g_switch_set;						\
+ 									\
    if (!g_switch_set)							\
      g_switch_value = SDATA_DEFAULT_SIZE;				\
  									\
*************** extern int rs6000_pic_labelno;
*** 665,672 ****
  #undef	ASM_OUTPUT_ALIGNED_LOCAL
  #define	ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)		\
  do {									\
    if (rs6000_sdata != SDATA_NONE && (SIZE) > 0				\
!       && (SIZE) <= (unsigned HOST_WIDE_INT)g_switch_value)		\
      {									\
        sbss_section ();							\
        ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT));	\
--- 663,672 ----
  #undef	ASM_OUTPUT_ALIGNED_LOCAL
  #define	ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)		\
  do {									\
+   extern unsigned HOST_WIDE_INT g_switch_value;				\
+ 									\
    if (rs6000_sdata != SDATA_NONE && (SIZE) > 0				\
!       && (SIZE) <= g_switch_value)					\
      {									\
        sbss_section ();							\
        ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT));	\



More information about the Gcc-patches mailing list