Nearly CC
An educational compiler skeleton
Classes | Functions
cfg_printer.h File Reference

Support for printing a textual representation of a ControlFlowGraph. More...

#include "cfg.h"
#include "print_instruction_seq.h"
#include "highlevel_formatter.h"
#include "lowlevel_formatter.h"
Include dependency graph for cfg_printer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  DefaultBlockAnnotator
 Default annotator for printing a control flow graph. More...
 
class  ControlFlowGraphPrinter< Formatter, BlockAnnotator >
 Print a textual representation of a ControlFlowGraph. More...
 

Functions

template<typename BlockAnnotator = DefaultBlockAnnotator>
ControlFlowGraphPrinter< HighLevelFormatter, BlockAnnotator > make_highlevel_cfg_printer (const std::shared_ptr< ControlFlowGraph > &hl_cfg, BlockAnnotator annotator=BlockAnnotator())
 Create a ControlFlowGraphPrinter for printing a high-level ControlFlowGraph. More...
 
template<typename BlockAnnotator = DefaultBlockAnnotator>
ControlFlowGraphPrinter< LowLevelFormatter, BlockAnnotator > make_lowlevel_cfg_printer (const std::shared_ptr< ControlFlowGraph > &ll_cfg, BlockAnnotator annotator=BlockAnnotator())
 Create a ControlFlowGraphPrinter for printing a low-level ControlFlowGraph. More...
 

Detailed Description

Support for printing a textual representation of a ControlFlowGraph.

Function Documentation

◆ make_highlevel_cfg_printer()

template<typename BlockAnnotator = DefaultBlockAnnotator>
ControlFlowGraphPrinter<HighLevelFormatter, BlockAnnotator> make_highlevel_cfg_printer ( const std::shared_ptr< ControlFlowGraph > &  hl_cfg,
BlockAnnotator  annotator = BlockAnnotator() 
)

Create a ControlFlowGraphPrinter for printing a high-level ControlFlowGraph.

Example usage:

auto hl_cfg_printer = ::make_highlevel_cfg_printer(hl_cfg);
ControlFlowGraphPrinter< HighLevelFormatter, BlockAnnotator > make_highlevel_cfg_printer(const std::shared_ptr< ControlFlowGraph > &hl_cfg, BlockAnnotator annotator=BlockAnnotator())
Create a ControlFlowGraphPrinter for printing a high-level ControlFlowGraph.
Definition: cfg_printer.h:100
Template Parameters
BlockAnnotatorthe type of block annotator to use to annotate basic blocks
Parameters
hl_cfgthe high-level ControlFlowGraph to print
annotatorthe basic block annotator object to use
Returns
the initialized ControlFlowGraphPrinter instance

◆ make_lowlevel_cfg_printer()

template<typename BlockAnnotator = DefaultBlockAnnotator>
ControlFlowGraphPrinter<LowLevelFormatter, BlockAnnotator> make_lowlevel_cfg_printer ( const std::shared_ptr< ControlFlowGraph > &  ll_cfg,
BlockAnnotator  annotator = BlockAnnotator() 
)

Create a ControlFlowGraphPrinter for printing a low-level ControlFlowGraph.

Example usage:

auto ll_cfg_printer = ::make_lowlevel_cfg_printer(ll_cfg);
ControlFlowGraphPrinter< LowLevelFormatter, BlockAnnotator > make_lowlevel_cfg_printer(const std::shared_ptr< ControlFlowGraph > &ll_cfg, BlockAnnotator annotator=BlockAnnotator())
Create a ControlFlowGraphPrinter for printing a low-level ControlFlowGraph.
Definition: cfg_printer.h:118
Template Parameters
BlockAnnotatorthe type of block annotator to use to annotate basic blocks
Parameters
ll_cfgthe low-level ControlFlowGraph to print
annotatorthe basic block annotator object to use
Returns
the initialized ControlFlowGraphPrinter instance