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]

Use generic small-data handling on powerpc SVR4.


There were only two substantive differences between
SYMBOL_FLAG_SMALL_V4 and the generic SYMBOL_FLAG_SMALL:

- Some extra section names.  I've added these into the generic names.
  .sbss2 isn't ever generated by the compiler, but could be; the other
  names are historic, but there may be code (and linker scripts) out
  there that use them.
- SYMBOL_FLAG_SMALL had an optimisation involving -msdata=data and
  static variables.  This is correct for both versions; I've added
  a comment saying why.

Tested on powerpc-eabisim.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/rs6000-genericsmalldata.patch=============
2003-05-02  Geoffrey Keating  <geoffk@apple.com>

	* config/rs6000/sysv4.h (SYMBOL_FLAG_SMALL_V4): Delete.
	(SYMBOL_FLAG_SMALL_V4): Delete.
	* config/rs6000/rs6000.c (small_data_operand): Use SYMBOL_REF_SMALL_P.
	(rs6000_elf_encode_section_info): Don't set SYMBOL_FLAG_SMALL_V4.
	(rs6000_elf_in_small_data_p): Add extra section names.  Add
	comment about TREE_PUBLIC test.

Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.462
diff -u -p -u -p -r1.462 rs6000.c
--- config/rs6000/rs6000.c	30 Apr 2003 16:51:21 -0000	1.462
+++ config/rs6000/rs6000.c	2 May 2003 18:29:13 -0000
@@ -2210,7 +2210,7 @@ small_data_operand (op, mode)
       sym_ref = XEXP (sum, 0);
     }
 
-  return SYMBOL_REF_SMALL_V4_P (sym_ref);
+  return SYMBOL_REF_SMALL_P (sym_ref);
 #else
   return 0;
 #endif
@@ -12926,9 +12926,6 @@ rs6000_elf_unique_section (decl, reloc)
 /* For a SYMBOL_REF, set generic flags and then perform some
    target-specific processing.
 
-   Set SYMBOL_FLAG_SMALL_V4 for an operand in small memory on V.4/eabi;
-   this is different from the generic SYMBOL_FLAG_SMALL.
-
    When the AIX ABI is requested on a non-AIX system, replace the
    function name with the real name (with a leading .) rather than the
    function descriptor name.  This saves a lot of overriding code to
@@ -12954,33 +12951,6 @@ rs6000_elf_encode_section_info (decl, rt
       memcpy (str + 1, XSTR (sym_ref, 0), len + 1);
       XSTR (sym_ref, 0) = ggc_alloc_string (str, len + 1);
     }
-  else if (rs6000_sdata != SDATA_NONE
-	   && DEFAULT_ABI == ABI_V4
-	   && TREE_CODE (decl) == VAR_DECL)
-    {
-      rtx sym_ref = XEXP (rtl, 0);
-      int size = int_size_in_bytes (TREE_TYPE (decl));
-      tree section_name = DECL_SECTION_NAME (decl);
-      const char *name = (char *)0;
-
-      if (section_name)
-	{
-	  if (TREE_CODE (section_name) == STRING_CST)
-	    name = TREE_STRING_POINTER (section_name);
-	  else
-	    abort ();
-	}
-
-      if (name
-	  ? (strcmp (name, ".sdata") == 0
-	     || strcmp (name, ".sdata2") == 0
-	     || strcmp (name, ".sbss") == 0
-	     || strcmp (name, ".sbss2") == 0
-	     || strcmp (name, ".PPC.EMB.sdata0") == 0
-	     || strcmp (name, ".PPC.EMB.sbss0") == 0)
-	  : (size > 0 && size <= g_switch_value))
-	SYMBOL_REF_FLAGS (sym_ref) |= SYMBOL_FLAG_SMALL_V4;
-    }
 }
 
 static bool
@@ -12995,7 +12965,10 @@ rs6000_elf_in_small_data_p (decl)
       const char *section = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
       if (strcmp (section, ".sdata") == 0
 	  || strcmp (section, ".sdata2") == 0
-	  || strcmp (section, ".sbss") == 0)
+	  || strcmp (section, ".sbss") == 0
+	  || strcmp (section, ".sbss2") == 0
+	  || strcmp (section, ".PPC.EMB.sdata0") == 0
+	  || strcmp (section, ".PPC.EMB.sbss0") == 0)
 	return true;
     }
   else
@@ -13004,6 +12977,8 @@ rs6000_elf_in_small_data_p (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)))
 	return true;
     }
Index: config/rs6000/sysv4.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/sysv4.h,v
retrieving revision 1.122
diff -u -p -u -p -r1.122 sysv4.h
--- config/rs6000/sysv4.h	30 Apr 2003 16:51:22 -0000	1.122
+++ config/rs6000/sysv4.h	2 May 2003 18:29:14 -0000
@@ -1374,9 +1374,3 @@ ncrtn.o%s"
 
 /* Generate entries in .fixup for relocatable addresses.  */
 #define RELOCATABLE_NEEDS_FIXUP
-
-/* Define target-specific symbol_ref flags, beginning with
-   SYMBOL_REF_FLAG_DEP.  */
-#define SYMBOL_FLAG_SMALL_V4  (SYMBOL_FLAG_MACH_DEP << 0)
-#define SYMBOL_REF_SMALL_V4_P(RTX) \
-  ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_SMALL_V4) != 0)
============================================================


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