From 7bfefa9d2c82e804ef4e59772f4060ac325bf99a Mon Sep 17 00:00:00 2001 From: dnovillo Date: Sat, 3 Oct 2009 21:10:11 +0000 Subject: Merge lto branch into trunk. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152434 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cgraphbuild.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'gcc/cgraphbuild.c') diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index a7a8bd2b314..d61def279ad 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -78,6 +78,29 @@ record_reference (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) return NULL_TREE; } +/* Reset inlining information of all incoming call edges of NODE. */ + +void +reset_inline_failed (struct cgraph_node *node) +{ + struct cgraph_edge *e; + + for (e = node->callers; e; e = e->next_caller) + { + e->callee->global.inlined_to = NULL; + if (!node->analyzed) + e->inline_failed = CIF_BODY_NOT_AVAILABLE; + else if (node->local.redefined_extern_inline) + e->inline_failed = CIF_REDEFINED_EXTERN_INLINE; + else if (!node->local.inlinable) + e->inline_failed = CIF_FUNCTION_NOT_INLINABLE; + else if (e->call_stmt_cannot_inline_p) + e->inline_failed = CIF_MISMATCHED_ARGUMENTS; + else + e->inline_failed = CIF_FUNCTION_NOT_CONSIDERED; + } +} + /* Computes the frequency of the call statement so that it can be stored in cgraph_edge. BB is the basic block of the call statement. */ int -- cgit v1.2.1 From 85276fc74c8268b26cdd13f6607fbe0f9fff681f Mon Sep 17 00:00:00 2001 From: meissner Date: Thu, 8 Oct 2009 18:52:57 +0000 Subject: Fix 41626 from Jan Hubicka git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152569 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cgraphbuild.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'gcc/cgraphbuild.c') diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index d61def279ad..65e3d67e14c 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -33,13 +33,16 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" /* Walk tree and record all calls and references to functions/variables. - Called via walk_tree: TP is pointer to tree to be examined. */ + Called via walk_tree: TP is pointer to tree to be examined. + When DATA is non-null, record references to callgraph. + */ static tree -record_reference (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) +record_reference (tree *tp, int *walk_subtrees, void *data) { tree t = *tp; tree decl; + bool do_callgraph = data != NULL; switch (TREE_CODE (t)) { @@ -57,7 +60,7 @@ record_reference (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) /* Record dereferences to the functions. This makes the functions reachable unconditionally. */ decl = TREE_OPERAND (*tp, 0); - if (TREE_CODE (decl) == FUNCTION_DECL) + if (TREE_CODE (decl) == FUNCTION_DECL && do_callgraph) cgraph_mark_address_taken_node (cgraph_node (decl)); break; @@ -218,13 +221,15 @@ struct gimple_opt_pass pass_build_cgraph_edges = }; /* Record references to functions and other variables present in the - initial value of DECL, a variable. */ + initial value of DECL, a variable. + When ONLY_VARS is true, we mark needed only variables, not functions. */ void -record_references_in_initializer (tree decl) +record_references_in_initializer (tree decl, bool only_vars) { struct pointer_set_t *visited_nodes = pointer_set_create (); - walk_tree (&DECL_INITIAL (decl), record_reference, NULL, visited_nodes); + walk_tree (&DECL_INITIAL (decl), record_reference, + only_vars ? NULL : decl, visited_nodes); pointer_set_destroy (visited_nodes); } -- cgit v1.2.1 From 0c297edc21c4ab6f2129cc25ed52772ad2f79a7b Mon Sep 17 00:00:00 2001 From: amylaar Date: Sun, 8 Nov 2009 21:10:08 +0000 Subject: * cfgrtl.c (pass_free_cfg): Add pass name. * cgraphbuild.c (pass_build_cgraph_edges): Likewise. (pass_rebuild_cgraph_edges, pass_remove_cgraph_callee_edges): Likewise. * dce.c (pass_ud_rtl_dce, pass_fast_rtl_dce): Change pass name. * df-core.c (pass_df_initialize_no_opt): Likewise. * except.c (pass_rtl_eh): Likewise. * function.c (pass_init_function, pass_leaf_regs): Likewise. * gcse.c (pass_rtl_pre): Change pass name. * passes.c (pass_postreload): Add pass name. (make_pass_instance): Don't use duplicate-tracking logic for names starting with '*'. (next_pass_1): Assert that pass has a name. (register_one_dump_file): If there is an space in the name, skip past it. * predict.c (pass_strip_predict_hints): Add pass name. * reg-stack.c (pass_stack_regs): Likewise. * stack-ptr-mod.c (pass_stack_ptr_mod): Likewise. * tree-cfg.c (pass_warn_function_return, pass_warn_function_noreturn): Add pass name. * tree-dfa.c (pass_referenced_vars): Likewise. * tree-optimize.c (pass_cleanup_cfg_post_optimizing): Fix whitespace before comment. (pass_fixup_cfg): Add pass name, fix whitespace before comment. (pass_init_datastructures): Add pass name. * tree-ssa-loop.c (pass_record_bounds): Likewise. * tree-ssa.c (pass_early_warn_uninitialized, pass_late_warn_uninitialized): Likewise. * tree.c (pass_ipa_free_lang_data): Likewise. * doc/passes.texi (pass manager): Document how to disambiguate pass names. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154013 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cgraphbuild.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/cgraphbuild.c') diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index 65e3d67e14c..8423c36b880 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -205,7 +205,7 @@ struct gimple_opt_pass pass_build_cgraph_edges = { { GIMPLE_PASS, - NULL, /* name */ + "*build_cgraph_edges", /* name */ NULL, /* gate */ build_cgraph_edges, /* execute */ NULL, /* sub */ @@ -270,7 +270,7 @@ struct gimple_opt_pass pass_rebuild_cgraph_edges = { { GIMPLE_PASS, - NULL, /* name */ + "*rebuild_cgraph_edges", /* name */ NULL, /* gate */ rebuild_cgraph_edges, /* execute */ NULL, /* sub */ @@ -297,7 +297,7 @@ struct gimple_opt_pass pass_remove_cgraph_callee_edges = { { GIMPLE_PASS, - NULL, /* name */ + "*remove_cgraph_callee_edges", /* name */ NULL, /* gate */ remove_cgraph_callee_edges, /* execute */ NULL, /* sub */ -- cgit v1.2.1 From e2d3f42272e712ce0bda8583066fdf858041ce77 Mon Sep 17 00:00:00 2001 From: hubicka Date: Mon, 16 Nov 2009 16:06:29 +0000 Subject: * cgraphbuild.c (compute_call_stmt_bb_frequency): Use proper ENTRY_BLOCK_PTR. * cgraph.c (cgraph_clone_edge): Avoid freq_scale 0 to completely zero out all callees. * cgraphunit.c (verify_cgraph_node): Verify cgraph nodes for frequency and count match. * ipa-inline.c (update_noncloned_frequencies): New function. (cgraph_clone_inlined_nodes): Use it. * tree-inline.c (copy_bb): Fix frequency scaling; output diagnostic on frequency mismatches to dump file. (initialize_cfun): Do not scale frequency; fix count scaling; initialize entry and exit block frequencies; copy profile info. (copy_cfg_body): Use frequency_scale as argument; fix count scaling. (copy_body): Use frequency_scale as argument. (expand_call_inline): Compute frequency scale and output diagnostic to dump file. (delete_unreachable_blocks_update_callgrah): Remove checking that has to be done after edge redirection. (tree_function_versioning): Update initialize_cfun and copy_body call. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154205 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cgraphbuild.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/cgraphbuild.c') diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index 8423c36b880..0c3bff2f90e 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -109,7 +109,8 @@ reset_inline_failed (struct cgraph_node *node) int compute_call_stmt_bb_frequency (tree decl, basic_block bb) { - int entry_freq = ENTRY_BLOCK_PTR->frequency; + int entry_freq = ENTRY_BLOCK_PTR_FOR_FUNCTION + (DECL_STRUCT_FUNCTION (decl))->frequency; int freq = bb->frequency; if (profile_status_for_function (DECL_STRUCT_FUNCTION (decl)) == PROFILE_ABSENT) -- cgit v1.2.1 From 48e1416a24d50cacbb2a5e06a9ee61dd8cbee313 Mon Sep 17 00:00:00 2001 From: hjl Date: Wed, 25 Nov 2009 10:55:54 +0000 Subject: Remove trailing white spaces. 2009-11-25 H.J. Lu * alias.c: Remove trailing white spaces. * alloc-pool.c: Likewise. * alloc-pool.h: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * builtins.def: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfglayout.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cif-code.def: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbgcnt.def: Likewise. * dbgcnt.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * ddg.h: Likewise. * defaults.h: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * df.h: Likewise. * dfp.c: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * double-int.h: Likewise. * dse.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2asm.h: Likewise. * dwarf2out.c: Likewise. * ebitmap.c: Likewise. * ebitmap.h: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcov-dump.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genchecksum.c: Likewise. * genconfig.c: Likewise. * genflags.c: Likewise. * gengtype-parse.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genmddeps.c: Likewise. * genmodes.c: Likewise. * genopinit.c: Likewise. * genpreds.c: Likewise. * gensupport.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * ggc.h: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple.c: Likewise. * gimple.def: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graphds.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * gthr-nks.h: Likewise. * gthr-posix.c: Likewise. * gthr-posix.h: Likewise. * gthr-posix95.h: Likewise. * gthr-single.h: Likewise. * gthr-tpf.h: Likewise. * gthr-vxworks.h: Likewise. * gthr.h: Likewise. * haifa-sched.c: Likewise. * hard-reg-set.h: Likewise. * hooks.c: Likewise. * hooks.h: Likewise. * hosthooks.h: Likewise. * hwint.h: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * integrate.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lambda-code.c: Likewise. * lambda-mat.c: Likewise. * lambda-trans.c: Likewise. * lambda.h: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * libgcov.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * lto-wpa-fixup.c: Likewise. * matrix-reorg.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omega.h: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts-common.c: Likewise. * opts.c: Likewise. * params.def: Likewise. * params.h: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * predict.def: Likewise. * pretty-print.c: Likewise. * pretty-print.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sbitmap.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-int.h: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sel-sched.h: Likewise. * sese.c: Likewise. * sese.h: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * stub-objc.c: Likewise. * sync-builtins.def: Likewise. * target-def.h: Likewise. * target.h: Likewise. * targhooks.c: Likewise. * targhooks.h: Likewise. * timevar.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tracer.c: Likewise. * tree-affine.c: Likewise. * tree-affine.h: Likewise. * tree-browser.def: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-dump.h: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-nomudflap.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * treestruct.def: Likewise. * unwind-compat.c: Likewise. * unwind-dw2-fde-glibc.c: Likewise. * unwind-dw2.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vec.c: Likewise. * vec.h: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154645 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cgraphbuild.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/cgraphbuild.c') diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index 0c3bff2f90e..bcc66c0eecd 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" /* Walk tree and record all calls and references to functions/variables. - Called via walk_tree: TP is pointer to tree to be examined. + Called via walk_tree: TP is pointer to tree to be examined. When DATA is non-null, record references to callgraph. */ @@ -222,14 +222,14 @@ struct gimple_opt_pass pass_build_cgraph_edges = }; /* Record references to functions and other variables present in the - initial value of DECL, a variable. + initial value of DECL, a variable. When ONLY_VARS is true, we mark needed only variables, not functions. */ void record_references_in_initializer (tree decl, bool only_vars) { struct pointer_set_t *visited_nodes = pointer_set_create (); - walk_tree (&DECL_INITIAL (decl), record_reference, + walk_tree (&DECL_INITIAL (decl), record_reference, only_vars ? NULL : decl, visited_nodes); pointer_set_destroy (visited_nodes); } -- cgit v1.2.1 From 63b0bea7f5af509ae68aa64919da34dfc7223727 Mon Sep 17 00:00:00 2001 From: hubicka Date: Tue, 4 May 2010 15:42:15 +0000 Subject: * Makefile.in (cgraphbuild.o): Add dependency on ipa-utils.h * cgraphbuild.c: Include ipa-utils.h (record_reference_ctx): New struct. (record_reference): Simplify to work on initializers; not statements. (mark_address, mark_load, mark_store): New. (build_cgraph_edges): Simplify using walk_stmt_load_store_addr_ops; walk PHI nodes too. (record_references_in_initializer): Update use of record_reference. (rebuild_cgraph_edges): Simplify using walk_stmt_load_store_addr_ops; walk PHI nodes too. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159032 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cgraphbuild.c | 210 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 145 insertions(+), 65 deletions(-) (limited to 'gcc/cgraphbuild.c') diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index bcc66c0eecd..02c373aa299 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -31,6 +31,13 @@ along with GCC; see the file COPYING3. If not see #include "intl.h" #include "gimple.h" #include "tree-pass.h" +#include "ipa-utils.h" + +/* Context of record_reference. */ +struct record_reference_ctx +{ + bool only_vars; +}; /* Walk tree and record all calls and references to functions/variables. Called via walk_tree: TP is pointer to tree to be examined. @@ -42,26 +49,31 @@ record_reference (tree *tp, int *walk_subtrees, void *data) { tree t = *tp; tree decl; - bool do_callgraph = data != NULL; + struct record_reference_ctx *ctx = (struct record_reference_ctx *)data; switch (TREE_CODE (t)) { case VAR_DECL: - if (TREE_STATIC (t) || DECL_EXTERNAL (t)) - { - varpool_mark_needed_node (varpool_node (t)); - if (lang_hooks.callgraph.analyze_expr) - return lang_hooks.callgraph.analyze_expr (tp, walk_subtrees); - } + case FUNCTION_DECL: + gcc_unreachable (); break; case FDESC_EXPR: case ADDR_EXPR: /* Record dereferences to the functions. This makes the functions reachable unconditionally. */ - decl = TREE_OPERAND (*tp, 0); - if (TREE_CODE (decl) == FUNCTION_DECL && do_callgraph) + decl = get_base_var (*tp); + if (TREE_CODE (decl) == FUNCTION_DECL && !ctx->only_vars) cgraph_mark_address_taken_node (cgraph_node (decl)); + + if (TREE_CODE (decl) == VAR_DECL) + { + gcc_assert (TREE_STATIC (decl) || DECL_EXTERNAL (decl)); + if (lang_hooks.callgraph.analyze_expr) + lang_hooks.callgraph.analyze_expr (&decl, walk_subtrees); + varpool_mark_needed_node (varpool_node (decl)); + } + *walk_subtrees = 0; break; default: @@ -126,6 +138,75 @@ compute_call_stmt_bb_frequency (tree decl, basic_block bb) return freq; } +/* Mark address taken in STMT. */ + +static bool +mark_address (gimple stmt ATTRIBUTE_UNUSED, tree addr, + void *data ATTRIBUTE_UNUSED) +{ + if (TREE_CODE (addr) == FUNCTION_DECL) + { + struct cgraph_node *node = cgraph_node (addr); + cgraph_mark_address_taken_node (node); + } + else + { + 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; + + if (lang_hooks.callgraph.analyze_expr) + lang_hooks.callgraph.analyze_expr (&addr, &walk_subtrees); + varpool_mark_needed_node (vnode); + } + } + + return false; +} + +/* Mark load of T. */ + +static bool +mark_load (gimple stmt ATTRIBUTE_UNUSED, tree t, + void *data ATTRIBUTE_UNUSED) +{ + t = get_base_address (t); + if (TREE_CODE (t) == VAR_DECL + && (TREE_STATIC (t) || DECL_EXTERNAL (t))) + { + struct varpool_node *vnode = varpool_node (t); + int walk_subtrees; + + if (lang_hooks.callgraph.analyze_expr) + lang_hooks.callgraph.analyze_expr (&t, &walk_subtrees); + varpool_mark_needed_node (vnode); + } + return false; +} + +/* Mark store of T. */ + +static bool +mark_store (gimple stmt ATTRIBUTE_UNUSED, tree t, + void *data ATTRIBUTE_UNUSED) +{ + t = get_base_address (t); + if (TREE_CODE (t) == VAR_DECL + && (TREE_STATIC (t) || DECL_EXTERNAL (t))) + { + struct varpool_node *vnode = varpool_node (t); + int walk_subtrees; + + if (lang_hooks.callgraph.analyze_expr) + lang_hooks.callgraph.analyze_expr (&t, &walk_subtrees); + varpool_mark_needed_node (vnode); + } + return false; +} + /* Create cgraph edges for function calls. Also look for functions and variables having addresses taken. */ @@ -141,49 +222,40 @@ build_cgraph_edges (void) /* Create the callgraph edges and record the nodes referenced by the function. body. */ FOR_EACH_BB (bb) - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - { - gimple stmt = gsi_stmt (gsi); - tree decl; - - if (is_gimple_call (stmt) && (decl = gimple_call_fndecl (stmt))) - { - size_t i; - size_t n = gimple_call_num_args (stmt); + { + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple stmt = gsi_stmt (gsi); + tree decl; + + if (is_gimple_call (stmt) && (decl = gimple_call_fndecl (stmt))) cgraph_create_edge (node, cgraph_node (decl), stmt, - bb->count, compute_call_stmt_bb_frequency (current_function_decl, bb), + bb->count, + compute_call_stmt_bb_frequency + (current_function_decl, bb), bb->loop_depth); - for (i = 0; i < n; i++) - walk_tree (gimple_call_arg_ptr (stmt, i), record_reference, - node, visited_nodes); - if (gimple_call_lhs (stmt)) - walk_tree (gimple_call_lhs_ptr (stmt), record_reference, node, - visited_nodes); - } - else - { - struct walk_stmt_info wi; - memset (&wi, 0, sizeof (wi)); - wi.info = node; - wi.pset = visited_nodes; - walk_gimple_op (stmt, record_reference, &wi); - if (gimple_code (stmt) == GIMPLE_OMP_PARALLEL - && gimple_omp_parallel_child_fn (stmt)) - { - tree fn = gimple_omp_parallel_child_fn (stmt); + walk_stmt_load_store_addr_ops (stmt, node, mark_load, + mark_store, mark_address); + if (gimple_code (stmt) == GIMPLE_OMP_PARALLEL + && gimple_omp_parallel_child_fn (stmt)) + { + tree fn = gimple_omp_parallel_child_fn (stmt); + cgraph_mark_needed_node (cgraph_node (fn)); + } + if (gimple_code (stmt) == GIMPLE_OMP_TASK) + { + tree fn = gimple_omp_task_child_fn (stmt); + if (fn) + cgraph_mark_needed_node (cgraph_node (fn)); + fn = gimple_omp_task_copy_fn (stmt); + if (fn) cgraph_mark_needed_node (cgraph_node (fn)); - } - if (gimple_code (stmt) == GIMPLE_OMP_TASK) - { - tree fn = gimple_omp_task_child_fn (stmt); - if (fn) - cgraph_mark_needed_node (cgraph_node (fn)); - fn = gimple_omp_task_copy_fn (stmt); - if (fn) - cgraph_mark_needed_node (cgraph_node (fn)); - } - } - } + } + } + for (gsi = gsi_start (phi_nodes (bb)); !gsi_end_p (gsi); gsi_next (&gsi)) + walk_stmt_load_store_addr_ops (gsi_stmt (gsi), node, + mark_load, mark_store, mark_address); + } /* Look for initializers of constant variables and private statics. */ for (step = cfun->local_decls; @@ -194,8 +266,6 @@ build_cgraph_edges (void) if (TREE_CODE (decl) == VAR_DECL && (TREE_STATIC (decl) && !DECL_EXTERNAL (decl))) varpool_finalize_decl (decl); - else if (TREE_CODE (decl) == VAR_DECL && DECL_INITIAL (decl)) - walk_tree (&DECL_INITIAL (decl), record_reference, node, visited_nodes); } pointer_set_destroy (visited_nodes); @@ -229,8 +299,11 @@ void record_references_in_initializer (tree decl, bool only_vars) { struct pointer_set_t *visited_nodes = pointer_set_create (); + struct record_reference_ctx ctx = {false}; + + ctx.only_vars = only_vars; walk_tree (&DECL_INITIAL (decl), record_reference, - only_vars ? NULL : decl, visited_nodes); + &ctx, visited_nodes); pointer_set_destroy (visited_nodes); } @@ -249,19 +322,26 @@ rebuild_cgraph_edges (void) node->count = ENTRY_BLOCK_PTR->count; FOR_EACH_BB (bb) - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - { - gimple stmt = gsi_stmt (gsi); - tree decl; - - if (is_gimple_call (stmt) && (decl = gimple_call_fndecl (stmt))) - cgraph_create_edge (node, cgraph_node (decl), stmt, - bb->count, - compute_call_stmt_bb_frequency - (current_function_decl, bb), - bb->loop_depth); - - } + { + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple stmt = gsi_stmt (gsi); + tree decl; + + if (is_gimple_call (stmt) && (decl = gimple_call_fndecl (stmt))) + cgraph_create_edge (node, cgraph_node (decl), stmt, + bb->count, + compute_call_stmt_bb_frequency + (current_function_decl, bb), + bb->loop_depth); + walk_stmt_load_store_addr_ops (stmt, node, mark_load, + mark_store, mark_address); + + } + for (gsi = gsi_start (phi_nodes (bb)); !gsi_end_p (gsi); gsi_next (&gsi)) + walk_stmt_load_store_addr_ops (gsi_stmt (gsi), node, + mark_load, mark_store, mark_address); + } gcc_assert (!node->global.inlined_to); return 0; -- cgit v1.2.1 From 8d8103295d80e9ef11e5eee58cb3e29e1709f299 Mon Sep 17 00:00:00 2001 From: hubicka Date: Thu, 6 May 2010 08:39:32 +0000 Subject: * cgraphbuild.c (record_reference_ctx): Add varpool_node. (record_reference, mark_address, mark_load, mark_store): Record references. (record_references_in_initializer): Update call of record_references. (rebuild_cgraph_edges): Remove all references before rebuiding. * cgraph.c (cgraph_create_node): Clear ref list. (cgraph_remove_node): Remove references. (dump_cgraph_node): Dump references. (cgraph_clone_node): Clone references. * cgraph.h: Include ipa-ref.h and ipa-ref-inline.h (struct cgraph_node, varpool_node): Add ref_lst. * ipa-ref.c: New file. * ipa-ref.h: New file. * ipa-ref-inline.h: New file. * lto-cgraph.c (output_varpool): Take cgrag node set argument. (referenced_from_other_partition_p): New function. (lto_output_varpool_node): Take set arugment; call referenced_from_other_partition. (lto_output_ref): New. (add_references): New. (output_refs): New. (output_cgraph): Compute boundary based on references; output refs. (output_varpool): Accept cgraph_node_set argument. (input_ref): New. (input_refs): New. (input_cgraph): Call input_refs. * lto-section-in.c (lto_section_name): Add refs. * Makefile.in: (cgraph.h): Include ipa-ref.h and ipa-ref-inline.h (ipa-ref.o): New file. * varpool.c (varpool_node): Clear ipa ref list. (varpool_remove_node): Remove references. (dump_varpool_node): Dump references. (varpool_assemble_decl): Only compile finalized ones. (varpool_extra_name_alias): Initialize ref list. * lto-streamer.c (lto-get_section_name): Add .refs section. * lto-streamer.h (lto_section_type): Add LTO_section_refs. (referenced_from_other_partition_p): Declared. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159097 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cgraphbuild.c | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) (limited to 'gcc/cgraphbuild.c') diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index 02c373aa299..ec190c7211c 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see struct record_reference_ctx { bool only_vars; + struct varpool_node *varpool_node; }; /* Walk tree and record all calls and references to functions/variables. @@ -63,15 +64,26 @@ record_reference (tree *tp, int *walk_subtrees, void *data) /* Record dereferences to the functions. This makes the functions reachable unconditionally. */ decl = get_base_var (*tp); - if (TREE_CODE (decl) == FUNCTION_DECL && !ctx->only_vars) - cgraph_mark_address_taken_node (cgraph_node (decl)); + if (TREE_CODE (decl) == FUNCTION_DECL) + { + if (!ctx->only_vars) + cgraph_mark_address_taken_node (cgraph_node (decl)); + ipa_record_reference (NULL, ctx->varpool_node, + cgraph_node (decl), NULL, + IPA_REF_ADDR, NULL); + } if (TREE_CODE (decl) == VAR_DECL) { - gcc_assert (TREE_STATIC (decl) || DECL_EXTERNAL (decl)); + struct varpool_node *vnode = varpool_node (decl); if (lang_hooks.callgraph.analyze_expr) lang_hooks.callgraph.analyze_expr (&decl, walk_subtrees); - varpool_mark_needed_node (varpool_node (decl)); + varpool_mark_needed_node (vnode); + if (vnode->alias && vnode->extra_name) + vnode = vnode->extra_name; + ipa_record_reference (NULL, ctx->varpool_node, + NULL, vnode, + IPA_REF_ADDR, NULL); } *walk_subtrees = 0; break; @@ -148,6 +160,9 @@ mark_address (gimple stmt ATTRIBUTE_UNUSED, tree addr, { struct cgraph_node *node = cgraph_node (addr); cgraph_mark_address_taken_node (node); + ipa_record_reference ((struct cgraph_node *)data, NULL, + node, NULL, + IPA_REF_ADDR, stmt); } else { @@ -161,6 +176,11 @@ mark_address (gimple stmt ATTRIBUTE_UNUSED, tree addr, 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); } } @@ -183,6 +203,11 @@ mark_load (gimple stmt ATTRIBUTE_UNUSED, tree t, if (lang_hooks.callgraph.analyze_expr) lang_hooks.callgraph.analyze_expr (&t, &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_LOAD, stmt); } return false; } @@ -203,6 +228,11 @@ mark_store (gimple stmt ATTRIBUTE_UNUSED, tree t, if (lang_hooks.callgraph.analyze_expr) lang_hooks.callgraph.analyze_expr (&t, &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_STORE, NULL); } return false; } @@ -299,8 +329,10 @@ void record_references_in_initializer (tree decl, bool only_vars) { struct pointer_set_t *visited_nodes = pointer_set_create (); - struct record_reference_ctx ctx = {false}; + struct varpool_node *node = varpool_node (decl); + struct record_reference_ctx ctx = {false, NULL}; + ctx.varpool_node = node; ctx.only_vars = only_vars; walk_tree (&DECL_INITIAL (decl), record_reference, &ctx, visited_nodes); @@ -318,6 +350,7 @@ rebuild_cgraph_edges (void) gimple_stmt_iterator gsi; cgraph_node_remove_callees (node); + ipa_remove_all_references (&node->ref_list); node->count = ENTRY_BLOCK_PTR->count; -- cgit v1.2.1 From 122217458886bdc3d5be91b21f593eaab20a6a3f Mon Sep 17 00:00:00 2001 From: hubicka Date: Mon, 10 May 2010 16:00:40 +0000 Subject: * Makefile.in (cgraphbuild.o): Add dependency on except.h. * cgraphbuild.c: Include except.h (record_type_list, record_eh_tables): New function. (build_cgraph_edges, rebuild_cgraph_edges): Use it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159229 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cgraphbuild.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) (limited to 'gcc/cgraphbuild.c') diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index ec190c7211c..246be20df2e 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple.h" #include "tree-pass.h" #include "ipa-utils.h" +#include "except.h" /* Context of record_reference. */ struct record_reference_ctx @@ -105,6 +106,86 @@ record_reference (tree *tp, int *walk_subtrees, void *data) return NULL_TREE; } +/* Record references to typeinfos in the type list LIST. */ + +static void +record_type_list (struct cgraph_node *node, tree list) +{ + for (; list; list = TREE_CHAIN (list)) + { + tree type = TREE_VALUE (list); + + if (TYPE_P (type)) + type = lookup_type_for_runtime (type); + STRIP_NOPS (type); + if (TREE_CODE (type) == ADDR_EXPR) + { + type = TREE_OPERAND (type, 0); + if (TREE_CODE (type) == VAR_DECL) + { + struct varpool_node *vnode = varpool_node (type); + varpool_mark_needed_node (vnode); + ipa_record_reference (node, NULL, + NULL, vnode, + IPA_REF_ADDR, NULL); + } + } + } +} + +/* Record all references we will introduce by producing EH tables + for NODE. */ + +static void +record_eh_tables (struct cgraph_node *node, struct function *fun) +{ + eh_region i; + + i = fun->eh->region_tree; + if (!i) + return; + + while (1) + { + switch (i->type) + { + case ERT_CLEANUP: + case ERT_MUST_NOT_THROW: + break; + + case ERT_TRY: + { + eh_catch c; + for (c = i->u.eh_try.first_catch; c; c = c->next_catch) + record_type_list (node, c->type_list); + } + break; + + case ERT_ALLOWED_EXCEPTIONS: + record_type_list (node, i->u.allowed.type_list); + break; + } + /* If there are sub-regions, process them. */ + if (i->inner) + i = i->inner; + /* If there are peers, process them. */ + else if (i->next_peer) + i = i->next_peer; + /* Otherwise, step back up the tree to the next peer. */ + else + { + do + { + i = i->outer; + if (i == NULL) + return; + } + while (i->next_peer == NULL); + i = i->next_peer; + } + } +} + /* Reset inlining information of all incoming call edges of NODE. */ void @@ -297,6 +378,7 @@ build_cgraph_edges (void) && (TREE_STATIC (decl) && !DECL_EXTERNAL (decl))) varpool_finalize_decl (decl); } + record_eh_tables (node, cfun); pointer_set_destroy (visited_nodes); return 0; @@ -375,6 +457,7 @@ rebuild_cgraph_edges (void) walk_stmt_load_store_addr_ops (gsi_stmt (gsi), node, mark_load, mark_store, mark_address); } + record_eh_tables (node, cfun); gcc_assert (!node->global.inlined_to); return 0; -- cgit v1.2.1 From ea7e866e878831ed073b7160e8b5707676abba2e Mon Sep 17 00:00:00 2001 From: hubicka Date: Tue, 11 May 2010 08:14:50 +0000 Subject: * cgraphbuild.c (cgraph_rebuild_references): New. (cgraph_mark_reachable_node): Accept references to optimized out extern inlines. * cgraph.h (cgraph_rebuild_references): Declare. * tree-inline.c (tree_function_versioning): Use it. * ipa-struct-reorg.c (do_reorg_for_func): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159259 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cgraphbuild.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'gcc/cgraphbuild.c') diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index 246be20df2e..b09963d1c04 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -463,6 +463,37 @@ rebuild_cgraph_edges (void) return 0; } +/* Rebuild cgraph edges for current function node. This needs to be run after + passes that don't update the cgraph. */ + +void +cgraph_rebuild_references (void) +{ + basic_block bb; + struct cgraph_node *node = cgraph_node (current_function_decl); + gimple_stmt_iterator gsi; + + ipa_remove_all_references (&node->ref_list); + + node->count = ENTRY_BLOCK_PTR->count; + + FOR_EACH_BB (bb) + { + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple stmt = gsi_stmt (gsi); + + walk_stmt_load_store_addr_ops (stmt, node, mark_load, + mark_store, mark_address); + + } + for (gsi = gsi_start (phi_nodes (bb)); !gsi_end_p (gsi); gsi_next (&gsi)) + walk_stmt_load_store_addr_ops (gsi_stmt (gsi), node, + mark_load, mark_store, mark_address); + } + record_eh_tables (node, cfun); +} + struct gimple_opt_pass pass_rebuild_cgraph_edges = { { -- cgit v1.2.1 From f8b7e3ec43723c9f6bd4213794a33d6c57046103 Mon Sep 17 00:00:00 2001 From: hubicka Date: Wed, 12 May 2010 21:32:59 +0000 Subject: * cgraphbuild.c (build_cgraph_edges, rebuild_cgraph_edges): Build indrect edges too. * cgraph.c (cgraph_create_indirect_edge): Take ecf_flags argument. (cgraph_clone_edge): Update. (cgraph_node_remove_callees): Remove indirect calls too. * cgraph.h (cgraph_indirect_call_info): Add ecf_flags. (cgraph_create_indirect_edge): Update prototype. * ipa-reference.c (has_proper_scope_for_analysis): Rename to is_proper_for_analysis. (add_new_function, visited_nodes, function_insertion_hook_holder, get_local_reference_vars_info, mark_address_taken, mark_address, mark_load, mark_store, check_asm_memory_clobber, check_call, scan_stmt_for_static_refs, scan_initializer_for_static_refs): Remove. (ipa_init): Do not initialize visited_nodes; function_insertion_hook_holder. (analyze_variable): Rewrite. (analyze_function): Rewrite. (copy_local_bitmap): Remove. (duplicate_node_dat): Do not duplicate local info. (generate_summary): Simplify to only walk cgraph. (write_node_summary_p, ipa_reference_write_summary, ipa_reference_read_summary): Remove. (propagate): Do not remove function insertion; generate summary. (pass_ipa_reference): NULLify summary handling fields. * lto-cgraph.c (lto_output_edge): Output ecf_flags. (input_edge): Input ecf_flags. * ipa-prop.c (ipa_note_parm_call): Expect edge to be around. (update_indirect_edges_after_inlining): Ignore edges with unknown param. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159343 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cgraphbuild.c | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'gcc/cgraphbuild.c') diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index b09963d1c04..c63b5afc81c 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -339,12 +339,21 @@ build_cgraph_edges (void) gimple stmt = gsi_stmt (gsi); tree decl; - if (is_gimple_call (stmt) && (decl = gimple_call_fndecl (stmt))) - cgraph_create_edge (node, cgraph_node (decl), stmt, - bb->count, - compute_call_stmt_bb_frequency - (current_function_decl, bb), - bb->loop_depth); + if (is_gimple_call (stmt)) + { + int freq = compute_call_stmt_bb_frequency (current_function_decl, + bb); + decl = gimple_call_fndecl (stmt); + if (decl) + cgraph_create_edge (node, cgraph_node (decl), stmt, + bb->count, freq, + bb->loop_depth); + else + cgraph_create_indirect_edge (node, stmt, + gimple_call_flags (stmt), + bb->count, freq, + bb->loop_depth); + } walk_stmt_load_store_addr_ops (stmt, node, mark_load, mark_store, mark_address); if (gimple_code (stmt) == GIMPLE_OMP_PARALLEL @@ -443,12 +452,21 @@ rebuild_cgraph_edges (void) gimple stmt = gsi_stmt (gsi); tree decl; - if (is_gimple_call (stmt) && (decl = gimple_call_fndecl (stmt))) - cgraph_create_edge (node, cgraph_node (decl), stmt, - bb->count, - compute_call_stmt_bb_frequency - (current_function_decl, bb), - bb->loop_depth); + if (is_gimple_call (stmt)) + { + int freq = compute_call_stmt_bb_frequency (current_function_decl, + bb); + decl = gimple_call_fndecl (stmt); + if (decl) + cgraph_create_edge (node, cgraph_node (decl), stmt, + bb->count, freq, + bb->loop_depth); + else + cgraph_create_indirect_edge (node, stmt, + gimple_call_flags (stmt), + bb->count, freq, + bb->loop_depth); + } walk_stmt_load_store_addr_ops (stmt, node, mark_load, mark_store, mark_address); -- cgit v1.2.1 From 182cf5a9a415f31df0f9a10e46faed1221484a35 Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 1 Jul 2010 08:49:19 +0000 Subject: 2010-07-01 Richard Guenther PR middle-end/42834 PR middle-end/44468 * doc/gimple.texi (is_gimple_mem_ref_addr): Document. * doc/generic.texi (References to storage): Document MEM_REF. * tree-pretty-print.c (dump_generic_node): Handle MEM_REF. (print_call_name): Likewise. * tree.c (recompute_tree_invariant_for_addr_expr): Handle MEM_REF. (build_simple_mem_ref_loc): New function. (mem_ref_offset): Likewise. * tree.h (build_simple_mem_ref_loc): Declare. (build_simple_mem_ref): Define. (mem_ref_offset): Declare. * fold-const.c: Include tree-flow.h. (operand_equal_p): Handle MEM_REF. (build_fold_addr_expr_with_type_loc): Likewise. (fold_comparison): Likewise. (fold_unary_loc): Fold VIEW_CONVERT_EXPR > to MEM_REF . (fold_binary_loc): Fold MEM[&MEM[p, CST1], CST2] to MEM[p, CST1 + CST2], fold MEM[&a.b, CST2] to MEM[&a, offsetof (a, b) + CST2]. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Handle MEM_REF. (ptr_deref_may_alias_ref_p_1): Likewise. (ao_ref_base_alias_set): Properly differentiate base object for offset and TBAA. (ao_ref_init_from_ptr_and_size): Use MEM_REF. (indirect_ref_may_alias_decl_p): Handle MEM_REFs properly. (indirect_refs_may_alias_p): Likewise. (refs_may_alias_p_1): Likewise. Remove pointer SSA name def chasing code. (ref_maybe_used_by_call_p_1): Handle MEM_REF. (call_may_clobber_ref_p_1): Likewise. * dwarf2out.c (loc_list_from_tree): Handle MEM_REF. * expr.c (expand_assignment): Handle MEM_REF. (store_expr): Handle MEM_REFs from STRING_CSTs. (store_field): If expanding a MEM_REF of a non-addressable decl use bitfield operations. (get_inner_reference): Handle MEM_REF. (expand_expr_addr_expr_1): Likewise. (expand_expr_real_1): Likewise. * tree-eh.c (tree_could_trap_p): Handle MEM_REF. * alias.c (ao_ref_from_mem): Handle MEM_REF. (get_alias_set): Likewise. Properly handle VIEW_CONVERT_EXPRs. * tree-data-ref.c (dr_analyze_innermost): Handle MEM_REF. (dr_analyze_indices): Likewise. (dr_analyze_alias): Likewise. (object_address_invariant_in_loop_p): Likewise. * gimplify.c (mark_addressable): Handle MEM_REF. (gimplify_cond_expr): Build MEM_REFs. (gimplify_modify_expr_to_memcpy): Likewise. (gimplify_init_ctor_preeval_1): Handle MEM_REF. (gimple_fold_indirect_ref): Adjust. (gimplify_expr): Handle MEM_REF. Gimplify INDIRECT_REF to MEM_REF. * tree.def (MEM_REF): New tree code. * tree-dfa.c: Include toplev.h. (get_ref_base_and_extent): Handle MEM_REF. (get_addr_base_and_unit_offset): New function. * emit-rtl.c (set_mem_attributes_minus_bitpos): Handle MEM_REF. * gimple-fold.c (may_propagate_address_into_dereference): Handle MEM_REF. (maybe_fold_offset_to_array_ref): Allow possibly out-of bounds accesses if the array has just one dimension. Remove always true parameter. Do not require type compatibility here. (maybe_fold_offset_to_component_ref): Remove. (maybe_fold_stmt_indirect): Remove. (maybe_fold_reference): Remove INDIRECT_REF handling. Fold back to non-MEM_REF. (maybe_fold_offset_to_address): Simplify. Deal with type mismatches here. (maybe_fold_reference): Likewise. (maybe_fold_stmt_addition): Likewise. Also handle &ARRAY + I in addition to &ARRAY[0] + I. (fold_gimple_assign): Handle ADDR_EXPR of MEM_REFs. (gimple_get_relevant_ref_binfo): Handle MEM_REF. * cfgexpand.c (expand_debug_expr): Handle MEM_REF. * tree-ssa.c (useless_type_conversion_p): Make most pointer conversions useless. (warn_uninitialized_var): Handle MEM_REF. (maybe_rewrite_mem_ref_base): New function. (execute_update_addresses_taken): Implement re-writing of MEM_REFs to SSA form. * tree-inline.c (remap_gimple_op_r): Handle MEM_REF, remove INDIRECT_REF handling. (copy_tree_body_r): Handle MEM_REF. * gimple.c (is_gimple_addressable): Adjust. (is_gimple_address): Likewise. (is_gimple_invariant_address): ADDR_EXPRs of MEM_REFs with invariant base are invariant. (is_gimple_min_lval): Adjust. (is_gimple_mem_ref_addr): New function. (get_base_address): Handle MEM_REF. (count_ptr_derefs): Likewise. (get_base_loadstore): Likewise. * gimple.h (is_gimple_mem_ref_addr): Declare. (gimple_call_fndecl): Handle invariant MEM_REF addresses. * tree-cfg.c (verify_address): New function, split out from ... (verify_expr): ... here. Use for verifying ADDR_EXPRs and the address operand of MEM_REFs. Verify MEM_REFs. Reject INDIRECT_REFs. (verify_types_in_gimple_min_lval): Handle MEM_REF. Disallow INDIRECT_REF. Allow conversions. (verify_types_in_gimple_reference): Verify VIEW_CONVERT_EXPR of a register does not change its size. (verify_types_in_gimple_reference): Verify MEM_REF. (verify_gimple_assign_single): Disallow INDIRECT_REF. Handle MEM_REF. * tree-ssa-operands.c (opf_non_addressable, opf_not_non_addressable): New. (mark_address_taken): Handle MEM_REF. (get_indirect_ref_operands): Pass through opf_not_non_addressable. (get_asm_expr_operands): Pass opf_not_non_addressable. (get_expr_operands): Handle opf_[not_]non_addressable. Handle MEM_REF. Remove INDIRECT_REF handling. * tree-vrp.c: (check_array_ref): Handle MEM_REF. (search_for_addr_array): Likewise. (check_array_bounds): Likewise. (vrp_stmt_computes_nonzero): Adjust for MEM_REF. * tree-ssa-loop-im.c (for_each_index): Handle MEM_REF. (ref_always_accessed_p): Likewise. (gen_lsm_tmp_name): Likewise. Handle ADDR_EXPR. * tree-complex.c (extract_component): Do not handle INDIRECT_REF. Handle MEM_REF. * cgraphbuild.c (mark_load): Properly check for NULL result from get_base_address. (mark_store): Likewise. * tree-ssa-loop-niter.c (array_at_struct_end_p): Handle MEM_REF. * tree-loop-distribution.c (generate_builtin): Exchange INDIRECT_REF handling for MEM_REF. * tree-scalar-evolution.c (follow_ssa_edge_expr): Handle &MEM[ptr + CST] similar to POINTER_PLUS_EXPR. * builtins.c (stabilize_va_list_loc): Use the function ABI valist type if we couldn't canonicalize the argument type. Always dereference with the canonical va-list type. (maybe_emit_free_warning): Handle MEM_REF. (fold_builtin_memory_op): Simplify and handle MEM_REFs in folding memmove to memcpy. * builtins.c (fold_builtin_memory_op): Use ref-all types for all memcpy foldings. * omp-low.c (build_receiver_ref): Adjust for MEM_REF. (build_outer_var_ref): Likewise. (scan_omp_1_op): Likewise. (lower_rec_input_clauses): Likewise. (lower_lastprivate_clauses): Likewise. (lower_reduction_clauses): Likewise. (lower_copyprivate_clauses): Likewise. (expand_omp_atomic_pipeline): Likewise. (expand_omp_atomic_mutex): Likewise. (create_task_copyfn): Likewise. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle MEM_REF. Remove old union trick. Initialize constant offsets. (ao_ref_init_from_vn_reference): Likewise. Do not handle INDIRECT_REF. Init base_alias_set properly. (vn_reference_lookup_3): Replace INDIRECT_REF handling with MEM_REF. (vn_reference_fold_indirect): Adjust for MEM_REFs. (valueize_refs): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. (may_insert): Remove. (visit_reference_op_load): Do not test may_insert. (run_scc_vn): Remove parameter, do not fiddle with may_insert. * tree-ssa-sccvn.h (struct vn_reference_op_struct): Add a field to store the constant offset this op applies. (run_scc_vn): Adjust prototype. * cgraphunit.c (thunk_adjust): Adjust for MEM_REF. * tree-ssa-ccp.c (ccp_fold): Replace INDIRECT_REF folding with MEM_REF. Propagate &foo + CST as &MEM[&foo, CST]. Do not bother about volatile qualifiers on pointers. (fold_const_aggregate_ref): Handle MEM_REF, do not handle INDIRECT_REF. * tree-ssa-loop-ivopts.c * tree-ssa-loop-ivopts.c (determine_base_object): Adjust for MEM_REF. (strip_offset_1): Likewise. (find_interesting_uses_address): Replace INDIRECT_REF handling with MEM_REF handling. (get_computation_cost_at): Likewise. * ipa-pure-const.c (check_op): Handle MEM_REF. * tree-stdarg.c (check_all_va_list_escapes): Adjust for MEM_REF. * tree-ssa-sink.c (is_hidden_global_store): Handle MEM_REF and constants. * ipa-inline.c (likely_eliminated_by_inlining_p): Handle MEM_REF. * tree-parloops.c (take_address_of): Adjust for MEM_REF. (eliminate_local_variables_1): Likewise. (create_call_for_reduction_1): Likewise. (create_loads_for_reductions): Likewise. (create_loads_and_stores_for_name): Likewise. * matrix-reorg.c (may_flatten_matrices_1): Sanitize. (ssa_accessed_in_tree): Handle MEM_REF. (ssa_accessed_in_assign_rhs): Likewise. (update_type_size): Likewise. (analyze_accesses_for_call_stmt): Likewise. (analyze_accesses_for_assign_stmt): Likewise. (transform_access_sites): Likewise. (transform_allocation_sites): Likewise. * tree-affine.c (tree_to_aff_combination): Handle MEM_REF. * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Do not handle INDIRECT_REF. * tree-ssa-phiopt.c (add_or_mark_expr): Handle MEM_REF. (cond_store_replacement): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle MEM_REF, no not handle INDIRECT_REFs. (insert_into_preds_of_block): Properly initialize avail. (phi_translate_1): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. Properly handle reference lookups that require a bit re-interpretation. (can_PRE_operation): Do not handle INDIRECT_REF. Handle MEM_REF. * tree-sra.c * tree-sra.c (build_access_from_expr_1): Handle MEM_REF. (build_ref_for_offset_1): Remove. (build_ref_for_offset): Build MEM_REFs. (gate_intra_sra): Disable for now. (sra_ipa_modify_expr): Handle MEM_REF. (ipa_early_sra_gate): Disable for now. * tree-sra.c (create_access): Swap INDIRECT_REF handling for MEM_REF handling. (disqualify_base_of_expr): Likewise. (ptr_parm_has_direct_uses): Swap INDIRECT_REF handling for MEM_REF handling. (sra_ipa_modify_expr): Remove INDIRECT_REF handling. Use mem_ref_offset. Remove bogus folding. (build_access_from_expr_1): Properly handle MEM_REF for non IPA-SRA. (make_fancy_name_1): Add support for MEM_REF. * tree-predcom.c (ref_at_iteration): Handle MEM_REFs. * tree-mudflap.c (mf_xform_derefs_1): Adjust for MEM_REF. * ipa-prop.c (compute_complex_assign_jump_func): Handle MEM_REF. (compute_complex_ancestor_jump_func): Likewise. (ipa_analyze_virtual_call_uses): Likewise. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Replace INDIRECT_REF folding with more generalized MEM_REF folding. (tree_ssa_forward_propagate_single_use_vars): Adjust accordingly. (forward_propagate_addr_into_variable_array_index): Also handle &ARRAY + I in addition to &ARRAY[0] + I. * tree-ssa-dce.c (ref_may_be_aliased): Handle MEM_REF. * tree-ssa-ter.c (find_replaceable_in_bb): Avoid TER if that creates assignments with overlap. * tree-nested.c (get_static_chain): Adjust for MEM_REF. (get_frame_field): Likewise. (get_nonlocal_debug_decl): Likewise. (convert_nonlocal_reference_op): Likewise. (struct nesting_info): Add mem_refs pointer-set. (create_nesting_tree): Allocate it. (convert_local_reference_op): Insert to be folded mem-refs. (fold_mem_refs): New function. (finalize_nesting_tree_1): Perform defered folding of mem-refs (free_nesting_tree): Free the pointer-set. * tree-vect-stmts.c (vectorizable_store): Adjust for MEM_REF. (vectorizable_load): Likewise. * tree-ssa-phiprop.c (phiprop_insert_phi): Adjust for MEM_REF. (propagate_with_phi): Likewise. * tree-object-size.c (addr_object_size): Handle MEM_REFs instead of INDIRECT_REFs. (compute_object_offset): Handle MEM_REF. (plus_stmt_object_size): Handle MEM_REF. (collect_object_sizes_for): Dispatch to plus_stmt_object_size for &MEM_REF. * tree-flow.h (get_addr_base_and_unit_offset): Declare. (symbol_marked_for_renaming): Likewise. * Makefile.in (tree-dfa.o): Add $(TOPLEV_H). (fold-const.o): Add $(TREE_FLOW_H). * tree-ssa-structalias.c (get_constraint_for_1): Handle MEM_REF. (find_func_clobbers): Likewise. * ipa-struct-reorg.c (decompose_indirect_ref_acc): Handle MEM_REF. (decompose_access): Likewise. (replace_field_acc): Likewise. (replace_field_access_stmt): Likewise. (insert_new_var_in_stmt): Likewise. (get_stmt_accesses): Likewise. (reorg_structs_drive): Disable. * config/i386/i386.c (ix86_va_start): Adjust for MEM_REF. (ix86_canonical_va_list_type): Likewise. cp/ * cp-gimplify.c (cp_gimplify_expr): Open-code the rhs predicate we are looking for, allow non-gimplified INDIRECT_REFs. testsuite/ * gcc.c-torture/execute/20100316-1.c: New testcase. * gcc.c-torture/execute/pr44468.c: Likewise. * gcc.c-torture/compile/20100609-1.c: Likewise. * gcc.dg/volatile2.c: Adjust. * gcc.dg/plugin/selfassign.c: Likewise. * gcc.dg/pr36902.c: Likewise. * gcc.dg/tree-ssa/foldaddr-2.c: Remove. * gcc.dg/tree-ssa/foldaddr-3.c: Likewise. * gcc.dg/tree-ssa/forwprop-8.c: Adjust. * gcc.dg/tree-ssa/pr17141-1.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-13.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-14.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-21.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise. * gcc.dg/tree-ssa/20030807-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-10.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-1.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise. * gcc.dg/tree-ssa/forwprop-1.c: Likewise. * gcc.dg/tree-ssa/forwprop-2.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-25.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-26.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise. * gcc.dg/tree-ssa/ssa-sccvn-4.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-5.c: Likewise. * gcc.dg/struct/w_prof_two_strs.c: XFAIL. * gcc.dg/struct/wo_prof_escape_arg_to_local.c: Likewise. * gcc.dg/struct/wo_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_malloc_size_var.c: Likewise. * gcc.dg/struct/w_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_str_init.c: Likewise. * gcc.dg/struct/wo_prof_array_through_pointer.c: Likewise. * gcc.dg/struct/w_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_array_field.c: Likewise. * gcc.dg/struct/wo_prof_single_str_local.c: Likewise. * gcc.dg/struct/w_prof_local_var.c: Likewise. * gcc.dg/struct/wo_prof_two_strs.c: Likewise. * gcc.dg/struct/wo_prof_empty_str.c: Likewise. * gcc.dg/struct/wo_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_value.c: Likewise. * gcc.dg/struct/wo_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_escape_return.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_array.c: Likewise. * gcc.dg/struct/wo_prof_double_malloc.c: Likewise. * gcc.dg/struct/w_ratio_cold_str.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_pointer.c: Likewise. * gcc.dg/struct/wo_prof_local_var.c: Likewise. * gcc.dg/tree-prof/stringop-1.c: Adjust. * g++.dg/tree-ssa/pr31146.C: Likewise. * g++.dg/tree-ssa/copyprop-1.C: Likewise. * g++.dg/tree-ssa/pr33604.C: Likewise. * g++.dg/plugin/selfassign.c: Likewise. * gfortran.dg/array_memcpy_3.f90: Likewise. * gfortran.dg/array_memcpy_4.f90: Likewise. * c-c++-common/torture/pr42834.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161655 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cgraphbuild.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/cgraphbuild.c') diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index c63b5afc81c..9dcb8623167 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -275,7 +275,7 @@ mark_load (gimple stmt ATTRIBUTE_UNUSED, tree t, void *data ATTRIBUTE_UNUSED) { 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); @@ -300,7 +300,7 @@ mark_store (gimple stmt ATTRIBUTE_UNUSED, tree t, void *data ATTRIBUTE_UNUSED) { 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); -- cgit v1.2.1 From 2ab2ce89368289e93c9022aae8689f109c132f5c Mon Sep 17 00:00:00 2001 From: froydnj Date: Tue, 6 Jul 2010 02:26:33 +0000 Subject: gcc/ * vec.h (FOR_EACH_VEC_ELT_REVERSE): New macro. * function.h (struct_function): Change type of local_decls field to a VEC. (add_local_decl): New function. (FOR_EACH_LOCAL_DECL): New macro. * cfgexpand.c (init_vars_expansion): Adjust for new type of cfun->local_decls. (estimated_stack_frame_size): Likewise. (expand_used_vars): Likewise. * cgraphbuild.c (build_cgraph_edges): Likewise. * function.c (instantiate_decls_1): Likewise. * ipa-struct-reorg.c (build_data_structure): Likewise. * ipa-type-escape.c (analyze_function): Likewise. * lto-streamer-in.c (input_function): Likewise. * lto-streamer-out.c (output_function): Likewise. * tree-ssa-live.c (remove_unused_locals): Likewise. * tree.c (free_lang_data_in_decl): Likewise. (find_decls_types_in_node): Likewise. * omp-low.c (remove_exit_barrier): Likewise. (expand_omp_taskreg): Likewise. (list2chain): Rename to... (vec2chain): ...this. Adjust. * cgraphunit.c (assemble_thunk): Call add_local_decl. * tree-cfg.c (replace_by_duplicate_decl): Likewise. * gimple-low.c (record_vars_into): Likewise. * tree-inline.c (remap_decls): Likewise. (declare_return_variable): Likewise. (declare_inline_vars): Likewise. (copy_forbidden): Adjust for new type of cfun->local_decls. (add_local_variables): New function. (expand_call_inline): Call it. (tree_function_versioning): Likewise. gcc/cp/ * decl.c (cp_finish_decl): Call add_local_decl. * optimize.c (clone_body): Adjust for new type of cfun->local_decls. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161862 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cgraphbuild.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'gcc/cgraphbuild.c') diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index 9dcb8623167..3bd42e34039 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -328,7 +328,8 @@ build_cgraph_edges (void) 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. */ @@ -378,15 +379,10 @@ build_cgraph_edges (void) } /* 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); -- cgit v1.2.1