diff options
author | aaw <aaw@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-09-29 03:47:05 +0000 |
---|---|---|
committer | aaw <aaw@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-09-29 03:47:05 +0000 |
commit | 1fab06aaf36ca06985faf4a832f50a6de6eeab58 (patch) | |
tree | 117f5e7112f351b5d67c496778a7e3a085dcdc1b /gcc/varasm.c | |
parent | dfa26c6cc44dc1bb920d5209a45289a8c4566ea0 (diff) | |
download | gcc-1fab06aaf36ca06985faf4a832f50a6de6eeab58.tar.gz |
Revert
2007-09-27 Ollie Wild <aaw@google.com>
gcc/
* varasm.c (compare_constant): Removed call to
lang_hooks.expand_constant.
(copy_constants): Removed call to lang_hooks.expand_constant.
(compute_reloc_for_constant): Removed call to
lang_hooks.expand_constant.
(output_addressed_constants): Removed call to
lang_hooks.expand_constant.
(constructor_static_from_elts_p): Removed call to
lang_hooks.expand_constant.
(output_constant): Removed calls to lang_hooks.expand_constant.
* langhooks.h (struct lang_hooks): Removed field expand_constant.
* langhooks-def.h (lhd_return_tree): Removed.
(LANG_HOOKS_EXPAND_CONSTANT): Removed.
(LANG_HOOKS_INITIALIZER): Removed LANG_HOOKS_EXPAND_CONSTANT.
* langhooks.c (lhd_return_tree): Removed.
gcc/cp/
* typeck2.c (digest_init): Call cplus_expand_constant after
convert_for_initialization.
* cp-objcp-common.h (LANG_HOOKS_EXPAND_CONSTANT): Removed.
* expr.c (cplus_expand_constant): Updated function description.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128881 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index e85824577f6..9dece23fefe 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -2985,7 +2985,15 @@ compare_constant (const tree t1, const tree t2) return compare_constant (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0)); default: - return 0; + { + tree nt1, nt2; + nt1 = lang_hooks.expand_constant (t1); + nt2 = lang_hooks.expand_constant (t2); + if (nt1 != t1 || nt2 != t2) + return compare_constant (nt1, nt2); + else + return 0; + } } gcc_unreachable (); @@ -3053,7 +3061,12 @@ copy_constant (tree exp) } default: - gcc_unreachable (); + { + tree t = lang_hooks.expand_constant (exp); + + gcc_assert (t != exp); + return copy_constant (t); + } } } @@ -3897,6 +3910,10 @@ compute_reloc_for_constant (tree exp) int reloc = 0, reloc2; tree tem; + /* Give the front-end a chance to convert VALUE to something that + looks more like a constant to the back-end. */ + exp = lang_hooks.expand_constant (exp); + switch (TREE_CODE (exp)) { case ADDR_EXPR: @@ -3961,6 +3978,10 @@ output_addressed_constants (tree exp) { tree tem; + /* Give the front-end a chance to convert VALUE to something that + looks more like a constant to the back-end. */ + exp = lang_hooks.expand_constant (exp); + switch (TREE_CODE (exp)) { case ADDR_EXPR: @@ -4034,6 +4055,10 @@ constructor_static_from_elts_p (const_tree ctor) tree initializer_constant_valid_p (tree value, tree endtype) { + /* Give the front-end a chance to convert VALUE to something that + looks more like a constant to the back-end. */ + value = lang_hooks.expand_constant (value); + switch (TREE_CODE (value)) { case CONSTRUCTOR: @@ -4292,6 +4317,11 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align) enum tree_code code; unsigned HOST_WIDE_INT thissize; + /* Some front-ends use constants other than the standard language-independent + varieties, but which may still be output directly. Give the front-end a + chance to convert EXP to a language-independent representation. */ + exp = lang_hooks.expand_constant (exp); + if (size == 0 || flag_syntax_only) return; @@ -4348,6 +4378,9 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align) code = TREE_CODE (TREE_TYPE (exp)); thissize = int_size_in_bytes (TREE_TYPE (exp)); + /* Give the front end another chance to expand constants. */ + exp = lang_hooks.expand_constant (exp); + /* Allow a constructor with no elements for any data type. This means to fill the space with zeros. */ if (TREE_CODE (exp) == CONSTRUCTOR |