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 (logger *logger)
 
 ~supergraph ()
 
supernodeget_node_for_function_entry (const function &fun) const
 
supernodeget_node_for_function_exit (const function &fun) const
 
supernodeget_node_for_block (basic_block bb) const
 
supernodeget_caller_next_node (cgraph_edge *edge) const
 
call_superedgeget_edge_for_call (cgraph_edge *edge) const
 
return_superedgeget_edge_for_return (cgraph_edge *edge) const
 
superedgeget_intraprocedural_edge_for_call (cgraph_edge *edge) const
 
cfg_superedgeget_edge_for_cfg_edge (edge e) const
 
supernodeget_supernode_for_stmt (const gimple *stmt) 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
 
json::objectto_json () const
 
int num_nodes () const
 
int num_edges () const
 
supernodeget_node_by_index (int idx) const
 
unsigned get_num_snodes (const function *fun) const
 
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)
 

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 ordered_hash_map< cgraph_edge *, supernode * > cgraph_edge_to_node_t
 
typedef ordered_hash_map< ::edge, cfg_superedge * > cfg_edge_to_cfg_superedge_t
 
typedef ordered_hash_map< cgraph_edge *, call_superedge * > cgraph_edge_to_call_superedge_t
 
typedef ordered_hash_map< cgraph_edge *, return_superedge * > cgraph_edge_to_return_superedge_t
 
typedef ordered_hash_map< cgraph_edge *, superedge * > cgraph_edge_to_intraproc_superedge_t
 
typedef ordered_hash_map< gimple *, supernode * > stmt_to_node_t
 
typedef hash_map< const function *, unsigned > function_to_num_snodes_t
 

Private Member Functions

supernodeadd_node (function *fun, basic_block bb, gcall *returning_call, gimple_seq phi_nodes)
 
cfg_superedgeadd_cfg_edge (supernode *src, supernode *dest, ::edge e)
 
call_superedgeadd_call_superedge (supernode *src, supernode *dest, cgraph_edge *cedge)
 
return_superedgeadd_return_superedge (supernode *src, supernode *dest, cgraph_edge *cedge)
 

Private Attributes

bb_to_node_t m_bb_to_initial_node
 
bb_to_node_t m_bb_to_final_node
 
cgraph_edge_to_node_t m_cgraph_edge_to_caller_prev_node
 
cgraph_edge_to_node_t m_cgraph_edge_to_caller_next_node
 
cfg_edge_to_cfg_superedge_t m_cfg_edge_to_cfg_superedge
 
cgraph_edge_to_call_superedge_t m_cgraph_edge_to_call_superedge
 
cgraph_edge_to_return_superedge_t m_cgraph_edge_to_return_superedge
 
cgraph_edge_to_intraproc_superedge_t m_cgraph_edge_to_intraproc_superedge
 
stmt_to_node_t m_stmt_to_node_t
 
function_to_num_snodes_t m_function_to_num_snodes
 
saved_uids m_stmt_uids
 

Detailed Description

A "supergraph" is a directed graph formed by joining together all CFGs,
linking them via interprocedural call and return edges.

Basic blocks are split at callsites, so that a call statement occurs
twice: once at the end of a supernode, and a second instance at the
start of the next supernode (to handle the return).   

Member Typedef Documentation

◆ bb_to_node_t

◆ cfg_edge_to_cfg_superedge_t

◆ cgraph_edge_to_call_superedge_t

◆ cgraph_edge_to_intraproc_superedge_t

◆ cgraph_edge_to_node_t

◆ cgraph_edge_to_return_superedge_t

◆ cluster_t

◆ dump_args_t

◆ edge_t

◆ function_to_num_snodes_t

◆ node_t

◆ stmt_to_node_t

Constructor & Destructor Documentation

◆ supergraph()

ana::supergraph::supergraph ( logger * logger)

◆ ~supergraph()

ana::supergraph::~supergraph ( )

Member Function Documentation

◆ add_call_superedge()

call_superedge * ana::supergraph::add_call_superedge ( supernode * src,
supernode * dest,
cgraph_edge * cedge )
private

◆ add_cfg_edge()

cfg_superedge * ana::supergraph::add_cfg_edge ( supernode * src,
supernode * dest,
::edge e )
private

◆ 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,
gcall * returning_call,
gimple_seq phi_nodes )
private

◆ add_node() [2/2]

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

◆ add_return_superedge()

return_superedge * ana::supergraph::add_return_superedge ( supernode * src,
supernode * dest,
cgraph_edge * cedge )
private

◆ dump_dot() [1/2]

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

◆ 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_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.   

◆ get_caller_next_node()

supernode * ana::supergraph::get_caller_next_node ( cgraph_edge * edge) const
inline

◆ get_edge_for_call()

call_superedge * ana::supergraph::get_edge_for_call ( cgraph_edge * edge) const
inline

◆ get_edge_for_cfg_edge()

cfg_superedge * ana::supergraph::get_edge_for_cfg_edge ( edge e) const
inline

◆ get_edge_for_return()

return_superedge * ana::supergraph::get_edge_for_return ( cgraph_edge * edge) const
inline

◆ get_intraprocedural_edge_for_call()

superedge * ana::supergraph::get_intraprocedural_edge_for_call ( cgraph_edge * edge) const
inline

◆ get_node_by_index()

supernode * ana::supergraph::get_node_by_index ( int idx) const
inline

◆ get_node_for_block()

supernode * ana::supergraph::get_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_supernode_for_stmt()

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

References m_stmt_to_node_t.

◆ num_edges()

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

◆ num_nodes()

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

◆ to_json()

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

Referenced by get_node_for_block().

◆ m_cfg_edge_to_cfg_superedge

cfg_edge_to_cfg_superedge_t ana::supergraph::m_cfg_edge_to_cfg_superedge
private

Referenced by get_edge_for_cfg_edge().

◆ m_cgraph_edge_to_call_superedge

cgraph_edge_to_call_superedge_t ana::supergraph::m_cgraph_edge_to_call_superedge
private

Referenced by get_edge_for_call().

◆ m_cgraph_edge_to_caller_next_node

cgraph_edge_to_node_t ana::supergraph::m_cgraph_edge_to_caller_next_node
private

Referenced by get_caller_next_node().

◆ m_cgraph_edge_to_caller_prev_node

cgraph_edge_to_node_t ana::supergraph::m_cgraph_edge_to_caller_prev_node
private

◆ m_cgraph_edge_to_intraproc_superedge

cgraph_edge_to_intraproc_superedge_t ana::supergraph::m_cgraph_edge_to_intraproc_superedge
private

◆ m_cgraph_edge_to_return_superedge

cgraph_edge_to_return_superedge_t ana::supergraph::m_cgraph_edge_to_return_superedge
private

Referenced by get_edge_for_return().

◆ m_edges

Referenced by num_edges().

◆ m_function_to_num_snodes

function_to_num_snodes_t ana::supergraph::m_function_to_num_snodes
private

Referenced by get_num_snodes().

◆ m_nodes

Referenced by get_node_by_index(), and num_nodes().

◆ m_stmt_to_node_t

stmt_to_node_t ana::supergraph::m_stmt_to_node_t
private

Referenced by get_supernode_for_stmt().

◆ m_stmt_uids

saved_uids ana::supergraph::m_stmt_uids
private

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