|
Nearly CC
An educational compiler skeleton
|
An instance of Dataflow performs a dataflow analysis on the basic blocks of a control flow graph and provides an interface for querying dataflow facts at arbitrary points. More...
#include "dataflow.h"
Public Types | |
| typedef Analysis::FactType | FactType |
| Data type representing a dataflow fact. More... | |
Public Member Functions | |
| Dataflow (const std::shared_ptr< ControlFlowGraph > &cfg) | |
| Constructor. More... | |
| void | execute () |
| Execute the analysis. | |
| const FactType & | get_fact_at_end_of_block (std::shared_ptr< InstructionSequence > bb) const |
| Get dataflow fact at end of specified block. More... | |
| const FactType & | get_fact_at_beginning_of_block (std::shared_ptr< InstructionSequence > bb) const |
| Get dataflow fact at beginning of specific block. More... | |
| FactType | get_fact_after_instruction (std::shared_ptr< InstructionSequence > bb, Instruction *ins) const |
| Get dataflow fact at the location immediately after the specified instruction (in program order). More... | |
| FactType | get_fact_before_instruction (std::shared_ptr< InstructionSequence > bb, Instruction *ins) const |
| Get dataflow fact at the location immediately before the specified instruction (in program order). More... | |
Static Public Member Functions | |
| static std::string | fact_to_string (const FactType &fact) |
| Convert dataflow fact to a string. More... | |
Static Public Attributes | |
| static const unsigned | MAX_BLOCKS = 1024 |
| We assume there won't be more than this many basic blocks. | |
An instance of Dataflow performs a dataflow analysis on the basic blocks of a control flow graph and provides an interface for querying dataflow facts at arbitrary points.
The Analysis object (instance of the Analysis type parameter) provides the concrete details about how the analysis is performed:
etc.
| Analysis | the analysis class, derived from either ForwardAnalysis or BackwardAnalysis |
Data type representing a dataflow fact.
Inferred from the Analysis type.
| Dataflow< Analysis >::Dataflow | ( | const std::shared_ptr< ControlFlowGraph > & | cfg | ) |
Constructor.
| the | ControlFlowGraph to analyze |
|
static |
Convert dataflow fact to a string.
| fact | a dataflow fact |
| Dataflow< Analysis >::FactType Dataflow< Analysis >::get_fact_after_instruction | ( | std::shared_ptr< InstructionSequence > | bb, |
| Instruction * | ins | ||
| ) | const |
Get dataflow fact at the location immediately after the specified instruction (in program order).
| bb | the basic block |
| ins | pointer to an Instruction in the basic block |
| const Dataflow< Analysis >::FactType & Dataflow< Analysis >::get_fact_at_beginning_of_block | ( | std::shared_ptr< InstructionSequence > | bb | ) | const |
Get dataflow fact at beginning of specific block.
| bb | the basic block |
| const Dataflow< Analysis >::FactType & Dataflow< Analysis >::get_fact_at_end_of_block | ( | std::shared_ptr< InstructionSequence > | bb | ) | const |
Get dataflow fact at end of specified block.
| bb | the basic block |
| Dataflow< Analysis >::FactType Dataflow< Analysis >::get_fact_before_instruction | ( | std::shared_ptr< InstructionSequence > | bb, |
| Instruction * | ins | ||
| ) | const |
Get dataflow fact at the location immediately before the specified instruction (in program order).
| bb | the basic block |
| ins | pointer to an Instruction in the basic block |