i370 symbol_ref_flags usage

Richard Henderson rth@twiddle.net
Thu Apr 17 07:36:00 GMT 2003


Work around a bug in the front ends, in their setting of DECL_EXTERNAL.
Fix a typo in the makefile fragment.
Remove 11 more lines of code.


r~


        * varasm.c (default_encode_section_info): Don't set 
        SYMBOL_FLAG_EXTERNAL if not TREE_PUBLIC.
        * config/i370/i370.c (i370_encode_section_info): Remove.
        * config/i370/i370.h (CONSTANT_ADDRESS_P): Use SYMBOL_REF_EXTERNAL_P.
        (PRINT_OPERAND, PRINT_OPERAND_ADDRESS): Likewise.
        * config/i370/i370.md (movsi): Likewise.

        * config/i370/t-i370: Add missing backslash.

Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.339
diff -c -p -d -u -r1.339 varasm.c
--- varasm.c	15 Apr 2003 20:57:06 -0000	1.339
+++ varasm.c	17 Apr 2003 07:30:21 -0000
@@ -5371,7 +5371,10 @@ default_encode_section_info (decl, first
     flags |= SYMBOL_FLAG_SMALL;
   if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL (decl))
     flags |= decl_tls_model (decl) << SYMBOL_FLAG_TLS_SHIFT;
-  if (DECL_P (decl) && DECL_EXTERNAL (decl))
+  /* ??? Why is DECL_EXTERNAL ever set for non-PUBLIC names?  Without
+     being PUBLIC, the thing *must* be defined in this translation unit.
+     Prevent this buglet from being propagated into rtl code as well.  */
+  if (DECL_P (decl) && DECL_EXTERNAL (decl) && TREE_PUBLIC (decl))
     flags |= SYMBOL_FLAG_EXTERNAL;
 
   SYMBOL_REF_FLAGS (symbol) = flags;
Index: config/i370/i370.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i370/i370.c,v
retrieving revision 1.32
diff -c -p -d -u -r1.32 i370.c
--- config/i370/i370.c	28 Jan 2003 04:46:25 -0000	1.32
+++ config/i370/i370.c	17 Apr 2003 07:30:22 -0000
@@ -110,7 +110,6 @@ static void i370_output_function_epilogu
 #ifdef LONGEXTERNAL
 static int mvs_hash_alias PARAMS ((const char *));
 #endif
-static void i370_encode_section_info PARAMS ((tree, int));
 static void i370_internal_label PARAMS ((FILE *, const char *, unsigned long));
 static bool i370_rtx_costs PARAMS ((rtx, int, int, int *));
 
@@ -314,8 +313,6 @@ static const unsigned char ebcasc[256] =
 #define TARGET_ASM_FUNCTION_PROLOGUE i370_output_function_prologue
 #undef TARGET_ASM_FUNCTION_EPILOGUE
 #define TARGET_ASM_FUNCTION_EPILOGUE i370_output_function_epilogue
-#undef TARGET_ENCODE_SECTION_INFO
-#define TARGET_ENCODE_SECTION_INFO i370_encode_section_info
 #undef TARGET_ASM_INTERNAL_LABEL
 #define  TARGET_ASM_INTERNAL_LABEL i370_internal_label
 #undef TARGET_RTX_COSTS
@@ -1592,17 +1589,6 @@ i370_output_function_epilogue (file, l)
   mvs_free_label_list();
   for (i = function_base_page; i < mvs_page_num; i++)
     fprintf (file, "\tDC\tA(PG%d)\n", i);
-}
-
-/* Mark external references.  */
-
-static void
-i370_encode_section_info (decl, first)
-     tree decl;
-     int first ATTRIBUTE_UNUSED;
-{
-  if (DECL_EXTERNAL (decl) && TREE_PUBLIC (decl))
-    SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
 }
 
 static void
Index: config/i370/i370.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i370/i370.h,v
retrieving revision 1.56
diff -c -p -d -u -r1.56 i370.h
--- config/i370/i370.h	28 Jan 2003 04:46:25 -0000	1.56
+++ config/i370/i370.h	17 Apr 2003 07:30:22 -0000
@@ -700,7 +700,7 @@ enum reg_class
 	  && GET_CODE (XEXP (XEXP (X, 0), 0)) == LABEL_REF)		\
   || (GET_CODE (X) == CONST						\
 	  && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF		\
-	  && !SYMBOL_REF_FLAG (XEXP (XEXP (X, 0), 0))))
+	  && !SYMBOL_REF_EXTERNAL_P (XEXP (XEXP (X, 0), 0))))
 
 /* Nonzero if the constant value X is a legitimate general operand.
    It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
@@ -1266,7 +1266,7 @@ enum reg_class
       case SYMBOL_REF:							\
       case LABEL_REF:							\
 	mvs_page_lit += 4;						\
-	if (SYMBOL_REF_FLAG (XV)) fprintf (FILE, "=V(");		\
+	if (SYMBOL_REF_EXTERNAL_P (XV)) fprintf (FILE, "=V(");		\
 	else                      fprintf (FILE, "=A(");		\
 	output_addr_const (FILE, XV);					\
 	fprintf (FILE, ")");						\
@@ -1356,7 +1356,7 @@ enum reg_class
 	   && GET_CODE (XEXP (XEXP (XV, 0), 0)) == SYMBOL_REF)		\
 	  {								\
 	    mvs_page_lit += 4;						\
-	    if (SYMBOL_REF_FLAG (XEXP (XEXP (XV, 0), 0)))		\
+	    if (SYMBOL_REF_EXTERNAL_P (XEXP (XEXP (XV, 0), 0)))		\
 	      {								\
 		fprintf (FILE, "=V(");					\
 		ASM_OUTPUT_LABELREF (FILE,				\
@@ -1467,7 +1467,7 @@ enum reg_class
 	break;								\
       default:								\
 	mvs_page_lit += 4;						\
-	if (SYMBOL_REF_FLAG (ADDR)) fprintf (FILE, "=V(");		\
+	if (SYMBOL_REF_EXTERNAL_P (ADDR)) fprintf (FILE, "=V(");	\
 	else                        fprintf (FILE, "=A(");		\
 	output_addr_const (FILE, ADDR);					\
 	fprintf (FILE, ")");						\
@@ -1560,7 +1560,7 @@ enum reg_class
       case SYMBOL_REF:							\
       case LABEL_REF:							\
 	mvs_page_lit += 4;						\
-        if (SYMBOL_REF_FLAG (XV)) fprintf (FILE, "=V(");                \
+        if (SYMBOL_REF_EXTERNAL_P (XV)) fprintf (FILE, "=V(");		\
         else                      fprintf (FILE, "=A(");                \
         output_addr_const (FILE, XV);                                   \
         fprintf (FILE, ")");                                            \
@@ -1650,7 +1650,7 @@ enum reg_class
 	   && GET_CODE (XEXP (XEXP (XV, 0), 0)) == SYMBOL_REF)		\
 	  {								\
 	    mvs_page_lit += 4;						\
-	    if (SYMBOL_REF_FLAG (XEXP (XEXP (XV, 0), 0)))		\
+	    if (SYMBOL_REF_EXTERNAL_P (XEXP (XEXP (XV, 0), 0)))		\
 	      {								\
 		fprintf (FILE, "=V(");					\
 		ASM_OUTPUT_LABELREF (FILE,				\
@@ -1765,7 +1765,7 @@ abort(); \
 	break;								\
       default:								\
 	mvs_page_lit += 4;						\
-	if (SYMBOL_REF_FLAG (ADDR)) fprintf (FILE, "=V(");		\
+	if (SYMBOL_REF_EXTERNAL_P (ADDR)) fprintf (FILE, "=V(");	\
 	else                        fprintf (FILE, "=A(");		\
 	output_addr_const (FILE, ADDR);					\
 	fprintf (FILE, ")");						\
Index: config/i370/i370.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i370/i370.md,v
retrieving revision 1.20
diff -c -p -d -u -r1.20 i370.md
--- config/i370/i370.md	20 Jan 2002 23:48:11 -0000	1.20
+++ config/i370/i370.md	17 Apr 2003 07:30:22 -0000
@@ -855,7 +855,7 @@ check_label_emit ();
 ;  op0 = operands[0];
 ;  if (GET_CODE (op0) == CONST
 ;      && GET_CODE (XEXP (XEXP (op0, 0), 0)) == SYMBOL_REF
-;      && SYMBOL_REF_FLAG (XEXP (XEXP (op0, 0), 0)))
+;      && SYMBOL_REF_EXTERNAL_P (XEXP (XEXP (op0, 0), 0)))
 ;    {
 ;      op0 = gen_rtx_MEM (SImode, copy_to_mode_reg (SImode, XEXP (op0, 0)));
 ;    }
@@ -863,7 +863,7 @@ check_label_emit ();
 ;  op1 = operands[1];
 ;  if (GET_CODE (op1) == CONST
 ;      && GET_CODE (XEXP (XEXP (op1, 0), 0)) == SYMBOL_REF
-;      && SYMBOL_REF_FLAG (XEXP (XEXP (op1, 0), 0)))
+;      && SYMBOL_REF_EXTERNAL_P (XEXP (XEXP (op1, 0), 0)))
 ;    {
 ;      op1 = gen_rtx_MEM (SImode, copy_to_mode_reg (SImode, XEXP (op1, 0)));
 ;    }
Index: config/i370/t-i370
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i370/t-i370,v
retrieving revision 1.7
diff -c -p -d -u -r1.7 t-i370
--- config/i370/t-i370	16 Dec 2002 18:21:16 -0000	1.7
+++ config/i370/t-i370	17 Apr 2003 07:30:22 -0000
@@ -1,3 +1,3 @@
-i370-c.o: $(srcdir)/config/i370/i370-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h
+i370-c.o: $(srcdir)/config/i370/i370-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
   $(TM_H) $(TREE_H) toplev.h $(CPPLIB_H) c-pragma.h $(TM_P_H)
 	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/i370/i370-c.c



More information about the Gcc-patches mailing list