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]

Patch to (almost) completly update frv port to use target hooks


The following patch updates the frv port for target hooks.  Currently
the only triplet, frv-unknown-elf, doesn't compile frv.o, I get this
hard error:

 > config/frv/frv.c:788:3: attempt to use poisoned "STRIP_NAME_ENCODING"

I also get various warnings about other obsolete target macros that my
patch fixes:

 > config/frv/frv.c:780: warning: implicit declaration of function `DECL_READONLY_SECTION'
 > config/frv/frv.c:788: warning: implicit declaration of function `STRIP_NAME_ENCODING'
 > config/frv/frv.c:8309: warning: `p' might be used uninitialized in this function
 > config/frv/frv.c:8312: warning: function `STRIP_NAME_ENCODING' was previously declared within a block
 > system.h:604:26: warning: poisoning existing macro "MD_EXPAND_BUILTIN"
 > system.h:604:9: warning: poisoning existing macro "MD_INIT_BUILTINS"
 > system.h:606:24: warning: poisoning existing macro "UNIQUE_SECTION"
 > system.h:606:39: warning: poisoning existing macro "SELECT_SECTION"
 > system.h:606:54: warning: poisoning existing macro "SELECT_RTX_SECTION"
 > system.h:607:29: warning: poisoning existing macro "STRIP_NAME_ENCODING"
 > system.h:607:9: warning: poisoning existing macro "ENCODE_SECTION_INFO"
 > system.h:615:23: warning: poisoning existing macro "EASY_DIV_EXPR"
 > system.h:618:9: warning: poisoning existing macro "SLOW_ZERO_EXTEND"


With my patch I can link cc1, but I still get these two poison
warnings.  I wasn't comfortable converting these macros.

 > system.h:604:44: warning: poisoning existing macro "ASM_OUTPUT_CONSTRUCTOR"
 > system.h:605:9: warning: poisoning existing macro "ASM_OUTPUT_DESTRUCTOR"

Anyway, since this recently contributed port never worked to begin
with, there can't be a regression.  So ok to install on the trunk?

		Thanks,
		--Kaveh


2002-09-04  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* frv-protos.h (frv_init_builtins, frv_expand_builtin,
	frv_select_section, frv_select_rtx_section,
	frv_encode_section_info, frv_unique_section): Delete.
	* frv.c: Update for target hooks.
	* frv.h (STRIP_NAME_ENCODING, SLOW_ZERO_EXTEND, SELECT_SECTION,
	SELECT_RTX_SECTION, ENCODE_SECTION_INFO, UNIQUE_SECTION,
	EASY_DIV_EXPR, MD_INIT_BUILTINS, MD_EXPAND_BUILTIN): Delete.

diff -rup orig/egcc-bib-CVS20020901/gcc/config/frv/frv-protos.h egcc-bib-CVS20020901/gcc/config/frv/frv-protos.h
--- orig/egcc-bib-CVS20020901/gcc/config/frv/frv-protos.h	2002-08-04 15:37:03.000000000 -0400
+++ egcc-bib-CVS20020901/gcc/config/frv/frv-protos.h	2002-09-02 12:44:59.964053309 -0400
@@ -69,9 +69,6 @@ extern rtx frv_legitimize_address		PARAM
 							 enum machine_mode));
 
 #ifdef TREE_CODE
-extern void frv_init_builtins PARAMS ((void));
-extern rtx frv_expand_builtin PARAMS ((tree, rtx, rtx, enum machine_mode, int));
-
 extern void frv_init_cumulative_args		PARAMS ((CUMULATIVE_ARGS *, tree,
 						       rtx, int, int));
 
@@ -174,16 +171,6 @@ extern int frv_register_move_cost	PARAMS
 
 #ifdef TREE_CODE
 extern int frv_adjust_field_align	PARAMS ((tree, int));
-extern void frv_select_section		PARAMS ((tree, int));
-#endif
-
-#ifdef RTX_CODE
-extern void frv_select_rtx_section	PARAMS ((enum machine_mode, rtx));
-#endif
-
-#ifdef TREE_CODE
-extern void frv_encode_section_info	PARAMS ((tree));
-extern void frv_unique_section		PARAMS ((tree, int));
 #endif
 
 extern void fixup_section		PARAMS ((void));
diff -rup orig/egcc-bib-CVS20020901/gcc/config/frv/frv.c egcc-bib-CVS20020901/gcc/config/frv/frv.c
--- orig/egcc-bib-CVS20020901/gcc/config/frv/frv.c	2002-08-04 18:45:22.000000000 -0400
+++ egcc-bib-CVS20020901/gcc/config/frv/frv.c	2002-09-02 13:21:57.453964070 -0400
@@ -274,6 +274,13 @@ static void frv_pack_insns			PARAMS ((vo
 static void frv_function_prologue		PARAMS ((FILE *, HOST_WIDE_INT));
 static void frv_function_epilogue		PARAMS ((FILE *, HOST_WIDE_INT));
 static bool frv_assemble_integer		PARAMS ((rtx, unsigned, int));
+static const char * frv_strip_name_encoding	PARAMS ((const char *));
+static void frv_encode_section_info		PARAMS ((tree, int));
+static void frv_unique_section			PARAMS ((tree, int));
+static void frv_init_builtins			PARAMS ((void));
+static rtx frv_expand_builtin			PARAMS ((tree, rtx, rtx, enum machine_mode, int));
+static void frv_select_section			PARAMS ((tree, int, unsigned HOST_WIDE_INT));
+static void frv_select_rtx_section		PARAMS ((enum machine_mode, rtx, unsigned HOST_WIDE_INT));
 
 /* Initialize the GCC target structure.  */
 #undef  TARGET_ASM_FUNCTION_PROLOGUE
@@ -282,6 +289,20 @@ static bool frv_assemble_integer		PARAMS
 #define TARGET_ASM_FUNCTION_EPILOGUE frv_function_epilogue
 #undef  TARGET_ASM_INTEGER
 #define TARGET_ASM_INTEGER frv_assemble_integer
+#undef  TARGET_STRIP_NAME_ENCODING
+#define TARGET_STRIP_NAME_ENCODING frv_strip_name_encoding
+#undef  TARGET_ENCODE_SECTION_INFO
+#define TARGET_ENCODE_SECTION_INFO frv_encode_section_info
+#undef  TARGET_ASM_UNIQUE_SECTION
+#define TARGET_ASM_UNIQUE_SECTION frv_unique_section
+#undef TARGET_INIT_BUILTINS
+#define TARGET_INIT_BUILTINS frv_init_builtins
+#undef TARGET_EXPAND_BUILTIN
+#define TARGET_EXPAND_BUILTIN frv_expand_builtin
+#undef TARGET_ASM_SELECT_SECTION
+#define TARGET_ASM_SELECT_SECTION frv_select_section
+#undef TARGET_ASM_SELECT_RTX_SECTION
+#define TARGET_ASM_SELECT_RTX_SECTION frv_select_rtx_section
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
@@ -620,10 +641,11 @@ frv_optimization_options (level, size)
 
    Defined in svr4.h.  */
 
-void
-frv_select_section (decl, reloc)
+static void
+frv_select_section (decl, reloc, align)
      tree decl;
      int reloc;
+     unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED;
 {
   int size = int_size_in_bytes (TREE_TYPE (decl));
 
@@ -676,10 +698,11 @@ frv_select_section (decl, reloc)
 
    Defined in svr4.h.  */
 
-void
-frv_select_rtx_section (mode, op)
+static void
+frv_select_rtx_section (mode, op, align)
      enum machine_mode mode;
      rtx op ATTRIBUTE_UNUSED;
+     unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED;
 {
   int size = (int) GET_MODE_SIZE (mode);
   if (size > 0 && size <= g_switch_value)
@@ -713,10 +736,13 @@ frv_string_begins_with (name, prefix)
 
 */
 
-void
-frv_encode_section_info (decl)
+static void
+frv_encode_section_info (decl, first)
      tree decl;
+     int first;
 {
+  if (first)
+    return;
   if (TREE_CODE (decl) == VAR_DECL)
     {
       int size = int_size_in_bytes (TREE_TYPE (decl));
@@ -757,7 +783,7 @@ frv_encode_section_info (decl)
     }
 }
 
-void
+static void
 frv_unique_section (decl, reloc)
      tree decl;
      int reloc;
@@ -767,7 +793,7 @@ frv_unique_section (decl, reloc)
   const char *name;
   char *string;
   const char *prefix;
-  static const char *prefixes[4][2] =
+  static const char *const prefixes[4][2] =
     {
       { ".text.", ".gnu.linkonce.t." },
       { ".rodata.", ".gnu.linkonce.r." },
@@ -777,7 +803,7 @@ frv_unique_section (decl, reloc)
 
   if (TREE_CODE (decl) == FUNCTION_DECL)
     sec = 0;
-  else if (DECL_READONLY_SECTION (decl, reloc))
+  else if (decl_readonly_section (decl, reloc))
     sec = 1;
   else if (SDATA_NAME_P (XSTR (XEXP (DECL_RTL (decl), 0), 0)))
     sec = 3;
@@ -785,7 +811,7 @@ frv_unique_section (decl, reloc)
     sec = 2;
 
   name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-  STRIP_NAME_ENCODING (name, name);
+  name = (* targetm.strip_name_encoding) (name);
   prefix = prefixes[sec][DECL_ONE_ONLY (decl)];
   len = strlen (name) + strlen (prefix);
   string = alloca (len + 1);
@@ -3480,7 +3506,7 @@ frv_regno_ok_for_base_p (regno, strict_p
    with suitable punctuation to prevent any ambiguity.  Allocate the new name
    in `saveable_obstack'.  You will have to modify `ASM_OUTPUT_LABELREF' to
    remove and decode the added text and output the name accordingly, and define
-   `STRIP_NAME_ENCODING' to access the original name string.
+   `(* targetm.strip_name_encoding)' to access the original name string.
 
    You can check the information stored here into the `symbol_ref' in the
    definitions of the macros `GO_IF_LEGITIMATE_ADDRESS' and
@@ -8309,7 +8335,7 @@ frv_assemble_integer (value, size, align
 	      const char *p;
 
 	      ASM_GENERATE_INTERNAL_LABEL (buf, "LCP", label_num++);
-	      STRIP_NAME_ENCODING (p, buf);
+	      p = (* targetm.strip_name_encoding) (buf);
 
 	      fprintf (asm_out_file, "%s:\n", p);
 	      fprintf (asm_out_file, "%s\n", FIXUP_SECTION_ASM_OP);
@@ -9087,7 +9113,7 @@ static struct builtin_description bdesc_
 
 /* Initialize media builtins. */
 
-void
+static void
 frv_init_builtins ()
 {
   tree endlink = void_list_node;
@@ -9706,7 +9732,7 @@ frv_expand_mwtacc_builtin (icode, arglis
 
 /* Expand builtins. */
 
-rtx
+static rtx
 frv_expand_builtin (exp, target, subtarget, mode, ignore)
      tree exp;
      rtx target;
@@ -9854,3 +9880,12 @@ frv_expand_builtin (exp, target, subtarg
     }
   return 0;
 }
+
+static const char *
+frv_strip_name_encoding (str)
+     const char *str;
+{
+  while (*str == '*' || *str == SDATA_FLAG_CHAR)
+    str++;
+  return str;
+}
diff -rup orig/egcc-bib-CVS20020901/gcc/config/frv/frv.h egcc-bib-CVS20020901/gcc/config/frv/frv.h
--- orig/egcc-bib-CVS20020901/gcc/config/frv/frv.h	2002-09-01 22:46:02.000000000 -0400
+++ egcc-bib-CVS20020901/gcc/config/frv/frv.h	2002-09-02 12:47:23.481320500 -0400
@@ -2464,7 +2464,7 @@ __asm__("\n"								\
    with suitable punctuation to prevent any ambiguity.  Allocate the new name
    in `saveable_obstack'.  You will have to modify `ASM_OUTPUT_LABELREF' to
    remove and decode the added text and output the name accordingly, and define
-   `STRIP_NAME_ENCODING' to access the original name string.
+   `(* targetm.strip_name_encoding)' to access the original name string.
 
    You can check the information stored here into the `symbol_ref' in the
    definitions of the macros `GO_IF_LEGITIMATE_ADDRESS' and
@@ -2722,17 +2722,6 @@ __asm__("\n"								\
    same word of the structure, but to different bytes.  */
 #define SLOW_BYTE_ACCESS 1
 
-/* Define this macro if zero-extension (of a `char' or `short' to an `int') can
-   be done faster if the destination is a register that is known to be zero.
-
-   If you define this macro, you must have instruction patterns that recognize
-   RTL structures like this:
-
-        (set (strict_low_part (subreg:QI (reg:SI ...) 0)) ...)
-
-   and likewise for `HImode'.  */
-#define SLOW_ZERO_EXTEND 0
-
 /* Define this macro if it is as good or better to call a constant function
    address than to call an address kept in a register.  */
 #define NO_FUNCTION_CSE
@@ -2837,59 +2826,9 @@ fixup_section ()							\
     }									\
 }									\
 
-/* A C statement or statements to switch to the appropriate section for output
-   of EXP.  You can assume that EXP is either a `VAR_DECL' node or a constant
-   of some sort.  RELOC indicates whether the initial value of EXP requires
-   link-time relocations.  Select the section by calling `text_section' or one
-   of the alternatives for other sections.
-
-   Do not define this macro if you put all read-only variables and constants in
-   the read-only data section (usually the text section).
-
-   Defined in svr4.h.  */
-#undef	SELECT_SECTION
-#define SELECT_SECTION(EXP, RELOC, ALIGN) frv_select_section ((EXP), (RELOC))
-
-/* A C statement or statements to switch to the appropriate section for output
-   of RTX in mode MODE.  You can assume that RTX is some kind of constant in
-   RTL.  The argument MODE is redundant except in the case of a `const_int'
-   rtx.  Select the section by calling `text_section' or one of the
-   alternatives for other sections.
-
-   Do not define this macro if you put all constants in the read-only data
-   section.
-
-   Defined in svr4.h.  */
-#undef	SELECT_RTX_SECTION
-#define SELECT_RTX_SECTION(MODE, RTX, ALIGN) frv_select_rtx_section (MODE, RTX)
-
 #define SDATA_FLAG_CHAR '@'
 
 #define SDATA_NAME_P(NAME) (*(NAME) == SDATA_FLAG_CHAR)
-
-#define ENCODE_SECTION_INFO(DECL, FIRST)	\
-  do						\
-    {						\
-      if (FIRST)				\
-        frv_encode_section_info (DECL);		\
-    }						\
-  while (0)
-
-/* Decode SYM_NAME and store the real name part in VAR, sans
-   the characters that encode section info.  Define this macro if
-   ENCODE_SECTION_INFO alters the symbol's name string.  */
-
-#define STRIP_NAME_ENCODING(VAR, SYMBOL_NAME)			\
-  do								\
-    {								\
-      const char * _name = (SYMBOL_NAME);			\
-								\
-      while (* _name == '*' || * _name == SDATA_FLAG_CHAR)	\
-	_name ++;						\
-      (VAR) = _name;						\
-    }								\
-  while (0)
-
 
 /* Position Independent Code.  */
 
@@ -3366,12 +3305,6 @@ do {                                    
    Defined in svr4.h.  */
 #undef  PREFERRED_DEBUGGING_TYPE
 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
-
-/* This version of UNIQUE_SECTION overrides the one in elfos.h.  We
-   need to check whether DECL is destined for the .sdata section.  */
-
-#undef  UNIQUE_SECTION
-#define UNIQUE_SECTION(DECL,RELOC) frv_unique_section (DECL, RELOC)
 
 /* Miscellaneous Parameters.  */
 
@@ -3494,14 +3427,6 @@ do {                                    
 /* Define if loading short immediate values into registers sign extends.  */
 #define SHORT_IMMEDIATES_SIGN_EXTEND
 
-/* An alias for a tree code that is the easiest kind of division to compile
-   code for in the general case.  It may be `TRUNC_DIV_EXPR', `FLOOR_DIV_EXPR',
-   `CEIL_DIV_EXPR' or `ROUND_DIV_EXPR'.  These four division operators differ
-   in how they round the result to an integer.  `EASY_DIV_EXPR' is used when it
-   is permissible to use any of those kinds of division and the choice should
-   be made on the basis of efficiency.  */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
 /* The maximum number of bytes that a single instruction can move quickly from
    memory to memory.  */
 #define MOVE_MAX 8
@@ -3726,13 +3651,6 @@ enum frv_builtins
   FRV_BUILTIN_MHDSETH
 };
 
-#define MD_INIT_BUILTINS do { \
-    frv_init_builtins (); \
-  } while (0)
-
-#define MD_EXPAND_BUILTIN(EXP, TARGET, SUBTARGET, MODE, IGNORE) \
-    frv_expand_builtin ((EXP), (TARGET), (SUBTARGET), (MODE), (IGNORE))
-
 /* Enable prototypes on the call rtl functions.  */
 #define MD_CALL_PROTOTYPES 1
 


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