|
Nearly CC
An educational compiler skeleton
|
Base class for ControlFlowGraphTransform transformations. More...
#include "cfg_transform.h"

Public Member Functions | |
| ControlFlowGraphTransform (const std::shared_ptr< ControlFlowGraph > &cfg) | |
| Constructor. More... | |
| std::shared_ptr< ControlFlowGraph > | get_orig_cfg () |
| Get a shared pointer to the original ControlFlowGraph. More... | |
| virtual std::shared_ptr< ControlFlowGraph > | transform_cfg () |
| Transform the original ControlFlowGraph. More... | |
| virtual std::shared_ptr< InstructionSequence > | transform_basic_block (std::shared_ptr< InstructionSequence > orig_bb)=0 |
| Create a transformed version of the instructions in a basic block. More... | |
Base class for ControlFlowGraphTransform transformations.
This is the preferred way to implement local optimizations. In general, implementations of ControlFlowGraphTransform are intended to be nondestructive, meaning that they return a new result ControlFlowGraph without modifying the original one.
| ControlFlowGraphTransform::ControlFlowGraphTransform | ( | const std::shared_ptr< ControlFlowGraph > & | cfg | ) |
Constructor.
| cfg | the ControlFlowGraph to transform |
| std::shared_ptr< ControlFlowGraph > ControlFlowGraphTransform::get_orig_cfg | ( | ) |
Get a shared pointer to the original ControlFlowGraph.
|
pure virtual |
Create a transformed version of the instructions in a basic block.
Note that an InstructionSequence "owns" the Instruction objects it contains, and is responsible for deleting them. Therefore, be careful to avoid having two InstructionSequences contain pointers to the same Instruction. If you need to make an exact copy of an Instruction object, you can do so using the duplicate() member function, as follows:
| orig_bb | the original basic block |
Implemented in PeepholeLowLevel.
|
virtual |
Transform the original ControlFlowGraph.