aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2003-05-14 10:44:01 -0700
committerRichard Henderson <rth@gcc.gnu.org>2003-05-14 10:44:01 -0700
commit2adb9af1f88f1454435e8469cbc3c523ab5db42f (patch)
treecfb46ce49ae7e84da0f5bc6e3bd2c4d3571b6089
parentbb84cb12fb14b902e94788f37fa967eef29584df (diff)
downloadgcc-2adb9af1f88f1454435e8469cbc3c523ab5db42f.zip
gcc-2adb9af1f88f1454435e8469cbc3c523ab5db42f.tar.gz
gcc-2adb9af1f88f1454435e8469cbc3c523ab5db42f.tar.bz2
rtl.h (TREE_CONSTANT_POOL_ADDRESS_P): Rename from DEFERRED_CONSTANT_P.
* 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
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/integrate.c2
-rw-r--r--gcc/rtl.h13
-rw-r--r--gcc/varasm.c32
4 files changed, 38 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2de7e1e..0d42be6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/integrate.c b/gcc/integrate.c
index c150dcb..4f31c79 100644
--- a/gcc/integrate.c
+++ b/gcc/integrate.c
@@ -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;
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 431b0dd..77b1f38 100644
--- 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) \
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 811aa38..6bd8d73 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -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;