Commit 78bd9046 by Alexandre Oliva Committed by Alexandre Oliva

dwarf2asm.c (dw2_force_const_mem): Defer creation of declarations for constants until...

* dwarf2asm.c (dw2_force_const_mem): Defer creation of
declarations for constants until...
(dw2_output_indirect_constant_1): ... this point.

From-SVN: r148160
parent 4cbc7f7a
2009-06-04 Alexandre Oliva <aoliva@redhat.com>
* dwarf2asm.c (dw2_force_const_mem): Defer creation of
declarations for constants until...
(dw2_output_indirect_constant_1): ... this point.
2009-06-04 Richard Earnshaw <rearnsha@arm.com> 2009-06-04 Richard Earnshaw <rearnsha@arm.com>
PR target/10242 PR target/10242
......
...@@ -809,7 +809,7 @@ dw2_force_const_mem (rtx x, bool is_public) ...@@ -809,7 +809,7 @@ dw2_force_const_mem (rtx x, bool is_public)
{ {
splay_tree_node node; splay_tree_node node;
const char *key; const char *key;
tree decl; tree decl_id;
if (! indirect_pool) if (! indirect_pool)
/* We use strcmp, rather than just comparing pointers, so that the /* We use strcmp, rather than just comparing pointers, so that the
...@@ -821,7 +821,7 @@ dw2_force_const_mem (rtx x, bool is_public) ...@@ -821,7 +821,7 @@ dw2_force_const_mem (rtx x, bool is_public)
key = XSTR (x, 0); key = XSTR (x, 0);
node = splay_tree_lookup (indirect_pool, (splay_tree_key) key); node = splay_tree_lookup (indirect_pool, (splay_tree_key) key);
if (node) if (node)
decl = (tree) node->value; decl_id = (tree) node->value;
else else
{ {
tree id; tree id;
...@@ -832,13 +832,9 @@ dw2_force_const_mem (rtx x, bool is_public) ...@@ -832,13 +832,9 @@ dw2_force_const_mem (rtx x, bool is_public)
char *ref_name = XALLOCAVEC (char, strlen (str) + sizeof "DW.ref."); char *ref_name = XALLOCAVEC (char, strlen (str) + sizeof "DW.ref.");
sprintf (ref_name, "DW.ref.%s", str); sprintf (ref_name, "DW.ref.%s", str);
id = get_identifier (ref_name); gcc_assert (!maybe_get_identifier (ref_name));
decl = build_decl (VAR_DECL, id, ptr_type_node); decl_id = get_identifier (ref_name);
DECL_ARTIFICIAL (decl) = 1; TREE_PUBLIC (decl_id) = 1;
DECL_IGNORED_P (decl) = 1;
TREE_PUBLIC (decl) = 1;
DECL_INITIAL (decl) = decl;
make_decl_one_only (decl);
} }
else else
{ {
...@@ -846,12 +842,8 @@ dw2_force_const_mem (rtx x, bool is_public) ...@@ -846,12 +842,8 @@ dw2_force_const_mem (rtx x, bool is_public)
ASM_GENERATE_INTERNAL_LABEL (label, "LDFCM", dw2_const_labelno); ASM_GENERATE_INTERNAL_LABEL (label, "LDFCM", dw2_const_labelno);
++dw2_const_labelno; ++dw2_const_labelno;
id = get_identifier (label); gcc_assert (!maybe_get_identifier (label));
decl = build_decl (VAR_DECL, id, ptr_type_node); decl_id = get_identifier (label);
DECL_ARTIFICIAL (decl) = 1;
DECL_IGNORED_P (decl) = 1;
TREE_STATIC (decl) = 1;
DECL_INITIAL (decl) = decl;
} }
id = maybe_get_identifier (str); id = maybe_get_identifier (str);
...@@ -859,10 +851,10 @@ dw2_force_const_mem (rtx x, bool is_public) ...@@ -859,10 +851,10 @@ dw2_force_const_mem (rtx x, bool is_public)
TREE_SYMBOL_REFERENCED (id) = 1; TREE_SYMBOL_REFERENCED (id) = 1;
splay_tree_insert (indirect_pool, (splay_tree_key) key, splay_tree_insert (indirect_pool, (splay_tree_key) key,
(splay_tree_value) decl); (splay_tree_value) decl_id);
} }
return XEXP (DECL_RTL (decl), 0); return gen_rtx_SYMBOL_REF (Pmode, IDENTIFIER_POINTER (decl_id));
} }
/* A helper function for dw2_output_indirect_constants called through /* A helper function for dw2_output_indirect_constants called through
...@@ -874,10 +866,24 @@ dw2_output_indirect_constant_1 (splay_tree_node node, ...@@ -874,10 +866,24 @@ dw2_output_indirect_constant_1 (splay_tree_node node,
{ {
const char *sym; const char *sym;
rtx sym_ref; rtx sym_ref;
tree decl; tree id, decl;
sym = (const char *) node->key; sym = (const char *) node->key;
decl = (tree) node->value; id = (tree) node->value;
decl = build_decl (VAR_DECL, id, ptr_type_node);
DECL_ARTIFICIAL (decl) = 1;
DECL_IGNORED_P (decl) = 1;
DECL_INITIAL (decl) = decl;
if (TREE_PUBLIC (id))
{
TREE_PUBLIC (decl) = 1;
make_decl_one_only (decl);
}
else
TREE_STATIC (decl) = 1;
sym_ref = gen_rtx_SYMBOL_REF (Pmode, sym); sym_ref = gen_rtx_SYMBOL_REF (Pmode, sym);
sym = targetm.strip_name_encoding (sym); sym = targetm.strip_name_encoding (sym);
if (TREE_PUBLIC (decl) && USE_LINKONCE_INDIRECT) if (TREE_PUBLIC (decl) && USE_LINKONCE_INDIRECT)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment