diff options
author | Richard Henderson <rth@redhat.com> | 2003-05-14 10:44:01 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2003-05-14 10:44:01 -0700 |
commit | 2adb9af1f88f1454435e8469cbc3c523ab5db42f (patch) | |
tree | cfb46ce49ae7e84da0f5bc6e3bd2c4d3571b6089 /gcc/varasm.c | |
parent | bb84cb12fb14b902e94788f37fa967eef29584df (diff) | |
download | gcc-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
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 32 |
1 files changed, 18 insertions, 14 deletions
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; |