rtl.h (TREE_CONSTANT_POOL_ADDRESS_P): Rename from DEFERRED_CONSTANT_P.
authorRichard Henderson <rth@redhat.com>
Wed, 14 May 2003 17:44:01 +0000 (10:44 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 14 May 2003 17:44:01 +0000 (10:44 -0700)
        * rtl.h (TREE_CONSTANT_POOL_ADDRESS_P): Rename from
        DEFERRED_CONSTANT_P.
        * integrate.c (copy_rtx_and_substitute): Update use.
        * varasm.c (build_constant_desc): Set SYMBOL_REF_DECL
        to the copy generated.
        (maybe_output_constant_def_contents): Examine TREE_ASM_WRITTEN
        of the constant to see if we should emit.
        (mark_constant): Similarly.
        (output_constant_def_contents): Set TREE_ASM_WRITTEN.

From-SVN: r66807

gcc/ChangeLog
gcc/integrate.c
gcc/rtl.h
gcc/varasm.c

index 2de7e1e449d2943e1da1fd1d1d0b4bd6ff64ef8b..0d42be6c71d9992cb47181f2bb45aae96977278d 100644 (file)
@@ -1,3 +1,15 @@
+2003-05-14  Richard Henderson  <rth@redhat.com>
+
+       * rtl.h (TREE_CONSTANT_POOL_ADDRESS_P): Rename from
+       DEFERRED_CONSTANT_P.
+       * integrate.c (copy_rtx_and_substitute): Update use.
+       * varasm.c (build_constant_desc): Set SYMBOL_REF_DECL
+       to the copy generated.
+       (maybe_output_constant_def_contents): Examine TREE_ASM_WRITTEN
+       of the constant to see if we should emit.
+       (mark_constant): Similarly.
+       (output_constant_def_contents): Set TREE_ASM_WRITTEN.
+
 2003-05-14  David Edelsohn  <edelsohn@gnu.org>
 
        * config/rs6000/rs6000.md (movsi_internal2): Use compare for self
index c150dcbd709ef309ac9e2ce09961b7e32af3601c..4f31c79fa2d938b6bff71e3b4ad2f366819ee711 100644 (file)
@@ -2215,7 +2215,7 @@ copy_rtx_and_substitute (orig, map, for_lhs)
                          copy_rtx_and_substitute (constant, map, for_lhs)),
                         0);
        }
-      else if (DEFERRED_CONSTANT_P (orig) && inlining)
+      else if (TREE_CONSTANT_POOL_ADDRESS_P (orig) && inlining)
        notice_rtl_inlining_of_deferred_constant ();
 
       return orig;
index 431b0dd4daffebeba39b7776d7715d68a72ce12d..77b1f38fc28ca8186b87ba243302880de392bf99 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1230,15 +1230,16 @@ do {                                            \
 #define COND_EXEC_TEST(RTX) XCEXP (RTX, 0, COND_EXEC)
 #define COND_EXEC_CODE(RTX) XCEXP (RTX, 1, COND_EXEC)
 
-/* 1 if RTX is a symbol_ref that addresses this function's constants pool.  */
+/* 1 if RTX is a symbol_ref that addresses this function's rtl
+   constants pool.  */
 #define CONSTANT_POOL_ADDRESS_P(RTX)                                   \
   (RTL_FLAG_CHECK1("CONSTANT_POOL_ADDRESS_P", (RTX), SYMBOL_REF)->unchanging)
 
-/* 1 if RTX is a symbol_ref that addresses a value in the file's constant
-   pool which has not yet been output.  This information is private to
-   varasm.c.  */
-#define DEFERRED_CONSTANT_P(RTX)                                       \
-  (RTL_FLAG_CHECK1("DEFERRED_CONSTANT_P", (RTX), SYMBOL_REF)->frame_related)
+/* 1 if RTX is a symbol_ref that addresses a value in the file's
+   tree constant pool.  This information is private to varasm.c.  */
+#define TREE_CONSTANT_POOL_ADDRESS_P(RTX)                              \
+  (RTL_FLAG_CHECK1("TREE_CONSTANT_POOL_ADDRESS_P",                     \
+                  (RTX), SYMBOL_REF)->frame_related)
 
 /* Used if RTX is a symbol_ref, for machine-specific purposes.  */
 #define SYMBOL_REF_FLAG(RTX)                                           \
index 811aa388d036006284bab782f72986ee33db1677..6bd8d73ec9871d81b95c7477caaa4947a01232a8 100644 (file)
@@ -2535,7 +2535,8 @@ build_constant_desc (exp)
   /* We have a symbol name; construct the SYMBOL_REF and the MEM.  */
   symbol = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (label));
   SYMBOL_REF_FLAGS (symbol) = SYMBOL_FLAG_LOCAL;
-  SYMBOL_REF_DECL (symbol) = exp;
+  SYMBOL_REF_DECL (symbol) = desc->value;
+  TREE_CONSTANT_POOL_ADDRESS_P (symbol) = 1;
 
   rtl = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (exp)), symbol);
   set_mem_attributes (rtl, exp, 1);
@@ -2550,12 +2551,6 @@ build_constant_desc (exp)
 
   (*targetm.encode_section_info) (exp, rtl, true);
 
-  /* Descriptors start out deferred; this simplifies the logic in
-     maybe_output_constant_def_contents.  However, we do not bump
-     n_deferred_constants here, because we don't know if we're inside
-     a function and have an n_deferred_constants to bump.  */
-  DEFERRED_CONSTANT_P (XEXP (rtl, 0)) = 1;
-
   desc->rtl = rtl;
 
   return desc;
@@ -2607,19 +2602,24 @@ maybe_output_constant_def_contents (desc, defer)
      int defer;
 {
   rtx symbol = XEXP (desc->rtl, 0);
+  tree exp = desc->value;
 
   if (flag_syntax_only)
     return;
 
-  if (!DEFERRED_CONSTANT_P (symbol))
+  if (TREE_ASM_WRITTEN (exp))
     /* Already output; don't do it again.  */
     return;
 
   /* The only constants that cannot safely be deferred, assuming the
      context allows it, are strings under flag_writable_strings.  */
-  if (defer && (TREE_CODE (desc->value) != STRING_CST
-               || !flag_writable_strings))
+  if (defer && (TREE_CODE (exp) != STRING_CST || !flag_writable_strings))
     {
+      /* Increment n_deferred_constants if it exists.  It needs to be at
+        least as large as the number of constants actually referred to
+        by the function.  If it's too small we'll stop looking too early
+        and fail to emit constants; if it's too large we'll only look
+        through the entire function when we could have stopped earlier.  */
       if (cfun)
        n_deferred_constants++;
       return;
@@ -2648,7 +2648,7 @@ output_constant_def_contents (symbol)
 #endif
 
   /* We are no longer deferring this constant.  */
-  DEFERRED_CONSTANT_P (symbol) = 0;
+  TREE_ASM_WRITTEN (exp) = 1;
 
   if (IN_NAMED_SECTION (exp))
     named_section (exp, NULL, reloc);
@@ -3481,10 +3481,14 @@ mark_constant (current_rtx, data)
          else
            return -1;
        }
-      else if (DEFERRED_CONSTANT_P (x))
+      else if (TREE_CONSTANT_POOL_ADDRESS_P (x))
        {
-         n_deferred_constants--;
-         output_constant_def_contents (x);
+         tree exp = SYMBOL_REF_DECL (x);
+         if (!TREE_ASM_WRITTEN (exp))
+           {
+             n_deferred_constants--;
+             output_constant_def_contents (x);
+           }
        }
     }
   return 0;