diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-05-16 21:49:36 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-05-16 21:49:36 +0000 |
commit | 02b2818cfeffc3709b01ae5a2475d6f94eacb056 (patch) | |
tree | b941299e1cca65763fc24db9b4af875a72897cdf /gcc/cgraph.c | |
parent | 95773d67b14432080d189b6c182f1625ac4d2cf6 (diff) | |
download | gcc-02b2818cfeffc3709b01ae5a2475d6f94eacb056.tar.gz |
* cgraph.c (cgraph_clone_node): Take decl argument and insert
clone into hash when it is different from orig.
(cgraph_create_virtual_clone): Update use of cgraph_clone_node.
* cgraph.h (cgraph_clone_node): Update prototype.
* lto-cgrpah.c (lto_cgraph_encoder_new): Create body map.
(lto_cgraph_encoder_delete): Delete body map.
(lto_cgraph_encoder_size): Move to header.
(lto_cgraph_encoder_encode_body_p, lto_set_cgraph_encoder_encode_body): New.
(lto_output_node): Do not take written_decls argument; output clone_of
pointer.
(add_node_to): Add include_body_argument; call
lto_set_cgraph_encoder_encode_body on master of the clone.
(add_references): Update use of add_node_to.
(compute_ltrans_boundary): Likewise.
(output_cgraph): Do not create written_decls bitmap.
(input_node): Take nodes argument; stream in clone_of correctly.
(input_cgraph_1): Update use of input_node.
* lto-streamer-out.c (lto_output): Use encoder info to decide
what bodies to output.
* ipa-inline.c (cgraph_clone_inlined_nodes,
cgraph_decide_recursive_inlining): Update call of cgraph_clone_node.
* lto-streamer.h (lto_cgraph_encoder_d): Add body.
(lto_cgraph_encoder_size): Define here.
(lto_cgraph_encoder_encode_body_p, lto_varpool_encoder_encode_body_p):
Declare.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159466 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 82ce0e804a6..6e30ec1435d 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -2051,7 +2051,7 @@ cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n, function's profile to reflect the fact that part of execution is handled by node. */ struct cgraph_node * -cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq, +cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq, int loop_nest, bool update_original, VEC(cgraph_edge_p,heap) *redirect_callers) { @@ -2060,7 +2060,7 @@ cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq, gcov_type count_scale; unsigned i; - new_node->decl = n->decl; + new_node->decl = decl; new_node->origin = n->origin; if (new_node->origin) { @@ -2118,6 +2118,24 @@ cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq, new_node->clone_of = n; cgraph_call_node_duplication_hooks (n, new_node); + if (n->decl != decl) + { + struct cgraph_node **slot; + slot = (struct cgraph_node **) htab_find_slot (cgraph_hash, new_node, INSERT); + gcc_assert (!*slot); + *slot = new_node; + if (assembler_name_hash) + { + void **aslot; + tree name = DECL_ASSEMBLER_NAME (decl); + + aslot = htab_find_slot_with_hash (assembler_name_hash, name, + decl_assembler_name_hash (name), + INSERT); + gcc_assert (!*aslot); + *aslot = new_node; + } + } return new_node; } @@ -2159,7 +2177,6 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node, tree old_decl = old_node->decl; struct cgraph_node *new_node = NULL; tree new_decl; - struct cgraph_node key, **slot; size_t i; struct ipa_replace_map *map; @@ -2177,10 +2194,9 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node, SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl)); SET_DECL_RTL (new_decl, NULL); - new_node = cgraph_clone_node (old_node, old_node->count, + new_node = cgraph_clone_node (old_node, new_decl, old_node->count, CGRAPH_FREQ_BASE, 0, false, redirect_callers); - new_node->decl = new_decl; /* Update the properties. Make clone visible only within this translation unit. Make sure that is not weak also. @@ -2243,21 +2259,6 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node, new_node->lowered = true; new_node->reachable = true; - key.decl = new_decl; - slot = (struct cgraph_node **) htab_find_slot (cgraph_hash, &key, INSERT); - gcc_assert (!*slot); - *slot = new_node; - if (assembler_name_hash) - { - void **aslot; - tree name = DECL_ASSEMBLER_NAME (new_decl); - - aslot = htab_find_slot_with_hash (assembler_name_hash, name, - decl_assembler_name_hash (name), - INSERT); - gcc_assert (!*aslot); - *aslot = new_node; - } return new_node; } |