diff options
Diffstat (limited to 'gcc/analyzer/supergraph.h')
-rw-r--r-- | gcc/analyzer/supergraph.h | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/gcc/analyzer/supergraph.h b/gcc/analyzer/supergraph.h index 5d1268e..09a12be 100644 --- a/gcc/analyzer/supergraph.h +++ b/gcc/analyzer/supergraph.h @@ -79,6 +79,18 @@ struct supergraph_traits typedef supercluster cluster_t; }; +/* A class to manage the setting and restoring of statement uids. */ + +class saved_uids +{ +public: + void make_uid_unique (gimple *stmt); + void restore_uids () const; + +private: + auto_vec<std::pair<gimple *, unsigned> > m_old_stmt_uids; +}; + /* A "supergraph" is a directed graph formed by joining together all CFGs, linking them via interprocedural call and return edges. @@ -90,6 +102,7 @@ class supergraph : public digraph<supergraph_traits> { public: supergraph (logger *logger); + ~supergraph (); supernode *get_node_for_function_entry (function *fun) const { @@ -168,7 +181,7 @@ public: private: supernode *add_node (function *fun, basic_block bb, gcall *returning_call, gimple_seq phi_nodes); - cfg_superedge *add_cfg_edge (supernode *src, supernode *dest, ::edge e, int idx); + cfg_superedge *add_cfg_edge (supernode *src, supernode *dest, ::edge e); call_superedge *add_call_superedge (supernode *src, supernode *dest, cgraph_edge *cedge); return_superedge *add_return_superedge (supernode *src, supernode *dest, @@ -205,6 +218,8 @@ private: typedef hash_map<const function *, unsigned> function_to_num_snodes_t; function_to_num_snodes_t m_function_to_num_snodes; + + saved_uids m_stmt_uids; }; /* A node within a supergraph. */ @@ -253,6 +268,11 @@ class supernode : public dnode<supergraph_traits> return i; } + gcall *get_returning_call () const + { + return m_returning_call; + } + gimple *get_last_stmt () const { if (m_stmts.length () == 0) @@ -385,7 +405,7 @@ class callgraph_superedge : public superedge function *get_caller_function () const; tree get_callee_decl () const; tree get_caller_decl () const; - gcall *get_call_stmt () const { return m_cedge->call_stmt; } + gcall *get_call_stmt () const; tree get_arg_for_parm (tree parm, callsite_expr *out) const; tree get_parm_for_arg (tree arg, callsite_expr *out) const; tree map_expr_from_caller_to_callee (tree caller_expr, @@ -499,6 +519,7 @@ class cfg_superedge : public superedge int false_value_p () const { return get_flags () & EDGE_FALSE_VALUE; } int back_edge_p () const { return get_flags () & EDGE_DFS_BACK; } + size_t get_phi_arg_idx () const; tree get_phi_arg (const gphi *phi) const; private: @@ -518,15 +539,12 @@ is_a_helper <const cfg_superedge *>::test (const superedge *sedge) namespace ana { /* A subclass for edges from switch statements, retaining enough - information to identify the pertinent case, and for adding labels + information to identify the pertinent cases, and for adding labels when rendering via graphviz. */ class switch_cfg_superedge : public cfg_superedge { public: - switch_cfg_superedge (supernode *src, supernode *dst, ::edge e, int idx) - : cfg_superedge (src, dst, e), - m_idx (idx) - {} + switch_cfg_superedge (supernode *src, supernode *dst, ::edge e); const switch_cfg_superedge *dyn_cast_switch_cfg_superedge () const FINAL OVERRIDE @@ -542,10 +560,10 @@ class switch_cfg_superedge : public cfg_superedge { return as_a <gswitch *> (m_src->get_last_stmt ()); } - tree get_case_label () const; + const vec<tree> &get_case_labels () const { return m_case_labels; } - private: - const int m_idx; +private: + auto_vec<tree> m_case_labels; }; } // namespace ana |