aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index e858245..9dece23 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