GCC Middle and Back End API Reference
graph.c File Reference
#include "sbitmap.h"
Include dependency graph for graph.c:

Functions

static FILE * open_graph_file ()
static void draw_cfg_node ()
static void draw_cfg_node_succ_edges ()
static void draw_cfg_nodes_no_loops ()
static void draw_cfg_nodes_for_loop (pretty_printer *pp, int funcdef_no, struct loop *loop)
static void draw_cfg_nodes ()
static void draw_cfg_edges ()
void print_graph_cfg ()
static void start_graph_dump ()
static void end_graph_dump ()
void clean_graph_dump_file ()
void finish_graph_dump_file ()

Variables

static const char *const graph_ext = ".dot"

Function Documentation

void clean_graph_dump_file ( )
   Similar as clean_dump_file, but this time for graph output files.  
static void draw_cfg_edges ( )
static
   Draw all edges in the CFG.  Retreating edges are drawin as not
   constraining, this makes the layout of the graph better.
   (??? Calling mark_dfs_back may change the compiler's behavior when
   dumping, but computing back edges here for ourselves is also not
   desirable.)  
     Add an invisible edge from ENTRY to EXIT, to improve the graph layout.  
static void draw_cfg_node ( )
static
   Draw a basic block BB belonging to the function with FUNCDEF_NO
   as its unique number.  
static void draw_cfg_node_succ_edges ( )
static
   Draw all successor edges of a basic block BB belonging to the function
   with FUNCDEF_NO as its unique number.  

References color(), edge_def::dest, edge_def::flags, basic_block_def::index, pp_printf(), edge_def::probability, and edge_def::src.

Referenced by draw_cfg_nodes().

static void draw_cfg_nodes ( )
static
   Draw all the basic blocks in the CFG in case the loop tree is available.
   All loop bodys are printed in clusters.  

References draw_cfg_node_succ_edges(), mark_dfs_back_edges(), and pp_printf().

static void draw_cfg_nodes_for_loop ( pretty_printer pp,
int  funcdef_no,
struct loop loop 
)
static
   Draw all the basic blocks in LOOP.  Print the blocks in breath-first
   order to get a good ranking of the nodes.  This function is recursive:
   It first prints inner loops, then the body of LOOP itself.  
static void draw_cfg_nodes_no_loops ( )
static
   Draw all the basic blocks in the CFG in case loops are not available.
   First compute a topological order of the blocks to get a good ranking of
   the nodes.  Then, if any nodes are not reachable from ENTRY, add them at
   the end.  
         Some blocks are unreachable.  We still want to dump them.  
static void end_graph_dump ( )
static
   End the dump of a graph.  

References open_graph_file().

void finish_graph_dump_file ( )
   Do final work on the graph output file.  
static FILE* open_graph_file ( )
static
   Open a file with MODE for dumping our graph to.
   Return the file pointer.  

Referenced by end_graph_dump().

void print_graph_cfg ( )
   Print a graphical representation of the CFG of function FUN.
   First print all basic blocks.  Draw all edges at the end to get
   subgraphs right for GraphViz, which requires nodes to be defined
   before edges to cluster nodes properly.  
static void start_graph_dump ( )
static
   Start the dump of a graph.  

Variable Documentation

const char* const graph_ext = ".dot"
static
@verbatim 

Output routines for graphical representation. Copyright (C) 1998-2013 Free Software Foundation, Inc. Contributed by Ulrich Drepper drepp.nosp@m.er@c.nosp@m.ygnus.nosp@m..com, 1998. Rewritten for DOT output by Steven Bosscher, 2012.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.

   DOT files with the .dot extension are recognized as document templates
   by a well-known piece of word processing software out of Redmond, WA.
   Therefore some recommend using the .gv extension instead.  Obstinately
   ignore that recommendation...