GCC Middle and Back End API Reference
ana::supergraph Class Reference

#include <supergraph.h>

Inheritance diagram for ana::supergraph:
Collaboration diagram for ana::supergraph:

Public Types

typedef supergraph_traits::node_t node_t
typedef supergraph_traits::edge_t edge_t
typedef supergraph_traits::dump_args_t dump_args_t
typedef supergraph_traits::cluster_t cluster_t

Public Member Functions

 supergraph (region_model_manager &mgr, logger *logger)
 ~supergraph ()
supernodeget_node_for_function_entry (const function &fun) const
supernodeget_node_for_function_exit (const function &fun) const
supernodeget_initial_node_for_block (basic_block bb) const
supernodeget_final_node_for_block (basic_block bb) const
supernodeget_supernode_for_stmt (const gimple *stmt) const
superedgeget_superedge_for_phis (::edge cfg_edge) const
void dump_dot_to_pp (pretty_printer *pp, const dump_args_t &) const
void dump_dot_to_file (FILE *fp, const dump_args_t &) const
void dump_dot (const char *path, const dump_args_t &) const
std::unique_ptr< json::objectto_json () const
int num_nodes () const
int num_edges () const
unsigned get_num_snodes (const function *fun) const
void log_stats (logger *logger) const
void delete_nodes (const std::set< supernode * > &snodes)
void fixup_locations (logger *)
void simplify (logger *)
void sort_nodes (logger *logger)
supernodeadd_node (function *fun, basic_block bb, logger *logger)
void dump_dot_to_pp (pretty_printer *pp, cluster_t *root_cluster, const dump_args_t &args) const
void dump_dot_to_file (FILE *fp, cluster_t *root_cluster, const dump_args_t &args) const
void dump_dot (const char *path, cluster_t *root_cluster, const dump_args_t &args) const
void add_node (node_t *node)
void add_edge (edge_t *edge)
virtual void add_any_extra_stmts (graphviz_out &) const

Data Fields

auto_delete_vec< node_tm_nodes
auto_delete_vec< edge_tm_edges

Private Types

typedef ordered_hash_map< basic_block, supernode * > bb_to_node_t
typedef hash_map< const function *, unsigned > function_to_num_snodes_t

Private Member Functions

gimplepopulate_for_basic_block (basic_block bb, function *fun, logger *logger)
void add_sedges_for_cfg_edge (supernode *src, supernode *dest, ::edge e, gimple *control_stmt, region_model_manager &mgr, logger *logger)
void dump_dot_to_gv_for_loop (graphviz_out &gv, const dump_args_t &, class loop *, function *) const
void dump_dot_to_gv_for_bb (graphviz_out &gv, const dump_args_t &, basic_block, function *) const
void reorder_nodes_and_ids (const std::vector< supernode * > &ordering, logger *logger)

Private Attributes

bb_to_node_t m_bb_to_initial_node
bb_to_node_t m_bb_to_final_node
std::map< const gimple *, supernode * > m_node_for_stmt
std::map<::edge, superedge * > m_edges_for_phis
function_to_num_snodes_t m_function_to_num_snodes
saved_uids m_stmt_uids
int m_next_snode_id
std::vector< supernode * > m_snode_by_id

Detailed Description

A directed graph class representing the users's code,
with nodes representing locations within functions, and
edges representing transitions between them.

For historical reasons we call this the "supergraph", although
this is now a misnomer as we no longer add callgraph edges to this
graph: the edges within the supergraph are purely intraprocedural:
either linking consecutive stmts in a basic block, or linking
basic blocks (corresponding to CFG edges).  However, all functions
are within the same graph.   

Member Typedef Documentation

◆ bb_to_node_t

◆ cluster_t

typedef supergraph_traits::cluster_t digraph< supergraph_traits >::cluster_t
inherited

◆ dump_args_t

typedef supergraph_traits::dump_args_t digraph< supergraph_traits >::dump_args_t
inherited

◆ edge_t

typedef supergraph_traits::edge_t digraph< supergraph_traits >::edge_t
inherited

◆ function_to_num_snodes_t

typedef hash_map<const function *, unsigned> ana::supergraph::function_to_num_snodes_t
private

◆ node_t

typedef supergraph_traits::node_t digraph< supergraph_traits >::node_t
inherited

Constructor & Destructor Documentation

◆ supergraph()

ana::supergraph::supergraph ( region_model_manager & mgr,
logger * logger )

◆ ~supergraph()

ana::supergraph::~supergraph ( )

Member Function Documentation

◆ add_any_extra_stmts()

virtual void digraph< supergraph_traits >::add_any_extra_stmts ( graphviz_out & ) const
inlinevirtualinherited

◆ add_edge()

void digraph< supergraph_traits >::add_edge ( edge_t * edge)
inlineinherited
Add EDGE to this digraph, and to the preds/succs of its endpoints.
Take ownership of EDGE.   

◆ add_node() [1/2]

supernode * ana::supergraph::add_node ( function * fun,
basic_block bb,
logger * logger )

◆ add_node() [2/2]

void digraph< supergraph_traits >::add_node ( node_t * node)
inlineinherited
Add NODE to this DIGRAPH, taking ownership.   

◆ add_sedges_for_cfg_edge()

void ana::supergraph::add_sedges_for_cfg_edge ( supernode * src,
supernode * dest,
::edge e,
gimple * control_stmt,
region_model_manager & mgr,
logger * logger )
private

◆ delete_nodes()

void ana::supergraph::delete_nodes ( const std::set< supernode * > & snodes)

◆ dump_dot() [1/2]

void ana::supergraph::dump_dot ( const char * path,
const dump_args_t &  ) const

References path.

◆ dump_dot() [2/2]

void digraph< supergraph_traits >::dump_dot ( const char * path,
cluster_t * root_cluster,
const dump_args_t & args ) const
inlineinherited
Write .dot information for this graph to a file at PATH, passing ARGS
to the nodes and edges.
If ROOT_CLUSTER is non-NULL, use it to organize the nodes into clusters.   

◆ dump_dot_to_file() [1/2]

void ana::supergraph::dump_dot_to_file ( FILE * fp,
const dump_args_t &  ) const

◆ dump_dot_to_file() [2/2]

void digraph< supergraph_traits >::dump_dot_to_file ( FILE * fp,
cluster_t * root_cluster,
const dump_args_t & args ) const
inlineinherited
Write .dot information for this graph to FP, passing ARGS to the nodes
and edges.
If ROOT_CLUSTER is non-NULL, use it to organize the nodes into clusters.   

◆ dump_dot_to_gv_for_bb()

void ana::supergraph::dump_dot_to_gv_for_bb ( graphviz_out & gv,
const dump_args_t & ,
basic_block ,
function *  ) const
private

◆ dump_dot_to_gv_for_loop()

void ana::supergraph::dump_dot_to_gv_for_loop ( graphviz_out & gv,
const dump_args_t & ,
class loop * ,
function *  ) const
private

◆ dump_dot_to_pp() [1/2]

void ana::supergraph::dump_dot_to_pp ( pretty_printer * pp,
const dump_args_t &  ) const

◆ dump_dot_to_pp() [2/2]

void digraph< supergraph_traits >::dump_dot_to_pp ( pretty_printer * pp,
cluster_t * root_cluster,
const dump_args_t & args ) const
inlineinherited
Write .dot information for this graph to PP, passing ARGS to the nodes
and edges.
If ROOT_CLUSTER is non-NULL, use it to organize the nodes into clusters.   

◆ fixup_locations()

void ana::supergraph::fixup_locations ( logger * )

◆ get_final_node_for_block()

supernode * ana::supergraph::get_final_node_for_block ( basic_block bb) const
inline

◆ get_initial_node_for_block()

supernode * ana::supergraph::get_initial_node_for_block ( basic_block bb) const
inline

◆ get_node_for_function_entry()

supernode * ana::supergraph::get_node_for_function_entry ( const function & fun) const
inline

◆ get_node_for_function_exit()

supernode * ana::supergraph::get_node_for_function_exit ( const function & fun) const
inline

◆ get_num_snodes()

unsigned ana::supergraph::get_num_snodes ( const function * fun) const
inline

References m_function_to_num_snodes, and map.

◆ get_superedge_for_phis()

superedge * ana::supergraph::get_superedge_for_phis ( ::edge cfg_edge) const
inline

References m_edges_for_phis.

◆ get_supernode_for_stmt()

supernode * ana::supergraph::get_supernode_for_stmt ( const gimple * stmt) const
inline

◆ log_stats()

void ana::supergraph::log_stats ( logger * logger) const

◆ num_edges()

int ana::supergraph::num_edges ( ) const
inline

◆ num_nodes()

int ana::supergraph::num_nodes ( ) const
inline

◆ populate_for_basic_block()

gimple * ana::supergraph::populate_for_basic_block ( basic_block bb,
function * fun,
logger * logger )
private

◆ reorder_nodes_and_ids()

void ana::supergraph::reorder_nodes_and_ids ( const std::vector< supernode * > & ordering,
logger * logger )
private

◆ simplify()

void ana::supergraph::simplify ( logger * )

◆ sort_nodes()

void ana::supergraph::sort_nodes ( logger * logger)

◆ to_json()

std::unique_ptr< json::object > ana::supergraph::to_json ( ) const

Field Documentation

◆ m_bb_to_final_node

bb_to_node_t ana::supergraph::m_bb_to_final_node
private

◆ m_bb_to_initial_node

bb_to_node_t ana::supergraph::m_bb_to_initial_node
private

◆ m_edges

◆ m_edges_for_phis

std::map<::edge, superedge *> ana::supergraph::m_edges_for_phis
private

Referenced by get_superedge_for_phis().

◆ m_function_to_num_snodes

function_to_num_snodes_t ana::supergraph::m_function_to_num_snodes
private

Referenced by get_num_snodes().

◆ m_next_snode_id

int ana::supergraph::m_next_snode_id
private

◆ m_node_for_stmt

std::map<const gimple *, supernode *> ana::supergraph::m_node_for_stmt
private

Referenced by get_supernode_for_stmt().

◆ m_nodes

◆ m_snode_by_id

std::vector<supernode *> ana::supergraph::m_snode_by_id
private

◆ m_stmt_uids

saved_uids ana::supergraph::m_stmt_uids
private

The documentation for this class was generated from the following file: