Mercurial > hg > CbC > CbC_gcc
diff gcc/cgraphbuild.c @ 67:f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author | nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Mar 2011 17:18:12 +0900 |
parents | b7f97abdc517 |
children | 04ced10e8804 |
line wrap: on
line diff
--- a/gcc/cgraphbuild.c Tue May 25 18:58:51 2010 +0900 +++ b/gcc/cgraphbuild.c Tue Mar 22 17:18:12 2011 +0900 @@ -1,5 +1,5 @@ /* Callgraph construction. - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Jan Hubicka @@ -141,6 +141,11 @@ { eh_region i; + if (DECL_FUNCTION_PERSONALITY (node->decl)) + ipa_record_reference (node, NULL, + cgraph_node (DECL_FUNCTION_PERSONALITY (node->decl)), + NULL, IPA_REF_ADDR, NULL); + i = fun->eh->region_tree; if (!i) return; @@ -234,9 +239,9 @@ /* Mark address taken in STMT. */ static bool -mark_address (gimple stmt ATTRIBUTE_UNUSED, tree addr, - void *data ATTRIBUTE_UNUSED) +mark_address (gimple stmt, tree addr, void *data) { + addr = get_base_address (addr); if (TREE_CODE (addr) == FUNCTION_DECL) { struct cgraph_node *node = cgraph_node (addr); @@ -245,24 +250,20 @@ node, NULL, IPA_REF_ADDR, stmt); } - else + else if (addr && TREE_CODE (addr) == VAR_DECL + && (TREE_STATIC (addr) || DECL_EXTERNAL (addr))) { - addr = get_base_address (addr); - if (addr && TREE_CODE (addr) == VAR_DECL - && (TREE_STATIC (addr) || DECL_EXTERNAL (addr))) - { - struct varpool_node *vnode = varpool_node (addr); - int walk_subtrees; + struct varpool_node *vnode = varpool_node (addr); + int walk_subtrees; - if (lang_hooks.callgraph.analyze_expr) - lang_hooks.callgraph.analyze_expr (&addr, &walk_subtrees); - varpool_mark_needed_node (vnode); - if (vnode->alias && vnode->extra_name) - vnode = vnode->extra_name; - ipa_record_reference ((struct cgraph_node *)data, NULL, - NULL, vnode, - IPA_REF_ADDR, stmt); - } + if (lang_hooks.callgraph.analyze_expr) + lang_hooks.callgraph.analyze_expr (&addr, &walk_subtrees); + varpool_mark_needed_node (vnode); + if (vnode->alias && vnode->extra_name) + vnode = vnode->extra_name; + ipa_record_reference ((struct cgraph_node *)data, NULL, + NULL, vnode, + IPA_REF_ADDR, stmt); } return false; @@ -271,12 +272,21 @@ /* Mark load of T. */ static bool -mark_load (gimple stmt ATTRIBUTE_UNUSED, tree t, - void *data ATTRIBUTE_UNUSED) +mark_load (gimple stmt, tree t, void *data) { t = get_base_address (t); - if (TREE_CODE (t) == VAR_DECL - && (TREE_STATIC (t) || DECL_EXTERNAL (t))) + if (t && TREE_CODE (t) == FUNCTION_DECL) + { + /* ??? This can happen on platforms with descriptors when these are + directly manipulated in the code. Pretend that it's an address. */ + struct cgraph_node *node = cgraph_node (t); + cgraph_mark_address_taken_node (node); + ipa_record_reference ((struct cgraph_node *)data, NULL, + node, NULL, + IPA_REF_ADDR, stmt); + } + else if (t && TREE_CODE (t) == VAR_DECL + && (TREE_STATIC (t) || DECL_EXTERNAL (t))) { struct varpool_node *vnode = varpool_node (t); int walk_subtrees; @@ -296,11 +306,10 @@ /* Mark store of T. */ static bool -mark_store (gimple stmt ATTRIBUTE_UNUSED, tree t, - void *data ATTRIBUTE_UNUSED) +mark_store (gimple stmt, tree t, void *data) { t = get_base_address (t); - if (TREE_CODE (t) == VAR_DECL + if (t && TREE_CODE (t) == VAR_DECL && (TREE_STATIC (t) || DECL_EXTERNAL (t))) { struct varpool_node *vnode = varpool_node (t); @@ -313,7 +322,7 @@ vnode = vnode->extra_name; ipa_record_reference ((struct cgraph_node *)data, NULL, NULL, vnode, - IPA_REF_STORE, NULL); + IPA_REF_STORE, stmt); } return false; } @@ -328,7 +337,8 @@ struct cgraph_node *node = cgraph_node (current_function_decl); struct pointer_set_t *visited_nodes = pointer_set_create (); gimple_stmt_iterator gsi; - tree step; + tree decl; + unsigned ix; /* Create the callgraph edges and record the nodes referenced by the function. body. */ @@ -360,16 +370,19 @@ && gimple_omp_parallel_child_fn (stmt)) { tree fn = gimple_omp_parallel_child_fn (stmt); - cgraph_mark_needed_node (cgraph_node (fn)); + ipa_record_reference (node, NULL, cgraph_node (fn), + NULL, IPA_REF_ADDR, stmt); } if (gimple_code (stmt) == GIMPLE_OMP_TASK) { tree fn = gimple_omp_task_child_fn (stmt); if (fn) - cgraph_mark_needed_node (cgraph_node (fn)); + ipa_record_reference (node, NULL, cgraph_node (fn), + NULL, IPA_REF_ADDR, stmt); fn = gimple_omp_task_copy_fn (stmt); if (fn) - cgraph_mark_needed_node (cgraph_node (fn)); + ipa_record_reference (node, NULL, cgraph_node (fn), + NULL, IPA_REF_ADDR, stmt); } } for (gsi = gsi_start (phi_nodes (bb)); !gsi_end_p (gsi); gsi_next (&gsi)) @@ -378,15 +391,10 @@ } /* Look for initializers of constant variables and private statics. */ - for (step = cfun->local_decls; - step; - step = TREE_CHAIN (step)) - { - tree decl = TREE_VALUE (step); - if (TREE_CODE (decl) == VAR_DECL - && (TREE_STATIC (decl) && !DECL_EXTERNAL (decl))) - varpool_finalize_decl (decl); - } + FOR_EACH_LOCAL_DECL (cfun, ix, decl) + if (TREE_CODE (decl) == VAR_DECL + && (TREE_STATIC (decl) && !DECL_EXTERNAL (decl))) + varpool_finalize_decl (decl); record_eh_tables (node, cfun); pointer_set_destroy (visited_nodes); @@ -522,7 +530,7 @@ NULL, /* sub */ NULL, /* next */ 0, /* static_pass_number */ - TV_NONE, /* tv_id */ + TV_CGRAPH, /* tv_id */ PROP_cfg, /* properties_required */ 0, /* properties_provided */ 0, /* properties_destroyed */