[PATCH] RFA frv misc patches

Eric Christopher echristo@redhat.com
Tue Oct 14 03:44:00 GMT 2003


This patch fixes a lot of problems on the frv port. I hadn't heard
anything about my offer for frv maintenance so I'll submit for approval.
There are still a couple of bitfield failures that I'm looking at, but I
thought I'd get this in to at least make C++ mostly usable :)

-eric

-- 
Eric Christopher <echristo@redhat.com>

2003-10-13  Eric Christopher  <echristo@redhat.com>

	* config/frv/frv.c (frv_adjust_field_align): Redo check for
	too wide bitfields.
	(frv_hard_regno_mode_ok): Add SPR_P and AP_FIRST.
	* config/frv/frv.h (FUNCTION_PROFILER): Remove abort call.
	(SBSS_SECTION_ASM_OP): Remove.
	(EXTRA_SECTIONS): Remove in_sbss.
	(EXTRA_SECTION_FUNCTIONS): Remove SBSS_SECTION_FUNCTION.
	(SBSS_SECTION_FUNCTION, sbss_section): Remove.
	(ASM_OUTPUT_ALIGNED_DECL_LOCAL): Change sbss_section to
	named_section.

Index: frv.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/frv/frv.c,v
retrieving revision 1.33
diff -u -p -w -r1.33 frv.c
--- frv.c	7 Oct 2003 02:23:39 -0000	1.33
+++ frv.c	14 Oct 2003 03:35:06 -0000
@@ -7794,15 +7794,17 @@ frv_adjust_field_align (field, computed)
      tree field;
      int computed;
 {
-  /* C++ provides a null DECL_CONTEXT if the bit field is wider than
its
-     type.  */
-  if (DECL_BIT_FIELD (field) && DECL_CONTEXT (field))
+
+  tree type = TREE_TYPE (field);
+
+  /* Make sure that the bitfield is not wider than the type.  */
+  if (DECL_BIT_FIELD (field)
+      && tree_int_cst_compare (DECL_SIZE (field), TYPE_SIZE (type)) <=
0)
     {
       tree parent = DECL_CONTEXT (field);
       tree prev = NULL_TREE;
       tree cur;
 
-      /* Loop finding the previous field to the current one */
       for (cur = TYPE_FIELDS (parent); cur && cur != field; cur =
TREE_CHAIN (cur))
 	{
 	  if (TREE_CODE (cur) != FIELD_DECL)
@@ -7926,7 +7928,7 @@ frv_hard_regno_mode_ok (regno, mode)
       else
 	{
 	  /* The other registers store one word.  */
-	  if (GPR_P (regno))
+	  if (GPR_P (regno) || regno == AP_FIRST)
 	    base = GPR_FIRST;
 
 	  else if (FPR_P (regno))
@@ -7935,6 +7937,10 @@ frv_hard_regno_mode_ok (regno, mode)
 	  else if (ACC_P (regno))
 	    base = ACC_FIRST;
 
+	  else if (SPR_P (regno))
+	    return mode == SImode;
+
+	  /* Fill in the table. */
 	  else
 	    return 0;
 
Index: frv.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/frv/frv.h,v
retrieving revision 1.29
diff -u -p -w -r1.29 frv.h
--- frv.h	2 Oct 2003 00:44:21 -0000	1.29
+++ frv.h	14 Oct 2003 03:35:07 -0000
@@ -2076,7 +2076,7 @@ struct machine_function GTY(())
    This declaration must be present, but it can be an abort if
profiling is
    not implemented.  */
 
-#define FUNCTION_PROFILER(FILE, LABELNO) abort ()
+#define FUNCTION_PROFILER(FILE, LABELNO)
 
 
 /* Implementing the Varargs Macros.  */
@@ -2522,7 +2522,6 @@ __asm__("\n"								\
 
 /* Short Data Support */
 #define SDATA_SECTION_ASM_OP	"\t.section .sdata,\"aw\""
-#define SBSS_SECTION_ASM_OP	"\t.section .sbss,\"aw\""
 
 /* On svr4, we *do* have support for the .init and .fini sections, and
we
    can put stuff in there to be executed before and after `main'.  We
let
@@ -2553,7 +2552,7 @@ __asm__("\n"								\
    `in_text' and `in_data'.  You need not define this macro
    on a system with no other sections (that GCC needs to use).  */
 #undef  EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_sdata, in_sbss, in_const, in_fixup
+#define EXTRA_SECTIONS in_sdata, in_const, in_fixup
 
 /* One or more functions to be defined in "varasm.c".  These
    functions should do jobs analogous to those of `text_section' and
@@ -2562,7 +2561,6 @@ __asm__("\n"								\
 #undef  EXTRA_SECTION_FUNCTIONS
 #define EXTRA_SECTION_FUNCTIONS                                        
\
 	SDATA_SECTION_FUNCTION						\
-	SBSS_SECTION_FUNCTION						\
 	FIXUP_SECTION_FUNCTION
 
 #define SDATA_SECTION_FUNCTION						\
@@ -2576,17 +2574,6 @@ sdata_section ()							\
     }									\
 }
 
-#define SBSS_SECTION_FUNCTION						\
-void									\
-sbss_section ()								\
-{									\
-  if (in_section != in_sbss)						\
-    {									\
-      fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP);		\
-      in_section = in_sbss;						\
-    }									\
-}
-
 #define FIXUP_SECTION_FUNCTION						\
 void									\
 fixup_section ()							\
@@ -2682,7 +2669,7 @@ extern int size_directive_output;
 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE,
ALIGN)	\
 do {                                                                  
	\
   if ((SIZE) > 0 && (SIZE) <= g_switch_value)				\
-    sbss_section ();                                                 	\
+    named_section (0, ".sbss", 0);                                   
	\
   else                                                                
	\
     bss_section ();                                                  	\
   ASM_OUTPUT_ALIGN (STREAM, floor_log2 ((ALIGN) / BITS_PER_UNIT));    
	\





More information about the Gcc-patches mailing list