aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2021-11-02 18:57:51 +0100
committerJan Hubicka <hubicka@ucw.cz>2021-11-02 18:57:51 +0100
commita70c05120ae6f15f204a04a7df7d19941ab33ef1 (patch)
tree234844b801a3446e044d1c2be530e4afb386d0d5 /gcc/gimple.c
parent164bbf701ff10ff44e272525e8f462ed3ff1cf43 (diff)
downloadgcc-a70c05120ae6f15f204a04a7df7d19941ab33ef1.zip
gcc-a70c05120ae6f15f204a04a7df7d19941ab33ef1.tar.gz
gcc-a70c05120ae6f15f204a04a7df7d19941ab33ef1.tar.bz2
Static chain support in ipa-modref
Teach ipa-modref about the static chain that is, like retslot, a hiden argument. The patch is pretty much symemtric to what was done for retslot handling and I verified it does the intended job for Ada LTO bootstrap. gcc/ChangeLog: * gimple.c (gimple_call_static_chain_flags): New function. * gimple.h (gimple_call_static_chain_flags): Declare * ipa-modref.c (modref_summary::modref_summary): Initialize static_chain_flags. (modref_summary_lto::modref_summary_lto): Likewise. (modref_summary::useful_p): Test static_chain_flags. (modref_summary_lto::useful_p): Likewise. (struct modref_summary_lto): Add static_chain_flags. (modref_summary::dump): Dump static_chain_flags. (modref_summary_lto::dump): Likewise. (struct escape_point): Add static_cahin_arg. (analyze_ssa_name_flags): Use gimple_call_static_chain_flags. (analyze_parms): Handle static chains. (modref_summaries::duplicate): Duplicate static_chain_flags. (modref_summaries_lto::duplicate): Likewise. (modref_write): Stream static_chain_flags. (read_section): Likewise. (modref_merge_call_site_flags): Handle static_chain_flags. * ipa-modref.h (struct modref_summary): Add static_chain_flags. * tree-ssa-structalias.c (handle_rhs_call): Use gimple_static_chain_flags. gcc/testsuite/ChangeLog: * gcc.dg/ipa/modref-3.c: New test.
Diffstat (limited to 'gcc/gimple.c')
-rw-r--r--gcc/gimple.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 22dd641..76768c1 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1647,6 +1647,33 @@ gimple_call_retslot_flags (const gcall *stmt)
return flags;
}
+/* Detects argument flags for static chain on call STMT. */
+
+int
+gimple_call_static_chain_flags (const gcall *stmt)
+{
+ int flags = 0;
+
+ tree callee = gimple_call_fndecl (stmt);
+ if (callee)
+ {
+ cgraph_node *node = cgraph_node::get (callee);
+ modref_summary *summary = node ? get_modref_function_summary (node)
+ : NULL;
+
+ if (summary)
+ {
+ int modref_flags = summary->static_chain_flags;
+
+ /* We have possibly optimized out load. Be conservative here. */
+ gcc_checking_assert (node->binds_to_current_def_p ());
+ if (dbg_cnt (ipa_mod_ref_pta))
+ flags |= modref_flags;
+ }
+ }
+ return flags;
+}
+
/* Detects return flags for the call STMT. */
int