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.   

References open_graph_file(), and start_graph_dump().

Referenced by pass_init_dump_file().

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.)   

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

Referenced by print_graph_cfg().

static void draw_cfg_node ( )
static
Draw a basic block BB belonging to the function with FUNCDEF_NO
   as its unique number.   

References dump_bb_for_graph(), basic_block_def::index, pp_flush(), pp_printf(), pp_string(), and pp_write_text_to_stream().

Referenced by draw_cfg_nodes_for_loop(), and draw_cfg_nodes_no_loops().

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_flush(), pp_printf(), edge_def::probability, edge_def::src, and basic_block_def::succs.

Referenced by draw_cfg_edges().

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_nodes_for_loop(), draw_cfg_nodes_no_loops(), get_loop(), and loops_for_fn().

Referenced by print_graph_cfg().

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.   

References draw_cfg_node(), free(), get_loop_body(), get_loop_body_in_bfs_order(), loop::header, loop::inner, loop::latch, loop_depth(), basic_block_def::loop_father, loop::next, loop::num, loop::num_nodes, and pp_printf().

Referenced by draw_cfg_nodes().

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.   

References bitmap_bit_p(), bitmap_clear(), bitmap_set_bit(), draw_cfg_node(), free(), basic_block_def::index, pre_and_rev_post_order_compute(), sbitmap_alloc(), sbitmap_free(), and visited.

Referenced by draw_cfg_nodes().

static void end_graph_dump ( )
static
End the dump of a graph.   

Referenced by finish_graph_dump_file().

void finish_graph_dump_file ( )
Do final work on the graph output file.   

References end_graph_dump(), and open_graph_file().

Referenced by gcc::pass_manager::finish_optimization_passes().

static FILE* open_graph_file ( )
static
Open a file with MODE for dumping our graph to.
   Return the file pointer.   

References fatal_error(), graph_ext, memcpy(), and strlen().

Referenced by clean_graph_dump_file(), finish_graph_dump_file(), and print_graph_cfg().

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.   

References pretty_printer::buffer, draw_cfg_edges(), draw_cfg_nodes(), function_name(), open_graph_file(), pp_flush(), pp_printf(), and output_buffer::stream.

Referenced by execute_function_dump().

static void start_graph_dump ( )
static

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

Referenced by open_graph_file().