diff options
author | Jan Hubicka <jh@suse.cz> | 2010-05-30 14:19:15 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2010-05-30 12:19:15 +0000 |
commit | d56026c21e98183dd543b799ba3a1e1adea9a22c (patch) | |
tree | 95c8141edd637bb1eaf3d0b8672e60d8c734e72b /gcc/cgraph.c | |
parent | 17f01631e1b9191081968fdeb7b2b06951342a01 (diff) | |
download | gcc-d56026c21e98183dd543b799ba3a1e1adea9a22c.zip gcc-d56026c21e98183dd543b799ba3a1e1adea9a22c.tar.gz gcc-d56026c21e98183dd543b799ba3a1e1adea9a22c.tar.bz2 |
cgraph.h (cgraph_node_cannot_return, [...]): New functions.
* cgraph.h (cgraph_node_cannot_return,
cgraph_edge_cannot_lead_to_return): New functions.
* cgraph.c (cgraph_node_cannot_return,
cgraph_edge_cannot_lead_to_return): Use them.
* ipa-pure-const.c (pure_const_names): New static var.
(check_call): Handle calls not leading to return.
(pure_const_read_summary): Dump info read.
(propagate): Dump info about propagation process; ignore side
effects of functions not leading to exit; fix handling of
pure functions.
From-SVN: r160051
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 8c79168..0c2441f 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -2584,4 +2584,39 @@ cgraph_propagate_frequency (struct cgraph_node *node) return false; } +/* Return true when NODE can not return or throw and thus + it is safe to ignore its side effects for IPA analysis. */ + +bool +cgraph_node_cannot_return (struct cgraph_node *node) +{ + int flags = flags_from_decl_or_type (node->decl); + if (!flag_exceptions) + return (flags & ECF_NORETURN) != 0; + else + return ((flags & (ECF_NORETURN | ECF_NOTHROW)) + == (ECF_NORETURN | ECF_NOTHROW)); +} + +/* Return true when call of E can not lead to return from caller + and thus it is safe to ignore its side effects for IPA analysis + when computing side effects of the caller. + FIXME: We could actually mark all edges that have no reaching + patch to EXIT_BLOCK_PTR or throw to get better results. */ +bool +cgraph_edge_cannot_lead_to_return (struct cgraph_edge *e) +{ + if (e->indirect_unknown_callee) + { + int flags = e->indirect_info->ecf_flags; + if (!flag_exceptions) + return (flags & ECF_NORETURN) != 0; + else + return ((flags & (ECF_NORETURN | ECF_NOTHROW)) + == (ECF_NORETURN | ECF_NOTHROW)); + } + else + return cgraph_node_cannot_return (e->callee); +} + #include "gt-cgraph.h" |