Nearly CC
An educational compiler skeleton
Public Member Functions | List of all members
PeepholeLowLevel Class Reference
Inheritance diagram for PeepholeLowLevel:
Inheritance graph
[legend]
Collaboration diagram for PeepholeLowLevel:
Collaboration graph
[legend]

Public Member Functions

 PeepholeLowLevel (const std::shared_ptr< ControlFlowGraph > &cfg)
 
virtual std::shared_ptr< InstructionSequencetransform_basic_block (std::shared_ptr< InstructionSequence > orig_bb)
 Create a transformed version of the instructions in a basic block. More...
 
int get_num_matched () const
 
std::shared_ptr< ControlFlowGraphget_orig_cfg ()
 Get a shared pointer to the original ControlFlowGraph. More...
 
virtual std::shared_ptr< ControlFlowGraphtransform_cfg ()
 Transform the original ControlFlowGraph. More...
 

Member Function Documentation

◆ get_orig_cfg()

std::shared_ptr< ControlFlowGraph > ControlFlowGraphTransform::get_orig_cfg ( )
inherited

Get a shared pointer to the original ControlFlowGraph.

Returns
the original ControlFlowGraph

◆ transform_basic_block()

std::shared_ptr< InstructionSequence > PeepholeLowLevel::transform_basic_block ( std::shared_ptr< InstructionSequence orig_bb)
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:

Instruction *orig_ins = // ...an Instruction object...
Instruction *dup_ins = orig_ins->duplicate();
Instruction object type.
Definition: instruction.h:31
Instruction * duplicate() const
Return an exact duplicate of this Instruction.
Definition: instruction.h:69
Parameters
orig_bbthe original basic block
Returns
shared pointer to the new basic block InstructionSequence

Implements ControlFlowGraphTransform.

◆ transform_cfg()

std::shared_ptr< ControlFlowGraph > ControlFlowGraphTransform::transform_cfg ( )
virtualinherited

Transform the original ControlFlowGraph.

Returns
shared pointer to the transformed ControlFlowGraph

The documentation for this class was generated from the following files: